aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2011-02-08 05:01:42 +0000
committerMatthew Hoops2011-02-08 05:01:42 +0000
commit8b1970477100c37e0fa075e7f38b3444ef0d00da (patch)
tree17bbe00044cd6aa20cc1668aa6dd0ce11168dbea
parent464f49d705a42d3b7bd2fedb9564a665716f2a1a (diff)
downloadscummvm-rg350-8b1970477100c37e0fa075e7f38b3444ef0d00da.tar.gz
scummvm-rg350-8b1970477100c37e0fa075e7f38b3444ef0d00da.tar.bz2
scummvm-rg350-8b1970477100c37e0fa075e7f38b3444ef0d00da.zip
SCI: Fix Mac SCI1.1+ view white/black/transparency
Since Mac OS required black to be at 0xff and white to be at 0x00, the original Sierra programs had to hack around that in various sections of the code to keep things in line with the PC versions. We're changing the view pixels instead so we only have to change in one location. svn-id: r55823
-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;
+ }
+ }
+ }
}
}