[Scummvm-cvs-logs] CVS: scummvm/scumm script.cpp,1.88,1.89

Max Horn fingolfin at users.sourceforge.net
Sun May 18 13:58:17 CEST 2003


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

Modified Files:
	script.cpp 
Log Message:
consistently index script slots with index 0 (not 1); this fixes bug #739463; made stopScriptNr match stopObjectScript more closely (we could merge them into one function one day)

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- script.cpp	17 May 2003 18:42:31 -0000	1.88
+++ script.cpp	18 May 2003 20:57:32 -0000	1.89
@@ -87,18 +87,17 @@
 	if (script == 0)
 		return;
 
-	ss = &vm.slot[1];
-
-	for (i = 1; i < NUM_SCRIPT_SLOT; i++, ss++) {
-		if (script != ss->number || ss->where != WIO_GLOBAL && ss->where != WIO_LOCAL || ss->status == ssDead)
-			continue;
-
-		if (ss->cutsceneOverride)
-			error("Script %d stopped with active cutscene/override", script);
-		ss->number = 0;
-		ss->status = ssDead;
-		if (_currentScript == i)
-			_currentScript = 0xFF;
+	ss = vm.slot;
+	for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) {
+		if (script == ss->number && ss->status != ssDead &&
+			(ss->where == WIO_GLOBAL && ss->where == WIO_LOCAL)) {
+			if (ss->cutsceneOverride)
+				error("Script %d stopped with active cutscene/override", script);
+			ss->number = 0;
+			ss->status = ssDead;
+			if (_currentScript == i)
+				_currentScript = 0xFF;
+		}
 	}
 
 	if (_numNestedScripts == 0)
@@ -108,7 +107,8 @@
 	num = _numNestedScripts;
 
 	do {
-		if (nest->number == script && (nest->where == WIO_GLOBAL || nest->where == WIO_LOCAL)) {
+		if (nest->number == script &&
+				(nest->where == WIO_GLOBAL || nest->where == WIO_LOCAL)) {
 			nest->number = 0xFF;
 			nest->slot = 0xFF;
 			nest->where = 0xFF;
@@ -125,9 +125,8 @@
 	if (script == 0)
 		return;
 
-	ss = &vm.slot[1];
-
-	for (i = 1; i < NUM_SCRIPT_SLOT; i++, ss++) {
+	ss = vm.slot;
+	for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) {
 		if (script == ss->number && ss->status != ssDead &&
 		    (ss->where == WIO_ROOM || ss->where == WIO_INVENTORY || ss->where == WIO_FLOBJECT)) {
 			if (ss->cutsceneOverride)
@@ -159,9 +158,9 @@
 int Scumm::getScriptSlot() {
 	ScriptSlot *ss;
 	int i;
-	ss = &vm.slot[1];
 
-	for (i = 1; i < NUM_SCRIPT_SLOT; i++, ss++) {
+	ss = vm.slot;
+	for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) {
 		if (ss->status == ssDead)
 			return i;
 	}
@@ -550,7 +549,7 @@
 void Scumm::freezeScripts(int flag) {
 	int i;
 
-	for (i = 1; i < NUM_SCRIPT_SLOT; i++) {
+	for (i = 0; i < NUM_SCRIPT_SLOT; i++) {
 		if (_currentScript != i && vm.slot[i].status != ssDead && (vm.slot[i].unk1 == 0 || flag >= 0x80)) {
 			vm.slot[i].status |= 0x80;
 			vm.slot[i].freezeCount++;
@@ -568,7 +567,7 @@
 
 void Scumm::unfreezeScripts() {
 	int i;
-	for (i = 1; i < NUM_SCRIPT_SLOT; i++) {
+	for (i = 0; i < NUM_SCRIPT_SLOT; i++) {
 		if (vm.slot[i].status & 0x80) {
 			if (!--vm.slot[i].freezeCount) {
 				vm.slot[i].status &= 0x7F;
@@ -662,9 +661,8 @@
 	ScriptSlot *ss;
 	int i;
 
-	ss = &vm.slot[1];
-
-	for (i = 1; i < NUM_SCRIPT_SLOT; i++, ss++) {
+	ss = vm.slot;
+	for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) {
 		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);
@@ -690,7 +688,7 @@
 }
 
 void Scumm::killAllScriptsExceptCurrent() {
-	for (int i = 1; i < NUM_SCRIPT_SLOT; i++) {
+	for (int i = 0; i < NUM_SCRIPT_SLOT; i++) {
 		if (i != _currentScript)
 			vm.slot[i].status = ssDead;
 	}
@@ -794,7 +792,7 @@
 }
 
 void Scumm::decreaseScriptDelay(int amount) {
-	ScriptSlot *ss = &vm.slot[0];
+	ScriptSlot *ss = vm.slot;
 	int i;
 	for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) {
 		if (ss->status == ssPaused) {





More information about the Scummvm-git-logs mailing list