pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/actions angel.hxx,1.3,1.4 basher.cxx,


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/actions angel.hxx,1.3,1.4 basher.cxx,1.7,1.8 basher.hxx,1.4,1.5 blocker.cxx,1.2,1.3 blocker.hxx,1.3,1.4 boarder.cxx,1.2,1.3 boarder.hxx,1.4,1.5 bomber.hxx,1.4,1.5 bridger.cxx,1.6,1.7 bridger.hxx,1.6,1.7 climber.cxx,1.4,1.5 climber.hxx,1.3,1.4 digger.cxx,1.4,1.5 digger.hxx,1.3,1.4 drown.hxx,1.3,1.4 exiter.hxx,1.3,1.4 faller.cxx,1.10,1.11 faller.hxx,1.5,1.6 floater.cxx,1.6,1.7 floater.hxx,1.3,1.4 jumper.cxx,1.3,1.4 jumper.hxx,1.3,1.4 laser_kill.hxx,1.3,1.4 miner.cxx,1.4,1.5 miner.hxx,1.3,1.4 rocket_launcher.cxx,1.1,1.2 rocket_launcher.hxx,1.3,1.4 slider.cxx,1.2,1.3 slider.hxx,1.3,1.4 smashed.hxx,1.3,1.4 splashed.hxx,1.3,1.4 superman.hxx,1.3,1.4 teleported.cxx,1.2,1.3 teleported.hxx,1.3,1.4 waiter.cxx,1.1,1.2 waiter.hxx,1.3,1.4 walker.cxx,1.10,1.11 walker.hxx,1.3,1.4
Date: 28 Jun 2002 15:12:25 -0000

Update of /usr/local/cvsroot/Games/Pingus/src/actions
In directory dark:/tmp/cvs-serv7425/actions

Modified Files:
        angel.hxx basher.cxx basher.hxx blocker.cxx blocker.hxx 
        boarder.cxx boarder.hxx bomber.hxx bridger.cxx bridger.hxx 
        climber.cxx climber.hxx digger.cxx digger.hxx drown.hxx 
        exiter.hxx faller.cxx faller.hxx floater.cxx floater.hxx 
        jumper.cxx jumper.hxx laser_kill.hxx miner.cxx miner.hxx 
        rocket_launcher.cxx rocket_launcher.hxx slider.cxx slider.hxx 
        smashed.hxx splashed.hxx superman.hxx teleported.cxx 
        teleported.hxx waiter.cxx waiter.hxx walker.cxx walker.hxx 
Log Message:
- changed action names from string to enum
- implemented actions slots for wall and fall case
- some cleanup


Index: angel.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/angel.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- angel.hxx   26 Jun 2002 19:13:13 -0000      1.3
+++ angel.hxx   28 Jun 2002 15:12:22 -0000      1.4
@@ -33,6 +33,7 @@
   Angel ();
   void  init();
   std::string get_name() const { return "Angel"; }
+  ActionName get_type() const { return Pingus::Actions::Angel; }
   void  update(float delta);
   void  draw_offset(int, int, float s);
 

Index: basher.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/basher.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- basher.cxx  26 Jun 2002 15:38:44 -0000      1.7
+++ basher.cxx  28 Jun 2002 15:12:22 -0000      1.8
@@ -78,7 +78,7 @@
        }
       else if (sprite.get_progress () > 0.6f)
        {
-         is_finished = true;
+         pingu->set_action(Walker);
        }
     }
 }
@@ -98,8 +98,8 @@
 Basher::walk_forward()
 {
   if (rel_getpixel(0, -1) ==  GroundpieceData::GP_NOTHING) {
-    // We ar e in the air... lets fall...
-    is_finished = true;
+    // We are in the air... lets fall...
+    pingu->set_action(Faller);
   } else {
     // On ground, walk forward...
     pingu->pos.x += pingu->direction;
@@ -115,7 +115,7 @@
       return true;
     }
 
-  for(int i = 0; is_finished == false && i < 16; i++)
+  for(int i = 0; i < 16; i++)
     {
       // Check that there is a high enough wall (i.e. not 1 pixel) to bash.
       // Probably best to check from where Pingu can't automatically walk up

Index: basher.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/basher.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- basher.hxx  26 Jun 2002 19:13:13 -0000      1.4
+++ basher.hxx  28 Jun 2002 15:12:22 -0000      1.5
@@ -38,6 +38,7 @@
   
   void   init(void);
   std::string get_name () const { return "Basher"; }
+  ActionName get_type() const { return Pingus::Actions::Basher; }
   void draw_offset(int x, int y, float s);
   void update(float delta);
   bool have_something_to_dig();

Index: blocker.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/blocker.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- blocker.cxx 25 Jun 2002 18:15:18 -0000      1.2
+++ blocker.cxx 28 Jun 2002 15:12:22 -0000      1.3
@@ -38,8 +38,6 @@
                                                "pingus"));
   sprite.set_align_center_bottom ();
 
-  is_finished = false;
-
   if (rel_getpixel(0,-1)     ==  GroundpieceData::GP_NOTHING
       && rel_getpixel(0, -2) ==  GroundpieceData::GP_GROUND)
     {
@@ -59,7 +57,7 @@
 {
   if (!standing_on_ground())
     {
-      is_finished = true;
+      pingu->set_action(Faller);
     }
 }
 

Index: blocker.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/blocker.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- blocker.hxx 26 Jun 2002 19:13:13 -0000      1.3
+++ blocker.hxx 28 Jun 2002 15:12:22 -0000      1.4
@@ -37,9 +37,10 @@
   ///
   void  init();
   std::string get_name () const { return "Blocker"; }
+  ActionName get_type() const { return Pingus::Actions::Blocker; }
  
   void  update(float delta);
-  void   draw_offset(int, int, float s);
+  void  draw_offset(int, int, float s);
   bool  standing_on_ground();
   ///
   bool  need_catch();

Index: boarder.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/boarder.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- boarder.cxx 19 Jun 2002 15:19:26 -0000      1.2
+++ boarder.cxx 28 Jun 2002 15:12:22 -0000      1.3
@@ -56,7 +56,7 @@
       
       // Incremental update so that we don't skip pixels
       double new_x_pos = pingu->pos.x + pingu->direction * speed;
-      while (int(new_x_pos) != int(pingu->pos.x) && !is_finished)
+      while (int(new_x_pos) != int(pingu->pos.x))
        {
          double old_pos = pingu->pos.x;
          pingu->pos.x += (int(pingu->pos.x) < int(new_x_pos)) ? 1 : -1;
@@ -67,17 +67,17 @@
              pingu->pos.x = old_pos;// + (pingu->direction * 10);
              ////pingu->pos.y = 10;
 
-             pingu->direction.change ();
-             is_finished = true;
-             pingu->apply_force (CL_Vector(speed * pingu->direction * 0.5,
+                     pingu->apply_force (CL_Vector(speed * pingu->direction * 
0.5,
                                            -speed * abs(pingu->direction) * 
0.5));
+              pingu->set_action(Walker);
+              return;
            }
        }
     }
   else
     {
-      is_finished = true;
       pingu->apply_force (CL_Vector(speed * pingu->direction, 0));
+      pingu->set_action(Walker);
     }
 }
 

Index: boarder.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/boarder.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- boarder.hxx 26 Jun 2002 19:13:13 -0000      1.4
+++ boarder.hxx 28 Jun 2002 15:12:22 -0000      1.5
@@ -36,6 +36,7 @@
   Boarder ();
   void  init();
   std::string get_name() const { return "Boarder"; }
+  ActionName get_type() const { return Pingus::Actions::Boarder; }
   void  update(float delta);
   void  draw_offset(int, int, float s);
 private:

Index: bomber.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/bomber.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- bomber.hxx  26 Jun 2002 19:13:13 -0000      1.4
+++ bomber.hxx  28 Jun 2002 15:12:22 -0000      1.5
@@ -45,6 +45,8 @@
   
   void   init(void);
   std::string get_name () const { return "Bomber"; }
+  ActionName get_type() const { return Pingus::Actions::Bomber; }
+  ActionType get_activation_mode() const { return COUNTDOWN_TRIGGERED; }
   void   draw_offset(int x, int y, float s);
   void   update(float delta);
   int    activation_time() { return 50; }

Index: bridger.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/bridger.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- bridger.cxx 26 Jun 2002 11:44:16 -0000      1.6
+++ bridger.cxx 28 Jun 2002 15:12:22 -0000      1.7
@@ -135,7 +135,7 @@
         {
            // Let Walker sort out change of direction (so that in case
            // of a climber, we would start to climb instead of direction 
change)
-          pingu->set_action ("walker");
+          pingu->set_action (Walker);
           pingu->pos = last_pos;
           return;
         }
@@ -161,7 +161,7 @@
         }
       else // Out of bricks
        {
-         pingu->set_action("waiter");
+         pingu->set_action(Waiter);
        }     
     }
 

Index: bridger.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/bridger.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- bridger.hxx 26 Jun 2002 19:13:13 -0000      1.6
+++ bridger.hxx 28 Jun 2002 15:12:22 -0000      1.7
@@ -54,6 +54,7 @@
 
   void   init();
   std::string get_name () const;
+  ActionName get_type() const { return Pingus::Actions::Bridger; }
   void   update(float delta);
   void   update_build (float delta);
   void   update_walk (float delta);

Index: climber.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/climber.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- climber.cxx 25 Jun 2002 18:15:18 -0000      1.4
+++ climber.cxx 28 Jun 2002 15:12:22 -0000      1.5
@@ -84,14 +84,14 @@
             }
 
           // Finish climbing.
-         is_finished = true;
+         pingu->set_action(Walker);
        }
     }
   else 
     {
       //    std::cout << "Climber failed, falling down" << std::endl;
       pingu->direction.change();
-      is_finished = true;
+      pingu->set_action(Walker);
     }
 }
 

Index: climber.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/climber.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- climber.hxx 26 Jun 2002 19:13:13 -0000      1.3
+++ climber.hxx 28 Jun 2002 15:12:22 -0000      1.4
@@ -33,9 +33,10 @@
   Climber();
   void   init();
   std::string get_name () const { return "Climber"; }
+  ActionName get_type() const { return Pingus::Actions::Climber; }
+  ActionType get_activation_mode() const { return WALL_TRIGGERED; }
   void draw_offset(int x, int y, float s=1.0);
   void update(float delta);
-  ActionType get_type(void) { return (ActionType)WALL; }
   char get_persistent_char () { return 'c'; }
 };
 

Index: digger.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/digger.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- digger.cxx  25 Jun 2002 18:15:18 -0000      1.4
+++ digger.cxx  28 Jun 2002 15:12:22 -0000      1.5
@@ -58,7 +58,7 @@
   if (!have_something_to_dig())
     { 
       dig ();
-      is_finished = true;
+      pingu->set_action(Walker);
     }
 }
 

Index: digger.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/digger.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- digger.hxx  26 Jun 2002 19:13:13 -0000      1.3
+++ digger.hxx  28 Jun 2002 15:12:22 -0000      1.4
@@ -36,6 +36,7 @@
 
   void init(void);
   std::string get_name () const { return "Digger"; }
+  ActionName get_type() const { return Pingus::Actions::Digger; }
   bool have_something_to_dig();
   void dig();
   void update(float delta);

Index: drown.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/drown.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- drown.hxx   26 Jun 2002 19:13:13 -0000      1.3
+++ drown.hxx   28 Jun 2002 15:12:22 -0000      1.4
@@ -30,6 +30,7 @@
 public:
   void init();
   std::string get_name() const { return "Drown"; }
+  ActionName get_type() const { return Pingus::Actions::Drown; }
   void update(float delta);
   void draw_offset(int x, int y, float s);
   bool catchable () { return false; }

Index: exiter.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/exiter.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- exiter.hxx  26 Jun 2002 19:13:13 -0000      1.3
+++ exiter.hxx  28 Jun 2002 15:12:22 -0000      1.4
@@ -31,6 +31,7 @@
 public:
   void init(void);
   std::string get_name () const { return "Exiter"; }
+  ActionName get_type() const { return Pingus::Actions::Exiter; }
   void update(float delta);
   void draw_offset(int x, int y, float s);
 };

Index: faller.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/faller.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- faller.cxx  26 Jun 2002 19:13:13 -0000      1.10
+++ faller.cxx  28 Jun 2002 15:12:22 -0000      1.11
@@ -54,22 +54,18 @@
   tumbler.update (delta);
   faller.update (delta);
 
-  // FIXME: This should be triggered at a later point, when close to
-  // FIXME: deadly_velocity or something like that
-  for (unsigned int i=0; i < pingu->persist.size(); ++i) {
-    if (pingu->persist[i]->get_name() == "Floater") {
-      pingu->set_action("floater");
-      return;
-    }
-  }
-
   // Pingu stands on ground
   if (rel_getpixel(0, -1) !=  GroundpieceData::GP_NOTHING)
     { 
-      pingu->set_action ("walker");
+      pingu->set_action (Walker);
       return;
     }
 
+  // FIXME: This should be triggered at a later point, when close to
+  // FIXME: deadly_velocity or something like that
+  if (pingu->set_fall_action())
+    return;
+
   // Apply all forces
   pingu->velocity = ForcesHolder::apply_forces(pingu->pos, pingu->velocity);
     
@@ -126,7 +122,7 @@
     {
       if (rel_getpixel(0, 0) == GroundpieceData::GP_WATER)
        {
-         pingu->set_action("drown");
+         pingu->set_action(Drown);
          return;
        }
       else
@@ -134,7 +130,7 @@
          // Did we stop too fast?
          if (fabs(pingu->velocity.y) > deadly_velocity) 
            {
-             pingu->set_action("splashed");
+             pingu->set_action(Splashed);
              return;
            }
          else if (fabs(pingu->velocity.x) > deadly_velocity)
@@ -149,7 +145,7 @@
       pingu->pos = last_pos;
 
       // FIXME: UGLY!
-      //pingu->set_action ("walker");
+      //pingu->set_action (Walker);
     }
 }
 
@@ -179,9 +175,9 @@
 }
 
 bool
-Faller::change_allowed (const std::string& new_action)
+Faller::change_allowed (ActionName new_action)
 {
-  if (new_action == "floater")
+  if (new_action == Floater)
     return true;
   else
     return false;

Index: faller.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/faller.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- faller.hxx  26 Jun 2002 19:13:13 -0000      1.5
+++ faller.hxx  28 Jun 2002 15:12:22 -0000      1.6
@@ -42,9 +42,10 @@
   void  update(float delta);
   void  draw_offset(int x, int y, float s);
 
-  bool change_allowed (const std::string&);
+  bool change_allowed (ActionName new_action);
   
   std::string get_name() const { return "Faller"; }
+  ActionName get_type() const { return Pingus::Actions::Faller; }
   bool is_tumbling () const;
 };
 

Index: floater.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/floater.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- floater.cxx 26 Jun 2002 19:13:13 -0000      1.6
+++ floater.cxx 28 Jun 2002 15:12:22 -0000      1.7
@@ -47,21 +47,8 @@
       step = 0;
     }
   } else {
-    pingu->set_action ("walker");
+    pingu->set_action (Walker);
   }
-
-  // FIXME: use action slots here instead of a for-loop
-  if (rel_getpixel(0, -1) == GroundpieceData::GP_NOTHING) 
-    {
-      for (unsigned int i=0; i < pingu->get_persistent_actions ()->size(); 
++i) 
-       {
-         if ((*(pingu->get_persistent_actions ()))[i]->get_type() == 
(ActionType)FALL) 
-           {
-             // FIXME: Use action slots instead of the persistend vector
-              pingu->set_action("floater");
-           }
-       }
-    }
 }
 
 void 

Index: floater.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/floater.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- floater.hxx 26 Jun 2002 19:13:13 -0000      1.3
+++ floater.hxx 28 Jun 2002 15:12:22 -0000      1.4
@@ -35,7 +35,8 @@
   Floater();
 
   std::string get_name() const { return "Floater"; }
-  ActionType get_type(void) { return FALL; };
+  ActionName get_type() const { return Pingus::Actions::Faller; }
+  ActionType get_activation_mode() { return FALL_TRIGGERED; };
   void init(void);
   void update(float delta);
   void draw_offset (int x, int y, float s);

Index: jumper.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/jumper.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- jumper.cxx  26 Jun 2002 17:43:18 -0000      1.3
+++ jumper.cxx  28 Jun 2002 15:12:22 -0000      1.4
@@ -53,7 +53,7 @@
   // Move the pingu in the air, so that it can start 'falling'
   pingu->pos.y -= 1;
 
-  pingu->set_action ("faller");
+  pingu->set_action (Faller);
 }
 
 /* EOF */

Index: jumper.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/jumper.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- jumper.hxx  26 Jun 2002 19:13:13 -0000      1.3
+++ jumper.hxx  28 Jun 2002 15:12:22 -0000      1.4
@@ -33,6 +33,7 @@
 
   void  init(void);
   std::string get_name() const { return "Jumper"; }
+  ActionName get_type() const { return Pingus::Actions::Jumper; }
   void  update(float delta);
   void  draw_offset(int x, int y, float s);
 };

Index: laser_kill.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/laser_kill.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- laser_kill.hxx      26 Jun 2002 19:13:13 -0000      1.3
+++ laser_kill.hxx      28 Jun 2002 15:12:22 -0000      1.4
@@ -32,6 +32,7 @@
   ///
   LaserKill();
   std::string get_name() const { return "LaserKill"; }
+  ActionName get_type() const { return Pingus::Actions::Laserkill; }
   void init(void);
   void update(float delta);
   void draw_offset(int x, int y, float s);

Index: miner.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/miner.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- miner.cxx   25 Jun 2002 18:15:18 -0000      1.4
+++ miner.cxx   28 Jun 2002 15:12:22 -0000      1.5
@@ -75,7 +75,7 @@
       pingu->get_world()->get_gfx_map()->remove(miner_radius_gfx,
                                                pingu->get_x () - 16 + 
pingu->direction, 
                                                pingu->get_y () - 29);
-      is_finished = true;
+      pingu->set_action(Walker);
     }
   else if (rel_getpixel(0, -1) ==  GroundpieceData::GP_SOLID)
     {
@@ -84,7 +84,7 @@
                                               pingu->get_y () - 31);
       pingu->get_world()->get_gfx_map()->remove(miner_radius_gfx, pingu->get_x 
() - 16 + pingu->direction, 
                                                pingu->get_y () - 31);
-      is_finished = true;
+      pingu->set_action(Walker);
     }
 }
 

Index: miner.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/miner.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- miner.hxx   26 Jun 2002 19:13:13 -0000      1.3
+++ miner.hxx   28 Jun 2002 15:12:22 -0000      1.4
@@ -38,6 +38,7 @@
 
   void init(void);
   std::string get_name() const { return "Miner"; }
+  ActionName get_type() const { return Pingus::Actions::Miner; }
   void update(float delta);
   void draw_offset(int x, int y, float s);
 };

Index: rocket_launcher.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/rocket_launcher.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- rocket_launcher.cxx 12 Jun 2002 19:01:42 -0000      1.1
+++ rocket_launcher.cxx 28 Jun 2002 15:12:22 -0000      1.2
@@ -47,7 +47,7 @@
 {
   if (sprite.finished ())
     {
-      is_finished = true;
+      pingu->set_action(Walker);
     }
 
   sprite.update (delta);

Index: rocket_launcher.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/rocket_launcher.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- rocket_launcher.hxx 26 Jun 2002 19:13:13 -0000      1.3
+++ rocket_launcher.hxx 28 Jun 2002 15:12:22 -0000      1.4
@@ -35,6 +35,7 @@
 
   void  init();
   std::string get_name() const { return "RocketLauncher"; }
+  ActionName get_type() const { return Pingus::Actions::Rocketlauncher; }
   void  update(float delta);
   void  draw_offset(int, int, float s);
 };

Index: slider.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/slider.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- slider.cxx  25 Jun 2002 18:15:18 -0000      1.2
+++ slider.cxx  28 Jun 2002 15:12:22 -0000      1.3
@@ -59,13 +59,13 @@
            pingu->velocity += CL_Vector(-speed, 0.0);
          }
 
-         is_finished = true;
+         pingu->set_action(Walker);
        }
     }
 
   speed -= 7 * delta;
   if (speed < 1)
-    is_finished = true;
+    pingu->set_action(Walker);
 }
 
 void

Index: slider.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/slider.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- slider.hxx  26 Jun 2002 19:13:13 -0000      1.3
+++ slider.hxx  28 Jun 2002 15:12:22 -0000      1.4
@@ -33,6 +33,7 @@
 
   void  init(void);
   std::string get_name() const { return "Slider"; }
+  ActionName get_type() const { return Pingus::Actions::Slider; }
   void  update(float delta);
   void  draw_offset(int x, int y, float s);
 };

Index: smashed.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/smashed.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- smashed.hxx 26 Jun 2002 19:13:13 -0000      1.3
+++ smashed.hxx 28 Jun 2002 15:12:23 -0000      1.4
@@ -33,6 +33,7 @@
 public:
   void   init(void);
   std::string get_name() const { return "Smashed"; }
+  ActionName get_type() const { return Pingus::Actions::Smashed; }
   void update(float delta);
   void draw_offset(int x, int y, float s);
   bool catchable () { return false; }

Index: splashed.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/splashed.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- splashed.hxx        26 Jun 2002 19:13:13 -0000      1.3
+++ splashed.hxx        28 Jun 2002 15:12:23 -0000      1.4
@@ -36,6 +36,7 @@
   
   void   init(void);
   std::string get_name() const { return "Splashed"; }
+  ActionName get_type() const { return Pingus::Actions::Splashed; }
   void update(float delta);
   void draw_offset(int x, int y, float s);
   bool catchable () { return false; }

Index: superman.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/superman.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- superman.hxx        26 Jun 2002 19:13:13 -0000      1.3
+++ superman.hxx        28 Jun 2002 15:12:23 -0000      1.4
@@ -32,6 +32,7 @@
   Superman ();
   void  init();
   std::string get_name() const { return "Superman"; }
+  ActionName get_type() const { return Pingus::Actions::Superman; }
   void  update(float delta);
   void  draw_offset(int, int, float s);
 

Index: teleported.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/teleported.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- teleported.cxx      13 Jun 2002 14:25:12 -0000      1.2
+++ teleported.cxx      28 Jun 2002 15:12:23 -0000      1.3
@@ -44,7 +44,7 @@
 {
   pingu->set_pos (x_target, y_target);
   pingu->set_status(PS_ALIVE);
-  is_finished = true;
+  pingu->set_action(Walker);
 }
 
 /* EOF */

Index: teleported.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/teleported.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- teleported.hxx      26 Jun 2002 19:13:13 -0000      1.3
+++ teleported.hxx      28 Jun 2002 15:12:23 -0000      1.4
@@ -31,7 +31,8 @@
 public:
   Teleported();
 
-  std::string get_name() const { return "LaserKill"; }
+  std::string get_name() const { return "Teleported"; }
+  ActionName get_type() const { return Pingus::Actions::Teleported; }
   void init(void);
   void update(float delta);
   void draw_offset(int x, int y, float s);

Index: waiter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/waiter.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- waiter.cxx  12 Jun 2002 19:01:43 -0000      1.1
+++ waiter.cxx  28 Jun 2002 15:12:23 -0000      1.2
@@ -31,7 +31,7 @@
   sprite.update (delta);
   
   if (countdown < 0)
-    is_finished = true;
+    pingu->set_action(Walker);
   
   countdown -= delta;
 }

Index: waiter.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/waiter.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- waiter.hxx  26 Jun 2002 19:13:13 -0000      1.3
+++ waiter.hxx  28 Jun 2002 15:12:23 -0000      1.4
@@ -37,6 +37,7 @@
   /// 
   void init();
   std::string get_name() const { return "Waiter"; }
+  ActionName get_type() const { return Pingus::Actions::Waiter; }
   void update(float delta);
   void  draw_offset(int x, int y, float s);
 };

Index: walker.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/walker.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- walker.cxx  28 Jun 2002 09:51:46 -0000      1.10
+++ walker.cxx  28 Jun 2002 15:12:23 -0000      1.11
@@ -62,7 +62,7 @@
 
   if (rel_getpixel(0, -1) ==  GroundpieceData::GP_WATER)
     {
-      pingu->set_action ("drown");
+      pingu->set_action (Drown);
       return;
     }
 
@@ -89,7 +89,7 @@
        }
       else
        {
-         pingu->set_action ("faller");
+         pingu->set_action (Faller);
          return;
        }
     }
@@ -139,25 +139,13 @@
          if (rel_getpixel(1, 0) !=  GroundpieceData::GP_NOTHING)
            {
              // We reached a wall
-
-             // Check if there is a persistent action
-             for (unsigned int i=0; i < pingu->persist.size(); ++i) 
-               {
-                 if (pingu->persist[i]->get_type() & (ActionType)WALL) 
-                   {
-                     pout(PINGUS_DEBUG_ACTIONS) 
-                       << "Pingu: We are in front of a wall, setting 
persistant action" << std::endl;
-                     // pingu->set_paction(pingu->persist[i]->get_name());
-                     // FIXME: above fails because of Capitalised name
-                     // returned from get_name(). May be we should 
-                     // use capitalised names everywhere. 
-  
-                     // Do we set  any other action here?
-                     pingu->set_action("climber");
-                     return;
-                   }
-               }
-             
+              if (pingu->set_wall_action()) 
+                {
+                 pout(PINGUS_DEBUG_ACTIONS) 
+                   << "Pingu: We are in front of a wall, setting persistant 
action" << std::endl;
+                 return;
+                }
+            
              // No persitent action found, so change the direction
              pingu->direction.change();              
            }
@@ -166,7 +154,7 @@
              // We take the step, so that we are in the air
              pingu->pos.x += pingu->direction;
              // We reached a cliff
-             pingu->set_action ("faller");
+             pingu->set_action (Faller);
              return;
            }
        }

Index: walker.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/walker.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- walker.hxx  26 Jun 2002 19:13:13 -0000      1.3
+++ walker.hxx  28 Jun 2002 15:12:23 -0000      1.4
@@ -37,6 +37,7 @@
   void  draw_offset(int x, int y, float s);
 
   std::string get_name() const { return "Walker"; }
+  ActionName get_type() const { return Pingus::Actions::Walker; }
 };
 
 #endif




reply via email to

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