[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.248,2.249 script_v7he.cpp,2.81,2.82 script_v80he.cpp,2.18,2.19 script_v90he.cpp,2.30,2.31 scumm.cpp,1.196,1.197 scumm.h,1.478,1.479

Travis Howell kirben at users.sourceforge.net
Mon Sep 13 23:22:00 CEST 2004


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

Modified Files:
	intern.h script_v7he.cpp script_v80he.cpp script_v90he.cpp 
	scumm.cpp scumm.h 
Log Message:

Load POLD resources in HE80+ games
Some more WIP on polygons


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.248
retrieving revision 2.249
diff -u -d -r2.248 -r2.249
--- intern.h	14 Sep 2004 00:59:59 -0000	2.248
+++ intern.h	14 Sep 2004 06:21:10 -0000	2.249
@@ -620,20 +620,18 @@
 	int getCharsetOffsets(int chr);
 	void arrrays_unk2(int dst, int src, int len2, int len);
 
-	void polygonStore(int id, bool flag, int vert1x, int vert1y, int vert2x, int vert2y, 
-					  int vert3x, int vert3y, int vert4x, int vert4y);
 	void polygonErase(int fromId, int toId);
 	bool polygonContains(WizPolygon &pol, int x, int y);
 	bool polygonDefined(int id);
 	int polygonHit(int id, int x, int y);
 
-
 	/* HE version 70 script opcodes */
 	void o7_cursorCommand();
 	void o7_startSound();
 	void o7_pickupObject();
 	void o7_getActorRoom();
 	void o7_resourceRoutines();
+	void o7_findObject();
 	void o7_quitPauseRestart();
 	void o7_kernelSetFunctions();
 	void o7_unknownED();

Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.81
retrieving revision 2.82
diff -u -d -r2.81 -r2.82
--- script_v7he.cpp	14 Sep 2004 02:56:36 -0000	2.81
+++ script_v7he.cpp	14 Sep 2004 06:21:11 -0000	2.82
@@ -246,7 +246,7 @@
 		OPCODE(o6_verbOps),
 		OPCODE(o6_getActorFromXY),
 		/* A0 */
-		OPCODE(o6_findObject),
+		OPCODE(o7_findObject),
 		OPCODE(o6_pseudoRoom),
 		OPCODE(o6_getActorElevation),
 		OPCODE(o6_getVerbEntrypoint),
@@ -699,6 +699,43 @@
 	}
 }
 
+void ScummEngine_v7he::o7_findObject() {
+	int i, b;
+	byte a;
+	const int mask = 0xF;
+
+	int y = pop();
+	int x = pop();
+
+
+	for (i = 1; i < _numLocalObjects; i++) {
+		if ((_objs[i].obj_nr < 1) || getClass(_objs[i].obj_nr, kObjectClassUntouchable))
+			continue;
+
+		if (polygonDefined(_objs[i].obj_nr)) {
+			if (polygonHit(_objs[i].obj_nr, x, y) != 0) {
+				push(_objs[i].obj_nr);
+				return;
+			}
+		}
+
+		b = i;
+		do {
+			a = _objs[b].parentstate;
+			b = _objs[b].parent;
+			if (b == 0) {
+				if (_objs[i].x_pos <= x && _objs[i].width + _objs[i].x_pos > x &&
+				    _objs[i].y_pos <= y && _objs[i].height + _objs[i].y_pos > y) {
+					push(_objs[i].obj_nr);
+					return;
+				}
+				break;
+			}
+		} while ((_objs[b].state & mask) == a);
+	}
+	push(0);;
+}
+
 void ScummEngine_v7he::o7_quitPauseRestart() {
 	byte subOp = fetchScriptByte();
 	int par1;
@@ -1033,11 +1070,11 @@
 	}
 }
 
-void ScummEngine_v7he::polygonStore(int id, bool flag, int vert1x, int vert1y, int vert2x, 
+void ScummEngine::polygonStore(int id, bool flag, int vert1x, int vert1y, int vert2x, 
 							int vert2y, int vert3x, int vert3y, int vert4x, int vert4y) {
 	int i;
 
-	debug(1, "polygonStore(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d", id, flag, vert1x,
+	debug(1, "polygonStore(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", id, flag, vert1x,
 		  vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y);
 
 	for (i = 0; i < _WizNumPolygons; i++)
@@ -1045,7 +1082,7 @@
 			break;
 	
 	if (i == _WizNumPolygons) {
-		error("ScummEngine_v7he::polygonStore: out of polygon slot, max = %d", 
+		error("ScummEngine::polygonStore: out of polygon slot, max = %d", 
 			  _WizNumPolygons);
 	}
 
@@ -1068,7 +1105,7 @@
 	_WizPolygons[i].bound.right = -10000;
 	_WizPolygons[i].bound.bottom = -10000;
 
-	for (int j = 0; j < 4; j++) {
+	for (int j = 0; j < 5; j++) {
 		_WizPolygons[i].bound.left = MIN(_WizPolygons[i].bound.left, _WizPolygons[i].vert[j].x);
 		_WizPolygons[i].bound.top = MIN(_WizPolygons[i].bound.top, _WizPolygons[i].vert[j].y);
 		_WizPolygons[i].bound.right = MAX(_WizPolygons[i].bound.right, _WizPolygons[i].vert[j].x);
@@ -1131,8 +1168,6 @@
 		diry = curdir;
 	}
 
-	//r = true;
-
 	return r;
 }
 

Index: script_v80he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v80he.cpp,v
retrieving revision 2.18
retrieving revision 2.19
diff -u -d -r2.18 -r2.19
--- script_v80he.cpp	13 Sep 2004 23:24:36 -0000	2.18
+++ script_v80he.cpp	14 Sep 2004 06:21:11 -0000	2.19
@@ -245,7 +245,7 @@
 		OPCODE(o72_verbOps),
 		OPCODE(o6_getActorFromXY),
 		/* A0 */
-		OPCODE(o6_findObject),
+		OPCODE(o7_findObject),
 		OPCODE(o6_pseudoRoom),
 		OPCODE(o6_getActorElevation),
 		OPCODE(o6_getVerbEntrypoint),

Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.30
retrieving revision 2.31
diff -u -d -r2.30 -r2.31
--- script_v90he.cpp	13 Sep 2004 23:24:36 -0000	2.30
+++ script_v90he.cpp	14 Sep 2004 06:21:11 -0000	2.31
@@ -245,7 +245,7 @@
 		OPCODE(o90_unknown9E),
 		OPCODE(o6_getActorFromXY),
 		/* A0 */
-		OPCODE(o6_findObject),
+		OPCODE(o7_findObject),
 		OPCODE(o6_pseudoRoom),
 		OPCODE(o6_getActorElevation),
 		OPCODE(o6_getVerbEntrypoint),

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.196
retrieving revision 1.197
diff -u -d -r1.196 -r1.197
--- scumm.cpp	13 Sep 2004 23:24:36 -0000	1.196
+++ scumm.cpp	14 Sep 2004 06:21:11 -0000	1.197
@@ -2812,7 +2812,7 @@
 		}
 	}
 
-	// Actor Palette in HE 7.0 games
+	// Actor Palette in HE 70 games
 	if (_heversion == 70) {
 		ptr = findResourceData(MKID('REMP'), roomptr);
 		if (ptr) {
@@ -2824,6 +2824,37 @@
 		}
 	}
 			
+	// Polygons in HE 80+ games
+	if (_heversion >= 80) {
+		ptr = findResourceData(MKID('POLD'), roomptr);
+		if (ptr) {
+			int slots = READ_LE_UINT32(ptr);
+			ptr += 4;
+			debug(1, "Loading %d polygon slots\n", slots);
+
+			bool flag = 1;
+			int id, points, vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y;
+			while (slots--) {
+				id = READ_LE_UINT32(ptr);
+				points = READ_LE_UINT32(ptr + 4);
+				if (points != 4)
+					error("Illegal polygon with %d points", points);
+				vert1x = READ_LE_UINT32(ptr + 8);
+				vert1y = READ_LE_UINT32(ptr + 12);
+				vert2x = READ_LE_UINT32(ptr + 16);
+				vert2y = READ_LE_UINT32(ptr + 20);
+				vert3x = READ_LE_UINT32(ptr + 24);
+				vert3y = READ_LE_UINT32(ptr + 28);
+				vert4x = READ_LE_UINT32(ptr + 32);
+				vert4y = READ_LE_UINT32(ptr + 36);
+
+				ptr += 40;
+				polygonStore(id, flag, vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y);
+			}
+		}
+
+	}
+
 	// Transparent color
 	if (_features & GF_OLD_BUNDLE)
 		gdi._transparentColor = 255;

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.478
retrieving revision 1.479
diff -u -d -r1.478 -r1.479
--- scumm.h	13 Sep 2004 23:24:36 -0000	1.478
+++ scumm.h	14 Sep 2004 06:21:11 -0000	1.479
@@ -701,6 +701,8 @@
 	void loadRoomObjects();
 	void loadRoomObjectsSmall();
 	void loadRoomObjectsOldBundle();
+	void polygonStore(int id, bool flag, int vert1x, int vert1y, int vert2x, int vert2y, 
+					  int vert3x, int vert3y, int vert4x, int vert4y);
 
 	virtual void readArrayFromIndexFile();
 	virtual void readMAXS(int blockSize);





More information about the Scummvm-git-logs mailing list