From fd65ea311ae0f1ea0ddfe6c4daa7bbe1a79823f9 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 8 Aug 2008 02:18:17 +0000 Subject: Hopefully allow quiting at any stage AGOS engines games again. svn-id: r33693 --- engines/agos/animation.cpp | 4 ++-- engines/agos/input.cpp | 4 ++-- engines/agos/oracle.cpp | 2 +- engines/agos/saveload.cpp | 20 ++++++++++++-------- engines/agos/script.cpp | 2 +- engines/agos/script_e1.cpp | 8 ++++---- engines/agos/script_e2.cpp | 4 ++-- engines/agos/script_s1.cpp | 2 +- engines/agos/script_ww.cpp | 4 ++-- engines/agos/subroutine.cpp | 2 ++ engines/agos/verb.cpp | 3 +++ engines/agos/window.cpp | 2 +- 12 files changed, 33 insertions(+), 24 deletions(-) diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp index c92f834a3b..3e1b9b0611 100644 --- a/engines/agos/animation.cpp +++ b/engines/agos/animation.cpp @@ -151,7 +151,7 @@ void MoviePlayer::play() { startSound(); - while (_frameNum < _framesCount) + while (_frameNum < _framesCount && !_vm->_quit) handleNextFrame(); closeFile(); @@ -167,7 +167,7 @@ void MoviePlayer::play() { _vm->_system->setPalette(palette, 0, 256); } - _vm->fillBackGroundFromBack(); + _vm->fillBackGroundFromBack(); _vm->_fastFadeOutFlag = true; } diff --git a/engines/agos/input.cpp b/engines/agos/input.cpp index d36549f187..6f4cd09947 100644 --- a/engines/agos/input.cpp +++ b/engines/agos/input.cpp @@ -123,7 +123,7 @@ void AGOSEngine::setup_cond_c_helper() { clearName(); _lastNameOn = last; - for (;;) { + while (!_quit) { _lastHitArea = NULL; _lastHitArea3 = 0; _leftButtonDown = 0; @@ -145,7 +145,7 @@ void AGOSEngine::setup_cond_c_helper() { } delay(100); - } while (_lastHitArea3 == (HitArea *) -1 || _lastHitArea3 == 0); + } while ((_lastHitArea3 == (HitArea *) -1 || _lastHitArea3 == 0) && !_quit); if (_lastHitArea == NULL) { } else if (_lastHitArea->id == 0x7FFB) { diff --git a/engines/agos/oracle.cpp b/engines/agos/oracle.cpp index a113c8e2ea..2d2feb7b9e 100644 --- a/engines/agos/oracle.cpp +++ b/engines/agos/oracle.cpp @@ -459,7 +459,7 @@ void AGOSEngine_Feeble::saveUserGame(int slot) { } windowPutChar(window, 0x7f); - for (;;) { + while (!_quit) { _keyPressed.reset(); delay(1); diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp index 4a5c43e706..9779630d47 100644 --- a/engines/agos/saveload.cpp +++ b/engines/agos/saveload.cpp @@ -279,11 +279,11 @@ restart: name = buf; _saveGameNameLen = 0; - for (;;) { + while (!_quit) { windowPutChar(window, 128); _keyPressed.reset(); - for (;;) { + while (!_quit) { delay(10); if (_keyPressed.ascii && _keyPressed.ascii < 128) { i = _keyPressed.ascii; @@ -443,7 +443,7 @@ void AGOSEngine_Elvira2::userGame(bool load) { name = buf + 192; - for (;;) { + while (!_quit) { windowPutChar(window, 128); _saveLoadEdit = true; @@ -516,7 +516,7 @@ int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) { _keyPressed.reset(); - for (;;) { + while (!_quit) { _lastHitArea = NULL; _lastHitArea3 = NULL; @@ -526,7 +526,7 @@ int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) { return _keyPressed.ascii; } delay(10); - } while (_lastHitArea3 == 0); + } while (_lastHitArea3 == 0 && !_quit); ha = _lastHitArea; if (ha == NULL || ha->id < 200) { @@ -543,6 +543,8 @@ int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) { return ha->id - 200; } } + + return 225; } void AGOSEngine_Simon1::listSaveGames(char *dst) { @@ -706,7 +708,7 @@ restart:; _saveGameNameLen++; } - for (;;) { + while (!_quit) { windowPutChar(window, 127); _saveLoadEdit = true; @@ -785,7 +787,7 @@ int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) { _keyPressed.reset(); - for (;;) { + while (!_quit) { _lastHitArea = NULL; _lastHitArea3 = NULL; @@ -795,7 +797,7 @@ int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) { return _keyPressed.ascii; } delay(10); - } while (_lastHitArea3 == 0); + } while (_lastHitArea3 == 0 && !_quit); ha = _lastHitArea; if (ha == NULL || ha->id < 205) { @@ -824,6 +826,8 @@ int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) { return ha->id - 208; } } + + return 205; } void AGOSEngine::disableFileBoxes() { diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp index 6758aec511..fa132ec26f 100644 --- a/engines/agos/script.cpp +++ b/engines/agos/script.cpp @@ -1012,7 +1012,7 @@ int AGOSEngine::runScript() { executeOpcode(_opcode); } while (getScriptCondition() != flag && !getScriptReturn() && !_quit); - return getScriptReturn(); + return (_quit) ? 1 : getScriptReturn(); } Child *nextSub(Child *sub, int16 key) { diff --git a/engines/agos/script_e1.cpp b/engines/agos/script_e1.cpp index c7e1d6736e..9b572e347b 100644 --- a/engines/agos/script_e1.cpp +++ b/engines/agos/script_e1.cpp @@ -1053,11 +1053,11 @@ uint AGOSEngine::confirmYesOrNo(uint16 x, uint16 y) { ha->priority = 999; ha->window = 0; - for (;;) { + while (!_quit) { _lastHitArea = NULL; _lastHitArea3 = NULL; - for (;;) { + while (!_quit) { if (_lastHitArea3 != 0) break; delay(1); @@ -1102,11 +1102,11 @@ uint AGOSEngine::continueOrQuit() { ha->priority = 999; ha->window = 0; - for (;;) { + while (!_quit) { _lastHitArea = NULL; _lastHitArea3 = NULL; - for (;;) { + while (!_quit) { if (_lastHitArea3 != 0) break; delay(1); diff --git a/engines/agos/script_e2.cpp b/engines/agos/script_e2.cpp index da9afc5a7d..6f6db8efb4 100644 --- a/engines/agos/script_e2.cpp +++ b/engines/agos/script_e2.cpp @@ -370,11 +370,11 @@ void AGOSEngine_Elvira2::oe2_pauseGame() { uint32 pauseTime = getTime(); haltAnimation(); - for (;;) { + while (!_quit) { _lastHitArea = NULL; _lastHitArea3 = NULL; - for (;;) { + while (!_quit) { if (processSpecialKeys() != 0 || _lastHitArea3 != 0) break; delay(1); diff --git a/engines/agos/script_s1.cpp b/engines/agos/script_s1.cpp index 6a0ba4bacf..6183a3fb20 100644 --- a/engines/agos/script_s1.cpp +++ b/engines/agos/script_s1.cpp @@ -339,7 +339,7 @@ void AGOSEngine_Simon1::os1_pauseGame() { break; } - for (;;) { + while (!_quit) { delay(1); if (_keyPressed.keycode == keyYes) _quit = true; diff --git a/engines/agos/script_ww.cpp b/engines/agos/script_ww.cpp index 5fd83312c3..8dc915f6e8 100644 --- a/engines/agos/script_ww.cpp +++ b/engines/agos/script_ww.cpp @@ -368,11 +368,11 @@ void AGOSEngine_Waxworks::oww_pauseGame() { uint32 pauseTime = getTime(); haltAnimation(); - for (;;) { + while (!_quit) { _lastHitArea = NULL; _lastHitArea3 = NULL; - for (;;) { + while (!_quit) { if (_lastHitArea3 != 0) break; delay(1); diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp index cb71ed7efa..5903cabf4b 100644 --- a/engines/agos/subroutine.cpp +++ b/engines/agos/subroutine.cpp @@ -518,6 +518,8 @@ void AGOSEngine::runSubroutine101() { } int AGOSEngine::startSubroutine(Subroutine *sub) { + printf("startSubroutine\n"); + int result = -1; SubroutineLine *sl = (SubroutineLine *)((byte *)sub + sub->first); diff --git a/engines/agos/verb.cpp b/engines/agos/verb.cpp index 963bd6bd86..c8f6d40f1f 100644 --- a/engines/agos/verb.cpp +++ b/engines/agos/verb.cpp @@ -343,6 +343,9 @@ void AGOSEngine::handleVerbClicked(uint verb) { Subroutine *sub; int result; + if (_quit) + return; + _objectItem = _hitAreaObjectItem; if (_objectItem == _dummyItem2) { _objectItem = me(); diff --git a/engines/agos/window.cpp b/engines/agos/window.cpp index e25bd6b438..e1f986b92e 100644 --- a/engines/agos/window.cpp +++ b/engines/agos/window.cpp @@ -298,7 +298,7 @@ void AGOSEngine::waitWindow(WindowBlock *window) { ha->id = 0x7FFF; ha->priority = 999; - for (;;) { + while (!_quit) { _lastHitArea = NULL; _lastHitArea3 = NULL; -- cgit v1.2.3