ASYLUM: Load the proper scene when using the puzzle command

- Save the current scene and restore it when quitting the puzzle

git-svn-id: http://asylumengine.googlecode.com/svn/trunk@708 0bfb4aae-4ea4-11de-8d8d-752d95cf3e3c
This commit is contained in:
Julien Templier 2010-12-10 14:27:21 +00:00 committed by Eugene Sandulenko
parent 109a98049a
commit 4e654d2dfb
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
3 changed files with 44 additions and 3 deletions

View File

@ -85,6 +85,7 @@ AsylumEngine::AsylumEngine(OSystem *system, const ADGameDescription *gd) : Engin
// Debug
_delayedSceneIndex = kResourcePackInvalid;
_delayedVideoIndex = -1;
_previousScene = NULL;
// Add default search directories
const Common::FSNode gameDataDir(ConfMan.get("path"));
@ -409,6 +410,18 @@ void AsylumEngine::switchEventHandler(EventHandler *handler) {
_handler->handleEvent(deinit);
}
//////////////////////////////////////////////////////////////////////////
// DEBUG - If a previous scene is found, replace the current scene by this one
if (handler == _scene) {
if (_previousScene) {
delete _scene;
_scene = _previousScene;
handler = _scene;
_previousScene = NULL;
}
}
//////////////////////////////////////////////////////////////////////////
// replace message handler
_handler = handler;

View File

@ -124,14 +124,14 @@ public:
/**
* Get the number of engine ticks
*
* @return The tick.
* @return The tick.
*/
uint32 getTick() { return _system->getMillis() + _tickOffset; }
/**
* Sets the tick value
*
* @param offset The offset.
* @param offset The offset.
*/
void setTick(uint32 offset) { _tickOffset = offset - _system->getMillis(); }
@ -250,7 +250,7 @@ private:
SharedData _data;
int _gameFlags[145];
int32 _sinCosTables[72];
bool _introPlayed;
bool _introPlayed;
int32 _tickOffset;
void updateMouseCursor();
@ -283,6 +283,7 @@ private:
// Debug
friend class Console;
Scene *_previousScene;
ResourcePackId _delayedSceneIndex;
int32 _delayedVideoIndex;
};

View File

@ -49,6 +49,26 @@ extern int32 g_debugPolygons;
extern int32 g_debugObjects;
extern int32 g_debugScrolling;
const ResourcePackId puzzleToScenes[17] = {
kResourcePackTowerCells,
kResourcePackCourtyardAndChapel,
kResourcePackInnocentAbandoned,
kResourcePackMansion,
kResourcePackInvalid,
kResourcePackLaboratory,
kResourcePackLaboratory,
kResourcePackLaboratory,
kResourcePackLaboratory,
kResourcePackMorgueCementary,
kResourcePackMansion,
kResourcePackMorgueCementary,
kResourcePackInvalid,
kResourcePackMorgueCementary,
kResourcePackLostVillage,
kResourcePackHive,
kResourcePackHive
};
Console::Console(AsylumEngine *engine) : _vm(engine) {
// Commands
DCmd_Register("help", WRAP_METHOD(Console, cmdHelp));
@ -425,6 +445,13 @@ bool Console::cmdRunPuzzle(int32 argc, const char **argv) {
getScreen()->clear();
getScreen()->clearGraphicsInQueue();
// Save previous scene
_vm->_previousScene = getScene();
// Load puzzle scene
_vm->_scene = new Scene(_vm);
getScene()->load(puzzleToScenes[index]);
_vm->switchEventHandler(puzzle);
return false;