[Scummvm-cvs-logs] CVS: scummvm/scumm saveload.cpp,1.191,1.192 script.cpp,1.205,1.206 scumm.cpp,1.301,1.302 scumm.h,1.528,1.529

Max Horn fingolfin at users.sourceforge.net
Sat Jan 29 07:50:20 CET 2005


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

Modified Files:
	saveload.cpp script.cpp scumm.cpp scumm.h 
Log Message:
Renamed _localScriptList to _localScriptOffsets for clarity

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -d -r1.191 -r1.192
--- saveload.cpp	10 Jan 2005 22:05:45 -0000	1.191
+++ saveload.cpp	29 Jan 2005 15:49:55 -0000	1.192
@@ -455,7 +455,7 @@
 		MKLINE(ScummEngine, _roomResource, sleByte, VER(8)),
 		MKLINE(ScummEngine, _numObjectsInRoom, sleByte, VER(8)),
 		MKLINE(ScummEngine, _currentScript, sleByte, VER(8)),
-		MKARRAY(ScummEngine, _localScriptList[0], sleUint32, _numLocalScripts, VER(8)),
+		MKARRAY(ScummEngine, _localScriptOffsets[0], sleUint32, _numLocalScripts, VER(8)),
 
 
 		// vm.localvar grew from 25 to 40 script entries and then from

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -d -r1.205 -r1.206
--- script.cpp	24 Jan 2005 10:10:50 -0000	1.205
+++ script.cpp	29 Jan 2005 15:49:56 -0000	1.206
@@ -54,7 +54,7 @@
 		debugC(DEBUG_SCRIPTS, "runScript(Global-%d) from %d-%d", script, 
 				       vm.slot[_currentScript].number, _roomResource);
 	} else {
-		scriptOffs = _localScriptList[script - _numGlobalScripts];
+		scriptOffs = _localScriptOffsets[script - _numGlobalScripts];
 		if (scriptOffs == 0)
 			error("Local script %d is not in room %d", script, _roomResource);
 		scriptType = WIO_LOCAL;

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.301
retrieving revision 1.302
diff -u -d -r1.301 -r1.302
--- scumm.cpp	29 Jan 2005 05:11:29 -0000	1.301
+++ scumm.cpp	29 Jan 2005 15:49:56 -0000	1.302
@@ -658,7 +658,7 @@
 	memset(_saveLoadName, 0, sizeof(_saveLoadName));
 	_maxHeapThreshold = 0;
 	_minHeapThreshold = 0;
-	memset(_localScriptList, 0, sizeof(_localScriptList));
+	memset(_localScriptOffsets, 0, sizeof(_localScriptOffsets));
 	_scriptPointer = NULL;
 	_scriptOrgPointer = NULL;
 	_opcode = 0;
@@ -2020,7 +2020,7 @@
 void ScummEngine::initRoomSubBlocks() {
 	int i;
 	const byte *ptr;
-	byte *roomptr, *searchptr, *roomResPtr, *roomImagePtr = 0;
+	byte *roomptr, *searchptr, *roomResPtr = 0;
 	const RoomHeader *rmhd;
 
 	_ENCD_offs = 0;
@@ -2029,21 +2029,11 @@
 	_CLUT_offs = 0;
 	_PALS_offs = 0;
 
-	nukeResource(rtMatrix, 1);
-	nukeResource(rtMatrix, 2);
-
-	for (i = 1; i < res.num[rtScaleTable]; i++)
-		nukeResource(rtScaleTable, i);
-
-	memset(_localScriptList, 0, sizeof(_localScriptList));
-
 	memset(_extraBoxFlags, 0, sizeof(_extraBoxFlags));
 
 	// Determine the room and room script base address
 	roomResPtr = roomptr = getResourceAddress(rtRoom, _roomResource);
-	if (_heversion >= 70)
-		roomImagePtr = getResourceAddress(rtRoomImage, _roomResource);
-	else if (_version == 8)
+	if (_version == 8)
 		roomResPtr = getResourceAddress(rtRoomScripts, _roomResource);
 	if (!roomptr || !roomResPtr)
 		error("Room %d: data not found (" __FILE__  ":%d)", _roomResource, __LINE__);
@@ -2097,6 +2087,7 @@
 	} else if (_features & GF_SMALL_HEADER) {
 		_IM00_offs = findResourceData(MKID('IM00'), roomptr) - roomptr;
 	} else if (_heversion >= 70) {
+		byte *roomImagePtr = getResourceAddress(rtRoomImage, _roomResource);
 		_IM00_offs = findResource(MKID('IM00'), roomImagePtr) - roomImagePtr;
 	} else {
 		_IM00_offs = findResource(MKID('IM00'), findResource(MKID('RMIM'), roomptr)) - roomptr;
@@ -2147,6 +2138,8 @@
 	//
 	// Load box data
 	//
+	nukeResource(rtMatrix, 1);
+	nukeResource(rtMatrix, 2);
 	if (_features & GF_SMALL_HEADER) {
 		if (_version <= 2)
 			ptr = roomptr + *(roomptr + 0x15);
@@ -2204,6 +2197,9 @@
 	//
 	// Load scale data
 	//
+	for (i = 1; i < res.num[rtScaleTable]; i++)
+		nukeResource(rtScaleTable, i);
+
 	if (_features & GF_OLD_BUNDLE)
 		ptr = 0;
 	else
@@ -2241,6 +2237,8 @@
 		roomResPtr = getResourceAddress(rtRoomScripts, _roomResource);
 	searchptr = roomResPtr;
 
+	memset(_localScriptOffsets, 0, sizeof(_localScriptOffsets));
+
 	if (_features & GF_OLD_BUNDLE) {
 		int num_objects = *(roomResPtr + 20);
 		int num_sounds;
@@ -2261,7 +2259,7 @@
 			while (*ptr) {
 				int id = *ptr;
 
-				_localScriptList[id - _numGlobalScripts] = READ_LE_UINT16(ptr + 1);
+				_localScriptOffsets[id - _numGlobalScripts] = READ_LE_UINT16(ptr + 1);
 				ptr += 3;
 	
 				if (_dumpScripts) {
@@ -2271,12 +2269,12 @@
 					// HACK: to determine the sizes of the local scripts, we assume that
 					// a) their order in the data file is the same as in the index
 					// b) the last script at the same time is the last item in the room "header"
-					int len = - (int)_localScriptList[id - _numGlobalScripts] + _resourceHeaderSize;
+					int len = - (int)_localScriptOffsets[id - _numGlobalScripts] + _resourceHeaderSize;
 					if (*ptr)
 						len += READ_LE_UINT16(ptr + 1);
 					else
 						len += READ_LE_UINT16(roomResPtr);
-					dumpResource(buf, id, roomResPtr + _localScriptList[id - _numGlobalScripts] - _resourceHeaderSize, len);
+					dumpResource(buf, id, roomResPtr + _localScriptOffsets[id - _numGlobalScripts] - _resourceHeaderSize, len);
 				}
 			}
 		}
@@ -2293,7 +2291,7 @@
 				dumpResource(buf, id, ptr - _resourceHeaderSize);
 			}
 
-			_localScriptList[id - _numGlobalScripts] = ptr + 1 - roomptr;
+			_localScriptOffsets[id - _numGlobalScripts] = ptr + 1 - roomptr;
 		}
 	} else if (_heversion >= 90) {
 		ResourceIterator localScriptIterator2(searchptr, false);
@@ -2305,7 +2303,7 @@
 			id = READ_LE_UINT32(ptr);
 
 			checkRange(_numLocalScripts + _numGlobalScripts, _numGlobalScripts, id, "Invalid local script %d");
-			_localScriptList[id - _numGlobalScripts] = ptr + 4 - roomResPtr;
+			_localScriptOffsets[id - _numGlobalScripts] = ptr + 4 - roomResPtr;
 
 			if (_dumpScripts) {
 				char buf[32];
@@ -2321,7 +2319,7 @@
 			ptr += _resourceHeaderSize;	/* skip tag & size */
 
 			id = ptr[0];
-			_localScriptList[id - _numGlobalScripts] = ptr + 1 - roomResPtr;
+			_localScriptOffsets[id - _numGlobalScripts] = ptr + 1 - roomResPtr;
 
 			if (_dumpScripts) {
 				char buf[32];
@@ -2340,14 +2338,14 @@
 			if (_version == 8) {
 				id = READ_LE_UINT32(ptr);
 				checkRange(_numLocalScripts + _numGlobalScripts, _numGlobalScripts, id, "Invalid local script %d");
-				_localScriptList[id - _numGlobalScripts] = ptr + 4 - roomResPtr;
+				_localScriptOffsets[id - _numGlobalScripts] = ptr + 4 - roomResPtr;
 			} else if (_version == 7) {
 				id = READ_LE_UINT16(ptr);
 				checkRange(_numLocalScripts + _numGlobalScripts, _numGlobalScripts, id, "Invalid local script %d");
-				_localScriptList[id - _numGlobalScripts] = ptr + 2 - roomResPtr;
+				_localScriptOffsets[id - _numGlobalScripts] = ptr + 2 - roomResPtr;
 			} else {
 				id = ptr[0];
-				_localScriptList[id - _numGlobalScripts] = ptr + 1 - roomResPtr;
+				_localScriptOffsets[id - _numGlobalScripts] = ptr + 1 - roomResPtr;
 			}
 
 			if (_dumpScripts) {

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.528
retrieving revision 1.529
diff -u -d -r1.528 -r1.529
--- scumm.h	11 Jan 2005 13:25:01 -0000	1.528
+++ scumm.h	29 Jan 2005 15:49:57 -0000	1.529
@@ -540,7 +540,7 @@
 	uint32 _maxHeapThreshold, _minHeapThreshold;
 
 	/* Script VM - should be in Script class */
-	uint32 _localScriptList[256];
+	uint32 _localScriptOffsets[256];
 	const byte *_scriptPointer, *_scriptOrgPointer;
 	byte _opcode, _currentScript;
 	uint16 _curExecScript;





More information about the Scummvm-git-logs mailing list