2 * Copyright (C) 2007 Robert Kooima
4 * NEVERBALL is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published
6 * by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
26 #include "st_time_out.h"
28 #include "st_shared.h"
31 /*---------------------------------------------------------------------------*/
33 #define TIME_OUT_NEXT 1
34 #define TIME_OUT_SAME 2
35 #define TIME_OUT_SAVE 3
36 #define TIME_OUT_BACK 4
37 #define TIME_OUT_OVER 5
39 static int time_out_action(int i)
41 audio_play(AUD_MENU, 1.0f);
50 return goto_state(&st_over);
54 return goto_save(&st_time_out, &st_time_out);
58 return goto_state(&st_level);
63 return goto_state(&st_level);
70 static int time_out_enter(void)
74 if ((id = gui_vstack(0)))
76 kd = gui_label(id, _("Time's Up!"), GUI_LRG, GUI_ALL, gui_gry, gui_red);
80 if ((jd = gui_harray(id)))
83 gui_start(jd, _("Exit"), GUI_SML, TIME_OUT_OVER, 0);
85 if (progress_next_avail())
86 gui_start(jd, _("Next Level"), GUI_SML, TIME_OUT_NEXT, 0);
88 if (progress_same_avail())
89 gui_start(jd, _("Retry Level"), GUI_SML, TIME_OUT_SAME, 0);
92 gui_state(jd, _("Save Replay"), GUI_SML, TIME_OUT_SAVE, 0);
100 audio_music_fade_out(2.0f);
101 /* audio_play(AUD_TIME, 1.0f); */
108 static int time_out_keybd(int c, int d)
112 if (config_tst_d(CONFIG_KEY_RESTART, c) && progress_same_avail())
115 goto_state(&st_play_ready);
121 static int time_out_buttn(int b, int d)
125 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
126 return time_out_action(gui_token(gui_click()));
127 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
128 return time_out_action(TIME_OUT_BACK);
133 /*---------------------------------------------------------------------------*/
135 struct state st_time_out = {