diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/scumm/script.cpp | 17 | ||||
-rw-r--r-- | engines/scumm/script_v0.cpp | 3 | ||||
-rw-r--r-- | engines/scumm/scumm_v0.h | 1 | ||||
-rw-r--r-- | engines/scumm/verbs.cpp | 3 |
4 files changed, 21 insertions, 3 deletions
diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index cda2b3cd82..b51452170a 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -1209,8 +1209,7 @@ void ScummEngine_v0::checkAndRunSentenceScript() { return; } - // FIXME: should this be executed? - //_currentScript = 0xFF; + _currentScript = 0xFF; assert(st.objectA); @@ -1233,7 +1232,19 @@ void ScummEngine_v0::checkAndRunSentenceScript() { _cmdObject2 = st.objectB; _sentenceNum--; - // TODO: check sentenceNum + // abort sentence execution if the number of nested scripts is too high. + // This might happen for instance if the sentence command depends on an + // object that the actor has to pick-up in a nested doSentence() call. + // If the actor is not able to pick-up the object (e.g. because it is not + // reachable or pickupable) a nested pick-up command is triggered again + // and again, so the actual sentence command will never be executed. + // In this case the sentence command has to be aborted. + _sentenceNestedCount++; + if (_sentenceNestedCount > 6) { + _sentenceNestedCount = 0; + _sentenceNum = 0; + return; + } if (whereIsObject(st.objectA) != WIO_INVENTORY) { if (_currentMode != kModeKeypad) { diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp index 4d9a206118..4081123e13 100644 --- a/engines/scumm/script_v0.cpp +++ b/engines/scumm/script_v0.cpp @@ -979,6 +979,9 @@ void ScummEngine_v0::resetSentence() { _walkToObjectState = kWalkToObjectStateDone; _redrawSentenceLine = true; + + _sentenceNum = 0; + _sentenceNestedCount = 0; } } // End of namespace Scumm diff --git a/engines/scumm/scumm_v0.h b/engines/scumm/scumm_v0.h index e25d6f5826..8b13569042 100644 --- a/engines/scumm/scumm_v0.h +++ b/engines/scumm/scumm_v0.h @@ -55,6 +55,7 @@ protected: int _cmdVerb; // script verb int _cmdObject; // 1st script object (see OBJECT_V0()) int _cmdObject2; // 2nd script object or actor (see OBJECT_V0()) + int _sentenceNestedCount; int _walkToObject; int _walkToObjectState; diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp index 91c9cc159a..7a099adae9 100644 --- a/engines/scumm/verbs.cpp +++ b/engines/scumm/verbs.cpp @@ -689,6 +689,9 @@ int ScummEngine_v0::activeVerbPrep() { } void ScummEngine_v0::verbExec() { + _sentenceNum = 0; + _sentenceNestedCount = 0; + if (_activeVerb == kVerbWhatIs) return; |