aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-01-18 11:53:07 +0000
committerTorbjörn Andersson2006-01-18 11:53:07 +0000
commit34d835e4a263f6cc0be68da94cca40c803dd9532 (patch)
treeacda69073f4c5467392209f98036c46e60ef3022 /scumm
parent791b5bdc6175fb3f15dbc4f10d643ac3596228e9 (diff)
downloadscummvm-rg350-34d835e4a263f6cc0be68da94cca40c803dd9532.tar.gz
scummvm-rg350-34d835e4a263f6cc0be68da94cca40c803dd9532.tar.bz2
scummvm-rg350-34d835e4a263f6cc0be68da94cca40c803dd9532.zip
Work around a script bug in Full Throttle. See bug #1407789.
svn-id: r20080
Diffstat (limited to 'scumm')
-rw-r--r--scumm/actor.cpp8
-rw-r--r--scumm/script.cpp8
-rw-r--r--scumm/script_v5.cpp2
-rw-r--r--scumm/scumm.h2
4 files changed, 17 insertions, 3 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp
index e892c78248..be84e3f01d 100644
--- a/scumm/actor.cpp
+++ b/scumm/actor.cpp
@@ -909,12 +909,16 @@ void ScummEngine::playActorSounds() {
}
}
+bool ScummEngine::isValidActor(int id) const {
+ return id >= 0 && id < _numActors && _actors[id]._number == id;
+}
+
Actor *ScummEngine::derefActor(int id, const char *errmsg) const {
if (id == 0)
debugC(DEBUG_ACTORS, "derefActor(0, \"%s\") in script %d, opcode 0x%x",
errmsg, vm.slot[_currentScript].number, _opcode);
- if (id < 0 || id >= _numActors || _actors[id]._number != id) {
+ if (!isValidActor(id)) {
if (errmsg)
error("Invalid actor %d in %s", id, errmsg);
else
@@ -928,7 +932,7 @@ Actor *ScummEngine::derefActorSafe(int id, const char *errmsg) const {
debugC(DEBUG_ACTORS, "derefActorSafe(0, \"%s\") in script %d, opcode 0x%x",
errmsg, vm.slot[_currentScript].number, _opcode);
- if (id < 0 || id >= _numActors || _actors[id]._number != id) {
+ if (!isValidActor(id)) {
debugC(DEBUG_ACTORS, "Invalid actor %d in %s (script %d, opcode 0x%x)",
id, errmsg, vm.slot[_currentScript].number, _opcode);
return NULL;
diff --git a/scumm/script.cpp b/scumm/script.cpp
index 534d34074e..f74571f6db 100644
--- a/scumm/script.cpp
+++ b/scumm/script.cpp
@@ -1083,6 +1083,14 @@ void ScummEngine::checkAndRunSentenceScript() {
localParamList[0] = _sentence[_sentenceNum].verb;
localParamList[1] = _sentence[_sentenceNum].objectA;
localParamList[2] = _sentence[_sentenceNum].objectB;
+
+ // WORKAROUND for bug #1407789. The script clearly assumes that
+ // one of the two objects is an actor. If that's not the case,
+ // fall back on what appears to be the usual sentence script.
+
+ if (_gameId == GID_FT && sentenceScript == 103 && !isValidActor(localParamList[1]) && !isValidActor(localParamList[2])) {
+ sentenceScript = 28;
+ }
}
_currentScript = 0xFF;
if (sentenceScript)
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp
index 382d0f28f0..a55094614b 100644
--- a/scumm/script_v5.cpp
+++ b/scumm/script_v5.cpp
@@ -1052,7 +1052,7 @@ void ScummEngine_v5::o5_getActorRoom() {
// WORKAROUND bug #746349. This is a really odd bug in either the script
// or in our script engine. Might be a good idea to investigate this
// further by e.g. looking at the FOA engine a bit closer.
- if (_gameId == GID_INDY4 && _roomResource == 94 && vm.slot[_currentScript].number == 206 && act > _numActors) {
+ if (_gameId == GID_INDY4 && _roomResource == 94 && vm.slot[_currentScript].number == 206 && !isValidActor(act)) {
setResult(0);
return;
}
diff --git a/scumm/scumm.h b/scumm/scumm.h
index a59d4f9ccd..437e15f6c9 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -848,6 +848,8 @@ protected:
void setVerbObject(uint room, uint object, uint verb);
public:
+ bool isValidActor(int id) const;
+
/* Should be in Actor class */
Actor *derefActor(int id, const char *errmsg = 0) const;
Actor *derefActorSafe(int id, const char *errmsg) const;