pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r2676 - in branches/pingus_sdl/src: . particles worldobjs


From: grumbel at BerliOS
Subject: [Pingus-CVS] r2676 - in branches/pingus_sdl/src: . particles worldobjs
Date: Wed, 17 Jan 2007 14:16:57 +0100

Author: grumbel
Date: 2007-01-17 14:16:56 +0100 (Wed, 17 Jan 2007)
New Revision: 2676

Modified:
   branches/pingus_sdl/src/SConscript
   branches/pingus_sdl/src/collider.cxx
   branches/pingus_sdl/src/collision_mask.cpp
   branches/pingus_sdl/src/collision_mask.hpp
   branches/pingus_sdl/src/fps_counter.cxx
   branches/pingus_sdl/src/fps_counter.hxx
   branches/pingus_sdl/src/ground_map.cxx
   branches/pingus_sdl/src/ground_map.hxx
   branches/pingus_sdl/src/particles/explosive_particle.cxx
   branches/pingus_sdl/src/particles/explosive_particle.hxx
   branches/pingus_sdl/src/particles/snow_particle_holder.cxx
   branches/pingus_sdl/src/pixel_buffer.cpp
   branches/pingus_sdl/src/pixel_buffer.hpp
   branches/pingus_sdl/src/resource.cxx
   branches/pingus_sdl/src/sprite.cpp
   branches/pingus_sdl/src/sprite.hpp
   branches/pingus_sdl/src/world.cxx
   branches/pingus_sdl/src/world.hxx
   branches/pingus_sdl/src/worldobjs/groundpiece.cxx
   branches/pingus_sdl/src/worldobjs/ice_block.cxx
   branches/pingus_sdl/src/worldobjs/liquid.cxx
Log:
- some fixes to the map loading, map now loads and displays, still buggy however

Modified: branches/pingus_sdl/src/SConscript
===================================================================
--- branches/pingus_sdl/src/SConscript  2007-01-17 10:25:43 UTC (rev 2675)
+++ branches/pingus_sdl/src/SConscript  2007-01-17 13:16:56 UTC (rev 2676)
@@ -141,7 +141,7 @@
 'fonts.cxx',
 'font.cpp',
 'sprite.cpp',
-#'fps_counter.cxx', 
+'fps_counter.cxx', 
 'game_session.cxx', 
 'game_session_result.cxx', 
 'game_time.cxx', 

Modified: branches/pingus_sdl/src/collider.cxx
===================================================================
--- branches/pingus_sdl/src/collider.cxx        2007-01-17 10:25:43 UTC (rev 
2675)
+++ branches/pingus_sdl/src/collider.cxx        2007-01-17 13:16:56 UTC (rev 
2676)
@@ -43,7 +43,7 @@
 int Collider::getpixel(World* const world, const Vector3f& pos) const
 {
   return world->get_colmap()->getpixel(static_cast<int>(pos.x),
-                                       static_cast<int>(pos.y));
+                                       static_cast<int>(pos.y));
 }
 
 /* EOF */

Modified: branches/pingus_sdl/src/collision_mask.cpp
===================================================================
--- branches/pingus_sdl/src/collision_mask.cpp  2007-01-17 10:25:43 UTC (rev 
2675)
+++ branches/pingus_sdl/src/collision_mask.cpp  2007-01-17 13:16:56 UTC (rev 
2676)
@@ -23,6 +23,8 @@
 **  02111-1307, USA.
 */
 
+#include <iostream>
+#include "resource.hxx"
 #include "collision_mask.hpp"
 
 CollisionMask::CollisionMask()
@@ -30,6 +32,12 @@
 
 }
 
+CollisionMask::CollisionMask(const std::string& name)
+{
+  std::cout << "CollisionMask: " << name << std::endl;
+  pixelbuffer = Resource::load_pixelbuffer(name);
+}
+
 CollisionMask::~CollisionMask()
 {
 }  
@@ -37,13 +45,19 @@
 int
 CollisionMask::get_width() const
 {
-  return 0;
+  return pixelbuffer.get_width();
 }
 
 int
 CollisionMask::get_height() const
 {
-  return 0;
+  return pixelbuffer.get_height();
 }
 
+PixelBuffer
+CollisionMask::get_pixelbuffer() const
+{
+  return pixelbuffer;
+}
+
 /* EOF */

Modified: branches/pingus_sdl/src/collision_mask.hpp
===================================================================
--- branches/pingus_sdl/src/collision_mask.hpp  2007-01-17 10:25:43 UTC (rev 
2675)
+++ branches/pingus_sdl/src/collision_mask.hpp  2007-01-17 13:16:56 UTC (rev 
2676)
@@ -26,16 +26,24 @@
 #ifndef HEADER_COLLISION_MASK_HPP
 #define HEADER_COLLISION_MASK_HPP
 
+#include <string>
+#include "pixel_buffer.hpp"
+
 /** */
 class CollisionMask
 {
-private:
 public:
+  PixelBuffer pixelbuffer;
+
+public:
   CollisionMask();
+  CollisionMask(const std::string& name);
   ~CollisionMask();
   
   int get_width() const;
   int get_height() const;
+  
+  PixelBuffer get_pixelbuffer() const;
 };
 
 #endif

Modified: branches/pingus_sdl/src/fps_counter.cxx
===================================================================
--- branches/pingus_sdl/src/fps_counter.cxx     2007-01-17 10:25:43 UTC (rev 
2675)
+++ branches/pingus_sdl/src/fps_counter.cxx     2007-01-17 13:16:56 UTC (rev 
2676)
@@ -18,9 +18,6 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include <stdio.h>
-#include <ClanLib/Core/System/system.h>
-#include <ClanLib/Display/display.h>
-#include <ClanLib/Display/font.h>
 #include "fonts.hxx"
 #include "fps_counter.hxx"
 #include "gettext.h"
@@ -34,7 +31,7 @@
 
 FPSCounter::~FPSCounter()
 {
-       font = CL_Font();
+       font = Font();
 }
 
 // We are not initialising the fpscounter in the constructor, 'cause
@@ -44,7 +41,7 @@
 {
   font = Fonts::pingus_small;
   font.set_alignment(origin_top_right);
-  start_time = CL_System::get_time();
+  start_time = SDL_GetTicks();
   strcat(fps_string, _("unknown"));
   fps_count = 0;
 }
@@ -53,7 +50,7 @@
 // we unload all of our resources.
 void FPSCounter::deinit()
 {
-       font = CL_Font();
+  font = Font();
 }
 
 void
@@ -63,8 +60,8 @@
 
   if (odd_frame)
     {
-      font.draw(CL_Display::get_width(),
-                CL_Display::get_height() - (2 * font.get_height()),
+      font.draw(Display::get_width(),
+                Display::get_height() - (2 * font.get_height()),
                 "o");
 
       odd_frame = false;
@@ -74,15 +71,15 @@
       odd_frame = true;
     }
 
-  font.draw(CL_Display::get_width(),
-            CL_Display::get_height() - font.get_height(),
+  font.draw(Display::get_width(),
+            Display::get_height() - font.get_height(),
             fps_string);
 }
 
 void
 FPSCounter::update_fps_counter()
 {
-  unsigned int current_time = CL_System::get_time();
+  unsigned int current_time = SDL_GetTicks();
   int current_fps;
 
   fps_count++;
@@ -92,7 +89,7 @@
       current_fps = fps_count * 1000 / (current_time - start_time);
       snprintf(fps_string, 16, "%d fps", current_fps);
       fps_count = 0;
-      start_time = CL_System::get_time();
+      start_time = SDL_GetTicks();
     }
 }
 

Modified: branches/pingus_sdl/src/fps_counter.hxx
===================================================================
--- branches/pingus_sdl/src/fps_counter.hxx     2007-01-17 10:25:43 UTC (rev 
2675)
+++ branches/pingus_sdl/src/fps_counter.hxx     2007-01-17 13:16:56 UTC (rev 
2676)
@@ -28,7 +28,7 @@
 {
 private:
   /** The font... */
-  CL_Font font;
+  Font font;
 
   /** Used to know when the frame has changed */
   bool odd_frame;

Modified: branches/pingus_sdl/src/ground_map.cxx
===================================================================
--- branches/pingus_sdl/src/ground_map.cxx      2007-01-17 10:25:43 UTC (rev 
2675)
+++ branches/pingus_sdl/src/ground_map.cxx      2007-01-17 13:16:56 UTC (rev 
2676)
@@ -46,6 +46,10 @@
       Blitter::clear_canvas(pixelbuffer);
     }
 #endif
+  if (!pixelbuffer)
+    {
+      pixelbuffer = PixelBuffer(tile_size, tile_size);
+    }
 }
 
 void
@@ -69,6 +73,9 @@
   Blitter::put_surface(pixelbuffer, obj, x, y);
   surface = CL_Surface(pixelbuffer);
 #endif
+  prepare();
+  pixelbuffer.blit(obj, x, y);
+  sprite = Sprite(pixelbuffer);
 }
 
 GroundMap::GroundMap(const PingusLevel& plf)
@@ -138,10 +145,11 @@
       for (int x = start_x; x <= (start_x + tilemap_width) && x < 
int(tile.size()); ++x)
         for (int y = start_y; y <= start_y + tilemap_height && y < 
int(tile[x].size()); ++y)
           {
-            if (tile[x][y].get_surface())
+            if (tile[x][y].get_sprite())
               {
-                ////gc.color().draw(tile[x][y].get_surface(),
-                ////Vector3f((x * tile_size, y * tile_size)));
+                //std::cout << "Drawing GroundMap Tile " << std::endl;
+                gc.color().draw(tile[x][y].get_sprite(),
+                                Vector3f(x * tile_size, y * tile_size));
               }
             else
               {
@@ -273,18 +281,20 @@
 }
 
 void
-GroundMap::put(PixelBuffer sprovider, int x, int y)
+GroundMap::put(PixelBuffer source, int x, int y)
 {
   // Get the start tile and end tile
   int start_x = std::max(0, x / tile_size);
   int start_y = std::max(0, y / tile_size);
-  int end_x   = std::min(tile_width,  (x + sprovider.get_width())  / tile_size 
+ 1);
-  int end_y   = std::min(tile_height, (y + sprovider.get_height()) / tile_size 
+ 1);
+  int end_x   = std::min(tile_width,  (x + source.get_width())  / tile_size + 
1);
+  int end_y   = std::min(tile_height, (y + source.get_height()) / tile_size + 
1);
 
+  //std::cout << "GroundMap:put: " << source.get_width() << "x" << 
source.get_height() << std::endl;
+
   for(int ix = start_x; ix < end_x; ++ix)
     for(int iy = start_y; iy < end_y; ++iy)
       {
-        tile[ix][iy].put(sprovider,
+        tile[ix][iy].put(source,
                          x - (ix * tile_size), y - (iy * tile_size));
       }
 }

Modified: branches/pingus_sdl/src/ground_map.hxx
===================================================================
--- branches/pingus_sdl/src/ground_map.hxx      2007-01-17 10:25:43 UTC (rev 
2675)
+++ branches/pingus_sdl/src/ground_map.hxx      2007-01-17 13:16:56 UTC (rev 
2676)
@@ -35,7 +35,7 @@
 class MapTile
 {
 private:
-  SDL_Surface* surface;
+  Sprite       sprite;
   PixelBuffer  pixelbuffer;
 
   void prepare();
@@ -46,7 +46,7 @@
   void remove(PixelBuffer, int x, int y, int real_x, int real_y, GroundMap*);  
   void put(PixelBuffer, int x, int y);  
 
-  SDL_Surface* get_surface() const { return surface; }
+  Sprite get_sprite() const { return sprite; }
 };
 
 /** This map type is the defaulh maptype, it is should be used for the

Modified: branches/pingus_sdl/src/particles/explosive_particle.cxx
===================================================================
--- branches/pingus_sdl/src/particles/explosive_particle.cxx    2007-01-17 
10:25:43 UTC (rev 2675)
+++ branches/pingus_sdl/src/particles/explosive_particle.cxx    2007-01-17 
13:16:56 UTC (rev 2676)
@@ -71,16 +71,12 @@
 ExplosiveParticle::detonate ()
 {
   alive = false;
-  CL_PixelBuffer bomber_radius = 
Resource::load_surface_provider("Other/bomber_radius", "pingus");
   WorldObj::get_world()->get_particle_holder ()->add_pingu_explo((int)pos.x, 
(int)pos.y);
 
-  // FIXME: Ugly do handle the colmap and the gfx map seperatly
-  WorldObj::get_world()->get_colmap()->remove(bomber_radius,
-                             int(pos.x) - (bomber_radius.get_width()/2),
-                             int(pos.y) - (bomber_radius.get_height()/2));
-  WorldObj::get_world()->get_gfx_map()->remove(bomber_radius,
-                              int(pos.x) - (bomber_radius.get_width()/2),
-                              int(pos.y) - (bomber_radius.get_height()/2));
+  CollisionMask mask = Resource::load_collision_mask("Other/bomber_radius", 
"pingus");
+  WorldObj::get_world()->remove(mask,
+                                int(pos.x) - (bomber_radius.get_width()/2),
+                                int(pos.y) - (bomber_radius.get_height()/2));
 }
 
 //void

Modified: branches/pingus_sdl/src/particles/explosive_particle.hxx
===================================================================
--- branches/pingus_sdl/src/particles/explosive_particle.hxx    2007-01-17 
10:25:43 UTC (rev 2675)
+++ branches/pingus_sdl/src/particles/explosive_particle.hxx    2007-01-17 
13:16:56 UTC (rev 2676)
@@ -23,7 +23,6 @@
 #include "../sprite.hxx"
 #include "particle.hxx"
 
-
 class ExplosiveParticle
   : public Particle
 {

Modified: branches/pingus_sdl/src/particles/snow_particle_holder.cxx
===================================================================
--- branches/pingus_sdl/src/particles/snow_particle_holder.cxx  2007-01-17 
10:25:43 UTC (rev 2675)
+++ branches/pingus_sdl/src/particles/snow_particle_holder.cxx  2007-01-17 
13:16:56 UTC (rev 2676)
@@ -109,7 +109,7 @@
             && pixel != Groundtype::GP_WATER
            && pixel != Groundtype::GP_OUTOFSCREEN)
            {
-             world->get_gfx_map()->put(ground, static_cast<int>(it->pos.x - 
1), static_cast<int>(it->pos.y - 1));
+             world->put(ground, static_cast<int>(it->pos.x - 1), 
static_cast<int>(it->pos.y - 1));
              it->alive = false;
            }
        }

Modified: branches/pingus_sdl/src/pixel_buffer.cpp
===================================================================
--- branches/pingus_sdl/src/pixel_buffer.cpp    2007-01-17 10:25:43 UTC (rev 
2675)
+++ branches/pingus_sdl/src/pixel_buffer.cpp    2007-01-17 13:16:56 UTC (rev 
2676)
@@ -23,22 +23,110 @@
 **  02111-1307, USA.
 */
 
+#include "SDL_image.h"
+#include <sstream>
+#include <iostream>
 #include "pixel_buffer.hpp"
 
 PixelBuffer::PixelBuffer()
+  : surface(0)
 {
 }
 
-PixelBuffer::PixelBuffer(int width_, int height_)
-  : width(width_),
-    height(height_)
+PixelBuffer::PixelBuffer(const std::string& name_)
 {
-  data = new unsigned char[4 * width * height];
+  std::ostringstream str;
+  str << "data/images/" << name_ << ".png";
+  std::string name = str.str();
+  surface = IMG_Load(name.c_str());
+  if (surface)
+    std::cout << "Loaded pixelbuffer: " << name << ": " << surface->w << "x" 
<< surface->h << std::endl;
+  else
+    std::cout << "XXXXXX Failed to load: " << name << std::endl;
 }
 
+PixelBuffer::PixelBuffer(int width, int height)
+{
+  surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32,
+                                 0x000000ff,
+                                 0x0000ff00,
+                                 0x00ff0000,
+                                 0xff000000);
+  SDL_FillRect(surface, NULL, SDL_MapRGBA(surface->format, 255, 0, 0, 255));
+}
+
 PixelBuffer::~PixelBuffer()
 {
-  delete[] data;
+  ////delete[] data;
 }
 
+void
+PixelBuffer::blit(const PixelBuffer& src, int x, int y)
+{
+  if (!surface)
+    {
+      std::cout << "PixelBuffer: Trying to blit to empty surface" << std::endl;
+    }
+  else if (!src.surface)
+    {
+      std::cout << "PixelBuffer: Trying to blit with an empty surface" << 
std::endl;
+    }
+  else
+    {
+      SDL_Rect dstrect;
+
+      dstrect.x = x;
+      dstrect.y = y;
+
+      SDL_BlitSurface(src.surface, NULL, surface, &dstrect);
+    }
+}
+
+void
+PixelBuffer::lock()
+{
+  SDL_LockSurface(surface);
+}
+
+void
+PixelBuffer::unlock()
+{
+  SDL_UnlockSurface(surface);
+}
+
+uint8_t*
+PixelBuffer::get_data() const
+{
+  return static_cast<uint8_t*>(surface->pixels);
+}
+
+int
+PixelBuffer::get_width()  const
+{
+  if (surface)
+    return surface->w;
+  else
+    return 0;
+}
+
+int
+PixelBuffer::get_height() const
+{
+  if (surface)
+    return surface->h;
+  else
+    return 0;
+}
+
+SDL_Surface* 
+PixelBuffer::get_surface() const
+{
+  return surface;
+}
+
+PixelBuffer::operator bool() const
+{
+  return surface;
+}
+
 /* EOF */

Modified: branches/pingus_sdl/src/pixel_buffer.hpp
===================================================================
--- branches/pingus_sdl/src/pixel_buffer.hpp    2007-01-17 10:25:43 UTC (rev 
2675)
+++ branches/pingus_sdl/src/pixel_buffer.hpp    2007-01-17 13:16:56 UTC (rev 
2676)
@@ -26,22 +26,33 @@
 #ifndef HEADER_PIXEL_BUFFER_HPP
 #define HEADER_PIXEL_BUFFER_HPP
 
+#include "SDL.h"
+#include <string>
+
 /** */
 class PixelBuffer
 {
 private:
-  int width;
-  int height;
-  unsigned char* data;
+  SDL_Surface* surface;
 
 public:
   PixelBuffer();
+  PixelBuffer(const std::string& name);
   PixelBuffer(int width, int height);
   ~PixelBuffer();
 
-  unsigned char* get_data() { return data; }
-  int get_width()  const { return width; }
-  int get_height() const { return height; }
+  uint8_t* get_data() const;
+  void lock();
+  void unlock();
+
+  int get_width()  const;
+  int get_height() const;
+
+  void blit(const PixelBuffer& source, int x, int y);
+
+  SDL_Surface* get_surface() const;
+
+  operator bool() const;
 };
 
 #endif

Modified: branches/pingus_sdl/src/resource.cxx
===================================================================
--- branches/pingus_sdl/src/resource.cxx        2007-01-17 10:25:43 UTC (rev 
2675)
+++ branches/pingus_sdl/src/resource.cxx        2007-01-17 13:16:56 UTC (rev 
2676)
@@ -133,15 +133,15 @@
 }
 
 CollisionMask
-Resource::load_collision_mask(const std::string& name_)
+Resource::load_collision_mask(const std::string& name)
 {
-  return CollisionMask();
+  return CollisionMask(name);
 }
 
 PixelBuffer
 Resource::load_pixelbuffer(const ResDescriptor& desc_)
 {
-  return PixelBuffer();
+  return PixelBuffer(desc_.res_name);
 #if 0
   CL_SpriteDescription desc = load_sprite_desc(desc_.res_name);
 
@@ -158,7 +158,7 @@
 PixelBuffer
 Resource::load_pixelbuffer(const std::string& res_name)
 {
-  return PixelBuffer();  ////load_pixelbuffer(ResDescriptor(res_name));
+  return load_pixelbuffer(ResDescriptor(res_name));
 }
 
 #if 0

Modified: branches/pingus_sdl/src/sprite.cpp
===================================================================
--- branches/pingus_sdl/src/sprite.cpp  2007-01-17 10:25:43 UTC (rev 2675)
+++ branches/pingus_sdl/src/sprite.cpp  2007-01-17 13:16:56 UTC (rev 2676)
@@ -31,6 +31,7 @@
 #include "math/vector2i.hpp"
 #include "SDL_image.h"
 #include "sprite.hpp"
+#include "pixel_buffer.hpp"
 #include "sprite_description.hpp"
 
 class SpriteImpl
@@ -55,6 +56,22 @@
     load(str.str());
   }
 
+  SpriteImpl(const PixelBuffer& pixelbuffer)
+  {
+    if (pixelbuffer.get_surface())
+      {
+        surface = SDL_DisplayFormat(pixelbuffer.get_surface());
+      }
+    else
+      {
+        surface = 0;
+        std::cout << "XXX Surface empty"  << std::endl;
+      }
+
+    offset = Vector2i(0,0);
+    origin = origin_top_left;
+  }
+
   void 
   load(const std::string& filename)
   {
@@ -67,9 +84,10 @@
       }
     else
       {
-        std::cout << "Loaded sprite: " << filename << std::endl;
+        //std::cout << "Loaded sprite: " << filename << std::endl;
       }
     
+    origin = origin_top_left;
     offset = calc_origin(origin, Size(surface->w, surface->h)) + offset;
   }
 
@@ -101,6 +119,12 @@
 {  
 }
 
+Sprite::Sprite(const PixelBuffer& pixelbuffer)
+  : impl(new SpriteImpl(pixelbuffer))
+{
+  
+}
+
 Sprite::Sprite(const SpriteDescription& desc)
   : impl(new SpriteImpl(desc))
 {

Modified: branches/pingus_sdl/src/sprite.hpp
===================================================================
--- branches/pingus_sdl/src/sprite.hpp  2007-01-17 10:25:43 UTC (rev 2675)
+++ branches/pingus_sdl/src/sprite.hpp  2007-01-17 13:16:56 UTC (rev 2676)
@@ -30,6 +30,7 @@
 #include "SDL.h"
 #include "shared_ptr.hxx"
 
+class PixelBuffer;
 class SpriteImpl;
 class SpriteDescription;
 
@@ -40,6 +41,7 @@
   Sprite();
   Sprite(const SpriteDescription& desc);
   Sprite(const std::string& name);
+  Sprite(const PixelBuffer& pixelbuffer);
   ~Sprite();
 
   int get_width();

Modified: branches/pingus_sdl/src/world.cxx
===================================================================
--- branches/pingus_sdl/src/world.cxx   2007-01-17 10:25:43 UTC (rev 2675)
+++ branches/pingus_sdl/src/world.cxx   2007-01-17 13:16:56 UTC (rev 2676)
@@ -217,12 +217,6 @@
   return colmap;
 }
 
-GroundMap*
-World::get_gfx_map ()
-{
-  return gfx_map;
-}
-
 void
 World::play_sound(std::string name, const Vector3f& pos, float volume)
 {
@@ -280,8 +274,9 @@
 }
 
 void
-World::put(const CollisionMask&, int x, int y, Groundtype::GPType)
+World::put(const CollisionMask& mask, int x, int y, Groundtype::GPType type)
 {
+  gfx_map->put(mask.get_pixelbuffer(), x, y);
 }
 
 void

Modified: branches/pingus_sdl/src/world.hxx
===================================================================
--- branches/pingus_sdl/src/world.hxx   2007-01-17 10:25:43 UTC (rev 2675)
+++ branches/pingus_sdl/src/world.hxx   2007-01-17 13:16:56 UTC (rev 2676)
@@ -126,9 +126,6 @@
   /** @return A pointer to the collision map used in this world */
   ColMap* get_colmap();
 
-  /** @return A pointer to the gfx map of this world */
-  GroundMap* get_gfx_map();
-
   void put(int x, int y, Groundtype::GPType p = Groundtype::GP_GROUND);
   void put(const CollisionMask&, int x, int y, Groundtype::GPType);
 

Modified: branches/pingus_sdl/src/worldobjs/groundpiece.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/groundpiece.cxx   2007-01-17 10:25:43 UTC 
(rev 2675)
+++ branches/pingus_sdl/src/worldobjs/groundpiece.cxx   2007-01-17 13:16:56 UTC 
(rev 2676)
@@ -34,6 +34,8 @@
   gptype = Groundtype::GP_GROUND;
   reader.read_enum("type", gptype, &Groundtype::string_to_type);
 
+  std::cout << "Groundpiece: " << desc.res_name << std::endl;
+
   // FIXME: we don't need to load surfaces here, providers would be
   // FIXME: enough and should be faster
 }
@@ -42,14 +44,15 @@
 Groundpiece::on_startup ()
 {
   //// FIXME: We discard rotation here!
-  CollisionMask surface = Resource::load_collision_mask(desc.res_name);
+  std::cout << "Groundpiece::on_startup" << std::endl;
+  CollisionMask mask = Resource::load_collision_mask(desc.res_name);
 
   // FIXME: overdrawing of bridges and similar things aren't handled
   // FIXME: here
   if (gptype == Groundtype::GP_REMOVE)
-    get_world()->remove(surface, static_cast<int>(pos.x), 
static_cast<int>(pos.y));
+    get_world()->remove(mask, static_cast<int>(pos.x), 
static_cast<int>(pos.y));
   else
-    get_world()->put(surface, static_cast<int>(pos.x), 
static_cast<int>(pos.y), gptype);
+    get_world()->put(mask, static_cast<int>(pos.x), static_cast<int>(pos.y), 
gptype);
 }
 
 } // namespace WorldObjs

Modified: branches/pingus_sdl/src/worldobjs/ice_block.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/ice_block.cxx     2007-01-17 10:25:43 UTC 
(rev 2675)
+++ branches/pingus_sdl/src/worldobjs/ice_block.cxx     2007-01-17 13:16:56 UTC 
(rev 2676)
@@ -88,9 +88,8 @@
          is_finished = true;
          thickness = 0;
 
-         PixelBuffer 
surf(Resource::load_pixelbuffer("worldobjs/iceblock_cmap"));
-         world->get_colmap ()->remove(surf, static_cast<int>(pos.x), 
static_cast<int>(pos.y));
-         world->get_gfx_map()->remove(surf, static_cast<int>(pos.x), 
static_cast<int>(pos.y));
+         CollisionMask mask = 
Resource::load_collision_mask("worldobjs/iceblock_cmap");
+         world->remove(mask, static_cast<int>(pos.x), static_cast<int>(pos.y));
          return;
        }
     }

Modified: branches/pingus_sdl/src/worldobjs/liquid.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/liquid.cxx        2007-01-17 10:25:43 UTC 
(rev 2675)
+++ branches/pingus_sdl/src/worldobjs/liquid.cxx        2007-01-17 13:16:56 UTC 
(rev 2676)
@@ -58,13 +58,13 @@
 void
 Liquid::on_startup ()
 {
-  PixelBuffer colmap_sur = Resource::load_pixelbuffer("liquids/water_cmap");
+  CollisionMask mask = Resource::load_collision_mask("liquids/water_cmap");
 
   for(int i=0; i < width; ++i)
-    world->get_colmap()->put(colmap_sur,
-                             static_cast<int>(pos.x + i),
-                            static_cast<int>(pos.y),
-                            Groundtype::GP_WATER);
+    world->put(mask,
+               static_cast<int>(pos.x + i),
+               static_cast<int>(pos.y),
+               Groundtype::GP_WATER);
 }
 
 void





reply via email to

[Prev in Thread] Current Thread [Next in Thread]