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.
23 #include "game_common.h"
28 #include "st_time_out.h"
30 #include "st_shared.h"
33 /*---------------------------------------------------------------------------*/
35 #define TIME_OUT_NEXT 1
36 #define TIME_OUT_SAME 2
37 #define TIME_OUT_SAVE 3
38 #define TIME_OUT_BACK 4
39 #define TIME_OUT_OVER 5
41 static int time_out_action(int i)
43 audio_play(AUD_MENU, 1.0f);
52 return goto_state(&st_over);
56 return goto_save(&st_time_out, &st_time_out);
60 return goto_state(&st_level);
65 return goto_state(&st_level);
72 static int time_out_enter(void)
76 if ((id = gui_vstack(0)))
78 kd = gui_label(id, _("Time's Up!"), GUI_LRG, GUI_ALL, gui_gry, gui_red);
82 if ((jd = gui_harray(id)))
85 gui_start(jd, _("Exit"), GUI_SML, TIME_OUT_OVER, 0);
87 if (progress_next_avail())
88 gui_start(jd, _("Next Level"), GUI_SML, TIME_OUT_NEXT, 0);
90 if (progress_same_avail())
91 gui_start(jd, _("Retry Level"), GUI_SML, TIME_OUT_SAME, 0);
94 gui_state(jd, _("Save Replay"), GUI_SML, TIME_OUT_SAVE, 0);
102 audio_music_fade_out(2.0f);
103 /* audio_play(AUD_TIME, 1.0f); */
110 static int time_out_keybd(int c, int d)
114 if (config_tst_d(CONFIG_KEY_RESTART, c) && progress_same_avail())
117 goto_state(&st_play_ready);
123 static int time_out_buttn(int b, int d)
127 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
128 return time_out_action(gui_token(gui_click()));
129 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
130 return time_out_action(TIME_OUT_BACK);
135 /*---------------------------------------------------------------------------*/
137 struct state st_time_out = {