diff options
Diffstat (limited to 'engines/lure/game.cpp')
-rw-r--r-- | engines/lure/game.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp index f9b31c21c5..479877f229 100644 --- a/engines/lure/game.cpp +++ b/engines/lure/game.cpp @@ -23,10 +23,10 @@ * */ -#include "lure/lure.h" #include "lure/game.h" #include "lure/animseq.h" #include "lure/fights.h" +#include "lure/lure.h" #include "lure/res_struct.h" #include "lure/room.h" #include "lure/scripts.h" @@ -125,6 +125,7 @@ void Game::nextFrame() { void Game::execute() { OSystem &system = *g_system; + LureEngine &engine = LureEngine::getReference(); Room &room = Room::getReference(); Resources &res = Resources::getReference(); Events &events = Events::getReference(); @@ -137,12 +138,20 @@ void Game::execute() { screen.empty(); screen.setPaletteEmpty(); + + bool _loadSavegame = false; + + if (engine.gameToLoad() != -1) + _loadSavegame = engine.loadGame(engine.gameToLoad()); + + if (!_loadSavegame) { + // Flag for starting game + setState(GS_RESTART); + } - // Flag for starting game - setState(GS_RESTART); bool initialRestart = true; - while (!events.quitFlag) { + while (!engine.quit()) { if ((_state & GS_RESTART) != 0) { res.reset(); @@ -162,7 +171,7 @@ void Game::execute() { mouse.cursorOn(); // Main game loop - while (!events.quitFlag && ((_state & GS_RESTART) == 0)) { + while (!engine.quit() && ((_state & GS_RESTART) == 0)) { // If time for next frame, allow everything to update if (system.getMillis() > timerVal + GAME_FRAME_DELAY) { timerVal = system.getMillis(); @@ -291,10 +300,7 @@ void Game::execute() { if (restartFlag) setState(GS_RESTART); - - } else if ((_state & GS_RESTART) == 0) - // Exiting game - events.quitFlag = true; + } } } @@ -892,7 +898,7 @@ void Game::doShowCredits() { void Game::doQuit() { Sound.pause(); if (getYN()) - Events::getReference().quitFlag = true; + LureEngine::getReference().quitGame(); Sound.resume(); } @@ -977,6 +983,7 @@ bool Game::getYN() { Events &events = Events::getReference(); Screen &screen = Screen::getReference(); Resources &res = Resources::getReference(); + LureEngine &engine = LureEngine::getReference(); Common::Language l = LureEngine::getReference().getLanguage(); Common::KeyCode y = Common::KEYCODE_y; @@ -1018,7 +1025,7 @@ bool Game::getYN() { } g_system->delayMillis(10); - } while (!events.quitFlag && !breakFlag); + } while (!engine.quit() && !breakFlag); screen.update(); if (!vKbdFlag) |