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 faller.cxx,1.26,1.27 walker.c


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/actions faller.cxx,1.26,1.27 walker.cxx,1.25,1.26
Date: 3 Oct 2002 00:47:07 -0000

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

Modified Files:
        faller.cxx walker.cxx 
Log Message:
- fixed ghost faller

Index: faller.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/faller.cxx,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- faller.cxx  1 Oct 2002 19:53:45 -0000       1.26
+++ faller.cxx  3 Oct 2002 00:47:05 -0000       1.27
@@ -69,15 +69,12 @@
   pingu->set_velocity(ForcesHolder::apply_forces(pingu->get_pos(), 
pingu->get_velocity()));
     
   Vector newp = pingu->get_velocity();
-  Vector last_pos;
   
   // Update x and y by moving the penguin to it's target *slowly*
   // and checking if the penguin has hit the bottom at each loop
-  while(rel_getpixel(0, 0) == Groundtype::GP_NOTHING
+  while(rel_getpixel(0, -1) == Groundtype::GP_NOTHING
        && (fabs(newp.x) >= 1 || fabs(newp.y) >= 1))
     {
-      last_pos = pingu->get_pos();
-
       if (fabs(newp.x) >= 1)
        { 
          // Since the velocity might be a
@@ -110,7 +107,7 @@
     }
 
   // Now that the Pingu is moved, check if he hits the ground.
-  if (rel_getpixel(0, 0) == Groundtype::GP_NOTHING)
+  if (rel_getpixel(0, -1) == Groundtype::GP_NOTHING)
     { // if pingu is not on ground
       ++falling;
          
@@ -119,7 +116,7 @@
     }
   else // Ping is on ground/water/something
     {
-      if (rel_getpixel(0, 0) == Groundtype::GP_WATER)
+      if (rel_getpixel(0, -1) == Groundtype::GP_WATER)
        {
          pingu->set_action(Actions::Drown);
          return;
@@ -139,10 +136,6 @@
        }
       // Reset the velocity
       pingu->set_velocity(Vector(-(pingu->get_velocity().x/3), 0));
-      pingu->set_pos(last_pos);
-
-      // FIXME: UGLY!
-      //pingu->set_action (Walker);
     }
 }
 

Index: walker.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/walker.cxx,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- walker.cxx  1 Oct 2002 19:53:45 -0000       1.25
+++ walker.cxx  3 Oct 2002 00:47:05 -0000       1.26
@@ -102,7 +102,8 @@
     {
       // simple, stupid, but working bridge code
       // FIXME: We don't check if we 'drift' into a solid ground block
-      pingu->set_pos(pingu->get_x() + pingu->direction, pingu->get_y() - 1); 
// pingus 'float' through bridges
+      pingu->set_pos(pingu->get_x() + pingu->direction,
+                    pingu->get_y() - 1); // pingus 'float' through bridges
     }
   else 
     { 
@@ -136,7 +137,8 @@
       if (found_next_step)
        {
          // pos.y has a reversed co-system to rel_getpixel()?
-         pingu->set_pos(pingu->get_x() + pingu->direction, pingu->get_y() - 
possible_y_step);
+         pingu->set_pos(pingu->get_x() + pingu->direction, 
+                        pingu->get_y() - possible_y_step);
        }
       else
        {





reply via email to

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