示例#1
0
文件: title.c 项目: akien-mga/tbftss
void initTitle(void)
{
	startSectionTransition();
	
	stopMusic();
	
	app.delegate.logic = &logic;
	app.delegate.draw = &draw;
	memset(&app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);
	
	battle.camera.x =  battle.camera.y = 0;
	
	destroyBattle();
	
	logo = getTexture("gfx/title/logo.png");
	
	pandoranWar = getTexture("gfx/title/pandoran.png");
	
	background = getTexture("gfx/backgrounds/background02.jpg");
	
	earthTexture = getTexture("gfx/planets/earth.png");
	
	earth.x = rand() % SCREEN_WIDTH;
	earth.y = -(128 + (rand() % 128));
	
	initBackground();
	
	initEffects();
	
	initFighters();
	
	updateAllMissions();
	
	getWidget("campaign", "title")->action = campaign;
	getWidget("challenges", "title")->action = challenges;
	getWidget("trophies", "title")->action = trophies;
	getWidget("stats", "title")->action = stats;
	getWidget("fighterDB", "title")->action = fighterDatabase;
	getWidget("options", "title")->action = options;
	getWidget("credits", "title")->action = credits;
	getWidget("quit", "title")->action = quit;
	
	getWidget("ok", "stats")->action = ok;
	getWidget("ok", "trophies")->action = ok;
	getWidget("ok", "fighterDB")->action = ok;
	
	show = SHOW_TITLE;
	
	endSectionTransition();
	
	playMusic("music/main/Rise of spirit.ogg", 0);
}
示例#2
0
void initChallengeHome(void)
{
	Mission *m;
	
	startSectionTransition();

	stopMusic();

	updateAllMissions();

	unlockChallenges();

	awardChallengeTrophies();

	awardStatsTrophies();

	app.saveGame = 1;
	
	CHALLENGES_TEXT = _("Challenges");
	COMPLETED_TEXT = _("Completed : %d / %d");
	PAGE_TEXT = _("Page : %d / %d");
	LOCKED_TEXT = _("[Locked]");
	CRAFT_TEXT = _("Craft: %s");
	TIME_TEXT = _("Time Limit: %s");
	RESTRICTIONS_TEXT = _("Restrictions: %s");

	app.delegate.logic = &logic;
	app.delegate.draw = &draw;
	memset(&app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);

	background = getTexture(getBackgroundTextureName(rand()));
	planetTexture = getTexture(getPlanetTextureName(rand()));
	challengeIcon = getTexture("gfx/challenges/challengeIcon.png");
	challengeIconHighlight = getTexture("gfx/challenges/challengeIconHighlight.png");

	battle.camera.x =  battle.camera.y = 0;

	planet.x = rand() % SCREEN_WIDTH;
	planet.y = rand() % SCREEN_HEIGHT;
	
	maxPages = page = 0;
	
	for (m = game.challengeMissionHead.next ; m != NULL ; m = m->next)
	{
		maxPages++;
	}
	
	maxPages /= CHALLENGES_PER_PAGE;
	maxPages = ceil(maxPages);

	show = SHOW_CHALLENGES;

	initBackground();

	start = getWidget("start", "challenges");
	start->action = startChallengeMission;

	getWidget("resume", "challengesMenu")->action = resume;
	getWidget("stats", "challengesMenu")->action = stats;
	getWidget("trophies", "challengesMenu")->action = trophies;
	getWidget("options", "challengesMenu")->action = options;
	getWidget("quit", "challengesMenu")->action = quit;

	getWidget("ok", "stats")->action = ok;
	getWidget("ok", "trophies")->action = ok;
	
	prev = getWidget("prev", "challenges");
	prev->action = prevPage;
	prev->visible = 0;
	
	next = getWidget("next", "challenges");
	next->action = nextPage;
	next->visible = 1;

	/* select first challenge if none chosen */
	if (!game.currentMission)
	{
		game.currentMission = game.challengeMissionHead.next;
		updateChallengeMissionData();
	}
	
	SDL_SetWindowGrab(app.window, 0);

	endSectionTransition();

	playMusic("music/main/covert_operations.mp3", 1);
}