[Scummvm-cvs-logs] CVS: scummvm/scumm script_v6.cpp,1.135,1.136 script_v8.cpp,2.169,2.170

Max Horn fingolfin at users.sourceforge.net
Wed May 28 07:03:31 CEST 2003


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

Modified Files:
	script_v6.cpp script_v8.cpp 
Log Message:
cleanup; added hackish fix for bug #744441

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- script_v6.cpp	26 May 2003 22:37:36 -0000	1.135
+++ script_v6.cpp	28 May 2003 14:01:54 -0000	1.136
@@ -2031,14 +2031,19 @@
 }
 
 void Scumm_v6::o6_wait() {
-	switch (fetchScriptByte()) {
-	case 168:{
-		Actor *a = derefActor(pop(), "o6_wait");
-		int offs = (int16)fetchScriptWord();
+	int actnum;
+	int offs = -2;
+	Actor *a;
+	byte subOp = fetchScriptByte();
+
+	switch (subOp) {
+	case 168:
+		offs = fetchScriptWordSigned();
+		actnum = pop();
+		a = derefActor(actnum, "o6_wait:168");
 		if (a->isInCurrentRoom() && a->moving) {
 			_scriptPointer += offs;
 			o6_breakHere();
-		}
 		return;
 	}
 	case 169:
@@ -2057,11 +2062,11 @@
 			break;
 		return;
 	case 170:
-		if (!(_features & GF_AFTER_V7)) {
-			if (camera._cur.x >> 3 != camera._dest.x >> 3)
+		if (_features & GF_AFTER_V7) {
+			if (camera._dest != camera._cur)
 				break;
 		} else {
-			if (camera._dest != camera._cur)
+			if (camera._cur.x >> 3 != camera._dest.x >> 3)
 				break;
 		}
 
@@ -2075,31 +2080,42 @@
 		if (!isScriptInUse(VAR(VAR_SENTENCE_SCRIPT)))
 			return;
 		break;
-	case 226:{										/* wait until actor drawn */
-			int actnum = pop();
-			Actor *a = derefActor(actnum, "o6_wait:226");
-			int offs = fetchScriptWordSigned();
-			if (a->isInCurrentRoom() && a->needRedraw) {
-				_scriptPointer += offs;
-				o6_breakHere();
-			}
-			return;
+	case 226:										/* wait until actor drawn */
+		offs = fetchScriptWordSigned();
+		actnum = pop();
+		a = derefActor(actnum, "o6_wait:226");
+		if (a->isInCurrentRoom() && a->needRedraw) {
+			_scriptPointer += offs;
+			o6_breakHere();
 		}
-	case 232:{										/* wait until actor stops turning */
-			int actnum = pop();
-			Actor *a = derefActor(actnum, "o6_wait:232");
-			int offs = fetchScriptWordSigned();
-			if (a->isInCurrentRoom() && a->moving & MF_TURN) {
-				_scriptPointer += offs;
-				o6_breakHere();
-			}
-			return;
+		return;
+	case 232:										/* wait until actor stops turning */
+		// FIXME: This opcode is really odd. It's used a lot in The Dig.
+		// But sometimes it receives the actor ID as params, and sometimes an
+		// angle. However in (almost?) all cases, just before calling it, _curActor
+		// is set, so we can use it. I tried to add code that detects if an angle
+		// is passed, and if so, wait till that angle is reached, but that leads to hangs.
+		// It would be very good if somebody could disassmble the original code
+		// for this opcode so that we could figure out what's really going on here.
+		//
+		// For now, if the value passed in is divisible by 45, assume it is an
+		// angle, and use _curActor as the actor to wait for.
+		offs = fetchScriptWordSigned();
+		actnum = pop();
+		if (actnum % 45 == 0) {
+			actnum = _curActor;
+		}
+		a = derefActor(actnum, "o6_wait:232b");
+		if (a->isInCurrentRoom() && a->moving & MF_TURN) {
+			_scriptPointer += offs;
+			o6_breakHere();
 		}
+		return;
 	default:
-		error("o6_wait: default case");
+		error("o6_wait: default case 0x%x", subOp);
 	}
 
-	_scriptPointer -= 2;
+	_scriptPointer += offs;
 	o6_breakHere();
 }
 

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.169
retrieving revision 2.170
diff -u -d -r2.169 -r2.170
--- script_v8.cpp	27 May 2003 15:33:37 -0000	2.169
+++ script_v8.cpp	28 May 2003 14:01:54 -0000	2.170
@@ -631,7 +631,8 @@
 }
 
 void Scumm_v8::o8_wait() {
-	int actnum, offs;
+	int actnum;
+	int offs = -2;
 	Actor *a;
 	byte subOp = fetchScriptByte();
 
@@ -684,7 +685,7 @@
 		error("o8_wait: default case 0x%x", subOp);
 	}
 
-	_scriptPointer -= 2;
+	_scriptPointer += offs;
 	o6_breakHere();
 }
 





More information about the Scummvm-git-logs mailing list