fixed bug which caused tux to "swing" on low frame rates
authorTobias Gläßer <tobi.web@gmx.de>
Sun, 29 Feb 2004 21:59:17 +0000 (21:59 +0000)
committerTobias Gläßer <tobi.web@gmx.de>
Sun, 29 Feb 2004 21:59:17 +0000 (21:59 +0000)
SVN-Revision: 161

src/gameloop.c
src/player.c

index 5c6f4c9..199546c 100644 (file)
@@ -686,7 +686,7 @@ int gameloop(char * subset, int levelnb, int mode)
         }
 
       if(tux.input.down == DOWN)
-        SDL_Delay(30);
+        SDL_Delay(45);
 
       /*Draw the current scene to the screen */
       /*If the machine running the game is too slow
index 44d5830..9423b10 100644 (file)
@@ -882,9 +882,17 @@ void player_input(player_type *pplayer)
   else
     {
       if(pplayer->base.xm > 0)
-        pplayer->base.xm = (int)(pplayer->base.xm - frame_ratio);
+        {
+          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);
+        {
+          pplayer->base.xm = (int)(pplayer->base.xm + frame_ratio);
+          if(pplayer->base.xm > 0)
+            pplayer->base.xm = 0;
+        }
     }
 
   /* Jump/jumping? */