ASYLUM: Add Game::reset() function

- Set game as started in the menu, making return to game work properly

git-svn-id: http://asylumengine.googlecode.com/svn/trunk@643 0bfb4aae-4ea4-11de-8d8d-752d95cf3e3c
This commit is contained in:
Julien Templier 2010-12-03 23:18:36 +00:00 committed by Eugene Sandulenko
parent 7463acb772
commit 84dbd45ae0
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
4 changed files with 25 additions and 1 deletions

View File

@ -217,7 +217,7 @@ void AsylumEngine::restart() {
_data.getPoint()->x = -1;
_data.getPoint()->y = -1;
// FIXME the original runs a list of "reset" functions (some can be moved to constructors, others need to be part of the global data)
reset();
_introPlayed = false;
@ -227,6 +227,18 @@ void AsylumEngine::restart() {
startGame(kResourcePackTowerCells, kStartGamePlayIntro);
}
void AsylumEngine::reset() {
// Set game as started
_mainMenu->setGameStarted();
// Reset puzzles
for (uint32 i = 0; i < ARRAYSIZE(_puzzles); i++)
if (_puzzles[i] != NULL)
_puzzles[i]->reset();
// FIXME reset shared actor data
}
void AsylumEngine::playIntro() {
if (!_video || !_screen)
error("[AsylumEngine::playIntro] Subsystems not initialized properly!");

View File

@ -126,6 +126,11 @@ public:
*/
SharedData *getData() { return &_data; }
/**
* Resets the game
*/
void reset();
/**
* This is the global tick counter.
*/

View File

@ -51,6 +51,8 @@ public:
virtual void open() = 0;
virtual void close() = 0;
virtual void reset() {}
bool isActive() { return _active; }
protected:

View File

@ -57,6 +57,11 @@ public:
*/
bool handleEvent(const AsylumEvent &evt);
/**
* Sets the game as started.
*/
void setGameStarted() { _gameStarted = true; }
private:
AsylumEngine *_vm;