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.
23 #include "game_common.h"
28 #include "st_shared.h"
30 /*---------------------------------------------------------------------------*/
40 static int do_init = 1;
42 static int set_action(int i)
44 audio_play(AUD_MENU, 1.0f);
50 return goto_state(&st_title);
58 return goto_state(&st_set);
67 return goto_state(&st_set);
79 return goto_state(&st_start);
86 static void gui_set(int id, int i)
89 gui_state(id, set_name(i), GUI_SML, i, 0);
91 gui_label(id, "", GUI_SML, GUI_ALL, 0, 0);
94 static int set_enter(void)
96 int w = config_get_d(CONFIG_WIDTH);
97 int h = config_get_d(CONFIG_HEIGHT);
106 first = MIN(first, (total - 1) - ((total - 1) % SET_STEP));
108 audio_music_fade_to(0.5f, "bgm/inter.ogg");
109 audio_play(AUD_START, 1.f);
113 if ((id = gui_vstack(0)))
115 if ((jd = gui_hstack(id)))
117 gui_label(jd, _("Level Set"), GUI_SML, GUI_ALL, gui_yel, gui_red);
119 gui_navig(jd, first > 0, first + SET_STEP < total);
124 if ((jd = gui_harray(id)))
126 shot_id = gui_image(jd, set_shot(first), 7 * w / 16, 7 * h / 16);
128 if ((kd = gui_varray(jd)))
130 for (i = first; i < first + SET_STEP; i++)
136 desc_id = gui_multi(id, " \\ \\ \\ \\ \\", GUI_SML, GUI_ALL,
139 gui_layout(id, 0, 0);
144 static void set_over(int i)
146 gui_set_image(shot_id, set_shot(i));
147 gui_set_multi(desc_id, set_desc(i));
150 static void set_point(int id, int x, int y, int dx, int dy)
152 int jd = shared_point_basic(id, x, y);
153 int i = gui_token(jd);
154 if (jd && set_exists(i))
158 static void set_stick(int id, int a, int v)
160 int jd = shared_stick_basic(id, a, v);
161 int i = gui_token(jd);
162 if (jd && set_exists(i))
166 static int set_buttn(int b, int d)
170 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
171 return set_action(gui_token(gui_click()));
172 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
173 return set_action(GUI_BACK);
178 /*---------------------------------------------------------------------------*/
180 struct state st_set = {