pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] rev 2339 - in trunk: data/data data/levels/volcano src src/


From: Ingo Ruhnke
Subject: [Pingus-CVS] rev 2339 - in trunk: data/data data/levels/volcano src src/actions
Date: Thu, 24 Jun 2004 00:47:50 +0200

Author: grumbel
Date: 2004-06-24 00:47:50 +0200 (Thu, 24 Jun 2004)
New Revision: 2339

Modified:
   trunk/data/data/alias.xml
   trunk/data/data/pingus.xml
   trunk/data/levels/volcano/volcano1-grumbel.pingus
   trunk/data/levels/volcano/volcano4-grumbel.pingus
   trunk/src/actions/blocker.cxx
   trunk/src/actions/blocker.hxx
   trunk/src/actions/bomber.cxx
   trunk/src/actions/bomber.hxx
   trunk/src/actions/bridger.cxx
   trunk/src/actions/bridger.hxx
   trunk/src/state_sprite.cxx
   trunk/src/state_sprite.hxx
Log:
- some resource fixes

Modified: trunk/data/data/alias.xml
===================================================================
--- trunk/data/data/alias.xml   2004-06-23 22:13:52 UTC (rev 2338)
+++ trunk/data/data/alias.xml   2004-06-23 22:47:50 UTC (rev 2339)
@@ -329,6 +329,11 @@
 <alias name="Hotspots/plate" link="groundpieces/solid/misc/metalplate_horiz" />
 <alias name="Hotspots/plate2" link="groundpieces/solid/misc/metalplate_large" 
/>
 <alias name="Hotspots/plate_small" 
link="groundpieces/solid/misc/metalplate_small" />
+
+<alias name="global/Hotspots/plate" 
link="groundpieces/solid/misc/metalplate_horiz" />
+<alias name="global/Hotspots/plate2" 
link="groundpieces/solid/misc/metalplate_large" />
+<alias name="global/Hotspots/plate_small" 
link="groundpieces/solid/misc/metalplate_small" />
+
 <alias name="GroundPieces/Rock/granit1" link="groundpieces/solid/rock/granit1" 
/>
 <alias name="GroundPieces/Rock/granit2" link="groundpieces/solid/rock/granit2" 
/>
 <alias name="GroundPieces/Rock/granit3" link="groundpieces/solid/rock/granit3" 
/>

Modified: trunk/data/data/pingus.xml
===================================================================
--- trunk/data/data/pingus.xml  2004-06-23 22:13:52 UTC (rev 2338)
+++ trunk/data/data/pingus.xml  2004-06-23 22:47:50 UTC (rev 2339)
@@ -74,6 +74,7 @@
 
     <section name="bomber">
       <sprite name="left">
+        <animation speed="60" loop="no" />
         <translation origin="bottom_center" x="0" y="2"/>
         <image file="../images/pingus/bomber.png">
           <grid pos="0,0" size="32,32" array="16,1"/>
@@ -81,6 +82,7 @@
       </sprite>
 
       <sprite name="right">
+        <animation speed="60" loop="no" />
         <translation origin="bottom_center" x="0" y="2"/>
         <image file="../images/pingus/bomber.png">
           <grid pos="0,0" size="32,32" array="16,1"/>
@@ -168,6 +170,7 @@
 
     <section name="bridger">
       <sprite name="left">
+        <animation speed="66" loop="no" />
         <translation origin="bottom_center" x="0" y="2"/>
         <image file="../images/pingus/bridger.png">
           <grid pos="0,0" size="32,32" array="15,1"/>
@@ -175,6 +178,7 @@
       </sprite>
 
       <sprite name="right">
+        <animation speed="66" loop="no" />
         <translation origin="bottom_center" x="0" y="2"/>
         <image file="../images/pingus/bridger.png">
           <grid pos="0,32" size="32,32" array="15,1"/>
@@ -184,12 +188,14 @@
 
     <section name="bridger_walk">
       <sprite name="left">
+        <animation speed="66" loop="no" />
         <image file="../images/pingus/bridger_walk.png">
           <grid pos="0,0" size="32,32" array="4,1"/>
         </image>
       </sprite>
       
       <sprite name="right">
+        <animation speed="66" loop="no" />
         <image file="../images/pingus/bridger_walk.png">
           <grid pos="0,32" size="32,32" array="4,1"/>
         </image>
@@ -414,22 +420,10 @@
       <image file="../images/pingus/bomber_radius_gfx.png">
       </image>
     </sprite>
-    <sprite name="explo0">
+    <sprite name="explo">
       <image file="../images/pingus/explo0.png">
       </image>
     </sprite>
-    <sprite name="explo1">
-      <image file="../images/pingus/explo1.png">
-      </image>
-    </sprite>
-    <sprite name="explo2">
-      <image file="../images/pingus/explo2.png">
-      </image>
-    </sprite>
-    <sprite name="explo3">
-      <image file="../images/pingus/explo3.png">
-      </image>
-    </sprite>
     <sprite name="laser_kill">
       <image file="../images/pingus/laser_kill.png">
         <grid pos="0,0" size="33,32" array="9,2"/>

Modified: trunk/data/levels/volcano/volcano1-grumbel.pingus
===================================================================
--- trunk/data/levels/volcano/volcano1-grumbel.pingus   2004-06-23 22:13:52 UTC 
(rev 2338)
+++ trunk/data/levels/volcano/volcano1-grumbel.pingus   2004-06-23 22:47:50 UTC 
(rev 2339)
@@ -844,7 +844,7 @@
 <liquid use-old-width-handling="0">
   <surface><resource type="datafile">
     <resource-datafile>liquids</resource-datafile>
-  <resource-ident>Liquid/water2</resource-ident>
+  <resource-ident>water2</resource-ident>
     <modifier>ROT0</modifier>
   </resource></surface>
   <position>

Modified: trunk/data/levels/volcano/volcano4-grumbel.pingus
===================================================================
--- trunk/data/levels/volcano/volcano4-grumbel.pingus   2004-06-23 22:13:52 UTC 
(rev 2338)
+++ trunk/data/levels/volcano/volcano4-grumbel.pingus   2004-06-23 22:47:50 UTC 
(rev 2339)
@@ -266,7 +266,7 @@
   </position>
   <surface><resource type="datafile">
     <resource-datafile>exits</resource-datafile>
-  <resource-ident>exits/stone</resource-ident>
+  <resource-ident>stone</resource-ident>
     <modifier>ROT0</modifier>
   </resource></surface>
   <owner-id>0</owner-id></exit>

Modified: trunk/src/actions/blocker.cxx
===================================================================
--- trunk/src/actions/blocker.cxx       2004-06-23 22:13:52 UTC (rev 2338)
+++ trunk/src/actions/blocker.cxx       2004-06-23 22:47:50 UTC (rev 2339)
@@ -32,10 +32,10 @@
 namespace Actions {
 
 Blocker::Blocker(Pingu* p)
-  : PinguAction(p),
-    sprite(Resource::load_sprite("pingus/blocker")) // 6.0f)
+  : PinguAction(p)
 {
-  sprite.set_alignment(origin_bottom_center);
+  sprite.load(Direction::LEFT,  Resource::load_sprite("pingus/blocker/left"));
+  sprite.load(Direction::RIGHT, Resource::load_sprite("pingus/blocker/right"));
 
   if (   rel_getpixel(0,-1)  ==  Groundtype::GP_NOTHING
       && rel_getpixel(0, -2) ==  Groundtype::GP_GROUND)
@@ -72,7 +72,7 @@
 void
 Blocker::draw (GraphicContext& gc)
 {
-  gc.draw(sprite, pingu->get_pos());
+  gc.draw(sprite[pingu->direction], pingu->get_pos());
 }
 
 bool

Modified: trunk/src/actions/blocker.hxx
===================================================================
--- trunk/src/actions/blocker.hxx       2004-06-23 22:13:52 UTC (rev 2338)
+++ trunk/src/actions/blocker.hxx       2004-06-23 22:47:50 UTC (rev 2339)
@@ -21,6 +21,7 @@
 #define HEADER_PINGUS_ACTIONS_BLOCKER_HXX
 
 #include <ClanLib/Display/sprite.h>
+#include "../state_sprite.hxx"
 #include "../pingu_action.hxx"
 
 namespace Pingus {
@@ -29,7 +30,7 @@
 class Blocker : public PinguAction
 {
 private:
-  CL_Sprite sprite;
+  StateSprite sprite;
 
 public:
   Blocker (Pingu* p);

Modified: trunk/src/actions/bomber.cxx
===================================================================
--- trunk/src/actions/bomber.cxx        2004-06-23 22:13:52 UTC (rev 2338)
+++ trunk/src/actions/bomber.cxx        2004-06-23 22:47:50 UTC (rev 2339)
@@ -46,9 +46,11 @@
     sound_played(false),
     gfx_exploded(false),
     colmap_exploded(false),
-    sprite("pingus/bomber", "", 17.0f, Sprite::NONE, Sprite::ONCE),
     explo_surf(Resource::load_sprite("other/explo"))
 {
+  sprite.load(Direction::LEFT,  Resource::load_sprite("pingus/bomber/left"));
+  sprite.load(Direction::RIGHT, Resource::load_sprite("pingus/bomber/right"));
+
   // Only load the surface again if no static_surface is available
   if (!static_surface_loaded)
     {
@@ -56,7 +58,6 @@
       bomber_radius     = Resource::load_pixelbuffer("other/bomber_radius");
       bomber_radius_gfx = 
Resource::load_pixelbuffer("other/bomber_radius_gfx");
     }
-  sprite.set_align_center_bottom();
 }
 
 void
@@ -68,13 +69,13 @@
 void
 Bomber::draw (GraphicContext& gc)
 {
-  if (sprite.get_frame () >= 13 && !gfx_exploded)
+  if (sprite[pingu->direction].get_current_frame() >= 13 && !gfx_exploded)
     {
       gc.draw (explo_surf, Vector(pingu->get_x () - 32, pingu->get_y () - 48));
       gfx_exploded = true;
     }
 
-  gc.draw(sprite, pingu->get_pos ());
+  gc.draw(sprite[pingu->direction], pingu->get_pos ());
 }
 
 void
@@ -92,7 +93,7 @@
   pingu->set_pos(mover.get_pos());
 
   // If the Bomber hasn't 'exploded' yet and it has hit Water or Lava
-  if (sprite.get_frame () <= 9 && (rel_getpixel(0, -1) == Groundtype::GP_WATER
+  if (sprite[pingu->direction].get_current_frame() <= 9 && (rel_getpixel(0, 
-1) == Groundtype::GP_WATER
       || rel_getpixel(0, -1) == Groundtype::GP_LAVA))
     {
       pingu->set_action(Actions::Drown);
@@ -100,20 +101,20 @@
     }
 
   // If the Bomber hasn't 'exploded' yet and it has hit the ground too quickly
-  if (sprite.get_frame () <= 9 && rel_getpixel(0, -1) != Groundtype::GP_NOTHING
+  if (sprite[pingu->direction].get_current_frame () <= 9 && rel_getpixel(0, 
-1) != Groundtype::GP_NOTHING
       && velocity.y > deadly_velocity)
     {
       pingu->set_action(Actions::Splashed);
       return;
     }
 
-  if (sprite.get_frame () > 9 && !sound_played) {
+  if (sprite[pingu->direction].get_current_frame () > 9 && !sound_played) {
     WorldObj::get_world()->play_sound("plop", pingu->get_pos ());
     sound_played = true;
   }
 
   // Throwing particles
-  if (sprite.get_frame () > 12 && !particle_thrown)
+  if (sprite[pingu->direction].get_current_frame () > 12 && !particle_thrown)
     {
       particle_thrown = true;
       
WorldObj::get_world()->get_pingu_particle_holder()->add_particle(static_cast<int>(pingu->get_x()),
@@ -121,7 +122,7 @@
     }
 
 
-  if (sprite.get_frame () >= 13 && !colmap_exploded)
+  if (sprite[pingu->direction].get_current_frame () >= 13 && !colmap_exploded)
     {
       colmap_exploded = true;
       WorldObj::get_world()->get_colmap()->remove(bomber_radius,
@@ -134,7 +135,7 @@
 
 
   // The pingu explode
-  if (sprite.finished ())
+  if (sprite[pingu->direction].is_finished ())
     {
       pingu->set_status(PS_DEAD);
     }

Modified: trunk/src/actions/bomber.hxx
===================================================================
--- trunk/src/actions/bomber.hxx        2004-06-23 22:13:52 UTC (rev 2338)
+++ trunk/src/actions/bomber.hxx        2004-06-23 22:47:50 UTC (rev 2339)
@@ -20,7 +20,7 @@
 #ifndef HEADER_PINGUS_ACTIONS_BOMBER_HXX
 #define HEADER_PINGUS_ACTIONS_BOMBER_HXX
 
-#include "../sprite.hxx"
+#include "../state_sprite.hxx"
 #include "../pingu_action.hxx"
 
 namespace Pingus {
@@ -40,8 +40,8 @@
   static CL_PixelBuffer bomber_radius;
   static CL_PixelBuffer bomber_radius_gfx;
 
-  Sprite     sprite;
-  CL_Sprite  explo_surf;
+  StateSprite sprite;
+  CL_Sprite   explo_surf;
 
 public:
   Bomber (Pingu* p);

Modified: trunk/src/actions/bridger.cxx
===================================================================
--- trunk/src/actions/bridger.cxx       2004-06-23 22:13:52 UTC (rev 2338)
+++ trunk/src/actions/bridger.cxx       2004-06-23 22:47:50 UTC (rev 2339)
@@ -41,12 +41,16 @@
 Bridger::Bridger (Pingu* p)
   : PinguAction(p),
     mode(B_BUILDING),
-    walk_sprite(Sprite("pingus/bridger_walk", "", 15.0f, Sprite::NONE, 
Sprite::ONCE)),
-    build_sprite(Sprite("pingus/bridger_build", "", 15.0f, Sprite::NONE, 
Sprite::ONCE)),
     bricks(MAX_BRICKS),
     block_build(false),
     name(_("Bridger") + std::string(" (") + to_string(bricks) + ")")
 {
+  walk_sprite.load (Direction::LEFT,  
Resource::load_sprite("pingus/bridger_walk/left"));
+  walk_sprite.load (Direction::RIGHT, 
Resource::load_sprite("pingus/bridger_walk/right"));
+
+  build_sprite.load (Direction::LEFT,  
Resource::load_sprite("pingus/bridger/left"));
+  build_sprite.load (Direction::RIGHT, 
Resource::load_sprite("pingus/bridger/right"));
+
   if (!static_surfaces_loaded)
     {
       static_surface = Resource::load_surface ("pingus/bridger");
@@ -54,9 +58,6 @@
       brick_r = Resource::load_pixelbuffer("other/brick_right");
       static_surfaces_loaded = true;
     }
-
-  build_sprite.set_align_center_bottom();
-  walk_sprite.set_align_center_bottom();
 }
 
 void
@@ -79,22 +80,13 @@
   switch (mode)
     {
     case B_BUILDING:
-      if (pingu->direction.is_left ())
-       build_sprite.set_direction (Sprite::LEFT);
-      else
-       build_sprite.set_direction (Sprite::RIGHT);
-
-      gc.draw(build_sprite, Vector(pingu->get_x () - (x_offset * 
pingu->direction),
-                                  pingu->get_y () + y_offset));
+      gc.draw(build_sprite[pingu->direction], Vector(pingu->get_x () - 
(x_offset * pingu->direction),
+                                                     pingu->get_y () + 
y_offset));
       break;
 
     case B_WALKING:
-      if (pingu->direction.is_left ())
-       walk_sprite.set_direction (Sprite::LEFT);
-      else
-       walk_sprite.set_direction (Sprite::RIGHT);
-      gc.draw (walk_sprite, Vector(pingu->get_x () - (x_offset * 
pingu->direction),
-                                  pingu->get_y () + y_offset));
+      gc.draw(walk_sprite[pingu->direction], Vector(pingu->get_x () - 
(x_offset * pingu->direction),
+                                                    pingu->get_y () + 
y_offset));
       break;
     }
 }
@@ -117,13 +109,13 @@
 void
 Bridger::update_walk ()
 {
-  if (walk_sprite.finished ()) // FIXME: Dangerous! might not be fixed timing
+  if (walk_sprite[pingu->direction].is_finished ()) // FIXME: Dangerous! might 
not be fixed timing
     {
       if (way_is_free())
        {
          mode = B_BUILDING;
          block_build = false;
-         walk_sprite.reset ();
+         walk_sprite[pingu->direction].restart();
          walk_one_step_up();
        }
       else // We reached a wall...
@@ -142,9 +134,9 @@
 void
 Bridger::update_build ()
 {
-  build_sprite.update ();
+  build_sprite[pingu->direction].update ();
 
-  if (build_sprite.get_frame () >= 7 && !block_build)
+  if (build_sprite[pingu->direction].get_current_frame () >= 7 && !block_build)
     {
       block_build = true;
 
@@ -166,10 +158,10 @@
        }
     }
 
-  if (build_sprite.finished ())
+  if (build_sprite[pingu->direction].is_finished ())
     {
       mode = B_WALKING;
-      build_sprite.reset ();
+      build_sprite[pingu->direction].restart();
     }
 }
 

Modified: trunk/src/actions/bridger.hxx
===================================================================
--- trunk/src/actions/bridger.hxx       2004-06-23 22:13:52 UTC (rev 2338)
+++ trunk/src/actions/bridger.hxx       2004-06-23 22:47:50 UTC (rev 2339)
@@ -23,7 +23,7 @@
 #include "../vector.hxx"
 #include "../game_counter.hxx"
 #include "../pingu_action.hxx"
-#include "../sprite.hxx"
+#include "../state_sprite.hxx"
 
 namespace Pingus {
 namespace Actions {
@@ -36,8 +36,8 @@
   enum { brick_length = 16 };
 
 private:
-  Sprite walk_sprite;
-  Sprite build_sprite;
+  StateSprite walk_sprite;
+  StateSprite build_sprite;
 
   GameCounter counter;
 

Modified: trunk/src/state_sprite.cxx
===================================================================
--- trunk/src/state_sprite.cxx  2004-06-23 22:13:52 UTC (rev 2338)
+++ trunk/src/state_sprite.cxx  2004-06-23 22:47:50 UTC (rev 2339)
@@ -32,6 +32,12 @@
   sprites[state] = sprite;
 }
 
+void
+StateSprite::update()
+{
+  update(0.033f);
+}
+
 void 
 StateSprite::update(float delta)
 {

Modified: trunk/src/state_sprite.hxx
===================================================================
--- trunk/src/state_sprite.hxx  2004-06-23 22:13:52 UTC (rev 2338)
+++ trunk/src/state_sprite.hxx  2004-06-23 22:47:50 UTC (rev 2339)
@@ -37,6 +37,8 @@
   StateSprite();
   
   void update(float delta);
+  void update();
+
   void load(int state, CL_Sprite);
   CL_Sprite& operator[](int state);
 };





reply via email to

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