Commit 9b23527d authored by Gerhard Stein's avatar Gerhard Stein

Intro and Title Screen fully working again.

parent 4d6d8851
......@@ -17,19 +17,18 @@
////
// Creation Routine
////
CTitle::CTitle(std::vector<CObject*> &Objects, CMap &map) :
m_objects(Objects),
m_time(0),
m_map(map)
CTitle::CTitle( CMap &map ) :
mTime(0),
mMap(map)
{}
bool CTitle::init(int Episode)
{
CObject *p_object;
CObject *pObject;
SDL_Surface *pSurface;
CBitmap *pBitmap;
g_pTimer->ResetSecondsTimer();
m_time = 10; // show the title screen for 10 secs.
mTime = 10; // show the title screen for 10 secs.
pSurface = g_pVideoDriver->mp_VideoEngine->getBlitSurface();
if(!g_pVideoDriver->getSpecialFXConfig())
g_pGfxEngine->setupEffect(new CColorMerge(16));
......@@ -38,23 +37,23 @@ bool CTitle::init(int Episode)
if( (pBitmap = g_pGfxEngine->getBitmap("TITLE")) != NULL )
{
p_object = new CEGABitmap( &m_map, pSurface, pBitmap );
p_object->setScrPos( 160-(pBitmap->getWidth()/2), 0 );
m_objects.push_back(p_object);
pObject = new CEGABitmap( &mMap, pSurface, pBitmap );
pObject->setScrPos( 160-(pBitmap->getWidth()/2), 0 );
mObjects.push_back(pObject);
}
if( (pBitmap = g_pGfxEngine->getBitmap("F1HELP")) != NULL )
{
pBitmap = g_pGfxEngine->getBitmap("F1HELP");
p_object = new CEGABitmap( &m_map, pSurface, pBitmap );
pObject = new CEGABitmap( &mMap, pSurface, pBitmap );
p_object->setScrPos( (Episode == 3) ? 128 : 96, 182 );
m_objects.push_back(p_object);
pObject->setScrPos( (Episode == 3) ? 128 : 96, 182 );
mObjects.push_back(pObject);
}
m_map.changeTileArrayY(2, 15, 2, g_pGfxEngine->getTileMap(1).EmptyBackgroundTile());
mMap.changeTileArrayY(2, 15, 2, g_pGfxEngine->getTileMap(1).EmptyBackgroundTile());
m_finished = false;
mFinished = false;
return true;
}
......@@ -64,19 +63,13 @@ bool CTitle::init(int Episode)
////
void CTitle::process()
{
if( m_time == 0) m_finished = true;
else m_time -= g_pTimer->HasSecElapsed();
}
if( mTime == 0) mFinished = true;
else mTime -= g_pTimer->HasSecElapsed();
////
// Cleanup Routine
////
CTitle::~CTitle() {
while( !m_objects.empty() )
std::vector< SmartPointer<CObject> >::iterator obj = mObjects.begin();
for( ; obj != mObjects.end() ; obj++ )
{
if(m_objects.back())
delete m_objects.back();
m_objects.pop_back();
obj->get()->process();
}
}
}
......@@ -18,26 +18,27 @@
#include <SDL.h>
#include <vector>
#include "../graphics/CGfxEngine.h"
#include "../common/CObject.h"
#include "../common/CMap.h"
#include "graphics/CGfxEngine.h"
#include "common/CObject.h"
#include "common/CMap.h"
#include "SmartPointer.h"
class CTitle {
class CTitle
{
public:
CTitle(std::vector<CObject*> &Objects, CMap &map);
virtual ~CTitle();
CTitle(CMap &map);
bool init(int Episode);
void process();
bool isFinished()
{ return m_finished; }
{ return mFinished; }
private:
std::vector<CObject*> &m_objects;
bool m_finished;
unsigned int m_time;
CMap &m_map;
std::vector< SmartPointer<CObject> > mObjects;
bool mFinished;
unsigned int mTime;
CMap &mMap;
};
#endif /* CTITLE_H_ */
......@@ -51,7 +51,7 @@ bool CPassiveVort::init(char mode)
MapLoader.load( m_Episode, 90, m_DataDirectory);
mpMap->gotoPos( 32, 32 ); // Coordinates of title screen
mpMap->drawAll();
mp_TitleScreen = new CTitle(mObject, *mpMap.get() );
mp_TitleScreen = new CTitle( *mpMap.get() );
mp_TitleScreen->init(m_Episode);
}
else if( m_mode == DEMO )
......@@ -65,83 +65,6 @@ bool CPassiveVort::init(char mode)
void CPassiveVort::process()
{
// Open the Main-Menu or close the opened one?
/*if( !mp_Menu )
{
if (mp_PressAnyBox==NULL && m_mode == TITLE)
{
mp_PressAnyBox = new CTextBox(150, 10," PRESS ANY KEY ");
mp_PressAnyBox->setAttribs(0, true);
mp_PressAnyBox->enableBorders(true);
}
if ( g_pInput->getPressedAnyKey() || g_pInput->getPressedAnyCommand() )
{
// Close the "Press Any Key" box
if(g_pGfxEngine->Effect()) // some effect is running? Close it!
g_pGfxEngine->killEffect();
g_pInput->flushAll();
if (m_mode != TITLE)
{
cleanup();
init(TITLE);
}
else
{
SAFE_DELETE(mp_PressAnyBox);
mp_Menu = new CMenuVorticon( PASSIVE, *mp_Map, m_SavedGame,
m_RestartVideo, m_hideobjects);
}
}
}
else // Close menu
{
if ( mp_Menu->m_demoback )
{
SAFE_DELETE(mp_Menu);
mp_Map->drawAll();
}
else if( m_RestartVideo )
{
cleanup();
init(m_mode);
m_RestartVideo = false;
}
}*/
// If Menu is open show it!
/*if( mp_Menu )
{
mp_Menu->processSpecific();
if(mp_Menu->mustStartGame() || m_SavedGame.getCommand() == CSaveGameController::LOAD) // Start a normal game
{
m_NumPlayers = mp_Menu->getNumPlayers();
m_Difficulty = mp_Menu->getDifficulty();
SAFE_DELETE(mp_Menu);
cleanup();
m_mode = STARTGAME;
}
else if(mp_Menu->getExitEvent())
{
SAFE_DELETE(mp_Menu);
cleanup();
m_mode = SHUTDOWN;
}
else if(mp_Menu->getChooseGame())
{
SAFE_DELETE(mp_Menu);
m_modeg = true;
}
else if( m_RestartVideo ) // When some video settings has been changed
{
cleanup();
init(m_mode);
m_RestartVideo = false;
}
}*/
// Process Drawing related stuff
// Animate the tiles
mpMap->animateAllTiles();
......@@ -163,7 +86,7 @@ void CPassiveVort::process()
// Modes. We have three: Intro, Main-tile and Demos. We could add more.
/*if( m_mode == INTRO )
if( m_mode == INTRO )
{
// Intro code goes here!
mp_IntroScreen->process();
......@@ -177,40 +100,18 @@ void CPassiveVort::process()
}
else if( m_mode == TITLE )
{
mp_TitleScreen->process();*/
/*if( !mp_Menu )
{
if( mp_TitleScreen->isFinished() )
{
// The Title screen was shown enough time, shut it down
// and load Demo environment
cleanup();
init(DEMO);
return;
}
}*/
/*}
mp_TitleScreen->process();
}
else if( m_mode == DEMO )
{
// TODO: Demo modes are processed here!
// TODO: Implement Demos here!
cleanup();
init(TITLE);
}*/
/*if(!m_hideobjects)
{
// Make the Objects do its jobs
std::vector<CObject*>::iterator i;
for( i=m_object.begin() ; i!=m_object.end() ; i++ )
{
(*i)->process();
}
}
// If Menu is not open show "Press Any Key"
if(mp_PressAnyBox != NULL)
/*if(mp_PressAnyBox != NULL)
mp_PressAnyBox->process();*/
}
......
......@@ -14,7 +14,8 @@
#include "common/CObject.h"
#include <SDL.h>
class CEGABitmap : public CObject {
class CEGABitmap : public CObject
{
public:
CEGABitmap(CMap *p_Map, SDL_Surface *pSurface, CBitmap *pBitmap);
void setPos(int px, int py);
......
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