diff options
author | Matthew Hoops | 2011-02-21 20:32:30 -0500 |
---|---|---|
committer | Matthew Hoops | 2011-02-21 20:32:30 -0500 |
commit | 6db22dde64ca00c31d99c20790063f9ba782552d (patch) | |
tree | 93d1d396cf636666ff5d606de90f630f30ef4840 /engines | |
parent | 4402153a095e152132655c13a94e1098375fe0d3 (diff) | |
download | scummvm-rg350-6db22dde64ca00c31d99c20790063f9ba782552d.tar.gz scummvm-rg350-6db22dde64ca00c31d99c20790063f9ba782552d.tar.bz2 scummvm-rg350-6db22dde64ca00c31d99c20790063f9ba782552d.zip |
SCI: Fixed freddy's Mac icon bar palettes
(hopefully for good now)
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/graphics/palette.cpp | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp index 534890315c..0f95a3f2fb 100644 --- a/engines/sci/graphics/palette.cpp +++ b/engines/sci/graphics/palette.cpp @@ -850,21 +850,16 @@ void GfxPalette::palVaryProcess(int signal, bool setPalette) { byte GfxPalette::findMacIconBarColor(byte r, byte g, byte b) { // Find the best color for use with the Mac icon bar - // For black, always use 0 - if (r == 0 && g == 0 && b == 0) - return 0; - byte found = 0xFF; uint diff = 0xFFFFFFFF; - for (uint16 i = 1; i < 255; i++) { - int dr = _macClut[i * 3 ] - r; - int dg = _macClut[i * 3 + 1] - g; - int db = _macClut[i * 3 + 2] - b; + for (uint16 i = 0; i < 256; i++) { + // Use the difference of the top 4 bits + int dr = (_macClut[i * 3 ] & 0xf0) - (r & 0xf0); + int dg = (_macClut[i * 3 + 1] & 0xf0) - (g & 0xf0); + int db = (_macClut[i * 3 + 2] & 0xf0) - (b & 0xf0); - // Use the largest difference. This is what the Mac Palette Manager does. - uint cdiff = MAX<int>(ABS(dr), ABS(dg)); - cdiff = MAX<int>(cdiff, ABS(db)); + uint cdiff = ABS(dr) + ABS(dg) + ABS(db); if (cdiff == 0) return i; @@ -889,7 +884,9 @@ void GfxPalette::loadMacIconBarPalette() { clutStream->readUint32BE(); // seed clutStream->readUint16BE(); // flags uint16 colorCount = clutStream->readUint16BE() + 1; - _macClut = new byte[colorCount * 3]; + assert(colorCount == 256); + + _macClut = new byte[256 * 3]; for (uint16 i = 0; i < colorCount; i++) { clutStream->readUint16BE(); @@ -898,6 +895,19 @@ void GfxPalette::loadMacIconBarPalette() { _macClut[i * 3 + 2] = clutStream->readUint16BE() >> 8; } + // Adjust bounds on the KQ6 palette + // We don't use all of it for the icon bar + if (g_sci->getGameId() == GID_KQ6) + memset(_macClut + 32 * 3, 0, (256 - 32) * 3); + + // Force black/white + _macClut[0x00 * 3 ] = 0; + _macClut[0x00 * 3 + 1] = 0; + _macClut[0x00 * 3 + 2] = 0; + _macClut[0xff * 3 ] = 0xff; + _macClut[0xff * 3 + 1] = 0xff; + _macClut[0xff * 3 + 2] = 0xff; + delete clutStream; } |