[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.297,2.298 script_v100he.cpp,2.2,2.3 script_v7he.cpp,2.102,2.103 script_v90he.cpp,2.86,2.87

Gregory Montoir cyx at users.sourceforge.net
Sat Oct 9 09:14:02 CEST 2004


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

Modified Files:
	intern.h script_v100he.cpp script_v7he.cpp script_v90he.cpp 
Log Message:
o90_getPolygonOverlap update

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.297
retrieving revision 2.298
diff -u -d -r2.297 -r2.298
--- intern.h	9 Oct 2004 14:33:30 -0000	2.297
+++ intern.h	9 Oct 2004 16:10:53 -0000	2.298
@@ -625,7 +625,7 @@
 	void arrrays_unk2(int dst, int src, int len2, int len);
 
 	void polygonErase(int fromId, int toId);
-	bool polygonContains(WizPolygon &pol, int x, int y);
+	bool polygonContains(const WizPolygon &pol, int x, int y);
 	bool polygonDefined(int id);
 	int polygonHit(int id, int x, int y);
 

Index: script_v100he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v100he.cpp,v
retrieving revision 2.2
retrieving revision 2.3
diff -u -d -r2.2 -r2.3
--- script_v100he.cpp	9 Oct 2004 16:03:14 -0000	2.2
+++ script_v100he.cpp	9 Oct 2004 16:10:53 -0000	2.3
@@ -1358,7 +1358,8 @@
 		break;
 	case 81:
 		pop();
-		break;	default:
+		break;
+	default:
 		error("o100_unknown25: Unknown case %d", subOp);
 	}
 	push(0);

Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.102
retrieving revision 2.103
diff -u -d -r2.102 -r2.103
--- script_v7he.cpp	9 Oct 2004 14:33:31 -0000	2.102
+++ script_v7he.cpp	9 Oct 2004 16:10:53 -0000	2.103
@@ -1017,7 +1017,7 @@
 	return false;
 }
 
-bool ScummEngine_v70he::polygonContains(WizPolygon &pol, int x, int y) {
+bool ScummEngine_v70he::polygonContains(const WizPolygon &pol, int x, int y) {
 	int pi = pol.numVerts - 1;
 	bool diry = (y < pol.vert[pi].y);
 	bool curdir;

Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.86
retrieving revision 2.87
diff -u -d -r2.86 -r2.87
--- script_v90he.cpp	9 Oct 2004 05:15:12 -0000	2.86
+++ script_v90he.cpp	9 Oct 2004 16:10:53 -0000	2.87
@@ -1175,31 +1175,80 @@
 }
 
 void ScummEngine_v90he::o90_getPolygonOverlap() {
-	// Polygons related
-	int args[32];
+	int args1[32];
 	int args2[32];
 
-	getStackList(args, ARRAYSIZE(args));
+	int n1 = getStackList(args1, ARRAYSIZE(args1));
 	getStackList(args2, ARRAYSIZE(args2));
 
 	int subOp = pop();
 
 	switch (subOp) {
 	case 1:
+		{
+			Common::Rect r(args1[0], args1[1], args1[2] + 1, args1[3] + 1);
+			Common::Point p(args2[0], args2[1]);
+			push(r.contains(p) ? 1 : 0);
+		}
+		break;
 	case 2:
+		{
+			int dx = args2[0] - args1[0];
+			int dy = args2[1] - args1[1];
+			int dist = dx * dx + dy * dy;
+			if (dist >= 2) {
+				dist = (int)sqrt(dist + 1);
+			}
+			push((dist > args1[2]) ? 1 : 0);
+		}
+		break;
 	case 3:
+		{
+			Common::Rect r1(args1[0], args1[1], args1[2] + 1, args1[3] + 1);
+			Common::Rect r2(args2[0], args2[1], args2[2] + 1, args2[3] + 1);
+			push(r2.intersects(r1) ? 1 : 0);			
+		}
+		break;
 	case 4:
+		{
+			int dx = args2[0] - args1[0];
+			int dy = args2[1] - args1[1];
+			int dist = dx * dx + dy * dy;
+			if (dist >= 2) {
+				dist = (int)sqrt(dist + 1);
+			}
+			push((dist < args1[2] && dist < args2[2]) ? 1 : 0);
+		}
+		break;
 	case 5:
+		{
+			assert((n1 & 1) == 0);
+			n1 /= 2;
+			if (n1 == 0) {
+				push(0);
+			} else {
+				WizPolygon wp;
+				memset(&wp, 0, sizeof(wp));
+				wp.numVerts = n1;
+				assert(n1 < ARRAYSIZE(wp.vert));
+				for (int i = 0; i < n1; ++i) {
+					wp.vert[i].x = args1[i * 2 + 0];
+					wp.vert[i].y = args1[i * 2 + 1];
+				}
+				push(polygonContains(wp, args2[0], args2[1]) ? 1 : 0);
+			}
+		}
+		break;
 	// HE 98+
 	case 6:
 	case 7:
 	case 8:
 	case 9:
+		push(0);
 		break;
 	default:
 		error("o90_getPolygonOverlap: default case %d", subOp);
 	}
-	push(0);
 }
 
 void ScummEngine_v90he::o90_unknown36() {





More information about the Scummvm-git-logs mailing list