[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.399,1.400 script.cpp,1.238,1.239 script_v5.cpp,1.303,1.304 scumm.h,1.668,1.669

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Wed Jan 18 03:54:03 CET 2006


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4519

Modified Files:
	actor.cpp script.cpp script_v5.cpp scumm.h 
Log Message:
Work around a script bug in Full Throttle. See bug #1407789.


Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.399
retrieving revision 1.400
diff -u -d -r1.399 -r1.400
--- actor.cpp	17 Jan 2006 03:07:00 -0000	1.399
+++ actor.cpp	18 Jan 2006 11:53:07 -0000	1.400
@@ -909,12 +909,16 @@
 	}
 }
 
+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 @@
 		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;

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.238
retrieving revision 1.239
diff -u -d -r1.238 -r1.239
--- script.cpp	10 Jan 2006 21:39:13 -0000	1.238
+++ script.cpp	18 Jan 2006 11:53:07 -0000	1.239
@@ -1083,6 +1083,14 @@
 		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)

Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.303
retrieving revision 1.304
diff -u -d -r1.303 -r1.304
--- script_v5.cpp	10 Jan 2006 00:34:13 -0000	1.303
+++ script_v5.cpp	18 Jan 2006 11:53:07 -0000	1.304
@@ -1052,7 +1052,7 @@
 	// 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;
 	}

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.668
retrieving revision 1.669
diff -u -d -r1.668 -r1.669
--- scumm.h	18 Jan 2006 03:43:27 -0000	1.668
+++ scumm.h	18 Jan 2006 11:53:07 -0000	1.669
@@ -848,6 +848,8 @@
 	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;





More information about the Scummvm-git-logs mailing list