pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] rev 2309 - in trunk/src: . actions


From: Ingo Ruhnke
Subject: [Pingus-CVS] rev 2309 - in trunk/src: . actions
Date: Fri, 07 May 2004 00:07:34 +0200

Author: grumbel
Date: 2004-05-07 00:07:34 +0200 (Fri, 07 May 2004)
New Revision: 2309

Modified:
   trunk/src/actions/bomber.cxx
   trunk/src/actions/bridger.cxx
   trunk/src/actions/digger.cxx
   trunk/src/actions/walker.cxx
   trunk/src/col_map.cxx
   trunk/src/col_map.hxx
   trunk/src/spot_map.cxx
   trunk/src/spot_map.hxx
Log:
- colmap seems to work

Modified: trunk/src/actions/bomber.cxx
===================================================================
--- trunk/src/actions/bomber.cxx        2004-05-06 20:57:36 UTC (rev 2308)
+++ trunk/src/actions/bomber.cxx        2004-05-06 22:07:34 UTC (rev 2309)
@@ -125,14 +125,12 @@
   if (sprite.get_frame () >= 13 && !colmap_exploded)
     {
       colmap_exploded = true;
-#ifdef CLANLIB_0_6
-      WorldObj::get_world()->get_colmap()->remove(bomber_radius,
+      
WorldObj::get_world()->get_colmap()->remove(bomber_radius.get_pixeldata(),
                                                   
static_cast<int>(pingu->get_x () - (bomber_radius.get_width()/2)),
                                                   
static_cast<int>(pingu->get_y () - 16 - (bomber_radius.get_width()/2)));
-      WorldObj::get_world()->get_gfx_map()->remove(bomber_radius_gfx,
+      
WorldObj::get_world()->get_gfx_map()->remove(bomber_radius_gfx.get_pixeldata(),
                                                    
static_cast<int>(pingu->get_x () - (bomber_radius.get_width()/2)),
                                                    
static_cast<int>(pingu->get_y () - 16 - (bomber_radius.get_width()/2)));
-#endif
     }
 
 

Modified: trunk/src/actions/bridger.cxx
===================================================================
--- trunk/src/actions/bridger.cxx       2004-05-06 20:57:36 UTC (rev 2308)
+++ trunk/src/actions/bridger.cxx       2004-05-06 22:07:34 UTC (rev 2309)
@@ -234,29 +234,26 @@
   if (bricks < 4)
     Sound::PingusSound::play_sound("ting");
 
-#ifdef CLANLIB_0_6
-
   if (pingu->direction.is_right())
     {
-      WorldObj::get_world()->get_colmap()->put(brick_r,
+      WorldObj::get_world()->get_colmap()->put(brick_r.get_pixeldata(),
                                               static_cast<int>(pingu->get_x() 
+ 10 - brick_r.get_width()),
                                               static_cast<int>(pingu->get_y()),
                                               Groundtype::GP_BRIDGE);
-      WorldObj::get_world()->get_gfx_map()->put(brick_r,
+      WorldObj::get_world()->get_gfx_map()->put(brick_r.get_pixeldata(),
                                                static_cast<int>(pingu->get_x() 
+ 10 - brick_r.get_width()),
                                                
static_cast<int>(pingu->get_y()));
     }
   else
     {
-      WorldObj::get_world()->get_colmap()->put(brick_r,
+      WorldObj::get_world()->get_colmap()->put(brick_r.get_pixeldata(),
                                               static_cast<int>(pingu->get_x() 
- 10),
                                               static_cast<int>(pingu->get_y()),
                                               Groundtype::GP_BRIDGE);
-      WorldObj::get_world()->get_gfx_map()->put(brick_l,
+      WorldObj::get_world()->get_gfx_map()->put(brick_l.get_pixeldata(),
                                                static_cast<int>(pingu->get_x() 
- 10),
                                                
static_cast<int>(pingu->get_y()));
     }
-#endif
 }
 
 void

Modified: trunk/src/actions/digger.cxx
===================================================================
--- trunk/src/actions/digger.cxx        2004-05-06 20:57:36 UTC (rev 2308)
+++ trunk/src/actions/digger.cxx        2004-05-06 22:07:34 UTC (rev 2309)
@@ -99,14 +99,12 @@
 void
 Digger::dig ()
 {
-#ifdef CLANLIB_0_6
-  WorldObj::get_world()->get_colmap()->remove(digger_radius,
+  WorldObj::get_world()->get_colmap()->remove(digger_radius.get_pixeldata(),
                                              static_cast<int>(pingu->get_x() - 
(digger_radius_width / 2)),
                                              static_cast<int>(pingu->get_y() - 
digger_radius_height + 2));
-  WorldObj::get_world()->get_gfx_map()->remove(digger_radius_gfx,
+  
WorldObj::get_world()->get_gfx_map()->remove(digger_radius_gfx.get_pixeldata(),
                                               static_cast<int>(pingu->get_x () 
- (digger_radius_gfx_width / 2)),
                                               static_cast<int>(pingu->get_y() 
- digger_radius_gfx_height + 2));
-#endif
   pingu->set_y(pingu->get_y() + 1);
 }
 

Modified: trunk/src/actions/walker.cxx
===================================================================
--- trunk/src/actions/walker.cxx        2004-05-06 20:57:36 UTC (rev 2308)
+++ trunk/src/actions/walker.cxx        2004-05-06 22:07:34 UTC (rev 2309)
@@ -216,7 +216,7 @@
       floaterlayer.set_direction(Sprite::RIGHT);
     }
 
-  gc.draw (walker, pingu->get_pos() + Vector (0, +2));
+  gc.draw(walker, pingu->get_pos() + Vector (0, +2));
 
   if (pingu->get_fall_action() && pingu->get_fall_action()->get_type() == 
Actions::Floater)
     {

Modified: trunk/src/col_map.cxx
===================================================================
--- trunk/src/col_map.cxx       2004-05-06 20:57:36 UTC (rev 2308)
+++ trunk/src/col_map.cxx       2004-05-06 22:07:34 UTC (rev 2309)
@@ -77,7 +77,7 @@
 }
 
 void
-ColMap::remove(CL_PixelBuffer& provider, int x, int y)
+ColMap::remove(CL_PixelBuffer provider, int x, int y)
 {
   ++serial;
 

Modified: trunk/src/col_map.hxx
===================================================================
--- trunk/src/col_map.hxx       2004-05-06 20:57:36 UTC (rev 2308)
+++ trunk/src/col_map.hxx       2004-05-06 22:07:34 UTC (rev 2309)
@@ -82,7 +82,7 @@
   void put(CL_PixelBuffer, int x, int y, Groundtype::GPType);
 
   /// void remove(int x, int y);
-  void remove(CL_PixelBuffer&, int x, int y);
+  void remove(CL_PixelBuffer, int x, int y);
 
   void draw(GraphicContext& gc);
 

Modified: trunk/src/spot_map.cxx
===================================================================
--- trunk/src/spot_map.cxx      2004-05-06 20:57:36 UTC (rev 2308)
+++ trunk/src/spot_map.cxx      2004-05-06 22:07:34 UTC (rev 2309)
@@ -18,6 +18,7 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include <stdio.h>
+#include <iostream>
 #include <ClanLib/Display/pixel_buffer.h>
 #include <ClanLib/Display/pixel_format.h>
 #include "gui/graphic_context.hxx"
@@ -65,10 +66,10 @@
 }
 
 void
-MapTileSurface::reload(void)
+MapTileSurface::reload()
 {
-  CL_PixelBuffer buf = surface.get_pixeldata();
-  surface = CL_Surface(new CL_PixelBuffer(buf), true);
+  std::cout << "Reload" << std::endl;
+  surface = CL_Surface(new CL_PixelBuffer(buffer), true);
 }
 
 void
@@ -229,7 +230,7 @@
 }
 
 void
-PingusSpotMap::remove(const CL_PixelBuffer& sprovider, int x, int y)
+PingusSpotMap::remove(CL_PixelBuffer sprovider, int x, int y)
 {
   // Get the start tile and end tile
   int start_x = Math::max(x / tile_size, 0);
@@ -245,7 +246,7 @@
        {
          if (!tile[ix][iy].is_empty())
            {
-              CL_PixelBuffer target    = tile[ix][iy].surface.get_pixeldata();
+              CL_PixelBuffer target    = tile[ix][iy].buffer;
               CL_PixelBuffer sprovider = sprovider;
              put_alpha_surface(target,
                                sprovider,
@@ -260,7 +261,7 @@
 }
 
 void
-PingusSpotMap::put_alpha_surface(CL_PixelBuffer& provider, CL_PixelBuffer& 
sprovider,
+PingusSpotMap::put_alpha_surface(CL_PixelBuffer provider, CL_PixelBuffer 
sprovider,
                                 int x, int y, int real_x_arg, int real_y_arg)
 {
   int start_i;
@@ -358,7 +359,7 @@
 }
 
 void
-PingusSpotMap::put(const CL_PixelBuffer& sprovider, int x, int y)
+PingusSpotMap::put(CL_PixelBuffer sprovider, int x, int y)
 {
   // Get the start tile and end tile
   int start_x = x / tile_size;
@@ -383,26 +384,24 @@
          if (tile[ix][iy].surface == 0)
            {
              CL_PixelBuffer canvas(tile_size, tile_size, tile_size * 4, 
CL_PixelFormat::rgba8888);
-
+              
              Blitter::clear_canvas(canvas);
 
              Blitter::put_surface(canvas, sprovider,
                                   x - (ix * tile_size), y - (iy * tile_size));
 
-             tile[ix][iy].surface = CL_Surface (new CL_PixelBuffer(canvas), 
true);
+             tile[ix][iy].buffer = canvas;
+             tile[ix][iy].reload();
            }
          else
            {
-              CL_PixelBuffer target = tile[ix][iy].surface.get_pixeldata();
+              CL_PixelBuffer target = tile[ix][iy].buffer;
              Blitter::put_surface(target,
                                   sprovider,
                                   x - (ix * tile_size), y - (iy * tile_size));
+              tile[ix][iy].reload();
            }
-         /*
-           CL_Surface s = CL_Surface::create(sprovider);
-         s->put_target(x - (ix * tile_size), y - (iy * tile_size), 0,
-                       tile[ix][iy].surface->get_provider());*/
-         tile[ix][iy].reload();
+
          tile[ix][iy].set_empty(false);
        }
     }

Modified: trunk/src/spot_map.hxx
===================================================================
--- trunk/src/spot_map.hxx      2004-05-06 20:57:36 UTC (rev 2308)
+++ trunk/src/spot_map.hxx      2004-05-06 22:07:34 UTC (rev 2309)
@@ -22,6 +22,7 @@
 #define HEADER_PINGUS_SPOT_MAP_HXX
 
 #include <vector>
+#include <ClanLib/Display/pixel_buffer.h>
 #include "globals.hxx"
 #include "pingu_map.hxx"
 #include "worldobjsdata/groundpiece_data.hxx"
@@ -37,8 +38,10 @@
 {
 private:
   bool empty;
+
 public:
-  CL_Surface surface;
+  CL_Surface     surface;
+  CL_PixelBuffer buffer;
 
   MapTileSurface ();
   virtual ~MapTileSurface ();
@@ -46,7 +49,9 @@
   MapTileSurface (const MapTileSurface& old);
   MapTileSurface& operator= (const MapTileSurface& old);
 
-  void reload (void);
+  CL_Surface get_surface() const { return surface; }
+  void reload ();
+
   inline bool is_empty (void) { return empty; }
   void mark_dirty (void);
   void check_empty (void);
@@ -84,18 +89,18 @@
   int  get_width();
 
   /** Put the gives surface provider onto the given coordinates */
-  void put(const CL_PixelBuffer&, int x, int y);
+  void put(CL_PixelBuffer, int x, int y);
 
   /** Remove the gives surface provider onto the given coordinates
       (everything non-transparent is removed from the map) */
-  void remove(const CL_PixelBuffer&, int x, int y);
+  void remove(CL_PixelBuffer, int x, int y);
 
   float get_z_pos () const { return 0; }
 
 private:
   /** Low level version of the remove() call, acts on a single canvas
       instead on the complete map-tiles */
-  void put_alpha_surface(CL_PixelBuffer& provider, CL_PixelBuffer& sprovider,
+  void put_alpha_surface(CL_PixelBuffer provider, CL_PixelBuffer sprovider,
                         int x, int y, int real_x, int real_y);
 
   /** Draw the collision map onto the screen */





reply via email to

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