[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.251,2.252 saveload.cpp,1.173,1.174 saveload.h,1.42,1.43 script_v72he.cpp,2.93,2.94 script_v7he.cpp,2.86,2.87 script_v80he.cpp,2.22,2.23 script_v90he.cpp,2.33,2.34 scumm.cpp,1.200,1.201 scumm.h,1.479,1.480 vars.cpp,1.101,1.102

Travis Howell kirben at users.sourceforge.net
Tue Sep 14 08:07:05 CEST 2004


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

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

Save polygons
Move findObject changes to HE72


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.251
retrieving revision 2.252
diff -u -d -r2.251 -r2.252
--- intern.h	14 Sep 2004 12:05:00 -0000	2.251
+++ intern.h	14 Sep 2004 15:06:00 -0000	2.252
@@ -631,7 +631,6 @@
 	void o7_pickupObject();
 	void o7_getActorRoom();
 	void o7_resourceRoutines();
-	void o7_findObject();
 	void o7_quitPauseRestart();
 	void o7_kernelSetFunctions();
 	void o7_unknownED();
@@ -709,6 +708,7 @@
 	void drawWizImage(int restype, int resnum, int state, int x1, int y1, int flags);
 	void flushWizBuffer();
 
+	int findObject(int x, int y, int *args);
 	virtual void decodeParseString(int a, int b);
 	void decodeScriptString(byte *dst, bool scriptString = false);
 	void copyScriptString(byte *dst);
@@ -724,7 +724,7 @@
 	void o72_wordArrayIndexedWrite();
 	void o72_compareStackList();
 	void o72_unknown50();
-	void o72_findObject();
+	void o72_findObjectWithClassOf();
 	void o72_wordArrayInc();
 	void o72_objectX();
 	void o72_objectY();
@@ -740,6 +740,7 @@
 	void o72_getNumFreeArrays();
 	void o72_actorOps();
 	void o72_verbOps();
+	void o72_findObject();
 	void o72_arrayOps();
 	void o72_dimArray();
 	void o72_dim2dimArray();

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.173
retrieving revision 1.174
diff -u -d -r1.173 -r1.174
--- saveload.cpp	12 Sep 2004 12:18:46 -0000	1.173
+++ saveload.cpp	14 Sep 2004 15:06:00 -0000	1.174
@@ -364,6 +364,27 @@
 }
 
 void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) {
+	const SaveLoadEntry polygonEntries[] = {
+		MKLINE(WizPolygon, vert[0].x, sleInt16, VER(40)),
+		MKLINE(WizPolygon, vert[0].y, sleInt16, VER(40)),
+		MKLINE(WizPolygon, vert[1].x, sleInt16, VER(40)),
+		MKLINE(WizPolygon, vert[1].y, sleInt16, VER(40)),
+		MKLINE(WizPolygon, vert[2].x, sleInt16, VER(40)),
+		MKLINE(WizPolygon, vert[2].y, sleInt16, VER(40)),
+		MKLINE(WizPolygon, vert[3].x, sleInt16, VER(40)),
+		MKLINE(WizPolygon, vert[3].y, sleInt16, VER(40)),
+		MKLINE(WizPolygon, vert[4].x, sleInt16, VER(40)),
+		MKLINE(WizPolygon, vert[4].y, sleInt16, VER(40)),
+		MKLINE(WizPolygon, bound.left, sleInt16, VER(40)),
+		MKLINE(WizPolygon, bound.top, sleInt16, VER(40)),
+		MKLINE(WizPolygon, bound.right, sleInt16, VER(40)),
+		MKLINE(WizPolygon, bound.bottom, sleInt16, VER(40)),
+		MKLINE(WizPolygon, id, sleInt16, VER(40)),
+		MKLINE(WizPolygon, numVerts, sleInt16, VER(40)),
+		MKLINE(WizPolygon, flag, sleByte, VER(40)),
+		MKEND()
+	};
+
 	const SaveLoadEntry objectEntries[] = {
 		MKLINE(ObjectData, OBIMoffset, sleUint32, VER(8)),
 		MKLINE(ObjectData, OBCDoffset, sleUint32, VER(8)),
@@ -696,6 +717,7 @@
 	else
 		s->saveLoadArrayOf(vm.slot, NUM_SCRIPT_SLOT, sizeof(vm.slot[0]), scriptSlotEntries);
 
+	s->saveLoadArrayOf(_WizPolygons, 200, sizeof(_WizPolygons[0]), polygonEntries);
 	s->saveLoadArrayOf(_objs, _numLocalObjects, sizeof(_objs[0]), objectEntries);
 	if (s->isLoading() && savegameVersion < VER(13)) {
 		// Since roughly v13 of the save games, the objs storage has changed a bit

Index: saveload.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- saveload.h	10 Sep 2004 12:13:03 -0000	1.42
+++ saveload.h	14 Sep 2004 15:06:01 -0000	1.43
@@ -32,7 +32,7 @@
 // Can be useful for other ports too :)
 
 #define VER(x) x
-#define CURRENT_VER 39
+#define CURRENT_VER 40
 
 // To work around a warning in GCC 3.2 (and 3.1 ?) regarding non-POD types,
 // we use a small trick: instead of 0 we use 42. Why? Well, it seems newer GCC

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.93
retrieving revision 2.94
diff -u -d -r2.93 -r2.94
--- script_v72he.cpp	14 Sep 2004 10:46:09 -0000	2.93
+++ script_v72he.cpp	14 Sep 2004 15:06:01 -0000	2.94
@@ -147,7 +147,7 @@
 		/* 50 */
 		OPCODE(o72_unknown50),
 		OPCODE(o6_invalid),
-		OPCODE(o72_findObject),
+		OPCODE(o72_findObjectWithClassOf),
 		OPCODE(o72_wordArrayInc),
 		/* 54 */
 		OPCODE(o72_objectX),
@@ -245,7 +245,7 @@
 		OPCODE(o72_verbOps),
 		OPCODE(o6_getActorFromXY),
 		/* A0 */
-		OPCODE(o6_findObject),
+		OPCODE(o72_findObject),
 		OPCODE(o6_pseudoRoom),
 		OPCODE(o6_getActorElevation),
 		OPCODE(o6_getVerbEntrypoint),
@@ -565,6 +565,38 @@
 	*dst = 0;
 }
 
+int ScummEngine_v72he::findObject(int x, int y, int *args) {
+	int i, b;
+	byte a;
+	const int mask = 0xF;
+
+	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)
+				return _objs[i].obj_nr;
+
+		//if (VAR(VAR_POLYGONS_ONLY))
+		//	continue;
+
+		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)
+					return _objs[i].obj_nr;
+				break;
+			}
+		} while ((_objs[b].state & mask) == a);
+	}
+
+	return 0;
+}
+
 const byte *ScummEngine_v72he::findWrappedBlock(uint32 tag, const byte *ptr, int state, bool errorFlag) {
 	if (READ_UINT32(ptr) == MKID('MULT')) {
 		error("findWrappedBlock: multi blocks aren't implemented");
@@ -644,13 +676,13 @@
 	VAR(VAR_OVERRIDE) = 0;
 }
 
-void ScummEngine_v72he::o72_findObject() {
+void ScummEngine_v72he::o72_findObjectWithClassOf() {
 	int args[16];
 
 	getStackList(args, ARRAYSIZE(args));
 	int y = pop();
 	int x = pop();
-	int r = findObject(x, y);
+	int r = findObject(x, y, args);
 	push(r);
 }
 
@@ -1145,6 +1177,13 @@
 	}
 }
 
+void ScummEngine_v72he::o72_findObject() {
+	int y = pop();
+	int x = pop();
+	int r = findObject(x, y, 0);
+	push(r);
+}
+
 void ScummEngine_v72he::o72_arrayOps() {
 	byte subOp = fetchScriptByte();
 	int array = fetchScriptWord();

Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.86
retrieving revision 2.87
diff -u -d -r2.86 -r2.87
--- script_v7he.cpp	14 Sep 2004 10:46:09 -0000	2.86
+++ script_v7he.cpp	14 Sep 2004 15:06:01 -0000	2.87
@@ -246,7 +246,7 @@
 		OPCODE(o6_verbOps),
 		OPCODE(o6_getActorFromXY),
 		/* A0 */
-		OPCODE(o7_findObject),
+		OPCODE(o6_findObject),
 		OPCODE(o6_pseudoRoom),
 		OPCODE(o6_getActorElevation),
 		OPCODE(o6_getVerbEntrypoint),
@@ -699,43 +699,6 @@
 	}
 }
 
-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;
@@ -1098,8 +1061,8 @@
 	_WizPolygons[i].vert[3].y = vert4y;
 	_WizPolygons[i].vert[4].x = vert1x;
 	_WizPolygons[i].vert[4].y = vert1y;
-	_WizPolygons[i].numVerts = 5;
 	_WizPolygons[i].id = id;
+	_WizPolygons[i].numVerts = 5;
 	_WizPolygons[i].flag = flag;
 
 	_WizPolygons[i].bound.left = 10000;

Index: script_v80he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v80he.cpp,v
retrieving revision 2.22
retrieving revision 2.23
diff -u -d -r2.22 -r2.23
--- script_v80he.cpp	14 Sep 2004 12:55:48 -0000	2.22
+++ script_v80he.cpp	14 Sep 2004 15:06:01 -0000	2.23
@@ -147,7 +147,7 @@
 		/* 50 */
 		OPCODE(o72_unknown50),
 		OPCODE(o6_invalid),
-		OPCODE(o72_findObject),
+		OPCODE(o72_findObjectWithClassOf),
 		OPCODE(o72_wordArrayInc),
 		/* 54 */
 		OPCODE(o72_objectX),
@@ -245,7 +245,7 @@
 		OPCODE(o72_verbOps),
 		OPCODE(o6_getActorFromXY),
 		/* A0 */
-		OPCODE(o7_findObject),
+		OPCODE(o72_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.33
retrieving revision 2.34
diff -u -d -r2.33 -r2.34
--- script_v90he.cpp	14 Sep 2004 12:05:00 -0000	2.33
+++ script_v90he.cpp	14 Sep 2004 15:06:01 -0000	2.34
@@ -147,7 +147,7 @@
 		/* 50 */
 		OPCODE(o72_unknown50),
 		OPCODE(o6_invalid),
-		OPCODE(o72_findObject),
+		OPCODE(o72_findObjectWithClassOf),
 		OPCODE(o72_wordArrayInc),
 		/* 54 */
 		OPCODE(o72_objectX),
@@ -245,7 +245,7 @@
 		OPCODE(o90_unknown9E),
 		OPCODE(o6_getActorFromXY),
 		/* A0 */
-		OPCODE(o7_findObject),
+		OPCODE(o72_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.200
retrieving revision 1.201
diff -u -d -r1.200 -r1.201
--- scumm.cpp	14 Sep 2004 12:17:15 -0000	1.200
+++ scumm.cpp	14 Sep 2004 15:06:01 -0000	1.201
@@ -845,6 +845,7 @@
 	VAR_NUM_CHARSETS = 0xFF;
 	VAR_NUM_GLOBAL_OBJS = 0xFF;
 	VAR_NUM_SPRITES = 0xFF;
+	VAR_POLYGONS_ONLY = 0xFF;
 	VAR_WINDOWS_VERSION = 0xFF;
 
 	// Use g_scumm from error() ONLY

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.479
retrieving revision 1.480
diff -u -d -r1.479 -r1.480
--- scumm.h	14 Sep 2004 06:21:11 -0000	1.479
+++ scumm.h	14 Sep 2004 15:06:01 -0000	1.480
@@ -1326,6 +1326,7 @@
 	byte VAR_NUM_CHARSETS;
 	byte VAR_NUM_GLOBAL_OBJS;
 	byte VAR_NUM_SPRITES;
+	byte VAR_POLYGONS_ONLY;
 	byte VAR_WINDOWS_VERSION;
 };
 

Index: vars.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/vars.cpp,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -d -r1.101 -r1.102
--- vars.cpp	10 Sep 2004 11:01:17 -0000	1.101
+++ vars.cpp	14 Sep 2004 15:06:02 -0000	1.102
@@ -255,6 +255,7 @@
 	VAR_NUM_IMAGES = 72;
 	VAR_NUM_CHARSETS = 73;
 	VAR_NUM_GLOBAL_OBJS = 74;
+	VAR_POLYGONS_ONLY = 76;
 
 	if (_heversion >= 80)
 		VAR_WINDOWS_VERSION = 79;





More information about the Scummvm-git-logs mailing list