diff options
author | Paul Gilbert | 2015-03-17 08:31:29 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-03-17 08:31:29 -0400 |
commit | ec4319923452bebade836b43a912de06958315a6 (patch) | |
tree | c38ae5f9a3f7d81129f20937febb255469e60587 | |
parent | 51989953b616c97db4d3d433fffee2ab8395606b (diff) | |
download | scummvm-rg350-ec4319923452bebade836b43a912de06958315a6.tar.gz scummvm-rg350-ec4319923452bebade836b43a912de06958315a6.tar.bz2 scummvm-rg350-ec4319923452bebade836b43a912de06958315a6.zip |
SHERLOCK: Convert 6-bit palettes to 8-bit VGA palettes
-rw-r--r-- | engines/sherlock/screen.cpp | 4 | ||||
-rw-r--r-- | engines/sherlock/screen.h | 1 | ||||
-rw-r--r-- | engines/sherlock/sprite.cpp | 3 |
3 files changed, 5 insertions, 3 deletions
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp index 6dcb37c448..500abc1197 100644 --- a/engines/sherlock/screen.cpp +++ b/engines/sherlock/screen.cpp @@ -79,10 +79,10 @@ int Screen::equalizePalette(const byte palette[PALETTE_SIZE]) { for (int idx = 0; idx < PALETTE_SIZE; ++idx) { if (tempPalette[idx] > palette[idx]) { - --tempPalette[idx]; + tempPalette[idx] = MAX((int)palette[idx], (int)tempPalette[idx] - 4); ++total; } else if (tempPalette[idx] < palette[idx]) { - ++tempPalette[idx]; + tempPalette[idx] = MIN((int)palette[idx], (int)tempPalette[idx] + 4); ++total; } } diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h index 62d3944d04..d244452771 100644 --- a/engines/sherlock/screen.h +++ b/engines/sherlock/screen.h @@ -33,6 +33,7 @@ namespace Sherlock { #define PALETTE_SIZE 768 #define PALETTE_COUNT 256 +#define VGA_COLOR_TRANS(x) ((x) * 255 / 63) class SherlockEngine; diff --git a/engines/sherlock/sprite.cpp b/engines/sherlock/sprite.cpp index ca70932155..be5a0e0d27 100644 --- a/engines/sherlock/sprite.cpp +++ b/engines/sherlock/sprite.cpp @@ -85,7 +85,8 @@ void Sprite::loadPalette(Common::SeekableReadStream &stream) { assert((size - 12) == PALETTE_SIZE); stream.seek(4 + 12, SEEK_CUR); - stream.read(&_palette[0], PALETTE_SIZE); + for (int idx = 0; idx < PALETTE_SIZE; ++idx) + _palette[idx] = VGA_COLOR_TRANS(stream.readByte()); } /** |