[Scummvm-cvs-logs] CVS: scummvm/scumm resource.cpp,1.233,1.234 script.cpp,1.164,1.165 script_v6.cpp,1.366,1.367 script_v6he.cpp,2.81,2.82 scumm.cpp,1.110,1.111 scumm.h,1.435,1.436

Travis Howell kirben at users.sourceforge.net
Sun Aug 1 06:58:01 CEST 2004


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

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

HE games use different method to clear some arrays resources.


Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.233
retrieving revision 1.234
diff -u -d -r1.233 -r1.234
--- resource.cpp	31 Jul 2004 23:20:37 -0000	1.233
+++ resource.cpp	1 Aug 2004 13:57:00 -0000	1.234
@@ -2406,6 +2406,7 @@
 	_scummVars = (int32 *)calloc(_numVariables, sizeof(int32));
 	_bitVars = (byte *)calloc(_numBitVariables >> 3, 1);
 	_images = (uint16 *)calloc(_numImages, sizeof(uint16));
+	_arraySlot = (byte *)calloc(_numArray, 1);
 
 	allocResTypeData(rtCostume, (_features & GF_NEW_COSTUMES) ? MKID('AKOS') : MKID('COST'),
 								_numCostumes, "costume", 1);

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- script.cpp	1 Aug 2004 06:52:45 -0000	1.164
+++ script.cpp	1 Aug 2004 13:57:00 -0000	1.165
@@ -215,6 +215,7 @@
 				error("Script %d stopped with active cutscene/override", script);
 			ss->number = 0;
 			ss->status = ssDead;
+			nukeArrays(script);
 			if (_currentScript == i)
 				_currentScript = 0xFF;
 		}
@@ -226,6 +227,7 @@
 	while (num > 0) {
 		if (nest->number == script &&
 				(nest->where == WIO_GLOBAL || nest->where == WIO_LOCAL)) {
+			nukeArrays(script);
 			nest->number = 0xFF;
 			nest->slot = 0xFF;
 			nest->where = 0xFF;
@@ -252,6 +254,7 @@
 				error("Object %d stopped with active cutscene/override", script);
 			ss->number = 0;
 			ss->status = ssDead;
+			nukeArrays(script);
 			if (_currentScript == i)
 				_currentScript = 0xFF;
 		}
@@ -263,6 +266,7 @@
 	while (num > 0) {
 		if (nest->number == script &&
 				(nest->where == WIO_ROOM || nest->where == WIO_INVENTORY || nest->where == WIO_FLOBJECT)) {
+			nukeArrays(script);
 			nest->number = 0xFF;
 			nest->slot = 0xFF;
 			nest->where = 0xFF;
@@ -341,6 +345,19 @@
 	vm.slot[_currentScript].offs = _scriptPointer - _scriptOrgPointer;
 }
 
+/* Nuke arrays based on script */
+void ScummEngine::nukeArrays(int script) {
+	int i;
+
+	if (!_heversion || !script)
+		return;
+
+	for (i = 1; i < _numArray; i++) {
+		if (_arraySlot[i] == script)
+			nukeResource(rtString, i);
+	}
+}
+
 /* Get the code pointer to a script */
 void ScummEngine::getScriptBaseAddress() {
 	ScriptSlot *ss;
@@ -673,6 +690,7 @@
 	}
 	ss->number = 0;
 	ss->status = ssDead;
+	nukeArrays(_currentScript);
 	_currentScript = 0xFF;
 }
 
@@ -828,6 +846,7 @@
 				warning("Object %d stopped with active cutscene/override in exit", ss->number);
 				ss->cutsceneOverride = 0;
 			}
+			nukeArrays(i);
 			ss->status = ssDead;
 		} else if (ss->where == WIO_LOCAL) {
 			// Earlier games only checked global scripts at this point
@@ -835,6 +854,7 @@
 				warning("Script %d stopped with active cutscene/override in exit", ss->number);
 				ss->cutsceneOverride = 0;
 			}
+			nukeArrays(i);
 			ss->status = ssDead;
 		}
 	}

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.366
retrieving revision 1.367
diff -u -d -r1.366 -r1.367
--- script_v6.cpp	1 Aug 2004 02:03:07 -0000	1.366
+++ script_v6.cpp	1 Aug 2004 13:57:00 -0000	1.367
@@ -465,6 +465,7 @@
 
 	if (data)
 		nukeResource(rtString, data);
+	_arraySlot[a] = 0;
 
 	writeVar(a, 0);
 }

Index: script_v6he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6he.cpp,v
retrieving revision 2.81
retrieving revision 2.82
diff -u -d -r2.81 -r2.82
--- script_v6he.cpp	1 Aug 2004 02:07:57 -0000	2.81
+++ script_v6he.cpp	1 Aug 2004 13:57:00 -0000	2.82
@@ -1124,12 +1124,12 @@
 }
 
 void ScummEngine_v6he::o6_localizeArray() {
-	int stringID = pop();
+	int slot = pop();
 
-	if (stringID < _numArray) {
-		_baseArrays[stringID][0] = (byte)_currentScript;
+	if (slot < _numArray) {
+		_arraySlot[slot] = vm.slot[_currentScript].number;
 	} else {
-		warning("o6_localizeArray(%d): too big scriptID", stringID);
+		warning("o6_localizeArray(%d): array slot out of range", slot);
 	}
 }
 

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- scumm.cpp	26 Jul 2004 18:13:53 -0000	1.110
+++ scumm.cpp	1 Aug 2004 13:57:00 -0000	1.111
@@ -2165,6 +2165,7 @@
 		if (ss->where == WIO_ROOM || ss->where == WIO_FLOBJECT) {
 			if (ss->cutsceneOverride != 0)
 				error("Object %d stopped with active cutscene/override in exit", ss->number);
+			nukeArrays(_currentScript);
 			_currentScript = 0xFF;
 		} else if (ss->where == WIO_LOCAL) {
 			if (ss->cutsceneOverride != 0) {
@@ -2172,6 +2173,7 @@
 				if (_version >= 5)
 					error("Script %d stopped with active cutscene/override in exit", ss->number);
 			}
+			nukeArrays(_currentScript);
 			_currentScript = 0xFF;
 		}
 	}

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.435
retrieving revision 1.436
diff -u -d -r1.435 -r1.436
--- scumm.h	31 Jul 2004 23:20:37 -0000	1.435
+++ scumm.h	1 Aug 2004 13:57:00 -0000	1.436
@@ -443,6 +443,7 @@
 
 	Actor *_actors;	// Has _numActors elements
 	
+	byte *_arraySlot;
 	uint16 *_inventory;
 	uint16 *_newNames;
 	uint16 *_images;
@@ -572,6 +573,7 @@
 	void runScript(int script, bool freezeResistant, bool recursive, int *lvarptr);
 	void stopScript(int script);
 	bool isScriptRunning(int script) const;	// FIXME - should be protected, used by Sound::startTalkSound
+	void nukeArrays(int script);
 
 protected:
 	void runObjectScript(int script, int entry, bool freezeResistant, bool recursive, int *vars, int slot = -1);





More information about the Scummvm-git-logs mailing list