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.
29 /*---------------------------------------------------------------------------*/
37 static int done_action(int i)
42 audio_play(AUD_MENU, 1.0f);
44 config_get_s(CONFIG_PLAYER, player, MAXNAM);
50 return goto_state(&st_start);
61 config_set_s(CONFIG_PLAYER, player);
62 level_name(0, player, time_i, coin_i);
63 set_most_coins(0, coin_i);
64 set_best_times(0, time_i);
71 player[l + 0] = gui_keyboard_char((char) i);
74 config_set_s(CONFIG_PLAYER, player);
75 level_name(0, player, time_i, coin_i);
76 set_most_coins(0, coin_i);
77 set_best_times(0, time_i);
83 static int done_enter(void)
85 const char *s1 = _("New Challenge Record");
86 const char *s2 = _("Challenge Complete");
92 high = level_done(&time_i, &coin_i);
94 if ((id = gui_vstack(0)))
99 gid = gui_label(id, s1, GUI_MED, GUI_ALL, gui_grn, gui_grn);
101 gid = gui_label(id, s2, GUI_MED, GUI_ALL, gui_blu, gui_grn);
105 if ((jd = gui_harray(id)))
107 gui_most_coins(jd, 3, 1);
108 gui_best_times(jd, 3, 1);
112 gui_start(id, _("OK"), GUI_SML, DONE_OK, 0);
114 if (high) gui_keyboard(id);
116 gui_layout(id, 0, 0);
117 gui_pulse(gid, 1.2f);
120 set_most_coins(0, coin_i);
121 set_best_times(0, time_i);
126 static void done_leave(int id)
131 static void done_paint(int id, float st)
137 static void done_timer(int id, float dt)
143 static void done_point(int id, int x, int y, int dx, int dy)
145 gui_pulse(gui_point(id, x, y), 1.2f);
148 static void done_stick(int id, int a, int v)
150 if (config_tst_d(CONFIG_JOYSTICK_AXIS_X, a))
151 gui_pulse(gui_stick(id, v, 0), 1.2f);
152 if (config_tst_d(CONFIG_JOYSTICK_AXIS_Y, a))
153 gui_pulse(gui_stick(id, 0, v), 1.2f);
156 static int done_click(int b, int d)
158 if (b <= 0 && d == 1)
159 return done_action(gui_token(gui_click()));
163 static int done_buttn(int b, int d)
167 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
168 return done_click(0, 1);
169 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
170 return done_action(DONE_OK);
175 /*---------------------------------------------------------------------------*/
177 struct state st_done = {