From 618d01c41c9e8507408b117dfa63750975fec68b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 26 Aug 2011 06:34:59 +0200 Subject: SCUMM: Fix some range checks in Indy4 Amiga palette code. --- engines/scumm/palette.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index 930b287f00..c00a117751 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -889,7 +889,7 @@ void ScummEngine::darkenPalette(int redScale, int greenScale, int blueScale, int const byte *palptr = getPalettePtr(_curPalIndex, _roomResource) + startColor * 3; for (int i = startColor; i <= endColor; ++i) { - if (i >= 16 && i <= 48) { + if (i >= 16 && i < 48) { if (cycleFlag) _colorUsedByCycle[i - 16] &= ~2; else @@ -916,7 +916,7 @@ void ScummEngine::darkenPalette(int redScale, int greenScale, int blueScale, int } for (int i = 0; i < 256; ++i) { - if (i >= 16 && i <= _amigaFirstUsedColor) + if (i >= 16 && i < _amigaFirstUsedColor) continue; bool inRange = (startColor <= i && i <= endColor); @@ -1196,7 +1196,7 @@ void ScummEngine::setPalColor(int idx, int r, int g, int b) { } if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) { - if (idx < 16 || idx > _amigaFirstUsedColor) { + if (idx < 16 || idx >= _amigaFirstUsedColor) { mapRoomPalette(idx); mapVerbPalette(idx); } else if (idx >= 16 && idx < 48 && idx != 33) { @@ -1205,7 +1205,7 @@ void ScummEngine::setPalColor(int idx, int r, int g, int b) { _amigaPalette[(idx - 16) * 3 + 2] = _currentPalette[idx * 3 + 2] >> 4; for (int i = 0; i < 256; ++i) { - if (i >= 16 && i <= _amigaFirstUsedColor) + if (i >= 16 && i < _amigaFirstUsedColor) continue; if (idx - 16 == _roomPalette[i]) @@ -1217,7 +1217,7 @@ void ScummEngine::setPalColor(int idx, int r, int g, int b) { _amigaPalette[(idx - 16) * 3 + 2] = _currentPalette[idx * 3 + 2] >> 4; for (int i = 0; i < 256; ++i) { - if (i >= 16 && i <= _amigaFirstUsedColor) + if (i >= 16 && i < _amigaFirstUsedColor) continue; if (idx - 16 == _verbPalette[i]) -- cgit v1.2.3