diff options
author | johndoe123 | 2015-11-23 13:22:51 +0100 |
---|---|---|
committer | johndoe123 | 2015-11-23 13:22:51 +0100 |
commit | 1800f9d8dc26e177ac53be3e2cda0a5c19593dc0 (patch) | |
tree | 814df34ba83ec4558e7ee79b6411759f66564265 /engines/bbvs | |
parent | 0dbf4e53c69ccebacde849d134fb94aca6217ef0 (diff) | |
download | scummvm-rg350-1800f9d8dc26e177ac53be3e2cda0a5c19593dc0.tar.gz scummvm-rg350-1800f9d8dc26e177ac53be3e2cda0a5c19593dc0.tar.bz2 scummvm-rg350-1800f9d8dc26e177ac53be3e2cda0a5c19593dc0.zip |
BBVS: Fix bug #6954: Pathfinding bug in Prison
The bug was caused by a check introduced by me to avoid division-by-zero errors
when the source and dest x values are equal.
This had the side effect that it didn't work well in this case outlined in the
bug report, maybe also in other places.
I'm not sure how to handle a DBZ correctly here so I'm setting the x delta to
1.0 if it would normally be 0.0, which seems to work after walking around
in some scenes.
Diffstat (limited to 'engines/bbvs')
-rw-r--r-- | engines/bbvs/walk.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/engines/bbvs/walk.cpp b/engines/bbvs/walk.cpp index 5ef14101a0..e97182ff5d 100644 --- a/engines/bbvs/walk.cpp +++ b/engines/bbvs/walk.cpp @@ -326,12 +326,10 @@ void BbvsEngine::canWalkToDest(WalkArea *walkArea, int infoCount) { } bool BbvsEngine::walkTestLineWalkable(const Common::Point &sourcePt, const Common::Point &destPt, WalkInfo *walkInfo) { - const float ptDeltaX = destPt.x - sourcePt.x; + const float ptDeltaX = MAX<float>(destPt.x - sourcePt.x, 1.0f); const float ptDeltaY = destPt.y - sourcePt.y; const float wDeltaX = walkInfo->x - sourcePt.x; const float wDeltaY = walkInfo->y - sourcePt.y; - if (destPt.x == sourcePt.x) - return true; if (walkInfo->direction) { const float nDeltaY = wDeltaX * ptDeltaY / ptDeltaX + (float)sourcePt.y - (float)walkInfo->y; return (nDeltaY >= 0.0f) && (nDeltaY < (float)walkInfo->delta); |