diff options
-rw-r--r-- | engines/xeen/worldofxeen/worldofxeen.cpp | 5 | ||||
-rw-r--r-- | engines/xeen/xeen.cpp | 17 | ||||
-rw-r--r-- | engines/xeen/xeen.h | 15 |
3 files changed, 26 insertions, 11 deletions
diff --git a/engines/xeen/worldofxeen/worldofxeen.cpp b/engines/xeen/worldofxeen/worldofxeen.cpp index c5f56573d3..a15bc401ba 100644 --- a/engines/xeen/worldofxeen/worldofxeen.cpp +++ b/engines/xeen/worldofxeen/worldofxeen.cpp @@ -39,8 +39,9 @@ WorldOfXeenEngine::WorldOfXeenEngine(OSystem *syst, const XeenGameDescription *g void WorldOfXeenEngine::outerGameLoop() { //_pendingAction = getGameID() == GType_DarkSide ? WOX_DARKSIDE_INTRO : WOX_CLOUDS_INTRO; _pendingAction = WOX_MENU; - if (gDebugLevel >= 1) - // Skip main menu when starting in debug mode + + if (_loadSaveSlot != -1 || gDebugLevel >= 1) + // Skip main menu and go straight to the game _pendingAction = WOX_PLAY_GAME; while (!shouldQuit() && _pendingAction != WOX_QUIT) { diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 9a0e42e44c..81f629e22f 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -139,7 +139,8 @@ Common::Error XeenEngine::saveGameState(int slot, const Common::String &desc) { } Common::Error XeenEngine::loadGameState(int slot) { - return _saves->loadGameState(slot); + _loadSaveSlot = slot; + return Common::kNoError; } bool XeenEngine::canLoadGameStateCurrently() { @@ -173,7 +174,12 @@ void XeenEngine::play() { _party->_mazePosition.y = 21; } - _map->load(_party->_mazeId); + if (_loadSaveSlot >= 0) { + _saves->loadGameState(_loadSaveSlot); + _loadSaveSlot = -1; + } else { + _map->load(_party->_mazeId); + } _interface->startup(); if (_mode == MODE_0) { @@ -199,6 +205,13 @@ void XeenEngine::play() { void XeenEngine::gameLoop() { // Main game loop while (!shouldQuit()) { + if (_loadSaveSlot >= 0) { + // Load any pending savegame + int saveSlot = _loadSaveSlot; + _loadSaveSlot = -1; + _saves->loadGameState(saveSlot); + } + _map->cellFlagLookup(_party->_mazePosition); if (_map->_currentIsEvent) { _quitMode = _scripts->checkEvents(); diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h index afbec4a7f9..c0ff0713df 100644 --- a/engines/xeen/xeen.h +++ b/engines/xeen/xeen.h @@ -102,7 +102,12 @@ class XeenEngine : public Engine { private: const XeenGameDescription *_gameDescription; Common::RandomSource _randomSource; - int _loadSaveSlot; +private: + void initialize(); + + // Engine APIs + virtual Common::Error run(); + virtual bool hasFeature(EngineFeature f) const; void play(); @@ -110,6 +115,8 @@ private: void gameLoop(); protected: + int _loadSaveSlot; +protected: /** * Outer gameplay loop responsible for dispatching control to game-specific * intros, main menus, or to play the actual game @@ -120,12 +127,6 @@ protected: * Play the game */ virtual void playGame(); -private: - void initialize(); - - // Engine APIs - virtual Common::Error run(); - virtual bool hasFeature(EngineFeature f) const; public: Combat *_combat; Debugger *_debugger; |