aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kurushin2005-09-04 17:40:16 +0000
committerAndrew Kurushin2005-09-04 17:40:16 +0000
commit4e5cc8d080adca4dafdff81706d3b008261cf2cb (patch)
tree27f22c15ffca5b3446e882cec26e26f2553035fd
parent368785074c9eb9e9cb9f658064a2fcf453f875f5 (diff)
downloadscummvm-rg350-4e5cc8d080adca4dafdff81706d3b008261cf2cb.tar.gz
scummvm-rg350-4e5cc8d080adca4dafdff81706d3b008261cf2cb.tar.bz2
scummvm-rg350-4e5cc8d080adca4dafdff81706d3b008261cf2cb.zip
fix #1269037 Rif walks off-screen when looking at screen at desk
svn-id: r18774
-rw-r--r--saga/actor.cpp4
-rw-r--r--saga/actor.h2
-rw-r--r--saga/isomap.cpp40
3 files changed, 23 insertions, 23 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp
index 3dd1d7e5cc..fdd9f82064 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -1975,13 +1975,14 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) {
pointBest = actor->_walkStepsPoints[actor->_walkStepsCount - 1];
+ pointBest.x &= ~1;
delta.x = ABS(pointFrom.x - pointTo.x);
delta.y = ABS(pointFrom.y - pointTo.y);
bestDelta.x = ABS(pointBest.x - pointTo.x);
bestDelta.y = ABS(pointBest.y - pointTo.y);
- if (delta.x + delta.y <= bestDelta.x + bestDelta.y && (actor->_flags & kFollower)) {
+ if ((delta.x + delta.y <= bestDelta.x + bestDelta.y) && (actor->_flags & kFollower)) {
actor->_actorFlags |= kActorNoFollow;
}
@@ -2542,7 +2543,6 @@ int Actor::fillPathArray(const Point &fromPoint, const Point &toPoint, Point &be
bestRating = currentRating;
bestPath = nextPoint;
}
- pathDirection = &_pathDirectionList[i];
}
++i;
} while (i < _pathDirectionListCount);
diff --git a/saga/actor.h b/saga/actor.h
index 0728816593..8a6518f98e 100644
--- a/saga/actor.h
+++ b/saga/actor.h
@@ -752,7 +752,7 @@ public:
inline int16 quickDistance(const Point &point1, const Point &point2) {
Point delta;
- delta.x = ABS(point1.x - point2.x);
+ delta.x = ABS(point1.x - point2.x) / 2;
delta.y = ABS(point1.y - point2.y);
return ((delta.x < delta.y) ? (delta.y + delta.x / 2) : (delta.x + delta.y / 2));
}
diff --git a/saga/isomap.cpp b/saga/isomap.cpp
index 76f0094c89..aa8f6fa282 100644
--- a/saga/isomap.cpp
+++ b/saga/isomap.cpp
@@ -1416,40 +1416,40 @@ void IsoMap::findDragonTilePath(ActorData* actor,const Location &start, const Lo
switch (tilePoint->direction) {
case kDirUpRight:
- if (checkDragonPoint( tilePoint->u + 1, tilePoint->v + 0, 1)) {
- pushDragonPoint( tilePoint->u + 2, tilePoint->v + 0, 1);
- pushDragonPoint( tilePoint->u + 1, tilePoint->v + 1, 7);
- pushDragonPoint( tilePoint->u + 1, tilePoint->v - 1, 3);
+ if (checkDragonPoint( tilePoint->u + 1, tilePoint->v + 0, kDirUpRight)) {
+ pushDragonPoint( tilePoint->u + 2, tilePoint->v + 0, kDirUpRight);
+ pushDragonPoint( tilePoint->u + 1, tilePoint->v + 1, kDirUpLeft);
+ pushDragonPoint( tilePoint->u + 1, tilePoint->v - 1, kDirDownRight);
}
break;
case kDirDownRight:
- if (checkDragonPoint( tilePoint->u + 0, tilePoint->v - 1, 3)) {
- pushDragonPoint( tilePoint->u + 0, tilePoint->v - 2, 3);
- pushDragonPoint( tilePoint->u + 1, tilePoint->v - 1, 1);
- pushDragonPoint( tilePoint->u - 1, tilePoint->v - 1, 5);
+ if (checkDragonPoint( tilePoint->u + 0, tilePoint->v - 1, kDirDownRight)) {
+ pushDragonPoint( tilePoint->u + 0, tilePoint->v - 2, kDirDownRight);
+ pushDragonPoint( tilePoint->u + 1, tilePoint->v - 1, kDirUpRight);
+ pushDragonPoint( tilePoint->u - 1, tilePoint->v - 1, kDirDownLeft);
}
break;
case kDirDownLeft:
- if (checkDragonPoint( tilePoint->u - 1, tilePoint->v + 0, 5)) {
- pushDragonPoint( tilePoint->u - 2, tilePoint->v + 0, 5);
- pushDragonPoint( tilePoint->u - 1, tilePoint->v - 1, 3);
- pushDragonPoint( tilePoint->u - 1, tilePoint->v + 1, 7);
+ if (checkDragonPoint( tilePoint->u - 1, tilePoint->v + 0, kDirDownLeft)) {
+ pushDragonPoint( tilePoint->u - 2, tilePoint->v + 0, kDirDownLeft);
+ pushDragonPoint( tilePoint->u - 1, tilePoint->v - 1, kDirDownRight);
+ pushDragonPoint( tilePoint->u - 1, tilePoint->v + 1, kDirUpLeft);
}
break;
case kDirUpLeft:
- if (checkDragonPoint( tilePoint->u + 0, tilePoint->v + 1, 7)) {
- pushDragonPoint( tilePoint->u + 0, tilePoint->v + 2, 7);
- pushDragonPoint( tilePoint->u - 1, tilePoint->v + 1, 5);
- pushDragonPoint( tilePoint->u + 1, tilePoint->v + 1, 1);
+ if (checkDragonPoint( tilePoint->u + 0, tilePoint->v + 1, kDirUpLeft)) {
+ pushDragonPoint( tilePoint->u + 0, tilePoint->v + 2, kDirUpLeft);
+ pushDragonPoint( tilePoint->u - 1, tilePoint->v + 1, kDirDownLeft);
+ pushDragonPoint( tilePoint->u + 1, tilePoint->v + 1, kDirUpRight);
}
break;
}
if (first && (_queueCount == _readCount)) {
- pushDragonPoint( tilePoint->u + 1, tilePoint->v + 0, 1);
- pushDragonPoint( tilePoint->u + 0, tilePoint->v - 1, 3);
- pushDragonPoint( tilePoint->u - 1, tilePoint->v + 0, 5);
- pushDragonPoint( tilePoint->u + 0, tilePoint->v + 1, 7);
+ pushDragonPoint( tilePoint->u + 1, tilePoint->v + 0, kDirUpRight);
+ pushDragonPoint( tilePoint->u + 0, tilePoint->v - 1, kDirDownRight);
+ pushDragonPoint( tilePoint->u - 1, tilePoint->v + 0, kDirDownLeft);
+ pushDragonPoint( tilePoint->u + 0, tilePoint->v + 1, kDirUpLeft);
}
first = false;
}