From 5d48d8521939d4a62151e1dd1d996a6385ffaaae Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Apr 2013 10:50:08 +1000 Subject: HOPKINS: Fix Return to Launcher --- engines/hopkins/events.cpp | 2 +- engines/hopkins/hopkins.cpp | 9 ++++----- engines/hopkins/hopkins.h | 1 - engines/hopkins/menu.cpp | 6 +++--- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 58389ef2e9..51c66c4f92 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -237,7 +237,7 @@ void EventsManager::checkForNextFrameCounter() { void EventsManager::delay(int totalMilli) { uint32 delayEnd = g_system->getMillis() + totalMilli; - while (!g_system->getEventManager()->shouldQuit() && g_system->getMillis() < delayEnd) { + while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd) { g_system->delayMillis(10); } } diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index bf9509c0d4..aece768ca7 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1534,10 +1534,6 @@ bool HopkinsEngine::runFull() { return true; } -bool HopkinsEngine::shouldQuit() const { - return g_system->getEventManager()->shouldQuit(); -} - int HopkinsEngine::getRandomNumber(int maxNumber) { return _randomSource.getRandomNumber(maxNumber); } @@ -1889,7 +1885,10 @@ void HopkinsEngine::bombExplosion() { } void HopkinsEngine::restoreSystem() { - quitGame(); + // If the game isn't alerady trying to quit, flag that quitting is needed + if (!shouldQuit()) + quitGame(); + _events->refreshEvents(); } diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index b5de387894..7af7f962b3 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -167,7 +167,6 @@ public: Common::Platform getPlatform() const; uint16 getVersion() const; bool getIsDemo() const; - bool shouldQuit() const; int getRandomNumber(int maxNumber); Common::String generateSaveName(int slotNumber); diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 01aa84e4ed..455f4ad8d4 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -50,11 +50,11 @@ int MenuManager::menu() { signed int result; int frameIndex[] = { 0, 0, 0, 0, 0 }; - if (g_system->getEventManager()->shouldQuit()) + if (_vm->shouldQuit()) return -1; result = 0; - while (!g_system->getEventManager()->shouldQuit()) { + while (!_vm->shouldQuit()) { _vm->_objectsMan->_forestFl = false; _vm->_events->_breakoutFl = false; _vm->_globals->_disableInventFl = true; @@ -97,7 +97,7 @@ int MenuManager::menu() { // Loop to make menu selection bool selectionMade = false; do { - if (g_system->getEventManager()->shouldQuit()) + if (_vm->shouldQuit()) return -1; menuIndex = MENU_NONE; -- cgit v1.2.3