From 7f50c5040144627cf00ccd91831946c356c45860 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Feb 2018 21:16:23 -0500 Subject: XEEN: Fix exiting to main menu after playing ending cutscenes --- engines/xeen/combat.cpp | 2 +- engines/xeen/cutscenes.cpp | 14 ++-- engines/xeen/dialogs_awards.cpp | 4 +- engines/xeen/dialogs_char_info.cpp | 6 +- engines/xeen/dialogs_control_panel.cpp | 2 +- engines/xeen/dialogs_dismiss.cpp | 6 +- engines/xeen/dialogs_exchange.cpp | 2 +- engines/xeen/dialogs_info.cpp | 2 +- engines/xeen/dialogs_input.cpp | 6 +- engines/xeen/dialogs_items.cpp | 10 +-- engines/xeen/dialogs_map.cpp | 2 +- engines/xeen/dialogs_message.cpp | 6 +- engines/xeen/dialogs_party.cpp | 20 ++--- engines/xeen/dialogs_query.cpp | 6 +- engines/xeen/dialogs_quests.cpp | 4 +- engines/xeen/dialogs_quick_ref.cpp | 2 +- engines/xeen/dialogs_spells.cpp | 22 ++--- engines/xeen/dialogs_whowill.cpp | 2 +- engines/xeen/events.cpp | 16 ++-- engines/xeen/interface.cpp | 20 ++--- engines/xeen/locations.cpp | 68 +++++++-------- engines/xeen/party.cpp | 2 +- engines/xeen/screen.cpp | 2 +- engines/xeen/scripts.cpp | 10 +-- engines/xeen/worldofxeen/darkside_cutscenes.cpp | 14 ++-- engines/xeen/worldofxeen/worldofxeen.cpp | 1 + engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp | 96 +++++++++++----------- engines/xeen/worldofxeen/worldofxeen_menu.cpp | 16 ++-- engines/xeen/xeen.cpp | 4 +- engines/xeen/xeen.h | 5 ++ 30 files changed, 189 insertions(+), 183 deletions(-) diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp index 5b82468d1a..fa408307fa 100644 --- a/engines/xeen/combat.cpp +++ b/engines/xeen/combat.cpp @@ -626,7 +626,7 @@ void Combat::monstersAttack() { do { intf.draw3d(true); events.pollEventsAndWait(); - } while (!_vm->shouldQuit() && intf._isAttacking); + } while (!_vm->shouldExit() && intf._isAttacking); endAttack(); diff --git a/engines/xeen/cutscenes.cpp b/engines/xeen/cutscenes.cpp index 4df737263d..46a911e096 100644 --- a/engines/xeen/cutscenes.cpp +++ b/engines/xeen/cutscenes.cpp @@ -38,7 +38,7 @@ void Cutscenes::showSubtitles(uint windowIndex) { Sound &sound = *_vm->_sound; Windows &windows = *_vm->_windows; - if (sound._soundOn || _vm->shouldQuit()) { + if (sound._soundOn || _vm->shouldExit()) { // Sound is on, so subtitles aren't needed resetSubtitles(0, 0); } else { @@ -124,7 +124,7 @@ bool Cutscenes::doScroll(bool rollUp, bool fadeIn) { if (_vm->_files->_isDarkCc) { if (fadeIn) screen.fadeIn(2); - return _vm->shouldQuit(); + return _vm->shouldExit(); } screen.saveBackground(); @@ -145,7 +145,7 @@ bool Cutscenes::doScroll(bool rollUp, bool fadeIn) { if (rollUp) { for (int i = 22, ctr = 7; i > 0 && !events.isKeyMousePressed() - && !_vm->shouldQuit(); --i) { + && !_vm->shouldExit(); --i) { events.updateGameCounter(); screen.restoreBackground(); @@ -161,7 +161,7 @@ bool Cutscenes::doScroll(bool rollUp, bool fadeIn) { marb[(i - 1) / 5]->draw(0, (i - 1) % 5); screen.update(); - while (!_vm->shouldQuit() && events.timeElapsed() == 0) + while (!_vm->shouldExit() && events.timeElapsed() == 0) events.pollEventsAndWait(); if (i == 0 && fadeIn) @@ -169,7 +169,7 @@ bool Cutscenes::doScroll(bool rollUp, bool fadeIn) { } } else { for (int i = 0, ctr = 0; i < 22 && !events.isKeyMousePressed() - && !_vm->shouldQuit(); ++i) { + && !_vm->shouldExit(); ++i) { events.updateGameCounter(); screen.restoreBackground(); @@ -186,7 +186,7 @@ bool Cutscenes::doScroll(bool rollUp, bool fadeIn) { } screen.update(); - while (!_vm->shouldQuit() && events.timeElapsed() == 0) + while (!_vm->shouldExit() && events.timeElapsed() == 0) events.pollEventsAndWait(); if (i == 0 && fadeIn) @@ -208,7 +208,7 @@ bool Cutscenes::doScroll(bool rollUp, bool fadeIn) { for (int i = 0; i < 16; ++i) delete hand[i]; - return _vm->shouldQuit() || events.isKeyMousePressed(); + return _vm->shouldExit() || events.isKeyMousePressed(); } } // End of namespace Xeen diff --git a/engines/xeen/dialogs_awards.cpp b/engines/xeen/dialogs_awards.cpp index ab1b79193b..242539c20b 100644 --- a/engines/xeen/dialogs_awards.cpp +++ b/engines/xeen/dialogs_awards.cpp @@ -54,7 +54,7 @@ void Awards::execute(const Character *ch) { windows[29].writeString(Res.AWARDS_TEXT); drawButtons(&windows[0]); - while (!_vm->shouldQuit()) { + while (!_vm->shouldExit()) { // Build up a list of awards the character has awards.clear(); awards.resize(AWARDS_TOTAL); @@ -100,7 +100,7 @@ void Awards::execute(const Character *ch) { do { events.pollEventsAndWait(); checkEvents(_vm); - } while (!g_vm->shouldQuit() && !_buttonValue); + } while (!g_vm->shouldExit() && !_buttonValue); if (_buttonValue == Common::KEYCODE_ESCAPE) { break; diff --git a/engines/xeen/dialogs_char_info.cpp b/engines/xeen/dialogs_char_info.cpp index 3d039c111b..b7a7df8c85 100644 --- a/engines/xeen/dialogs_char_info.cpp +++ b/engines/xeen/dialogs_char_info.cpp @@ -67,7 +67,7 @@ void CharacterInfo::execute(int charIndex) { events.updateGameCounter(); bool cursorFlag = false; _buttonValue = 0; - while (!_vm->shouldQuit() && !_buttonValue) { + while (!_vm->shouldExit() && !_buttonValue) { events.pollEventsAndWait(); if (events.timeElapsed() > 4) { cursorFlag = !cursorFlag; @@ -208,7 +208,7 @@ void CharacterInfo::execute(int charIndex) { case Common::KEYCODE_ESCAPE: goto exit; } - } while (!_vm->shouldQuit()); + } while (!_vm->shouldExit()); exit: w.close(); intf.unhighlightChar(); @@ -560,7 +560,7 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) { // Wait for a user key/click EventsManager &events = *_vm->_events; - while (!_vm->shouldQuit() && !events.isKeyMousePressed()) + while (!_vm->shouldExit() && !events.isKeyMousePressed()) events.pollEventsAndWait(); events.clearEvents(); diff --git a/engines/xeen/dialogs_control_panel.cpp b/engines/xeen/dialogs_control_panel.cpp index 9eec117bb2..5a7f593e68 100644 --- a/engines/xeen/dialogs_control_panel.cpp +++ b/engines/xeen/dialogs_control_panel.cpp @@ -78,7 +78,7 @@ int ControlPanel::execute() { events.pollEventsAndWait(); checkEvents(_vm); - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return 0; } while (!_buttonValue && !events.timeElapsed()); diff --git a/engines/xeen/dialogs_dismiss.cpp b/engines/xeen/dialogs_dismiss.cpp index 25edb6ba89..52ac475e05 100644 --- a/engines/xeen/dialogs_dismiss.cpp +++ b/engines/xeen/dialogs_dismiss.cpp @@ -46,7 +46,7 @@ void Dismiss::execute() { w.update(); bool breakFlag = false; - while (!_vm->shouldQuit() && !breakFlag) { + while (!_vm->shouldExit() && !breakFlag) { do { events.updateGameCounter(); intf.draw3d(false); @@ -59,8 +59,8 @@ void Dismiss::execute() { do { events.pollEventsAndWait(); checkEvents(_vm); - } while (!_vm->shouldQuit() && !_buttonValue && events.timeElapsed() == 0); - } while (!_vm->shouldQuit() && !_buttonValue); + } while (!_vm->shouldExit() && !_buttonValue && events.timeElapsed() == 0); + } while (!_vm->shouldExit() && !_buttonValue); if (_buttonValue >= Common::KEYCODE_F1 && _buttonValue <= Common::KEYCODE_F6) { _buttonValue -= Common::KEYCODE_F1; diff --git a/engines/xeen/dialogs_exchange.cpp b/engines/xeen/dialogs_exchange.cpp index dc994ac8b9..d977656d35 100644 --- a/engines/xeen/dialogs_exchange.cpp +++ b/engines/xeen/dialogs_exchange.cpp @@ -45,7 +45,7 @@ void ExchangeDialog::execute(Character *&c, int &charIndex) { _iconSprites.draw(w, 0, Common::Point(225, 120)); w.update(); - while (!_vm->shouldQuit()) { + while (!_vm->shouldExit()) { events.pollEventsAndWait(); checkEvents(_vm); diff --git a/engines/xeen/dialogs_info.cpp b/engines/xeen/dialogs_info.cpp index fb6734f55c..4f51316b6e 100644 --- a/engines/xeen/dialogs_info.cpp +++ b/engines/xeen/dialogs_info.cpp @@ -74,7 +74,7 @@ void InfoDialog::execute() { w.update(); events.wait(1); - } while (!_vm->shouldQuit() && !events.isKeyMousePressed()); + } while (!_vm->shouldExit() && !events.isKeyMousePressed()); events.clearEvents(); w.close(); diff --git a/engines/xeen/dialogs_input.cpp b/engines/xeen/dialogs_input.cpp index 6437778f7c..a8979d6ae0 100644 --- a/engines/xeen/dialogs_input.cpp +++ b/engines/xeen/dialogs_input.cpp @@ -41,7 +41,7 @@ int Input::getString(Common::String &line, uint maxLen, int maxWidth, bool isNum _window->writeString(msg); _window->update(); - while (!_vm->shouldQuit()) { + while (!_vm->shouldExit()) { Common::KeyCode keyCode = waitForKey(msg); bool refresh = false; @@ -86,7 +86,7 @@ Common::KeyCode Input::waitForKey(const Common::String &msg) { && _vm->_mode != MODE_FF && _vm->_mode != MODE_17; Common::KeyCode ch = Common::KEYCODE_INVALID; - while (!_vm->shouldQuit()) { + while (!_vm->shouldExit()) { events.updateGameCounter(); if (flag) @@ -247,7 +247,7 @@ int Choose123::execute(int numOptions) { } events.wait(delay); - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return 0; } while (!_buttonValue); diff --git a/engines/xeen/dialogs_items.cpp b/engines/xeen/dialogs_items.cpp index 9f08e8bc55..c9249f3b74 100644 --- a/engines/xeen/dialogs_items.cpp +++ b/engines/xeen/dialogs_items.cpp @@ -308,11 +308,11 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) { // Wait for a selection _buttonValue = 0; - while (!_vm->shouldQuit() && !_buttonValue) { + while (!_vm->shouldExit() && !_buttonValue) { events.pollEventsAndWait(); checkEvents(_vm); } - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return nullptr; // Handle escaping out of dialog @@ -808,11 +808,11 @@ int ItemsDialog::doItemOptions(Character &c, int actionIndex, int itemIndex, Ite _iconSprites.draw(0, 0, Common::Point(235, 111)); w.update(); - while (!_vm->shouldQuit()) { + while (!_vm->shouldExit()) { while (!_buttonValue) { events.pollEventsAndWait(); checkEvents(_vm); - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return false; } @@ -1017,7 +1017,7 @@ int ItemsDialog::doItemOptions(Character &c, int actionIndex, int itemIndex, Ite saveButtons(); clearButtons(); - while (!_vm->shouldQuit() && !events.isKeyMousePressed()) + while (!_vm->shouldExit() && !events.isKeyMousePressed()) events.pollEventsAndWait(); events.clearEvents(); diff --git a/engines/xeen/dialogs_map.cpp b/engines/xeen/dialogs_map.cpp index 8008d4645a..d7442605c3 100644 --- a/engines/xeen/dialogs_map.cpp +++ b/engines/xeen/dialogs_map.cpp @@ -111,7 +111,7 @@ void MapDialog::execute() { events.ipause5(2); drawFlag = false; - } while (!_vm->shouldQuit() && !events.isKeyMousePressed()); + } while (!_vm->shouldExit() && !events.isKeyMousePressed()); events.clearEvents(); windows[5].close(); diff --git a/engines/xeen/dialogs_message.cpp b/engines/xeen/dialogs_message.cpp index 039680249f..b0bc5b6634 100644 --- a/engines/xeen/dialogs_message.cpp +++ b/engines/xeen/dialogs_message.cpp @@ -44,7 +44,7 @@ void MessageDialog::execute(const Common::String &msg, MessageWaitType waitType) switch (waitType) { case WT_FREEZE_WAIT: - while (!_vm->shouldQuit() && !events.isKeyMousePressed()) + while (!_vm->shouldExit() && !events.isKeyMousePressed()) events.pollEventsAndWait(); events.clearEvents(); @@ -65,7 +65,7 @@ void MessageDialog::execute(const Common::String &msg, MessageWaitType waitType) events.wait(1); if (checkEvents(_vm)) break; - } while (!_vm->shouldQuit() && !_buttonValue); + } while (!_vm->shouldExit() && !_buttonValue); break; case WT_LOC_WAIT: @@ -113,7 +113,7 @@ void CantCast::execute(int spellId, int componentNum) { do { events.pollEventsAndWait(); - } while (!_vm->shouldQuit() && !events.isKeyMousePressed()); + } while (!_vm->shouldExit() && !events.isKeyMousePressed()); events.clearEvents(); w.close(); diff --git a/engines/xeen/dialogs_party.cpp b/engines/xeen/dialogs_party.cpp index 226776c7d3..e1d6e5614e 100644 --- a/engines/xeen/dialogs_party.cpp +++ b/engines/xeen/dialogs_party.cpp @@ -57,7 +57,7 @@ void PartyDialog::execute() { loadButtons(); setupBackground(); - while (!_vm->shouldQuit()) { + while (!_vm->shouldExit()) { _vm->_mode = MODE_1; // Build up a list of available characters in the Roster that are on the @@ -104,11 +104,11 @@ void PartyDialog::execute() { } bool breakFlag = false; - while (!_vm->shouldQuit() && !breakFlag) { + while (!_vm->shouldExit() && !breakFlag) { do { events.pollEventsAndWait(); checkEvents(_vm); - } while (!_vm->shouldQuit() && !_buttonValue); + } while (!_vm->shouldExit() && !_buttonValue); switch (_buttonValue) { case Common::KEYCODE_ESCAPE: @@ -435,7 +435,7 @@ void PartyDialog::createChar() { screen.loadBackground("create.raw"); events.setCursor(0); - while (!_vm->shouldQuit()) { + while (!_vm->shouldExit()) { classId = -1; if (restartFlag) { @@ -511,7 +511,7 @@ void PartyDialog::createChar() { // Animate the dice until a user action occurs _buttonValue = 0; - while (!_vm->shouldQuit() && !_buttonValue) + while (!_vm->shouldExit() && !_buttonValue) drawDice(dice); // Handling for different actions @@ -689,7 +689,7 @@ void PartyDialog::createChar() { } printSelectionArrow(icons, selectedClass); - } while (!_vm->shouldQuit() && _buttonValue != Common::KEYCODE_ESCAPE); + } while (!_vm->shouldExit() && _buttonValue != Common::KEYCODE_ESCAPE); _vm->_mode = oldMode; } @@ -720,9 +720,9 @@ int PartyDialog::selectCharacter(bool isDelete, int firstDisplayChar) { addPartyButtons(_vm); int result = -1, v; - while (!_vm->shouldQuit() && result == -1) { + while (!_vm->shouldExit() && result == -1) { _buttonValue = 0; - while (!_vm->shouldQuit() && !_buttonValue) { + while (!_vm->shouldExit() && !_buttonValue) { events.pollEventsAndWait(); checkEvents(_vm); } @@ -921,12 +921,12 @@ int PartyDialog::exchangeAttribute(int srcAttr) { int result = 0; bool breakFlag = false; - while (!_vm->shouldQuit() && !breakFlag) { + while (!_vm->shouldExit() && !breakFlag) { // Wait for an action do { events.pollEventsAndWait(); checkEvents(_vm); - } while (!_vm->shouldQuit() && !_buttonValue); + } while (!_vm->shouldExit() && !_buttonValue); Attribute destAttr; switch (_buttonValue) { diff --git a/engines/xeen/dialogs_query.cpp b/engines/xeen/dialogs_query.cpp index fd466938b3..75de3ee3ea 100644 --- a/engines/xeen/dialogs_query.cpp +++ b/engines/xeen/dialogs_query.cpp @@ -66,8 +66,8 @@ bool Confirm::execute(const Common::String &msg, int mode) { w.update(); events.clearEvents(); - while (!_vm->shouldQuit()) { - while (!_vm->shouldQuit() && !_buttonValue) { + while (!_vm->shouldExit()) { + while (!_vm->shouldExit() && !_buttonValue) { events.pollEvents(); checkEvents(_vm); } @@ -124,7 +124,7 @@ bool YesNo::execute(bool type, bool townFlag) { intf._face2State = map._headData[party._mazePosition.y][party._mazePosition.x]._right; } - while (!_vm->shouldQuit()) { + while (!_vm->shouldExit()) { events.updateGameCounter(); if (loc.isActive()) { diff --git a/engines/xeen/dialogs_quests.cpp b/engines/xeen/dialogs_quests.cpp index 5cfd9efc96..5e5171ea87 100644 --- a/engines/xeen/dialogs_quests.cpp +++ b/engines/xeen/dialogs_quests.cpp @@ -61,7 +61,7 @@ void Quests::execute() { windows[29].writeString(Res.QUESTS_DIALOG_TEXT); drawButtons(&windows[0]); - while (!_vm->shouldQuit()) { + while (!_vm->shouldExit()) { Common::String lines[MAX_DIALOG_LINES]; switch (mode) { @@ -179,7 +179,7 @@ void Quests::execute() { // Key handling _buttonValue = 0; - while (!_vm->shouldQuit() && !_buttonValue) { + while (!_vm->shouldExit() && !_buttonValue) { events.pollEventsAndWait(); checkEvents(_vm); } diff --git a/engines/xeen/dialogs_quick_ref.cpp b/engines/xeen/dialogs_quick_ref.cpp index 9254aa21f2..afc06966dd 100644 --- a/engines/xeen/dialogs_quick_ref.cpp +++ b/engines/xeen/dialogs_quick_ref.cpp @@ -77,7 +77,7 @@ void QuickReferenceDialog::execute() { // Wait for a key/mouse press events.clearEvents(); - while (!_vm->shouldQuit() && !events.isKeyMousePressed()) + while (!_vm->shouldExit() && !events.isKeyMousePressed()) events.pollEventsAndWait(); events.clearEvents(); diff --git a/engines/xeen/dialogs_spells.cpp b/engines/xeen/dialogs_spells.cpp index e00fa13e57..cd31d5b3be 100644 --- a/engines/xeen/dialogs_spells.cpp +++ b/engines/xeen/dialogs_spells.cpp @@ -118,7 +118,7 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int do { events.pollEventsAndWait(); checkEvents(_vm); - } while (!_vm->shouldQuit() && !_buttonValue); + } while (!_vm->shouldExit() && !_buttonValue); switch (_buttonValue) { case Common::KEYCODE_F1: @@ -271,11 +271,11 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int ++topIndex; break; } - } while (!_vm->shouldQuit() && _buttonValue != Common::KEYCODE_ESCAPE); + } while (!_vm->shouldExit() && _buttonValue != Common::KEYCODE_ESCAPE); windows[25].close(); - if (_vm->shouldQuit()) + if (_vm->shouldExit()) selection = -1; if (isCasting && selection != -1) c->_currentSpell = _spells[selection]._spellIndex; @@ -491,7 +491,7 @@ int CastSpell::show(XeenEngine *vm, Character *&c) { do { spellId = dlg->execute(c); - if (g_vm->shouldQuit() || spellId == -1) { + if (g_vm->shouldExit() || spellId == -1) { result = 0; } else { result = spells.castSpell(c, (MagicSpell)spellId); @@ -536,7 +536,7 @@ int CastSpell::execute(Character *&c) { do { events.pollEventsAndWait(); checkEvents(_vm); - } while (!_vm->shouldQuit() && events.timeElapsed() < 1 && !_buttonValue); + } while (!_vm->shouldExit() && events.timeElapsed() < 1 && !_buttonValue); switch (_buttonValue) { case Common::KEYCODE_F1: @@ -579,9 +579,9 @@ int CastSpell::execute(Character *&c) { default: break; } - } while (!_vm->shouldQuit() && _buttonValue != Common::KEYCODE_ESCAPE); + } while (!_vm->shouldExit() && _buttonValue != Common::KEYCODE_ESCAPE); - if (_vm->shouldQuit()) + if (_vm->shouldExit()) spellId = -1; return spellId; } @@ -634,7 +634,7 @@ int SpellOnWho::execute(int spellId) { do { events.pollEventsAndWait(); - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return -1; checkEvents(_vm); @@ -706,7 +706,7 @@ int SelectElement::execute(int spellId) { do { events.pollEventsAndWait(); - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return -1; checkEvents(_vm); @@ -770,7 +770,7 @@ void NotWhileEngaged::execute(int spellId) { spells._spellNames[spellId].c_str())); w.update(); - while (!_vm->shouldQuit() && !events.isKeyMousePressed()) + while (!_vm->shouldExit() && !events.isKeyMousePressed()) events.pollEventsAndWait(); events.clearEvents(); @@ -838,7 +838,7 @@ bool LloydsBeacon::execute() { do { events.pollEventsAndWait(); - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return true; checkEvents(_vm); diff --git a/engines/xeen/dialogs_whowill.cpp b/engines/xeen/dialogs_whowill.cpp index a2be4e3a94..1e32007d7f 100644 --- a/engines/xeen/dialogs_whowill.cpp +++ b/engines/xeen/dialogs_whowill.cpp @@ -62,7 +62,7 @@ int WhoWill::execute(int message, int action, bool type) { intf._face1State = map._headData[party._mazePosition.y][party._mazePosition.x]._left; intf._face2State = map._headData[party._mazePosition.y][party._mazePosition.x]._right; - while (!_vm->shouldQuit()) { + while (!_vm->shouldExit()) { events.updateGameCounter(); if (windows[11]._enabled) { diff --git a/engines/xeen/events.cpp b/engines/xeen/events.cpp index bec5b6bd51..6ceef4406b 100644 --- a/engines/xeen/events.cpp +++ b/engines/xeen/events.cpp @@ -116,7 +116,7 @@ void EventsManager::clearEvents() { } void EventsManager::debounceMouse() { - while (_leftButton && !_vm->shouldQuit()) { + while (_leftButton && !_vm->shouldExit()) { pollEventsAndWait(); } } @@ -142,13 +142,13 @@ bool EventsManager::isKeyMousePressed() { } bool EventsManager::wait(uint numFrames, bool interruptable) { - while (!_vm->shouldQuit() && timeElapsed() < numFrames) { + while (!_vm->shouldExit() && timeElapsed() < numFrames) { pollEventsAndWait(); if (interruptable && (_leftButton || _rightButton || isKeyPending())) return true; } - return _vm->shouldQuit(); + return _vm->shouldExit(); } void EventsManager::ipause(uint amount) { @@ -156,13 +156,13 @@ void EventsManager::ipause(uint amount) { do { _vm->_interface->draw3d(true); pollEventsAndWait(); - } while (!_vm->shouldQuit() && timeElapsed() < amount); + } while (!_vm->shouldExit() && timeElapsed() < amount); } void EventsManager::ipause5(uint amount) { do { pollEventsAndWait(); - } while (!_vm->shouldQuit() && timeElapsed5() < amount); + } while (!_vm->shouldExit() && timeElapsed5() < amount); } void EventsManager::waitForPressAnimated() { @@ -172,9 +172,9 @@ void EventsManager::waitForPressAnimated() { updateGameCounter(); _vm->_interface->draw3d(true); - while (!_vm->shouldQuit() && timeElapsed() == 0) + while (!_vm->shouldExit() && timeElapsed() == 0) pollEventsAndWait(); - } while (!_vm->shouldQuit() && !isKeyMousePressed()); + } while (!_vm->shouldExit() && !isKeyMousePressed()); clearEvents(); } @@ -184,7 +184,7 @@ void EventsManager::waitForPress() { do { pollEventsAndWait(); - } while (!_vm->shouldQuit() && !isKeyMousePressed()); + } while (!_vm->shouldExit() && !isKeyMousePressed()); clearEvents(); } diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp index 456a7879b4..b3508693d8 100644 --- a/engines/xeen/interface.cpp +++ b/engines/xeen/interface.cpp @@ -306,7 +306,7 @@ void Interface::perform() { } if (eventsFlag) { scripts.checkEvents(); - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return; } } @@ -316,7 +316,7 @@ void Interface::perform() { // Show control panel combat._moveMonsters = false; ControlPanel::show(_vm); - if (!g_vm->shouldQuit() && !g_vm->_quitMode) + if (!g_vm->shouldExit() && !g_vm->_quitMode) combat._moveMonsters = true; break; @@ -1056,19 +1056,19 @@ void Interface::rest() { screen.fadeIn(); events.updateGameCounter(); - while (!_vm->shouldQuit() && events.timeElapsed() < 7) + while (!_vm->shouldExit() && events.timeElapsed() < 7) events.pollEventsAndWait(); sound.playSound("dreams2.voc", 1); - while (!_vm->shouldQuit() && sound.isPlaying()) + while (!_vm->shouldExit() && sound.isPlaying()) events.pollEventsAndWait(); sound.playSound("laff1.voc", 1); - while (!_vm->shouldQuit() && sound.isPlaying()) + while (!_vm->shouldExit() && sound.isPlaying()) events.pollEventsAndWait(); events.updateGameCounter(); - while (!_vm->shouldQuit() && events.timeElapsed() < 7) + while (!_vm->shouldExit() && events.timeElapsed() < 7) events.pollEventsAndWait(); screen.fadeOut(); @@ -1525,7 +1525,7 @@ void Interface::doCombat() { w.open(); bool breakFlag = false; - while (!_vm->shouldQuit() && !breakFlag) { + while (!_vm->shouldExit() && !breakFlag) { highlightChar(combat._whosTurn); combat.setSpeedTable(); @@ -1550,9 +1550,9 @@ void Interface::doCombat() { do { events.pollEventsAndWait(); checkEvents(_vm); - } while (!_vm->shouldQuit() && events.timeElapsed() < 1 && !_buttonValue); - } while (!_vm->shouldQuit() && !_buttonValue); - if (_vm->shouldQuit()) + } while (!_vm->shouldExit() && events.timeElapsed() < 1 && !_buttonValue); + } while (!_vm->shouldExit() && !_buttonValue); + if (_vm->shouldExit()) return; switch (_buttonValue) { diff --git a/engines/xeen/locations.cpp b/engines/xeen/locations.cpp index 7a7fedee7d..db04aae97d 100644 --- a/engines/xeen/locations.cpp +++ b/engines/xeen/locations.cpp @@ -86,7 +86,7 @@ int BaseLocation::show() { do { wait(); charP = doOptions(charP); - if (_vm->shouldQuit() || _exitToUi) + if (_vm->shouldExit() || _exitToUi) return 0; Common::String msg = createLocationText(*charP); @@ -279,9 +279,9 @@ int BaseLocation::wait() { Windows &windows = *g_vm->_windows; _buttonValue = 0; - while (!_vm->shouldQuit() && !_buttonValue) { + while (!_vm->shouldExit() && !_buttonValue) { events.updateGameCounter(); - while (!_vm->shouldQuit() && !_buttonValue && events.timeElapsed() < 3) { + while (!_vm->shouldExit() && !_buttonValue && events.timeElapsed() < 3) { events.pollEventsAndWait(); checkEvents(_vm); } @@ -424,7 +424,7 @@ void BankLocation::depositWithdrawl(PartyBank whereId) { windows[35].writeString(msg); windows[35].update(); } - } while (!g_vm->shouldQuit() && _buttonValue != Common::KEYCODE_ESCAPE); + } while (!g_vm->shouldExit() && _buttonValue != Common::KEYCODE_ESCAPE); for (uint idx = 0; idx < _buttons.size(); ++idx) _buttons[idx]._sprites = &_icons1; @@ -1171,14 +1171,14 @@ int ArenaLocation::show() { do { LocationMessage::show(27, Res.WARZONE_BATTLE_MASTER, Res.WARZONE_LEVEL, 2); level = NumericInput::show(g_vm, 11, 2, 200); - } while (!g_vm->shouldQuit() && level > 10); + } while (!g_vm->shouldExit() && level > 10); if (level == 0) goto exit; do { LocationMessage::show(27, Res.WARZONE_BATTLE_MASTER, Res.WARZONE_HOW_MANY, 2); howMany = NumericInput::show(g_vm, 11, 2, 200); - } while (!g_vm->shouldQuit() && howMany > 20); + } while (!g_vm->shouldExit() && howMany > 20); if (howMany == 0) goto exit; @@ -1298,7 +1298,7 @@ int ReaperCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } @@ -1313,7 +1313,7 @@ int ReaperCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } } else { @@ -1324,7 +1324,7 @@ int ReaperCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } } @@ -1353,7 +1353,7 @@ int ReaperCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } while (sound.isPlaying() || _subtitleCtr); @@ -1384,9 +1384,9 @@ int ReaperCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; - } while (!g_vm->shouldQuit() && sound.isPlaying()); + } while (!g_vm->shouldExit() && sound.isPlaying()); sprites2.draw(0, 0, Common::Point(0, 0)); if (_isDarkCc) @@ -1411,7 +1411,7 @@ int ReaperCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } @@ -1591,7 +1591,7 @@ int GolemCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } @@ -1614,7 +1614,7 @@ int GolemCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } @@ -1631,7 +1631,7 @@ int GolemCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } sound.setMusicVolume(48); @@ -1657,7 +1657,7 @@ int GolemCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } while (sound.isPlaying() || _subtitleCtr); @@ -1674,7 +1674,7 @@ int GolemCutscene::show() { if (!_isDarkCc) { sound.playSound("ogre.voc"); - while (!g_vm->shouldQuit() && sound.isPlaying()) + while (!g_vm->shouldExit() && sound.isPlaying()) events.pollEventsAndWait(); sound.playSound(_mazeFlag ? "golem16.voc" : "golem14.voc"); @@ -1702,9 +1702,9 @@ int GolemCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; - } while (!g_vm->shouldQuit() && sound.isPlaying()); + } while (!g_vm->shouldExit() && sound.isPlaying()); sprites1.draw(0, 0, Common::Point(0, 0)); sprites1.draw(0, 1, Common::Point(160, 0)); @@ -1714,18 +1714,18 @@ int GolemCutscene::show() { sprites2[0].draw(0, 2); windows[0].update(); - while (!g_vm->shouldQuit() && sound.isPlaying()) { + while (!g_vm->shouldExit() && sound.isPlaying()) { events.updateGameCounter(); events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } sound.setMusicVolume(95); if (!_mazeFlag) { - for (int idx = 0; !g_vm->shouldQuit() && idx < (_isDarkCc ? 9 : 12); ++idx) { + for (int idx = 0; !g_vm->shouldExit() && idx < (_isDarkCc ? 9 : 12); ++idx) { events.updateGameCounter(); screen.blitFrom(savedBg); sprites1.draw(0, 0, @@ -1737,7 +1737,7 @@ int GolemCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } } @@ -1911,14 +1911,14 @@ int DwarfCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } // Have character rise up from the bottom of the screen savedBg.copyFrom(screen); for (int idx = 15; idx >= 0; --idx) { - if (g_vm->shouldQuit()) + if (g_vm->shouldExit()) return 0; events.updateGameCounter(); @@ -1928,7 +1928,7 @@ int DwarfCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } @@ -1950,7 +1950,7 @@ int DwarfCutscene::show() { updateSubtitles(); events.timeMark5(); - while (!g_vm->shouldQuit() && events.timeElapsed5() < 7) + while (!g_vm->shouldExit() && events.timeElapsed5() < 7) events.pollEventsAndWait(); sound.playSound(_mazeFlag ? "ok2.voc" : "back2.voc"); @@ -1974,12 +1974,12 @@ int DwarfCutscene::show() { while (events.timeElapsed5() < 2) { events.pollEventsAndWait(); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } } while (sound.isPlaying() || _subtitleCtr); - while (!g_vm->shouldQuit() && events.timeElapsed() < 3) + while (!g_vm->shouldExit() && events.timeElapsed() < 3) events.pollEventsAndWait(); } @@ -2129,7 +2129,7 @@ int SphinxCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } @@ -2157,7 +2157,7 @@ int SphinxCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } while (sound.isPlaying() || _subtitleCtr); @@ -2177,7 +2177,7 @@ int SphinxCutscene::show() { events.wait(1); checkEvents(g_vm); - if (g_vm->shouldQuit() || _buttonValue) + if (g_vm->shouldExit() || _buttonValue) goto exit; } @@ -2435,7 +2435,7 @@ bool LocationMessage::execute(int portrait, const Common::String &name, const Co events.pollEventsAndWait(); checkEvents(_vm); - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return false; while (events.timeElapsed() >= 3) { diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp index 849abfb850..2ef7ad7053 100644 --- a/engines/xeen/party.cpp +++ b/engines/xeen/party.cpp @@ -667,7 +667,7 @@ void Party::giveTreasure() { while (!events.isKeyMousePressed() && events.timeElapsed() < 1) events.pollEventsAndWait(); - } while (!_vm->shouldQuit() && events.timeElapsed() == 1); + } while (!_vm->shouldExit() && events.timeElapsed() == 1); if (_vm->_mode != MODE_COMBAT) _vm->_mode = MODE_1; diff --git a/engines/xeen/screen.cpp b/engines/xeen/screen.cpp index 1561c82488..98421dd5bb 100644 --- a/engines/xeen/screen.cpp +++ b/engines/xeen/screen.cpp @@ -125,7 +125,7 @@ void Screen::fadeOut(int step) { } void Screen::fadeInner(int step) { - for (int idx = 128; idx >= 0 && !_vm->shouldQuit(); idx -= step) { + for (int idx = 128; idx >= 0 && !_vm->shouldExit(); idx -= step) { int val = MAX(idx, 0); bool flag = !_fadeIn; if (!flag) { diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index 35f28bbf73..51c22dd6db 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -172,7 +172,7 @@ int Scripts::checkEvents() { _nEdamageType = DT_PHYSICAL; // int var40 = -1; - while (!_vm->shouldQuit() && _lineNum >= 0) { + while (!_vm->shouldExit() && _lineNum >= 0) { // Break out of the events if there's an attacking monster if (combat._attackMonsters[0] != -1) { _eventSkipped = true; @@ -181,7 +181,7 @@ int Scripts::checkEvents() { _eventSkipped = false; uint eventIndex; - for (eventIndex = 0; eventIndex < map._events.size() && !_vm->shouldQuit(); ++eventIndex) { + for (eventIndex = 0; eventIndex < map._events.size() && !_vm->shouldExit(); ++eventIndex) { MazeEvent &event = map._events[eventIndex]; if (event._position == _currentPos && party._mazeDirection != @@ -199,7 +199,7 @@ int Scripts::checkEvents() { if (eventIndex == map._events.size()) _lineNum = -1; } - } while (!_vm->shouldQuit() && !_eventSkipped && _lineNum != -1); + } while (!_vm->shouldExit() && !_eventSkipped && _lineNum != -1); intf._face1State = intf._face2State = 2; if (_refreshIcons) { @@ -1866,7 +1866,7 @@ void Scripts::display(bool justifyFlag, int var46) { if (!w._enabled) w.open(); - while (!_vm->shouldQuit()) { + while (!_vm->shouldExit()) { const char *newPos = w.writeString(_displayMessage); w.update(); @@ -1885,7 +1885,7 @@ void Scripts::display(bool justifyFlag, int var46) { intf.draw3d(true); events.wait(1); - } while (!_vm->shouldQuit() && !events.isKeyMousePressed()); + } while (!_vm->shouldExit() && !events.isKeyMousePressed()); w.writeString(justifyFlag ? "\r" : "\r\x3""c"); } diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.cpp b/engines/xeen/worldofxeen/darkside_cutscenes.cpp index d9cf3e1287..0e97d8cd93 100644 --- a/engines/xeen/worldofxeen/darkside_cutscenes.cpp +++ b/engines/xeen/worldofxeen/darkside_cutscenes.cpp @@ -70,7 +70,7 @@ bool DarkSideCutscenes::showDarkSideTitle() { // Initial loop for dragon roaring int nwcIndex = 0, nwcFrame = 0; - for (int idx = 0; idx < 55 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 55 && !_vm->shouldExit(); ++idx) { // Render the next frame screen.vertMerge(0); nwc[nwcIndex].draw(0, nwcFrame); @@ -96,7 +96,7 @@ bool DarkSideCutscenes::showDarkSideTitle() { } // Loop for dragon using flyspray - for (int idx = 0; idx < 42 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 42 && !_vm->shouldExit(); ++idx) { screen.vertMerge(SCREEN_HEIGHT); nwc[3].draw(0, idx); screen.draw(); @@ -124,7 +124,7 @@ bool DarkSideCutscenes::showDarkSideTitle() { WAIT(2); } - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return false; // Pause for a bit @@ -449,7 +449,7 @@ bool DarkSideCutscenes::showDarkSideEnding() { // Play landing thud sound.playSound("thud.voc"); - while (!_vm->shouldQuit() && !events.isKeyMousePressed() + while (!_vm->shouldExit() && !events.isKeyMousePressed() && sound.isPlaying()) { events.pollEventsAndWait(); } @@ -1051,7 +1051,7 @@ bool DarkSideCutscenes::showDarkSideEnding() { screen.loadBackground("sc270001.raw"); screen.saveBackground(); - while (sound.isPlaying() && !_vm->shouldQuit()) { + while (sound.isPlaying() && !_vm->shouldExit()) { events.pollEventsAndWait(); if (events.isKeyMousePressed()) return false; @@ -1201,7 +1201,7 @@ void DarkSideCutscenes::showPharaohEndText(const char *msg1, const char *msg2, c // Iterate through showing the pages int idx = 1; - for (int pageNum = 0; !_vm->shouldQuit() && pageNum < numPages; ++pageNum) { + for (int pageNum = 0; !_vm->shouldExit() && pageNum < numPages; ++pageNum) { // Show each page until a key is pressed do { // Draw the dragon pharoah @@ -1224,7 +1224,7 @@ void DarkSideCutscenes::showPharaohEndText(const char *msg1, const char *msg2, c windows[0].update(); events.wait(3); idx = (idx + 1) % 32; - } while (!_vm->shouldQuit() && !events.isKeyMousePressed()); + } while (!_vm->shouldExit() && !events.isKeyMousePressed()); events.clearEvents(); } diff --git a/engines/xeen/worldofxeen/worldofxeen.cpp b/engines/xeen/worldofxeen/worldofxeen.cpp index 48ecafd89b..dcb87197f3 100644 --- a/engines/xeen/worldofxeen/worldofxeen.cpp +++ b/engines/xeen/worldofxeen/worldofxeen.cpp @@ -46,6 +46,7 @@ void WorldOfXeenEngine::outerGameLoop() { while (!shouldQuit() && _pendingAction != WOX_QUIT) { WOXGameAction action = _pendingAction; _pendingAction = WOX_MENU; + _quitMode = QMODE_NONE; switch (action) { case WOX_CLOUDS_INTRO: diff --git a/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp b/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp index 19b5c2a07a..3ac3962f69 100644 --- a/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp +++ b/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp @@ -32,11 +32,11 @@ void WorldOfXeenCutscenes::showWorldOfXeenEnding(GooberState state, uint score) _finalScore = score; worldEnding1(); - if (!_vm->shouldQuit()) + if (!_vm->shouldExit()) worldEnding2(); - if (!_vm->shouldQuit()) + if (!_vm->shouldExit()) worldEnding3(); - if (!_vm->shouldQuit()) + if (!_vm->shouldExit()) worldEnding4(); } @@ -78,7 +78,7 @@ void WorldOfXeenCutscenes::worldEnding1() { windows[41].writeString("\x1\xD"); screen.fadeOut(); - while (!_vm->shouldQuit() && sound.isPlaying()) + while (!_vm->shouldExit() && sound.isPlaying()) events.pollEventsAndWait(); sound.playSong("nwblksmt.m"); @@ -90,7 +90,7 @@ void WorldOfXeenCutscenes::worldEnding1() { events.updateGameCounter(); events.wait(60); - for (int idx = 0; idx < 50 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 50 && !_vm->shouldExit(); ++idx) { if (idx == 9 || idx == 22 || idx == 33 || idx == 44) sound.playSound("whoosh.voc"); @@ -103,7 +103,7 @@ void WorldOfXeenCutscenes::worldEnding1() { events.wait(2); } - for (int idx = 0; idx < 40 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 40 && !_vm->shouldExit(); ++idx) { screen.horizMerge(); events.updateGameCounter(); tower1.draw(0, 0, Common::Point(0, 0), SPRFLAG_800); @@ -114,7 +114,7 @@ void WorldOfXeenCutscenes::worldEnding1() { } int frame = 40, frame2 = 0; - for (int idx = 0, xp = 0; idx < SCREEN_WIDTH && !_vm->shouldQuit(); ++idx) { + for (int idx = 0, xp = 0; idx < SCREEN_WIDTH && !_vm->shouldExit(); ++idx) { events.updateGameCounter(); screen.horizMerge(xp); tower1.draw(0, 0, Common::Point(idx, 0), SPRFLAG_800); @@ -136,7 +136,7 @@ void WorldOfXeenCutscenes::worldEnding1() { events.wait(2); } - for (; frame2 < 60 && !_vm->shouldQuit(); ++frame2) { + for (; frame2 < 60 && !_vm->shouldExit(); ++frame2) { events.updateGameCounter(); screen.horizMerge(frame); tower2.draw(0, 0, Common::Point(0, 0), SPRFLAG_800); @@ -148,7 +148,7 @@ void WorldOfXeenCutscenes::worldEnding1() { events.wait(2); } - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return; screen.freePages(); screen.fadeOut(); @@ -159,14 +159,14 @@ void WorldOfXeenCutscenes::worldEnding1() { w0.update(); screen.fadeIn(); - for (int idx = 0; idx < 26 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 26 && !_vm->shouldExit(); ++idx) { events.updateGameCounter(); screen.blitFrom(savedBg); sc06.draw(0, idx, Common::Point(26, 75)); events.wait(2); } - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return; screen.fadeOut(); screen.loadBackground("eg140001.raw"); @@ -175,8 +175,8 @@ void WorldOfXeenCutscenes::worldEnding1() { setSubtitle(Res.WORLD_END_TEXT[3]); screen.fadeIn(); - for (int idx1 = 0; idx1 < 2 && !_vm->shouldQuit(); ++idx1) { - for (int idx2 = 0; idx2 < 15 && !_vm->shouldQuit(); ++idx2) { + for (int idx1 = 0; idx1 < 2 && !_vm->shouldExit(); ++idx1) { + for (int idx2 = 0; idx2 < 15 && !_vm->shouldExit(); ++idx2) { events.updateGameCounter(); screen.blitFrom(savedBg); sc14.draw(0, idx2, Common::Point(141, 63)); @@ -191,8 +191,8 @@ void WorldOfXeenCutscenes::worldEnding1() { screen.loadPage(0); savedBg.blitFrom(screen); - for (int idx1 = 0; idx1 < 2 && !_vm->shouldQuit(); ++idx1) { - for (int idx2 = 0; idx2 < 6 && !_vm->shouldQuit(); ++idx2) { + for (int idx1 = 0; idx1 < 2 && !_vm->shouldExit(); ++idx1) { + for (int idx2 = 0; idx2 < 6 && !_vm->shouldExit(); ++idx2) { events.updateGameCounter(); screen.blitFrom(savedBg); sc14.draw(0, idx2, Common::Point(26, 21)); @@ -210,7 +210,7 @@ void WorldOfXeenCutscenes::worldEnding1() { w0.update(); frame = 0; - for (int idx = 185; idx > 68 && !_vm->shouldQuit(); idx -= 3) { + for (int idx = 185; idx > 68 && !_vm->shouldExit(); idx -= 3) { if (!sound.isPlaying()) sound.playSound("cast.voc"); @@ -225,7 +225,7 @@ void WorldOfXeenCutscenes::worldEnding1() { frame = (frame + 1) % 17; } - for (int idx = 0; idx < 17 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 17 && !_vm->shouldExit(); ++idx) { if (!sound.isPlaying()) sound.playSound("cast.voc"); @@ -239,7 +239,7 @@ void WorldOfXeenCutscenes::worldEnding1() { events.wait(2); } - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return; screen.blitFrom(savedBg); sc17.draw(0, 0, Common::Point(33, 68), SPRFLAG_4000); @@ -252,8 +252,8 @@ void WorldOfXeenCutscenes::worldEnding1() { w0.update(); screen.fadeIn(); - for (int idx1 = 0; idx1 < 2 && !_vm->shouldQuit(); ++idx1) { - for (int idx2 = 0; idx2 < 15 && !_vm->shouldQuit(); ++idx2) { + for (int idx1 = 0; idx1 < 2 && !_vm->shouldExit(); ++idx1) { + for (int idx2 = 0; idx2 < 15 && !_vm->shouldExit(); ++idx2) { events.updateGameCounter(); screen.blitFrom(savedBg); sc14.draw(0, idx2, Common::Point(141, 63)); @@ -266,8 +266,8 @@ void WorldOfXeenCutscenes::worldEnding1() { screen.horizMerge(0); savedBg.blitFrom(screen); - for (int idx1 = 0; idx1 < 3 && !_vm->shouldQuit(); ++idx1) { - for (int idx2 = 0; idx2 < 15 && !_vm->shouldQuit(); ++idx2) { + for (int idx1 = 0; idx1 < 3 && !_vm->shouldExit(); ++idx1) { + for (int idx2 = 0; idx2 < 15 && !_vm->shouldExit(); ++idx2) { events.updateGameCounter(); screen.blitFrom(savedBg); sc10.draw(0, idx2, Common::Point(26, 21)); @@ -282,7 +282,7 @@ void WorldOfXeenCutscenes::worldEnding1() { setSubtitle(Res.WORLD_END_TEXT[5]); w0.update(); - for (int idx = 185; idx > 13 && !_vm->shouldQuit(); idx -= 6) { + for (int idx = 185; idx > 13 && !_vm->shouldExit(); idx -= 6) { events.updateGameCounter(); screen.blitFrom(savedBg); staff.draw(0, 0, Common::Point(196, idx), SPRFLAG_4000); @@ -294,7 +294,7 @@ void WorldOfXeenCutscenes::worldEnding1() { events.updateGameCounter(); events.wait(30); - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return; screen.fadeOut(); @@ -303,8 +303,8 @@ void WorldOfXeenCutscenes::worldEnding1() { w0.update(); screen.fadeIn(); - for (int idx1 = 0; idx1 < 2 && !_vm->shouldQuit(); ++idx1) { - for (int idx2 = 0; idx2 < 15 && !_vm->shouldQuit(); ++idx2) { + for (int idx1 = 0; idx1 < 2 && !_vm->shouldExit(); ++idx1) { + for (int idx2 = 0; idx2 < 15 && !_vm->shouldExit(); ++idx2) { events.updateGameCounter(); screen.blitFrom(savedBg); sc14.draw(0, idx2, Common::Point(141, 63)); @@ -314,7 +314,7 @@ void WorldOfXeenCutscenes::worldEnding1() { } } - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return; screen.loadBackground("tablmain.raw"); savedBg.blitFrom(screen); @@ -325,7 +325,7 @@ void WorldOfXeenCutscenes::worldEnding1() { w0.update(); sound.playSound("cast.voc"); - for (int idx = 0; idx < 5 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 5 && !_vm->shouldExit(); ++idx) { if (!sound.isPlaying()) sound.playSound("cast.voc"); @@ -341,7 +341,7 @@ void WorldOfXeenCutscenes::worldEnding1() { } frame = 0; - for (int idx = 0; idx < 16 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 16 && !_vm->shouldExit(); ++idx) { if (!sound.isPlaying()) sound.playSound("cast.voc"); @@ -358,7 +358,7 @@ void WorldOfXeenCutscenes::worldEnding1() { } frame = 0; - for (int idx = 11; idx < 82 && !_vm->shouldQuit(); ++idx) { + for (int idx = 11; idx < 82 && !_vm->shouldExit(); ++idx) { if (!sound.isPlaying()) sound.playSound("cast.voc"); @@ -374,13 +374,13 @@ void WorldOfXeenCutscenes::worldEnding1() { } sound.stopSound(); - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return; sound.playSound("click.voc"); sound.playSound("padspell.voc"); - for (int idx = 0; idx < 14 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 14 && !_vm->shouldExit(); ++idx) { if (idx == 10) sound.playSound("padspell.voc"); @@ -393,7 +393,7 @@ void WorldOfXeenCutscenes::worldEnding1() { events.wait(2); } - for (int idx = 0; idx < 17 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 17 && !_vm->shouldExit(); ++idx) { if (idx == 10) sound.playSound("padspell.voc"); @@ -406,7 +406,7 @@ void WorldOfXeenCutscenes::worldEnding1() { events.wait(3); } - for (int idx = 0; idx < 6 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 6 && !_vm->shouldExit(); ++idx) { events.updateGameCounter(); screen.blitFrom(savedBg); sc20[3].draw(0, idx, Common::Point(26, 55)); @@ -416,7 +416,7 @@ void WorldOfXeenCutscenes::worldEnding1() { events.wait(4); } - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return; screen.blitFrom(savedBg); setSubtitle(Res.WORLD_END_TEXT[6]); @@ -428,7 +428,7 @@ void WorldOfXeenCutscenes::worldEnding1() { savedBg.blitFrom(screen); screen.freePages(); - for (int idx = 0; idx < 35 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 35 && !_vm->shouldExit(); ++idx) { if (idx == 3) sound.playSound("click.voc"); else if (idx == 5 || idx == 15) @@ -470,7 +470,7 @@ void WorldOfXeenCutscenes::worldEnding2() { screen.fadeIn(); int frame = 0; - for (int idx = 0; idx < 61 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 61 && !_vm->shouldExit(); ++idx) { if (idx == 2 || idx == 15 || idx == 25 || idx == 33 || idx == 41) sound.playSound("gascompr.voc"); @@ -502,7 +502,7 @@ void WorldOfXeenCutscenes::worldEnding3() { screen.fadeIn(); sound.playSound("comet.voc"); - for (int idx = 0; idx < 52 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 52 && !_vm->shouldExit(); ++idx) { if (idx == 28) sound.playSound("click.voc"); if (!sound.isPlaying()) @@ -525,7 +525,7 @@ void WorldOfXeenCutscenes::worldEnding3() { screen.fadeIn(0x81); int frame1 = 0, frame2 = 0, frame3 = 0, ctr = 0; - for (int idx = 0; idx < 78 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 78 && !_vm->shouldExit(); ++idx) { events.updateGameCounter(); sc261[ctr / 14].draw(0, idx % 17, Common::Point(7, 4)); sc262.draw(0, frame1, Common::Point(86, 4)); @@ -586,7 +586,7 @@ void WorldOfXeenCutscenes::worldEnding4() { screen.loadPalette("eg250001.pal"); screen.fadeIn(); - for (int idx = 0; idx < 89 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 89 && !_vm->shouldExit(); ++idx) { if (!sound.isPlaying()) sound.playSound("comet.voc"); if (idx == 19 || idx == 60) @@ -598,7 +598,7 @@ void WorldOfXeenCutscenes::worldEnding4() { events.wait(2); } - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return; sound.stopSound(); screen.fadeOut(); @@ -608,7 +608,7 @@ void WorldOfXeenCutscenes::worldEnding4() { w0.update(); screen.fadeIn(); - for (int idx = 0; idx < 138 && !_vm->shouldQuit(); ++idx) { + for (int idx = 0; idx < 138 && !_vm->shouldExit(); ++idx) { if (!sound.isPlaying() && idx > 98) sound.playSound("rumble.voc"); @@ -620,7 +620,7 @@ void WorldOfXeenCutscenes::worldEnding4() { } sound.stopSound(); - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return; screen.loadPalette("white.pal"); @@ -628,14 +628,14 @@ void WorldOfXeenCutscenes::worldEnding4() { sound.playSound("explosio.voc"); events.updateGameCounter(); events.wait(10); - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return; screen.loadPalette("eg250001.pal"); screen.fadeOut(); - for (int idx1 = 0; idx1 < 20 && !_vm->shouldQuit(); ++idx1) { - for (int idx2 = 0; idx2 < 4 && !_vm->shouldQuit(); ++idx2) { + for (int idx1 = 0; idx1 < 20 && !_vm->shouldExit(); ++idx1) { + for (int idx2 = 0; idx2 < 4 && !_vm->shouldExit(); ++idx2) { sc30.draw(0, idx2); setSubtitle2(Res.WORLD_END_TEXT[8]); w0.update(); @@ -648,11 +648,11 @@ void WorldOfXeenCutscenes::worldEnding4() { } screen.fadeOut(); - while (sound.isMusicPlaying() && !_vm->shouldQuit()) { + while (sound.isMusicPlaying() && !_vm->shouldExit()) { events.updateGameCounter(); events.wait(2); } - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return; sound.playSong("outday3.m"); diff --git a/engines/xeen/worldofxeen/worldofxeen_menu.cpp b/engines/xeen/worldofxeen/worldofxeen_menu.cpp index 90d362910e..dad16ec89d 100644 --- a/engines/xeen/worldofxeen/worldofxeen_menu.cpp +++ b/engines/xeen/worldofxeen/worldofxeen_menu.cpp @@ -66,7 +66,7 @@ void WorldOfXeenMenu::execute() { SpriteResource title1Sprites(title1), title2Sprites(title2); bool firstTime = true, doFade = true; - while (!_vm->shouldQuit()) { + while (!_vm->shouldExit()) { setBackground(doFade); if (firstTime) { @@ -82,11 +82,11 @@ void WorldOfXeenMenu::execute() { setupButtons(&title2Sprites); openWindow(); - while (!_vm->shouldQuit()) { + while (!_vm->shouldExit()) { // Show the dialog with a continually animating background - while (!_vm->shouldQuit() && !_buttonValue) + while (!_vm->shouldExit() && !_buttonValue) showContents(title1Sprites, true); - if (_vm->shouldQuit()) + if (_vm->shouldExit()) return; // Handle keypress @@ -117,7 +117,7 @@ void WorldOfXeenMenu::showTitles1(SpriteResource &sprites) { EventsManager &events = *_vm->_events; int frameNum = 0; - while (!_vm->shouldQuit() && !events.isKeyMousePressed()) { + while (!_vm->shouldExit() && !events.isKeyMousePressed()) { events.updateGameCounter(); frameNum = (frameNum + 1) % (_vm->getGameID() == GType_WorldOfXeen ? 5 : 10); @@ -147,7 +147,7 @@ void WorldOfXeenMenu::showTitles2() { screen.saveBackground(); sound.playSound("elect.voc"); - for (int i = 0; i < 30 && !_vm->shouldQuit(); ++i) { + for (int i = 0; i < 30 && !_vm->shouldExit(); ++i) { events.updateGameCounter(); screen.restoreBackground(); title2Sprites[i / 4].draw(0, i % 4); @@ -156,7 +156,7 @@ void WorldOfXeenMenu::showTitles2() { if (i == 19) sound.stopSound(); - while (!_vm->shouldQuit() && events.timeElapsed() < 2) + while (!_vm->shouldExit() && events.timeElapsed() < 2) events.pollEventsAndWait(); } @@ -239,7 +239,7 @@ void WorldOptionsMenu::showContents(SpriteResource &title1, bool waitFlag) { screen.update(); if (waitFlag) { - while (!_vm->shouldQuit() && !_buttonValue && events.timeElapsed() < 3) { + while (!_vm->shouldExit() && !_buttonValue && events.timeElapsed() < 3) { events.pollEventsAndWait(); checkEvents(_vm); } diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 0e2980119c..9c33ab8cb1 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -206,7 +206,7 @@ void XeenEngine::play() { void XeenEngine::gameLoop() { // Main game loop - while (!shouldQuit()) { + while (!shouldExit()) { if (_loadSaveSlot >= 0) { // Load any pending savegame int saveSlot = _loadSaveSlot; @@ -217,7 +217,7 @@ void XeenEngine::gameLoop() { _map->cellFlagLookup(_party->_mazePosition); if (_map->_currentIsEvent) { _quitMode = (QuitMode)_scripts->checkEvents(); - if (shouldQuit() || _quitMode) + if (shouldExit() || _quitMode) return; } _party->giveTreasure(); diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h index a8e6441459..d3a7fedb80 100644 --- a/engines/xeen/xeen.h +++ b/engines/xeen/xeen.h @@ -175,6 +175,11 @@ public: int getRandomNumber(int minNumber, int maxNumber); + /** + * Returns true if the game should be exited (and likely return to game menu) + */ + bool shouldExit() const { return _quitMode != QMODE_NONE || shouldQuit(); } + /** * Load a savegame */ -- cgit v1.2.3