[Scummvm-cvs-logs] CVS: scummvm/scumm object.cpp,1.168,1.169 script_v6.cpp,1.313,1.314

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Mon Mar 1 08:27:01 CET 2004


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

Modified Files:
	object.cpp script_v6.cpp 
Log Message:
Got rid of the Sam & Max inventory hack. This fixes at least one aspect of
bug #907113. See also bug #493153 for the origins of the hack.

It would be very nice if we could get this fix into 0.6.0 as well, because
bug #907113 crashes ScummVM for reasons which escape me. But someone will
have to verify that the fix is correct first. Pretty please...?


Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -d -r1.168 -r1.169
--- object.cpp	18 Feb 2004 11:46:07 -0000	1.168
+++ object.cpp	1 Mar 2004 16:07:16 -0000	1.169
@@ -1191,19 +1191,26 @@
 
 void ScummEngine::setOwnerOf(int obj, int owner) {
 	ScriptSlot *ss;
+
+	// In Sam & Max this is necessary, or you won't get your stuff back
+	// from the Lost and Found tent after riding the Cone of Tragedy. But
+	// it probably applies to all V6+ games. See bugs #493153 and #907113.
+
+	int arg = (_version >= 6) ? obj : 0;
+
 	if (owner == 0) {
 		clearOwnerOf(obj);
 		ss = &vm.slot[_currentScript];
 		if (ss->where == WIO_INVENTORY && _inventory[ss->number] == obj) {
 			putOwner(obj, 0);
-			runInventoryScript(0);
+			runInventoryScript(arg);
 			stopObjectCode();
 			return;
 		}
 	}
 
 	putOwner(obj, owner);
-	runInventoryScript(0);
+	runInventoryScript(arg);
 }
 
 int ScummEngine::getObjX(int obj) {

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.313
retrieving revision 1.314
diff -u -d -r1.313 -r1.314
--- script_v6.cpp	1 Mar 2004 02:55:08 -0000	1.313
+++ script_v6.cpp	1 Mar 2004 16:07:16 -0000	1.314
@@ -1020,36 +1020,6 @@
 void ScummEngine_v6::o6_setOwner() {
 	int owner = pop();
 	int obj = pop();
-
-	if ((owner == 2) && (_gameId == GID_SAMNMAX)) {
-		// TODO / FIXME: This hack was added a long time ago, in revision 1.28
-		// of object.cpp in the old CVS module (see also here:
-		// http://cvs.sourceforge.net/viewcvs.py/scummvm/scummvm-old/object.cpp?r1=1.27&r2=1.28
-		// Commited by Endy with message:
-		//  "Sam and Max inventory hack. Makes it work, but is nasty ;)"
-		//
-		// Sadly, it's not quite clear what exactly the hack fixes. In a quick
-		// test I didn't find any place where it is being used, but of course
-		// that means nothing.
-		//
-		// There aren't many places that invoke setOwner at all (in Sam and Max).
-		// I did a quick search of the script dumps I have here; in those I found
-		// seven calls to setOwner, and only one with owner == 2.
-
-		warning("Inside Sam and Max inventory hack! (obj %d)", obj);
-		for (int base = 6; base < 80; base++) {
-			int value = readArray(178, 0, base);
-			if (value == obj)
-				break;
-			if (value == 0) {
-				_scummVars[179]++;
-				writeArray(178, 0, base, obj);
-				break;
-			}
-			base++;
-		}
-	}
-
 	setOwnerOf(obj, owner);
 }
 





More information about the Scummvm-git-logs mailing list