diff options
author | Robert Crossfield | 2014-12-08 10:29:23 +1100 |
---|---|---|
committer | Robert Crossfield | 2014-12-08 13:14:12 +1100 |
commit | d92e47f4e6ff7187ac0dca9ad1c54b2c96fda1b9 (patch) | |
tree | 9db96fcf026d468d9613fecfce31cf466c753fab | |
parent | f2511e5a9ecfebdf5c03319acb9466e070fa3d06 (diff) | |
download | scummvm-rg350-d92e47f4e6ff7187ac0dca9ad1c54b2c96fda1b9.tar.gz scummvm-rg350-d92e47f4e6ff7187ac0dca9ad1c54b2c96fda1b9.tar.bz2 scummvm-rg350-d92e47f4e6ff7187ac0dca9ad1c54b2c96fda1b9.zip |
SCUMM V1-V2: Fix actor walk behavior (transitions between walk boxes, and changing destination issue)
-rw-r--r-- | engines/scumm/actor.cpp | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 59a1009789..07c8f84be7 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -385,13 +385,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; @@ -401,7 +416,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; } @@ -565,14 +580,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) { |