From ac23a92e306dc892e062006f604a816dff0d940c Mon Sep 17 00:00:00 2001 From: athrxx Date: Sun, 14 Apr 2024 15:06:50 +0200 Subject: [PATCH] SCUMM: (MI1/Amiga/Hercules/CGA) - fix bug 4535 (Voodoo lady palette glitches) MI1 Amiga does set up the shadow palette at the beginning and also updates it from o5_roomOps()[SO_ROOM_PALETTE]. But it never actually applies any use of the shadow palette when doing screen palette adjustments. I've also confirmed that the shadow is ignored in DOS CGA and Hercules mode. --- engines/scumm/palette.cpp | 6 +----- engines/scumm/scumm.cpp | 9 +++++++++ engines/scumm/scumm.h | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index 5ea8bd00812..0f7e1bd028c 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -1630,11 +1630,7 @@ void ScummEngine::updatePalette() { for (i = _palDirtyMin; i <= _palDirtyMax; i++) { byte *data; - // In b/w Mac rendering mode, the shadow palette is - // handled by the renderer itself. See comment in - // mac_drawStripToScreen(). - - if (_game.features & GF_SMALL_HEADER && _game.version > 2 && _renderMode != Common::kRenderMacintoshBW) + if (_shadowPalRemap) data = _currentPalette + _shadowPalette[i] * 3; else data = _currentPalette + i * 3; diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 5d2ce11b487..5cfb5b72310 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -520,6 +520,10 @@ ScummEngine_v4::ScummEngine_v4(OSystem *syst, const DetectorResult &dr) : ScummEngine_v5(syst, dr) { _resourceHeaderSize = 6; _game.features |= GF_SMALL_HEADER; + // MI1 Amiga ignores the shadow palette (bug #4535 - Voodoo lady palette glitches). + // I haven't checked other Amiga targets, so I'm limiting it to MI1. + _shadowPalRemap = (!(_game.platform == Common::kPlatformAmiga && _game.id == GID_MONKEY_VGA) && + _renderMode != Common::kRenderCGA && _renderMode != Common::kRenderHercA && _renderMode != Common::kRenderHercG); } ScummEngine_v3::ScummEngine_v3(OSystem *syst, const DetectorResult &dr) @@ -527,6 +531,10 @@ ScummEngine_v3::ScummEngine_v3(OSystem *syst, const DetectorResult &dr) // All v3 and older games only used 16 colors with exception of the GF_OLD256 games. if (!(_game.features & GF_OLD256)) _game.features |= GF_16COLOR; + // In b/w Mac rendering mode, the shadow palette is handled by the renderer itself. + // See comment in mac_drawStripToScreen(). + _shadowPalRemap = (_renderMode != Common::kRenderMacintoshBW && + _renderMode != Common::kRenderCGA && _renderMode != Common::kRenderHercA && _renderMode != Common::kRenderHercG); } ScummEngine_v3old::ScummEngine_v3old(OSystem *syst, const DetectorResult &dr) @@ -538,6 +546,7 @@ ScummEngine_v3old::ScummEngine_v3old(OSystem *syst, const DetectorResult &dr) ScummEngine_v2::ScummEngine_v2(OSystem *syst, const DetectorResult &dr) : ScummEngine_v3old(syst, dr) { + _shadowPalRemap = false; _inventoryOffset = 0; _flashlight.xStrips = 6; _flashlight.yStrips = 4; diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 91e02d699bf..10ad5fdbc52 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -1521,6 +1521,7 @@ protected: int _saveSound = 0; bool _native_mt32 = false; bool _copyProtection = false; + bool _shadowPalRemap = false; // Indy4 Amiga specific uint16 _amigaFirstUsedColor = 0;