pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] rev 2319 - in trunk: data/data src src/actions src/editor s


From: Ingo Ruhnke
Subject: [Pingus-CVS] rev 2319 - in trunk: data/data src src/actions src/editor src/editorobjs src/worldobjs
Date: Sun, 09 May 2004 16:30:46 +0200

Author: grumbel
Date: 2004-05-09 16:30:46 +0200 (Sun, 09 May 2004)
New Revision: 2319

Modified:
   trunk/data/data/textures.xml
   trunk/src/actions/miner.cxx
   trunk/src/blitter.cxx
   trunk/src/blitter.hxx
   trunk/src/editor/editor.cxx
   trunk/src/editor/panel.cxx
   trunk/src/editor/panel.hxx
   trunk/src/editor/panel_icons.cxx
   trunk/src/editor/thumb_cache.cxx
   trunk/src/editorobjs/switch_door_obj.cxx
   trunk/src/pingus_resource.cxx
   trunk/src/pingus_resource.hxx
   trunk/src/worldobjs/bumper.cxx
   trunk/src/worldobjs/conveyor_belt.cxx
   trunk/src/worldobjs/groundpiece.cxx
   trunk/src/worldobjs/ice_block.cxx
   trunk/src/worldobjs/liquid.cxx
   trunk/src/worldobjs/smasher.cxx
   trunk/src/worldobjs/surface_background.cxx
   trunk/src/worldobjs/switch_door.cxx
Log:
- fixed background color issue


Modified: trunk/data/data/textures.xml
===================================================================
--- trunk/data/data/textures.xml        2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/data/data/textures.xml        2004-05-09 14:30:46 UTC (rev 2319)
@@ -1,43 +1,124 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
 <resources>
-  <section name="Textures">
-    <surface file="../images/textures/fruitcaketile.jpg" height="256" 
name="fruitcaketile" width="256" x="0" y="0" />
-    <surface file="../images/textures/default.png" height="64" name="default" 
width="64" x="0" y="0" />
-    <surface file="../images/textures/industrial.jpg" height="600" 
name="industrial" width="400" x="0" y="0" />
-    <surface file="../images/textures/clouds2.jpg" name="clouds2" />
-    <surface file="../images/textures/clouds3.png" name="clouds3" />
-    <surface file="../images/textures/clouds.jpg" height="480" name="clouds" 
width="256" x="0" y="0" />
-    <surface file="../images/textures/crystal.jpg" height="286" name="crystal" 
width="169" x="0" y="0" />
-    <surface file="../images/textures/stones.png" height="256" name="stone" 
width="256" x="0" y="0" />
-    <surface file="../images/textures/rocktile.jpg" height="256" 
name="rocktile" width="256" x="0" y="0" />
-    <surface file="../images/textures/rooftile.jpg" height="256" 
name="rooftile" width="256" x="0" y="0" />
-    <surface file="../images/textures/rooftile2.jpg" height="256" 
name="rooftile2" width="256" x="0" y="0" />
-    <surface file="../images/textures/greentex.jpg" name="greentex" />
-    <surface file="../images/textures/rock6.jpg" name="rock6" />
-    <surface file="../images/textures/rockagglo.jpg" height="256" 
name="rockagglo" width="256" x="0" y="0" />
-    <surface file="../images/textures/icetile.jpg" height="400" name="icetile" 
width="150" x="0" y="0" />
-    <surface file="../images/textures/lunartile.jpg" height="400" 
name="lunartile" width="150" x="0" y="0" />
-    <surface file="../images/textures/blueflame.jpg" height="400" 
name="blueflame" width="150" x="0" y="0" />
-    <surface file="../images/textures/stone.jpg" height="398" name="stones" 
width="148" x="0" y="0" />
-    <surface file="../images/textures/flamebg.jpg" height="480" name="flame" 
width="256" x="0" y="0" />
-    <surface array="15x1" file="../images/textures/anim_fire.jpg" height="590" 
name="anim_fire" width="64" x="0" y="0" />
-    <surface file="../images/textures/stars.jpg" height="480" name="stars" 
width="256" x="0" y="0" />
-    <surface file="../images/textures/enchantedjungle.jpg" height="500" 
name="enchantedjungle" width="300" x="0" y="0" />
-    <surface file="../images/textures/darkjungle.jpg" height="500" 
name="darkjungle" width="300" x="0" y="0" />
-    <surface file="../images/textures/latejungle.jpg" height="500" 
name="latejungle" width="300" x="0" y="0" />
-    <surface file="../images/textures/nightjungle.jpg" height="500" 
name="nightjungle" width="300" x="0" y="0" />
-    <surface file="../images/textures/happyclouds.jpg" height="600" 
name="happyclouds" width="384" x="0" y="0" />
-    <surface file="../images/textures/desert.jpg" height="600" name="desert" 
width="256" x="0" y="0" />
-    <surface file="../images/textures/desert_room.jpg" height="378" 
name="desert_room" width="378" x="0" y="0" />
-    <surface file="../images/textures/sortie.jpg" height="256" name="sortie" 
width="256" x="0" y="0" />
-    <surface file="../images/textures/cyanspace.jpg" height="600" 
name="cyanspace" width="400" x="0" y="0" />
-    <surface file="../images/textures/bwsortiebg.jpg" height="600" 
name="bwsortiebg" width="400" x="0" y="0" />
-    <surface file="../images/textures/green_tendrils.png" height="256" 
name="green_tendrils" width="256" x="0" y="0" />
-    <surface file="../images/textures/mountain.png" height="600" 
name="mountain" width="400" x="0" y="0" />
-    <surface file="../images/textures/thunderstorm.png" height="800" 
name="thunderstorm" width="256" x="0" y="0" />
-    <surface file="../images/textures/creepers.png" height="256" width="256" 
name="creepers" x="0" y="0"/>
-    <surface file="../images/textures/creepers-mirrored.png" height="256" 
width="256" name="creepers-mirrored" x="0" y="0"/>
-    <surface file="../images/textures/swirljungle.png" height="256" 
width="256" name="swirljungle" x="0" y="0"/>
-    <surface file="../images/textures/ordina.jpg" name="ordina" />
-    <surface file="../images/textures/ordina.jpg" name="fond1" />
+  <section name="textures">
+    <sprite name="fruitcaketile">
+      <image file="../images/textures/fruitcaketile.jpg"/>
+    </sprite>
+    <sprite name="default">
+      <image file="../images/textures/default.png"/>
+    </sprite>
+    <sprite name="industrial">
+      <image file="../images/textures/industrial.jpg"/>
+    </sprite>
+    <sprite name="clouds2">
+      <image file="../images/textures/clouds2.jpg"/>
+    </sprite>
+    <sprite name="clouds3">
+      <image file="../images/textures/clouds3.png"/>
+    </sprite>
+    <sprite name="clouds">
+      <image file="../images/textures/clouds.jpg"/>
+    </sprite>
+    <sprite name="crystal">
+      <image file="../images/textures/crystal.jpg"/>
+    </sprite>
+    <sprite name="stone">
+      <image file="../images/textures/stones.png"/>
+    </sprite>
+    <sprite name="rocktile">
+      <image file="../images/textures/rocktile.jpg"/>
+    </sprite>
+    <sprite name="rooftile">
+      <image file="../images/textures/rooftile.jpg"/>
+    </sprite>
+    <sprite name="rooftile2">
+      <image file="../images/textures/rooftile2.jpg"/>
+    </sprite>
+    <sprite name="greentex">
+      <image file="../images/textures/greentex.jpg"/>
+    </sprite>
+    <sprite name="rock6">
+      <image file="../images/textures/rock6.jpg"/>
+    </sprite>
+    <sprite name="rockagglo">
+      <image file="../images/textures/rockagglo.jpg"/>
+    </sprite>
+    <sprite name="icetile">
+      <image file="../images/textures/icetile.jpg"/>
+    </sprite>
+    <sprite name="lunartile">
+      <image file="../images/textures/lunartile.jpg"/>
+    </sprite>
+    <sprite name="blueflame">
+      <image file="../images/textures/blueflame.jpg"/>
+    </sprite>
+    <sprite name="stones">
+      <image file="../images/textures/stone.jpg"/>
+    </sprite>
+    <sprite name="flame">
+      <image file="../images/textures/flamebg.jpg"/>
+    </sprite>
+    <sprite name="anim_fire">
+      <image file="../images/textures/anim_fire.jpg">
+        <grid pos="0,0" size="64,590" array="15x1"/>
+      </image>
+    </sprite>
+    <sprite name="stars">
+      <image file="../images/textures/stars.jpg"/>
+    </sprite>
+    <sprite name="enchantedjungle">
+      <image file="../images/textures/enchantedjungle.jpg"/>
+    </sprite>
+    <sprite name="darkjungle">
+      <image file="../images/textures/darkjungle.jpg"/>
+    </sprite>
+    <sprite name="latejungle">
+      <image file="../images/textures/latejungle.jpg"/>
+    </sprite>
+    <sprite name="nightjungle">
+      <image file="../images/textures/nightjungle.jpg"/>
+    </sprite>
+    <sprite name="happyclouds">
+      <image file="../images/textures/happyclouds.jpg"/>
+    </sprite>
+    <sprite name="desert">
+      <image file="../images/textures/desert.jpg"/>
+    </sprite>
+    <sprite name="desert_room">
+      <image file="../images/textures/desert_room.jpg"/>
+    </sprite>
+    <sprite name="sortie">
+      <image file="../images/textures/sortie.jpg"/>
+    </sprite>
+    <sprite name="cyanspace">
+      <image file="../images/textures/cyanspace.jpg"/>
+    </sprite>
+    <sprite name="bwsortiebg">
+      <image file="../images/textures/bwsortiebg.jpg"/>
+    </sprite>
+    <sprite name="green_tendrils">
+      <image file="../images/textures/green_tendrils.png"/>
+    </sprite>
+    <sprite name="mountain">
+      <image file="../images/textures/mountain.png"/>
+    </sprite>
+    <sprite name="thunderstorm">
+      <image file="../images/textures/thunderstorm.png"/>
+    </sprite>
+    <sprite name="creepers">
+      <image file="../images/textures/creepers.png"/>
+    </sprite>
+    <sprite name="creepers-mirrored">
+      <image file="../images/textures/creepers-mirrored.png"/>
+    </sprite>
+    <sprite name="swirljungle">
+      <image file="../images/textures/swirljungle.png"/>
+    </sprite>
+    <sprite name="ordina">
+      <image file="../images/textures/ordina.jpg"/>
+    </sprite>
+    <sprite name="fond1">
+      <image file="../images/textures/ordina.jpg"/>
+    </sprite>
   </section>
 </resources>

Modified: trunk/src/actions/miner.cxx
===================================================================
--- trunk/src/actions/miner.cxx 2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/actions/miner.cxx 2004-05-09 14:30:46 UTC (rev 2319)
@@ -31,8 +31,8 @@
 
 Miner::Miner (Pingu* p)
   : PinguAction(p),
-    miner_radius(PingusResource::load_surface_provider("Other/bash_radius", 
"pingus")),
-    
miner_radius_gfx(PingusResource::load_surface_provider("Other/bash_radius_gfx", 
"pingus")),
+    miner_radius(PingusResource::load_pixelbuffer("Other/bash_radius", 
"pingus")),
+    miner_radius_gfx(PingusResource::load_pixelbuffer("Other/bash_radius_gfx", 
"pingus")),
     sprite(Sprite("Pingus/miner0", "pingus", 20.0f)),
     slow_count(0)
 {

Modified: trunk/src/blitter.cxx
===================================================================
--- trunk/src/blitter.cxx       2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/blitter.cxx       2004-05-09 14:30:46 UTC (rev 2319)
@@ -417,9 +417,8 @@
 }
 
 CL_PixelBuffer
-Blitter::scale_surface_to_canvas(const CL_Surface& sur, int width, int height)
+Blitter::scale_surface_to_canvas (CL_PixelBuffer provider, int width, int 
height)
 {
-  CL_PixelBuffer provider = sur.get_pixeldata();
   CL_PixelBuffer canvas(width, height, width*4, CL_PixelFormat::rgba8888);
 
   provider.lock ();
@@ -518,9 +517,15 @@
   canvas.unlock ();
   provider.unlock ();
 
-  return canvas;
+  return canvas; 
 }
 
+CL_PixelBuffer
+Blitter::scale_surface_to_canvas(const CL_Surface& sur, int width, int height)
+{
+  return Blitter::scale_surface_to_canvas(sur.get_pixeldata(), width, height);
+}
+
 /*
 // Converts a SurfaceProvider based surface, to a Canvas
 // based one. The old one will not be deleted.
@@ -609,7 +614,6 @@
 CL_Surface
 Blitter::rotate_90 (const CL_Surface& sur)
 {
-#ifdef CLANLIB_0_6
   CL_PixelBuffer prov = sur.get_pixeldata();
 
   if (prov.get_format().get_type() ==  pixelformat_index)
@@ -617,16 +621,15 @@
       //std::cout << "Using indexed blitter" << std::endl;
       int pwidth  = prov.get_width();
       int pheight = prov.get_height();
+      
+      CL_PixelFormat format(8, 0, 0, 0, 0, 
+                            prov.get_format().has_colorkey(), 
prov.get_format().get_colorkey(),
+                            pixelformat_index);
+      CL_PixelBuffer canvas(pheight, pwidth, pwidth, format, 
prov.get_palette());
 
-      IndexedCanvas* canvas = new IndexedCanvas(pheight, pwidth);
-      if (prov->uses_src_colorkey())
-        canvas->set_src_colorkey(prov->get_src_colorkey());
-
       prov.lock();
       canvas.lock();
 
-      canvas.set_palette(prov.get_palette());
-
       unsigned char* source_buf = static_cast<unsigned char*>(prov.get_data());
       unsigned char* target_buf = static_cast<unsigned 
char*>(canvas.get_data());
 
@@ -638,11 +641,12 @@
 
       canvas.unlock();
       prov.unlock();
-      return CL_Surface(canvas, true);
+
+      return CL_Surface(new CL_PixelBuffer(canvas), true);
     }
   else
     {
-      CL_PixelBuffer* canvas = new CL_PixelBuffer (sur.get_height (), 
sur.get_width ());
+      CL_PixelBuffer canvas(sur.get_height (), sur.get_width (), 
sur.get_height()*4, CL_PixelFormat::rgba8888);
 
       prov.lock ();
       canvas.lock ();
@@ -651,16 +655,14 @@
       for (int y = 0; y < sur.get_height (); ++y)
         for (int x = 0; x < sur.get_width (); ++x)
           {
-            color = prov->get_pixel (x, y);
+            color = prov.get_pixel (x, y);
             canvas.draw_pixel (sur.get_height () - 1 - y, x , color);
           }
 
       canvas.unlock ();
       prov.unlock ();
-      return CL_Surface(canvas, true);
+      return CL_Surface(new CL_PixelBuffer(canvas), true);
     }
-#endif
-  return CL_Surface();
 }
 
 

Modified: trunk/src/blitter.hxx
===================================================================
--- trunk/src/blitter.hxx       2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/blitter.hxx       2004-05-09 14:30:46 UTC (rev 2319)
@@ -113,6 +113,8 @@
       @return A newly created surface, the caller is responsible to delete it. 
*/
   static CL_PixelBuffer scale_surface_to_canvas (const CL_Surface& sur, int 
width, int height);
 
+  static CL_PixelBuffer scale_surface_to_canvas (CL_PixelBuffer sur, int 
width, int height);
+
 private:
   Blitter (const Blitter&);
   Blitter& operator= (const Blitter&);

Modified: trunk/src/editor/editor.cxx
===================================================================
--- trunk/src/editor/editor.cxx 2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/editor/editor.cxx 2004-05-09 14:30:46 UTC (rev 2319)
@@ -356,7 +356,7 @@
 
   tool = ZOOM_TOOL;
 
-  CL_Surface mouse_cursor = PingusResource::load_surface("editor/region-zoom", 
"core");
+  CL_Sprite mouse_cursor = PingusResource::load_sprite("editor/region-zoom", 
"core");
 
   while (true)
     {

Modified: trunk/src/editor/panel.cxx
===================================================================
--- trunk/src/editor/panel.cxx  2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/editor/panel.cxx  2004-05-09 14:30:46 UTC (rev 2319)
@@ -34,8 +34,8 @@
 
 PanelIcon::PanelIcon()
 {
-  button = PingusResource::load_surface("editor/button","core");
-  button_pressed = PingusResource::load_surface("editor/button_pressed", 
"core");
+  button = PingusResource::load_sprite("editor/button","core");
+  button_pressed = PingusResource::load_sprite("editor/button_pressed", 
"core");
   font = Fonts::courier_small;
 }
 
@@ -88,7 +88,7 @@
 Panel::Panel()
 {
   is_init = false;
-  logo = PingusResource::load_surface ("editor/logo", "core");
+  logo = PingusResource::load_sprite("editor/logo", "core");
 }
 
 Panel::~Panel()

Modified: trunk/src/editor/panel.hxx
===================================================================
--- trunk/src/editor/panel.hxx  2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/editor/panel.hxx  2004-05-09 14:30:46 UTC (rev 2319)
@@ -37,9 +37,9 @@
 {
 protected:
   CL_Font    font;
-  CL_Surface sur;
-  CL_Surface button;
-  CL_Surface button_pressed;
+  CL_Sprite sur;
+  CL_Sprite button;
+  CL_Sprite button_pressed;
   std::string tooltip;
   unsigned int mouse_over_time;
 public:
@@ -63,7 +63,7 @@
   std::vector<PanelIcon*> buttons;
   std::vector<PanelIcon*>::iterator pressed_button;
   Editor* editor;
-  ::CL_Surface logo;
+  CL_Sprite logo;
 
 public:
   Panel();

Modified: trunk/src/editor/panel_icons.cxx
===================================================================
--- trunk/src/editor/panel_icons.cxx    2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/editor/panel_icons.cxx    2004-05-09 14:30:46 UTC (rev 2319)
@@ -31,7 +31,7 @@
 PanelIconLoad::PanelIconLoad()
 {
   tooltip = _("Load a level (F5)");
-  sur = PingusResource::load_surface("editor/open", "core");
+  sur = PingusResource::load_sprite("editor/open", "core");
 }
 
 void
@@ -44,7 +44,7 @@
 PanelIconExit::PanelIconExit()
 {
   tooltip = _("Exit the editor (Escape)");
-  sur = PingusResource::load_surface("editor/exit", "core");
+  sur = PingusResource::load_sprite("editor/exit", "core");
 }
 
 void
@@ -56,7 +56,7 @@
 PanelIconSave::PanelIconSave()
 {
   tooltip = _("Save this level (F6)");
-  sur = PingusResource::load_surface("editor/save", "core");
+  sur = PingusResource::load_sprite("editor/save", "core");
 }
 
 void
@@ -68,7 +68,7 @@
 PanelIconDelete::PanelIconDelete()
 {
   tooltip = _("Delete marked objects (delete)");
-  sur = PingusResource::load_surface("editor/delete", "core");
+  sur = PingusResource::load_sprite("editor/delete", "core");
 }
 
 void
@@ -80,7 +80,7 @@
 PanelIconCopy::PanelIconCopy()
 {
   tooltip = _("Duplicate current object (d)");
-  sur = PingusResource::load_surface("editor/copy", "core");
+  sur = PingusResource::load_sprite("editor/copy", "core");
 }
 
 void
@@ -92,7 +92,7 @@
 PanelIconLevelProperties::PanelIconLevelProperties()
 {
   tooltip = _("Edit Level Properties");
-  sur = PingusResource::load_surface("editor/edit", "core");
+  sur = PingusResource::load_sprite("editor/edit", "core");
 }
 
 void
@@ -104,7 +104,7 @@
 PanelIconObjectProperties::PanelIconObjectProperties()
 {
   tooltip = _("Edit Object Properties");
-  sur = PingusResource::load_surface("editor/preferences", "core");
+  sur = PingusResource::load_sprite("editor/preferences", "core");
 }
 
 void
@@ -116,7 +116,7 @@
 PanelIconRun::PanelIconRun()
 {
   tooltip = _("Start the level and test it (F4)");
-  sur = PingusResource::load_surface("editor/clock_run", "core");
+  sur = PingusResource::load_sprite("editor/clock_run", "core");
 }
 
 void
@@ -128,7 +128,7 @@
 PanelIconNew::PanelIconNew()
 {
   tooltip = _("Create a new level from scratch");
-  sur = PingusResource::load_surface("editor/new", "core");
+  sur = PingusResource::load_sprite("editor/new", "core");
 }
 
 void
@@ -140,7 +140,7 @@
 PanelIconInsertObject::PanelIconInsertObject()
 {
   tooltip = _("Insert an object (Insert)");
-  sur = PingusResource::load_surface("editor/index", "core");
+  sur = PingusResource::load_sprite("editor/index", "core");
 }
 
 void
@@ -152,7 +152,7 @@
 PanelIconRegionZoom::PanelIconRegionZoom ()
 {
   tooltip = _("Zoom into a region");
-  sur = PingusResource::load_surface("editor/region-zoom", "core");
+  sur = PingusResource::load_sprite("editor/region-zoom", "core");
 }
 
 void
@@ -164,7 +164,7 @@
 PanelIconZoomIn::PanelIconZoomIn()
 {
   tooltip = _("Zoom in");
-  sur = PingusResource::load_surface("editor/zoom-in", "core");
+  sur = PingusResource::load_sprite("editor/zoom-in", "core");
 }
 
 void
@@ -177,7 +177,7 @@
 PanelIconZoomOut::PanelIconZoomOut()
 {
   tooltip = _("Zoom out");
-  sur = PingusResource::load_surface("editor/zoom-out", "core");
+  sur = PingusResource::load_sprite("editor/zoom-out", "core");
 }
 
 void
@@ -190,7 +190,7 @@
 PanelIconSetupActions::PanelIconSetupActions ()
 {
   tooltip = _("Setup Number of Actions");
-  sur = PingusResource::load_surface("editor/actions", "core");
+  sur = PingusResource::load_sprite("editor/actions", "core");
 }
 
 void
@@ -202,7 +202,7 @@
 PanelIconHelp::PanelIconHelp ()
 {
   tooltip = _("Display Help Screen (F1)");
-  sur = PingusResource::load_surface("editor/help", "core");
+  sur = PingusResource::load_sprite("editor/help", "core");
 }
 
 void

Modified: trunk/src/editor/thumb_cache.cxx
===================================================================
--- trunk/src/editor/thumb_cache.cxx    2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/editor/thumb_cache.cxx    2004-05-09 14:30:46 UTC (rev 2319)
@@ -50,7 +50,7 @@
 CL_Surface
 ThumbCache::uncached_load (const std::string & res_ident, const std::string & 
datafile)
 {
-  CL_Surface sur = PingusResource::load_surface (res_ident, datafile);
+  CL_Surface sur = PingusResource::load_surface(res_ident, datafile);
 
   if (maintainer_mode)
     pout << "ThumbCache: Loading: " << res_ident << " (" << datafile << ")"  
<< std::endl;

Modified: trunk/src/editorobjs/switch_door_obj.cxx
===================================================================
--- trunk/src/editorobjs/switch_door_obj.cxx    2004-05-09 01:26:02 UTC (rev 
2318)
+++ trunk/src/editorobjs/switch_door_obj.cxx    2004-05-09 14:30:46 UTC (rev 
2319)
@@ -31,7 +31,7 @@
   : data(new WorldObjsData::SwitchDoorData(data_)),
     door_box      (PingusResource::load_sprite("switchdoor_box"      , 
"worldobjs")),
     door_tile     (PingusResource::load_sprite("switchdoor_tile"     , 
"worldobjs")),
-    
door_tile_cmap(PingusResource::load_surface_provider("switchdoor_tile_cmap", 
"worldobjs")),
+    door_tile_cmap(PingusResource::load_pixelbuffer("switchdoor_tile_cmap", 
"worldobjs")),
     switch_sur    (PingusResource::load_sprite("switchdoor_switch"   , 
"worldobjs"))
 {
 }

Modified: trunk/src/pingus_resource.cxx
===================================================================
--- trunk/src/pingus_resource.cxx       2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/pingus_resource.cxx       2004-05-09 14:30:46 UTC (rev 2319)
@@ -105,12 +105,6 @@
     CL_Sprite sprite(res_name, &res);
     return sprite;
   } catch (CL_Error& err) {
-      std::list<std::string> liste = res.get_resources_of_type("sprite");
-      for(std::list<std::string>::iterator i = liste.begin(); i != 
liste.end(); ++i)
-        {
-          std::cout << datafile << ": '" << *i << "'" <<  std::endl;
-        }
-
       std::cout << "PingusResource::load_sprite: CL_Error: '" << res_name << 
"', '" << datafile  << "'" << std::endl;
       std::cout << "CL_Error: " << err.message << std::endl;
     CL_ResourceManager res_mgr = get("core");
@@ -118,29 +112,41 @@
   }
 }
 
+CL_SpriteDescription
+PingusResource::load_sprite_desc(const std::string& res_name,
+                                 const std::string& datafile)
+{
+  CL_ResourceManager res = get(datafile);
+  try {
+    CL_SpriteDescription desc(res_name, &res);
+    return desc;
+  } catch(CL_Error& err) {
+    std::cout << "PingusResource::load_sprite_desc: CL_Error: '" << res_name 
<< "', '" << datafile  << "'" << std::endl;
+    std::cout << "CL_Error: " << err.message << std::endl;
+    res = get("core");
+    return CL_SpriteDescription("misc/404sprite", &res);
+  }
+}
+
 CL_PixelBuffer
-PingusResource::load_surface_provider(const ResDescriptor& desc)
+PingusResource::load_pixelbuffer(const ResDescriptor& desc)
 {
-  CL_Sprite sprite = load_sprite(desc);
-  if (sprite.get_frame_count() == 0)
-    {
-      std::cout << "Error: Desc: " << desc << std::endl;
-      assert(0);
-    }
-  return sprite.get_frame_surface(0).get_pixeldata();
+  return load_pixelbuffer(desc.res_name, desc.datafile);
 }
 
 CL_PixelBuffer
-PingusResource::load_surface_provider(const std::string& res_name,
+PingusResource::load_pixelbuffer(const std::string& res_name,
                                       const std::string& datafile)
 {
-  CL_Sprite sprite = load_sprite(res_name, datafile);
-  if (sprite.get_frame_count() == 0)
+  CL_SpriteDescription desc = load_sprite_desc(res_name, datafile);
+
+  if (desc.get_frames().size() == 0)
     {
-      std::cout << "Error: Desc: " << res_name << " " << datafile << std::endl;
+      std::cout << "Error: load_pixelbuffer: " << res_name << " " << datafile 
<< std::endl;
       assert(0);
     }
-  return sprite.get_frame_surface(0).get_pixeldata();
+
+  return *desc.get_frames().begin()->first;
 }
 
 CL_Surface

Modified: trunk/src/pingus_resource.hxx
===================================================================
--- trunk/src/pingus_resource.hxx       2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/pingus_resource.hxx       2004-05-09 14:30:46 UTC (rev 2319)
@@ -61,10 +61,12 @@
   static CL_Sprite  load_sprite(const ResDescriptor&);
   static CL_Sprite  load_sprite(const std::string& res_name,
                                 const std::string& datafile);
+  static CL_SpriteDescription load_sprite_desc(const std::string& res_name,
+                                               const std::string& datafile);
 
-  static CL_PixelBuffer load_surface_provider(const std::string& res_name,
+  static CL_PixelBuffer load_pixelbuffer(const std::string& res_name,
                                               const std::string& datafile);
-  static CL_PixelBuffer load_surface_provider(const ResDescriptor&);
+  static CL_PixelBuffer load_pixelbuffer(const ResDescriptor&);
 
   /** Load a font with res_name from datafile */
   static CL_Font load_font(const std::string& res_name,

Modified: trunk/src/worldobjs/bumper.cxx
===================================================================
--- trunk/src/worldobjs/bumper.cxx      2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/worldobjs/bumper.cxx      2004-05-09 14:30:46 UTC (rev 2319)
@@ -73,7 +73,7 @@
 {
   std::cout << "Drawing colmap entry" << std::endl;
 
-  CL_PixelBuffer prov = 
PingusResource::load_surface_provider("Traps/bumper_cmap", "traps");
+  CL_PixelBuffer prov = PingusResource::load_pixelbuffer("Traps/bumper_cmap", 
"traps");
   world->get_colmap()->put(prov, static_cast<int>(data->pos.x), 
static_cast<int>(data->pos.y), Groundtype::GP_SOLID);
 }
 

Modified: trunk/src/worldobjs/conveyor_belt.cxx
===================================================================
--- trunk/src/worldobjs/conveyor_belt.cxx       2004-05-09 01:26:02 UTC (rev 
2318)
+++ trunk/src/worldobjs/conveyor_belt.cxx       2004-05-09 14:30:46 UTC (rev 
2319)
@@ -56,7 +56,7 @@
 void
 ConveyorBelt::on_startup ()
 {
-  CL_PixelBuffer 
sur(PingusResource::load_surface_provider("conveyorbelt_cmap", "worldobjs"));
+  CL_PixelBuffer sur(PingusResource::load_pixelbuffer("conveyorbelt_cmap", 
"worldobjs"));
 
   for (int i=0; i < (data->width + 2); ++i)
     world->get_colmap()->put(sur,

Modified: trunk/src/worldobjs/groundpiece.cxx
===================================================================
--- trunk/src/worldobjs/groundpiece.cxx 2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/worldobjs/groundpiece.cxx 2004-05-09 14:30:46 UTC (rev 2319)
@@ -44,7 +44,7 @@
 void
 Groundpiece::on_startup ()
 {
-  CL_PixelBuffer surface = PingusResource::load_surface_provider(data->desc);
+  CL_PixelBuffer surface = PingusResource::load_pixelbuffer(data->desc);
 
   // FIXME: overdrawing of bridges and similar things aren't handled
   // FIXME: here

Modified: trunk/src/worldobjs/ice_block.cxx
===================================================================
--- trunk/src/worldobjs/ice_block.cxx   2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/worldobjs/ice_block.cxx   2004-05-09 14:30:46 UTC (rev 2319)
@@ -48,7 +48,7 @@
 void
 IceBlock::on_startup ()
 {
-  CL_PixelBuffer surf(PingusResource::load_surface_provider("iceblock_cmap", 
"worldobjs"));
+  CL_PixelBuffer surf(PingusResource::load_pixelbuffer("iceblock_cmap", 
"worldobjs"));
 
   world->get_colmap()->put(surf,
                            static_cast<int>(data->pos.x),
@@ -94,7 +94,7 @@
          is_finished = true;
          thickness = 0;
 
-         CL_PixelBuffer 
surf(PingusResource::load_surface_provider("iceblock_cmap", "worldobjs"));
+         CL_PixelBuffer surf(PingusResource::load_pixelbuffer("iceblock_cmap", 
"worldobjs"));
          world->get_colmap ()->remove(surf, static_cast<int>(data->pos.x), 
static_cast<int>(data->pos.y));
          world->get_gfx_map()->remove(surf, static_cast<int>(data->pos.x), 
static_cast<int>(data->pos.y));
          return;

Modified: trunk/src/worldobjs/liquid.cxx
===================================================================
--- trunk/src/worldobjs/liquid.cxx      2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/worldobjs/liquid.cxx      2004-05-09 14:30:46 UTC (rev 2319)
@@ -51,7 +51,7 @@
 void
 Liquid::on_startup ()
 {
-  CL_PixelBuffer colmap_sur = 
PingusResource::load_surface_provider("Liquid/water_cmap", "global");
+  CL_PixelBuffer colmap_sur = 
PingusResource::load_pixelbuffer("Liquid/water_cmap", "global");
 
   for(int i=0; i < data->width; ++i)
     world->get_colmap()->put(colmap_sur,

Modified: trunk/src/worldobjs/smasher.cxx
===================================================================
--- trunk/src/worldobjs/smasher.cxx     2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/worldobjs/smasher.cxx     2004-05-09 14:30:46 UTC (rev 2319)
@@ -113,7 +113,7 @@
 Smasher::on_startup ()
 {
   std::cout << "Drawing colmap entry" << std::endl;
-  CL_PixelBuffer buf = 
PingusResource::load_surface_provider("Traps/smasher_cmap", "traps");
+  CL_PixelBuffer buf = PingusResource::load_pixelbuffer("Traps/smasher_cmap", 
"traps");
   world->get_colmap()->put(buf, 
                           static_cast<int>(data->pos.x),
                           static_cast<int>(data->pos.y),

Modified: trunk/src/worldobjs/surface_background.cxx
===================================================================
--- trunk/src/worldobjs/surface_background.cxx  2004-05-09 01:26:02 UTC (rev 
2318)
+++ trunk/src/worldobjs/surface_background.cxx  2004-05-09 14:30:46 UTC (rev 
2319)
@@ -43,47 +43,41 @@
   if (data->color.alpha > 1.0)
     std::cout << "Background: Warning dim larger than 1.0 are no longer 
supported" << std::endl;
 
-  CL_Surface source_surface = PingusResource::load_surface(data->desc);
+  CL_PixelBuffer canvas = PingusResource::load_pixelbuffer(data->desc);
 
-  CL_PixelBuffer canvas;
-
   // Scaling Code
   if (data->stretch_x && data->stretch_y)
     {
-      canvas = Blitter::scale_surface_to_canvas(source_surface, 
world->get_width(), world->get_height());
+      canvas = Blitter::scale_surface_to_canvas(canvas, world->get_width(), 
world->get_height());
     }
   else if (data->stretch_x && !data->stretch_y)
     {
       if (data->keep_aspect)
         {
-          float aspect = 
source_surface.get_height()/float(source_surface.get_width());
-          canvas = Blitter::scale_surface_to_canvas(source_surface,
+          float aspect = canvas.get_height()/float(canvas.get_width());
+          canvas = Blitter::scale_surface_to_canvas(canvas,
                                                     world->get_width(),
                                                     
int(world->get_width()*aspect));
         }
       else
         {
-          canvas = Blitter::scale_surface_to_canvas(source_surface, 
source_surface.get_width(), world->get_height());
+          canvas = Blitter::scale_surface_to_canvas(canvas, 
canvas.get_width(), world->get_height());
         }
     }
   else if (!data->stretch_x && data->stretch_y)
     {
       if (data->keep_aspect)
         {
-          float aspect = 
float(source_surface.get_width())/source_surface.get_height();
-          canvas = Blitter::scale_surface_to_canvas(source_surface,
+          float aspect = float(canvas.get_width())/canvas.get_height();
+          canvas = Blitter::scale_surface_to_canvas(canvas,
                                                     int(world->get_height() * 
aspect),
                                                     world->get_height());
         }
       else
         {
-          canvas = Blitter::scale_surface_to_canvas(source_surface, 
source_surface.get_width(), world->get_height());
+          canvas = Blitter::scale_surface_to_canvas(canvas, 
canvas.get_width(), world->get_height());
         }
     }
-  else
-    {
-      canvas = Blitter::create_canvas(source_surface);
-    }
 
   /* FIXME: fill_rect doesn't work with RGB images
      FIXME: seems to work fine with indexed images

Modified: trunk/src/worldobjs/switch_door.cxx
===================================================================
--- trunk/src/worldobjs/switch_door.cxx 2004-05-09 01:26:02 UTC (rev 2318)
+++ trunk/src/worldobjs/switch_door.cxx 2004-05-09 14:30:46 UTC (rev 2319)
@@ -34,7 +34,7 @@
   : data(new WorldObjsData::SwitchDoorData(data_)),
     door_box      (PingusResource::load_sprite("switchdoor_box"      , 
"worldobjs")),
     door_tile     (PingusResource::load_sprite("switchdoor_tile"     , 
"worldobjs")),
-    
door_tile_cmap(PingusResource::load_surface_provider("switchdoor_tile_cmap", 
"worldobjs")),
+    door_tile_cmap(PingusResource::load_pixelbuffer("switchdoor_tile_cmap", 
"worldobjs")),
     switch_sur    (PingusResource::load_sprite("switchdoor_switch"   , 
"worldobjs")),
     is_opening(false),
     current_door_height(data->door_height)





reply via email to

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