aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/graphics/view.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 2e6b0f1bbe..ee13636e70 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -268,6 +268,16 @@ void GfxView::initData(GuiResourceId resourceId) {
cel->offsetEGA = 0;
cel->offsetRLE = READ_SCI11ENDIAN_UINT32(celData + 24);
cel->offsetLiteral = READ_SCI11ENDIAN_UINT32(celData + 28);
+
+ // Swap 0 and 0xff for Mac SCI1.1+ games
+ // See unpackCel() for more info
+ if (g_sci->getPlatform() == Common::kPlatformMacintosh) {
+ if (cel->clearKey == 0)
+ cel->clearKey = 0xff;
+ else if (cel->clearKey == 0xff)
+ cel->clearKey = 0;
+ }
+
// GK1-hires content is actually uncompressed, we need to swap both so that we process it as such
if ((cel->offsetRLE) && (!cel->offsetLiteral))
SWAP(cel->offsetRLE, cel->offsetLiteral);
@@ -456,12 +466,9 @@ void GfxView::unpackCel(int16 loopNo, int16 celNo, byte *outPtr, uint32 pixelCou
rlePtr += 4;
}
- while (runLength-- && pixelNo < pixelCount) {
- outPtr[pixelNo] = *literalPtr++;
- if (outPtr[pixelNo] == 255)
- outPtr[pixelNo] = 0;
- pixelNo++;
- }
+ while (runLength-- && pixelNo < pixelCount)
+ outPtr[pixelNo++] = *literalPtr++;
+
pixelNo = pixelLine + celInfo->width;
}
} else {
@@ -490,6 +497,24 @@ void GfxView::unpackCel(int16 loopNo, int16 celNo, byte *outPtr, uint32 pixelCou
pixelNo = pixelCount;
}
}
+
+ // Swap 0 and 0xff for Mac SCI1.1+ games
+ // Since Mac OS required that palette index 0 to be white and 0xff to be black,
+ // the Mac SCI devs decided that rather than change scripts and various pieces of
+ // code, that they would just put this little snippet of code in various places
+ // around the SCI codebase. We figured that it would be less hacky to swap pixels
+ // instead of fill color and transparency color, etc. We don't swap the one that
+ // is transparent here because we swapped clearKey earlier.
+ if (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() >= SCI_VERSION_1_1) {
+ for (uint32 i = 0; i < pixelCount; i++) {
+ if (outPtr[i] != _loop[loopNo].cel[celNo].clearKey) {
+ if (outPtr[i] == 0)
+ outPtr[i] = 0xff;
+ else if (outPtr[i] == 0xff)
+ outPtr[i] = 0;
+ }
+ }
+ }
}
}