When pressing a player's key and then press Esc, the player will still be going in...
[supertux.git] / src / gameloop.cpp
index 6ea6f4a..78b4a88 100644 (file)
@@ -188,6 +188,7 @@ GameSession::on_escape_press()
   else if (!Menu::current())
     {
       Menu::set_current(game_menu);
+      st_pause_ticks_start();
     }
 }
 
@@ -217,7 +218,8 @@ GameSession::process_events()
           if (Menu::current())
             {
               Menu::current()->event(event);
-              st_pause_ticks_start();
+             if(!Menu::current())
+             st_pause_ticks_stop();
             }
 
           switch(event.type)
@@ -259,7 +261,18 @@ GameSession::process_events()
           if (Menu::current())
             {
               Menu::current()->event(event);
-              st_pause_ticks_start();
+             if(!Menu::current())
+             st_pause_ticks_stop();
+
+            /* Tell Tux that the keys are all down, otherwise
+               it could have nasty bugs, like going allways to the right
+               or whatever that key does */
+            Player& tux = *world->get_tux();
+            tux.key_event((SDLKey)keymap.jump, UP);
+            tux.key_event((SDLKey)keymap.duck, UP);
+            tux.key_event((SDLKey)keymap.left, UP);
+            tux.key_event((SDLKey)keymap.right, UP);
+            tux.key_event((SDLKey)keymap.fire, UP);
             }
           else
             {