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;
}
void CEndingEp2::HeadsForEarth()
{
	if(m_mustsetup)
	{
		//Initialization
		std::string path = m_Map.m_gamepath;
		CMapLoader MapLoader(&m_Map, &m_Player);
		MapLoader.load(2, 81, path);

		m_Player[0].hideplayer = false;
		m_Player[0].sprite = SPR_VORTICON_MOTHERSHIP;
		m_Player[0].solid = false;

		mp_ShipFlySys = new CShipFlySys( m_Player[0], &m_Map, SPR_SHIP_RIGHT_EP2, SPR_SHIP_LEFT_EP2 );

		m_Map.gotoPos(0, 0);
		mp_ShipFlySys->addShipQueue(CMD_WAIT, 10, 0);
		mp_ShipFlySys->addShipQueue(CMD_MOVE, 672, DDOWNRIGHT);
		mp_ShipFlySys->addShipQueue(CMD_MOVE, 150, DDOWN);
		mp_ShipFlySys->addShipQueue(CMD_ENDOFQUEUE, 0, 0);
		m_Map.drawAll();
		mp_ShipFlySys->m_ShipQueuePtr = 0;

		int x, y;
		m_Map.findTile(593, &x, &y);
		m_Player[0].moveTo(VectorD2<int>(x<<CSF, y<<CSF));

		mp_Textbox = new CMessageBoxVort(g_pBehaviorEngine->getString("EP2_ESEQ_PART1"), true);

		m_mustsetup = false;
	}

	if(mp_Textbox)
	{
		mp_Textbox->process();

		if(mp_Textbox->isFinished())
		{
			SAFE_DELETE(mp_Textbox);
		}
	}
	else
	{	// process the normal ship flying level and do all the inited commands
		if( !mp_ShipFlySys->EndOfQueue() && !g_pInput->getPressedAnyCommand() )
		{
			mp_ShipFlySys->process();
		}
		else
		{
			// Shutdown code here!
			delete mp_ShipFlySys;
			mp_ShipFlySys = NULL;
			m_step++;
			m_mustsetup = 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;
}
void CEndingEp2::LimpsHome()
{
	if(m_mustsetup)
	{	//Initialization
		std::string path = m_Map.m_gamepath;
		CMapLoader MapLoader(&m_Map, &m_Player);
		MapLoader.load(2, 81, path);

		m_Player[0].hideplayer = false;
		m_Player[0].moveTo(VectorD2<int>(8<<CSF, 26<<CSF));
		m_Player[0].solid = false;

		mp_ShipFlySys = new CShipFlySys( m_Player[0], &m_Map, SPR_VORTICON_MOTHERSHIP, SPR_VORTICON_MOTHERSHIP );

		m_Map.gotoPos(LIMPSHOME_X, LIMPSHOME_Y);
		mp_ShipFlySys->addShipQueue(CMD_WAIT, 10, 0);
		mp_ShipFlySys->addShipQueue(CMD_MOVE, 80, DUPLEFT);
		mp_ShipFlySys->addShipQueue(CMD_ENDOFQUEUE, 0, 0);
		m_Map.drawAll();
		mp_ShipFlySys->m_ShipQueuePtr = 0;

		mp_Textbox = new CMessageBoxVort(g_pBehaviorEngine->getString("EP2_ESEQ_PART2"), true);

		m_mustsetup = false;
	}


	if(mp_Textbox)
	{
		mp_Textbox->process();

		if(mp_Textbox->isFinished())
		{
			SAFE_DELETE(mp_Textbox);
		}
	}
	else
	{	// process the normal ship flying level and do all the inited commands
		if( !mp_ShipFlySys->EndOfQueue() & !g_pInput->getPressedAnyCommand() )
		{
			mp_ShipFlySys->process();
		}
		else
		{
			// Shutdown code here!
			delete mp_ShipFlySys;
			mp_ShipFlySys = NULL;
			m_step++;
			m_mustsetup = true;
		}
	}
}
void CWorldMap::init()
{
    // Load the World map level.
    CMapLoaderGalaxy MapLoader(m_ExeFile, m_ObjectPtr, m_Inventory, m_Cheatmode);

    MapLoader.loadMap(m_Map, 0); // Is it a Map Level?
    const std::string loading_text = g_pBehaviorEngine->getString("WORLDMAP_LOAD_TEXT");

    CEventContainer& EventContainer = g_pBehaviorEngine->m_EventList;
    EventContainer.add( new EventSendBitmapDialogMsg(106, loading_text, LEFT) );

    m_Map.drawAll();
}
void CLevelPlay::loadMap(const int level)
{
	// Load the World map level.
	CMapLoaderGalaxy MapLoader(m_ExeFile, m_ObjectPtr, m_Inventory, m_Cheatmode);

	MapLoader.loadMap( m_Map, level );

    // Load the Background Music
	g_pMusicPlayer->stop();

    if(!g_pMusicPlayer->load(m_ExeFile, level))
    	g_pLogFile->textOut("Warning: The music cannot be played. Check that all the files have been correctly copied!");
    else
    	g_pMusicPlayer->play();
}
void CEndingEp3::HonorScene()
{
	if(m_mustsetup)
	{
		//Initialization
		std::string path = mpMap->m_gamepath;
		std::vector< std::unique_ptr<CVorticonSpriteObject> > spriteObjectContainer;
		CVorticonMapLoaderWithPlayer MapLoader(mpMap, m_Player, spriteObjectContainer);
		MapLoader.load(3, 81, path);

		m_Player[0].hideplayer = false;
		m_Player[0].moveTo(Vector2D<int>(244<<STC, 104<<STC));
		m_Player[0].sprite = 0;

		mpMap->gotoPos(32, 32);
		mpMap->drawAll();

		addMsgBoxString("EP3_ESEQ_PAGE1");
		addMsgBoxString("EP3_ESEQ_PAGE2");
		addMsgBoxString("EP3_ESEQ_PAGE3");
		addMsgBoxString("EP3_ESEQ_PAGE4");

		int newtile = mpMap->at(2,12);
		for(int x=0 ; x<22 ; x++) // This changes to the Oh No! Tiles to normal Stone-Tiles
		{
			mpMap->changeTile( x, 15, newtile);
			mpMap->changeTile( x, 16, newtile);
		}

		m_mustsetup = false;
	}

	if( mMessageBoxes.empty() )
	{
		m_step++;
		m_mustsetup = true;
	}
}
Exemple #8
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;
}