pingus-cvs
[Top][All Lists]
Advanced

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

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


From: grumbel at BerliOS
Subject: [Pingus-CVS] r2675 - in branches/pingus_sdl/src: . worldobjs
Date: Wed, 17 Jan 2007 11:25:44 +0100

Author: grumbel
Date: 2007-01-17 11:25:43 +0100 (Wed, 17 Jan 2007)
New Revision: 2675

Modified:
   branches/pingus_sdl/src/fonts.cxx
   branches/pingus_sdl/src/resource.cxx
   branches/pingus_sdl/src/resource.hxx
   branches/pingus_sdl/src/worldobj.hxx
   branches/pingus_sdl/src/worldobjs/conveyor_belt.cxx
   branches/pingus_sdl/src/worldobjs/groundpiece.cxx
   branches/pingus_sdl/src/worldobjs/ice_block.cxx
   branches/pingus_sdl/src/worldobjs/smasher.cxx
   branches/pingus_sdl/src/worldobjs/switch_door.cxx
   branches/pingus_sdl/src/worldobjs/switch_door.hxx
Log:
- replaced a bunch of PixelBuffer with CollisionMask

Modified: branches/pingus_sdl/src/fonts.cxx
===================================================================
--- branches/pingus_sdl/src/fonts.cxx   2007-01-17 10:15:39 UTC (rev 2674)
+++ branches/pingus_sdl/src/fonts.cxx   2007-01-17 10:25:43 UTC (rev 2675)
@@ -42,7 +42,6 @@
 void
 init ()
 {
-#if 0
   chalk_large  = Resource::load_font("fonts/chalk_large" + std::string(".") + 
encoding); 
   chalk_normal = Resource::load_font("fonts/chalk_normal" + std::string(".") + 
encoding);
   chalk_small  = Resource::load_font("fonts/chalk_small" + std::string(".") + 
encoding);
@@ -57,7 +56,6 @@
   smallfont_h  = Resource::load_font("fonts/courier_small" + std::string(".") 
+ encoding); // PingusResource::load_font("Fonts/smallfont_h","fonts");
 
   lcd          = Resource::load_font("fonts/courier_small" + std::string(".") 
+ encoding); // PingusResource::load_font("Fonts/numbers", "fonts");
-#endif 
 }
 
 void deinit () 

Modified: branches/pingus_sdl/src/resource.cxx
===================================================================
--- branches/pingus_sdl/src/resource.cxx        2007-01-17 10:15:39 UTC (rev 
2674)
+++ branches/pingus_sdl/src/resource.cxx        2007-01-17 10:25:43 UTC (rev 
2675)
@@ -132,20 +132,6 @@
 #endif
 }
 
-#if 0
-CL_SpriteDescription
-Resource::load_sprite_desc(const std::string& res_name)
-{
-  try {
-    return CL_SpriteDescription(res_name, &resmgr);
-  } catch(CL_Error& err) {
-    std::cout << "Resource::load_sprite_desc: CL_Error: '" << res_name << "'" 
<< std::endl;
-    std::cout << "CL_Error: " << err.message << std::endl;
-    return CL_SpriteDescription("core/misc/404sprite", &resmgr);
-  }
-}
-#endif
-
 CollisionMask
 Resource::load_collision_mask(const std::string& name_)
 {
@@ -321,13 +307,14 @@
     }
   }
 }
+#endif 
 
 Font
 Resource::load_font(const std::string& res_name)
 {
-  return Font(res_name, &resmgr);
+  ////return Font(res_name, &resmgr);
+  return Font();
 }
-#endif
 
 void
 Resource::cleanup ()

Modified: branches/pingus_sdl/src/resource.hxx
===================================================================
--- branches/pingus_sdl/src/resource.hxx        2007-01-17 10:15:39 UTC (rev 
2674)
+++ branches/pingus_sdl/src/resource.hxx        2007-01-17 10:25:43 UTC (rev 
2675)
@@ -27,6 +27,7 @@
 #include "res_descriptor.hxx"
 #include "resource_manager.hpp"
 #include "collision_mask.hpp"
+#include "font.hpp"
 
 class CL_ResourceManager;
 
@@ -77,13 +78,9 @@
   static PixelBuffer   load_pixelbuffer(const std::string& res_name);
   static PixelBuffer   load_pixelbuffer(const ResDescriptor&);
 
-#if 0
-  static CL_Sprite  load_sprite(const std::string& res_name);
-  static CL_SpriteDescription load_sprite_desc(const std::string& res_name);
-
   /** Load a font with res_name from datafile */
-  static CL_Font load_font(const std::string& res_name);
-#endif
+  static Font load_font(const std::string& res_name);
+
   /** Cleanup all currently unused surfaces */
   static void cleanup ();
 

Modified: branches/pingus_sdl/src/worldobj.hxx
===================================================================
--- branches/pingus_sdl/src/worldobj.hxx        2007-01-17 10:15:39 UTC (rev 
2674)
+++ branches/pingus_sdl/src/worldobj.hxx        2007-01-17 10:25:43 UTC (rev 
2675)
@@ -23,6 +23,7 @@
 #include "pingus.hxx"
 #include "file_reader.hxx"
 #include "sprite.hpp"
+#include "collision_mask.hpp"
 
 class SceneContext;
 class SmallMap;

Modified: branches/pingus_sdl/src/worldobjs/conveyor_belt.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/conveyor_belt.cxx 2007-01-17 10:15:39 UTC 
(rev 2674)
+++ branches/pingus_sdl/src/worldobjs/conveyor_belt.cxx 2007-01-17 10:25:43 UTC 
(rev 2675)
@@ -54,13 +54,13 @@
 void
 ConveyorBelt::on_startup ()
 {
-  PixelBuffer sur(Resource::load_pixelbuffer("worldobjs/conveyorbelt_cmap"));
+  CollisionMask mask = 
Resource::load_collision_mask("worldobjs/conveyorbelt_cmap");
 
   for (int i=0; i < (width + 2); ++i)
-    world->get_colmap()->put(sur,
-                             static_cast<int>(pos.x) + (15 * i),
-                            static_cast<int>(pos.y),
-                            Groundtype::GP_SOLID);
+    world->put(mask,
+               static_cast<int>(pos.x) + (15 * i),
+               static_cast<int>(pos.y),
+               Groundtype::GP_SOLID);
 }
 
 void

Modified: branches/pingus_sdl/src/worldobjs/groundpiece.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/groundpiece.cxx   2007-01-17 10:15:39 UTC 
(rev 2674)
+++ branches/pingus_sdl/src/worldobjs/groundpiece.cxx   2007-01-17 10:25:43 UTC 
(rev 2675)
@@ -41,19 +41,15 @@
 void
 Groundpiece::on_startup ()
 {
-  PixelBuffer surface = Resource::load_pixelbuffer(desc);
+  //// FIXME: We discard rotation here!
+  CollisionMask surface = 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()->get_gfx_map()->remove(surface, static_cast<int>(pos.x), 
static_cast<int>(pos.y));
+    get_world()->remove(surface, static_cast<int>(pos.x), 
static_cast<int>(pos.y));
   else
-    get_world()->get_gfx_map()->put(surface, static_cast<int>(pos.x), 
static_cast<int>(pos.y));
-
-  if (gptype == Groundtype::GP_REMOVE)
-    get_world()->get_colmap()->remove(surface, static_cast<int>(pos.x), 
static_cast<int>(pos.y));
-  else
-    get_world()->get_colmap()->put(surface, static_cast<int>(pos.x), 
static_cast<int>(pos.y), gptype);
+    get_world()->put(surface, 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:15:39 UTC 
(rev 2674)
+++ branches/pingus_sdl/src/worldobjs/ice_block.cxx     2007-01-17 10:25:43 UTC 
(rev 2675)
@@ -42,12 +42,12 @@
 void
 IceBlock::on_startup ()
 {
-  PixelBuffer surf(Resource::load_pixelbuffer("worldobjs/iceblock_cmap"));
+  CollisionMask surf = 
Resource::load_collision_mask("worldobjs/iceblock_cmap");
 
-  world->get_colmap()->put(surf,
-                           static_cast<int>(pos.x),
-                           static_cast<int>(pos.y),
-                          Groundtype::GP_GROUND);
+  world->put(surf,
+             static_cast<int>(pos.x),
+             static_cast<int>(pos.y),
+             Groundtype::GP_GROUND);
 }
 
 void

Modified: branches/pingus_sdl/src/worldobjs/smasher.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/smasher.cxx       2007-01-17 10:15:39 UTC 
(rev 2674)
+++ branches/pingus_sdl/src/worldobjs/smasher.cxx       2007-01-17 10:25:43 UTC 
(rev 2675)
@@ -108,11 +108,11 @@
 Smasher::on_startup ()
 {
   std::cout << "Drawing colmap entry" << std::endl;
-  PixelBuffer buf = Resource::load_pixelbuffer("traps/smasher_cmap");
-  world->get_colmap()->put(buf, 
-                          static_cast<int>(pos.x),
-                          static_cast<int>(pos.y),
-                          Groundtype::GP_SOLID);
+  CollisionMask buf = Resource::load_collision_mask("traps/smasher_cmap");
+  world->put(buf, 
+             static_cast<int>(pos.x),
+             static_cast<int>(pos.y),
+             Groundtype::GP_SOLID);
 }
 
 void

Modified: branches/pingus_sdl/src/worldobjs/switch_door.cxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/switch_door.cxx   2007-01-17 10:15:39 UTC 
(rev 2674)
+++ branches/pingus_sdl/src/worldobjs/switch_door.cxx   2007-01-17 10:25:43 UTC 
(rev 2675)
@@ -30,7 +30,7 @@
 SwitchDoor::SwitchDoor(const FileReader& reader)
   : door_box      (Resource::load_sprite("worldobjs/switchdoor_box")),
     door_tile     (Resource::load_sprite("worldobjs/switchdoor_tile")),
-    
door_tile_cmap(Resource::load_pixelbuffer("worldobjs/switchdoor_tile_cmap")),
+    
door_tile_cmap(Resource::load_collision_mask("worldobjs/switchdoor_tile_cmap")),
     switch_sur    (Resource::load_sprite("worldobjs/switchdoor_switch")),
     is_opening(false)
 {

Modified: branches/pingus_sdl/src/worldobjs/switch_door.hxx
===================================================================
--- branches/pingus_sdl/src/worldobjs/switch_door.hxx   2007-01-17 10:15:39 UTC 
(rev 2674)
+++ branches/pingus_sdl/src/worldobjs/switch_door.hxx   2007-01-17 10:25:43 UTC 
(rev 2675)
@@ -44,7 +44,7 @@
 
   Sprite door_box;
   Sprite door_tile;
-  PixelBuffer door_tile_cmap;
+  CollisionMask door_tile_cmap;
   Sprite switch_sur;
 
   /** True if the door is opening */





reply via email to

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