diff options
author | Martin Kiewitz | 2009-12-30 21:43:57 +0000 |
---|---|---|
committer | Martin Kiewitz | 2009-12-30 21:43:57 +0000 |
commit | 046d44ebe075a15fb883728f8c86e2422deffe6c (patch) | |
tree | 8f34bbb95c950b104895deddc9d6169dcd365415 | |
parent | c71fc9130d9a9dff8161f72063a2b152b937281b (diff) | |
download | scummvm-rg350-046d44ebe075a15fb883728f8c86e2422deffe6c.tar.gz scummvm-rg350-046d44ebe075a15fb883728f8c86e2422deffe6c.tar.bz2 scummvm-rg350-046d44ebe075a15fb883728f8c86e2422deffe6c.zip |
SCI: fix palette merging (fixes lsl1demo right at the beginning and sq5 wilco on title screen)
svn-id: r46775
-rw-r--r-- | engines/sci/gui/gui_palette.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/engines/sci/gui/gui_palette.cpp b/engines/sci/gui/gui_palette.cpp index ea4911464e..7d26116941 100644 --- a/engines/sci/gui/gui_palette.cpp +++ b/engines/sci/gui/gui_palette.cpp @@ -208,6 +208,13 @@ void SciGuiPalette::merge(GuiPalette *pFrom, GuiPalette *pTo, uint16 flag) { pFrom->mapping[i] = i; continue; } + // is the same color already at the same position? -> match it directly w/o lookup + // this fixes games like lsl1demo/sq5 where the same rgb color exists multiple times and where we would + // otherwise match the wrong one + if ((pTo->colors[i].r == pFrom->colors[i].r) && (pTo->colors[i].g == pFrom->colors[i].g) && (pTo->colors[i].b == pFrom->colors[i].b)) { + pFrom->mapping[i] = i; + continue; + } // check if exact color could be matched res = matchColor(pTo, pFrom->colors[i].r, pFrom->colors[i].g, pFrom->colors[i].b); if (res & 0x8000) { // exact match was found @@ -238,7 +245,7 @@ uint16 SciGuiPalette::matchColor(GuiPalette *pPal, byte r, byte g, byte b) { int diff = 0x2FFFF, cdiff; int16 dr,dg,db; - for (int i = 0; i < 256; i++) { + for (int i = 1; i < 255; i++) { if ((!pPal->colors[i].used)) continue; dr = pPal->colors[i].r - r; |