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"
28 /*---------------------------------------------------------------------------*/
30 static int level_enter(void)
34 const struct level_game *lg = curr_lg();
36 const float *textcol1, *textcol2;
38 if ((id = gui_vstack(0)))
40 if ((jd = gui_hstack(id)))
43 b = lg->level->is_bonus;
44 textcol1 = b ? gui_wht : 0;
45 textcol2 = b ? gui_grn : 0;
49 if ((kd = gui_vstack(jd)))
51 gui_label(kd, _(curr_set()->name), GUI_SML,
52 GUI_ALL, gui_wht, gui_wht);
55 if ((ld = gui_hstack(kd)))
59 gui_label(ld, ln, GUI_LRG, GUI_NE,
61 gui_label(ld, _("Level "), GUI_LRG, GUI_NW,
66 gui_label(ld, ln, GUI_MED, GUI_NE,
68 gui_label(ld, _("Bonus Level "), GUI_MED, GUI_NW,
73 gui_label(kd, mode_to_str(lg->mode, 1), GUI_SML, GUI_BOT,
81 if (strlen(lg->level->message) != 0)
82 gui_multi(id, _(lg->level->message), GUI_SML, GUI_ALL, gui_wht,
93 static void level_timer(int id, float dt)
98 static int level_click(int b, int d)
100 return (b < 0 && d == 1) ? goto_state(&st_play_ready) : 1;
103 static int level_keybd(int c, int d)
105 if (d && c == SDLK_F12)
106 return goto_state(&st_poser);
110 static int level_buttn(int b, int d)
114 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
116 return goto_state(&st_play_ready);
118 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
120 level_stat(GAME_NONE, curr_clock(), curr_coins());
122 return goto_state(&st_over);
128 /*---------------------------------------------------------------------------*/
130 static void poser_paint(int id, float st)
135 static int poser_buttn(int c, int d)
137 if (d && config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, c))
138 return goto_state(&st_level);
143 /*---------------------------------------------------------------------------*/
145 struct state st_level = {
159 struct state st_poser = {