aboutsummaryrefslogtreecommitdiff
path: root/saga/actor.cpp
diff options
context:
space:
mode:
authorAndrew Kurushin2005-01-04 18:54:29 +0000
committerAndrew Kurushin2005-01-04 18:54:29 +0000
commitb514251efe5855fb80d37791f69a7fcbbbcf4390 (patch)
treeddf75f8fe9662d0179b0b935f025aec3b547afb4 /saga/actor.cpp
parentdee9b3bd870843d197678b8f6bc44b46561c5778 (diff)
downloadscummvm-rg350-b514251efe5855fb80d37791f69a7fcbbbcf4390.tar.gz
scummvm-rg350-b514251efe5855fb80d37791f69a7fcbbbcf4390.tar.bz2
scummvm-rg350-b514251efe5855fb80d37791f69a7fcbbbcf4390.zip
- some walking addition
svn-id: r16426
Diffstat (limited to 'saga/actor.cpp')
-rw-r--r--saga/actor.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp
index 5f14b79a98..d6a9474761 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -151,7 +151,7 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) {
_pathRect.left = 0;
_pathRect.right = _vm->getDisplayWidth();
_pathRect.top = _vm->getPathYOffset();
- _pathRect.bottom = _vm->getStatusYOffset() - _vm->getPathYOffset();
+ _pathRect.bottom = _vm->getStatusYOffset();
// Get actor resource file context
_actorContext = _vm->getFileContext(GAME_RESOURCEFILE, 0);
@@ -1191,6 +1191,10 @@ bool Actor::actorWalkTo(uint16 actorId, const ActorLocation &toLocation) {
actor->walkStepIndex = 2;
}
+ if (actor->walkStepsCount == 0) {
+ actor->walkStepsCount = 2;
+ }
+
if (extraEndNode) {
actor->walkPath[actor->walkStepsCount - 2] = pointTo.x / (ACTOR_LMULT * 2);
actor->walkPath[actor->walkStepsCount - 1] = pointTo.y / ACTOR_LMULT;
@@ -1345,14 +1349,15 @@ void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point
intersect.top = MAX(_pathRect.top, _barrierList[i].top);
intersect.right = MIN(_pathRect.right, _barrierList[i].right);
intersect.bottom = MIN(_pathRect.bottom, _barrierList[i].bottom);
-
+
+ int16 w = intersect.width() >> 1;
intersect.left >>= 1;
intersect.top -= _vm->getPathYOffset();
- intersect.right >>= 1;
+ intersect.right = intersect.left + w;
intersect.bottom -= _vm->getPathYOffset();
for (iteratorPoint.y = intersect.top; iteratorPoint.y < intersect.bottom; iteratorPoint.y++) {
- for (iteratorPoint.x = 0; iteratorPoint.x < _xCellCount; iteratorPoint.x++) {
+ for (iteratorPoint.x = intersect.left; iteratorPoint.x < intersect.right; iteratorPoint.x++) {
setPathCell(iteratorPoint, kPathCellBarrier);
}
}
@@ -1428,8 +1433,11 @@ bool Actor::scanPathLine(const Point &point1, const Point &point2) {
iteratorPoint.x = point.x >> 1;
iteratorPoint.y = point.y - _vm->getPathYOffset();
- if (getPathCell(iteratorPoint) == kPathCellBarrier)
- return false;
+ if (validPathCellPoint(iteratorPoint)) {
+ if (getPathCell(iteratorPoint) == kPathCellBarrier) {
+ return false;
+ }
+ }
}
return true;
}
@@ -1467,7 +1475,9 @@ int Actor::fillPathArray(const Point &fromPoint, const Point &toPoint, Point &be
pathDirection->y = pathFromPoint.y;
pathDirection->direction = startDirection;
}
- setPathCell(pathFromPoint, 0);
+ if (validPathCellPoint(pathFromPoint)) {
+ setPathCell(pathFromPoint, 0);
+ }
pathDirectionIterator = pathDirectionList.begin();