static void title_stick(int id, int a, int v) { if (config_tst_d(CONFIG_JOYSTICK_AXIS_X, a)) gui_pulse(gui_stick(id, v, 0), 1.2f); if (config_tst_d(CONFIG_JOYSTICK_AXIS_Y, a)) gui_pulse(gui_stick(id, 0, v), 1.2f); }
static int demo_end_gui(void) { int id, jd, kd; if ((id = gui_vstack(0))) { if (demo_paused) kd = gui_label(id, _("Replay Paused"), GUI_LRG, gui_gry, gui_red); else kd = gui_label(id, _("Replay Ends"), GUI_LRG, gui_gry, gui_red); if ((jd = gui_harray(id))) { if (standalone) { gui_start(jd, _("Quit"), GUI_SML, DEMO_QUIT, 0); } else { gui_start(jd, _("Keep"), GUI_SML, DEMO_KEEP, 0); gui_state(jd, _("Delete"), GUI_SML, DEMO_DEL, 0); } if (demo_paused) gui_start(jd, _("Continue"), GUI_SML, DEMO_CONTINUE, 0); else gui_state(jd, _("Repeat"), GUI_SML, DEMO_REPLAY, 0); } gui_pulse(kd, 1.2f); gui_layout(id, 0, 0); } return id; }
static int clobber_gui(void) { int id, jd, kd; int file_id; if ((id = gui_vstack(0))) { kd = gui_label(id, _("Overwrite?"), GUI_MED, gui_red, gui_red); file_id = gui_label(id, "MMMMMMMM", GUI_MED, gui_yel, gui_yel); if ((jd = gui_harray(id))) { gui_start(jd, _("Cancel"), GUI_SML, GUI_BACK, 0); gui_state(jd, _("Overwrite"), GUI_SML, SAVE_SAVE, 0); } gui_pulse(kd, 1.2f); gui_layout(id, 0, 0); gui_set_trunc(file_id, TRUNC_TAIL); gui_set_label(file_id, text_input); } return id; }
static int pause_gui(void) { int id, jd, title_id; /* Build the pause GUI. */ if ((id = gui_vstack(0))) { title_id = gui_label(id, _("Paused"), GUI_LRG, 0, 0); gui_space(id); if ((jd = gui_harray(id))) { gui_state(jd, _("Quit"), GUI_SML, PAUSE_EXIT, 0); if (progress_same_avail()) gui_state(jd, _("Restart"), GUI_SML, PAUSE_RESTART, 0); gui_start(jd, _("Continue"), GUI_SML, PAUSE_CONTINUE, 0); } gui_pulse(title_id, 1.2f); gui_layout(id, 0, 0); } return id; }
static int shared_stick_basic(int id, int a, float v, int bump) { int jd; if ((jd = gui_stick(id, a, v, bump))) gui_pulse(jd, 1.2f); return jd; }
static void goal_timer(int id, float dt) { if (!resume) { static float t = 0.0f; t += dt; if (time_state() < 1.f) { game_server_step(dt); game_client_sync(demo_fp); game_client_blend(game_server_blend()); } else if (t > 0.05f && coins_id) { int coins = gui_value(coins_id); if (coins > 0) { int score = gui_value(score_id); int balls = gui_value(balls_id); gui_set_count(coins_id, coins - 1); gui_pulse(coins_id, 1.1f); gui_set_count(score_id, score + 1); gui_pulse(score_id, 1.1f); if (progress_reward_ball(score + 1)) { gui_set_count(balls_id, balls + 1); gui_pulse(balls_id, 2.0f); audio_play(AUD_BALL, 1.0f); } } t = 0.0f; } } gui_timer(id, dt); }
static int play_ready_gui(void) { int id; if ((id = gui_label(0, _("Ready?"), GUI_LRG, 0, 0))) { gui_layout(id, 0, 0); gui_pulse(id, 1.2f); } return id; }
static int over_gui(void) { int id; if ((id = gui_label(0, _("GAME OVER"), GUI_LRG, gui_gry, gui_red))) { gui_layout(id, 0, 0); gui_pulse(id, 1.2f); } return id; }
static int play_loop_gui(void) { int id; if ((id = gui_label(0, _("GO!"), GUI_LRG, gui_blu, gui_grn))) { gui_layout(id, 0, 0); gui_pulse(id, 1.2f); } return id; }
void hud_view_pulse(int c) { switch (c) { case 0: gui_set_label(view_id, STR_VIEW0); break; case 1: gui_set_label(view_id, STR_VIEW1); break; case 2: gui_set_label(view_id, STR_VIEW2); break; } gui_pulse(view_id, 1.2f); view_timer = 2.0f; }
static int demo_play_gui(void) { int id; if ((id = gui_vstack(0))) { gui_label(id, _("Replay"), GUI_LRG, gui_blu, gui_grn); gui_layout(id, 0, 0); gui_pulse(id, 1.2f); } return id; }
static int shared_stick_basic(int id, int a, int v) { int jd = 0; if (config_tst_d(CONFIG_JOYSTICK_AXIS_X, a)) jd = gui_stick(id, v, 0); else if (config_tst_d(CONFIG_JOYSTICK_AXIS_Y, a)) jd = gui_stick(id, 0, v); if (jd) gui_pulse(jd, 1.2f); return jd; }
static void start_point(int id, int x, int y, int dx, int dy) { int jd; if ((jd = gui_point(id, x, y))) { int i = gui_token(jd); gui_set_image(shot_id, level_shot(i)); set_most_coins(i, 3); set_best_times(i, 3); gui_pulse(jd, 1.2f); } }
static void course_point(int id, int x, int y, int dx, int dy) { int jd; if ((jd = gui_point(id, x, y))) { int i = gui_token(jd); if (course_exists(i)) { gui_set_image(shot_id, course_shot(i)); gui_set_multi(desc_id, _(course_desc(i))); } gui_pulse(jd, 1.2f); } }
static void course_stick(int id, int a, int v) { int jd; if ((jd = shared_stick_basic(id, a, v))) { int i = gui_token(jd); if (course_exists(i)) { gui_set_image(shot_id, course_shot(i)); gui_set_multi(desc_id, _(course_desc(i))); } gui_pulse(jd, 1.2f); } }
static int demo_end_enter(void) { int id, jd, kd; if ((id = gui_vstack(0))) { if (demo_paused) kd = gui_label(id, _("Replay Paused"), GUI_LRG, GUI_ALL, gui_gry, gui_red); else kd = gui_label(id, _("Replay Ends"), GUI_LRG, GUI_ALL, gui_gry, gui_red); if ((jd = gui_harray(id))) { int start_id = 0; if (standalone) { start_id = gui_start(jd, _("Quit"), GUI_SML, DEMO_QUIT, 1); } else { start_id = gui_start(jd, _("Keep"), GUI_SML, DEMO_KEEP, 1); gui_state(jd, _("Delete"), GUI_SML, DEMO_DEL, 0); } if (demo_paused) { gui_start(jd, _("Continue"), GUI_SML, DEMO_CONTINUE, 1); gui_toggle(start_id); } else gui_state(jd, _("Repeat"), GUI_SML, DEMO_REPLAY, 0); } gui_pulse(kd, 1.2f); gui_layout(id, 0, 0); } audio_music_fade_out(demo_paused ? 0.2f : 2.0f); return id; }
static void start_stick(int id, int a, int v) { int jd; int x = (config_tst_d(CONFIG_JOYSTICK_AXIS_X, a)) ? v : 0; int y = (config_tst_d(CONFIG_JOYSTICK_AXIS_Y, a)) ? v : 0; if ((jd = gui_stick(id, x, y))) { int i = gui_token(jd); gui_set_image(shot_id, level_shot(i)); set_most_coins(i, 3); set_best_times(i, 3); gui_pulse(jd, 1.2f); } }
static int demo_del_gui(void) { int id, jd, kd; if ((id = gui_vstack(0))) { kd = gui_label(id, _("Delete Replay?"), GUI_MED, gui_red, gui_red); if ((jd = gui_harray(id))) { gui_start(jd, _("Keep"), GUI_SML, DEMO_KEEP, 0); gui_state(jd, _("Delete"), GUI_SML, DEMO_DEL, 0); } gui_pulse(kd, 1.2f); gui_layout(id, 0, 0); } return id; }
static int over_enter(void) { int id; if (curr_mode() != MODE_CHALLENGE) return 0; if ((id = gui_label(0, _("GAME OVER"), GUI_LRG, GUI_ALL, gui_gry, gui_red))) { gui_layout(id, 0, 0); gui_pulse(id, 1.2f); } audio_music_fade_out(2.0f); audio_play(AUD_OVER, 1.f); video_clr_grab(); return id; }
static int fall_out_enter(void) { int id, jd, kd; /* Reset hack. */ resume = 0; if ((id = gui_vstack(0))) { kd = gui_label(id, _("Fall-out!"), GUI_LRG, GUI_ALL, gui_gry, gui_red); gui_space(id); if ((jd = gui_harray(id))) { if (progress_dead()) gui_start(jd, _("Exit"), GUI_SML, FALL_OUT_OVER, 0); if (progress_next_avail()) gui_start(jd, _("Next Level"), GUI_SML, FALL_OUT_NEXT, 0); if (progress_same_avail()) gui_start(jd, _("Retry Level"), GUI_SML, FALL_OUT_SAME, 0); if (demo_saved()) gui_state(jd, _("Save Replay"), GUI_SML, FALL_OUT_SAVE, 0); } gui_space(id); gui_pulse(kd, 1.2f); gui_layout(id, 0, 0); } audio_music_fade_out(2.0f); /* audio_play(AUD_FALL, 1.0f); */ video_clr_grab(); return id; }
static void start_over(int id, int pulse) { if (id) { if (pulse) gui_pulse(id, 1.2f); if (gui_token(id) == START_LEVEL) { start_over_level(gui_value(id)); } else { gui_set_image(shot_id, set_shot(curr_set())); set_score_board(set_score(curr_set(), SCORE_COIN), -1, set_score(curr_set(), SCORE_TIME), -1, NULL, -1); } } }
static int demo_del_enter(void) { int id, jd, kd; if ((id = gui_vstack(0))) { kd = gui_label(id, _("Delete Replay?"), GUI_MED, GUI_ALL, gui_red, gui_red); if ((jd = gui_harray(id))) { gui_start(jd, _("No"), GUI_SML, DEMO_KEEP, 1); gui_state(jd, _("Yes"), GUI_SML, DEMO_DEL, 0); } gui_pulse(kd, 1.2f); gui_layout(id, 0, 0); } audio_music_fade_out(2.0f); return id; }
static int demo_del_gui(void) { int id, jd, kd; if ((id = gui_vstack(0))) { kd = gui_label(id, _("Delete?"), GUI_LRG, gui_gry, gui_red); gui_space(id); if ((jd = video.device_w < video.device_h ? gui_vstack(id) : gui_harray(id))) { gui_start(jd, _("Keep"), GUI_MED, DEMO_KEEP, 0); gui_state(jd, _("Delete"), GUI_MED, DEMO_DEL, 0); } gui_pulse(kd, 1.2f); gui_layout(id, 0, 0); } return id; }
static int demo_play_enter(void) { int id; if (demo_paused) { demo_paused = 0; audio_music_fade_in(0.5f); return 0; } /* * Post-1.5.1 replays include view data in the first update, these * two lines are currently left in for compatibility with older * replays. */ game_set_fly(0.f, game_client_file()); game_client_step(NULL); if (check_compat && !game_compat_map) { goto_state(&st_demo_compat); return 0; } if ((id = gui_vstack(0))) { gui_label(id, _("Replay"), GUI_LRG, GUI_ALL, gui_blu, gui_grn); gui_layout(id, 0, 0); gui_pulse(id, 1.2f); } show_hud = 1; hud_update(0); return id; }
static int done_gui(void) { const char *s1 = _("New Set Record"); const char *s2 = _("Set Complete"); int id; int high = progress_set_high(); if ((id = gui_vstack(0))) { int gid; if (high) gid = gui_label(id, s1, GUI_MED, gui_grn, gui_grn); else gid = gui_label(id, s2, GUI_MED, gui_blu, gui_grn); gui_space(id); gui_score_board(id, GUI_SCORE_COIN | GUI_SCORE_TIME, 1, high); gui_space(id); gui_start(id, _("Select Level"), GUI_SML, GUI_BACK, 0); if (!resume) gui_pulse(gid, 1.2f); gui_layout(id, 0, 0); } set_score_board(set_score(curr_set(), SCORE_COIN), progress_score_rank(), set_score(curr_set(), SCORE_TIME), progress_times_rank(), NULL, -1); return id; }
static int pause_enter(void) { int id, jd, td; audio_music_fade_out(0.2f); if ((id = gui_vstack(0))) { td = gui_label(id, _("Paused"), GUI_LRG, GUI_ALL, 0, 0); gui_space(id); if ((jd = gui_harray(id))) { gui_state(jd, _("Quit"), GUI_SML, PAUSE_QUIT, 0); gui_start(jd, _("Continue"), GUI_SML, PAUSE_CONTINUE, 1); } gui_pulse(td, 1.2f); gui_layout(id, 0, 0); } hud_init(); return id; }
static int goal_gui(void) { const char *s1 = _("New Record"); const char *s2 = _("GOAL"); int id, jd, kd, ld, md; int high = progress_lvl_high(); if ((id = gui_vstack(0))) { int gid = 0; if (curr_mode() == MODE_CHALLENGE) { int coins, score, balls; int i; /* Reverse-engineer initial score and balls. */ if (resume) { coins = 0; score = curr_score(); balls = curr_balls(); } else { coins = curr_coins(); score = curr_score() - coins; balls = curr_balls(); for (i = curr_score(); i > score; i--) if (progress_reward_ball(i)) balls--; } /*if ((jd = gui_hstack(id))) { gui_filler(jd);*/ if ((kd = gui_vstack(id))) { if ((ld = video.device_w < video.device_h ? gui_vstack(kd) : gui_hstack(kd))) { if ((md = gui_harray(ld))) { balls_id = gui_count(md, 100, GUI_MED); gui_label(md, _("Balls"), GUI_MED, gui_wht, gui_wht); } if ((md = gui_harray(ld))) { score_id = gui_count(md, 1000, GUI_MED); gui_label(md, _("Score"), GUI_MED, gui_wht, gui_wht); } if ((md = gui_harray(ld))) { coins_id = gui_count(md, 100, GUI_MED); gui_label(md, _("Coins"), GUI_MED, gui_wht, gui_wht); } gui_set_count(balls_id, balls); gui_set_count(score_id, score); gui_set_count(coins_id, coins); } if ((ld = gui_harray(kd))) { const struct level *l; gui_label(ld, "", GUI_SML, 0, 0); for (i = MAXLVL - 1; i >= 0; i--) if ((l = get_level(i)) && level_bonus(l)) { const GLubyte *c = (level_opened(l) ? gui_grn : gui_gry); gui_label(ld, level_name(l), GUI_SML, c, c); } gui_label(ld, "", GUI_SML, 0, 0); } gui_set_rect(kd, GUI_ALL); } /*gui_filler(jd); }*/ gui_space(id); } else { gid = gui_label(id, high ? s1 : s2, GUI_LRG, gui_blu, gui_grn); gui_space(id); balls_id = score_id = coins_id = 0; } gui_score_board(id, (GUI_SCORE_COIN | GUI_SCORE_TIME | GUI_SCORE_GOAL | GUI_SCORE_SAVE), 1, high); gui_space(id); if ((jd = gui_harray(id))) { if (progress_done()) gui_start(jd, _("Finish"), GUI_MED, GOAL_DONE, 0); else if (progress_last()) gui_start(jd, _("Finish"), GUI_MED, GOAL_LAST, 0); if (progress_next_avail()) gui_start(jd, _("Next"), GUI_MED, GOAL_NEXT, 0); if (progress_same_avail()) gui_start(jd, _("Retry"), GUI_MED, GOAL_SAME, 0); if (!progress_done() && !progress_last()) gui_start(jd, _("Quit"), GUI_MED, GOAL_DONE, 0); //if (demo_saved()) // gui_state(jd, _("Save Replay"), GUI_SML, GOAL_SAVE, 0); } if (!resume && gid) gui_pulse(gid, 1.2f); gui_layout(id, 0, 0); } set_score_board(level_score(curr_level(), SCORE_COIN), progress_coin_rank(), level_score(curr_level(), SCORE_TIME), progress_time_rank(), level_score(curr_level(), SCORE_GOAL), progress_goal_rank()); return id; }
static void conf_stick(int id, int a, float v, int bump) { gui_pulse(gui_stick(id, a, v, bump), 1.2f); }
static void conf_point(int id, int x, int y, int dx, int dy) { gui_pulse(gui_point(id, x, y), 1.2f); }
void common_point(int id, int x, int y, int dx, int dy) { gui_pulse(gui_point(id, x, y), 1.2f); }