Fix (I hope) for bug #1032964 (INDY3-VGA: actors walking in wrong places)
svn-id: r15335
This commit is contained in:
parent
21d2a6ec55
commit
ad3062ab93
3 changed files with 40 additions and 35 deletions
|
@ -1663,6 +1663,12 @@ void Actor::walkActorOld() {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
next_box = _vm->getPathToDestBox(_walkbox, walkdata.destbox);
|
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) {
|
if (next_box < 0) {
|
||||||
moving |= MF_LAST_LEG;
|
moving |= MF_LAST_LEG;
|
||||||
return;
|
return;
|
||||||
|
@ -1701,18 +1707,11 @@ void Actor::walkActorOld() {
|
||||||
if (calcMovementFactor(p3))
|
if (calcMovementFactor(p3))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// FIXME: Fingolfin changed the destbox to curbox, matching walkActor.
|
setBox(walkdata.destbox);
|
||||||
// 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);
|
|
||||||
|
|
||||||
// FIXME: Ender added this recursion counter as a hack around
|
// FIXME: Ender added this recursion counter as a hack around
|
||||||
// a infinite loop in Maniac V1 - see bug #862245
|
// a infinite loop in Maniac V1 - see bug #862245
|
||||||
if (loopCtr > 10000) {
|
if (loopCtr > 100) {
|
||||||
moving |= MF_LAST_LEG;
|
moving |= MF_LAST_LEG;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,12 +37,15 @@ enum MoveFlags {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ActorWalkData {
|
struct ActorWalkData {
|
||||||
Common::Point dest; // Final destination
|
Common::Point dest; // Final destination point
|
||||||
byte destbox;
|
byte destbox; // Final destination box
|
||||||
int16 destdir;
|
int16 destdir; // Final destination, direction to face at
|
||||||
Common::Point cur; // Current position
|
|
||||||
byte curbox;
|
Common::Point cur; // Last position
|
||||||
Common::Point next; // Next position on our way to the destination
|
byte curbox; // Last box
|
||||||
|
|
||||||
|
Common::Point next; // Next position on our way to the destination, i.e. our intermediate destination
|
||||||
|
|
||||||
Common::Point point3;
|
Common::Point point3;
|
||||||
int32 deltaXFactor, deltaYFactor;
|
int32 deltaXFactor, deltaYFactor;
|
||||||
uint16 xfrac, yfrac;
|
uint16 xfrac, yfrac;
|
||||||
|
|
|
@ -735,10 +735,9 @@ int ScummEngine::getPathToDestBox(byte from, byte to) {
|
||||||
|
|
||||||
// WORKAROUND #2: In addition to the above, we have to add this special
|
// 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.
|
// 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
|
// See bug #770690 and also bug #774783.
|
||||||
// and also bug #774783.
|
|
||||||
if ((_gameId == GID_INDY3) && _roomResource == 46 && from == 1 && to == 0)
|
if ((_gameId == GID_INDY3) && _roomResource == 46 && from == 1 && to == 0)
|
||||||
return 1;
|
return 0;
|
||||||
|
|
||||||
// Skip up to the matrix data for box 'from'
|
// Skip up to the matrix data for box 'from'
|
||||||
for (i = 0; i < from && boxm < end; i++) {
|
for (i = 0; i < from && boxm < end; i++) {
|
||||||
|
@ -1137,24 +1136,28 @@ bool ScummEngine::areBoxesNeighbours(int box1nr, int box2nr) {
|
||||||
return result;
|
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 pt;
|
||||||
Common::Point gateA[2];
|
Common::Point gateA[2];
|
||||||
Common::Point gateB[2];
|
Common::Point gateB[2];
|
||||||
|
|
||||||
_vm->getGates(trap1, trap2, gateA, gateB);
|
_vm->getGates(box1, box2, gateA, gateB);
|
||||||
|
|
||||||
p2.x = 32000;
|
p2.x = 32000;
|
||||||
p3.x = 32000;
|
p3.x = 32000;
|
||||||
|
|
||||||
// next box (trap2) = final box?
|
// next box (box2) = final box?
|
||||||
if (trap2 == final_trap) {
|
if (box2 == finalBox) {
|
||||||
// Is the actor (x,y) between both gates?
|
// In Indy3, the masks (= z-level) have to match, too -- needed for the
|
||||||
if (compareSlope(_pos.x, _pos.y, walkdata.dest.x, walkdata.dest.y, gateA[0].x, gateA[0].y) !=
|
// 'maze' in the zeppeling (see bug #1032964).
|
||||||
compareSlope(_pos.x, _pos.y, walkdata.dest.x, walkdata.dest.y, gateB[0].x, gateB[0].y) &&
|
if (_vm->_gameId != GID_INDY3 || _vm->getMaskFromBox(box1) == _vm->getMaskFromBox(box2)) {
|
||||||
compareSlope(_pos.x, _pos.y, walkdata.dest.x, walkdata.dest.y, gateA[1].x, gateA[1].y) !=
|
// Is the actor (x,y) between both gates?
|
||||||
compareSlope(_pos.x, _pos.y, walkdata.dest.x, walkdata.dest.y, gateB[1].x, gateB[1].y)) {
|
if (compareSlope(_pos.x, _pos.y, walkdata.dest.x, walkdata.dest.y, gateA[0].x, gateA[0].y) !=
|
||||||
return;
|
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 @@ void Actor::findPathTowardsOld(byte trap1, byte trap2, byte final_trap, Common::
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the "gate" between two boxes. The gate is a pair of two lines which
|
* 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
|
* 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.
|
* 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
|
* 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 i, j;
|
||||||
int dist[8];
|
int dist[8];
|
||||||
int minDist[3];
|
int minDist[3];
|
||||||
|
@ -1191,23 +1194,23 @@ void ScummEngine::getGates(int trap1, int trap2, Common::Point gateA[2], Common:
|
||||||
|
|
||||||
// For all corner coordinates of the first box, compute the point closest
|
// 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).
|
// 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[0] = coords.ul;
|
||||||
boxCorner[1] = coords.ur;
|
boxCorner[1] = coords.ur;
|
||||||
boxCorner[2] = coords.lr;
|
boxCorner[2] = coords.lr;
|
||||||
boxCorner[3] = coords.ll;
|
boxCorner[3] = coords.ll;
|
||||||
for (i = 0; i < 4; i++) {
|
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.
|
// 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[4] = coords.ul;
|
||||||
boxCorner[5] = coords.ur;
|
boxCorner[5] = coords.ur;
|
||||||
boxCorner[6] = coords.lr;
|
boxCorner[6] = coords.lr;
|
||||||
boxCorner[7] = coords.ll;
|
boxCorner[7] = coords.ll;
|
||||||
for (i = 4; i < 8; i++) {
|
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.
|
// Find the three closest "close" points between the two boxes.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue