diff options
author | Colin Snover | 2017-11-14 11:48:18 -0600 |
---|---|---|
committer | Eugene Sandulenko | 2017-11-18 22:35:12 +0100 |
commit | 926bcb6740e19d644757fc21ccd3dbf750342985 (patch) | |
tree | 7918dfbf4b397ca1d768cad2fb89cb15d08a3169 /engines | |
parent | a25246bebe860aa7057e4c8901234c9d5f52b814 (diff) | |
download | scummvm-rg350-926bcb6740e19d644757fc21ccd3dbf750342985.tar.gz scummvm-rg350-926bcb6740e19d644757fc21ccd3dbf750342985.tar.bz2 scummvm-rg350-926bcb6740e19d644757fc21ccd3dbf750342985.zip |
FULLPIPE: Handle quit/RTL events correctly
Fixes Trac#10316.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 14 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.h | 1 | ||||
-rw-r--r-- | engines/fullpipe/gfx.cpp | 4 |
3 files changed, 12 insertions, 7 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 4bcdac7561..f359639df7 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -262,6 +262,10 @@ void FullpipeEngine::restartGame() { } } +bool FullpipeEngine::shouldQuit() { + return !_gameContinue || Engine::shouldQuit(); +} + Common::Error FullpipeEngine::loadGameState(int slot) { if (_gameLoader->readSavegame(getSavegameFile(slot))) return Common::kNoError; @@ -312,15 +316,16 @@ Common::Error FullpipeEngine::run() { loadAllScenes(); #endif - _gameContinue = true; - int time1 = g_fp->_system->getMillis(); // Center mouse _system->warpMouse(400, 300); - while (_gameContinue) { + for (;;) { updateEvents(); + if (shouldQuit()) { + break; + } int time2 = g_fp->_system->getMillis(); @@ -436,8 +441,7 @@ void FullpipeEngine::updateEvents() { _mouseScreenPos = event.mouse; break; case Common::EVENT_QUIT: - _gameContinue = false; - break; + return; case Common::EVENT_RBUTTONDOWN: if (!_inputArFlag && (_updateTicks - _lastInputTicks) >= 2) { ex = new ExCommand(0, 17, 107, event.mouse.x, event.mouse.y, 0, 1, 0, 0, 0); diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index ddcb5ad637..39c03fe3e4 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -106,6 +106,7 @@ public: void initialize(); void restartGame(); + bool shouldQuit(); void setMusicAllowed(int val) { _musicAllowed = val; } diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index d41505e2f1..8ba2e80c1b 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -626,7 +626,7 @@ void Picture::drawRotated(int x, int y, int angle) { } void Picture::displayPicture() { - if (!g_fp->_gameContinue) + if (g_fp->shouldQuit()) return; getData(); @@ -644,7 +644,7 @@ void Picture::displayPicture() { g_fp->_system->delayMillis(10); g_fp->_system->updateScreen(); - while (g_fp->_gameContinue) { + while (!g_fp->shouldQuit()) { g_fp->updateEvents(); g_fp->_system->delayMillis(10); g_fp->_system->updateScreen(); |