{
audio_play(AUD_MENU, 1.0f);
- switch(i)
+ switch (i)
{
- case HELP_BACK: return goto_state(&st_title);
- case HELP_RULE: return goto_state(&st_help);
- case HELP_CONT: return goto_state(&st_help2);
- case HELP_MODE: return goto_state(&st_help3);
- case HELP_SECR: return goto_state(&st_help4);
- case HELP_CRED: return goto_state(&st_help5);
+ case HELP_BACK: return goto_state(&st_title);
+ case HELP_RULE: return goto_state(&st_help);
+ case HELP_CONT: return goto_state(&st_help2);
+ case HELP_MODE: return goto_state(&st_help3);
+ case HELP_SECR: return goto_state(&st_help4);
+ case HELP_CRED: return goto_state(&st_help5);
}
return 1;
}
{
int kd = gui_state(id, text, GUI_SML, token, token == atoken);
if (token == atoken)
- gui_focus(kd);
+ gui_focus(kd);
return kd;
}
gui_filler(id);
if ((jd = gui_harray(id)))
{
- help_button(jd, _("Credits"), HELP_CRED, i);
- help_button(jd, _("Secrets"), HELP_SECR, i);
- help_button(jd, _("Modes"), HELP_MODE, i);
- help_button(jd, _("Controls"), HELP_CONT, i);
- help_button(jd, _("Rules"), HELP_RULE, i);
- help_button(jd, _("Back"), HELP_BACK, i);
+ help_button(jd, _("Credits"), HELP_CRED, i);
+ help_button(jd, _("Secrets"), HELP_SECR, i);
+ help_button(jd, _("Modes"), HELP_MODE, i);
+ help_button(jd, _("Controls"), HELP_CONT, i);
+ help_button(jd, _("Rules"), HELP_RULE, i);
+ help_button(jd, _("Back"), HELP_BACK, i);
}
gui_filler(id);
return jd;
static int help1_enter(void)
{
const char *s0 = _(
- "Move the mouse or joystick\\"
- "or use keyboard arrows to\\"
- "tilt the floor causing the\\"
- "ball to roll.\\ ");
+ "Move the mouse or joystick\\"
+ "or use keyboard arrows to\\"
+ "tilt the floor causing the\\"
+ "ball to roll.\\ ");
const char *s1 = _(
- "Roll over coins to collect\\"
- "them. Collect coins to\\"
- "unlock the goal and finish\\"
- "the level.\\ ");
+ "Roll over coins to collect\\"
+ "them. Collect coins to\\"
+ "unlock the goal and finish\\"
+ "the level.\\ ");
int w = config_get_d(CONFIG_WIDTH);
int h = config_get_d(CONFIG_HEIGHT);
if ((id = gui_vstack(0)))
{
- help_menu(id, HELP_RULE);
-
- if ((jd = gui_hstack(id)))
- {
- gui_image(jd, "gui/help1.jpg", 6 * w / 16, 6 * h / 16);
+ help_menu(id, HELP_RULE);
+
+ if ((jd = gui_hstack(id)))
+ {
+ gui_image(jd, "gui/help1.jpg", 6 * w / 16, 6 * h / 16);
gui_multi(jd, s0, GUI_SML, GUI_ALL, gui_wht, gui_wht);
- gui_filler(jd);
- }
- gui_space(id);
- if ((jd = gui_hstack(id)))
- {
- gui_filler(jd);
+ gui_filler(jd);
+ }
+ gui_space(id);
+ if ((jd = gui_hstack(id)))
+ {
+ gui_filler(jd);
gui_multi(jd, s1, GUI_SML, GUI_ALL, gui_wht, gui_wht);
- gui_image(jd, "gui/help2.jpg", 6 * w / 16, 6 * h / 16);
- }
+ gui_image(jd, "gui/help2.jpg", 6 * w / 16, 6 * h / 16);
+ }
gui_layout(id, 0, +1);
}
return id;
if ((id = gui_vstack(0)))
{
- help_menu(id, HELP_CONT);
-
+ help_menu(id, HELP_CONT);
+
if ((jd = gui_harray(id)))
{
gui_label(jd, s6, GUI_SML, GUI_NE, gui_wht, gui_wht);
if ((id = gui_vstack(0)))
{
- help_menu(id, HELP_MODE);
-
- gui_label(id, _("Normal"), GUI_SML, GUI_TOP, 0, 0);
- gui_multi(id,
- "Finish a level before the time run out.\\"
- "You need to collect coins in order to open the goal.",
- GUI_SML, GUI_BOT, gui_wht, gui_wht);
-
+ help_menu(id, HELP_MODE);
+
+ gui_label(id, _("Normal"), GUI_SML, GUI_TOP, 0, 0);
+ gui_multi(id,
+ "Finish a level before the time run out.\\"
+ "You need to collect coins in order to open the goal.",
+ GUI_SML, GUI_BOT, gui_wht, gui_wht);
+
gui_space(id);
-
- gui_label(id, _("Practice"), GUI_SML, GUI_TOP, 0, 0);
- gui_multi(id,
- "Play a level without time or coin constraint.",
- GUI_SML, GUI_BOT, gui_wht, gui_wht);
-
+
+ gui_label(id, _("Practice"), GUI_SML, GUI_TOP, 0, 0);
+ gui_multi(id, "Play a level without time or coin constraint.",
+ GUI_SML, GUI_BOT, gui_wht, gui_wht);
+
gui_space(id);
-
- gui_label(id, _("Challenge"), GUI_SML, GUI_TOP, 0, 0);
- gui_multi(id,
- "Start playing from the first level of the level set.\\"
- "You start with only four balls, do not lose them.\\"
- "Earn an extra ball for each 100 coins collected.",
- GUI_SML, GUI_BOT, gui_wht, gui_wht);
+
+ gui_label(id, _("Challenge"), GUI_SML, GUI_TOP, 0, 0);
+ gui_multi(id,
+ "Start playing from the first level of the level set.\\"
+ "You start with only four balls, do not lose them.\\"
+ "Earn an extra ball for each 100 coins collected.",
+ GUI_SML, GUI_BOT, gui_wht, gui_wht);
gui_layout(id, 0, +1);
}
static int help4_enter(void)
{
const char *s0 = _(
- " \\"
- " \\"
- " \\"
- " \\ ");
+ " \\"
+ " \\"
+ " \\"
+ " \\ ");
const char *s1 = _(
- " \\"
- " \\"
- " \\"
- " \\ ");
+ " \\"
+ " \\"
+ " \\"
+ " \\ ");
int w = config_get_d(CONFIG_WIDTH);
int h = config_get_d(CONFIG_HEIGHT);
if ((id = gui_vstack(0)))
{
- help_menu(id, HELP_SECR);
-
- if ((jd = gui_hstack(id)))
- {
- gui_filler(jd);
+ help_menu(id, HELP_SECR);
+
+ if ((jd = gui_hstack(id)))
+ {
+ gui_filler(jd);
gui_multi(jd, s0, GUI_SML, GUI_ALL, gui_wht, gui_wht);
- gui_image(jd, "gui/help3.jpg", 6 * w / 16, 6 * h / 16);
- }
- gui_space(id);
- if ((jd = gui_hstack(id)))
- {
- gui_image(jd, "gui/help4.jpg", 6 * w / 16, 6 * h / 16);
+ gui_image(jd, "gui/help3.jpg", 6 * w / 16, 6 * h / 16);
+ }
+ gui_space(id);
+ if ((jd = gui_hstack(id)))
+ {
+ gui_image(jd, "gui/help4.jpg", 6 * w / 16, 6 * h / 16);
gui_multi(jd, s1, GUI_SML, GUI_ALL, gui_wht, gui_wht);
- gui_filler(jd);
- }
+ gui_filler(jd);
+ }
gui_layout(id, 0, +1);
}
return id;
if ((id = gui_vstack(0)))
{
- help_menu(id, HELP_CRED);
-
- gui_label(id, _("Lead Maintainer"), GUI_SML, GUI_TOP, 0, 0);
- gui_label(id, "Robert Kooima <robert.kooima@gmail.com>", GUI_SML, GUI_BOT , gui_wht, gui_wht);
-
+ help_menu(id, HELP_CRED);
+
+ gui_label(id, _("Lead Maintainer"), GUI_SML, GUI_TOP, 0, 0);
+ gui_label(id, "Robert Kooima <robert.kooima@gmail.com>",
+ GUI_SML, GUI_BOT , gui_wht, gui_wht);
+
gui_space(id);
-
- gui_label(id, _("Developers"), GUI_SML, GUI_TOP, 0, 0);
- gui_label(id, "Robert Kooima, Jean Privat", GUI_SML, GUI_BOT , gui_wht, gui_wht);
-
+
+ gui_label(id, _("Developers"), GUI_SML, GUI_TOP, 0, 0);
+ gui_label(id, "Robert Kooima, Jean Privat",
+ GUI_SML, GUI_BOT , gui_wht, gui_wht);
+
gui_space(id);
-
- gui_label(id, _("Level Contribution"), GUI_SML, GUI_TOP, 0, 0);
- gui_multi(id, "Robert Kooima, Jean Privat, Jānis Rūcis,\\Paul Tompkins, Mehdi Yousfi-Monod", GUI_SML, GUI_BOT , gui_wht, gui_wht);
-
+
+ gui_label(id, _("Level Contribution"), GUI_SML, GUI_TOP, 0, 0);
+ gui_multi(id,
+ "Robert Kooima, Jean Privat, Jānis Rūcis,\\"
+ "Paul Tompkins, Mehdi Yousfi-Monod",
+ GUI_SML, GUI_BOT , gui_wht, gui_wht);
+
gui_space(id);
-
- gui_label(id, _("Translation"), GUI_SML, GUI_TOP, 0, 0);
- gui_multi(id, "French: Jean Privat, Mehdi Yousfi-Monod;\\"
- "German: Georg Wachter; Latvian: Jānis Rūcis", GUI_SML, GUI_BOT , gui_wht, gui_wht);
-
+
+ gui_label(id, _("Translation"), GUI_SML, GUI_TOP, 0, 0);
+ gui_multi(id,
+ "French: Jean Privat, Mehdi Yousfi-Monod;\\"
+ "German: Georg Wachter; Latvian: Jānis Rūcis",
+ GUI_SML, GUI_BOT , gui_wht, gui_wht);
+
gui_layout(id, 0, +1);
}
return id;
static int level_enter(void)
{
int id, jd, kd, ld;
- const char * ln;
- const struct level_game * lg = curr_lg();
+ const char *ln;
+ const struct level_game *lg = curr_lg();
int b;
/* Load the level */
if ((id = gui_vstack(0)))
{
- if (lg->mode == MODE_SINGLE)
- {
- gui_label(id, _("Single Level"), GUI_LRG, GUI_TOP, 0, 0);
- }
- else if ((jd = gui_hstack(id)))
+ if (lg->mode == MODE_SINGLE)
{
- ln = lg->level->numbername;
- b = lg->level->is_bonus;
+ gui_label(id, _("Single Level"), GUI_LRG, GUI_TOP, 0, 0);
+ }
+ else if ((jd = gui_hstack(id)))
+ {
+ ln = lg->level->numbername;
+ b = lg->level->is_bonus;
gui_filler(jd);
- if ((kd = gui_vstack(jd)))
- {
- if (b)
- gui_label(kd, _("*** BONUS ***"), GUI_MED, GUI_TOP, gui_wht, gui_grn);
- if ((ld = gui_hstack(kd)))
- {
- if (b)
- {
- gui_label(ld, ln, GUI_LRG, 0, gui_wht, gui_grn);
- gui_label(ld, _("Level "), GUI_LRG, 0, gui_wht, gui_grn);
- }
- else
- {
- gui_label(ld, ln, GUI_LRG, GUI_NE, 0, 0);
- gui_label(ld, _("Level "), GUI_LRG, GUI_NW, 0, 0);
- }
- }
-
- gui_label(kd, _(curr_set()->name), GUI_SML, GUI_BOT, gui_wht, gui_wht);
- }
- gui_filler(jd);
+ if ((kd = gui_vstack(jd)))
+ {
+ if (b)
+ gui_label(kd, _("*** BONUS ***"), GUI_MED, GUI_TOP, gui_wht,
+ gui_grn);
+ if ((ld = gui_hstack(kd)))
+ {
+ if (b)
+ {
+ gui_label(ld, ln, GUI_LRG, 0, gui_wht, gui_grn);
+ gui_label(ld, _("Level "), GUI_LRG, 0, gui_wht,
+ gui_grn);
+ }
+ else
+ {
+ gui_label(ld, ln, GUI_LRG, GUI_NE, 0, 0);
+ gui_label(ld, _("Level "), GUI_LRG, GUI_NW, 0, 0);
+ }
+ }
+
+ gui_label(kd, _(curr_set()->name), GUI_SML, GUI_BOT, gui_wht,
+ gui_wht);
+ }
+ gui_filler(jd);
}
gui_space(id);
-
- if (! level_ok)
- gui_label(id, _("Cannot load the level file."), GUI_SML, GUI_ALL, gui_red, gui_red);
- else if (lg->level->message[0] != '\0')
- gui_multi(id, _(lg->level->message), GUI_SML, GUI_ALL, gui_wht, gui_wht);
+
+ if (!level_ok)
+ gui_label(id, _("Cannot load the level file."), GUI_SML, GUI_ALL,
+ gui_red, gui_red);
+ else if (lg->level->message[0] != '\0')
+ gui_multi(id, _(lg->level->message), GUI_SML, GUI_ALL, gui_wht,
+ gui_wht);
gui_layout(id, 0, 0);
}
{
if (b < 0 && d == 1)
{
- if (level_ok)
- return goto_state(&st_play_ready);
- else
- return goto_end_level();
+ if (level_ok)
+ return goto_state(&st_play_ready);
+ else
+ return goto_end_level();
}
else
return 1;
if (d)
{
if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
- {
- if (level_ok)
- return goto_state(&st_play_ready);
- else
- return goto_end_level();
- }
+ {
+ if (level_ok)
+ return goto_state(&st_play_ready);
+ else
+ return goto_end_level();
+ }
if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
- return goto_end_level();
+ return goto_end_level();
}
return 1;
}
extern struct state st_name;
-static struct state * ok_state, * cancel_state;
+static struct state *ok_state, *cancel_state;
static char player[MAXNAM];
void name_default(void)
{
- char * login = getenv("LOGNAME");
+ char *login = getenv("LOGNAME");
+
if (login == NULL || login[0] == '\0')
- login = _("Player");
+ login = _("Player");
strncpy(player, login, MAXNAM);
player[MAXNAM-1] = '\0';
player[0] = toupper(player[0]);
}
-int goto_name(struct state * ok, struct state * cancel)
+int goto_name(struct state *ok, struct state *cancel)
{
config_get_s(CONFIG_PLAYER, player, MAXNAM);
if (player[0] == '\0')
- name_default();
+ name_default();
ok_state = ok;
cancel_state = cancel;
switch (i)
{
case NAME_OK:
- if (l == 0)
- return 1;
+ if (l == 0)
+ return 1;
config_set_s(CONFIG_PLAYER, player);
- return goto_state(ok_state);
-
+ return goto_state(ok_state);
+
case NAME_BACK:
case NAME_CANCEL:
- return goto_state(cancel_state);
-
+ return goto_state(cancel_state);
+
case GUI_BS:
if (l > 0)
{
if ((id = gui_vstack(0)))
{
- gui_label(id, _("Player Name"), GUI_MED, GUI_ALL, 0, 0);
+ gui_label(id, _("Player Name"), GUI_MED, GUI_ALL, 0, 0);
- gui_space(id);
gui_space(id);
-
- name_id = gui_label(id, player, GUI_MED, GUI_ALL, gui_yel, gui_yel);
+ gui_space(id);
+
+ name_id = gui_label(id, player, GUI_MED, GUI_ALL, gui_yel, gui_yel);
gui_space(id);
- gui_keyboard(id);
- if ((jd = gui_harray(id)))
- {
- enter_id = gui_start(jd, _("OK"), GUI_SML, NAME_OK, 0);
- gui_state(jd, _("Cancel"), GUI_SML, NAME_CANCEL, 0);
- }
+ gui_keyboard(id);
+ if ((jd = gui_harray(id)))
+ {
+ enter_id = gui_start(jd, _("OK"), GUI_SML, NAME_OK, 0);
+ gui_state(jd, _("Cancel"), GUI_SML, NAME_CANCEL, 0);
+ }
- gui_layout(id, 0, 0);
+ gui_layout(id, 0, 0);
}
SDL_EnableUNICODE(1);
static int name_keybd(int c, int d)
{
if (d)
- if ((c & 0xFF80) == 0)
- {
- gui_focus(enter_id);
- c &= 0x7F;
- if (c == '\b' || c == 0x7F)
- return name_action(GUI_BS);
- else if (c > ' ')
- return name_action(c);
- }
+ if ((c & 0xFF80) == 0)
+ {
+ gui_focus(enter_id);
+ c &= 0x7F;
+ if (c == '\b' || c == 0x7F)
+ return name_action(GUI_BS);
+ else if (c > ' ')
+ return name_action(c);
+ }
return 1;
}
if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
return name_action(gui_token(gui_click()));
if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
- name_action(NAME_BACK);
+ name_action(NAME_BACK);
}
return 1;
}
state = game_step(g, at, &state_value);
if (state)
{
- level_stop(state, state_value, curr_clock(), curr_coins());
- goto_state(&st_play_end);
+ level_stop(state, state_value, curr_clock(), curr_coins());
+ goto_state(&st_play_end);
}
game_step_fade(dt);
if (d == 1)
{
if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
- {
- level_stop(GAME_NONE, 0, curr_clock(), curr_coins());
+ {
+ level_stop(GAME_NONE, 0, curr_clock(), curr_coins());
return abort_play();
- }
+ }
if (config_tst_d(CONFIG_JOYSTICK_BUTTON_R, b))
view_rotate = +1;
static int look_keybd(int c, int d)
{
if (d && c == SDLK_F12)
- return goto_state(&st_play_loop);
+ return goto_state(&st_play_loop);
return 1;
}
static int look_buttn(int b, int d)
{
if (d && config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
- return goto_state(&st_play_loop);
+ return goto_state(&st_play_loop);
return 1;
}
return 1;
}
-static int play_end_init(int * gidp)
+static int play_end_init(int *gidp)
{
const struct level_game *lg = curr_lg();
int mode = lg->mode;
gui_space(id);
if (mode == MODE_CHALLENGE &&
- (lg->state == GAME_GOAL || lg->state == GAME_SPEC || l->is_bonus))
+ (lg->state == GAME_GOAL || lg->state == GAME_SPEC || l->is_bonus))
{
int coins = lg->coins;
int score = lg->score - coins;
{
int nlid = 0, rlid = 0;
int b = 0;
+
if (lg->win)
- gui_start(jd, _("Finish"), GUI_SML, PLAY_END_DONE, 0);
+ gui_start(jd, _("Finish"), GUI_SML, PLAY_END_DONE, 0);
else
- nlid = gui_maybe(jd, _("Next Level"), PLAY_END_NEXT, lg->next_level != NULL);
-
+ nlid = gui_maybe(jd, _("Next Level"), PLAY_END_NEXT,
+ lg->next_level != NULL);
+
if (lg->dead)
gui_start(jd, _("Game Over"), GUI_SML, PLAY_END_OVER, 0);
else
{
- b = mode != MODE_CHALLENGE ||
- ((state == GAME_FALL || state == GAME_TIME) && !lg->dead && !l->is_bonus);
+ b = mode != MODE_CHALLENGE || ((state == GAME_FALL || state == GAME_TIME) && !lg->dead && !l->is_bonus);
rlid = gui_maybe(jd, _("Retry Level"), PLAY_END_SAME, b);
}
/* default is next if the next level is newly unkocked */
if (nlid != 0 && lg->unlock)
gui_focus(nlid);
- else if(b)
+ else if (b)
gui_focus(rlid);
}
gui_set_count(score_id, score + 1);
gui_pulse(score_id, 1.1f);
- if ((score+1) % 100 == 0)
+
+ if ((score + 1) % 100 == 0)
{
gui_set_count(balls_id, balls + 1);
gui_pulse(balls_id, 2.0f);
/*---------------------------------------------------------------------------*/
-static struct state * ok_state;
-static struct state * cancel_state;
+static struct state *ok_state;
+static struct state *cancel_state;
-int goto_save(struct state * ok, struct state * cancel)
+int goto_save(struct state *ok, struct state *cancel)
{
demo_unique(filename);
ok_state = ok;
switch (i)
{
case SAVE_SAVE:
- if (strcmp(filename, "") == 0)
- return 1;
+ if (strcmp(filename, "") == 0)
+ return 1;
if (demo_exists(filename))
return goto_state(&st_clobber);
else
{
- demo_play_save(filename);
- return goto_state(ok_state);
+ demo_play_save(filename);
+ return goto_state(ok_state);
}
case SAVE_CANCEL:
- return goto_state(cancel_state);
+ return goto_state(cancel_state);
case GUI_BS:
if (l > 0)
if ((id = gui_vstack(0)))
{
- gui_label(id, _("Replay Name"), GUI_MED, GUI_ALL, 0, 0);
+ gui_label(id, _("Replay Name"), GUI_MED, GUI_ALL, 0, 0);
- gui_space(id);
gui_space(id);
-
+ gui_space(id);
+
file_id = gui_label(id, filename, GUI_MED, GUI_ALL, gui_yel, gui_yel);
-
+
gui_space(id);
gui_keyboard(id);
if ((jd = gui_harray(id)))
{
- enter_id = gui_start(jd, _("Save"), GUI_SML, SAVE_SAVE, 0);
+ enter_id = gui_start(jd, _("Save"), GUI_SML, SAVE_SAVE, 0);
gui_state(jd, _("Cancel"), GUI_SML, SAVE_CANCEL, 0);
}
static int save_keybd(int c, int d)
{
if (d)
- if ((c & 0xFF80) == 0)
- {
- gui_focus(enter_id);
- c &= 0x7F;
- if (c == '\b')
- return save_action(GUI_BS);
- else if (c > ' ')
- return save_action(c);
- }
+ if ((c & 0xFF80) == 0)
+ {
+ gui_focus(enter_id);
+ c &= 0x7F;
+ if (c == '\b')
+ return save_action(GUI_BS);
+ else if (c > ' ')
+ return save_action(c);
+ }
return 1;
}
if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
return save_action(gui_token(gui_click()));
if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
- return save_action(SAVE_CANCEL);
+ return save_action(SAVE_CANCEL);
}
return 1;
}
if (i == SAVE_SAVE)
{
- demo_play_save(filename);
- return goto_state(ok_state);
+ demo_play_save(filename);
+ return goto_state(ok_state);
}
return goto_state(&st_save);
}
{
audio_play(AUD_MENU, 1.0f);
- switch(i)
+ switch (i)
{
case GUI_BACK:
return goto_state(&st_title);
case GUI_PREV:
- config_set_d(CONFIG_LAST_SET, ((config_get_d(CONFIG_LAST_SET)/SET_GROUP)-1)*SET_GROUP);
- return goto_state(&st_set);
+ config_set_d(CONFIG_LAST_SET,
+ ((config_get_d(CONFIG_LAST_SET) / SET_GROUP) - 1) * SET_GROUP);
+ return goto_state(&st_set);
case GUI_NEXT:
- config_set_d(CONFIG_LAST_SET, ((config_get_d(CONFIG_LAST_SET)/SET_GROUP)+1)*SET_GROUP);
- return goto_state(&st_set);
+ config_set_d(CONFIG_LAST_SET,
+ ((config_get_d(CONFIG_LAST_SET) / SET_GROUP) + 1) * SET_GROUP);
+ return goto_state(&st_set);
case GUI_NULL:
- return 1;
+ return 1;
default:
- if (set_exists(i))
- {
- config_set_d(CONFIG_LAST_SET, i);
- set_goto(i);
- return goto_state(&st_start);
- }
+ if (set_exists(i))
+ {
+ config_set_d(CONFIG_LAST_SET, i);
+ set_goto(i);
+ return goto_state(&st_start);
+ }
}
return 1;
}
int jd;
if (set_completed(s))
- jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_yel, gui_wht);
+ jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_yel, gui_wht);
else if (set_unlocked(s))
- jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_grn, gui_wht);
+ jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_grn, gui_wht);
else
- jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_wht, gui_wht);
+ jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_wht, gui_wht);
gui_active(jd, i, 0);
}
/* Reset last set if it do not exists */
if (!set_exists(last_set))
{
- b = 0;
- last_set = 0;
- config_set_d(CONFIG_LAST_SET, 0);
+ b = 0;
+ last_set = 0;
+ config_set_d(CONFIG_LAST_SET, 0);
}
audio_music_fade_to(0.5f, "bgm/inter.ogg");
{
gui_label(jd, _("Level Set"), GUI_SML, GUI_ALL, gui_yel, gui_red);
gui_filler(jd);
- gui_back_prev_next(jd, b>0, set_exists((b+1)*SET_GROUP));
+ gui_back_prev_next(jd, b > 0, set_exists((b + 1) * SET_GROUP));
}
if ((jd = gui_harray(id)))
{
- shot_id = gui_image(jd, get_set(last_set)->shot, 7 * w / 16, 7 * h / 16);
+ shot_id = gui_image(jd, get_set(last_set)->shot, 7 * w / 16,
+ 7 * h / 16);
if ((kd = gui_varray(jd)))
- {
- /* Display levels */
- for(i=b*SET_GROUP; i<(b+1)*SET_GROUP && set_exists(i); i++)
- gui_set(kd, i);
-
- /* Display empty slots */
- for(; i<(b+1)*SET_GROUP; i++)
- gui_filler(kd);
- }
+ {
+ /* Display levels */
+ for (i = b * SET_GROUP; i < (b + 1) * SET_GROUP && set_exists(i); i++)
+ gui_set(kd, i);
+
+ /* Display empty slots */
+ for(; i < (b + 1) * SET_GROUP; i++)
+ gui_filler(kd);
+ }
}
gui_space(id);
int jd = shared_point_basic(id, x, y);
int i = gui_token(jd);
if (jd && set_exists(i))
- set_over(i);
+ set_over(i);
}
static void set_stick(int id, int a, int v)
int jd = shared_stick_basic(id, a, v);
int i = gui_token(jd);
if (jd && set_exists(i))
- set_over(i);
+ set_over(i);
}
static int set_buttn(int b, int d)
int shared_click(int b, int d)
{
if (b < 0 && d == 1)
- return st_buttn(config_get_d(CONFIG_JOYSTICK_BUTTON_A), 1);
+ return st_buttn(config_get_d(CONFIG_JOYSTICK_BUTTON_A), 1);
else
- return 1;
+ return 1;
}
{
int mode = curr_lg()->mode;
if (mode == MODE_SINGLE)
- return 0;
+ return 0;
else if (mode == MODE_CHALLENGE)
- return goto_state(&st_over);
+ return goto_state(&st_over);
else
- return goto_state(&st_start);
+ return goto_state(&st_start);
}
int jd = 0;
const GLfloat *fore, *back;
- if (! set_level_exists(s, i))
+ if (!set_level_exists(s, i))
{
- gui_space(id);
- return;
+ gui_space(id);
+ return;
}
l = get_level(i);
- if (! l->is_locked)
+ if (!l->is_locked)
{
- fore = l->is_bonus ? gui_grn : gui_wht;
- back = l->is_completed ? fore : gui_yel;
+ fore = l->is_bonus ? gui_grn : gui_wht;
+ back = l->is_completed ? fore : gui_yel;
}
else
fore = back = gui_gry;
static void start_over_level(i)
{
const struct level *l = get_level(i);
- if (! l->is_locked || config_get_d(CONFIG_CHEAT))
+ if (!l->is_locked || config_get_d(CONFIG_CHEAT))
{
gui_set_image(shot_id, l->shot);
set_most_coins(&l->coin_score, -1);
- if (config_get_d(CONFIG_MODE) == MODE_PRACTICE)
- {
- set_best_times(&l->time_score, -1, 0);
- if (l->is_bonus)
- gui_set_label(status_id, _("Play this bonus level in practice mode"));
- else
- gui_set_label(status_id, _("Play this level in practice mode"));
- }
- else
- {
- set_best_times(&l->goal_score, -1, 1);
- if (l->is_bonus)
- gui_set_label(status_id, _("Play this bonus level in normal mode"));
- else
- gui_set_label(status_id, _("Play this level in normal mode"));
- }
- if (config_get_d(CONFIG_CHEAT))
- {
- gui_set_label(status_id, l->file);
- }
- return;
+ if (config_get_d(CONFIG_MODE) == MODE_PRACTICE)
+ {
+ set_best_times(&l->time_score, -1, 0);
+ if (l->is_bonus)
+ gui_set_label(status_id,
+ _("Play this bonus level in practice mode"));
+ else
+ gui_set_label(status_id,
+ _("Play this level in practice mode"));
+ }
+ else
+ {
+ set_best_times(&l->goal_score, -1, 1);
+ if (l->is_bonus)
+ gui_set_label(status_id,
+ _("Play this bonus level in normal mode"));
+ else
+ gui_set_label(status_id, _("Play this level in normal mode"));
+ }
+ if (config_get_d(CONFIG_CHEAT))
+ {
+ gui_set_label(status_id, l->file);
+ }
+ return;
}
else if (l->is_bonus)
- gui_set_label(status_id, _("Play in challenge mode to unlock extra bonus levels"));
+ gui_set_label(status_id,
+ _("Play in challenge mode to unlock extra bonus levels"));
else
- gui_set_label(status_id, _("Finish previous levels to unlock this level"));
+ gui_set_label(status_id,
+ _("Finish previous levels to unlock this level"));
}
static void start_over(id)
{
int i;
+
gui_pulse(id, 1.2f);
if (id == 0)
- return;
+ return;
i = gui_token(id);
case START_CHALLENGE:
gui_set_image(shot_id, curr_set()->shot);
set_most_coins(&curr_set()->coin_score, -1);
- set_best_times(&curr_set()->time_score, -1, 0);
- gui_set_label(status_id, _("Challenge all levels from the first one"));
- break;
-
+ set_best_times(&curr_set()->time_score, -1, 0);
+ gui_set_label(status_id, _("Challenge all levels from the first one"));
+ break;
+
case START_NORMAL:
- gui_set_label(status_id, _("Collect coins and unlock next level"));
- break;
-
+ gui_set_label(status_id, _("Collect coins and unlock next level"));
+ break;
+
case START_PRACTICE:
- gui_set_label(status_id, _("Train yourself without time nor coin"));
- break;
+ gui_set_label(status_id, _("Train yourself without time nor coin"));
+ break;
}
if (i >= 0)
return goto_state(&st_set);
else if (i == START_NORMAL)
{
- config_set_d(CONFIG_MODE, MODE_NORMAL);
- return goto_state(&st_start);
+ config_set_d(CONFIG_MODE, MODE_NORMAL);
+ return goto_state(&st_start);
}
else if (i == START_PRACTICE)
{
- config_set_d(CONFIG_MODE, MODE_PRACTICE);
- return goto_state(&st_start);
+ config_set_d(CONFIG_MODE, MODE_PRACTICE);
+ return goto_state(&st_start);
}
if (i == START_CHALLENGE)
{
- /* On cheat, start challenge mode where you want */
- if (config_get_d(CONFIG_CHEAT))
- {
- config_set_d(CONFIG_MODE, MODE_CHALLENGE);
- return goto_state(&st_start);
- }
- i = 0;
- mode = MODE_CHALLENGE;
+ /* On cheat, start challenge mode where you want */
+ if (config_get_d(CONFIG_CHEAT))
+ {
+ config_set_d(CONFIG_MODE, MODE_CHALLENGE);
+ return goto_state(&st_start);
+ }
+ i = 0;
+ mode = MODE_CHALLENGE;
}
- if (i>=0)
+ if (i >= 0)
{
const struct level *l = get_level(i);
- if (!l->is_locked || config_get_d(CONFIG_CHEAT))
- {
+ if (!l->is_locked || config_get_d(CONFIG_CHEAT))
+ {
level_play(l, mode);
return goto_state(&st_level);
- }
+ }
}
return 1;
}
/* Desactivate cheat */
if (m == MODE_CHALLENGE && !config_get_d(CONFIG_CHEAT))
{
- m = MODE_NORMAL;
- config_set_d(CONFIG_MODE, m);
+ m = MODE_NORMAL;
+ config_set_d(CONFIG_MODE, m);
}
if ((id = gui_vstack(0)))
{
if ((jd = gui_hstack(id)))
{
-
- gui_label(jd, _(curr_set()->name), GUI_SML, GUI_ALL, gui_yel, gui_red);
+
+ gui_label(jd, _(curr_set()->name), GUI_SML, GUI_ALL, gui_yel, gui_red);
gui_filler(jd);
- if (set_completed(curr_set()))
- {
- gui_label(jd, _("Set Complete"), GUI_SML, GUI_ALL, gui_yel, gui_grn);
+ if (set_completed(curr_set()))
+ {
+ gui_label(jd, _("Set Complete"), GUI_SML, GUI_ALL, gui_yel, gui_grn);
gui_filler(jd);
- }
+ }
gui_start(jd, _("Back"), GUI_SML, START_BACK, 0);
}
-
+
if ((jd = gui_harray(id)))
{
shot_id = gui_image(jd, curr_set()->shot, 7 * w / 16, 7 * h / 16);
{
if ((ld = gui_harray(kd)))
{
- gui_state(ld, _("Practice"), GUI_SML, START_PRACTICE, m == MODE_PRACTICE);
- gui_state(ld, _("Normal"), GUI_SML, START_NORMAL, m == MODE_NORMAL);
- }
- for (i=0; i <5; i++)
+ gui_state(ld, _("Practice"), GUI_SML, START_PRACTICE,
+ m == MODE_PRACTICE);
+ gui_state(ld, _("Normal"), GUI_SML, START_NORMAL,
+ m == MODE_NORMAL);
+ }
+ for (i = 0; i < 5; i++)
if ((ld = gui_harray(kd)))
- for (j=4; j>=0; j--)
- gui_level(ld, i*5 + j);
- gui_state(kd, _("Challenge"), GUI_SML, START_CHALLENGE , m == MODE_CHALLENGE);
+ for (j = 4; j >= 0; j--)
+ gui_level(ld, i * 5 + j);
+
+ gui_state(kd, _("Challenge"), GUI_SML, START_CHALLENGE ,
+ m == MODE_CHALLENGE);
}
}
gui_space(id);
gui_best_times(jd, 0);
}
- gui_space(id);
-
- status_id = gui_label(id, _("Choose a level to play"), GUI_SML, GUI_ALL, gui_yel, gui_wht);
-
+ gui_space(id);
+
+ status_id = gui_label(id, _("Choose a level to play"), GUI_SML, GUI_ALL,
+ gui_yel, gui_wht);
+
gui_layout(id, 0, 0);
-
+
set_most_coins(NULL, -1);
set_best_times(NULL, -1, m != MODE_PRACTICE);
}
{
if (d && c == SDLK_c && config_get_d(CONFIG_CHEAT))
{
- set_cheat();
- return goto_state(&st_start);
+ set_cheat();
+ return goto_state(&st_start);
}
-
+
if (d && c == SDLK_F12)
{
int i;
switch (i)
{
case TITLE_PLAY:
- config_get_s(CONFIG_PLAYER, player, MAXNAM);
- if (player[0] == '\0')
- return goto_name(&st_set, &st_title);
- else
- return goto_state(&st_set);
+ config_get_s(CONFIG_PLAYER, player, MAXNAM);
+
+ if (player[0] == '\0')
+ return goto_name(&st_set, &st_title);
+ else
+ return goto_state(&st_set);
+
case TITLE_HELP: return goto_state(&st_help);
case TITLE_DEMO: return goto_state(&st_demo);
case TITLE_CONF: return goto_state(&st_conf);
static int title_keybd(int c, int d)
{
if (d && c == SDLK_c && ALLOW_CHEAT)
- config_tgl_d(CONFIG_CHEAT);
+ config_tgl_d(CONFIG_CHEAT);
return 1;
}
-
+
static int title_buttn(int b, int d)
{
if (d)
/*---------------------------------------------------------------------------*/
-static int is_special_name(const char * n)
+static int is_special_name(const char *n)
{
- return (strcmp(n, N_("Hard"))==0 || strcmp(n, N_("Medium"))==0 || strcmp(n, N_("Easy"))==0);
+ return (strcmp(n, N_("Hard")) == 0 || strcmp(n, N_("Medium")) == 0
+ || strcmp(n, N_("Easy")) == 0);
}
/*---------------------------------------------------------------------------*/
coin_c[j] = gui_count(md, 1000, GUI_SML, 0);
coin_c[j++] = gui_count(md, 1000, GUI_SML, GUI_SE);
-
- if (e)
- {
+
+ if (e)
+ {
gui_space(md);
coin_c[j++] = gui_count(md, 1000, GUI_SML, GUI_RGT);
- }
+ }
}
if ((md = gui_vstack(ld)))
{
for (j = 0; j < NSCORE ; j++)
- coin_n[j] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
-
- if (e)
- {
- gui_space(md);
- coin_n[j++] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
- }
+ coin_n[j] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
+
+ if (e)
+ {
+ gui_space(md);
+ coin_n[j++] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
+ }
}
if ((md = gui_vstack(ld)))
coin_t[j++] = gui_clock(md, 359999, GUI_SML, GUI_SW);
- if (e)
- {
+ if (e)
+ {
gui_space(md);
coin_t[j++] = gui_clock(md, 359999, GUI_SML, GUI_LFT);
- }
+ }
}
}
}
void set_most_coins(const struct score *s, int hilight)
{
int j, spe;
- const char * name;
+ const char *name;
if (s == NULL)
{
- for (j = 0; j < NSCORE + coin_extrarow ; j++)
- {
- gui_set_count(coin_c[j], -1);
- gui_set_label(coin_n[j], "");
- gui_set_clock(coin_t[j], -1);
- }
+ for (j = 0; j < NSCORE + coin_extrarow ; j++)
+ {
+ gui_set_count(coin_c[j], -1);
+ gui_set_label(coin_n[j], "");
+ gui_set_clock(coin_t[j], -1);
+ }
}
else
{
- for (j = 0; j < NSCORE + coin_extrarow; j++)
- {
- name = s->player[j];
- spe = is_special_name(name);
-
- if (spe)
- gui_set_color(coin_n[j], 0, 0);
- else if (j != hilight)
- gui_set_color(coin_n[j], gui_yel, gui_wht);
- else if (j>= NSCORE)
- gui_set_color(coin_n[j], gui_red, gui_red);
- else
- gui_set_color(coin_n[j], gui_grn, gui_grn);
-
- gui_set_count(coin_c[j], s->coins[j]);
- gui_set_label(coin_n[j], spe ? _(name) : name);
- gui_set_clock(coin_t[j], s->timer[j]);
- }
+ for (j = 0; j < NSCORE + coin_extrarow; j++)
+ {
+ name = s->player[j];
+ spe = is_special_name(name);
+
+ if (spe)
+ gui_set_color(coin_n[j], 0, 0);
+ else if (j != hilight)
+ gui_set_color(coin_n[j], gui_yel, gui_wht);
+ else if (j>= NSCORE)
+ gui_set_color(coin_n[j], gui_red, gui_red);
+ else
+ gui_set_color(coin_n[j], gui_grn, gui_grn);
+
+ gui_set_count(coin_c[j], s->coins[j]);
+ gui_set_label(coin_n[j], spe ? _(name) : name);
+ gui_set_clock(coin_t[j], s->timer[j]);
+ }
}
}
time_t2[j] = gui_clock(md, 359999, GUI_SML, 0);
time_t2[j++] = gui_clock(md, 359999, GUI_SML, GUI_SE);
-
- if (e)
- {
+
+ if (e)
+ {
gui_space(md);
- time_t2[j++] = gui_clock(md, 359999, GUI_SML, GUI_RGT);
- }
+ time_t2[j++] = gui_clock(md, 359999, GUI_SML, GUI_RGT);
+ }
}
if ((md = gui_vstack(ld)))
for (j = 0; j < NSCORE; j++)
time_n[j] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
- if (e)
- {
- gui_space(md);
+ if (e)
+ {
+ gui_space(md);
time_n[j++] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
- }
+ }
}
if ((md = gui_vstack(ld)))
time_c[j] = gui_count(md, 1000, GUI_SML, 0);
time_c[j++] = gui_count(md, 1000, GUI_SML, GUI_SW);
-
- if (e)
- {
+
+ if (e)
+ {
gui_space(md);
- time_c[j++] = gui_count(md, 1000, GUI_SML, GUI_LFT);
- }
+ time_c[j++] = gui_count(md, 1000, GUI_SML, GUI_LFT);
+ }
}
}
}
void set_best_times(const struct score *s, int hilight, int goal)
{
int j, spe;
- const char * name;
+ const char *name;
if (goal)
- gui_set_label(time_l, _("Unlock Goal"));
+ gui_set_label(time_l, _("Unlock Goal"));
else
- gui_set_label(time_l, _("Best Times"));
+ gui_set_label(time_l, _("Best Times"));
if (s == NULL)
{
- for (j = 0; j < NSCORE + time_extrarow ; j++)
- {
- gui_set_clock(time_t2[j], -1);
- gui_set_label(time_n[j], "");
- gui_set_count(time_c[j], -1);
- }
+ for (j = 0; j < NSCORE + time_extrarow ; j++)
+ {
+ gui_set_clock(time_t2[j], -1);
+ gui_set_label(time_n[j], "");
+ gui_set_count(time_c[j], -1);
+ }
}
else
{
- for (j = 0; j < NSCORE + time_extrarow ; j++)
- {
- name = s->player[j];
- spe = is_special_name(name);
-
- if (spe)
- gui_set_color(time_n[j], 0, 0);
- else if (j != hilight)
- gui_set_color(time_n[j], gui_yel, gui_wht);
- else if (j>= NSCORE)
- gui_set_color(time_n[j], gui_red, gui_red);
- else
- gui_set_color(time_n[j], gui_grn, gui_grn);
-
- gui_set_clock(time_t2[j], s->timer[j]);
- gui_set_label(time_n[j], spe ? _(name) : name);
- gui_set_count(time_c[j], s->coins[j]);
- }
+ for (j = 0; j < NSCORE + time_extrarow; j++)
+ {
+ name = s->player[j];
+ spe = is_special_name(name);
+
+ if (spe)
+ gui_set_color(time_n[j], 0, 0);
+ else if (j != hilight)
+ gui_set_color(time_n[j], gui_yel, gui_wht);
+ else if (j>= NSCORE)
+ gui_set_color(time_n[j], gui_red, gui_red);
+ else
+ gui_set_color(time_n[j], gui_grn, gui_grn);
+
+ gui_set_clock(time_t2[j], s->timer[j]);
+ gui_set_label(time_n[j], spe ? _(name) : name);
+ gui_set_count(time_c[j], s->coins[j]);
+ }
}
}
static int lock = 1;
static int keyd[127];
-static void gui_fill(int id, char * line)
+static void gui_fill(int id, char *line)
{
char l[2];
l[1] = '\0';
+
while(*line)
{
- *l = *(line++);
- keyd[(int)*l] = gui_state(id, l, GUI_SML, *l, 0);
+ *l = *(line++);
+ keyd[(int)*l] = gui_state(id, l, GUI_SML, *l, 0);
}
}
if ((ld = gui_harray(kd)))
{
gui_filler(ld);
- gui_fill(ld, "9876543210");
+ gui_fill(ld, "9876543210");
gui_filler(ld);
}
if ((ld = gui_harray(kd)))
{
gui_filler(ld);
- gui_fill(ld, "JIHGFEDCBA");
+ gui_fill(ld, "JIHGFEDCBA");
gui_filler(ld);
}
if ((ld = gui_harray(kd)))
{
gui_filler(ld);
- gui_fill(ld, "TSRQPONMLK");
+ gui_fill(ld, "TSRQPONMLK");
gui_filler(ld);
}
if ((ld = gui_harray(kd)))
{
gui_filler(ld);
- gui_fill(ld, "!.-_ZYXWVU");
+ gui_fill(ld, "!.-_ZYXWVU");
gui_filler(ld);
}
if ((ld = gui_harray(kd)))
{
gui_filler(ld);
- gui_fill(ld, "jihgfedcba");
+ gui_fill(ld, "jihgfedcba");
gui_filler(ld);
}
if ((ld = gui_harray(kd)))
{
gui_filler(ld);
- gui_fill(ld, "tsrqponmlk");
+ gui_fill(ld, "tsrqponmlk");
gui_filler(ld);
}
if ((ld = gui_hstack(kd)))
{
gui_filler(ld);
gui_state(ld, _("del"), GUI_SML, GUI_BS, 0);
- gui_fill(ld, "zyxwvu");
+ gui_fill(ld, "zyxwvu");
gui_filler(ld);
}
}
int jd;
if ((jd = gui_hstack(id)))
{
- if (next || prev)
- {
- gui_maybe(jd, _("Next"), GUI_NEXT, next);
- gui_maybe(jd, _("Prev"), GUI_PREV, prev);
- }
-
- gui_start(jd, _("Back"), GUI_SML, GUI_BACK, 0);
+ if (next || prev)
+ {
+ gui_maybe(jd, _("Next"), GUI_NEXT, next);
+ gui_maybe(jd, _("Prev"), GUI_PREV, prev);
+ }
+
+ gui_start(jd, _("Back"), GUI_SML, GUI_BACK, 0);
}
return jd;
}
{
int bd;
if (enabled)
- bd = gui_state(id, label, GUI_SML, token, 0);
+ bd = gui_state(id, label, GUI_SML, token, 0);
else
{
- bd = gui_state(id, label, GUI_SML, GUI_NULL, 0);
- gui_set_color(bd, gui_gry, gui_gry);
+ bd = gui_state(id, label, GUI_SML, GUI_NULL, 0);
+ gui_set_color(bd, gui_gry, gui_gry);
}
return bd;
}