diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agi/agi.cpp | 5 | ||||
-rw-r--r-- | engines/agi/cycle.cpp | 7 | ||||
-rw-r--r-- | engines/agi/op_cmd.cpp | 10 | ||||
-rw-r--r-- | engines/agi/op_test.cpp | 3 | ||||
-rw-r--r-- | engines/agi/saveload.cpp | 6 |
5 files changed, 17 insertions, 14 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index c67cfae4ab..840357fab0 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -61,9 +61,6 @@ void AgiEngine::processEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { - case Common::EVENT_QUIT: - _quit = true; - break; case Common::EVENT_PREDICTIVE_DIALOG: if (_predictiveDialogRunning) break; @@ -810,7 +807,7 @@ int AgiEngine::go() { runGame(); - return _rtl; + return _eventMan->shouldRTL(); } void AgiEngine::syncSoundSettings() { diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp index dc0e50cff2..e12efb6a2e 100644 --- a/engines/agi/cycle.cpp +++ b/engines/agi/cycle.cpp @@ -24,6 +24,7 @@ */ +#include "common/events.h" #include "agi/agi.h" #include "agi/sprite.h" @@ -116,7 +117,7 @@ void AgiEngine::interpretCycle() { oldSound = getflag(fSoundOn); _game.exitAllLogics = false; - while (runLogic(0) == 0 && !_quit) { + while (runLogic(0) == 0 && !_eventMan->shouldQuit()) { _game.vars[vWordNotFound] = 0; _game.vars[vBorderTouchObj] = 0; _game.vars[vBorderCode] = 0; @@ -353,10 +354,10 @@ int AgiEngine::playGame() { _game.vars[vKey] = 0; } - if (_quit == 0xff) + if (_eventMan->shouldQuit() == 0xff) ec = errRestartGame; - } while (_quit == 0); + } while (_eventMan->shouldQuit() == 0); _sound->stopSound(); diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp index e3629699ca..0cd633b078 100644 --- a/engines/agi/op_cmd.cpp +++ b/engines/agi/op_cmd.cpp @@ -26,6 +26,8 @@ #include "base/version.h" +#include "common/events.h" + #include "agi/agi.h" #include "agi/sprite.h" #include "agi/graphics.h" @@ -1213,11 +1215,11 @@ cmd(quit) { g_sound->stopSound(); if (p0) { - g_agi->_quit = true; + g_system->getEventManager()->pushEvent(Common::EVENT_QUIT); } else { if (g_agi->selectionBox (" Quit the game, or continue? \n\n\n", buttons) == 0) { - g_agi->_quit = true; + g_system->getEventManager()->pushEvent(Common::EVENT_QUIT); } } } @@ -1231,7 +1233,7 @@ cmd(restart_game) { g_agi->selectionBox(" Restart game, or continue? \n\n\n", buttons); if (sel == 0) { - g_agi->_quit = 0xff; + g_system->getEventManager()->pushEvent(Common::EVENT_QUIT); g_agi->setflag(fRestartGame, true); g_agi->_menu->enableAll(); } @@ -1739,7 +1741,7 @@ int AgiEngine::runLogic(int n) { curLogic->cIP = curLogic->sIP; timerHack = 0; - while (ip < _game.logics[n].size && !g_agi->_quit) { + while (ip < _game.logics[n].size && !_eventMan->shouldQuit()) { if (_debug.enabled) { if (_debug.steps > 0) { if (_debug.logic0 || n) { diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp index 098a7730a7..32fc2d89db 100644 --- a/engines/agi/op_test.cpp +++ b/engines/agi/op_test.cpp @@ -24,6 +24,7 @@ */ +#include "common/events.h" #include "agi/agi.h" #include "agi/keyboard.h" @@ -232,7 +233,7 @@ int AgiEngine::testIfCode(int lognum) { uint8 p[16] = { 0 }; bool end_test = false; - while (retval && !_quit && !end_test) { + while (retval && !_eventMan->shouldQuit() && !end_test) { if (_debug.enabled && (_debug.logic0 || lognum)) debugConsole(lognum, lTEST_MODE, NULL); diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index 5dc2523424..26d903d52a 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -29,6 +29,7 @@ */ +#include "common/events.h" #include "common/file.h" #include "agi/agi.h" @@ -91,7 +92,7 @@ int AgiEngine::saveGame(const char *fileName, const char *description) { out->writeSint16BE((int16)_game.lognum); out->writeSint16BE((int16)_game.playerControl); - out->writeSint16BE((int16)_quit); + out->writeSint16BE((int16)_eventMan->shouldQuit()); out->writeSint16BE((int16)_game.statusLine); out->writeSint16BE((int16)_game.clockEnabled); out->writeSint16BE((int16)_game.exitAllLogics); @@ -281,7 +282,8 @@ int AgiEngine::loadGame(const char *fileName, bool checkId) { _game.lognum = in->readSint16BE(); _game.playerControl = in->readSint16BE(); - _quit = in->readSint16BE(); + if (in->readSint16BE()) + _eventMan->pushEvent(Common::EVENT_QUIT); _game.statusLine = in->readSint16BE(); _game.clockEnabled = in->readSint16BE(); _game.exitAllLogics = in->readSint16BE(); |