[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.419,2.420 script.cpp,1.211,1.212 script_v6he.cpp,2.147,2.148 script_v80he.cpp,2.85,2.86 scumm.cpp,1.400,1.401 scumm.h,1.563,1.564

kirben kirben at users.sourceforge.net
Tue Apr 5 04:07:08 CEST 2005


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

Modified Files:
	intern.h script.cpp script_v6he.cpp script_v80he.cpp scumm.cpp 
	scumm.h 
Log Message:

getScriptSlot() must start from slot 1, required for nukeArrays() in HE games.


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.419
retrieving revision 2.420
diff -u -d -r2.419 -r2.420
--- intern.h	4 Apr 2005 11:47:34 -0000	2.419
+++ intern.h	5 Apr 2005 11:05:56 -0000	2.420
@@ -630,7 +630,7 @@
 	virtual void executeOpcode(byte i);
 	virtual const char *getOpcodeDesc(byte i);
 
-	void localizeArray(int slot, byte script);
+	void localizeArray(int slot, byte scriptSlot);
 	void redimArray(int arrayId, int newX, int newY, int d);
 	int readFileToArray(int slot, int32 size);
 	void writeFileFromArray(int slot, int resID);

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -d -r1.211 -r1.212
--- script.cpp	31 Mar 2005 21:38:49 -0000	1.211
+++ script.cpp	5 Apr 2005 11:05:57 -0000	1.212
@@ -224,7 +224,7 @@
 					error("Script %d stopped with active cutscene/override", script);
 			ss->number = 0;
 			ss->status = ssDead;
-			nukeArrays(script);
+			nukeArrays(i);
 			if (_currentScript == i)
 				_currentScript = 0xFF;
 		}
@@ -236,7 +236,7 @@
 	while (num > 0) {
 		if (nest->number == script &&
 				(nest->where == WIO_GLOBAL || nest->where == WIO_LOCAL)) {
-			nukeArrays(script);
+			nukeArrays(nest->slot);
 			nest->number = 0xFF;
 			nest->slot = 0xFF;
 			nest->where = 0xFF;
@@ -264,7 +264,7 @@
 					error("Object %d stopped with active cutscene/override", script);
 			ss->number = 0;
 			ss->status = ssDead;
-			nukeArrays(script);
+			nukeArrays(i);
 			if (_currentScript == i)
 				_currentScript = 0xFF;
 		}
@@ -276,7 +276,7 @@
 	while (num > 0) {
 		if (nest->number == script &&
 				(nest->where == WIO_ROOM || nest->where == WIO_INVENTORY || nest->where == WIO_FLOBJECT)) {
-			nukeArrays(script);
+			nukeArrays(nest->slot);
 			nest->number = 0xFF;
 			nest->slot = 0xFF;
 			nest->where = 0xFF;
@@ -288,12 +288,12 @@
 
 /* Return a free script slot */
 int ScummEngine::getScriptSlot() {
-	ScriptSlot *ss;
+	ScriptSlot *s;
 	int i;
 
-	ss = vm.slot;
-	for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) {
-		if (ss->status == ssDead)
+	for (i = 1; i < NUM_SCRIPT_SLOT; i++) {
+		s = &vm.slot[i];
+		if (s->status == ssDead)
 			return i;
 	}
 	error("Too many scripts running, %d max", NUM_SCRIPT_SLOT);
@@ -356,14 +356,14 @@
 }
 
 /* Nuke arrays based on script */
-void ScummEngine::nukeArrays(byte script) {
+void ScummEngine::nukeArrays(byte scriptSlot) {
 	int i;
 
-	if (_heversion < 60 || script == 0)
+	if (_heversion < 60 || scriptSlot == 0)
 		return;
 
 	for (i = 1; i < _numArray; i++) {
-		if (_arraySlot[i] == script) {
+		if (_arraySlot[i] == scriptSlot) {
 			res.nukeResource(rtString, i);
 			_arraySlot[i] = 0;
 		}
@@ -703,7 +703,7 @@
 			ss->cutsceneOverride = 0;
 		}
 	}
-	nukeArrays(ss->number);
+	nukeArrays(_currentScript);
 	ss->number = 0;
 	ss->status = ssDead;
 	_currentScript = 0xFF;

Index: script_v6he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6he.cpp,v
retrieving revision 2.147
retrieving revision 2.148
diff -u -d -r2.147 -r2.148
--- script_v6he.cpp	1 Apr 2005 23:42:16 -0000	2.147
+++ script_v6he.cpp	5 Apr 2005 11:05:58 -0000	2.148
@@ -1179,16 +1179,16 @@
 	}
 }
 
-void ScummEngine_v60he::localizeArray(int slot, byte script) {
+void ScummEngine_v60he::localizeArray(int slot, byte scriptSlot) {
 	if (slot >= _numArray)
 		error("o60_localizeArrayToScript(%d): array slot out of range", slot);
 
-	_arraySlot[slot] = script;
+	_arraySlot[slot] = scriptSlot;
 }
 
 void ScummEngine_v60he::o60_localizeArrayToScript() {
 	int slot = pop();
-	localizeArray(slot, vm.slot[_currentScript].number);
+	localizeArray(slot, _currentScript);
 }
 
 void ScummEngine_v60he::o60_seekFilePos() {

Index: script_v80he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v80he.cpp,v
retrieving revision 2.85
retrieving revision 2.86
diff -u -d -r2.85 -r2.86
--- script_v80he.cpp	4 Apr 2005 11:47:37 -0000	2.85
+++ script_v80he.cpp	5 Apr 2005 11:06:00 -0000	2.86
@@ -444,7 +444,7 @@
 
 void ScummEngine_v80he::o80_localizeArrayToRoom() {
 	int slot = pop();
-	localizeArray(slot, (byte)0xFFFFFFFF);
+	localizeArray(slot, 0xFF);
 }
 
 void ScummEngine_v80he::o80_readConfigFile() {
@@ -661,9 +661,9 @@
 	if (readVar(value) == 0) {
 		defineArray(value, kDwordArray, 0, 0, 0, num);
 		if (value & 0x8000)
-			localizeArray(readVar(value), (byte)0xFFFFFFFF);
+			localizeArray(readVar(value), 0xFF);
 		else if (value & 0x4000)
-			localizeArray(readVar(value), vm.slot[_currentScript].number);
+			localizeArray(readVar(value), _currentScript);
 
 		if (num > 0) {
 			int16 counter = 0;

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.400
retrieving revision 1.401
diff -u -d -r1.400 -r1.401
--- scumm.cpp	4 Apr 2005 00:16:57 -0000	1.400
+++ scumm.cpp	5 Apr 2005 11:06:00 -0000	1.401
@@ -2136,13 +2136,13 @@
 			if (ss->cutsceneOverride && _version >= 5)
 				error("Object %d stopped with active cutscene/override in exit", ss->number);
 
-			nukeArrays(ss->number);
+			nukeArrays(_currentScript);
 			_currentScript = 0xFF;
 		} else if (ss->where == WIO_LOCAL) {
 			if (ss->cutsceneOverride && _version >= 5)
 				error("Script %d stopped with active cutscene/override in exit", ss->number);
 
-			nukeArrays(ss->number);
+			nukeArrays(_currentScript);
 			_currentScript = 0xFF;
 		}
 	}
@@ -2166,7 +2166,7 @@
 	// For HE80+ games
 	for (i = 0; i < _numRoomVariables; i++)
 		_roomVars[i] = 0;
-	nukeArrays((byte)0xFFFFFFFF);
+	nukeArrays(0xFF);
 
 	for (i = 1; i < _numActors; i++) {
 		_actors[i].hideActor();

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.563
retrieving revision 1.564
diff -u -d -r1.563 -r1.564
--- scumm.h	4 Apr 2005 00:16:58 -0000	1.563
+++ scumm.h	5 Apr 2005 11:06:03 -0000	1.564
@@ -615,7 +615,7 @@
 public:
 	void runScript(int script, bool freezeResistant, bool recursive, int *lvarptr, int cycle = 0);
 	void stopScript(int script);
-	void nukeArrays(byte script);
+	void nukeArrays(byte scriptSlot);
 
 protected:
 	void runObjectScript(int script, int entry, bool freezeResistant, bool recursive, int *vars, int slot = -1, int cycle = 0);





More information about the Scummvm-git-logs mailing list