From bbad7ada1b88c18f89590119bccc0ae1bd70b04b Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Thu, 13 Jul 2017 21:06:24 -0500 Subject: SCI32: Ignore chest view palette in Phantasmagoria This fixes the 3-frame glitch that was also present in the original game when moving in the chapel from room 6500 to 6400 in chapter 7. Fixes Trac#9788. --- engines/sci/graphics/celobj32.cpp | 14 +++++++++++++- engines/sci/graphics/palette32.cpp | 4 +++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp index df55ec9567..49b3b0053b 100644 --- a/engines/sci/graphics/celobj32.cpp +++ b/engines/sci/graphics/celobj32.cpp @@ -982,7 +982,19 @@ CelObjView::CelObjView(const GuiResourceId viewId, const int16 loopNo, const int error("Cel is less than 0 on loop 0"); } - _hunkPaletteOffset = data.getUint32SEAt(8); + // HACK: Phantasmagoria view 64001 contains a bad palette that overwrites + // parts of the palette used by the background picture in room 6400, causing + // the black shadows to become tan, and many of the other background colors + // to end up a little bit off. View 64001 renders fine using the existing + // palette created by the background image, so here we just ignore the + // embedded palette entirely. + if (g_sci->getGameId() == GID_PHANTASMAGORIA && + _info.type == kCelTypeView && _info.resourceId == 64001) { + + _hunkPaletteOffset = 0; + } else { + _hunkPaletteOffset = data.getUint32SEAt(8); + } _celHeaderOffset = loopHeader.getUint32SEAt(12) + (data[13] * _info.celNo); const SciSpan celHeader = data.subspan(_celHeaderOffset); diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp index fded8f00b0..0ea64d6864 100644 --- a/engines/sci/graphics/palette32.cpp +++ b/engines/sci/graphics/palette32.cpp @@ -570,7 +570,9 @@ void GfxPalette32::mergePalette(Palette &to, const Palette &from) { // 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) + // some badly programmed rooms, like room 6400 in Phant1 (see Trac#9788). + // (Note, however, that that specific glitch is fully fixed by ignoring a + // bad palette in the CelObjView constructor) for (int i = 0; i < ARRAYSIZE(to.colors); ++i) { if (from.colors[i].used) { to.colors[i] = from.colors[i]; -- cgit v1.2.3