diff options
-rw-r--r-- | scumm/palette.cpp | 17 | ||||
-rw-r--r-- | scumm/saveload.cpp | 6 | ||||
-rw-r--r-- | scumm/saveload.h | 2 |
3 files changed, 19 insertions, 6 deletions
diff --git a/scumm/palette.cpp b/scumm/palette.cpp index 45fe354024..b8645f3a98 100644 --- a/scumm/palette.cpp +++ b/scumm/palette.cpp @@ -269,7 +269,7 @@ void ScummEngine::setPaletteFromPtr(const byte *ptr, int numcolor) { } } - if (_heversion >= 90) { + if (_heversion >= 90 || _version == 8) { memcpy(_darkenPalette, _currentPalette, 768); } @@ -674,7 +674,7 @@ void ScummEngine::darkenPalette(int redScale, int greenScale, int blueScale, int const byte *palptr; int color, idx, j; - if (_heversion >= 90) { + if (_heversion >= 90 || _version == 8) { palptr = _darkenPalette; } else { palptr = getPalettePtr(_curPalIndex, _roomResource); @@ -737,7 +737,7 @@ void ScummEngine_v8::desaturatePalette(int hueScale, int satScale, int lightScal byte *cur; int j; - cptr = getPalettePtr(_curPalIndex, _roomResource) + startColor * 3; + cptr = _darkenPalette + startColor * 3; cur = _currentPalette + startColor * 3; for (j = startColor; j <= endColor; j++) { @@ -809,7 +809,9 @@ int ScummEngine::remapPaletteColor(int r, int g, int b, int threshold) { int i; int ar, ag, ab; uint sum, bestsum, bestitem = 0; - byte *pal = _currentPalette; + + int startColor = (_version == 8) ? 24 : 1; + byte *pal = _currentPalette + startColor * 3; if (r > 255) r = 255; @@ -824,7 +826,7 @@ int ScummEngine::remapPaletteColor(int r, int g, int b, int threshold) { g &= ~3; b &= ~3; - for (i = 0; i < 256; i++, pal += 3) { + for (i = startColor; i < 256; i++, pal += 3) { ar = pal[0] & ~3; ag = pal[1] & ~3; ab = pal[2] & ~3; @@ -901,6 +903,11 @@ void ScummEngine::setPalColor(int idx, int r, int g, int b) { _currentPalette[idx * 3 + 0] = r; _currentPalette[idx * 3 + 1] = g; _currentPalette[idx * 3 + 2] = b; + if (_version == 8) { + _darkenPalette[idx * 3 + 0] = r; + _darkenPalette[idx * 3 + 1] = g; + _darkenPalette[idx * 3 + 2] = b; + } setDirtyColors(idx, idx); } diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index 1e3256fed9..5f541d0b71 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -605,6 +605,7 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) { MK_OBSOLETE(ScummEngine, gdi._transparentColor, sleByte, VER(8), VER(50)), MKARRAY(ScummEngine, _currentPalette[0], sleByte, 768, VER(8)), + MKARRAY(ScummEngine, _darkenPalette[0], sleByte, 768, VER(53)), // Sam & Max specific palette replaced by _shadowPalette now. MK_OBSOLETE_ARRAY(ScummEngine, _proc_special_palette[0], sleByte, 256, VER(8), VER(33)), @@ -915,6 +916,11 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) { s->saveLoadArrayOf(_palManipPalette, 0x300, 1, sleByte); s->saveLoadArrayOf(_palManipIntermediatePal, 0x600, 1, sleByte); } + + // darkenPalette was not saved before V53 + if (s->isLoading() && savegameVersion < VER(53)) { + memcpy(_darkenPalette, _currentPalette, 768); + } // diff --git a/scumm/saveload.h b/scumm/saveload.h index 51df8865be..5df78513c7 100644 --- a/scumm/saveload.h +++ b/scumm/saveload.h @@ -45,7 +45,7 @@ namespace Scumm { * only saves/loads those which are valid for the version of the savegame * which is being loaded/saved currently. */ -#define CURRENT_VER 52 +#define CURRENT_VER 53 /** * An auxillary macro, used to specify savegame versions. We use this instead |