[Scummvm-cvs-logs] SF.net SVN: scummvm:[45403] scummvm/trunk/engines/scumm

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Mon Oct 26 13:30:01 CET 2009


Revision: 45403
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45403&view=rev
Author:   Kirben
Date:     2009-10-26 12:29:57 +0000 (Mon, 26 Oct 2009)

Log Message:
-----------
Add patch from Tobias, for costume palettes in PCE version of Loom, with minor changes.

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/costume.cpp
    scummvm/trunk/engines/scumm/palette.cpp
    scummvm/trunk/engines/scumm/scumm.h

Modified: scummvm/trunk/engines/scumm/costume.cpp
===================================================================
--- scummvm/trunk/engines/scumm/costume.cpp	2009-10-26 10:41:28 UTC (rev 45402)
+++ scummvm/trunk/engines/scumm/costume.cpp	2009-10-26 12:29:57 UTC (rev 45403)
@@ -596,7 +596,7 @@
 	byte *dst;
 	byte maskbit;
 	int xPos, yPos;
-	uint color, width, height; //, pcolor;
+	uint pcolor, width, height;
 	bool masked;
 	int vertShift;
 	int xStep;
@@ -651,13 +651,13 @@
 					mask = v1.mask_ptr + yPos * _numStrips + (v1.x + xPos) / 8;
 					maskbit = revBitMask((v1.x + xPos) % 8);
 
-					color = block[row][col];
+					pcolor = block[row][col];
 					masked = (v1.y + yPos < 0 || v1.y + yPos >= _out.h) || 
 					         (v1.x + xPos < 0 || v1.x + xPos >= _out.w) || 
 							 (v1.mask_ptr && (mask[0] & maskbit));
 
-					if (color && !masked) {
-						WRITE_UINT16(dst, _vm->_16BitPalette[color]);
+					if (pcolor && !masked) {
+						WRITE_UINT16(dst, ((uint16*)_palette)[pcolor]);
 					}
 
 					xPos += xStep;
@@ -913,7 +913,14 @@
 }
 
 void PCEngineCostumeRenderer::setPalette(uint16 *palette) {
-	// TODO
+	const byte* ptr = _loaded._palette;
+	byte rgb[45];
+	byte *rgbPtr = rgb;
+	_vm->readPCEPalette(&ptr, &rgbPtr, 15);
+
+	_palette[0] = 0;
+	for (int i = 0; i < 15; ++i)
+		_palette[i + 1] = _vm->get16BitColor(rgb[i * 3 + 0], rgb[i * 3 + 1], rgb[i * 3 + 2]);
 }
 
 void ClassicCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {

Modified: scummvm/trunk/engines/scumm/palette.cpp
===================================================================
--- scummvm/trunk/engines/scumm/palette.cpp	2009-10-26 10:41:28 UTC (rev 45402)
+++ scummvm/trunk/engines/scumm/palette.cpp	2009-10-26 12:29:57 UTC (rev 45403)
@@ -209,7 +209,7 @@
 	*g = ((color >> 6) & 0x7) << 5;
 }
 
-void readPalette(const byte **ptr, byte **dest, int numEntries) {
+void ScummEngine::readPCEPalette(const byte **ptr, byte **dest, int numEntries) {
 	byte r, g, b;
 	byte msbs = 0;
 
@@ -252,7 +252,7 @@
 		*dest++ = bgSpriteB;
 
 		// entry 1 - 14
-		readPalette(&ptr, &dest, 14);
+		readPCEPalette(&ptr, &dest, 14);
 
 		// entry 15: DEFAULT_PALETTE[var3AE3];
 		*dest++ = 6 << 5;

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2009-10-26 10:41:28 UTC (rev 45402)
+++ scummvm/trunk/engines/scumm/scumm.h	2009-10-26 12:29:57 UTC (rev 45403)
@@ -1031,7 +1031,7 @@
 
 	void setPaletteFromTable(const byte *ptr, int numcolor, int firstIndex = 0);
 	void resetPalette();
-
+	
 	void setCurrentPalette(int pal);
 	void setRoomPalette(int pal, int room);
 	void setPCEPaletteFromPtr(const byte *ptr);
@@ -1049,6 +1049,7 @@
 	uint8 *getHEPaletteSlot(uint16 palSlot);
 	uint16 get16BitColor(uint8 r, uint8 g, uint8 b);
 	int remapPaletteColor(int r, int g, int b, int threshold);		// Used by Actor::remapActorPalette
+	void readPCEPalette(const byte **ptr, byte **dest, int numEntries);
 protected:
 	void moveMemInPalRes(int start, int end, byte direction);
 	void setShadowPalette(int slot, int redScale, int greenScale, int blueScale, int startColor, int endColor);


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