Commit 6f4c33c3 authored by Gerhard Stein's avatar Gerhard Stein

Ep1 Finale now works although not yet perfect

parent ea4cffc1
......@@ -14,9 +14,10 @@
#include "common/CMapLoader.h"
#include "common/Playerdefines.h"
CEndingEp1::CEndingEp1(const SmartPointer<CMap> &pMap, std::vector<CPlayer> &Player,
bool &hideobjects, std::vector<CObject*> &Object) :
CFinale(pMap, Object),
CEndingEp1::CEndingEp1(std::list< SmartPointer<CMessageBoxVort> > &messageBoxes,
const SmartPointer<CMap> &pMap, std::vector<CPlayer> &Player,
bool &hideobjects, std::vector<CObject*> &Object) :
CFinale(messageBoxes, pMap, Object),
m_Player(Player),
m_hideobjects(hideobjects)
{
......@@ -26,7 +27,6 @@ CEndingEp1::CEndingEp1(const SmartPointer<CMap> &pMap, std::vector<CPlayer> &Pla
m_timepassed = 0;
m_mustsetup = true;
m_mustfinishgame = false;
mpTextbox = NULL;
}
void CEndingEp1::process()
......@@ -46,6 +46,8 @@ void CEndingEp1::process()
}
}
void CEndingEp1::ReturnsToShip()
{
if(m_mustsetup)
......@@ -60,7 +62,7 @@ void CEndingEp1::ReturnsToShip()
m_Player[0].sprite = PMAPLEFTFRAME;
m_Player[0].processEvents();
mpTextbox = new CMessageBoxVort(g_pBehaviorEngine->getString("EP1_ESEQ_PART1"), true);
addMsgBoxString("EP1_ESEQ_PART1");
m_mustsetup = false;
}
......@@ -72,16 +74,16 @@ void CEndingEp1::ReturnsToShip()
return;
}
if( m_timepassed<50000 && !g_pInput->getPressedAnyCommand() )
/*if( m_timepassed<50000 && !g_pInput->getPressedAnyCommand() )
{
mpTextbox->processLogic();
}
else
else*/
if( mMessageBoxes.empty() )
{
// Shutdown code here!
m_step++;
m_mustsetup = true;
mpTextbox = NULL;
}
}
......@@ -144,6 +146,7 @@ void CEndingEp1::ShipFlyMarsToEarth()
}
}
void CEndingEp1::BackAtHome()
{
if(m_mustsetup)
......@@ -156,14 +159,14 @@ void CEndingEp1::BackAtHome()
m_Player[0].hideplayer = true;
mpFinaleStaticScene = new CFinaleStaticScene(mpMap->m_gamepath, "finale.ck1");
mpFinaleStaticScene->push_string("EP1_ESEQ_PART2_PAGE1", 6000);
mpFinaleStaticScene->push_string("EP1_ESEQ_PART2_PAGE2", 6000);
mpFinaleStaticScene->push_string("EP1_ESEQ_PART2_PAGE3", 6000);
mpFinaleStaticScene->push_string("EP1_ESEQ_PART2_PAGE4", 5000);
mpFinaleStaticScene->push_string("EP1_ESEQ_PART2_PAGE5", 5000);
mpFinaleStaticScene->push_string("EP1_ESEQ_PART2_PAGE6", 6000);
mpFinaleStaticScene->push_string("EP1_ESEQ_PART2_PAGE7", 6000);
mpFinaleStaticScene->push_string("EP1_ESEQ_PART2_PAGE8", 8000);
addMsgBoxString("EP1_ESEQ_PART2_PAGE1");
addMsgBoxString("EP1_ESEQ_PART2_PAGE2");
addMsgBoxString("EP1_ESEQ_PART2_PAGE3");
addMsgBoxString("EP1_ESEQ_PART2_PAGE4");
addMsgBoxString("EP1_ESEQ_PART2_PAGE5");
addMsgBoxString("EP1_ESEQ_PART2_PAGE6");
addMsgBoxString("EP1_ESEQ_PART2_PAGE7");
addMsgBoxString("EP1_ESEQ_PART2_PAGE8");
// The Bitmaps of the Window Lights on should drawn at Page 4
mpFinaleStaticScene->showBitmapAt("WINDON", 2, 6, 80, 0);
......@@ -172,11 +175,7 @@ void CEndingEp1::BackAtHome()
m_mustsetup = false;
}
if( !mpFinaleStaticScene->mustclose() )
{
mpFinaleStaticScene->process();
}
else
if( mMessageBoxes.empty() )
{
// Shutdown code here!
mpFinaleStaticScene = NULL;
......@@ -184,6 +183,11 @@ void CEndingEp1::BackAtHome()
m_step++;
m_mustsetup = true;
}
else
{
mpFinaleStaticScene->process();
}
}
void CEndingEp1::ShipFlyEarthToMShip()
......
......@@ -19,9 +19,15 @@
class CEndingEp1 : public CFinale
{
public:
CEndingEp1(const SmartPointer<CMap> &pMap, std::vector<CPlayer> &Player, bool &hideobjects, std::vector<CObject*> &Object);
CEndingEp1(std::list< SmartPointer<CMessageBoxVort> > &messageBoxes,
const SmartPointer<CMap> &pMap,
std::vector<CPlayer> &Player,
bool &hideobjects,
std::vector<CObject*> &Object);
void process();
void ReturnsToShip();
void ShipFlyMarsToEarth();
void BackAtHome();
......@@ -35,7 +41,6 @@ private:
std::vector<CPlayer> &m_Player;
SmartPointer<CShipFlySys> mpShipFlySys;
SmartPointer<CFinaleStaticScene> mpFinaleStaticScene;
SmartPointer<CMessageBoxVort> mpTextbox;
bool &m_hideobjects;
};
......
......@@ -17,8 +17,9 @@
const int LIMPSHOME_X = 0;
const int LIMPSHOME_Y = 300;
CEndingEp2::CEndingEp2(const SmartPointer<CMap> &pMap, std::vector<CPlayer> &Player, std::vector<CObject*> &Object) :
CFinale(pMap, Object),
CEndingEp2::CEndingEp2(std::list< SmartPointer<CMessageBoxVort> > &messageBoxes,
const SmartPointer<CMap> &pMap, std::vector<CPlayer> &Player, std::vector<CObject*> &Object) :
CFinale(messageBoxes, pMap, Object),
m_Player(Player)
{
m_Episode = 2;
......@@ -73,7 +74,7 @@ void CEndingEp2::HeadsForEarth()
mpMap->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);
addMsgBoxString("EP2_ESEQ_PART1");
m_mustsetup = false;
}
......@@ -125,7 +126,7 @@ void CEndingEp2::LimpsHome()
mpMap->drawAll();
mp_ShipFlySys->m_ShipQueuePtr = 0;
mp_Textbox = new CMessageBoxVort(g_pBehaviorEngine->getString("EP2_ESEQ_PART2"), true);
addMsgBoxString("EP2_ESEQ_PART2");
m_mustsetup = false;
}
......@@ -166,12 +167,18 @@ void CEndingEp2::SnowedOutside()
mpMap->resetScrolls(); // The Scrollsurface must be (0,0) so the bitmap is correctly drawn
mpMap->m_animation_enabled = false; // Needed, because the other map is still loaded
m_Player[0].hideplayer = true;
mp_FinaleStaticScene = new CFinaleStaticScene(mpMap->m_gamepath, "finale.ck2");
mp_FinaleStaticScene = new CFinaleStaticScene( mpMap->m_gamepath, "finale.ck2" );
mp_FinaleStaticScene->push_string("EP2_ESEQ_PART3_PAGE1", 6000);
/*mp_FinaleStaticScene->push_string("EP2_ESEQ_PART3_PAGE1", 6000);
mp_FinaleStaticScene->push_string("EP2_ESEQ_PART3_PAGE2", 6000);
mp_FinaleStaticScene->push_string("EP2_ESEQ_PART3_PAGE3", 6000);
mp_FinaleStaticScene->push_string("EP2_ESEQ_PART3_PAGE4", 6000);
mp_FinaleStaticScene->push_string("EP2_ESEQ_PART3_PAGE4", 6000);*/
addMsgBoxString("EP2_ESEQ_PART1");
addMsgBoxString("EP2_ESEQ_PART2");
addMsgBoxString("EP2_ESEQ_PART3");
addMsgBoxString("EP2_ESEQ_PART4");
m_mustsetup = false;
}
......
......@@ -18,7 +18,8 @@
class CEndingEp2 : public CFinale
{
public:
CEndingEp2(const SmartPointer<CMap> &pMap, std::vector<CPlayer> &Player, std::vector<CObject*> &Object);
CEndingEp2(std::list< SmartPointer<CMessageBoxVort> > &messageBoxes,
const SmartPointer<CMap> &pMap, std::vector<CPlayer> &Player, std::vector<CObject*> &Object);
void process();
void HeadsForEarth();
......
......@@ -14,8 +14,9 @@
#include "common/CMapLoader.h"
#include "common/Playerdefines.h"
CEndingEp3::CEndingEp3(const SmartPointer<CMap> &pMap, std::vector<CPlayer> &Player, std::vector<CObject*> &Object) :
CFinale(pMap, Object),
CEndingEp3::CEndingEp3(std::list< SmartPointer<CMessageBoxVort> > &messageBoxes,
const SmartPointer<CMap> &pMap, std::vector<CPlayer> &Player, std::vector<CObject*> &Object) :
CFinale(messageBoxes, pMap, Object),
m_Player(Player)
{
m_Episode = 3;
......@@ -129,7 +130,7 @@ void CEndingEp3::AwardScene()
mpMap->drawAll();
mp_FinaleStaticScene = new CFinaleStaticScene(mpMap->m_gamepath, "finale.ck3");
mp_FinaleStaticScene->push_string("THE_END", 6000);
addMsgBoxString("THE_END");
m_mustsetup = false;
}
......
......@@ -19,7 +19,8 @@
class CEndingEp3 : public CFinale {
public:
CEndingEp3(const SmartPointer<CMap> &pMap, std::vector<CPlayer> &Player, std::vector<CObject*> &Object);
CEndingEp3(std::list< SmartPointer<CMessageBoxVort> > &messageBoxes,
const SmartPointer<CMap> &pMap, std::vector<CPlayer> &Player, std::vector<CObject*> &Object);
void process();
void HonorScene();
......
......@@ -11,12 +11,21 @@
#include "FindFile.h"
#include <fstream>
CFinale::CFinale(const SmartPointer<CMap> &pMap, std::vector<CObject*> &Object) :
CFinale::CFinale(std::list< SmartPointer<CMessageBoxVort> > &messageBoxes,
const SmartPointer<CMap> &pMap,
std::vector<CObject*> &Object) :
m_mustfinishgame(false),
mMessageBoxes(messageBoxes),
mpMap(pMap),
m_Object(Object)
{}
void CFinale::addMsgBoxString(const std::string &text)
{
mMessageBoxes.push_back( new CMessageBoxVort(g_pBehaviorEngine->getString(text), true) );
}
void CFinale::showEndingText()
{
if(mpTextViewer.empty())
......
......@@ -15,9 +15,14 @@
#include "SmartPointer.h"
#include <string>
class CFinale {
class CFinale
{
public:
CFinale(const SmartPointer<CMap> &pMap, std::vector<CObject*> &Object);
CFinale(std::list< SmartPointer<CMessageBoxVort> > &messageBoxes,
const SmartPointer<CMap> &pMap,
std::vector<CObject*> &Object);
void addMsgBoxString(const std::string &text);
void showEndingText();
......@@ -30,6 +35,7 @@ protected:
SmartPointer<CTextViewer> mpTextViewer; // Used for Epilogue
std::string m_epilogue_text;
int m_Episode;
std::list< SmartPointer<CMessageBoxVort> > &mMessageBoxes;
SmartPointer<CMap> mpMap;
std::vector<CObject*> &m_Object;
};
......
......@@ -10,9 +10,9 @@
#include "sdl/CTimer.h"
#include "sdl/sound/CSound.h"
#include "graphics/CGfxEngine.h"
#include "sdl/extensions.h"
CFinaleStaticScene::CFinaleStaticScene(const std::string &game_path, const std::string &scene_file):
mp_current_tb(NULL),
m_mustclose(false),
m_count(0),
m_timer(0)
......@@ -22,20 +22,18 @@ m_timer(0)
mpSceneSurface = SDL_CreateRGBSurface( flags, resrect.w, resrect.h, 8, 0, 0, 0, 0);
SDL_SetColors( mpSceneSurface.get(), g_pGfxEngine->Palette.m_Palette, 0, 255);
if(finale_draw( mpSceneSurface.get(), scene_file, game_path))
g_pVideoDriver->mDrawTasks.add( new BlitSurfaceTask( mpSceneSurface, NULL, NULL ) );
if( finale_draw( mpSceneSurface.get(), scene_file, game_path) )
{
mpSceneSurface = SDL_DisplayFormatAlpha(mpSceneSurface.get());
}
else
{
m_mustclose = true;
}
}
void CFinaleStaticScene::push_string(const std::string &text, Uint32 delay)
{
CMessageBoxVort *p_Textbox = new CMessageBoxVort(g_pBehaviorEngine->getString(text), true, false, true);
mp_textbox_list.push_back(p_Textbox);
mp_current_tb = mp_textbox_list.front();
}
void CFinaleStaticScene::showBitmapAt(const std::string &bitmapname, Uint16 from_count, Uint16 to_count, Uint16 x, Uint16 y)
{
......@@ -63,7 +61,7 @@ void CFinaleStaticScene::process()
}
else
{
if( mp_textbox_list.empty() ) { m_mustclose = true; return; }
/*if( mp_textbox_list.empty() ) { m_mustclose = true; return; }
mp_current_tb = mp_textbox_list.front();
......@@ -83,7 +81,7 @@ void CFinaleStaticScene::process()
if(!mp_textbox_list.empty())
mp_current_tb = mp_textbox_list.front();
}
else
else*/
{
// Draw any requested Bitmap
for( std::vector<bitmap_structure>::iterator i=m_BitmapVector.begin() ;
......@@ -96,19 +94,10 @@ void CFinaleStaticScene::process()
}
// Draw Frame and the text like type writing
mp_current_tb->processLogic();
//mp_current_tb->processLogic();
}
}
}
CFinaleStaticScene::~CFinaleStaticScene()
{
CMessageBoxVort *p_textbox;
while(!mp_textbox_list.empty())
{
p_textbox = &*mp_textbox_list.front();
delete p_textbox;
mp_textbox_list.pop_front();
}
}
{}
......@@ -24,11 +24,11 @@ struct bitmap_structure {
// Prototype Reference to finale.cpp. This one still uses old C code.
bool finale_draw( SDL_Surface *sfc, const std::string& filename, const std::string& path);
class CFinaleStaticScene {
class CFinaleStaticScene
{
public:
CFinaleStaticScene(const std::string &game_path, const std::string &scene_file);
void push_string(const std::string &text, Uint32 delay);
void showBitmapAt(const std::string &bitmapname, Uint16 from_count, Uint16 to_count, Uint16 x, Uint16 y);
void setTimer(Uint16 timer) { m_timer = timer; }
void process();
......@@ -38,10 +38,8 @@ public:
private:
std::list<CMessageBoxVort*> mp_textbox_list;
std::vector<bitmap_structure> m_BitmapVector;
SmartPointer<SDL_Surface> mpSceneSurface;
CMessageBoxVort *mp_current_tb;
bool m_mustclose;
Uint8 m_count;
Uint16 m_timer; // Only used, if no Text to display is set. Example is the preview section
......
......@@ -53,7 +53,8 @@ typedef struct stShipQueue
int flag1;
} stShipQueue;
class CShipFlySys {
class CShipFlySys
{
public:
CShipFlySys(CPlayer &Player, SmartPointer<CMap> &pMap, int ship_rightsprite, int ship_leftsprite);
void addShipQueue(int cmd, int time, int flag1);
......
......@@ -27,8 +27,9 @@ const int EARTHCHUNK_BIG_DN = 66;
const int EARTHCHUNK_SMALL_UP = 68;
const int EARTHCHUNK_SMALL_DN = 70;
CTantalusRay::CTantalusRay(const SmartPointer<CMap> &pMap, std::vector<CObject*> &vect_obj, CObjectAI &objectai) :
CFinale(pMap, vect_obj),
CTantalusRay::CTantalusRay(std::list< SmartPointer<CMessageBoxVort> > &messageBoxes,
const SmartPointer<CMap> &pMap, std::vector<CObject*> &vect_obj, CObjectAI &objectai) :
CFinale(messageBoxes, pMap, vect_obj),
m_mustsetup(true),
m_alternate_sprite(0),
mp_MessageBox(new CMessageBoxVort("Uh-Oh")),
......
......@@ -19,7 +19,8 @@
class CTantalusRay : public CFinale
{
public:
CTantalusRay(const SmartPointer<CMap> &pMap, std::vector<CObject*> &vect_obj, CObjectAI &objectai);
CTantalusRay(std::list< SmartPointer<CMessageBoxVort> > &messageBoxes,
const SmartPointer<CMap> &pMap, std::vector<CObject*> &vect_obj, CObjectAI &objectai);
void process();
......
......@@ -18,16 +18,16 @@ void CPlayGameVorticon::processPauseDialogs()
return;
}
if(!m_MessageBoxes.empty())
if(!mMessageBoxes.empty())
{
CMessageBoxVort *pMB = m_MessageBoxes.front();
SmartPointer<CMessageBoxVort> pMB = mMessageBoxes.front();
pMB->processLogic();
if( pMB->isFinished() )
{
SAFE_DELETE(pMB);
m_MessageBoxes.pop_front();
mMessageBoxes.pop_front();
}
return;
}
......
......@@ -29,7 +29,7 @@ void CPlayGameVorticon::processInLevel()
// If the player touched a hint trigger in which we have to show a Message, do it so
std::string hinttext;
if( (hinttext=m_Player[i].pollHintMessage()) != "")
m_MessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString(hinttext), false, true) );
mMessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString(hinttext), false, true) );
// Check if the first player is dead, and if the others also are...
if(i==0) m_alldead = (m_Player[i].pdie == PDIE_DEAD);
......@@ -83,7 +83,7 @@ void CPlayGameVorticon::processLevelTrigger(int trigger)
mMap->m_Dark = false;
g_pMusicPlayer->stop();
g_pGfxEngine->Palette.setdark(mMap->m_Dark);
mp_Finale = new CTantalusRay(mMap, m_Object, *mp_ObjectAI);
mpFinale = new CTantalusRay(mMessageBoxes, mMap, m_Object, *mp_ObjectAI);
m_gameover = true;
}
else if (trigger == LVLTRIG_BRIDGE)
......
......@@ -29,8 +29,6 @@ mp_HUD(NULL)
{
mMap = new CMap();
m_level_command = (level==WORLD_MAP_LEVEL_VORTICON) ? GOTO_WORLD_MAP : START_LEVEL;
mp_Finale = NULL;
mp_gameoverbmp = NULL;
if(!m_Player.empty())
m_Player.clear();
......@@ -149,12 +147,12 @@ bool CPlayGameVorticon::init()
// 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));
mMessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER"),false, true));
mMessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER2"),false, true));
mMessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER3"),false, true));
mMessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER4"),false, true));
mMessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER5"),false, true));
mMessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER6"),false, true));
g_pSound->playSound(SOUND_MORTIMER);
}
......@@ -182,9 +180,9 @@ void CPlayGameVorticon::process()
if(g_pGfxEngine->Palette.in_progress())
g_pGfxEngine->Palette.applyFade();
if( m_MessageBoxes.empty() && !StatusScreenOpen() ) // Game is not paused, no messages have to be shown and no menu is open
if( mpFinale.empty() ) // Game is not paused, no messages have to be shown and no menu is open
{
if (!mp_Finale) // Hasn't the game yet been finished?
if(mMessageBoxes.empty() && !StatusScreenOpen())
{
// Perform AIs
mp_ObjectAI->process();
......@@ -208,28 +206,12 @@ void CPlayGameVorticon::process()
if(!m_Player[0].pdie)
m_Player[0].processCamera();
}
}
}
else // In this case the Game has been finished, goto to the cutscenes
{
mp_Finale->process();
if(mp_Finale->getHasFinished())
{
SAFE_DELETE(mp_Finale);
if(!m_gameover)
{
//mp_HighScores = new CHighScores(true);
collectHighScoreInfo();
}
}
m_Player[0].processEvents();
}
}
// Draw all the Stuff here!
drawAllElements();
......@@ -237,13 +219,14 @@ void CPlayGameVorticon::process()
showKeensLeft();
// Check if we are in gameover mode. If yes, than show the bitmaps and block the FKeys().
// Only confirmation button is allowes
if(m_gameover && !mp_Finale) // game over mode
if(m_gameover && mpFinale.empty()) // game over mode
{
if(mp_gameoverbmp != NULL)
if( !mpGameoverBmp.empty() )
{
mp_gameoverbmp->process();
mpGameoverBmp->process();
if( g_pInput->getPressedAnyCommand() )
{
......@@ -256,8 +239,8 @@ void CPlayGameVorticon::process()
{
CBitmap *pBitmap = g_pGfxEngine->getBitmap("GAMEOVER");
g_pSound->playSound(SOUND_GAME_OVER, PLAY_NOW);
mp_gameoverbmp = new CEGABitmap( mMap.get() , g_pVideoDriver->getBlitSurface(), pBitmap);
mp_gameoverbmp->setScrPos( 160-(pBitmap->getWidth()/2), 100-(pBitmap->getHeight()/2) );
mpGameoverBmp = new CEGABitmap( mMap.get() , g_pVideoDriver->getBlitSurface(), pBitmap);
mpGameoverBmp->setScrPos( 160-(pBitmap->getWidth()/2), 100-(pBitmap->getHeight()/2) );
}
}
else // No game over
......@@ -322,7 +305,7 @@ void CPlayGameVorticon::handleFKeys()
std::string Text = g_pBehaviorEngine->getString("CTSPACECHEAT");
m_MessageBoxes.push_back(new CMessageBoxVort(Text));
mMessageBoxes.push_back(new CMessageBoxVort(Text));
}
}
g_pVideoDriver->AddConsoleMsg("All items cheat");
......@@ -350,14 +333,14 @@ void CPlayGameVorticon::handleFKeys()
g_pSound->playSound(SOUND_GUN_CLICK, PLAY_FORCE);
// Show a message like in the original game
m_MessageBoxes.push_back(new CMessageBoxVort(m_Player[0].godmode ? g_pBehaviorEngine->getString("GODMODEON") : g_pBehaviorEngine->getString("GODMODEOFF")));
mMessageBoxes.push_back(new CMessageBoxVort(m_Player[0].godmode ? g_pBehaviorEngine->getString("GODMODEON") : g_pBehaviorEngine->getString("GODMODEOFF")));
g_pInput->flushKeys();
}
if(g_pInput->getPressedKey(KP) && m_MessageBoxes.empty())
if(g_pInput->getPressedKey(KP) && mMessageBoxes.empty())
{
g_pSound->playSound(SOUND_GUN_CLICK, PLAY_FORCE);
m_MessageBoxes.push_back(new CMessageBoxVort("Game Paused"));
mMessageBoxes.push_back(new CMessageBoxVort("Game Paused"));
}
// Menus will only open if Keen is solid or in god mode. This means neither dying nor teleporting
......@@ -435,15 +418,15 @@ void CPlayGameVorticon::createFinale()
{
if(m_Episode == 1)
{
mp_Finale = new CEndingEp1(mMap, m_Player, m_hideobjects, m_Object);
mpFinale = new CEndingEp1(mMessageBoxes, mMap, m_Player, m_hideobjects, m_Object);
}
else if(m_Episode == 2)
{
mp_Finale = new CEndingEp2(mMap, m_Player, m_Object);
mpFinale = new CEndingEp2(mMessageBoxes, mMap, m_Player, m_Object);
}
else if(m_Episode == 3)
{
mp_Finale = new CEndingEp3(mMap, m_Player, m_Object);
mpFinale = new CEndingEp3(mMessageBoxes, mMap, m_Player, m_Object);
}
}
......@@ -532,7 +515,7 @@ void CPlayGameVorticon::drawAllElements()
// Draw masked tiles here!
mMap->drawForegroundTiles();
if(mp_option[OPT_HUD].value && !mp_Finale )
if(mp_option[OPT_HUD].value && mpFinale.empty() )
{ // Draw the HUD
mp_HUD->render();
}
......@@ -542,8 +525,30 @@ void CPlayGameVorticon::drawAllElements()
m_Player[i].drawStatusScreen();
}
if(!mpFinale.empty()) // Finale processing if it is opened
{
mpFinale->process();
if(mpFinale->getHasFinished())
{
mpFinale = NULL;
if(!m_gameover)
{
//mp_HighScores = new CHighScores(true);
collectHighScoreInfo();
}
}
m_Player[0].processEvents();
}
// Render the dialogs which are seen when the game is paused
if( !m_MessageBoxes.empty() )
if( !mMessageBoxes.empty() )
{
// Finally draw Dialogs like status screen, game paused, etc.
processPauseDialogs();
......@@ -579,10 +584,8 @@ void CPlayGameVorticon::cleanup()
CPlayGameVorticon::~CPlayGameVorticon()
{
m_Player.clear();
if(mp_Finale) delete mp_Finale;
mp_Finale = NULL;
if(mp_gameoverbmp) delete mp_gameoverbmp;
mp_gameoverbmp = NULL;
mpFinale = NULL;
mpGameoverBmp = NULL;
SAFE_DELETE(mp_ObjectAI);
SAFE_DELETE(mp_HUD);
}
......@@ -106,9 +106,9 @@ private:
SmartPointer<CMap> mMap;
std::vector<CPlayer> m_Player;
CObjectAI *mp_ObjectAI;
CFinale *mp_Finale;
CEGABitmap *mp_gameoverbmp;
std::list<CMessageBoxVort*> m_MessageBoxes;
SmartPointer<CFinale> mpFinale;
SmartPointer<CEGABitmap> mpGameoverBmp;
std::list< SmartPointer<CMessageBoxVort> > mMessageBoxes;
bool m_showKeensLeft;
std::vector<CObject*> m_Object;
//CHighScores *mp_HighScores;
......
......@@ -152,14 +152,14 @@ void CPlayGameVorticon::YourShipNeedsTheseParts()
if (!bat) MessageBox->addTileAt(322,14<<3, 4<<3);
if (!vac) MessageBox->addTileAt(323,23<<3,4<<3);
if (!wis) MessageBox->addTileAt(324,31<<3,4<<3);
m_MessageBoxes.push_back(MessageBox);
mMessageBoxes.push_back(MessageBox);
}
void CPlayGameVorticon::ShipEp3()
{
// get one of four random strings and display it!!
std::string strname = "EP3_SHIP"+ itoa((rand()%4)+1);
m_MessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString(strname)));
mMessageBoxes.push_back(new CMessageBoxVort(g_pBehaviorEngine->getString(strname)));
}
void CPlayGameVorticon::showKeensLeft()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment