aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMatthew Hoops2011-02-07 01:51:09 +0000
committerMatthew Hoops2011-02-07 01:51:09 +0000
commitaa64cf1d6298dd02c6e19079dcca0a25536ec366 (patch)
tree92fe7b333872c316bc7b0cb2b610b278acbcf669 /engines
parente7a57de38ba56f2708403f28ea78ed56c9061ac6 (diff)
downloadscummvm-rg350-aa64cf1d6298dd02c6e19079dcca0a25536ec366.tar.gz
scummvm-rg350-aa64cf1d6298dd02c6e19079dcca0a25536ec366.tar.bz2
scummvm-rg350-aa64cf1d6298dd02c6e19079dcca0a25536ec366.zip
SCI: Fix SCI1.1 Mac picture palettes further
The palette color start is actually a byte, not a uint16. svn-id: r55796
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/graphics/palette.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index 81278ca4b6..cc1bffee4e 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -101,16 +101,18 @@ void GfxPalette::createFromData(byte *data, int bytesLeft, Palette *paletteOut)
int colorNo = 0;
memset(paletteOut, 0, sizeof(Palette));
+
// Setup 1:1 mapping
- for (colorNo = 0; colorNo < 256; colorNo++) {
+ for (colorNo = 0; colorNo < 256; colorNo++)
paletteOut->mapping[colorNo] = colorNo;
- }
+
if (bytesLeft < 37) {
// This happens when loading palette of picture 0 in sq5 - the resource is broken and doesn't contain a full
// palette
debugC(kDebugLevelResMan, "GfxPalette::createFromData() - not enough bytes in resource (%d), expected palette header", bytesLeft);
return;
}
+
// palette formats in here are not really version exclusive, we can not use sci-version to differentiate between them
// they were just called that way, because they started appearing in sci1.1 for example
if ((data[0] == 0 && data[1] == 1) || (data[0] == 0 && data[1] == 0 && READ_SCI11ENDIAN_UINT16(data + 29) == 0)) {
@@ -123,8 +125,10 @@ void GfxPalette::createFromData(byte *data, int bytesLeft, Palette *paletteOut)
// SCI1.1 palette
palFormat = data[32];
palOffset = 37;
- palColorStart = READ_SCI11ENDIAN_UINT16(data + 25); palColorCount = READ_SCI11ENDIAN_UINT16(data + 29);
+ palColorStart = data[25];
+ palColorCount = READ_SCI11ENDIAN_UINT16(data + 29);
}
+
switch (palFormat) {
case SCI_PAL_FORMAT_CONSTANT:
// Check, if enough bytes left
@@ -132,6 +136,7 @@ void GfxPalette::createFromData(byte *data, int bytesLeft, Palette *paletteOut)
warning("GfxPalette::createFromData() - not enough bytes in resource, expected palette colors");
return;
}
+
for (colorNo = palColorStart; colorNo < palColorStart + palColorCount; colorNo++) {
paletteOut->colors[colorNo].used = 1;
paletteOut->colors[colorNo].r = data[palOffset++];
@@ -144,6 +149,7 @@ void GfxPalette::createFromData(byte *data, int bytesLeft, Palette *paletteOut)
warning("GfxPalette::createFromData() - not enough bytes in resource, expected palette colors");
return;
}
+
for (colorNo = palColorStart; colorNo < palColorStart + palColorCount; colorNo++) {
paletteOut->colors[colorNo].used = data[palOffset++];
paletteOut->colors[colorNo].r = data[palOffset++];