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;
38 static int done_action(int i)
40 audio_play(AUD_MENU, 1.0f);
45 return goto_state(&st_start);
48 return goto_name(&st_done_bis, &st_done_bis);
53 static int done_init(int *gidp)
55 const char *s1 = _("New Challenge Record");
56 const char *s2 = _("Challenge Complete");
60 int high = (curr_lg()->times_rank < 3) || (curr_lg()->score_rank < 3);
62 if ((id = gui_vstack(0)))
67 gid = gui_label(id, s1, GUI_MED, GUI_ALL, gui_grn, gui_grn);
69 gid = gui_label(id, s2, GUI_MED, GUI_ALL, gui_blu, gui_grn);
76 if ((jd = gui_harray(id)))
78 gui_most_coins(jd, 1);
79 gui_best_times(jd, 1);
84 if ((jd = gui_harray(id)))
87 gui_state(jd, _("Change Player Name"), GUI_SML, DONE_NAME, 0);
88 gui_start(jd, _("OK"), GUI_SML, DONE_OK, 0);
94 set_best_times(&curr_set()->time_score, curr_lg()->times_rank, 0);
95 set_most_coins(&curr_set()->coin_score, curr_lg()->score_rank);
100 static int done_enter(void)
105 gui_pulse(gid, 1.2f);
109 static int done_bis_enter(void)
111 level_update_player_name();
112 return done_init(NULL);
115 static int done_buttn(int b, int d)
119 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
120 return done_action(gui_token(gui_click()));
121 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
122 return done_action(DONE_OK);
127 /*---------------------------------------------------------------------------*/
129 struct state st_done = {
142 struct state st_done_bis = {