diff options
Diffstat (limited to 'engines/agi')
-rw-r--r-- | engines/agi/agi.h | 2 | ||||
-rw-r--r-- | engines/agi/op_test.cpp | 17 |
2 files changed, 13 insertions, 6 deletions
diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 46d0a341df..2294593427 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -867,7 +867,7 @@ public: void unloadLogic(int16 logicNr); int runLogic(int16 logicNr); void debugConsole(int, int, const char *); - int testIfCode(int); + bool testIfCode(int16 logicNr); void executeAgiCommand(uint8, uint8 *); private: diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp index b4bf38b8a2..6afddf844a 100644 --- a/engines/agi/op_test.cpp +++ b/engines/agi/op_test.cpp @@ -376,7 +376,7 @@ uint8 AgiEngine::testSaid(uint8 nwords, uint8 *cc) { return true; } -int AgiEngine::testIfCode(int lognum) { +bool AgiEngine::testIfCode(int16 logicNr) { AgiGame *state = &_game; uint8 op; uint8 p[16]; @@ -387,8 +387,8 @@ int AgiEngine::testIfCode(int lognum) { int result = true; while (!(shouldQuit() || _restartGame) && !endTest) { - if (_debug.enabled && (_debug.logic0 || lognum)) - debugConsole(lognum, lTEST_MODE, NULL); + if (_debug.enabled && (_debug.logic0 || logicNr)) + debugConsole(logicNr, lTEST_MODE, NULL); op = *(code + ip++); memmove(p, (code + ip), 16); @@ -419,6 +419,13 @@ int AgiEngine::testIfCode(int lognum) { default: // Evaluate the command and skip the rest of the instruction _opCodesCond[op].functionPtr(state, this, p); + if (state->exitAllLogics) { + // required even here, because of at least the timer heuristic + // which when triggered waits a bit and processes ScummVM events and user may therefore restore a saved game + // fixes bug #9707 + // TODO: maybe delay restoring the game instead, when GMM is used? + return true; + } skipInstruction(op); // NOT mode is enabled only for one instruction @@ -457,8 +464,8 @@ int AgiEngine::testIfCode(int lognum) { else ip += READ_LE_UINT16(code + ip) + 2; - if (_debug.enabled && (_debug.logic0 || lognum)) - debugConsole(lognum, 0xFF, result ? "=true" : "=false"); + if (_debug.enabled && (_debug.logic0 || logicNr)) + debugConsole(logicNr, 0xFF, result ? "=true" : "=false"); return result; } |