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
);
51 return goto_state(&st_title
);
62 config_set_s(CONFIG_PLAYER
, player
);
63 level_name(0, player
, time_i
, coin_i
);
72 player
[l
+ 0] = gui_keyboard_char((char) i
);
75 config_set_s(CONFIG_PLAYER
, player
);
76 level_name(0, player
, time_i
, coin_i
);
84 static int done_enter(void)
86 const char *s1
= "New Set Record";
87 const char *s2
= "Set Complete";
93 high
= level_done(&time_i
, &coin_i
);
95 if ((id
= gui_vstack(0)))
100 gid
= gui_label(id
, s1
, GUI_MED
, GUI_ALL
, gui_grn
, gui_grn
);
102 gid
= gui_label(id
, s2
, GUI_MED
, GUI_ALL
, gui_blu
, gui_grn
);
106 if ((jd
= gui_harray(id
)))
108 gui_most_coins(jd
, 4, coin_i
);
109 gui_best_times(jd
, 4, time_i
);
113 gui_start(id
, "Main Menu", GUI_SML
, DONE_OK
, 0);
115 if (high
) gui_keyboard(id
);
117 gui_layout(id
, 0, 0);
118 gui_pulse(gid
, 1.2f
);
121 set_most_coins(0, 4);
122 set_best_times(0, 4);
127 static void done_leave(int id
)
132 static void done_paint(int id
, float st
)
138 static void done_timer(int id
, float dt
)
144 static void done_point(int id
, int x
, int y
, int dx
, int dy
)
146 gui_pulse(gui_point(id
, x
, y
), 1.2f
);
149 static void done_stick(int id
, int a
, int v
)
151 if (config_tst_d(CONFIG_JOYSTICK_AXIS_X
, a
))
152 gui_pulse(gui_stick(id
, v
, 0), 1.2f
);
153 if (config_tst_d(CONFIG_JOYSTICK_AXIS_Y
, a
))
154 gui_pulse(gui_stick(id
, 0, v
), 1.2f
);
157 static int done_click(int b
, int d
)
159 if (b
<= 0 && d
== 1)
160 return done_action(gui_token(gui_click()));
164 static int done_keybd(int c
, int d
)
166 if (d
&& c
== SDLK_ESCAPE
)
167 goto_state(&st_title
);
171 static int done_buttn(int b
, int d
)
175 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A
, b
))
176 return done_click(0, 1);
177 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT
, b
))
178 return goto_state(&st_title
);
183 /*---------------------------------------------------------------------------*/
185 struct state st_done
= {