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"
31 /*---------------------------------------------------------------------------*/
36 extern struct state st_done_bis;
42 static int done_action(int i)
44 audio_play(AUD_MENU, 1.0f);
49 return goto_state(&st_start);
52 return goto_name(&st_done_bis, &st_done_bis);
57 static int done_init(int * gidp)
59 const char *s1 = _("New Challenge Record");
60 const char *s2 = _("Challenge Complete");
64 if ((id = gui_vstack(0)))
69 gid = gui_label(id, s1, GUI_MED, GUI_ALL, gui_grn, gui_grn);
71 gid = gui_label(id, s2, GUI_MED, GUI_ALL, gui_blu, gui_grn);
78 if ((jd = gui_harray(id)))
80 gui_most_coins(jd, 3, 1);
81 gui_best_times(jd, 3, 1);
86 if ((jd = gui_harray(id)))
89 gui_state(jd, _("Change Player Name"), GUI_SML, DONE_NAME, 0);
90 gui_start(jd, _("OK"), GUI_SML, DONE_OK, 0);
96 set_most_coins(0, coin_i);
97 set_best_times(0, time_i);
102 static int done_enter(void)
108 high = level_done(&time_i, &coin_i);
111 gui_pulse(gid, 1.2f);
115 static int done_bis_enter(void)
118 config_get_s(CONFIG_PLAYER, player, MAXNAM);
119 level_name(0, player, time_i, coin_i);
120 return done_init(NULL);
123 static int done_buttn(int b, int d)
127 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
128 return done_action(gui_token(gui_click()));
129 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
130 return done_action(DONE_OK);
135 /*---------------------------------------------------------------------------*/
137 struct state st_done = {
150 struct state st_done_bis = {