diff options
author | Colin Snover | 2016-07-24 11:35:10 -0500 |
---|---|---|
committer | Colin Snover | 2016-07-24 11:36:48 -0500 |
commit | 1c228c488e765fc3e0e19dbcc91b3c40d4712697 (patch) | |
tree | 870a239622c3274f637add4c0826b35a1f9e3742 | |
parent | a6370aa68847bf110e6fd3d8a41114ec79c8456a (diff) | |
download | scummvm-rg350-1c228c488e765fc3e0e19dbcc91b3c40d4712697.tar.gz scummvm-rg350-1c228c488e765fc3e0e19dbcc91b3c40d4712697.tar.bz2 scummvm-rg350-1c228c488e765fc3e0e19dbcc91b3c40d4712697.zip |
SCI32: Fix bad VMD palettes in GK2
-rw-r--r-- | engines/sci/graphics/video32.cpp | 13 | ||||
-rw-r--r-- | engines/sci/graphics/video32.h | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp index dfddac1036..dd841f5b4c 100644 --- a/engines/sci/graphics/video32.cpp +++ b/engines/sci/graphics/video32.cpp @@ -348,6 +348,12 @@ void VMDPlayer::renderFrame() const { if (dirtyPalette) { Palette palette; palette.timestamp = g_sci->getTickCount(); + for (uint16 i = 0; i < _startColor; ++i) { + palette.colors[i].used = false; + } + for (uint16 i = _endColor; i < 256; ++i) { + palette.colors[i].used = false; + } if (_blackPalette) { for (uint16 i = _startColor; i <= _endColor; ++i) { palette.colors[i].r = palette.colors[i].g = palette.colors[i].b = 0; @@ -398,9 +404,12 @@ void VMDPlayer::fillPalette(Palette &palette) const { #pragma mark - #pragma mark VMDPlayer - Palette -void VMDPlayer::restrictPalette(const uint8 startColor, const uint8 endColor) { +void VMDPlayer::restrictPalette(const uint8 startColor, const int16 endColor) { _startColor = startColor; - _endColor = endColor; + // At least GK2 sends 256 as the end color, which is wrong, + // but works in the original engine as the storage size is 4 bytes + // and used values are clamped to 0-255 + _endColor = MIN((int16)255, endColor); } } // End of namespace Sci diff --git a/engines/sci/graphics/video32.h b/engines/sci/graphics/video32.h index cf863ba41d..7033f7c647 100644 --- a/engines/sci/graphics/video32.h +++ b/engines/sci/graphics/video32.h @@ -233,7 +233,7 @@ public: * Restricts use of the system palette by VMD playback to * the given range of palette indexes. */ - void restrictPalette(const uint8 startColor, const uint8 endColor); + void restrictPalette(const uint8 startColor, const int16 endColor); private: /** |