diff options
Diffstat (limited to 'engines/kyra/scene_lol.cpp')
-rw-r--r-- | engines/kyra/scene_lol.cpp | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index 154606d46f..391de5e49c 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -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; + int16 diff = _compassBroken ? (int8(_rnd.getRandomNumber(255)) - _compassDirection) : (_currentDirection << 6) - _compassDirection; + if (diff <= -128) + diff += 256; + if (diff >= 128) + diff -= 256; - d >>= 2; - _compassStep += d; + 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(); |