2 * Copyright (C) 2003 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.
20 #include "st_shared.h"
28 /*---------------------------------------------------------------------------*/
35 static int fail_action(int i)
37 struct state * next = level_dead() ? &st_over : &st_level;
41 return goto_end_level();
44 return goto_state(&st_over);
47 return goto_state(&st_level);
50 return goto_save(next, next);
55 static int fail_buttn(int b, int d)
59 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
60 return fail_action(gui_token(gui_click()));
61 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
62 return fail_action(FAIL_BACK);
67 static int fall_out_enter(void)
71 if ((id = gui_vstack(0)))
73 kd = gui_label(id, _("Fall-out!"), GUI_LRG, GUI_ALL, gui_gry, gui_red);
75 if ((jd = gui_harray(id)))
77 gui_state(jd, _("Save Replay"), GUI_SML, FAIL_SAVE, 0);
80 gui_start(jd, _("Game Over"), GUI_SML, FAIL_OVER, 0);
82 gui_start(jd, _("Retry Level"), GUI_SML, FAIL_RETRY, 0);
89 audio_music_fade_out(2.0f);
90 audio_play(AUD_FALL, 1.0f);
97 static void fall_out_timer(int id, float dt)
99 float g[3] = { 0.0f, -9.8f, 0.0f };
101 if (time_state() < 2.f)
109 /*---------------------------------------------------------------------------*/
111 static int time_out_enter(void)
115 if ((id = gui_vstack(0)))
117 kd = gui_label(id, _("Time's Up!"), GUI_LRG, GUI_ALL, gui_gry, gui_red);
119 if ((jd = gui_harray(id)))
121 gui_state(jd, _("Save Replay"), GUI_SML, FAIL_SAVE, 0);
124 gui_start(jd, _("Game Over"), GUI_SML, FAIL_OVER, 0);
126 gui_start(jd, _("Retry Level"), GUI_SML, FAIL_RETRY, 0);
130 gui_layout(id, 0, 0);
133 audio_music_fade_out(2.0f);
134 audio_play(AUD_TIME, 1.0f);
141 /*---------------------------------------------------------------------------*/
143 struct state st_fall_out = {
156 struct state st_time_out = {