[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.284,2.285 script_v72he.cpp,2.145,2.146 script_v90he.cpp,2.71,2.72

Travis Howell kirben at users.sourceforge.net
Sat Oct 2 23:17:06 CEST 2004


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

Modified Files:
	intern.h script_v72he.cpp script_v90he.cpp 
Log Message:

Add missing code for opcode


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.284
retrieving revision 2.285
diff -u -d -r2.284 -r2.285
--- intern.h	3 Oct 2004 05:29:31 -0000	2.284
+++ intern.h	3 Oct 2004 06:07:25 -0000	2.285
@@ -716,7 +716,7 @@
 	void drawWizPolygon(int resnum, int state, int id, int flags);
 	void flushWizBuffer();
 
-	int findObject(int x, int y, int *args);
+	int findObject(int x, int y, int num, int *args);
 	virtual void decodeParseString(int a, int b);
 	void decodeScriptString(byte *dst, bool scriptString = false);
 	void copyScriptString(byte *dst);

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.145
retrieving revision 2.146
diff -u -d -r2.145 -r2.146
--- script_v72he.cpp	3 Oct 2004 04:49:20 -0000	2.145
+++ script_v72he.cpp	3 Oct 2004 06:07:25 -0000	2.146
@@ -592,33 +592,58 @@
 	*dst = 0;
 }
 
-int ScummEngine_v72he::findObject(int x, int y, int *args) {
-	int i, b;
+int ScummEngine_v72he::findObject(int x, int y, int num, int *args) {
+	int i, b, result;
+	int cond, cls, tmp;
 	byte a;
 	const int mask = 0xF;
 
 	for (i = 1; i < _numLocalObjects; i++) {
+		result = 0;
 		if ((_objs[i].obj_nr < 1) || getClass(_objs[i].obj_nr, kObjectClassUntouchable))
 			continue;
 
+		// Check polygon bounds
 		if (polygonDefined(_objs[i].obj_nr)) {
 			if (polygonHit(_objs[i].obj_nr, x, y) != 0)
-				return _objs[i].obj_nr;
+				result = _objs[i].obj_nr;
 			else 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;
+		if (!result) {
+			// Check object bounds
+			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)
+						result = _objs[i].obj_nr;
+					break;
+				}
+			} while ((_objs[b].state & mask) == a);
+		}
+
+
+		if (result) {
+			if (!num)
+				return result;
+
+			// Check object class
+			cond = 1;
+			tmp = num;
+			while (--tmp >= 0) {
+				cls = args[tmp];
+				b = getClass(i, cls);
+				if ((cls & 0x80 && !b) || (!(cls & 0x80) && b))
+					cond = 0;
 			}
-		} while ((_objs[b].state & mask) == a);
+
+			if (cond)
+				return result;
+		}
 	}
 
 	return 0;
@@ -707,12 +732,12 @@
 }
 
 void ScummEngine_v72he::o72_findObjectWithClassOf() {
-	int args[16];
+	int args[16], num;
 
-	getStackList(args, ARRAYSIZE(args));
+	num = getStackList(args, ARRAYSIZE(args));
 	int y = pop();
 	int x = pop();
-	int r = findObject(x, y, args);
+	int r = findObject(x, y, num, args);
 	push(r);
 }
 
@@ -1338,7 +1363,7 @@
 void ScummEngine_v72he::o72_findObject() {
 	int y = pop();
 	int x = pop();
-	int r = findObject(x, y, 0);
+	int r = findObject(x, y, 0, 0);
 	push(r);
 }
 
@@ -1417,16 +1442,18 @@
 		len |= dim2end;
 		len = len - dim2end + 1;
 		offs = (b >= c) ? 1 : -1;
+		tmp2 = c;
+		tmp3 = len;
 		while (dim2start <= dim2end) {
 			tmp = dim1start;
-			tmp2 = c;
-			tmp3 = len;
 			while (tmp <= dim1end) {
 				writeArray(array, dim2start, tmp, tmp2);
-				if (--tmp3 == 0)
+				if (--tmp3 == 0) {
 					tmp2 = c;
-				else
+					tmp3 = len;
+				} else {
 					tmp2 += offs;
+				}
 				tmp++;
 			}
 			dim2start++;

Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.71
retrieving revision 2.72
diff -u -d -r2.71 -r2.72
--- script_v90he.cpp	3 Oct 2004 05:34:48 -0000	2.71
+++ script_v90he.cpp	3 Oct 2004 06:07:25 -0000	2.72
@@ -1067,9 +1067,8 @@
 
 void ScummEngine_v90he::o90_findAllObjectsWithClassOf() {
 	int args[16];
-	int num, cls, tmp;
+	int cond, num, cls, tmp;
 	bool b;
-	int cond = 1;
 
 	num = getStackList(args, ARRAYSIZE(args));
 	int room = pop();
@@ -1077,6 +1076,7 @@
 
 	if (room != _currentRoom)
 		warning("o90_findAllObjectsWithClassOf: current room is not %d", room);
+
 	writeVar(0, 0);
 	defineArray(0, kDwordArray, 0, 0, 0, _numLocalObjects + 1);
 	for (int i = 1; i < _numLocalObjects; i++) {





More information about the Scummvm-git-logs mailing list