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 "st_shared.h"
30 /*---------------------------------------------------------------------------*/
32 static int level_enter(void)
36 if ((id = gui_vstack(0)))
38 if ((jd = gui_hstack(id)))
42 if ((kd = gui_vstack(jd)))
44 const char *ln = level_name (curr_level());
45 int b = level_bonus(curr_level());
47 char setattr[MAXSTR], lvlattr[MAXSTR];
50 sprintf(lvlattr, _("Bonus Level %s"), ln);
52 sprintf(lvlattr, _("Level %s"), ln);
54 if (curr_mode() == MODE_CHALLENGE)
55 sprintf(setattr, "%s: %s", set_name(curr_set()),
56 mode_to_str(MODE_CHALLENGE, 1));
58 sprintf(setattr, "%s", set_name(curr_set()));
60 gui_label(kd, lvlattr, b ? GUI_MED : GUI_LRG, GUI_TOP,
61 b ? gui_wht : 0, b ? gui_grn : 0);
62 gui_label(kd, setattr, GUI_SML, GUI_BOT,
69 gui_multi(id, level_msg(curr_level()),
81 static void level_timer(int id, float dt)
86 static int level_click(int b, int d)
88 return (b < 0 && d == 1) ? goto_state(&st_play_ready) : 1;
91 static int level_keybd(int c, int d)
93 if (d && c == SDLK_F12)
94 return goto_state(&st_poser);
98 static int level_buttn(int b, int d)
102 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
104 return goto_state(&st_play_ready);
106 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
109 return goto_state(&st_over);
115 /*---------------------------------------------------------------------------*/
117 static void poser_paint(int id, float t)
122 static int poser_buttn(int c, int d)
124 if (d && config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, c))
125 return goto_state(&st_level);
130 /*---------------------------------------------------------------------------*/
132 struct state st_level = {
146 struct state st_poser = {