aboutsummaryrefslogtreecommitdiff
path: root/engines/lure/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/lure/game.cpp')
-rw-r--r--engines/lure/game.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp
index 479877f229..f9b31c21c5 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,7 +125,6 @@ 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();
@@ -138,20 +137,12 @@ 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 (!engine.quit()) {
+ while (!events.quitFlag) {
if ((_state & GS_RESTART) != 0) {
res.reset();
@@ -171,7 +162,7 @@ void Game::execute() {
mouse.cursorOn();
// Main game loop
- while (!engine.quit() && ((_state & GS_RESTART) == 0)) {
+ while (!events.quitFlag && ((_state & GS_RESTART) == 0)) {
// If time for next frame, allow everything to update
if (system.getMillis() > timerVal + GAME_FRAME_DELAY) {
timerVal = system.getMillis();
@@ -300,7 +291,10 @@ void Game::execute() {
if (restartFlag)
setState(GS_RESTART);
- }
+
+ } else if ((_state & GS_RESTART) == 0)
+ // Exiting game
+ events.quitFlag = true;
}
}
@@ -898,7 +892,7 @@ void Game::doShowCredits() {
void Game::doQuit() {
Sound.pause();
if (getYN())
- LureEngine::getReference().quitGame();
+ Events::getReference().quitFlag = true;
Sound.resume();
}
@@ -983,7 +977,6 @@ 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;
@@ -1025,7 +1018,7 @@ bool Game::getYN() {
}
g_system->delayMillis(10);
- } while (!engine.quit() && !breakFlag);
+ } while (!events.quitFlag && !breakFlag);
screen.update();
if (!vKbdFlag)