Esempio n. 1
0
    //--------------------------------------------------------------------------
    void
    FLevelFile::loadImpl()
    {
        FLevelFileSerializer serializer;
        Ogre::DataStreamPtr stream( openResource() );
        serializer.importFLevelFile( stream, this );

        String background_texture_name( getBackgroundTextureName() );
        if( m_background_texture_loader == NULL )
        {
            m_background_texture_loader = new FLevelTextureLoader( *this );
            m_background_texture = Ogre::TextureManager::getSingleton().create( background_texture_name, mGroup, true, m_background_texture_loader );
        }

        String background_2d_name( getBackground2DName() );
        if( m_background_2d_loader == NULL )
        {
            m_background_2d_loader = new FLevelBackground2DLoader( *this );
            m_background_2d = Background2DFileManager::getSingleton().create( background_2d_name, mGroup, true, m_background_2d_loader );
        }
    }
Esempio n. 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);
}