diff options
author | Colin Snover | 2016-09-27 09:51:19 -0500 |
---|---|---|
committer | Colin Snover | 2016-09-29 19:39:16 -0500 |
commit | 7ad9418583a6a5a15356d1ee6920d2cfa56f7d4d (patch) | |
tree | 1cad780ed2a6fb6b921cc87c6ea17c55b8fe6a98 /engines/sci | |
parent | 8fd19f84c800d42dfb81563116c78bcce2df5b3a (diff) | |
download | scummvm-rg350-7ad9418583a6a5a15356d1ee6920d2cfa56f7d4d.tar.gz scummvm-rg350-7ad9418583a6a5a15356d1ee6920d2cfa56f7d4d.tar.bz2 scummvm-rg350-7ad9418583a6a5a15356d1ee6920d2cfa56f7d4d.zip |
SCI32: Fix off-by-one error in palette fades
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/graphics/palette32.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp index db81669991..135badb5a2 100644 --- a/engines/sci/graphics/palette32.cpp +++ b/engines/sci/graphics/palette32.cpp @@ -810,21 +810,20 @@ void GfxPalette32::applyCycles() { #pragma mark - #pragma mark Fading -// NOTE: There are some game scripts (like SQ6 Sierra logo and main menu) that call -// setFade with numColorsToFade set to 256, but other parts of the engine like -// processShowStyleNone use 255 instead of 256. It is not clear if this is because -// the last palette entry is intentionally left unmodified, or if this is a bug -// in the engine. It certainly seems confused because all other places that accept -// color ranges typically receive values in the range of 0–255. -void GfxPalette32::setFade(uint16 percent, uint8 fromColor, uint16 numColorsToFade) { - if (fromColor > numColorsToFade) { +void GfxPalette32::setFade(uint16 percent, uint8 fromColor, uint16 toColor) { + if (fromColor > toColor) { return; } - assert(numColorsToFade <= ARRAYSIZE(_fadeTable)); + // Some game scripts (like SQ6 Sierra logo and main menu) incorrectly call + // setFade with toColor set to 256 + if (toColor > 255) { + toColor = 255; + } - for (int i = fromColor; i < numColorsToFade; i++) + for (int i = fromColor; i <= toColor; i++) { _fadeTable[i] = percent; + } } void GfxPalette32::fadeOff() { |