[Scummvm-cvs-logs] CVS: scummvm/scumm object.cpp,1.164,1.165 script_v6.cpp,1.278,1.279 scumm.h,1.364,1.365

Max Horn fingolfin at users.sourceforge.net
Mon Jan 19 12:24:04 CET 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv12652

Modified Files:
	object.cpp script_v6.cpp scumm.h 
Log Message:
moved the sam&max inventory hack into o6_setOwner

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- object.cpp	16 Jan 2004 08:23:46 -0000	1.164
+++ object.cpp	19 Jan 2004 20:23:27 -0000	1.165
@@ -1188,23 +1188,6 @@
 	return -1;
 }
 
-void ScummEngine::SamInventoryHack(int obj) {
-	// FIXME: Sam and Max hack
-	int base = 6;
-
-	while (base < 80) {
-		int value = readArray(178, 0, base);
-		if (value == obj)
-			return;
-		if (value == 0) {
-			_scummVars[179]++;
-			writeArray(178, 0, base, obj);
-			return;
-		}
-		base++;
-	}
-}
-
 void ScummEngine::setOwnerOf(int obj, int owner) {
 	ScriptSlot *ss;
 	if (owner == 0) {
@@ -1217,8 +1200,6 @@
 			return;
 		}
 	}
-	if ((owner == 2) && (_gameId == GID_SAMNMAX))
-		SamInventoryHack(obj);
 
 	putOwner(obj, owner);
 	runInventoryScript(0);

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.278
retrieving revision 1.279
diff -u -d -r1.278 -r1.279
--- script_v6.cpp	19 Jan 2004 19:47:47 -0000	1.278
+++ script_v6.cpp	19 Jan 2004 20:23:27 -0000	1.279
@@ -925,6 +925,35 @@
 	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);
 }
 

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.364
retrieving revision 1.365
diff -u -d -r1.364 -r1.365
--- scumm.h	19 Jan 2004 20:14:29 -0000	1.364
+++ scumm.h	19 Jan 2004 20:23:27 -0000	1.365
@@ -662,7 +662,6 @@
 	/* Should be in Object class */
 	byte OF_OWNER_ROOM;
 	int getInventorySlot();
-	void SamInventoryHack(int obj);	// FIXME: Sam and Max hack
 	int findInventory(int owner, int index);
 	int getInventoryCount(int owner);
 





More information about the Scummvm-git-logs mailing list