From 17ce8db211051bf0b7626958201b5bcfec206979 Mon Sep 17 00:00:00 2001 From: Christopher Page Date: Thu, 10 Jul 2008 22:34:48 +0000 Subject: Lure works with the new GMM implementation svn-id: r32996 --- engines/agos/agos.h | 1 - engines/agos/subroutine.cpp | 2 +- engines/lure/events.cpp | 10 +++------- engines/lure/fights.cpp | 4 ++-- engines/lure/game.cpp | 13 +++++-------- engines/lure/intro.cpp | 2 +- engines/lure/lure.cpp | 8 ++++---- engines/lure/menu.cpp | 4 ++-- engines/lure/scripts.cpp | 4 ++-- engines/lure/surface.cpp | 12 ++++++------ 10 files changed, 26 insertions(+), 34 deletions(-) diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 11c04cd021..fe1d36f281 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -269,7 +269,6 @@ protected: uint16 _marks; - // bool _quit; bool _scriptVar2; bool _runScriptReturn1; bool _runScriptCondition[40]; diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp index cb71ed7efa..488ebf4edf 100644 --- a/engines/agos/subroutine.cpp +++ b/engines/agos/subroutine.cpp @@ -555,7 +555,7 @@ int AGOSEngine::startSubroutine(Subroutine *sub) { _currentTable = sub; restart: - if (_quit) + if (quit()) return result; while ((byte *)sl != (byte *)sub) { diff --git a/engines/lure/events.cpp b/engines/lure/events.cpp index 3d093365f6..eec9dbda11 100644 --- a/engines/lure/events.cpp +++ b/engines/lure/events.cpp @@ -141,9 +141,9 @@ void Mouse::waitForRelease() { LureEngine &engine = LureEngine::getReference(); do { - while (e.pollEvent() && !engine._quit) ; + while (e.pollEvent() && !engine.quit()) ; g_system->delayMillis(20); - } while (!engine._quit && (lButton() || rButton() || mButton())); + } while (!engine.quit() && (lButton() || rButton() || mButton())); } /*--------------------------------------------------------------------------*/ @@ -166,10 +166,6 @@ bool Events::pollEvent() { // Handle keypress switch (_event.type) { - case Common::EVENT_QUIT: - engine._quit = true; - break; - case Common::EVENT_LBUTTONDOWN: case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONDOWN: @@ -217,7 +213,7 @@ bool Events::interruptableDelay(uint32 milliseconds) { uint32 delayCtr = g_system->getMillis() + milliseconds; while (g_system->getMillis() < delayCtr) { - if (engine._quit) return true; + if (engine.quit()) return true; if (events.pollEvent()) { if (((events.type() == Common::EVENT_KEYDOWN) && (events.event().kbd.ascii != 0)) || diff --git a/engines/lure/fights.cpp b/engines/lure/fights.cpp index f3eaa6f248..51fce850e6 100644 --- a/engines/lure/fights.cpp +++ b/engines/lure/fights.cpp @@ -117,7 +117,7 @@ void FightsManager::fightLoop() { uint32 timerVal = g_system->getMillis(); // Loop for the duration of the battle - while (!engine._quit && (playerFight.fwhits != GENERAL_MAGIC_ID)) { + while (!engine.quit() && (playerFight.fwhits != GENERAL_MAGIC_ID)) { checkEvents(); if (g_system->getMillis() > timerVal + GAME_FRAME_DELAY) { @@ -198,7 +198,7 @@ void FightsManager::checkEvents() { if (events.type() == Common::EVENT_KEYDOWN) { switch (events.event().kbd.keycode) { case Common::KEYCODE_ESCAPE: - engine._quit = true; + engine.quitGame(); return; case Common::KEYCODE_d: diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp index e8ac2ead88..195ad0fd66 100644 --- a/engines/lure/game.cpp +++ b/engines/lure/game.cpp @@ -143,7 +143,7 @@ void Game::execute() { setState(GS_RESTART); bool initialRestart = true; - while (!engine._quit) { + while (!engine.quit()) { if ((_state & GS_RESTART) != 0) { res.reset(); @@ -163,7 +163,7 @@ void Game::execute() { mouse.cursorOn(); // Main game loop - while (!engine._quit && ((_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(); @@ -292,10 +292,7 @@ void Game::execute() { if (restartFlag) setState(GS_RESTART); - - } else if ((_state & GS_RESTART) == 0) - // Exiting game - engine._quit = true; + } } } @@ -893,7 +890,7 @@ void Game::doShowCredits() { void Game::doQuit() { Sound.pause(); if (getYN()) - LureEngine::getReference()._quit = true; + LureEngine::getReference().quitGame(); Sound.resume(); } @@ -1020,7 +1017,7 @@ bool Game::getYN() { } g_system->delayMillis(10); - } while (!engine._quit && !breakFlag); + } while (!engine.quit() && !breakFlag); screen.update(); if (!vKbdFlag) diff --git a/engines/lure/intro.cpp b/engines/lure/intro.cpp index 894094d677..5b07dd3916 100644 --- a/engines/lure/intro.cpp +++ b/engines/lure/intro.cpp @@ -64,7 +64,7 @@ bool Introduction::showScreen(uint16 screenId, uint16 paletteId, uint16 delaySiz else screen.paletteFadeIn(&p); bool result = interruptableDelay(delaySize); - if (LureEngine::getReference()._quit) return true; + if (LureEngine::getReference().quit()) return true; if (!isEGA) screen.paletteFadeOut(); diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp index 9c5482da6d..90c0c34454 100644 --- a/engines/lure/lure.cpp +++ b/engines/lure/lure.cpp @@ -126,8 +126,8 @@ int LureEngine::go() { CopyProtectionDialog *dialog = new CopyProtectionDialog(); bool result = dialog->show(); delete dialog; - if (_quit) - return _rtl; + if (quit()) + return _eventMan->shouldRTL(); if (!result) error("Sorry - copy protection failed"); @@ -145,14 +145,14 @@ int LureEngine::go() { } // Play the game - if (!_quit) { + if (!quit()) { // Play the game Sound.loadSection(Sound.isRoland() ? ROLAND_MAIN_SOUND_RESOURCE_ID : ADLIB_MAIN_SOUND_RESOURCE_ID); gameInstance->execute(); } delete gameInstance; - return _rtl; + return _eventMan->shouldRTL(); } void LureEngine::pauseEngineIntern(bool pause) { diff --git a/engines/lure/menu.cpp b/engines/lure/menu.cpp index 3468e49582..562f54da20 100644 --- a/engines/lure/menu.cpp +++ b/engines/lure/menu.cpp @@ -131,7 +131,7 @@ uint8 Menu::execute() { while (mouse.lButton() || mouse.rButton()) { while (events.pollEvent()) { - if (engine._quit) return MENUITEM_NONE; + if (engine.quit()) return MENUITEM_NONE; if (mouse.y() < MENUBAR_Y_SIZE) { MenuRecord *p = getMenuAt(mouse.x()); @@ -547,7 +547,7 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) { } while (e.pollEvent()) { - if (engine._quit) { + if (engine.quit()) { selectedIndex = 0xffff; goto bail_out; diff --git a/engines/lure/scripts.cpp b/engines/lure/scripts.cpp index 9a459616ed..495f8046bb 100644 --- a/engines/lure/scripts.cpp +++ b/engines/lure/scripts.cpp @@ -221,7 +221,7 @@ void Script::endgameSequence(uint16 v1, uint16 v2, uint16 v3) { anim->show(); if (!events.interruptableDelay(30000)) { // No key yet pressed, so keep waiting - while (Sound.musicInterface_CheckPlaying(6) && !engine._quit) { + while (Sound.musicInterface_CheckPlaying(6) && !engine.quit()) { if (events.interruptableDelay(20)) break; } @@ -229,7 +229,7 @@ void Script::endgameSequence(uint16 v1, uint16 v2, uint16 v3) { delete anim; screen.paletteFadeOut(); - engine._quit = true; + engine.quitGame(); } // Setup the pig fight in the cave diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp index 1d18344358..23cc9043cf 100644 --- a/engines/lure/surface.cpp +++ b/engines/lure/surface.cpp @@ -534,7 +534,7 @@ bool Surface::getString(Common::String &line, int maxSize, bool isNumeric, bool // Loop until the input string changes refreshFlag = false; while (!refreshFlag && !abortFlag) { - abortFlag = engine._quit; + abortFlag = engine.quit(); if (abortFlag) break; while (events.pollEvent()) { @@ -976,7 +976,7 @@ bool SaveRestoreDialog::show(bool saveDialog) { // Provide highlighting of lines to select a save slot while (!abortFlag && !(mouse.lButton() && (selectedLine != -1)) && !mouse.rButton() && !mouse.mButton()) { - abortFlag = engine._quit; + abortFlag = engine.quit(); if (abortFlag) break; while (events.pollEvent()) { @@ -1179,7 +1179,7 @@ bool RestartRestoreDialog::show() { // Event loop for making selection bool buttonPressed = false; - while (!engine._quit) { + while (!engine.quit()) { // Handle events while (events.pollEvent()) { if ((events.type() == Common::EVENT_LBUTTONDOWN) && (highlightedButton != -1)) { @@ -1231,7 +1231,7 @@ bool RestartRestoreDialog::show() { Sound.killSounds(); - if (!restartFlag && !engine._quit) { + if (!restartFlag && !engine.quit()) { // Need to show Restore game dialog if (!SaveRestoreDialog::show(false)) // User cancelled, so fall back on Restart @@ -1351,7 +1351,7 @@ bool CopyProtectionDialog::show() { // Clear any prior try _charIndex = 0; - while (!engine._quit) { + while (!engine.quit()) { while (events.pollEvent() && (_charIndex < 4)) { if (events.type() == Common::EVENT_KEYDOWN) { if ((events.event().kbd.keycode == Common::KEYCODE_BACKSPACE) && (_charIndex > 0)) { @@ -1385,7 +1385,7 @@ bool CopyProtectionDialog::show() { break; } - if (engine._quit) + if (engine.quit()) return false; // At this point, two page numbers have been entered - validate them -- cgit v1.2.3