Fixed the problem that in a rare case, a set is downloaded and the neverballrc is...
[neverball] / ball / st_pause.c
index 30667d1..e46333b 100644 (file)
@@ -12,7 +12,6 @@
  * General Public License for more details.
  */
 
-#include <SDL_mixer.h>
 #include "gui.h"
 #include "config.h"
 #include "game.h"
@@ -22,7 +21,7 @@
 #include "hud.h"
 
 #include "st_play.h"
-#include "st_start.h"
+#include "st_over.h"
 #include "st_shared.h"
 #include "st_pause.h"
 
@@ -61,16 +60,14 @@ static int pause_action(int i)
     switch(i)
     {
     case PAUSE_CONTINUE:
-        Mix_ResumeMusic();
+        SDL_PauseAudio(0);
         config_set_grab(0);
         return goto_state(st_continue);
 
     case PAUSE_RESTART:
-        level_stat(GAME_NONE, curr_clock(), curr_coins());
-        level_stop();
+        level_same();
         clear_pause();
-        level_play(curr_lg()->level, curr_lg()->mode);
-        Mix_ResumeMusic();
+        SDL_PauseAudio(0);
         config_set_grab(1);
         return goto_state(&st_play_ready);
 
@@ -78,20 +75,22 @@ static int pause_action(int i)
         level_stat(GAME_NONE, curr_clock(), curr_coins());
         level_stop();
         clear_pause();
-        return goto_state(&st_start);
+        SDL_PauseAudio(0);
+        audio_music_stop();
+        return goto_state(&st_over);
     }
 
     return 1;
 }
 
+/*---------------------------------------------------------------------------*/
 
 static int pause_enter(void)
 {
     int id, jd, title_id;
 
     config_clr_grab();
-
-    Mix_PauseMusic();
+    SDL_PauseAudio(1);
 
     /* Build the pause GUI. */
 
@@ -125,13 +124,13 @@ static int pause_enter(void)
     return id;
 }
 
-void pause_paint(int id, float st)
+static void pause_paint(int id, float st)
 {
     shared_paint(id, st);
     hud_paint();
 }
 
-void pause_timer(int id, float dt)
+static void pause_timer(int id, float dt)
 {
     gui_timer(id, dt);
     hud_timer (dt);
@@ -160,7 +159,7 @@ static int pause_buttn(int b, int d)
 
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
         {
-            if (SDL_GetModState() & (KMOD_SHIFT | KMOD_CTRL | KMOD_ALT | KMOD_META))
+            if (SDL_GetModState() & KMOD_SHIFT)
                 return pause_action(PAUSE_EXIT);
             else
                 return pause_action(PAUSE_CONTINUE);
@@ -178,6 +177,7 @@ struct state st_pause = {
     pause_timer,
     shared_point,
     shared_stick,
+    shared_angle,
     shared_click,
     pause_keybd,
     pause_buttn,