aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorKirben2014-12-08 19:29:29 +1100
committerKirben2014-12-08 19:29:29 +1100
commit801bfedfc098d6335ef3b4517dc10d3ac75a6b8a (patch)
tree3b8f11e5712e0ed566be0b4a2f0edd0fb25d2ad4 /engines
parent6e24e7df3b9c39b03d1652bdf34f275d7ed8c1fc (diff)
parentd92e47f4e6ff7187ac0dca9ad1c54b2c96fda1b9 (diff)
downloadscummvm-rg350-801bfedfc098d6335ef3b4517dc10d3ac75a6b8a.tar.gz
scummvm-rg350-801bfedfc098d6335ef3b4517dc10d3ac75a6b8a.tar.bz2
scummvm-rg350-801bfedfc098d6335ef3b4517dc10d3ac75a6b8a.zip
Merge pull request #542 from segrax/V1-V2_WalkAnimFix
SCUMM V1-V2: Fix actor walk behavior (transitions between walk boxes, and changing destination issue)
Diffstat (limited to 'engines')
-rw-r--r--engines/scumm/actor.cpp44
1 files changed, 31 insertions, 13 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index d07f175c78..6cbb2a4e45 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -439,13 +439,28 @@ int Actor::actorWalkStep() {
return 0;
}
- tmpX = (_pos.x << 16) + _walkdata.xfrac + (_walkdata.deltaXFactor >> 8) * _scalex;
- _walkdata.xfrac = (uint16)tmpX;
- _pos.x = (tmpX >> 16);
+ if (_vm->_game.version <= 2) {
+ if (_walkdata.deltaXFactor != 0) {
+ if (_walkdata.deltaXFactor > 0)
+ _pos.x += 1;
+ else
+ _pos.x -= 1;
+ }
+ if (_walkdata.deltaYFactor != 0) {
+ if (_walkdata.deltaYFactor > 0)
+ _pos.y += 1;
+ else
+ _pos.y -= 1;
+ }
+ } else {
+ tmpX = (_pos.x << 16) + _walkdata.xfrac + (_walkdata.deltaXFactor >> 8) * _scalex;
+ _walkdata.xfrac = (uint16)tmpX;
+ _pos.x = (tmpX >> 16);
- tmpY = (_pos.y << 16) + _walkdata.yfrac + (_walkdata.deltaYFactor >> 8) * _scaley;
- _walkdata.yfrac = (uint16)tmpY;
- _pos.y = (tmpY >> 16);
+ tmpY = (_pos.y << 16) + _walkdata.yfrac + (_walkdata.deltaYFactor >> 8) * _scaley;
+ _walkdata.yfrac = (uint16)tmpY;
+ _pos.y = (tmpY >> 16);
+ }
if (ABS(_pos.x - _walkdata.cur.x) > distX) {
_pos.x = _walkdata.next.x;
@@ -455,7 +470,7 @@ int Actor::actorWalkStep() {
_pos.y = _walkdata.next.y;
}
- if (_vm->_game.version >= 4 && _vm->_game.version <= 6 && _pos == _walkdata.next) {
+ if ((_vm->_game.version <= 2 || (_vm->_game.version >= 4 && _vm->_game.version <= 6)) && _pos == _walkdata.next) {
_moving &= ~MF_IN_LEG;
return 0;
}
@@ -619,14 +634,17 @@ void Actor::startWalkActor(int destX, int destY, int dir) {
_walkdata.dest.y = abr.y;
_walkdata.destbox = abr.box;
_walkdata.destdir = dir;
- _walkdata.point3.x = 32000;
- _walkdata.curbox = _walkbox;
-
+
if (_vm->_game.version == 0) {
((Actor_v0*)this)->_newWalkBoxEntered = true;
- } else {
- _moving = (_moving & MF_IN_LEG) | MF_NEW_LEG;
- }
+ } else if (_vm->_game.version <= 2) {
+ _moving = (_moving & ~(MF_LAST_LEG | MF_IN_LEG)) | MF_NEW_LEG;
+ } else {
+ _moving = (_moving & MF_IN_LEG) | MF_NEW_LEG;
+ }
+
+ _walkdata.point3.x = 32000;
+ _walkdata.curbox = _walkbox;
}
void Actor::startWalkAnim(int cmd, int angle) {