diff options
-rw-r--r-- | scumm/palette.cpp | 27 | ||||
-rw-r--r-- | scumm/scumm.cpp | 1 | ||||
-rw-r--r-- | scumm/scumm.h | 1 |
3 files changed, 25 insertions, 4 deletions
diff --git a/scumm/palette.cpp b/scumm/palette.cpp index 726a69ccb6..20f13e15f5 100644 --- a/scumm/palette.cpp +++ b/scumm/palette.cpp @@ -238,14 +238,29 @@ void ScummEngine::setPaletteFromPtr(const byte *ptr, int numcolor) { // off there, too... I wonder if it hurts other games, too? What exactly is broken // if we remove this patch? // Since it also causes problems in Zak256, I am turning it off for all V4 games and older. - if ((_version <= 4) || (_version >= 7) || (i <= 15 || r < 252 || g < 252 || b < 252)) { + if (_version >= 5 || _version <= 6) { + if ((_heversion >= 80) && (i == 15 || r < 252 || g < 252 || b < 252)) { + *dest++ = r; + *dest++ = g; + *dest++ = b; + } else if (i <= 15 || r < 252 || g < 252 || b < 252) { + *dest++ = r; + *dest++ = g; + *dest++ = b; + } else { + dest += 3; + } + } else { *dest++ = r; *dest++ = g; *dest++ = b; - } else { - dest += 3; } } + + if (_heversion >= 90) { + memcpy(_darkenPalette, _currentPalette, 768); + } + setDirtyColors(0, numcolor - 1); } @@ -633,7 +648,11 @@ void ScummEngine::darkenPalette(int redScale, int greenScale, int blueScale, int const byte *palptr; int color, idx, j; - palptr = getPalettePtr(_curPalIndex, _roomResource); + if (_heversion >= 90) { + palptr = _darkenPalette; + } else { + palptr = getPalettePtr(_curPalIndex, _roomResource); + } for (j = startColor; j <= endColor; j++) { idx = (_heversion == 70) ? _HEV7ActorPalette[j] : j; cptr = palptr + idx * 3; diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 1a54fa1c82..8e4670dae3 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -857,6 +857,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _shadowPalette = NULL; _shadowPaletteSize = 0; memset(_currentPalette, 0, sizeof(_currentPalette)); + memset(_darkenPalette, 0, sizeof(_darkenPalette)); memset(_HEV7ActorPalette, 0, sizeof(_HEV7ActorPalette)); _palDirtyMin = 0; _palDirtyMax = 0; diff --git a/scumm/scumm.h b/scumm/scumm.h index 4935af2ada..069ad819c9 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -1095,6 +1095,7 @@ public: protected: int _shadowPaletteSize; byte _currentPalette[3 * 256]; + byte _darkenPalette[3 * 256]; int _palDirtyMin, _palDirtyMax; |