aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-07-13 17:00:59 -0500
committerColin Snover2017-07-13 17:19:50 -0500
commit8047f3fa77c6fa2f6bb417366d4c9cbed29b82eb (patch)
tree06bec937b2396d6f2eed800e9c9ce6138ae13b51
parent3e45309b8343fb7c9056c39650905d8464a276db (diff)
downloadscummvm-rg350-8047f3fa77c6fa2f6bb417366d4c9cbed29b82eb.tar.gz
scummvm-rg350-8047f3fa77c6fa2f6bb417366d4c9cbed29b82eb.tar.bz2
scummvm-rg350-8047f3fa77c6fa2f6bb417366d4c9cbed29b82eb.zip
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.
-rw-r--r--engines/sci/graphics/palette32.cpp11
1 files 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];
}