[Scummvm-cvs-logs] CVS: scummvm/scumm scumm.cpp,1.152,1.153 scumm.h,1.454,1.455 resource.cpp,1.253,1.254 script.cpp,1.181,1.182

Travis Howell kirben at users.sourceforge.net
Thu Aug 26 16:16:06 CEST 2004


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

Modified Files:
	scumm.cpp scumm.h resource.cpp script.cpp 
Log Message:

Add var difference in later HE games


Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -d -r1.152 -r1.153
--- scumm.cpp	26 Aug 2004 15:33:51 -0000	1.152
+++ scumm.cpp	26 Aug 2004 23:15:37 -0000	1.153
@@ -491,6 +491,7 @@
 	_inventory = NULL;
 	_newNames = NULL;
 	_scummVars = NULL;
+	_roomVars = NULL;
 	_varwatch = 0;
 	_bitVars = NULL;
 	_numVariables = 0;

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.454
retrieving revision 1.455
diff -u -d -r1.454 -r1.455
--- scumm.h	26 Aug 2004 14:28:42 -0000	1.454
+++ scumm.h	26 Aug 2004 23:15:38 -0000	1.455
@@ -472,6 +472,7 @@
 
 protected:
 	int16 _varwatch;
+	int32 *_roomVars;
 	int32 *_scummVars;
 	byte *_bitVars;
 

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.253
retrieving revision 1.254
diff -u -d -r1.253 -r1.254
--- resource.cpp	26 Aug 2004 14:35:38 -0000	1.253
+++ resource.cpp	26 Aug 2004 23:15:38 -0000	1.254
@@ -2429,6 +2429,7 @@
 	_inventory = (uint16 *)calloc(_numInventory, sizeof(uint16));
 	_verbs = (VerbSlot *)calloc(_numVerbs, sizeof(VerbSlot));
 	_objs = (ObjectData *)calloc(_numLocalObjects, sizeof(ObjectData));
+	_roomVars = (int32 *)calloc(_numBitVariables, sizeof(int32));
 	_scummVars = (int32 *)calloc(_numVariables, sizeof(int32));
 	_bitVars = (byte *)calloc(_numBitVariables >> 3, 1);
 	_images = (uint16 *)calloc(_numImages, sizeof(uint16));

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -d -r1.181 -r1.182
--- script.cpp	26 Aug 2004 14:28:41 -0000	1.181
+++ script.cpp	26 Aug 2004 23:15:39 -0000	1.182
@@ -477,13 +477,6 @@
 }
 
 int ScummEngine::readVar(uint var) {
-	// HACK Seems to variable difference
-	// Correct values for now
-	if (_gameId == GID_PAJAMA && var == 32770) 
-		return 5;
-	else if (_gameId == GID_WATER && var == 32770) 
-		return 23
-;
 	int a;
 	static byte copyprotbypassed;
 	if (!_copyProtection)
@@ -523,7 +516,12 @@
 	}
 
 	if (var & 0x8000) {
-		if ((_gameId == GID_ZAK256) || (_features & GF_OLD_BUNDLE) || 
+		if (_gameId == GID_PAJAMA) {
+			var &= 0xFFF;
+			checkRange(_numBitVariables, 0, var, "Room variable %d out of range(w)");
+			return _roomVars[var];
+
+		} else if ((_gameId == GID_ZAK256) || (_features & GF_OLD_BUNDLE) || 
 			(_gameId == GID_LOOM && (_features & GF_FMTOWNS))) {
 			int bit = var & 0xF;
 			var = (var >> 4) & 0xFF;
@@ -557,7 +555,10 @@
 			var &= 0xFFF;
 		}
 
-		checkRange(20, 0, var, "Local variable %d out of range(r)");
+		if (_heversion >= 72)
+			checkRange(24, 0, var, "Local variable %d out of range(r)");
+		else
+			checkRange(20, 0, var, "Local variable %d out of range(r)");
 		return vm.localvar[_currentScript][var];
 	}
 
@@ -598,7 +599,12 @@
 	}
 
 	if (var & 0x8000) {
-		if ((_gameId == GID_ZAK256) || (_features & GF_OLD_BUNDLE) ||
+		if (_gameId == GID_PAJAMA) {
+			var &= 0xFFF;
+			checkRange(_numBitVariables, 0, var, "Room variable %d out of range(w)");
+			_roomVars[var] = value;
+
+		} else if ((_gameId == GID_ZAK256) || (_features & GF_OLD_BUNDLE) ||
 			(_gameId == GID_LOOM && (_features & GF_FMTOWNS))) {
 			// In the old games, the bit variables were using the same memory
 			// as the normal variables!
@@ -628,7 +634,11 @@
 			var &= 0xFFF;
 		}
 
-		checkRange(20, 0, var, "Local variable %d out of range(w)");
+		if (_heversion >= 72)
+			checkRange(24, 0, var, "Local variable %d out of range(w)");
+		else
+			checkRange(20, 0, var, "Local variable %d out of range(w)");
+
 		vm.localvar[_currentScript][var] = value;
 		return;
 	}





More information about the Scummvm-git-logs mailing list