[Scummvm-git-logs] scummvm master -> 43ae2cc2ce89db99cfc00d48a1550fa68c2a6420
sluicebox
22204938+sluicebox at users.noreply.github.com
Tue Aug 11 08:40:05 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
43ae2cc2ce SCI: Set palette entry 0 on more SCI 1.1 operations
Commit: 43ae2cc2ce89db99cfc00d48a1550fa68c2a6420
https://github.com/scummvm/scummvm/commit/43ae2cc2ce89db99cfc00d48a1550fa68c2a6420
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-08-11T01:39:31-07:00
Commit Message:
SCI: Set palette entry 0 on more SCI 1.1 operations
In SCI 1.1 most palette operations copy entry 0 to the system palette,
such as when drawing a view. This continues an earlier fix which
included entry 0 when drawing a pic and exposed that this needs to
happen in other places too: 3de471de36f22c12604d60be16f270c594510a56
Fixes bug #11544 where a KQ6 RAVE resource ended up with the wrong
color in room 380. System palette entry 0 ended up as [7,7,7] when
the RAVE was drawn instead of black, the expected color, causing the
RAVE palette to merge incorrectly. [7,7,7] comes from pic 380's
palette, after which entry 0 should be set to black when drawing
view 5 and copying its palette, which is what now happens.
Changed paths:
engines/sci/graphics/palette.cpp
engines/sci/graphics/palette.h
engines/sci/graphics/picture.cpp
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index 37a5248f21..0cea495d83 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -312,10 +312,16 @@ void GfxPalette::set(Palette *newPalette, bool force, bool forceRealMerge, bool
if (force || newPalette->timestamp != systime) {
// SCI1.1+ doesn't do real merging anymore, but simply copying over the used colors from other palettes
// There are some games with inbetween SCI1.1 interpreters, use real merging for them (e.g. laura bow 2 demo)
- if ((forceRealMerge) || (_useMerging))
+ if (forceRealMerge || _useMerging) {
_sysPaletteChanged |= merge(newPalette, force, forceRealMerge);
- else
- _sysPaletteChanged |= insert(newPalette, &_sysPalette, includeFirstColor && (_palVaryResourceId == -1));
+ } else {
+ // SCI 1.1 has several functions which write to the system palette but
+ // some include the first color and others don't. The first color is
+ // always excluded when Pal-vary is active.
+ includeFirstColor &= (_palVaryResourceId == -1);
+
+ _sysPaletteChanged |= insert(newPalette, &_sysPalette, includeFirstColor);
+ }
// Adjust timestamp on newPalette, so it wont get merged/inserted w/o need
newPalette->timestamp = _sysPalette.timestamp;
@@ -658,7 +664,9 @@ void GfxPalette::kernelRestore(reg_t memoryHandle) {
restoredPalette.colors[colorNr].b = *memoryPtr++;
}
- set(&restoredPalette, true);
+ // restoring excludes the first color, unlike most
+ // operations on the system palette.
+ set(&restoredPalette, true, false, false);
}
}
@@ -677,7 +685,7 @@ void GfxPalette::kernelSyncScreenPalette() {
// Get current palette, update it and put back
g_system->getPaletteManager()->grabPalette(bpal, 0, 256);
- for (int16 i = 1; i < 255; i++) {
+ for (int16 i = 0; i < 255; i++) {
_sysPalette.colors[i].r = bpal[i * 3];
_sysPalette.colors[i].g = bpal[i * 3 + 1];
_sysPalette.colors[i].b = bpal[i * 3 + 2];
diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h
index 46db4caed4..8d2ca9d29b 100644
--- a/engines/sci/graphics/palette.h
+++ b/engines/sci/graphics/palette.h
@@ -52,7 +52,7 @@ public:
bool setAmiga();
void modifyAmigaPalette(const SciSpan<const byte> &data);
void setEGA();
- void set(Palette *sciPal, bool force, bool forceRealMerge = false, bool includeFirstColor = false);
+ void set(Palette *sciPal, bool force, bool forceRealMerge = false, bool includeFirstColor = true);
bool insert(Palette *newPalette, Palette *destPalette, bool includeFirstColor = false);
bool merge(Palette *pFrom, bool force, bool forceRealMerge);
uint16 matchColor(byte r, byte g, byte b);
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index 5ed8c61baa..1c82bbefc8 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -126,7 +126,7 @@ void GfxPicture::drawSci11Vga() {
if (has_cel) {
// Create palette and set it
_palette->createFromData(inbuffer.subspan(palette_data_ptr), &palette);
- _palette->set(&palette, true, false, true);
+ _palette->set(&palette, true);
drawCelData(inbuffer, cel_headerPos, cel_RlePos, cel_LiteralPos, 0, 0, 0, 0, false);
}
More information about the Scummvm-git-logs
mailing list