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.
25 #include "st_shared.h"
28 #define PAUSE_CONTINUE 1
29 #define PAUSE_RESTART 2
32 /*---------------------------------------------------------------------------*/
34 static struct state *st_continue;
39 st_continue = curr_state();
41 return goto_state(&st_pause);
49 void clear_pause(void)
54 /*---------------------------------------------------------------------------*/
56 static int pause_action(int i)
58 audio_play(AUD_MENU, 1.0f);
65 return goto_state(st_continue);
73 return goto_state(&st_play_ready);
78 progress_stat(GAME_NONE);
83 return goto_state(&st_over);
89 /*---------------------------------------------------------------------------*/
91 static int pause_enter(void)
98 /* Build the pause GUI. */
100 if ((id = gui_vstack(0)))
102 title_id = gui_label(id, _("Paused"), GUI_LRG, GUI_ALL, 0, 0);
106 if ((jd = gui_harray(id)))
108 gui_state(jd, _("Quit"), GUI_SML, PAUSE_EXIT, 0);
110 if (progress_same_avail())
111 gui_state(jd, _("Restart"), GUI_SML, PAUSE_RESTART, 0);
113 gui_start(jd, _("Continue"), GUI_SML, PAUSE_CONTINUE, 1);
116 gui_pulse(title_id, 1.2f);
117 gui_layout(id, 0, 0);
125 static void pause_paint(int id, float t)
131 static void pause_timer(int id, float dt)
137 static int pause_keybd(int c, int d)
141 if (config_tst_d(CONFIG_KEY_PAUSE, c))
142 return pause_action(PAUSE_CONTINUE);
144 if (config_tst_d(CONFIG_KEY_RESTART, c) && progress_same_avail())
145 return pause_action(PAUSE_RESTART);
150 static int pause_buttn(int b, int d)
154 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
155 return pause_action(gui_token(gui_click()));
157 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
158 return pause_action(PAUSE_CONTINUE);
163 /*---------------------------------------------------------------------------*/
165 struct state st_pause = {