From d92e47f4e6ff7187ac0dca9ad1c54b2c96fda1b9 Mon Sep 17 00:00:00 2001 From: Robert Crossfield Date: Mon, 8 Dec 2014 10:29:23 +1100 Subject: SCUMM V1-V2: Fix actor walk behavior (transitions between walk boxes, and changing destination issue) --- engines/scumm/actor.cpp | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) (limited to 'engines/scumm') 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) { -- cgit v1.2.3