Reuse a variable in date_to_str(). It also appears to make a bit more
[neverball] / ball / st_play.c
index 69f61ff..b44e38e 100644 (file)
@@ -1,4 +1,4 @@
-/*   
+/*
  * Copyright (C) 2003 Robert Kooima
  *
  * NEVERBALL is  free software; you can redistribute  it and/or modify
@@ -156,7 +156,7 @@ static int play_loop_enter(void)
 
     game_set_fly(0.f);
     view_rotate = 0;
-    
+
     hud_view_pulse(config_get_d(CONFIG_CAMERA));
 
     nohud = 0;
@@ -188,7 +188,7 @@ static void play_loop_timer(int id, float dt)
     float g[3] = { 0.0f, -9.8f, 0.0f };
 
     int state, state_value;
-    
+
     at = (7 * at + dt) / 8;
 
     gui_timer(id, at);
@@ -196,15 +196,16 @@ static void play_loop_timer(int id, float dt)
     game_set_rot(view_rotate * k);
 
     state = game_step(g, at, &state_value);
-    if (state)
-    {
-       level_stop(state, state_value, curr_clock(), curr_coins());
-       goto_state(&st_play_end);
-    }
 
     game_step_fade(dt);
     demo_play_step(at);
     audio_timer(dt);
+
+    if (state)
+    {
+        level_stop(state, state_value, curr_clock(), curr_coins());
+        goto_state(&st_play_end);
+    }
 }
 
 static void play_loop_point(int id, int x, int y, int dx, int dy)
@@ -250,6 +251,12 @@ static int play_loop_keybd(int c, int d)
             config_set_d(CONFIG_CAMERA, 2);
             hud_view_pulse(2);
         }
+        if (c == SDLK_r && curr_lg()->mode != MODE_CHALLENGE)
+        {
+            level_stop(GAME_NONE, 0, curr_clock(), curr_coins());
+            level_play_go();
+            goto_state(&st_play_set);
+        }
     }
     else
     {
@@ -261,10 +268,10 @@ static int play_loop_keybd(int c, int d)
 
     if (d && c == SDLK_F12)
         return goto_state(&st_look);
-    
+
     if (d && c == SDLK_F6)
         nohud = !nohud;
-    
+
     /* Cheat */
     if (d && c == SDLK_c && config_get_d(CONFIG_CHEAT))
     {
@@ -279,10 +286,10 @@ static int play_loop_buttn(int b, int d)
     if (d == 1)
     {
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
-       {
-           level_stop(GAME_NONE, 0, curr_clock(), curr_coins());
+        {
+            level_stop(GAME_NONE, 0, curr_clock(), curr_coins());
             return abort_play();
-       }
+        }
 
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_R, b))
             view_rotate = +1;
@@ -353,7 +360,7 @@ static void look_point(int id, int x, int y, int dx, int dy)
 static int look_keybd(int c, int d)
 {
     if (d && c == SDLK_F12)
-       return goto_state(&st_play_loop);
+        return goto_state(&st_play_loop);
 
     return 1;
 }
@@ -361,7 +368,7 @@ static int look_keybd(int c, int d)
 static int look_buttn(int b, int d)
 {
     if (d && config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
-       return goto_state(&st_play_loop);
+        return goto_state(&st_play_loop);
 
     return 1;
 }