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.
21 #include "st_shared.h"
27 /*---------------------------------------------------------------------------*/
31 static int level_enter(void)
35 const struct level_game * lg = curr_lg();
38 level_ok = level_play_go();
40 if ((id = gui_vstack(0)))
42 if (lg->mode == MODE_SINGLE)
44 gui_label(id, _("Single Level"), GUI_LRG, GUI_TOP, 0, 0);
46 else if ((jd = gui_hstack(id)))
49 if ((kd = gui_vstack(jd)))
51 if (level_extra_bonus(lg->level))
52 gui_label(kd, _("*** BONUS ***"), GUI_MED, GUI_TOP, gui_wht, gui_grn);
53 if ((ld = gui_hstack(kd)))
55 ln = _(level_number_name(lg->level));
56 if (level_extra_bonus(lg->level))
58 gui_label(ld, ln, GUI_LRG, 0, gui_wht, gui_grn);
59 gui_label(ld, _("Level "), GUI_LRG, 0, gui_wht, gui_grn);
63 gui_label(ld, ln, GUI_LRG, GUI_NE, 0, 0);
64 gui_label(ld, _("Level "), GUI_LRG, GUI_NW, 0, 0);
68 gui_label(kd, _(set_name(set_curr())), GUI_SML, GUI_BOT, gui_wht, gui_wht);
75 gui_multi(id, _(curr_intro()), GUI_SML, GUI_ALL, gui_wht, gui_wht);
77 gui_label(id, _("Cannot load the level file."), GUI_SML, GUI_ALL, gui_red, gui_red);
87 static void level_timer(int id, float dt)
93 static int level_click(int b, int d)
98 return goto_state(&st_play_ready);
100 return goto_end_level();
106 static int level_keybd(int c, int d)
108 if (d && c == SDLK_F12)
109 return goto_state(&st_poser);
113 static int level_buttn(int b, int d)
117 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
120 return goto_state(&st_play_ready);
122 return goto_end_level();
124 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
125 return goto_end_level();
130 /*---------------------------------------------------------------------------*/
132 static void poser_paint(int id, float st)
137 static int poser_buttn(int c, int d)
139 return (d && config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, c)) ? goto_state(&st_level) : 1;
142 /*---------------------------------------------------------------------------*/
144 struct state st_level = {
157 struct state st_poser = {