diff options
author | athrxx | 2014-03-17 21:28:59 +0100 |
---|---|---|
committer | athrxx | 2014-03-17 21:32:43 +0100 |
commit | e53a2b18e93e17554416f7e974f462fb23898a50 (patch) | |
tree | a56e5e00ef489087363ed5bf91acc2348b64490e /engines | |
parent | 2e8f2ba82206613d7f946c47009d45c287bf439a (diff) | |
download | scummvm-rg350-e53a2b18e93e17554416f7e974f462fb23898a50.tar.gz scummvm-rg350-e53a2b18e93e17554416f7e974f462fb23898a50.tar.bz2 scummvm-rg350-e53a2b18e93e17554416f7e974f462fb23898a50.zip |
KYRA: (LOL) - fix LoLEngine::updateCompass()
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/scene_lol.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index 313386e86d..391de5e49c 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -620,14 +620,14 @@ void LoLEngine::updateCompass() { if (_compassStep) _compassStep -= (((ABS(_compassStep) >> 4) + 2) * dir); - int16 d = _compassBroken ? (int8(_rnd.getRandomNumber(255)) - _compassDirection) : (_currentDirection << 6) - _compassDirection; - if (d <= -128) - d += 256; - if (d >= 128) - d -= 256; - - d >>= 2; - _compassStep += d; + int16 diff = _compassBroken ? (int8(_rnd.getRandomNumber(255)) - _compassDirection) : (_currentDirection << 6) - _compassDirection; + if (diff <= -128) + diff += 256; + if (diff >= 128) + diff -= 256; + + diff >>= 2; + _compassStep += diff; _compassStep = CLIP(_compassStep, -24, 24); _compassDirection += _compassStep; @@ -636,14 +636,9 @@ void LoLEngine::updateCompass() { if (_compassDirection > 255) _compassDirection -= 256; - if ((_compassDirection >> 6) == _currentDirection && _compassStep < 2) { - int16 d2 = d >> 16; - d ^= d2; - d -= d2; - if (d < 4) { - _compassDirection = _currentDirection << 6; - _compassStep = 0; - } + if (((((_compassDirection + 3) & 0xFD) >> 6) == _currentDirection) && (_compassStep < 2) && (ABS(diff) < 4)) { + _compassDirection = _currentDirection << 6; + _compassStep = 0; } gui_drawCompass(); |