bool CPlayGameVorticon::init()
{
	CVorticonMapLoaderWithPlayer MapLoader( mMap, m_Player, mSpriteObjectContainer );
	MapLoader.m_checkpointset = m_checkpointset;

	// load level map
	if( !MapLoader.load( m_Episode, m_Level, m_Gamepath ) ) return false;
	gpSaveGameController->setLevel(m_Level);

	//// If those worked fine, continue the initialization
	// draw level map
	mMap->drawAll();

	// Now Scroll to the position of the player and center him
	mMap->gotoPos( 32, 64 ); // Assure that the edges are never seen

	setupPlayers();

	// Well, all players are living because they were newly spawn.
	g_pTimer->ResetSecondsTimer();

	g_pInput->flushAll();

	// Initialize the AI
	mpObjectAI.reset( new CVorticonSpriteObjectAI(mMap.get(), mSpriteObjectContainer, m_Player,
			m_NumPlayers, m_Episode, m_Level,
			mMap->m_Dark) );

	// Check if Player meets the conditions to show a cutscene. This also happens, when finale of episode has reached
	verifyFinales();

	// When Level starts it's never dark!
	g_pGfxEngine->Palette.setdark(false);

	if(m_level_command == GOTO_FINALE)
		createFinale();
	else
		if(m_showKeensLeft)	g_pSound->playSound(SOUND_KEENSLEFT, PLAY_NOW);

	// In the case that we are in Episode 3 last Level, show Mortimer Messages
	if( m_Episode == 3 && m_Level == 16 )
	{
	    std::unique_ptr<CMessageBoxVort> msg1(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER"),false, true));
	    std::unique_ptr<CMessageBoxVort> msg2(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER2"),false, true));
	    std::unique_ptr<CMessageBoxVort> msg3(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER3"),false, true));
	    std::unique_ptr<CMessageBoxVort> msg4(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER4"),false, true));
	    std::unique_ptr<CMessageBoxVort> msg5(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER5"),false, true));
	    std::unique_ptr<CMessageBoxVort> msg6(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER6"),false, true));
	    mMessageBoxes.push_back(move(msg1));
	    mMessageBoxes.push_back(move(msg2));
	    mMessageBoxes.push_back(move(msg3));
	    mMessageBoxes.push_back(move(msg4));
	    mMessageBoxes.push_back(move(msg5));
	    mMessageBoxes.push_back(move(msg6));
	    g_pSound->playSound(SOUND_MORTIMER);
	}

	return true;
}
bool CPlayGameVorticon::init()
{
	CMapLoader MapLoader( &m_Map, &m_Player );
	MapLoader.m_checkpointset = m_checkpointset;
	MapLoader.mp_objvect = &m_Object;

	m_Map.m_Difficulty = m_Difficulty;

	// load level map
	if( !MapLoader.load( m_Episode, m_Level, m_Gamepath ) ) return false;
	m_SavedGame.setLevel(m_Level);

	//// If those worked fine, continue the initialization
	// draw level map
	m_Map.drawAll();

	// Now Scroll to the position of the player and center him
	m_Map.gotoPos( 32, 64 ); // Assure that the edges are never seen

	setupPlayers();

	// Well, all players are living because they were newly spawn.
	g_pTimer->ResetSecondsTimer();

	g_pInput->flushAll();

	// Initialize the AI
	mp_ObjectAI = new CObjectAI(&m_Map, m_Object, m_Player,
								m_NumPlayers, m_Episode, m_Level,
								m_Difficulty, m_Map.m_Dark);

	// Check if Player meets the conditions to show a cutscene. This also happens, when finale of episode has reached
	verifyFinales();

	// When Level starts it's never dark!
	g_pGfxEngine->Palette.setdark(false);

	if(m_level_command == GOTO_FINALE)
		createFinale();
	else
		if(m_showKeensLeft)	g_pSound->playSound(SOUND_KEENSLEFT, PLAY_NOW);

	// In the case that we are in Episode 3 last Level, show Mortimer Messages
	if( m_Episode == 3 && m_Level == 16 )
	{
		m_MessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER"),false, true));
		m_MessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER2"),false, true));
		m_MessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER3"),false, true));
		m_MessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER4"),false, true));
		m_MessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER5"),false, true));
		m_MessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER6"),false, true));
		g_pSound->playSound(SOUND_MORTIMER);
	}

	return true;
}
Esempio n. 3
0
// The Ending and mortimer cutscenes for example
void CPlayGameVorticon::verifyFinales()
{
	// first we need to know which Episode we were on
	if(m_Episode == 1)
	{
		bool hasBattery, hasWiskey, hasJoystick, hasVaccum;
		hasBattery = hasWiskey = hasJoystick = hasVaccum = false;

		// Check if one of the Players has the items
        const unsigned int numPlayers = g_pBehaviorEngine->mPlayers;
        for( size_t i=0 ;i < numPlayers ; i++)
		{
			hasBattery |= m_Player[i].inventory.HasBattery;
			hasWiskey |= m_Player[i].inventory.HasWiskey;
			hasJoystick |= m_Player[i].inventory.HasJoystick;
			hasVaccum |= m_Player[i].inventory.HasVacuum;
		}

		// If they have have the items, we can go home
		if(hasBattery && hasWiskey && hasJoystick && hasVaccum)
			createFinale();
	}
	else if(m_Episode == 2)
	{
		bool allCitiesSaved;
		allCitiesSaved = mpLevelCompleted[4];
		allCitiesSaved &= mpLevelCompleted[6];
		allCitiesSaved &= mpLevelCompleted[7];
		allCitiesSaved &= mpLevelCompleted[9];
		allCitiesSaved &= mpLevelCompleted[11];
		allCitiesSaved &= mpLevelCompleted[13];
		allCitiesSaved &= mpLevelCompleted[15];
		allCitiesSaved &= mpLevelCompleted[16];

		if(allCitiesSaved)
			createFinale();
	}
	else if(m_Episode == 3)
	{
		if(mpLevelCompleted[16] == true) // If this level is completed, Mortimer has been killed!
			createFinale();
	}
}
Esempio n. 4
0
bool CPlayGameVorticon::init()
{    
    const GsRect<Uint16> gameRect = gVideoDriver.getVidConfig().m_GameRect;
    gVideoDriver.setNativeResolution(gameRect);

    // Create the special merge effect (Fadeout)
    CColorMerge *pColorMergeFX = new CColorMerge(8);
    gEffectController.setupEffect(pColorMergeFX);


	CVorticonMapLoaderWithPlayer MapLoader( mMap, m_Player, mSpriteObjectContainer );
	MapLoader.m_checkpointset = m_checkpointset;
    const int numPlayers = g_pBehaviorEngine->mPlayers;

	// load level map
    if( !MapLoader.load( m_Episode, m_Level, m_Gamepath ) )
        return false;

    gpSaveGameController->setLevel(m_Level);
    mMap->setLevel(m_Level);

	//// If those worked fine, continue the initialization
	// draw level map
	mMap->drawAll();

	// Now Scroll to the position of the player and center him
    mMap->gotoPos( 32, 64 ); // Ensure that the edges are never seen

	setupPlayers();

	// Well, all players are living because they were newly spawn.
	gTimer.ResetSecondsTimer();

	gInput.flushAll();

	// Initialize the AI
	mpObjectAI.reset( new CVorticonSpriteObjectAI(mMap.get(), mSpriteObjectContainer, m_Player,
            numPlayers, m_Episode, m_Level,
			mMap->m_Dark) );

    // Check if Player meets the conditions to show a cutscene. This also happens, when finale of episode is reached
	verifyFinales();

	// When Level starts it's never dark!
	gGraphics.Palette.setdark(false);

    const std::string finaleStr = gArgs.getValue("finale");
    if(finaleStr == "on")
    {
        createFinale();
        gArgs.removeTag("finale");
    }

    if(m_showKeensLeft)
	  g_pSound->playSound(SOUND_KEENSLEFT, PLAY_NOW);

	// In the case that we are in Episode 3 last Level, show Mortimer Messages
	if( m_Episode == 3 && m_Level == 16 )
	{
	    std::unique_ptr<CMessageBoxVort> msg1(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER"),false, true));
	    std::unique_ptr<CMessageBoxVort> msg2(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER2"),false, true));
	    std::unique_ptr<CMessageBoxVort> msg3(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER3"),false, true));
	    std::unique_ptr<CMessageBoxVort> msg4(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER4"),false, true));
	    std::unique_ptr<CMessageBoxVort> msg5(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER5"),false, true));
	    std::unique_ptr<CMessageBoxVort> msg6(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER6"),false, true));
	    mMessageBoxes.push_back(move(msg1));
	    mMessageBoxes.push_back(move(msg2));
	    mMessageBoxes.push_back(move(msg3));
	    mMessageBoxes.push_back(move(msg4));
	    mMessageBoxes.push_back(move(msg5));
	    mMessageBoxes.push_back(move(msg6));
	    g_pSound->playSound(SOUND_MORTIMER);
	}

    return true;
}