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

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Tue Feb 8 06:01:42 CET 2011


Revision: 55823
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55823&view=rev
Author:   mthreepwood
Date:     2011-02-08 05:01:42 +0000 (Tue, 08 Feb 2011)

Log Message:
-----------
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.

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 04:24:25 UTC (rev 55822)
+++ scummvm/trunk/engines/sci/graphics/view.cpp	2011-02-08 05:01:42 UTC (rev 55823)
@@ -268,6 +268,16 @@
 				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 @@
 							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 @@
 				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;
+				}
+			}
+		}
 	}
 }
 


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