Clean up non-replay pause a bit
authorparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Mon, 6 Sep 2010 21:46:25 +0000 (21:46 +0000)
committerparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Mon, 6 Sep 2010 21:46:25 +0000 (21:46 +0000)
git-svn-id: https://s.snth.net/svn/neverball/trunk@3271 78b8d119-cf0a-0410-b17c-f493084dd1d7

ball/main.c
ball/st_pause.c
ball/st_pause.h
ball/st_play.c

index 60b07df..00fefef 100644 (file)
@@ -180,7 +180,7 @@ static int loop(void)
         case SDL_ACTIVEEVENT:
             if (e.active.state == SDL_APPINPUTFOCUS)
                 if (e.active.gain == 0 && video_get_grab())
-                    goto_pause();
+                    goto_state(&st_pause);
             break;
 
         case SDL_JOYAXISMOTION:
index ebd841b..4272c01 100644 (file)
 #define PAUSE_RESTART  2
 #define PAUSE_EXIT     3
 
-/*---------------------------------------------------------------------------*/
-
 static struct state *st_continue;
-static int paused;
-
-int goto_pause(void)
-{
-    st_continue = curr_state();
-    paused = 1;
-    return goto_state(&st_pause);
-}
-
-int is_paused(void)
-{
-    return paused;
-}
-
-void clear_pause(void)
-{
-    paused = 0;
-}
 
 /*---------------------------------------------------------------------------*/
 
@@ -69,7 +49,6 @@ static int pause_action(int i)
     case PAUSE_RESTART:
         if (progress_same())
         {
-            clear_pause();
             SDL_PauseAudio(0);
             video_set_grab(1);
             return goto_state(&st_play_ready);
@@ -79,7 +58,6 @@ static int pause_action(int i)
     case PAUSE_EXIT:
         progress_stat(GAME_NONE);
         progress_stop();
-        clear_pause();
         SDL_PauseAudio(0);
         audio_music_stop();
         return goto_state(&st_over);
@@ -94,6 +72,8 @@ static int pause_enter(struct state *st, struct state *prev)
 {
     int id, jd, title_id;
 
+    st_continue = prev;
+
     video_clr_grab();
     SDL_PauseAudio(1);
 
index f0cb935..4e13f38 100644 (file)
@@ -5,8 +5,4 @@
 
 extern struct state st_pause;
 
-int  goto_pause(void);
-int  is_paused(void);
-void clear_pause(void);
-
 #endif
index 2542fd1..5b23b94 100644 (file)
@@ -40,7 +40,7 @@ static int pause_or_exit(void)
 {
     if (config_tst_d(CONFIG_KEY_PAUSE, SDLK_ESCAPE))
     {
-        return goto_pause();
+        return goto_state(&st_pause);
     }
     else
     {
@@ -168,7 +168,7 @@ static int play_ready_keybd(int c, int d)
         keybd_camera(c);
 
         if (config_tst_d(CONFIG_KEY_PAUSE, c))
-            goto_pause();
+            goto_state(&st_pause);
     }
     return 1;
 }
@@ -201,8 +201,6 @@ static int play_set_enter(struct state *st, struct state *prev)
 
     audio_play(AUD_SET, 1.f);
 
-    clear_pause();
-
     return id;
 }
 
@@ -246,7 +244,7 @@ static int play_set_keybd(int c, int d)
         keybd_camera(c);
 
         if (config_tst_d(CONFIG_KEY_PAUSE, c))
-            goto_pause();
+            goto_state(&st_pause);
     }
     return 1;
 }
@@ -301,11 +299,8 @@ static int play_loop_enter(struct state *st, struct state *prev)
     VIEWR_SET_L(0);
     fast_rotate = 0;
 
-    if (is_paused())
-    {
-        clear_pause();
+    if (prev == &st_pause)
         return 0;
-    }
 
     if ((id = gui_label(0, _("GO!"), GUI_LRG, GUI_ALL, gui_blu, gui_grn)))
     {
@@ -450,7 +445,7 @@ static int play_loop_keybd(int c, int d)
                 goto_state(&st_play_ready);
         }
         if (config_tst_d(CONFIG_KEY_PAUSE, c))
-            goto_pause();
+            goto_state(&st_pause);
     }
     else
     {