void conf_common_init(int (*action_fn)(int, int)) { back_init("back/gui.png"); audio_music_fade_to(0.5f, "bgm/inter.ogg"); common_init(action_fn); }
static int demo_enter(struct state *st, struct state *prev) { if (!items || (prev == &st_demo_del)) { if (items) { demo_dir_free(items); items = NULL; } items = demo_dir_scan(); total = array_len(items); } first = first < total ? first : 0; last = MIN(first + DEMO_STEP - 1, total - 1); last_viewed = MIN(MAX(first, last_viewed), last); if (total) demo_dir_load(items, first, last); audio_music_fade_to(0.5f, "bgm/inter.ogg"); return demo_gui(); }
static int start_enter(struct state *st, struct state *prev) { progress_init(MODE_NORMAL); audio_music_fade_to(0.5f, "bgm/inter.ogg"); return start_gui(); }
static void conf_shared_init(int (*action_fn)(int, int)) { conf_shared_action = action_fn; game_client_free(NULL); back_init("back/gui.png"); audio_music_fade_to(0.5f, "bgm/inter.ogg"); }
static int set_enter(void) { int w = config_get_d(CONFIG_WIDTH); int h = config_get_d(CONFIG_HEIGHT); int id, jd, kd; int i; if (do_init) { total = set_init(); first = MIN(first, (total - 1) - ((total - 1) % SET_STEP)); audio_music_fade_to(0.5f, "bgm/inter.ogg"); audio_play(AUD_START, 1.f); } else do_init = 1; if ((id = gui_vstack(0))) { if ((jd = gui_hstack(id))) { gui_label(jd, _("Level Set"), GUI_SML, GUI_ALL, gui_yel, gui_red); gui_filler(jd); gui_navig(jd, first > 0, first + SET_STEP < total); } gui_space(id); if ((jd = gui_harray(id))) { shot_id = gui_image(jd, set_shot(first), 7 * w / 16, 7 * h / 16); if ((kd = gui_varray(jd))) { for (i = first; i < first + SET_STEP; i++) gui_set(kd, i); } } gui_space(id); desc_id = gui_multi(id, " \\ \\ \\ \\ \\", GUI_SML, GUI_ALL, gui_yel, gui_wht); gui_layout(id, 0, 0); } return id; }
static int title_enter(void) { int id, jd, kd; /* Build the title GUI. */ if ((id = gui_vstack(0))) { gui_label(id, "Neverball", GUI_LRG, GUI_ALL, 0, 0); gui_space(id); if ((jd = gui_harray(id))) { gui_filler(jd); if ((kd = gui_varray(jd))) { gui_start(kd, "Play", GUI_MED, TITLE_PLAY, 1); gui_state(kd, "Replay", GUI_MED, TITLE_DEMO, 0); gui_state(kd, "Help", GUI_MED, TITLE_HELP, 0); gui_state(kd, "Options", GUI_MED, TITLE_CONF, 0); gui_state(kd, "Exit", GUI_MED, TITLE_EXIT, 0); } gui_filler(jd); } gui_layout(id, 0, 0); } /* Start the title screen music. */ audio_music_fade_to(0.5f, "bgm/tittle.mod"); /* Initialize the first level of the first set for display. */ game_init("map-rlk/title.sol", "map-back/jupiter.sol", "png/space.png", 0, 1); real_time = 0.0f; demo_time = 0.0f; mode = 0; return id; }
static int title_enter(struct state *st, struct state *prev) { /* Start the title screen music. */ audio_music_fade_to(0.5f, "bgm/title.ogg"); /* Initialize the title level for display. */ if (init_title_level()) mode = MODE_LEVEL; else mode = MODE_NONE; real_time = 0.0f; SDL_EnableUNICODE(1); return title_gui(); }
static int resol_enter(struct state *st, struct state *prev) { if (!st_back) { /* Note the parent screen if not done yet. */ st_back = prev; } back_init("back/gui.png"); modes = SDL_ListModes(NULL, SDL_OPENGL | SDL_FULLSCREEN); if (modes == (SDL_Rect **) -1) modes = NULL; audio_music_fade_to(0.5f, "bgm/inter.ogg"); return resol_gui(); }
static int demo_enter(void) { int id, jd; if (items) demo_dir_free(items); items = demo_dir_scan(); total = array_len(items); id = gui_vstack(0); if (total) { if ((jd = gui_hstack(id))) { gui_label(jd, _("Select Replay"), GUI_SML, GUI_ALL, 0,0); gui_filler(jd); gui_navig(jd, first > 0, first + DEMO_STEP < total); } gui_demo_thumbs(id); gui_filler(id); gui_demo_status(id); gui_layout(id, 0, 0); gui_demo_update_thumbs(); gui_demo_update_status(last_viewed); } else { gui_label(id, _("No Replays"), GUI_MED, GUI_ALL, 0, 0); gui_layout(id, 0, 0); } audio_music_fade_to(0.5f, "bgm/inter.ogg"); return id; }
static int init_level(void) { demo_play_init(USER_REPLAY_FILE, level, mode, curr.score, curr.balls, curr.times); /* * Init both client and server, then process the first batch * of commands generated by the server to sync client to * server. */ if (game_client_init(level_file(level)) && game_server_init(level_file(level), level_time(level), goal_e)) { game_client_sync(demo_fp); audio_music_fade_to(2.0f, level_song(level)); return 1; } demo_play_stop(1); return 0; }
void hole_song(void) { audio_music_fade_to(0.5f, hole_v[hole].song); }
static int conf_enter(struct state *st, struct state *prev) { int id, jd, kd; int btn0, btn1; int i; back_init("back/gui.png"); /* Initialize the configuration GUI. */ if ((id = gui_vstack(0))) { int f = config_get_d(CONFIG_FULLSCREEN); int t = config_get_d(CONFIG_TEXTURES); int h = config_get_d(CONFIG_SHADOW); int s = config_get_d(CONFIG_SOUND_VOLUME); int m = config_get_d(CONFIG_MUSIC_VOLUME); char resolution[20]; sprintf(resolution, "%d x %d", config_get_d(CONFIG_WIDTH), config_get_d(CONFIG_HEIGHT)); if ((jd = gui_harray(id))) { gui_label(jd, _("Options"), GUI_SML, GUI_ALL, 0, 0); gui_space(jd); gui_start(jd, _("Back"), GUI_SML, CONF_BACK, 0); } gui_space(id); if ((jd = gui_harray(id)) && (kd = gui_harray(jd))) { btn0 = gui_state(kd, _("No"), GUI_SML, CONF_WIN, 0); btn1 = gui_state(kd, _("Yes"), GUI_SML, CONF_FULL, 0); if (f) gui_set_hilite(btn1, 1); else gui_set_hilite(btn0, 1); gui_label(jd, _("Fullscreen"), GUI_SML, GUI_ALL, 0, 0); } if ((jd = gui_harray(id)) && (kd = gui_harray(jd))) { gui_state(kd, resolution, GUI_SML, CONF_RESOL, 0); gui_label(jd, _("Resolution"), GUI_SML, GUI_ALL, 0, 0); } gui_space(id); if ((jd = gui_harray(id)) && (kd = gui_harray(jd))) { btn0 = gui_state(kd, _("Low"), GUI_SML, CONF_TEXLO, 0); btn1 = gui_state(kd, _("High"), GUI_SML, CONF_TEXHI, 0); gui_set_hilite(btn0, (t == 2)); gui_set_hilite(btn1, (t == 1)); gui_label(jd, _("Textures"), GUI_SML, GUI_ALL, 0, 0); } if ((jd = gui_harray(id)) && (kd = gui_harray(jd))) { btn0 = gui_state(kd, _("Off"), GUI_SML, CONF_SHDOF, (h == 0)); btn1 = gui_state(kd, _("On"), GUI_SML, CONF_SHDON, (h == 1)); if (h) gui_set_hilite(btn1, 1); else gui_set_hilite(btn0, 1); gui_label(jd, _("Shadow"), GUI_SML, GUI_ALL, 0, 0); } gui_space(id); if ((jd = gui_harray(id)) && (kd = gui_harray(jd))) { /* A series of empty buttons forms the sound volume control. */ for (i = 10; i >= 0; i--) { sound_id[i] = gui_state(kd, NULL, GUI_SML, 100 + i, 0); gui_set_hilite(sound_id[i], (s == i)); } gui_label(jd, _("Sound Volume"), GUI_SML, GUI_ALL, 0, 0); } if ((jd = gui_harray(id)) && (kd = gui_harray(jd))) { /* A series of empty buttons forms the music volume control. */ for (i = 10; i >= 0; i--) { music_id[i] = gui_state(kd, NULL, GUI_SML, 200 + i, 0); gui_set_hilite(music_id[i], (m == i)); } gui_label(jd, _("Music Volume"), GUI_SML, GUI_ALL, 0, 0); } gui_layout(id, 0, 0); } audio_music_fade_to(0.5f, "bgm/inter.ogg"); return id; }
static int course_enter(void) { int w = config_get_d(CONFIG_WIDTH); int h = config_get_d(CONFIG_HEIGHT); int id, jd, kd, ld, md, i = 0, j, n = course_count(); int m = (int)(sqrt(n/2.0)*2); if ((id = gui_vstack(0))) { gui_label(id, _("Select Course"), GUI_MED, GUI_ALL, 0, 0); gui_space(id); if ((jd = gui_hstack(id))) { shot_id = gui_image(jd, course_shot(0), w / 3, h / 3); gui_filler(jd); if ((kd = gui_varray(jd))) { for(i = 0; i < n; i += m) { if ((ld = gui_harray(kd))) { for (j = (m - 1); j >= 0; j--) { if (i + j < n) { md = gui_image(ld, course_shot(i + j), w / 3 / m, h / 3 / m); gui_active(md, i + j, 0); if (i + j == 0) gui_focus(md); } else gui_space(ld); } } } } } gui_space(id); desc_id = gui_multi(id, _(course_desc(0)), GUI_SML, GUI_ALL, gui_yel, gui_wht); gui_space(id); if ((jd = gui_hstack(id))) { gui_filler(jd); gui_state(jd, _("Back"), GUI_SML, COURSE_BACK, 0); } gui_layout(id, 0, 0); } audio_music_fade_to(0.5f, "bgm/inter.ogg"); return id; }
static int course_enter(struct state *st, struct state *prev) { int w = config_get_d(CONFIG_WIDTH); int h = config_get_d(CONFIG_HEIGHT); int id, jd, kd, ld, md; int i, j, r, c, n; n = course_count(); r = comp_rows(n); c = comp_cols(n); if ((id = gui_vstack(0))) { gui_label(id, _("Select Course"), GUI_MED, 0, 0); gui_space(id); if ((jd = gui_hstack(id))) { shot_id = gui_image(jd, course_shot(0), w / 3, h / 3); gui_filler(jd); if ((kd = gui_varray(jd))) { for(i = 0; i < r; i++) { if ((ld = gui_harray(kd))) { for (j = c - 1; j >= 0; j--) { int k = i * c + j; if (k < n) { md = gui_image(ld, course_shot(k), w / 3 / c, h / 3 / r); gui_set_state(md, k, 0); if (k == 0) gui_focus(md); } else gui_space(ld); } } } } } gui_space(id); desc_id = gui_multi(id, _(course_desc(0)), GUI_SML, gui_yel, gui_wht); gui_space(id); if ((jd = gui_hstack(id))) { gui_filler(jd); gui_state(jd, _("Back"), GUI_SML, COURSE_BACK, 0); } gui_layout(id, 0, 0); } audio_music_fade_to(0.5f, "bgm/inter.ogg"); return id; }
static int conf_enter(struct state *st, struct state *prev) { int id, jd, kd; int i; back_init("back/gui.png"); /* Initialize the configuration GUI. */ if ((id = gui_vstack(0))) { if ((jd = gui_harray(id))) { gui_label(jd, _("Options"), GUI_SML, 0, 0); gui_space(jd); gui_start(jd, _("Back"), GUI_SML, CONF_BACK, 0); } gui_space(id); if ((jd = gui_harray(id)) && (kd = gui_harray(jd))) { gui_state(kd, _("Configure"), GUI_SML, CONF_VIDEO, 0); gui_label(jd, _("Graphics"), GUI_SML, 0, 0); } gui_space(id); if ((jd = gui_harray(id)) && (kd = gui_harray(jd))) { /* A series of empty buttons forms the sound volume control. */ int s = config_get_d(CONFIG_SOUND_VOLUME); for (i = 10; i >= 0; i--) { sound_id[i] = gui_state(kd, NULL, GUI_SML, 100 + i, 0); gui_set_hilite(sound_id[i], (s == i)); } gui_label(jd, _("Sound Volume"), GUI_SML, 0, 0); } if ((jd = gui_harray(id)) && (kd = gui_harray(jd))) { /* A series of empty buttons forms the music volume control. */ int m = config_get_d(CONFIG_MUSIC_VOLUME); for (i = 10; i >= 0; i--) { music_id[i] = gui_state(kd, NULL, GUI_SML, 200 + i, 0); gui_set_hilite(music_id[i], (m == i)); } gui_label(jd, _("Music Volume"), GUI_SML, 0, 0); } gui_space(id); if ((jd = gui_harray(id)) && (kd = gui_harray(jd))) { gui_state(kd, _("Select"), GUI_SML, CONF_LANG, 0); gui_label(jd, _("Language"), GUI_SML, 0, 0); } gui_layout(id, 0, 0); } audio_music_fade_to(0.5f, "bgm/inter.ogg"); return id; }