diff options
author | Peter Kohaut | 2019-01-19 10:29:32 +0100 |
---|---|---|
committer | Peter Kohaut | 2019-01-19 23:15:41 +0100 |
commit | e45aad9136400e124cff5f2f803fb145f85547d7 (patch) | |
tree | 42f68fd114b74b72b361ab77c13ced9f5163b0db /engines | |
parent | 3ac69d40a6f6cf8d7a657dbf70df1bce234ebe8e (diff) | |
download | scummvm-rg350-e45aad9136400e124cff5f2f803fb145f85547d7.tar.gz scummvm-rg350-e45aad9136400e124cff5f2f803fb145f85547d7.tar.bz2 scummvm-rg350-e45aad9136400e124cff5f2f803fb145f85547d7.zip |
BLADERUNNER: Fixed rotation animation
Animated rotation wasnt checking for angle boundaries properly.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/bladerunner/actor.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp index 974cfdc45c..aa49d79664 100644 --- a/engines/bladerunner/actor.cpp +++ b/engines/bladerunner/actor.cpp @@ -608,12 +608,12 @@ bool Actor::tick(bool forceDraw, Common::Rect *screenRect) { int facingChange = angleChange * (512.0f / M_PI); if (facingChange != 0) { _facing = _facing - facingChange; - if (_facing < 0) { + while (_facing < 0) { _facing += 1024; } - if (_facing >= 1024) { - _facing = _facing - 1024; + while (_facing >= 1024) { + _facing -= 1024; } } } @@ -760,7 +760,15 @@ void Actor::setFacing(int facing, bool halfOrSet) { } } - _facing = (_facing + offset) % 1024; + _facing += offset; + + while (_facing < 0) { + _facing += 1024; + } + + while (_facing >= 1024) { + _facing -= 1024; + } } void Actor::setBoundingBox(const Vector3 &position, bool retired) { |