[Scummvm-cvs-logs] CVS: scummvm/scumm script_v90he.cpp,2.108,2.109 intern.h,2.313,2.314

Gregory Montoir cyx at users.sourceforge.net
Sun Nov 21 12:59:02 CET 2004


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

Modified Files:
	script_v90he.cpp intern.h 
Log Message:
o90_unknown24 implementation

Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.108
retrieving revision 2.109
diff -u -d -r2.108 -r2.109
--- script_v90he.cpp	13 Nov 2004 04:05:35 -0000	2.108
+++ script_v90he.cpp	21 Nov 2004 20:55:55 -0000	2.109
@@ -89,7 +89,7 @@
 		OPCODE(o90_atan2),
 		OPCODE(o90_getSegmentAngle),
 		/* 24 */
-		OPCODE(o90_unknown24),
+		OPCODE(o90_getDistanceBetweenPoints),
 		OPCODE(o90_unknown25),
 		OPCODE(o90_unknown26),
 		OPCODE(o90_unknown27),
@@ -831,29 +831,45 @@
 	debug(1,"o90_wizImageOps stub (%d)", subOp);
 }
 
-void ScummEngine_v90he::o90_unknown24() {
+void ScummEngine_v90he::o90_getDistanceBetweenPoints() {
 	byte subOp = fetchScriptByte();
+	int x1, y1, z1, x2, y2, z2, dx, dy, dz, d;
 
 	switch (subOp) {
 	case 28:
-		pop();
-		pop();
-		pop();
-		pop();
+		y2 = pop();
+		x2 = pop();
+		y1 = pop();
+		x1 = pop();
+		dx = x2 - x1;
+		dy = y2 - y1;
+		d = dx * dx + dy * dy;
+		if (d < 2) {
+			push(d);
+		} else {
+			push((int)sqrt((double)(d + 1)));
+		}
 		break;
 	case 29:
-		pop();
-		pop();
-		pop();
-		pop();
-		pop();
-		pop();
+		z2 = pop();
+		y2 = pop();
+		x2 = pop();
+		z1 = pop();
+		y1 = pop();
+		x1 = pop();
+		dx = x2 - x1;
+		dy = y2 - y1;
+		dz = z2 - z1;
+		d = dx * dx + dy * dy + dz * dz;
+		if (d < 2) {
+			push(d);
+		} else {
+			push((int)sqrt((double)(d + 1)));
+		}		
 		break;
 	default:
-		error("o90_unknown24: Unknown case %d", subOp);
+		error("o90_getDistanceBetweenPoints: Unknown case %d", subOp);
 	}
-	push(0);
-	debug(1,"o90_unknown24 stub (%d)", subOp);
 }
 
 void ScummEngine_v90he::o90_unknown25() {

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.313
retrieving revision 2.314
diff -u -d -r2.313 -r2.314
--- intern.h	19 Oct 2004 12:30:40 -0000	2.313
+++ intern.h	21 Nov 2004 20:55:56 -0000	2.314
@@ -888,7 +888,7 @@
 	void o90_startScriptUnk();
 	void o90_jumpToScriptUnk();
 	void o90_wizImageOps();
-	void o90_unknown24();
+	void o90_getDistanceBetweenPoints();
 	void o90_unknown25();
 	void o90_unknown26();
 	void o90_unknown27();





More information about the Scummvm-git-logs mailing list