From 8047f3fa77c6fa2f6bb417366d4c9cbed29b82eb Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Thu, 13 Jul 2017 17:00:59 -0500 Subject: SCI32: Stop optimising palette merges While this optimisation helped to reduce unnecessary palette updates in KQ7, it broke Phant1, which relies on changes to index 255 in the source palette causing palette invalidation. Refs Trac#9788. --- engines/sci/graphics/palette32.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp index d7f6710e12..fded8f00b0 100644 --- a/engines/sci/graphics/palette32.cpp +++ b/engines/sci/graphics/palette32.cpp @@ -566,11 +566,12 @@ Palette GfxPalette32::getPaletteFromResource(const GuiResourceId resourceId) con } void GfxPalette32::mergePalette(Palette &to, const Palette &from) { - // The last color is always white in SCI, so it is not copied. (Some - // palettes, particularly in KQ7, try to set the last color, which causes - // unnecessary palette updates since the last color is forced by SSCI to a - // specific value) - for (int i = 0; i < ARRAYSIZE(to.colors) - 1; ++i) { + // All colors MUST be copied, even index 255, despite the fact that games + // cannot actually change index 255 (it is forced to white when generating + // the hardware palette in updateHardware). While this causes some + // additional unnecessary source palette invalidations, not doing it breaks + // some badly programmed rooms, like room 6400 in Phant1 (see Trac#9788) + for (int i = 0; i < ARRAYSIZE(to.colors); ++i) { if (from.colors[i].used) { to.colors[i] = from.colors[i]; } -- cgit v1.2.3