コード例 #1
0
ファイル: replayview.c プロジェクト: miton/taisei
int fill_replayview_menu(MenuData *m) {
	DIR *dir = opendir(get_replays_path());
	struct dirent *e;
	int rpys = 0;
	
	if(!dir) {
		printf("Could't read %s\n", get_replays_path());
		return -1;
	}
	
	char ext[5];
	snprintf(ext, 5, ".%s", REPLAY_EXTENSION);
	
	while((e = readdir(dir))) {
		if(!strendswith(e->d_name, ext))
			continue;
		
		Replay *rpy = malloc(sizeof(Replay));
		if(!replay_load(rpy, e->d_name)) {
			free(rpy);
			continue;
		}
		
		add_menu_entry(m, " ", replayview_run, rpy);
		m->entries[m->ecount-1].freearg = replayview_freearg;
		m->entries[m->ecount-1].draw = replayview_drawitem;
		++rpys;
	}
	
	closedir(dir);
	
	qsort(m->entries, m->ecount, sizeof(MenuEntry), replayview_cmp);
	return rpys;
}
コード例 #2
0
ファイル: gameovermenu.c プロジェクト: piaopolar/taisei
void create_gameover_menu(MenuData *m) {
	create_menu(m);
	
	m->flags = MF_Transient | MF_AlwaysProcessInput;
	m->transition = NULL;
	m->context = "Game Over";
	
	char s[64];
	int c = MAX_CONTINUES - global.plr.continues;
	snprintf(s, sizeof(s), "Continue (%i)", c);
	add_menu_entry(m, s, c? continue_game : NULL, NULL);
	add_menu_entry(m, "Restart the Game", restart_game, NULL)->transition = TransFadeBlack;
	add_menu_entry(m, c? "Give up" : "Return to Title", give_up, NULL)->transition = TransFadeBlack;
	
	if(!c)
		m->cursor = 1;
}
コード例 #3
0
ファイル: stageselect.c プロジェクト: miton/taisei
void create_stage_menu(MenuData *m) {
	char title[STGMENU_MAX_TITLE_LENGTH];
	int i;
	
	create_menu(m);
	m->type = MT_Persistent;
	m->abortable = True;
	m->abortaction = backtomain;
	m->abortarg = m;
	// TODO: I think ALL menus should use the title field, but I don't want to screw with it right now.
	m->title = "Stage Select";
	
	for(i = 0; stages[i].loop; ++i) if(!stages[i].hidden) {
		snprintf(title, STGMENU_MAX_TITLE_LENGTH, "%s", stages[i].title);
		add_menu_entry(m, title, start_story, &(stages[i]));
	}
	
	add_menu_separator(m);
	add_menu_entry(m, "Back", backtomain, m);
}
コード例 #4
0
ファイル: replayview.c プロジェクト: miton/taisei
MenuData* replayview_stageselect(Replay *rpy) {
	MenuData *m = malloc(sizeof(MenuData));
	int i;
	
	create_menu(m);
	m->context = rpy;
	
	for(i = 0; i < rpy->stgcount; ++i) {
		add_menu_entry(m, stage_get(rpy->stages[i].stage)->title, start_replay, rpy);
	}
	
	return m;
}
コード例 #5
0
ファイル: replayview.c プロジェクト: miton/taisei
void create_replayview_menu(MenuData *m) {
	create_menu(m);
	m->type = MT_Persistent;
	m->abortable = True;
	m->abortaction = replayview_abort;
	m->abortarg = m;
	m->title = "Replays";
	replayview = m;
	
	int r = fill_replayview_menu(m);
	
	if(!r) {
		add_menu_entry(m, "No replays available. Play the game and record some!", replayview_abort, m);
	} else if(r < 0) {
		add_menu_entry(m, "There was a problem getting the replay list :(", replayview_abort, m);
	} else {
		add_menu_separator(m);
		add_menu_entry(m, "Back", replayview_abort, m);
	}
	
	printf("create_replayview_menu()\n");
}
コード例 #6
0
ファイル: stageselect.c プロジェクト: nexAkari/taisei
void create_stage_menu(MenuData *m) {
	char title[STGMENU_MAX_TITLE_LENGTH];
	Difficulty lastdiff = D_Any;

	create_menu(m);
	m->draw = draw_stage_menu;
	m->flags = MF_Abortable;
	m->transition = TransMenuDark;

	for(int i = 0; stages[i].procs; ++i) {
		if(stages[i].difficulty < lastdiff || (stages[i].difficulty && !lastdiff)) {
			add_menu_separator(m);
		}

		snprintf(title, STGMENU_MAX_TITLE_LENGTH, "%s: %s", stages[i].title, stages[i].subtitle);
		add_menu_entry(m, title, start_game, &(stages[i]));

		lastdiff = stages[i].difficulty;
	}

	add_menu_separator(m);
	add_menu_entry(m, "Back", menu_commonaction_close, NULL);
}
コード例 #7
0
ファイル: spellpractice.c プロジェクト: nexAkari/taisei
void create_spell_menu(MenuData *m) {
	char title[128];
	Difficulty lastdiff = D_Any;

	create_menu(m);
	m->draw = draw_spell_menu;
	m->flags = MF_Abortable;
	m->transition = TransMenuDark;

	for(StageInfo *stg = stages; stg->procs; ++stg) {
		if(stg->type != STAGE_SPELL) {
			continue;
		}

		if(stg->difficulty < lastdiff) {
			add_menu_separator(m);
		}

		StageProgress *p = stage_get_progress_from_info(stg, D_Any, false);
		if(p && p->unlocked) {
			snprintf(title, sizeof(title), "%s: %s", stg->title, stg->subtitle);
			add_menu_entry(m, title, start_game, stg);
		} else {
			snprintf(title, sizeof(title), "%s: ???????", stg->title);
			add_menu_entry(m, title, NULL, NULL);
		}

		lastdiff = stg->difficulty;
	}

	add_menu_separator(m);
	add_menu_entry(m, "Back", menu_commonaction_close, NULL);

	while(!m->entries[m->cursor].action) {
		++m->cursor;
	}
}
コード例 #8
0
ファイル: difficultyselect.c プロジェクト: laochailan/taisei
MenuData* create_difficulty_menu(void) {
	MenuData *m = alloc_menu();

	m->draw = draw_difficulty_menu;
	m->logic = update_difficulty_menu;
	m->transition = TransFadeBlack;
	m->flags = MF_Abortable;

	add_menu_entry(m, "“All those bullets confuse me!”\nYou will be stuck here forever", set_difficulty, (void *)D_Easy);
	add_menu_entry(m, "“Do you even graze?”\nSomewhat challenging", set_difficulty, (void *)D_Normal);
	add_menu_entry(m, "“Pain is my ally!”\nActually challenging", set_difficulty, (void *)D_Hard);
	add_menu_entry(m, "“I have no fear.”\nWe never playtested this one", set_difficulty, (void *)D_Lunatic);

	for(int i = 0; i < m->ecount; ++i) {
		Difficulty d = (Difficulty)(uintptr_t)m->entries[i].arg;

		if(d == progress.game_settings.difficulty) {
			m->cursor = i;
			break;
		}
	}

	return m;
}
コード例 #9
0
ファイル: options.c プロジェクト: laochailan/taisei
MenuData* create_options_menu(void) {
	MenuData *m = create_options_menu_base("Options");
	OptionBinding *b;

	add_menu_entry(m, "Player name", do_nothing,
		b = bind_stroption(CONFIG_PLAYERNAME)
	);

	add_menu_separator(m);

	add_menu_entry(m, "Save replays", do_nothing,
		b = bind_option(CONFIG_SAVE_RPY, bind_common_onoffplus_get, bind_common_onoffplus_set)
	);	bind_addvalue(b, "always");
		bind_addvalue(b, "never");
		bind_addvalue(b, "ask");

	add_menu_entry(m, "Auto-restart in Spell Practice", do_nothing,
		b = bind_option(CONFIG_SPELLSTAGE_AUTORESTART,  bind_common_onoff_get, bind_common_onoff_set)
	);	bind_onoff(b);

	add_menu_entry(m, "Power in Spell and Stage Practice", do_nothing,
		b = bind_option(CONFIG_PRACTICE_POWER, bind_power_get, bind_power_set)
	);	bind_addvalue(b, "0.0");
		bind_addvalue(b, "1.0");
		bind_addvalue(b, "2.0");
		bind_addvalue(b, "3.0");
		bind_addvalue(b, "4.0");

	add_menu_entry(m, "Shoot by default", do_nothing,
		b = bind_option(CONFIG_SHOT_INVERTED,   bind_common_onoff_get, bind_common_onoff_set)
	);	bind_onoff(b);

	add_menu_entry(m, "Boss healthbar style", do_nothing,
		b = bind_option(CONFIG_HEALTHBAR_STYLE,   bind_common_int_get, bind_common_int_set)
	);	bind_addvalue(b, "classic");
		bind_addvalue(b, "modern");

	add_menu_entry(m, "Floating score text visibility", do_nothing,
		b = bind_scale(CONFIG_SCORETEXT_ALPHA, 0, 1, 0.05)
	);

	add_menu_separator(m);

	add_menu_entry(m, "SFX Volume", do_nothing,
		b = bind_scale(CONFIG_SFX_VOLUME, 0, 1, 0.05)
	);	b->dependence = audio_output_works;

	add_menu_entry(m, "BGM Volume", do_nothing,
		b = bind_scale(CONFIG_BGM_VOLUME, 0, 1, 0.05)
	);	b->dependence = audio_output_works;

	add_menu_entry(m, "Mute audio", do_nothing,
		b = bind_option(CONFIG_MUTE_AUDIO,  bind_common_onoff_get, bind_common_onoff_set)
	);	bind_onoff(b);

	add_menu_separator(m);
	add_menu_entry(m, "Video options…", enter_options_menu_video, NULL);
	add_menu_entry(m, "Customize controls…", enter_options_menu_controls, NULL);
	add_menu_entry(m, "Gamepad & Joystick options…", enter_options_menu_gamepad, NULL);
	add_menu_separator(m);

	add_menu_entry(m, "Back", menu_action_close, NULL);

	return m;
}
コード例 #10
0
ファイル: options.c プロジェクト: laochailan/taisei
static MenuData* create_options_menu_controls(MenuData *parent) {
	MenuData *m = create_options_menu_base("Controls");

	add_menu_entry(m, "Move up", do_nothing,
		bind_keybinding(CONFIG_KEY_UP)
	);

	add_menu_entry(m, "Move down", do_nothing,
		bind_keybinding(CONFIG_KEY_DOWN)
	);

	add_menu_entry(m, "Move left", do_nothing,
		bind_keybinding(CONFIG_KEY_LEFT)
	);

	add_menu_entry(m, "Move right", do_nothing,
		bind_keybinding(CONFIG_KEY_RIGHT)
	);

	add_menu_separator(m);

	add_menu_entry(m, "Shoot", do_nothing,
		bind_keybinding(CONFIG_KEY_SHOT)
	);

	add_menu_entry(m, "Focus", do_nothing,
		bind_keybinding(CONFIG_KEY_FOCUS)
	);

	add_menu_entry(m, "Use Spell Card", do_nothing,
		bind_keybinding(CONFIG_KEY_BOMB)
	);

	add_menu_entry(m, "Power Surge / Discharge", do_nothing,
		bind_keybinding(CONFIG_KEY_SPECIAL)
	);

	add_menu_separator(m);

	add_menu_entry(m, "Toggle fullscreen", do_nothing,
		bind_keybinding(CONFIG_KEY_FULLSCREEN)
	);

	add_menu_entry(m, "Take a screenshot", do_nothing,
		bind_keybinding(CONFIG_KEY_SCREENSHOT)
	);

	add_menu_entry(m, "Skip dialog", do_nothing,
		bind_keybinding(CONFIG_KEY_SKIP)
	);

	add_menu_separator(m);

	add_menu_entry(m, "Toggle audio", do_nothing,
		bind_keybinding(CONFIG_KEY_TOGGLE_AUDIO)
	);

	add_menu_separator(m);

	add_menu_entry(m, "Stop the game immediately", do_nothing,
		bind_keybinding(CONFIG_KEY_STOP)
	);

	add_menu_entry(m, "Restart the game immediately", do_nothing,
		bind_keybinding(CONFIG_KEY_RESTART)
	);

#ifdef DEBUG
	add_menu_separator(m);

	add_menu_entry(m, "Toggle God mode", do_nothing,
		bind_keybinding(CONFIG_KEY_IDDQD)
	);

	add_menu_entry(m, "Skip stage", do_nothing,
		bind_keybinding(CONFIG_KEY_HAHAIWIN)
	);

	add_menu_entry(m, "Power up", do_nothing,
		bind_keybinding(CONFIG_KEY_POWERUP)
	);

	add_menu_entry(m, "Power down", do_nothing,
		bind_keybinding(CONFIG_KEY_POWERDOWN)
	);

	add_menu_entry(m, "Disable background rendering (HoM effect)", do_nothing,
		bind_keybinding(CONFIG_KEY_NOBACKGROUND)
	);

	add_menu_entry(m, "Toggle collision areas overlay", do_nothing,
		bind_keybinding(CONFIG_KEY_HITAREAS)
	);
#endif

	add_menu_separator(m);
	add_menu_entry(m, "Back", menu_action_close, NULL);

	return m;
}
コード例 #11
0
ファイル: options.c プロジェクト: laochailan/taisei
static MenuData* create_options_menu_video(MenuData *parent) {
	MenuData *m = create_options_menu_base("Video Options");
	OptionBinding *b;


	add_menu_entry(m, "Fullscreen", do_nothing,
		b = bind_option(CONFIG_FULLSCREEN, bind_common_onoff_get, bind_common_onoff_set)
	);	bind_onoff(b);
		b->dependence = bind_fullscreen_dependence;

	add_menu_entry(m, "Display", do_nothing,
		b = bind_video_display(CONFIG_VID_DISPLAY)
	);

	add_menu_entry(m, "Window size", do_nothing,
		b = bind_resolution()
	);	b->setter = bind_resolution_set;
		b->dependence = bind_resolution_dependence;

	add_menu_entry(m, "Resizable window", do_nothing,
		b = bind_option(CONFIG_VID_RESIZABLE, bind_common_onoff_get, bind_common_onoff_set)
	);	bind_onoff(b);
		b->dependence = bind_resizable_dependence;

	add_menu_separator(m);

	add_menu_entry(m, "Pause the game when not focused", do_nothing,
		b = bind_option(CONFIG_FOCUS_LOSS_PAUSE, bind_common_onoff_get, bind_common_onoff_set)
	);	bind_onoff(b);

	add_menu_entry(m, "Vertical synchronization", do_nothing,
		b = bind_option(CONFIG_VSYNC, bind_common_onoffplus_get, bind_common_onoffplus_set)
	);	bind_addvalue(b, "on");
		bind_addvalue(b, "off");

	if(video_query_capability(VIDEO_CAP_VSYNC_ADAPTIVE) != VIDEO_NEVER_AVAILABLE) {
		bind_addvalue(b, "adaptive");
	}

	add_menu_entry(m, "Skip frames", do_nothing,
		b = bind_option(CONFIG_VID_FRAMESKIP, bind_common_intplus1_get, bind_common_intplus1_set)
	);	bind_addvalue(b, "0");
		bind_addvalue(b, "½");
		bind_addvalue(b, "⅔");

	add_menu_separator(m);

	add_menu_entry(m, "Overall rendering quality", do_nothing,
		b = bind_scale(CONFIG_FG_QUALITY, 0.1, 1.0, 0.05)
	);

	add_menu_entry(m, "Draw background", do_nothing,
		b = bind_option(CONFIG_NO_STAGEBG, bind_common_onoff_inverted_get, bind_common_onoff_inverted_set)
	);	bind_onoff(b);

	add_menu_entry(m, "Background rendering quality", do_nothing,
		b = bind_scale(CONFIG_BG_QUALITY, 0.1, 1.0, 0.05)
	);	b->dependence = bind_bgquality_dependence;
		b->pad++;

	add_menu_separator(m);

	add_menu_entry(m, "Anti-aliasing", do_nothing,
		b = bind_option(CONFIG_FXAA, bind_common_int_get, bind_common_int_set)
	);	bind_addvalue(b, "none");
		bind_addvalue(b, "fxaa");

	add_menu_entry(m, "Particle effects", do_nothing,
		b = bind_option(CONFIG_PARTICLES, bind_common_int_get, bind_common_int_set)
	);	bind_addvalue(b, "minimal");
		bind_addvalue(b, "full");

	add_menu_entry(m, "Postprocessing effects", do_nothing,
		b = bind_option(CONFIG_POSTPROCESS, bind_common_int_get, bind_common_int_set)
	);	bind_addvalue(b, "minimal");
		bind_addvalue(b, "fast");
		bind_addvalue(b, "full");

	add_menu_separator(m);
	add_menu_entry(m, "Back", menu_action_close, NULL);

	return m;
}
コード例 #12
0
void create_options_menu(MenuData *m) {
	OptionBinding *b;
	
	create_menu(m);
	m->type = MT_Transient;
	m->ondestroy = destroy_options_menu;
	m->context = NULL;
	
	#define bind_onoff(b) bind_addvalue(b, "on"); bind_addvalue(b, "off")
	
	add_menu_entry(m, "Player Name", do_nothing, NULL);
		b = bind_stroption(m, "playername", PLAYERNAME);
		
	add_menu_separator(m);
		allocate_binding(m);
	
	add_menu_entry(m, "Video Mode", do_nothing, NULL);
		b = bind_resolution(m);
	
	add_menu_entry(m, "Fullscreen", do_nothing, NULL);
		b = bind_option(m, "fullscreen", FULLSCREEN, bind_common_onoffget, bind_fullscreen_set);
			bind_onoff(b);
			
	add_menu_entry(m, "Audio", do_nothing, NULL);
		b = bind_option(m, "disable_audio", NO_AUDIO, bind_common_onoffget_inverted,
													  bind_noaudio_set);
			bind_onoff(b);
		
	add_menu_entry(m, "Shaders", do_nothing, NULL);
		b = bind_option(m, "disable_shader", NO_SHADER, bind_common_onoffget_inverted,
														bind_noshader_set);
			bind_onoff(b);
			
	add_menu_entry(m, "Stage Background", do_nothing, NULL);
		b = bind_option(m, "disable_stagebg", NO_STAGEBG, bind_common_intget,
														  bind_common_intset);
			bind_addvalue(b, "on");
			bind_addvalue(b, "off");
			bind_addvalue(b, "auto");
	
	add_menu_entry(m, "Minimum FPS", do_nothing, NULL);
		b = bind_option(m, "disable_stagebg_auto_fpslimit", NO_STAGEBG_FPSLIMIT, bind_common_intget,
																				 bind_common_intset);
			bind_setvaluerange(b, 20, 60);
			bind_setdependence(b, bind_stagebg_fpslimit_dependence);
	
	add_menu_entry(m, "Save Replays", do_nothing, NULL);
		b = bind_option(m, "save_rpy", SAVE_RPY, bind_saverpy_get,
												 bind_saverpy_set);
			bind_addvalue(b, "on");
			bind_addvalue(b, "off");
			bind_addvalue(b, "ask");
	
	add_menu_separator(m);
		allocate_binding(m);
	
	add_menu_entry(m, "Move up", do_nothing, NULL);
		bind_keybinding(m, "key_up", KEY_UP);
	
	add_menu_entry(m, "Move down", do_nothing, NULL);
		bind_keybinding(m, "key_down", KEY_DOWN);
		
	add_menu_entry(m, "Move left", do_nothing, NULL);
		bind_keybinding(m, "key_left", KEY_LEFT);
		
	add_menu_entry(m, "Move right", do_nothing, NULL);
		bind_keybinding(m, "key_right", KEY_RIGHT);
	
	add_menu_separator(m);
		allocate_binding(m);
	
	add_menu_entry(m, "Fire", do_nothing, NULL);
		bind_keybinding(m, "key_shot", KEY_SHOT);
		
	add_menu_entry(m, "Focus", do_nothing, NULL);
		bind_keybinding(m, "key_focus", KEY_FOCUS);
	
	add_menu_entry(m, "Bomb", do_nothing, NULL);
		bind_keybinding(m, "key_bomb", KEY_BOMB);
		
	add_menu_separator(m);
		allocate_binding(m);
	
	add_menu_entry(m, "Toggle fullscreen", do_nothing, NULL);
		bind_keybinding(m, "key_fullscreen", KEY_FULLSCREEN);
		
	add_menu_entry(m, "Take a screenshot", do_nothing, NULL);
		bind_keybinding(m, "key_screenshot", KEY_SCREENSHOT);
	
	add_menu_entry(m, "Skip dialog", do_nothing, NULL);
		bind_keybinding(m, "key_skip", KEY_SKIP);
	
	add_menu_separator(m);
		allocate_binding(m);
		
	add_menu_entry(m, "Return to the main menu", backtomain, m);
		allocate_binding(m);
}