[Scummvm-git-logs] scummvm branch-2-1 -> fb24fc30b335934b2d55dda276791be8b9552b8f
sluicebox
22204938+sluicebox at users.noreply.github.com
Thu Jan 16 12:56:32 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:
fb24fc30b3 SCI: Set first palette color when drawing a 1.1 pic
Commit: fb24fc30b335934b2d55dda276791be8b9552b8f
https://github.com/scummvm/scummvm/commit/fb24fc30b335934b2d55dda276791be8b9552b8f
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-01-16T04:54:46-08:00
Commit Message:
SCI: Set first palette color when drawing a 1.1 pic
When drawing a pic while pal-very isn't active, SSCI 1.1 sets the
first 255 palette colors, as opposed to skipping the first when
normally inserting a palette. Without this, a palette cycle that
includes the first color will permanently alter the system palette,
such as in Hoyle4 when winning the Klondike game with certain
table backgrounds.
Fixes bugs #11164 and #11195
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 bc0b848..8bc5548 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -304,7 +304,7 @@ void GfxPalette::setEGA() {
setOnScreen();
}
-void GfxPalette::set(Palette *newPalette, bool force, bool forceRealMerge) {
+void GfxPalette::set(Palette *newPalette, bool force, bool forceRealMerge, bool includeFirstColor) {
uint32 systime = _sysPalette.timestamp;
if (force || newPalette->timestamp != systime) {
@@ -313,7 +313,7 @@ void GfxPalette::set(Palette *newPalette, bool force, bool forceRealMerge) {
if ((forceRealMerge) || (_useMerging))
_sysPaletteChanged |= merge(newPalette, force, forceRealMerge);
else
- _sysPaletteChanged |= insert(newPalette, &_sysPalette);
+ _sysPaletteChanged |= insert(newPalette, &_sysPalette, includeFirstColor && (_palVaryResourceId == -1));
// Adjust timestamp on newPalette, so it wont get merged/inserted w/o need
newPalette->timestamp = _sysPalette.timestamp;
@@ -334,10 +334,10 @@ void GfxPalette::set(Palette *newPalette, bool force, bool forceRealMerge) {
}
}
-bool GfxPalette::insert(Palette *newPalette, Palette *destPalette) {
+bool GfxPalette::insert(Palette *newPalette, Palette *destPalette, bool includeFirstColor) {
bool paletteChanged = false;
- for (int i = 1; i < 255; i++) {
+ for (int i = (includeFirstColor ? 0 : 1); i < 255; i++) {
if (newPalette->colors[i].used) {
if ((newPalette->colors[i].r != destPalette->colors[i].r) ||
(newPalette->colors[i].g != destPalette->colors[i].g) ||
diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h
index 2923df9..a753c3b 100644
--- a/engines/sci/graphics/palette.h
+++ b/engines/sci/graphics/palette.h
@@ -52,8 +52,8 @@ public:
bool setAmiga();
void modifyAmigaPalette(const SciSpan<const byte> &data);
void setEGA();
- void set(Palette *sciPal, bool force, bool forceRealMerge = false);
- bool insert(Palette *newPalette, Palette *destPalette);
+ void set(Palette *sciPal, bool force, bool forceRealMerge = false, bool includeFirstColor = false);
+ 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);
void getSys(Palette *pal);
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index 96c6e98..e719617 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -127,7 +127,7 @@ void GfxPicture::drawSci11Vga() {
if (has_cel) {
// Create palette and set it
_palette->createFromData(inbuffer.subspan(palette_data_ptr), &palette);
- _palette->set(&palette, true);
+ _palette->set(&palette, true, false, true);
drawCelData(inbuffer, cel_headerPos, cel_RlePos, cel_LiteralPos, 0, 0, 0, 0, false);
}
More information about the Scummvm-git-logs
mailing list