[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.303,1.304 actor.h,1.69,1.70 boxes.cpp,1.78,1.79

Max Horn fingolfin at users.sourceforge.net
Tue Sep 28 16:15:41 CEST 2004


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

Modified Files:
	actor.cpp actor.h boxes.cpp 
Log Message:
Fix (I hope) for bug #1032964 (INDY3-VGA: actors walking in wrong places)

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.303
retrieving revision 1.304
diff -u -d -r1.303 -r1.304
--- actor.cpp	28 Sep 2004 19:28:57 -0000	1.303
+++ actor.cpp	28 Sep 2004 23:05:44 -0000	1.304
@@ -1663,6 +1663,12 @@
 			break;
 
 		next_box = _vm->getPathToDestBox(_walkbox, walkdata.destbox);
+
+		// WORKAROUND: To fully fix bug #774783, we add a special case 
+		// here, resulting in a different next_box value for Hitler.
+		if ((_vm->_gameId == GID_INDY3) && _vm->_roomResource == 46 && _walkbox == 1 && walkdata.destbox == 0 && number == 9)
+			next_box = 1;
+
 		if (next_box < 0) {
 			moving |= MF_LAST_LEG;
 			return;
@@ -1701,18 +1707,11 @@
 		if (calcMovementFactor(p3))
 			return;
 
-		// FIXME: Fingolfin changed the destbox to curbox, matching walkActor.
-		// Motivation for this was comparision with some MI EGA disasm...
-		// However, that caused a regression in Indy3 (bug #809547).
-		// On the other hand, curbox is needed to fix bug #830106... <sigh>
-		if (_vm->_version >= 3)
-			setBox(walkdata.destbox);
-		else
-			setBox(walkdata.curbox);
+		setBox(walkdata.destbox);
 
 		// FIXME: Ender added this recursion counter as a hack around
 		//        a infinite loop in Maniac V1 - see bug #862245
-		if (loopCtr > 10000) {
+		if (loopCtr > 100) {
 			moving |= MF_LAST_LEG;
 			return;
 		}

Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.h,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- actor.h	28 Sep 2004 19:28:57 -0000	1.69
+++ actor.h	28 Sep 2004 23:05:44 -0000	1.70
@@ -37,12 +37,15 @@
 };
 
 struct ActorWalkData {
-	Common::Point dest;						// Final destination
-	byte destbox;
-	int16 destdir;
-	Common::Point cur;										// Current position
-	byte curbox;
-	Common::Point next;							// Next position on our way to the destination
+	Common::Point dest;           // Final destination point
+	byte destbox;                 // Final destination box
+	int16 destdir;                // Final destination, direction to face at
+
+	Common::Point cur;            // Last position
+	byte curbox;                  // Last box
+
+	Common::Point next;           // Next position on our way to the destination, i.e. our intermediate destination
+
 	Common::Point point3;
 	int32 deltaXFactor, deltaYFactor;
 	uint16 xfrac, yfrac;

Index: boxes.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/boxes.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- boxes.cpp	26 Sep 2004 16:09:17 -0000	1.78
+++ boxes.cpp	28 Sep 2004 23:05:45 -0000	1.79
@@ -735,10 +735,9 @@
 
 	// WORKAROUND #2: In addition to the above, we have to add this special
 	// case to fix the scene in Indy3 where Indy meets Hitler in Berlin.
-	// It's one of the places (or maybe even the only one?). See bug #770690
-	// and also bug #774783.
+	// See bug #770690 and also bug #774783.
 	if ((_gameId == GID_INDY3) && _roomResource == 46 && from == 1 && to == 0)
-		return 1;
+		return 0;
 
 	// Skip up to the matrix data for box 'from'
 	for (i = 0; i < from && boxm < end; i++) {
@@ -1137,24 +1136,28 @@
 	return result;
 }
 
-void Actor::findPathTowardsOld(byte trap1, byte trap2, byte final_trap, Common::Point &p2, Common::Point &p3) {
+void Actor::findPathTowardsOld(byte box1, byte box2, byte finalBox, Common::Point &p2, Common::Point &p3) {
 	Common::Point pt;
 	Common::Point gateA[2];
 	Common::Point gateB[2];
 
-	_vm->getGates(trap1, trap2, gateA, gateB);
+	_vm->getGates(box1, box2, gateA, gateB);
 
 	p2.x = 32000;
 	p3.x = 32000;
 
-	// next box (trap2) = final box?
-	if (trap2 == final_trap) {
-		// Is the actor (x,y) between both gates?
-		if (compareSlope(_pos.x, _pos.y, walkdata.dest.x, walkdata.dest.y, gateA[0].x, gateA[0].y) !=
-				compareSlope(_pos.x, _pos.y, walkdata.dest.x, walkdata.dest.y, gateB[0].x, gateB[0].y) &&
-				compareSlope(_pos.x, _pos.y, walkdata.dest.x, walkdata.dest.y, gateA[1].x, gateA[1].y) !=
-				compareSlope(_pos.x, _pos.y, walkdata.dest.x, walkdata.dest.y, gateB[1].x, gateB[1].y)) {
-			return;
+	// next box (box2) = final box?
+	if (box2 == finalBox) {
+		// In Indy3, the masks (= z-level) have to match, too -- needed for the
+		// 'maze' in the zeppeling (see bug #1032964).
+		if (_vm->_gameId != GID_INDY3 || _vm->getMaskFromBox(box1) == _vm->getMaskFromBox(box2)) {
+			// Is the actor (x,y) between both gates?
+			if (compareSlope(_pos.x, _pos.y, walkdata.dest.x, walkdata.dest.y, gateA[0].x, gateA[0].y) !=
+					compareSlope(_pos.x, _pos.y, walkdata.dest.x, walkdata.dest.y, gateB[0].x, gateB[0].y) &&
+					compareSlope(_pos.x, _pos.y, walkdata.dest.x, walkdata.dest.y, gateA[1].x, gateA[1].y) !=
+					compareSlope(_pos.x, _pos.y, walkdata.dest.x, walkdata.dest.y, gateB[1].x, gateB[1].y)) {
+				return;
+			}
 		}
 	}
 
@@ -1172,13 +1175,13 @@
 
 /**
  * Compute the "gate" between two boxes. The gate is a pair of two lines which
- * both start on box 'trap1' and end on 'trap2'. For both lines, one of its
+ * both start on box 'box1' and end on 'box2'. For both lines, one of its
  * end points is the corner point of one of the two boxes. The other end point
  * is a point on the other point closest to first end point.
  * This way the lines bound a 'corridor' between the two boxes, through which
- * the actor has to walk to get from trap1 to trap2.
+ * the actor has to walk to get from box1 to box2.
  */
-void ScummEngine::getGates(int trap1, int trap2, Common::Point gateA[2], Common::Point gateB[2]) {
+void ScummEngine::getGates(int box1, int box2, Common::Point gateA[2], Common::Point gateB[2]) {
 	int i, j;
 	int dist[8];
 	int minDist[3];
@@ -1191,23 +1194,23 @@
 
 	// For all corner coordinates of the first box, compute the point closest 
 	// to them on the second box (and also compute the distance of these points).
-	getBoxCoordinates(trap1, &coords);
+	getBoxCoordinates(box1, &coords);
 	boxCorner[0] = coords.ul;
 	boxCorner[1] = coords.ur;
 	boxCorner[2] = coords.lr;
 	boxCorner[3] = coords.ll;
 	for (i = 0; i < 4; i++) {
-		dist[i] = getClosestPtOnBox(trap2, boxCorner[i].x, boxCorner[i].y, closestPoint[i].x, closestPoint[i].y);
+		dist[i] = getClosestPtOnBox(box2, boxCorner[i].x, boxCorner[i].y, closestPoint[i].x, closestPoint[i].y);
 	}
 
 	// Now do the same but with the roles of the first and second box swapped.
-	getBoxCoordinates(trap2, &coords);
+	getBoxCoordinates(box2, &coords);
 	boxCorner[4] = coords.ul;
 	boxCorner[5] = coords.ur;
 	boxCorner[6] = coords.lr;
 	boxCorner[7] = coords.ll;
 	for (i = 4; i < 8; i++) {
-		dist[i] = getClosestPtOnBox(trap1, boxCorner[i].x, boxCorner[i].y, closestPoint[i].x, closestPoint[i].y);
+		dist[i] = getClosestPtOnBox(box1, boxCorner[i].x, boxCorner[i].y, closestPoint[i].x, closestPoint[i].y);
 	}
 
 	// Find the three closest "close" points between the two boxes.





More information about the Scummvm-git-logs mailing list