prevents stucking in some situations, when Tux is ducked.
authorTobias Gläßer <tobi.web@gmx.de>
Sat, 13 Mar 2004 20:08:20 +0000 (20:08 +0000)
committerTobias Gläßer <tobi.web@gmx.de>
Sat, 13 Mar 2004 20:08:20 +0000 (20:08 +0000)
SVN-Revision: 206

src/player.c

index 3df8f89..507837d 100644 (file)
@@ -490,28 +490,30 @@ void player_input(player_type *pplayer)
 {
   /* Handle key and joystick state: */
 
-
-  if (pplayer->input.right == DOWN && pplayer->input.left == UP)
-    {
-      player_handle_horizontal_input(pplayer,RIGHT);
-    }
-  else if (pplayer->input.left == DOWN && pplayer->input.right == UP)
+  if(pplayer->duck == NO)
     {
-      player_handle_horizontal_input(pplayer,LEFT);
-    }
-  else
-    {
-      if(pplayer->base.xm > 0)
+      if (pplayer->input.right == DOWN && pplayer->input.left == UP)
+        {
+          player_handle_horizontal_input(pplayer,RIGHT);
+        }
+      else if (pplayer->input.left == DOWN && pplayer->input.right == UP)
         {
-          pplayer->base.xm = (int)(pplayer->base.xm - frame_ratio);
-          if(pplayer->base.xm < 0)
-            pplayer->base.xm = 0;
+          player_handle_horizontal_input(pplayer,LEFT);
         }
-      else if(pplayer->base.xm < 0)
+      else
         {
-          pplayer->base.xm = (int)(pplayer->base.xm + frame_ratio);
           if(pplayer->base.xm > 0)
-            pplayer->base.xm = 0;
+            {
+              pplayer->base.xm = (int)(pplayer->base.xm - frame_ratio);
+              if(pplayer->base.xm < 0)
+                pplayer->base.xm = 0;
+            }
+          else if(pplayer->base.xm < 0)
+            {
+              pplayer->base.xm = (int)(pplayer->base.xm + frame_ratio);
+              if(pplayer->base.xm > 0)
+                pplayer->base.xm = 0;
+            }
         }
     }
 
@@ -864,10 +866,10 @@ void player_collision(player_type* pplayer, void* p_c_object, int c_object)
               else
                 {
                   pbad_c->dir = LEFT;
-                  pbad_c->base.x = pbad_c->base.x - 32;          
+                  pbad_c->base.x = pbad_c->base.x - 32;
                 }
-             
-            timer_start(&pbad_c->timer,5000);
+
+              timer_start(&pbad_c->timer,5000);
             }
           else if (pbad_c->mode == FLAT && pplayer->input.fire == DOWN)
             {