aboutsummaryrefslogtreecommitdiff
path: root/scumm/actor.cpp
diff options
context:
space:
mode:
authorMax Horn2004-08-22 08:53:53 +0000
committerMax Horn2004-08-22 08:53:53 +0000
commit178d577eb41d85cab8fe332cc37cccd57a0ebccb (patch)
treedd05278b68e07581debe7ed72ed70c73bb181bc8 /scumm/actor.cpp
parent4e2d3af64622098ac97b154ccc0458f83ca8b9c1 (diff)
downloadscummvm-rg350-178d577eb41d85cab8fe332cc37cccd57a0ebccb.tar.gz
scummvm-rg350-178d577eb41d85cab8fe332cc37cccd57a0ebccb.tar.bz2
scummvm-rg350-178d577eb41d85cab8fe332cc37cccd57a0ebccb.zip
Oops, I didn't mean to check in those actor.cpp changes (thangs Kirben!)
svn-id: r14674
Diffstat (limited to 'scumm/actor.cpp')
-rw-r--r--scumm/actor.cpp30
1 files changed, 9 insertions, 21 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp
index bd475348b2..0e81f7062a 100644
--- a/scumm/actor.cpp
+++ b/scumm/actor.cpp
@@ -148,12 +148,6 @@ void Actor::setActorWalkSpeed(uint newSpeedX, uint newSpeedY) {
speedx = newSpeedX;
speedy = newSpeedY;
-if (newSpeedX == 10 && newSpeedY == 5) {
- speedx = 5;
- speedy = 5;
-}
-
-
if (moving) {
calcMovementFactor(walkdata.next);
}
@@ -177,15 +171,17 @@ int ScummEngine::getAngleFromPos(int x, int y) const {
}
int Actor::calcMovementFactor(Common::Point next) {
- int deltaXFactor, deltaYFactor;
+ Common::Point actorPos(_pos);
+ int diffX, diffY;
+ int32 deltaXFactor, deltaYFactor;
- if (_pos == next)
+ if (actorPos == next)
return 0;
- const int diffX = next.x - _pos.x;
- const int diffY = next.y - _pos.y;
-
+ diffX = next.x - actorPos.x;
+ diffY = next.y - actorPos.y;
deltaYFactor = speedy << 16;
+
if (diffY < 0)
deltaYFactor = -deltaYFactor;
@@ -196,7 +192,7 @@ int Actor::calcMovementFactor(Common::Point next) {
deltaYFactor = 0;
}
- if ((uint) abs(deltaXFactor >> 16) > speedx) {
+ if ((uint) abs((int)(deltaXFactor >> 16)) > speedx) {
deltaXFactor = speedx << 16;
if (diffX < 0)
deltaXFactor = -deltaXFactor;
@@ -209,7 +205,7 @@ int Actor::calcMovementFactor(Common::Point next) {
}
}
- walkdata.cur = _pos;
+ walkdata.cur = actorPos;
walkdata.next = next;
walkdata.deltaXFactor = deltaXFactor;
walkdata.deltaYFactor = deltaYFactor;
@@ -383,11 +379,8 @@ int Actor::actorWalkStep() {
distX = abs(walkdata.next.x - walkdata.cur.x);
distY = abs(walkdata.next.y - walkdata.cur.y);
-if (number == 6) printf("actorWalkStep: actor %d at (%d,%d); ", number, actorPos.x, actorPos.y);
if (abs(actorPos.x - walkdata.cur.x) >= distX && abs(actorPos.y - walkdata.cur.y) >= distY) {
moving &= ~MF_IN_LEG;
-if (number == 6) printf("MF_IN_LEG: walkdata.cur=(%d,%d), walkdata.next=(%d,%d)\n",
- walkdata.cur.x, walkdata.cur.y, walkdata.next.x, walkdata.next.y);
return 0;
}
@@ -407,11 +400,6 @@ if (number == 6) printf("MF_IN_LEG: walkdata.cur=(%d,%d), walkdata.next=(%d,%d)\
actorPos.y = walkdata.next.y;
}
-if (number == 6) printf("new pos (%d,%d): delta=(%d,%d), delta>>8=(%d,%d)\n",
- actorPos.x, actorPos.y,
- walkdata.deltaXFactor, walkdata.deltaYFactor,
- (walkdata.deltaXFactor >> 8), (walkdata.deltaYFactor >> 8));
-
_pos = actorPos;
return 1;
}