[Scummvm-cvs-logs] CVS: scummvm boxes.cpp,1.39,1.40 actor.cpp,1.108,1.109 boxes.h,1.5,1.6 script_v1.cpp,1.138,1.139

Max Horn fingolfin at users.sourceforge.net
Thu Aug 15 09:47:03 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv4382

Modified Files:
	boxes.cpp actor.cpp boxes.h script_v1.cpp 
Log Message:
first attempt to implement the difference between the box lock and box invisible flag. fixes the counter bug and all of the bugs introduced to my fix for the bus bug; but the bus bug is back, will look into that next

Index: boxes.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/boxes.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- boxes.cpp	12 Aug 2002 16:05:14 -0000	1.39
+++ boxes.cpp	15 Aug 2002 16:46:29 -0000	1.40
@@ -54,6 +54,8 @@
 	PathNode *right;
 };
 
+#define BOX_MATRIX_SIZE 2000
+
 
 PathVertex *unkMatrixProc1(PathVertex *vtx, PathNode *node);
 
@@ -67,6 +69,20 @@
 	return ptr->mask;
 }
 
+void Scumm::setBoxFlags(int box, int val)
+{
+	debug(1, "setBoxFlags(%d, 0x%02x)", box, val);
+
+	/* FULL_THROTTLE stuff */
+	if (val & 0xC000) {
+		assert(box >= 0 && box < 65);
+		_extraBoxFlags[box] = val;
+	} else {
+		Box *b = getBoxBaseAddr(box);
+		b->flags = val;
+	}
+}
+
 byte Scumm::getBoxFlags(int box)
 {
 	Box *ptr = getBoxBaseAddr(box);
@@ -75,6 +91,12 @@
 	return ptr->flags;
 }
 
+void Scumm::setBoxScale(int box, int scale)
+{
+	Box *b = getBoxBaseAddr(box);
+	b->scale = scale;
+}
+
 int Scumm::getBoxScale(int box)
 {
 	if (_features & GF_NO_SCALLING)
@@ -119,7 +141,7 @@
 	for (i = numOfBoxes; i >= 0; i--) {
 		flag = getBoxFlags(i);
 
-		if (!(flag & 0x80) && (flag & 0x20))
+		if (!(flag & kBoxInvisible) && (flag & kBoxPlayerOnly))
 			return (-1);
 
 		if (checkXYInBoxBounds(i, param1, param2))
@@ -541,26 +563,6 @@
 	return false;
 }
 
-void Scumm::setBoxFlags(int box, int val)
-{
-	/* FULL_THROTTLE stuff */
-	if (val & 0xC000) {
-		assert(box >= 0 && box < 65);
-		_extraBoxFlags[box] = val;
-	} else {
-		Box *b = getBoxBaseAddr(box);
-		b->flags = val;
-	}
-}
-
-void Scumm::setBoxScale(int box, int scale)
-{
-	Box *b = getBoxBaseAddr(box);
-	b->scale = scale;
-}
-
-#define BOX_MATRIX_SIZE 2000
-
 void Scumm::createBoxMatrix()
 {
 	byte *matrix_ptr;
@@ -603,7 +605,7 @@
 
 	for (j = 0; j < num; j++) {
 		flags = getBoxFlags(j);
-		if (flags & 0x80) {
+		if (flags & kBoxInvisible) {
 			addToBoxMatrix(0xFF);
 			addToBoxMatrix(j);
 			addToBoxMatrix(j);
@@ -612,7 +614,7 @@
 			vtx = addPathVertex();
 			for (i = 0; i < num; i++) {
 				flags = getBoxFlags(j);
-				if (!(flags & 0x80)) {
+				if (!(flags & kBoxInvisible)) {
 					node = unkMatrixProc2(vtx, i);
 					if (i == j)
 						node2 = node;
@@ -752,7 +754,7 @@
 	BoxCoords box;
 	BoxCoords box2;
 
-	if (getBoxFlags(box1nr) & 0x80 || getBoxFlags(box2nr) & 0x80)
+	if (getBoxFlags(box1nr) & kBoxInvisible || getBoxFlags(box2nr) & kBoxInvisible)
 		return false;
 
 	getBoxCoordinates(box1nr, &box2);

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/actor.cpp,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- actor.cpp	14 Aug 2002 20:43:53 -0000	1.108
+++ actor.cpp	15 Aug 2002 16:46:29 -0000	1.109
@@ -199,12 +199,12 @@
 		flipY = (walkdata.YXFactor > 0);
 
 		// Check for X-Flip
-		if ((flags & 0x08) || isInClass(30)) {
+		if ((flags & kBoxXFlip) || isInClass(30)) {
 			dir = 360 - dir;
 			flipX = !flipX;
 		}
 		// Check for Y-Flip
-		if ((flags & 0x10) || isInClass(29)) {
+		if ((flags & kBoxYFlip) || isInClass(29)) {
 			dir = 180 - dir;
 			flipY = !flipY;
 		}
@@ -348,7 +348,7 @@
 	if (ignoreBoxes != 0)
 		return;
 
-	if (_vm->getBoxFlags(walkbox) & 0x20)
+	if (_vm->getBoxFlags(walkbox) & kBoxPlayerOnly)
 		return;
 
 	scale = _vm->getBoxScale(walkbox);
@@ -587,22 +587,29 @@
 
 			if (!(_vm->_features & GF_OLD256) || box)
 			for (j = box; j >= firstValidBox; j--) {
+				flags = _vm->getBoxFlags(j);
+
+				if (flags & kBoxLocked && (!(flags & kBoxPlayerOnly)))
+					continue;
+
+				if (flags & kBoxInvisible && (!(flags & kBoxPlayerOnly) || isInClass(31)))
+					continue;
+				
 				if (pathfrom >= firstValidBox) {
-					flags = _vm->getBoxFlags(j);
-					if (flags & 0x80 && (!(flags & 0x20) || isInClass(31)))
-						continue;
-	
+
 					i = _vm->getPathToDestBox(pathfrom, j);
 					if (i == -1)
 						continue;
-					
+
 					if (_vm->_features & GF_OLD256) {
 						// FIXME - we check here if the box suggested by getPathToDestBox
 						// is locked or not. This prevents us from walking thru
 						// closed doors in some cases in Zak256. However a better fix
 						// would be to recompute the box matrix whenever flags change.
 						flags = _vm->getBoxFlags(i);
-						if (flags & 0x80 && (!(flags & 0x20) || isInClass(31)))
+						if (flags & kBoxLocked && (!(flags & kBoxPlayerOnly)))
+							continue;
+						if (flags & kBoxInvisible && (!(flags & kBoxPlayerOnly) || isInClass(31)))
 							continue;
 					}
 				}

Index: boxes.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/boxes.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- boxes.h	16 Jul 2002 17:59:28 -0000	1.5
+++ boxes.h	15 Aug 2002 16:46:29 -0000	1.6
@@ -25,8 +25,16 @@
 
 #define SIZEOF_BOX 20
 
+typedef enum {
+	kBoxXFlip		= 0x08,
+	kBoxYFlip		= 0x10,
+	kBoxPlayerOnly	= 0x20,
+	kBoxLocked		= 0x40,
+	kBoxInvisible	= 0x80,
+} BoxFlags;
+
 struct AdjustBoxResult {	/* Result type of AdjustBox functions */
-	int16 x,y;
+	int16 x, y;
 	uint16 dist;
 };
 

Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v1.cpp,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- script_v1.cpp	14 Aug 2002 20:43:55 -0000	1.138
+++ script_v1.cpp	15 Aug 2002 16:46:29 -0000	1.139
@@ -1608,12 +1608,6 @@
 	if (_features & GF_OLD256) {
 		a = getVarOrDirectByte(0x80);
 		b = fetchScriptByte();
-
-		if (b & 0x40) {							// We don't use the locked 
-			b &= ~0x40;								// flag, so convert it to
-			b |= 0x80;								// invisible
-		}
-
 		setBoxFlags(a, b);
 		return;
 	}





More information about the Scummvm-git-logs mailing list