aboutsummaryrefslogtreecommitdiff
path: root/saga/actor.cpp
diff options
context:
space:
mode:
authorAndrew Kurushin2005-01-09 21:36:20 +0000
committerAndrew Kurushin2005-01-09 21:36:20 +0000
commit7a8e1c1efd72bd5bb9aa3db8f6cbb4ca39ca8c0f (patch)
treebc619e72feb6abfa299835881a3b41c58ae88f1b /saga/actor.cpp
parentce9f5bd29ae2ae07091cec57a8e3bb725ede68d7 (diff)
downloadscummvm-rg350-7a8e1c1efd72bd5bb9aa3db8f6cbb4ca39ca8c0f.tar.gz
scummvm-rg350-7a8e1c1efd72bd5bb9aa3db8f6cbb4ca39ca8c0f.tar.bz2
scummvm-rg350-7a8e1c1efd72bd5bb9aa3db8f6cbb4ca39ca8c0f.zip
small fixes:
- actor barrier rects - unreachable code svn-id: r16510
Diffstat (limited to 'saga/actor.cpp')
-rw-r--r--saga/actor.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp
index ddd3b85fa1..77625d3871 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -162,7 +162,7 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) {
_pathRect.left = 0;
- _pathRect.right = _vm->getDisplayWidth() - 1;
+ _pathRect.right = _vm->getDisplayWidth();
_pathRect.top = _vm->getPathYOffset();
_pathRect.bottom = _vm->getStatusYOffset();
@@ -1217,23 +1217,22 @@ bool Actor::actorWalkTo(uint16 actorId, const ActorLocation &toLocation) {
anotherActorScreenPosition = anotherActor->screenPosition;
testBox.left = anotherActorScreenPosition.x - collision.x;
- testBox.right = anotherActorScreenPosition.x + collision.x;
+ testBox.right = anotherActorScreenPosition.x + collision.x + 1;
testBox.top = anotherActorScreenPosition.y - collision.y;
- testBox.bottom = anotherActorScreenPosition.y + collision.y;
+ testBox.bottom = anotherActorScreenPosition.y + collision.y + 1;
testBox2 = testBox;
- testBox2.right += 2;
+ testBox2.right += 1;
testBox2.left -= 1;
- testBox2.bottom += 1;
if (testBox2.contains(pointFrom)) {
if (pointFrom.x > anotherActorScreenPosition.x + 4) {
- testBox.right = pointFrom.x - 2;
+ testBox.right = pointFrom.x - 1;
} else {
if (pointFrom.x < anotherActorScreenPosition.x - 4) {
testBox.left = pointFrom.x + 2;
} else {
if (pointFrom.y > anotherActorScreenPosition.y) {
- testBox.bottom = pointFrom.y - 1;
+ testBox.bottom = pointFrom.y;
} else {
testBox.top = pointFrom.y + 1 ;
}
@@ -1241,7 +1240,7 @@ bool Actor::actorWalkTo(uint16 actorId, const ActorLocation &toLocation) {
}
}
- if ((testBox.left <= testBox.right) && (testBox.top <= testBox.bottom)) {
+ if ((testBox.width() > 0) && (testBox.height() > 0)) {
_barrierList[_barrierCount++] = testBox;
}
}
@@ -1416,8 +1415,8 @@ void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point
intersect.bottom = MIN(_pathRect.bottom, _barrierList[i].bottom);
- for (iteratorPoint.y = intersect.top; iteratorPoint.y <= intersect.bottom; iteratorPoint.y++) {
- for (iteratorPoint.x = intersect.left; iteratorPoint.x <= intersect.right; iteratorPoint.x++) {
+ for (iteratorPoint.y = intersect.top; iteratorPoint.y < intersect.bottom; iteratorPoint.y++) {
+ for (iteratorPoint.x = intersect.left; iteratorPoint.x < intersect.right; iteratorPoint.x++) {
setPathCell(iteratorPoint, kPathCellBarrier);
}
}