diff options
-rw-r--r-- | scumm/actor.cpp | 30 |
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; } |