Restore original Escape behaviour if pause key is not Escape
authorparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sat, 19 Apr 2008 16:17:17 +0000 (16:17 +0000)
committerparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sat, 19 Apr 2008 16:17:17 +0000 (16:17 +0000)
The "original" Escape  key behaviour meant here is  "exit no questions
asked".  The  implementation is  actually "wrong",  based on  the fact
that the  game converts Escape  key presses to joystick  "exit" button
events.  Thus, the "pause key is  not Escape" test is performed in the
state buttn  handler when  in fact  we have no  idea where  the button
event  came from.   However, the  resulting behaviour  believed to  be
identical to that in 1.4.0 for both keyboard and joystick.

git-svn-id: https://s.snth.net/svn/neverball/trunk@2081 78b8d119-cf0a-0410-b17c-f493084dd1d7

ball/st_demo.c
ball/st_pause.c
ball/st_play.c
putt/st_all.c

index 7f60069..a6f9169 100644 (file)
@@ -402,8 +402,9 @@ static int demo_play_buttn(int b, int d)
     {
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
         {
-            if (!(SDL_GetModState() & KMOD_SHIFT))
+            if (config_tst_d(CONFIG_KEY_PAUSE, SDLK_ESCAPE))
                 demo_paused = 1;
+
             return goto_state(&st_demo_end);
         }
     }
@@ -514,6 +515,7 @@ static int demo_end_buttn(int b, int d)
     {
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
             return demo_end_action(gui_token(gui_click()));
+
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
         {
             if (demo_paused)
index 12ddff3..fd8c03b 100644 (file)
@@ -155,12 +155,7 @@ static int pause_buttn(int b, int d)
             return pause_action(gui_token(gui_click()));
 
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
-        {
-            if (SDL_GetModState() & KMOD_SHIFT)
-                return pause_action(PAUSE_EXIT);
-            else
-                return pause_action(PAUSE_CONTINUE);
-        }
+            return pause_action(PAUSE_CONTINUE);
     }
     return 1;
 }
index a8291f1..fbf6a73 100644 (file)
@@ -34,15 +34,19 @@ static int view_rotate;
 
 static int pause_or_exit(void)
 {
-    if (SDL_GetModState() & KMOD_SHIFT)
+    if (config_tst_d(CONFIG_KEY_PAUSE, SDLK_ESCAPE))
+    {
+        return goto_pause();
+    }
+    else
     {
         progress_stat(GAME_NONE);
         progress_stop();
+
         config_clr_grab();
 
         return goto_state(&st_over);
     }
-    return goto_pause();
 }
 
 /*---------------------------------------------------------------------------*/
index 6898d56..a4c366e 100644 (file)
@@ -550,7 +550,7 @@ int goto_pause(struct state *s, int e)
     if (curr_state() == &st_pause)
         return 1;
 
-    if (e && (SDL_GetModState() & KMOD_SHIFT))
+    if (e && !config_tst_d(CONFIG_KEY_PAUSE, SDLK_ESCAPE))
         return goto_state(s);
 
     st_continue = curr_state();
@@ -654,8 +654,6 @@ static int shared_keybd(int c, int d)
 {
     if (d)
     {
-        if (c == SDLK_ESCAPE)
-            return goto_pause(&st_over, 1);
         if (config_tst_d(CONFIG_KEY_PAUSE, c))
             return goto_pause(&st_over, 0);
     }