[Scummvm-cvs-logs] SF.net SVN: scummvm:[40109] scummvm/trunk/engines/tinsel
Hkz at users.sourceforge.net
Hkz at users.sourceforge.net
Fri Apr 24 13:54:11 CEST 2009
Revision: 40109
http://scummvm.svn.sourceforge.net/scummvm/?rev=40109&view=rev
Author: Hkz
Date: 2009-04-24 11:54:10 +0000 (Fri, 24 Apr 2009)
Log Message:
-----------
tinsel: added Discworld PSX palette converting function
Modified Paths:
--------------
scummvm/trunk/engines/tinsel/palette.cpp
scummvm/trunk/engines/tinsel/palette.h
Modified: scummvm/trunk/engines/tinsel/palette.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/palette.cpp 2009-04-24 10:48:51 UTC (rev 40108)
+++ scummvm/trunk/engines/tinsel/palette.cpp 2009-04-24 11:54:10 UTC (rev 40109)
@@ -92,6 +92,33 @@
#endif
/**
+ * Convert Discworld PSX 555 CLUTs to compatible 888 palette
+ */
+COLORREF* psxClutToRGBPal(uint8 *srcClut) {
+ uint8 red, green, blue;
+ uint16 clutEntry;
+
+ // Allocate space for the 16 colour destination palette
+ COLORREF *dstPal = (COLORREF*)calloc(sizeof(COLORREF), MAX_COLOURS);
+ memset(dstPal, 0, MAX_COLOURS * sizeof(COLORREF));
+
+ for (int idx = 0; idx < 0x10; idx++) {
+ clutEntry = READ_LE_UINT16(srcClut); // Read PSX CLUT entry
+ srcClut += sizeof(uint16);
+
+ // Extract color data
+ red = ((clutEntry & 0x1F) * 255) / 31;
+ green = (((clutEntry & 0x3E0) >> 5) * 255) / 31;
+ blue = (((clutEntry & 0x7C00) >> 10) * 255) / 31;
+
+ // Write the palette
+ dstPal[idx] = TINSEL_RGB(red, green, blue);
+ }
+
+ return dstPal;
+}
+
+/**
* Transfer palettes in the palette Q to Video DAC.
*/
void PalettesToVideoDAC(void) {
Modified: scummvm/trunk/engines/tinsel/palette.h
===================================================================
--- scummvm/trunk/engines/tinsel/palette.h 2009-04-24 10:48:51 UTC (rev 40108)
+++ scummvm/trunk/engines/tinsel/palette.h 2009-04-24 11:54:10 UTC (rev 40109)
@@ -107,6 +107,8 @@
void PaletteStats(void); // Shows the maximum number of palettes used at once
#endif
+COLORREF* psxClutToRGBPal(uint8 *srcClut); // Convert Discworld PSX 555 CLUTs to compatible 888 palette
+
void PalettesToVideoDAC(void); // Update the video DAC with palettes currently the the DAC queue
void UpdateDACqueueHandle(
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