[Scummvm-cvs-logs] CVS: scummvm/scumm script_v2.cpp,2.50,2.51 script_v5.cpp,1.72,1.73

Max Horn fingolfin at users.sourceforge.net
Thu May 8 07:15:04 CEST 2003


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

Modified Files:
	script_v2.cpp script_v5.cpp 
Log Message:
fixed o2_resourceRoutines

Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.50
retrieving revision 2.51
diff -u -d -r2.50 -r2.51
--- script_v2.cpp	8 May 2003 06:17:30 -0000	2.50
+++ script_v2.cpp	8 May 2003 14:14:37 -0000	2.51
@@ -689,63 +689,39 @@
 }
 
 void Scumm_v2::o2_resourceRoutines() {
+	const ResTypes resTypes[] = {
+			rtNumTypes,	// Unknown / invalid
+			rtNumTypes,	// Unknown / invalid
+			rtCostume,
+			rtRoom,
+			rtNumTypes,	// Unknown / invalid
+			rtScript,
+			rtSound
+		};
 	int resid = getVarOrDirectByte(0x80);
 	int opcode = fetchScriptByte();
 
+	ResTypes type = rtNumTypes;
+	if (0 <= (opcode >> 4) && (opcode >> 4) < (int)ARRAYSIZE(resTypes))
+		type = resTypes[opcode >> 4];
+
+	if (type == rtNumTypes) {
+		warning("o2_resourceRoutines: unknown restype %d", (opcode >> 4));
+		return;
+	}
+
 	if (((opcode & 0x0f) == 0) || ((opcode & 0x0f) == 1)) {
-		switch (opcode & 0xf1) {
-		case 96:
-			lock(rtSound, resid);
-			return;
-		case 97:
-			unlock(rtSound, resid);
-			return;
-		case 80:
-			lock(rtScript, resid);
-			return;
-		case 81:
-			unlock(rtScript, resid);
-			return;
-		case 32:
-			lock(rtCostume, resid);
-			return;
-		case 33:
-			unlock(rtCostume, resid);
-			return;
-		case 48:
-			lock(rtRoom, resid);
-			return;
-		case 49:
-			unlock(rtRoom, resid);
-			return;
-		default:
-			error("o2_resourceRoutines: unknown lock/unlock opcode %d", (opcode & 0xF1));
+		if (opcode & 1) {
+			ensureResourceLoaded(type, resid);
+		} else {
+			// Seems the nuke opcodes do nothing?
+			warning("o2_resourceRoutines: nuking resType %d, id %d does nothing", type, resid);
 		}
 	} else {
-		switch (opcode & 0xf1) {
-		// FIXME why is this case happening?
-		case 0:
-			warning("o2_resourceRoutines: unknown lock/unlock opcode 0");
-			return;
-		case 96:
-		case 80:
-		case 32:
-		case 48:
-			return;
-		case 97:
-			ensureResourceLoaded(rtSound, resid);
-			return;
-		case 81:
-			ensureResourceLoaded(rtScript, resid);
-			return;
-		case 33:
-			ensureResourceLoaded(rtCostume, resid);
-			return;
-		case 49:
-			ensureResourceLoaded(rtRoom, resid);
-			return;
-		default:
-			error("o2_resourceRoutines: unknown load/nuke opcode %d", (opcode & 0xF1));
+		if (opcode & 1) {
+			lock(type, resid);
+		} else {
+			unlock(type, resid);
 		}
 	}
 }

Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- script_v5.cpp	8 May 2003 00:28:05 -0000	1.72
+++ script_v5.cpp	8 May 2003 14:14:37 -0000	1.73
@@ -695,7 +695,8 @@
 }
 
 void Scumm_v5::o5_debug() {
-	getVarOrDirectWord(0x80);
+	int a = getVarOrDirectWord(0x80);
+	debug(1, "o5_debug(%d)", a);
 }
 
 void Scumm_v5::o5_decrement() {





More information about the Scummvm-git-logs mailing list