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.
30 /*---------------------------------------------------------------------------*/
35 extern struct state st_done_bis;
41 static int done_action(int i)
43 audio_play(AUD_MENU, 1.0f);
48 return goto_state(&st_start);
51 return goto_name(&st_done_bis, &st_done_bis);
56 static int done_init(int * gidp)
58 const char *s1 = _("New Challenge Record");
59 const char *s2 = _("Challenge Complete");
63 if ((id = gui_vstack(0)))
68 gid = gui_label(id, s1, GUI_MED, GUI_ALL, gui_grn, gui_grn);
70 gid = gui_label(id, s2, GUI_MED, GUI_ALL, gui_blu, gui_grn);
77 if ((jd = gui_harray(id)))
79 gui_most_coins(jd, 3, 1);
80 gui_best_times(jd, 3, 1);
85 if ((jd = gui_harray(id)))
88 gui_state(jd, _("Change Player Name"), GUI_SML, DONE_NAME, 0);
89 gui_start(jd, _("OK"), GUI_SML, DONE_OK, 0);
95 set_most_coins(0, coin_i);
96 set_best_times(0, time_i);
101 static int done_enter(void)
107 high = level_done(&time_i, &coin_i);
110 gui_pulse(gid, 1.2f);
114 static int done_bis_enter(void)
117 config_get_s(CONFIG_PLAYER, player, MAXNAM);
118 level_name(0, player, time_i, coin_i);
119 return done_init(NULL);
122 static void done_leave(int id)
127 static void done_paint(int id, float st)
133 static void done_timer(int id, float dt)
139 static void done_point(int id, int x, int y, int dx, int dy)
141 gui_pulse(gui_point(id, x, y), 1.2f);
144 static void done_stick(int id, int a, int v)
146 if (config_tst_d(CONFIG_JOYSTICK_AXIS_X, a))
147 gui_pulse(gui_stick(id, v, 0), 1.2f);
148 if (config_tst_d(CONFIG_JOYSTICK_AXIS_Y, a))
149 gui_pulse(gui_stick(id, 0, v), 1.2f);
152 static int done_click(int b, int d)
154 if (b <= 0 && d == 1)
155 return done_action(gui_token(gui_click()));
159 static int done_buttn(int b, int d)
163 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
164 return done_click(0, 1);
165 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
166 return done_action(DONE_OK);
171 /*---------------------------------------------------------------------------*/
173 struct state st_done = {
186 struct state st_done_bis = {