Bugfixes to walking code. Rex can now walk about on-screen

svn-id: r50914
This commit is contained in:
Paul Gilbert 2010-07-15 12:37:46 +00:00
parent 4366262511
commit 20a0ad6833
2 changed files with 11 additions and 7 deletions

View File

@ -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);

View File

@ -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
}
/*--------------------------------------------------------------------------*/