SCUMM: minor v1-3 walk code cleanup

This commit is contained in:
athrxx 2021-08-06 16:11:10 +02:00
parent 0d32674049
commit ecd02afeda
2 changed files with 7 additions and 9 deletions

View File

@ -231,7 +231,7 @@ void Actor_v2::initActor(int mode) {
void Actor_v3::initActor(int mode) {
if (mode == -1) {
_stepX = 0;
_stepX = 1;
_stepThreshold = 0;
}
Actor::initActor(mode);
@ -537,21 +537,19 @@ int Actor_v3::calcMovementFactor(const Common::Point& next) {
int diffX = next.x - _pos.x;
int diffY = next.y - _pos.y;
if (_vm->_game.version <= 2) {
_stepThreshold = MAX(ABS(diffX), ABS(diffY));
deltaXFactor = deltaYFactor = 1;
} else {
if (_vm->_game.version == 3) {
// These two lines fix bug #1052 (INDY3: Hitler facing wrong directions in the Berlin scene).
// I can't see anything like this in the original SCUMM1/2 code, so I limit this to SCUMM3.
if (!(_moving & MF_LAST_LEG) && (int)_speedx > ABS(diffX) && (int)_speedy > ABS(diffY))
return 0;
_stepX = ((ABS(diffY) / (int)_speedy) >> 1) > (ABS(diffX) / (int)_speedx) ? _speedy + 1 : _speedx;
_stepThreshold = MAX(ABS(diffY) / _speedy, ABS(diffX) / _stepX);
deltaXFactor = (int32)_stepX;
deltaYFactor = (int32)_speedy;
}
_stepThreshold = MAX(ABS(diffY) / _speedy, ABS(diffX) / _stepX);
deltaXFactor = (int32)_stepX;
deltaYFactor = (int32)_speedy;
if (diffX < 0)
deltaXFactor = -deltaXFactor;
if (diffY < 0)

View File

@ -329,7 +329,7 @@ protected:
class Actor_v3 : public Actor {
public:
Actor_v3(ScummEngine *scumm, int id) : Actor(scumm, id), _stepX(0), _stepThreshold(0), _facingXYratio(scumm->_game.version == 3 ? 3 : 1) {}
Actor_v3(ScummEngine *scumm, int id) : Actor(scumm, id), _stepX(1), _stepThreshold(0), _facingXYratio(scumm->_game.version == 3 ? 3 : 1) {}
void initActor(int mode) override;
void walkActor() override;