From 20a0ad6833fd50ed32e660a652ab962cb75d92ca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 15 Jul 2010 12:37:46 +0000 Subject: Bugfixes to walking code. Rex can now walk about on-screen svn-id: r50914 --- engines/m4/mads_player.cpp | 14 ++++++++------ engines/m4/mads_scene.cpp | 4 +++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/engines/m4/mads_player.cpp b/engines/m4/mads_player.cpp index 7a16938248..ff5f3464bf 100644 --- a/engines/m4/mads_player.cpp +++ b/engines/m4/mads_player.cpp @@ -503,14 +503,14 @@ void MadsPlayer::move() { if (_v8452C < _posDiff.x) _v8452C += _posDiff.y; if (_v8452C >= _posDiff.x) { - if ((_posChange.y <= 0) || (_v844C0 != 0)) + if ((_posChange.y > 0) || (_v844C0 != 0)) newPos.y += _yDirection; --_posChange.y; _v8452C -= _posDiff.x; } if (_v8452C < _posDiff.x) { - if ((_posChange.x <= 0) || (_v844C0 != 0)) + if ((_posChange.x > 0) || (_v844C0 != 0)) newPos.x += _xDirection; --_posChange.x; } @@ -524,9 +524,11 @@ void MadsPlayer::move() { _v8452E += _v84530; - } while ((_v8452E < var1) && !routeFlag && ((_posChange.x > 0) || (_posChange.y > 0))); + } while ((_v8452E < var1) && !routeFlag && ((_posChange.x > 0) || (_posChange.y > 0) || (_v844C0 != 0))); } + _v8452E -= var1; + if (routeFlag) moveComplete(); else { @@ -696,7 +698,7 @@ void MadsPlayer::startMovement() { else if (yDiff == 0) majorDir = 3; else { - if ((scaleAmount >= xDiff) && ((xAmt33 / scaleAmount) >= 141)) + if ((scaleAmount < xDiff) && ((xAmt33 / scaleAmount) >= 141)) majorDir = 3; else if (yDiff <= xDiff) majorDir = 2; @@ -727,8 +729,8 @@ void MadsPlayer::startMovement() { _posChange.x = xDiff; _posChange.y = yDiff; - scaleAmount = MAX(xDiff, yDiff); - _v84530 = (scaleAmount == 0) ? 0 : _hypotenuse / scaleAmount; + int majorChange = MAX(xDiff, yDiff); + _v84530 = (majorChange == 0) ? 0 : _hypotenuse / majorChange; if (_playerPos.x > _destPos.x) _v8452C = MAX(_posChange.x, _posChange.y); diff --git a/engines/m4/mads_scene.cpp b/engines/m4/mads_scene.cpp index 3f4b0df1ff..c30e8db5da 100644 --- a/engines/m4/mads_scene.cpp +++ b/engines/m4/mads_scene.cpp @@ -854,7 +854,9 @@ void MadsSceneResources::load(int sceneNumber, const char *resName, int v0, M4Su } void MadsSceneResources::setRouteNode(int nodeIndex, const Common::Point &pt, M4Surface *depthSurface) { - // TODO + _nodes[nodeIndex].pt = pt; + + // TODO: Implement the rest of the logic of this method } /*--------------------------------------------------------------------------*/ -- cgit v1.2.3