aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2011-08-27 19:57:45 +0200
committerJohannes Schickel2011-08-27 19:57:45 +0200
commit003c16920c1790152e64250b38613f36e39ec719 (patch)
tree32d266679b87803e689d957ece28de1b592f442a
parent064ab0fd628f660d8565512dfbffb0c11a82f046 (diff)
downloadscummvm-rg350-003c16920c1790152e64250b38613f36e39ec719.tar.gz
scummvm-rg350-003c16920c1790152e64250b38613f36e39ec719.tar.bz2
scummvm-rg350-003c16920c1790152e64250b38613f36e39ec719.zip
SCUMM: Also save first used color beyond 80 in Indy4 Amiga palette.
-rw-r--r--engines/scumm/palette.cpp23
-rw-r--r--engines/scumm/saveload.cpp9
-rw-r--r--engines/scumm/saveload.h2
-rw-r--r--engines/scumm/scumm.h1
4 files changed, 24 insertions, 11 deletions
diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp
index 9977436dc6..7a6be90f68 100644
--- a/engines/scumm/palette.cpp
+++ b/engines/scumm/palette.cpp
@@ -380,16 +380,7 @@ void ScummEngine::setAmigaPaletteFromPtr(const byte *ptr) {
_colorUsedByCycle[i] = 0;
}
- _amigaFirstUsedColor = 80;
- for (; _amigaFirstUsedColor < 256; ++_amigaFirstUsedColor) {
- // We look for the first used color here. If all color components are
- // >= 252 the color seems to be unused. Check remapPaletteColor for
- // the same behavior.
- if (ptr[_amigaFirstUsedColor * 3 + 0] <= 251
- || ptr[_amigaFirstUsedColor * 3 + 1] <= 251
- || ptr[_amigaFirstUsedColor * 3 + 2] <= 251)
- break;
- }
+ amigaPaletteFindFirstUsedColor();
for (int i = 0; i < 64; ++i) {
_amigaPalette[i * 3 + 0] = _currentPalette[(i + 16) * 3 + 0] >> 4;
@@ -424,6 +415,18 @@ void ScummEngine::setAmigaPaletteFromPtr(const byte *ptr) {
setDirtyColors(0, 255);
}
+void ScummEngine::amigaPaletteFindFirstUsedColor() {
+ for (_amigaFirstUsedColor = 80; _amigaFirstUsedColor < 256; ++_amigaFirstUsedColor) {
+ // We look for the first used color here. If all color components are
+ // >= 252 the color seems to be unused. Check remapPaletteColor for
+ // the same behavior.
+ if (_currentPalette[_amigaFirstUsedColor * 3 + 0] <= 251
+ || _currentPalette[_amigaFirstUsedColor * 3 + 1] <= 251
+ || _currentPalette[_amigaFirstUsedColor * 3 + 2] <= 251)
+ break;
+ }
+}
+
void ScummEngine::mapRoomPalette(int idx) {
// For Color 33 (which is in fact 17+16) see the special case in
// setAmigaPaletteFromPtr.
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index e0eba99cce..db151c2457 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -1357,6 +1357,15 @@ void ScummEngine::saveOrLoad(Serializer *s) {
s->saveLoadArrayOf(_roomPalette, 256, 1, sleByte);
s->saveLoadArrayOf(_verbPalette, 256, 1, sleByte);
s->saveLoadArrayOf(_amigaPalette, 3 * 64, 1, sleByte);
+
+ // Starting from version 86 we also save the first used color in
+ // the palette beyond the verb palette. For old versions we just
+ // look for it again, which hopefully won't cause any troubles.
+ if (s->getVersion() >= 86) {
+ s->saveLoadArrayOf(&_amigaFirstUsedColor, 1, 2, sleUint16);
+ } else {
+ amigaPaletteFindFirstUsedColor();
+ }
} else {
warning("Save with old Indiana Jones 4 Amiga palette handling detected");
// We need to restore the internal state of the Amiga palette for Indy4
diff --git a/engines/scumm/saveload.h b/engines/scumm/saveload.h
index 792a31d067..16c225d20e 100644
--- a/engines/scumm/saveload.h
+++ b/engines/scumm/saveload.h
@@ -47,7 +47,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 85
+#define CURRENT_VER 86
/**
* An auxillary macro, used to specify savegame versions. We use this instead
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 0af8264a58..d9237b2b30 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1092,6 +1092,7 @@ protected:
// Indy4 Amiga specific
uint16 _amigaFirstUsedColor;
byte _amigaPalette[3 * 64];
+ void amigaPaletteFindFirstUsedColor();
void mapRoomPalette(int idx);
int remapRoomPaletteColor(int r, int g, int b);
void mapVerbPalette(int idx);