pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src pingu_action.cxx,1.13,1.14


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src pingu_action.cxx,1.13,1.14
Date: 3 Nov 2002 13:41:31 -0000

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

Modified Files:
        pingu_action.cxx 
Log Message:
- removed the symmetric code

Index: pingu_action.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_action.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- pingu_action.cxx    3 Nov 2002 13:29:09 -0000       1.13
+++ pingu_action.cxx    3 Nov 2002 13:41:29 -0000       1.14
@@ -142,9 +142,9 @@
 
   // Keep moving the Pingu until there is only a fraction left
   while (   force_counter.x <= -1 
-         || force_counter.x >=  1
-         || force_counter.y <= -1
-         || force_counter.y >=  1)
+            || force_counter.x >=  1
+            || force_counter.y <= -1
+            || force_counter.y >=  1)
     {
       x_numerator += x_inc;
 
@@ -154,50 +154,24 @@
          // Revert back to being a fraction
          x_numerator -= denominator;
 
-          // FIXME: Symmetric code is EXTREMLY UGLY!!!!
-
-         // Move the Pingu depending on what the direction of the force is
-         if (force_counter.x >= 1)
-           {
-             // If there is something to the right of the Pingu
-             if (collision_on_walk(pingu->direction, 0))
-               {
-                 // Make the Pingu reflect/bounce off the wall
-                 force_counter.x = -(force_counter.x);
-                 resultant_force.x = -(resultant_force.x/3);
-
-                 pingu->set_velocity(resultant_force);
-
-                 pingu->direction.change();
-               }
-             else
-               {
-                 // Move the Pingu right
-                 pingu->set_x(pingu->get_x() + 1);
-                 force_counter.x--;
-               }
-           }
-         else if (force_counter.x <= -1)
-           {
-             // If there is something to the left of the Pingu
-             if (collision_on_walk(-(pingu->direction), 0))
-               {
-                 // Make the Pingu reflect off the wall
-                 force_counter.x = -(force_counter.x);
-                 resultant_force.x = -(resultant_force.x/3);
+          // If there is something to the left of the Pingu
+          if (collision_on_walk(1, 0))
+            {
+              // Make the Pingu reflect off the wall
+              force_counter.x = -(force_counter.x);
+              resultant_force.x = -(resultant_force.x/3);
 
-                 pingu->set_velocity(resultant_force);
+              pingu->set_velocity(resultant_force);
 
-                 pingu->direction.change();
-               }
-             else
-               {
-                 // Move the Pingu left
-                 pingu->set_x(pingu->get_x() - 1);
-                 force_counter.x++;
-               }
-           }
-       }
+              pingu->direction.change();
+            }
+          else
+            {
+              // Move the Pingu left
+              pingu->set_x(pingu->get_x() + pingu->direction);
+              force_counter.x -= pingu->direction;
+            }
+        }
 
       y_numerator += y_inc;
 
@@ -245,7 +219,7 @@
                }
            }
        }
-   }
+    }
 
 }
 





reply via email to

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