Merged branch utf8.
[neverball] / ball / st_play.c
index c52b7c3..6bb5487 100644 (file)
@@ -25,7 +25,7 @@
 #include "st_goal.h"
 #include "st_fall_out.h"
 #include "st_time_out.h"
-#include "st_start.h"
+#include "st_over.h"
 #include "st_pause.h"
 
 /*---------------------------------------------------------------------------*/
@@ -34,14 +34,15 @@ static int view_rotate;
 
 static int pause_or_exit(void)
 {
-    if (SDL_GetModState() & (KMOD_SHIFT | KMOD_CTRL | KMOD_ALT | KMOD_META))
+    if (SDL_GetModState() & KMOD_SHIFT)
     {
-        level_stop(GAME_NONE, curr_clock(), curr_coins());
+        level_stat(GAME_NONE, curr_clock(), curr_coins());
+        level_stop();
         config_clr_grab();
-        return goto_state(&st_start);
+        
+        return goto_state(&st_over);
     }
-    else
-        return goto_pause();
+    return goto_pause();
 }
 
 /*---------------------------------------------------------------------------*/
@@ -210,11 +211,9 @@ static void play_loop_paint(int id, float st)
         gui_paint(id);
 }
 
-#define CAMERA_MODIFIERS (KMOD_SHIFT | KMOD_CTRL | KMOD_ALT | KMOD_META)
-
 static void play_loop_timer(int id, float dt)
 {
-    float k = ((SDL_GetModState() & CAMERA_MODIFIERS) ?
+    float k = ((SDL_GetModState() & KMOD_SHIFT) ?
                (float) config_get_d(CONFIG_ROTATE_FAST) / 100.f:
                (float) config_get_d(CONFIG_ROTATE_SLOW) / 100.f);
 
@@ -231,17 +230,17 @@ static void play_loop_timer(int id, float dt)
     switch (game_step(g, at, 1))
     {
     case GAME_GOAL:
-        level_stop(GAME_GOAL, curr_clock(), curr_coins());
+        level_stat(GAME_GOAL, curr_clock(), curr_coins());
         goto_state(&st_goal);
         break;
 
     case GAME_FALL:
-        level_stop(GAME_FALL, curr_clock(), curr_coins());
+        level_stat(GAME_FALL, curr_clock(), curr_coins());
         goto_state(&st_fall_out);
         break;
 
     case GAME_TIME:
-        level_stop(GAME_TIME, curr_clock(), curr_coins());
+        level_stat(GAME_TIME, curr_clock(), curr_coins());
         goto_state(&st_time_out);
         break;
 
@@ -300,8 +299,7 @@ static int play_loop_keybd(int c, int d)
         if (config_tst_d(CONFIG_KEY_RESTART, c) &&
             curr_lg()->mode != MODE_CHALLENGE)
         {
-            level_stop(GAME_NONE, curr_clock(), curr_coins());
-            level_play(curr_lg()->level, curr_lg()->mode);
+            level_same();
             goto_state(&st_play_ready);
         }
         if (config_tst_d(CONFIG_KEY_PAUSE, c))
@@ -315,16 +313,15 @@ static int play_loop_keybd(int c, int d)
             view_rotate = 0;
     }
 
-    if (d && c == SDLK_F12 && config_get_d(CONFIG_CHEAT))
+    if (d && c == SDLK_F12 && config_cheat())
         return goto_state(&st_look);
 
     if (d && c == SDLK_F6)
         nohud = !nohud;
 
-    /* Cheat */
-    if (d && c == SDLK_c && config_get_d(CONFIG_CHEAT))
+    if (d && c == SDLK_c && config_cheat())
     {
-        level_stop(GAME_GOAL, curr_clock(), curr_coins());
+        level_stat(GAME_GOAL, curr_clock(), curr_coins());
         return goto_state(&st_goal);
     }
     return 1;