Those sets haven't been merged.
[neverball] / ball / st_over.c
index 160d0c8..c455042 100644 (file)
@@ -1,4 +1,4 @@
-/*   
+/*
  * Copyright (C) 2003 Robert Kooima
  *
  * NEVERBALL is  free software; you can redistribute  it and/or modify
 #include "gui.h"
 #include "set.h"
 #include "game.h"
-#include "level.h"
+#include "levels.h"
 #include "audio.h"
 #include "config.h"
 #include "demo.h"
+#include "st_shared.h"
 
 #include "st_over.h"
 #include "st_start.h"
@@ -29,6 +30,9 @@ static int over_enter(void)
 {
     int id;
 
+    if (curr_lg()->mode != MODE_CHALLENGE)
+        return 0;
+
     if ((id = gui_label(0, _("GAME OVER"), GUI_LRG, GUI_ALL, gui_gry, gui_red)))
     {
         gui_layout(id, 0, 0);
@@ -43,29 +47,12 @@ static int over_enter(void)
     return id;
 }
 
-static void over_leave(int id)
-{
-    gui_delete(id);
-}
-
-static void over_paint(int id, float st)
-{
-    game_draw(0, st);
-    gui_paint(id);
-}
-
 static void over_timer(int id, float dt)
 {
-    if (dt > 0.f && time_state() > 3.f)
+    if (curr_lg()->mode != MODE_CHALLENGE || time_state() > 3.f)
         goto_state(&st_start);
 
     gui_timer(id, dt);
-    audio_timer(dt);
-}
-
-static int over_keybd(int c, int d)
-{
-    return (d && c == SDLK_ESCAPE) ? goto_state(&st_start) : 1;
 }
 
 static int over_click(int b, int d)
@@ -78,7 +65,6 @@ static int over_buttn(int b, int d)
     if (d)
     {
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b) ||
-            config_tst_d(CONFIG_JOYSTICK_BUTTON_B, b) ||
             config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
             return goto_state(&st_start);
     }
@@ -89,13 +75,14 @@ static int over_buttn(int b, int d)
 
 struct state st_over = {
     over_enter,
-    over_leave,
-    over_paint,
+    shared_leave,
+    shared_paint,
     over_timer,
     NULL,
     NULL,
+    NULL,
     over_click,
-    over_keybd,
+    NULL,
     over_buttn,
     1, 0
 };