[Scummvm-cvs-logs] SF.net SVN: scummvm:[55825] scummvm/trunk/engines/sci/graphics/view.cpp

waltervn at users.sourceforge.net waltervn at users.sourceforge.net
Tue Feb 8 15:26:40 CET 2011


Revision: 55825
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55825&view=rev
Author:   waltervn
Date:     2011-02-08 14:26:39 +0000 (Tue, 08 Feb 2011)

Log Message:
-----------
SCI: Do not flip clearKey for Mac SCI1.1+ views.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/view.cpp

Modified: scummvm/trunk/engines/sci/graphics/view.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.cpp	2011-02-08 05:39:50 UTC (rev 55824)
+++ scummvm/trunk/engines/sci/graphics/view.cpp	2011-02-08 14:26:39 UTC (rev 55825)
@@ -269,15 +269,6 @@
 				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);
@@ -403,8 +394,25 @@
 		//  over pixels to automatically have them transparent
 		// Also some RLE compressed cels are possibly ending with the last
 		// non-transparent pixel (is this even possible with the current code?)
-		memset(outPtr, _loop[loopNo].cel[celNo].clearKey, pixelCount);
+		byte clearColor = _loop[loopNo].cel[celNo].clearKey;
 
+		// Since Mac OS required 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 a little snippet of code to swap these colors
+		// in various places around the SCI codebase. We figured that it would be less
+		// hacky to swap pixels instead and run the Mac games with a PC palette.
+		if (g_sci->getPlatform() == Common::kPlatformMacintosh) {
+			// clearColor is based on PC palette, but the literal data is not.
+			// We flip clearColor here to make it match the literal data. All
+			// these pixels will be flipped back again below.
+			if (clearColor == 0)
+				clearColor = 0xff;
+			else if (clearColor == 0xff)
+				clearColor = 0;
+		}
+
+		memset(outPtr, clearColor, pixelCount);
+
 		rlePtr = _resourceData + celInfo->offsetRLE;
 		if (!celInfo->offsetLiteral) { // no additional literal data
 			if (_resMan->isAmiga32color()) {
@@ -498,21 +506,13 @@
 			}
 		}
 
-		// 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.
+		// Swap 0 and 0xff pixels for Mac SCI1.1+ games (see above)
 		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;
-				}
+				if (outPtr[i] == 0)
+					outPtr[i] = 0xff;
+				else if (outPtr[i] == 0xff)
+					outPtr[i] = 0;
 			}
 		}
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list