[Scummvm-cvs-logs] SF.net SVN: scummvm: [30224] scummvm/trunk/engines/lure/palette.cpp

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sat Jan 5 08:20:26 CET 2008


Revision: 30224
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30224&view=rev
Author:   dreammaster
Date:     2008-01-04 23:20:26 -0800 (Fri, 04 Jan 2008)

Log Message:
-----------
Corrected the RGB values generated for a given EGA palette index

Modified Paths:
--------------
    scummvm/trunk/engines/lure/palette.cpp

Modified: scummvm/trunk/engines/lure/palette.cpp
===================================================================
--- scummvm/trunk/engines/lure/palette.cpp	2008-01-04 21:32:55 UTC (rev 30223)
+++ scummvm/trunk/engines/lure/palette.cpp	2008-01-05 07:20:26 UTC (rev 30224)
@@ -119,14 +119,30 @@
 	}
 }
 
+// EGA palette definition copied from DOSBox 0.72
+static byte ega_palette[64][3] =
+{
+  {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a},
+  {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a},
+  {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f},
+  {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f},
+  {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a},
+  {0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a},
+  {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f},
+  {0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f}
+};
+
 void Palette::convertEGAPalette(const byte *srcPalette) {
 	byte *pDest = _palette->data();
 	const byte *pSrc = srcPalette;
 
 	for (int index = 0; index < 16; ++index, ++pSrc) {
-		*pDest++ = (((*pSrc >> 5) & 1) | ((*pSrc >> 1) & 2)) * 0x55;
-		*pDest++ = (((*pSrc >> 4) & 1) | (*pSrc & 2)) * 0x55;
-		*pDest++ = (((*pSrc >> 3) & 1) | ((*pSrc << 1) & 2)) * 0x55;
+		// Handle RGB components of entry
+		assert(*pSrc < 64);
+		byte *v = &ega_palette[*pSrc][0];
+		*pDest++ = *v++ * 4;
+		*pDest++ = *v++ * 4;
+		*pDest++ = *v++ * 4;
 		*pDest++ = 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