[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.433,2.434 palette_he.cpp,1.6,1.7 wiz_he.cpp,2.45,2.46

kirben kirben at users.sourceforge.net
Sat Apr 9 18:25:47 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25325/scumm

Modified Files:
	intern.h palette_he.cpp wiz_he.cpp 
Log Message:

Add initial rmap support for wizImages.


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.433
retrieving revision 2.434
diff -u -d -r2.433 -r2.434
--- intern.h	10 Apr 2005 00:51:47 -0000	2.433
+++ intern.h	10 Apr 2005 01:25:33 -0000	2.434
@@ -783,6 +783,8 @@
 	int readFileToArray(int slot, int32 size);
 	void writeFileFromArray(int slot, int resID);
 
+	void remapPalette(uint8 *src, uint8 *dst);
+
 	void displayWizImage(WizImage *pwi);
 	void displayWizComplexImage(const WizParameters *params);
 	void drawWizComplexPolygon(int resNum, int state, int po_x, int po_y, int xmapNum, int angle, int zoom, const Common::Rect *r, int flags, int dstResNum, int paletteNum);

Index: palette_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/palette_he.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- palette_he.cpp	9 Apr 2005 09:20:44 -0000	1.6
+++ palette_he.cpp	10 Apr 2005 01:25:33 -0000	1.7
@@ -29,6 +29,49 @@
 
 namespace Scumm {
 
+void ScummEngine_v72he::remapPalette(uint8 *src, uint8 *dst) {
+	int a, b, c, eax, ebx, tmp;
+	uint8 *palPtr;
+
+	int startColor = 10;
+	int endColor = 246;
+	src += 30;
+
+	if (_heversion >= 99) {
+		palPtr = _hePalettes + 1024 + 30;
+	} else {
+		palPtr = _currentPalette + 30;
+	}
+
+	for (int j = startColor; j < endColor; j++) {
+		ebx = 0xFFFF;
+		tmp = 0xFFFF;
+
+		a = *src++;
+		b = *src++;
+		c = *src++;
+
+		uint8 *curPal = palPtr;
+
+		for (int k = startColor; k < endColor; k++) {
+			a -= *curPal++;
+			b -= *curPal++;
+			c -= *curPal++;
+
+			eax = (a * 2) + (b * 2) + (c * 2);
+
+			if (ebx == 0xFFFF || eax <= tmp) {
+				ebx = k;
+				tmp = eax;
+			}
+		}
+
+		if (ebx != 0xFFFF) {
+			dst[j] = ebx;
+		}
+	}
+}
+
 uint8 *ScummEngine_v90he::getHEPaletteIndex(int palSlot) {
 	if (palSlot) {
 		assert(palSlot >= 1 && palSlot <= _numPalettes);

Index: wiz_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.cpp,v
retrieving revision 2.45
retrieving revision 2.46
diff -u -d -r2.45 -r2.46
--- wiz_he.cpp	9 Apr 2005 15:12:26 -0000	2.45
+++ wiz_he.cpp	10 Apr 2005 01:25:33 -0000	2.46
@@ -912,8 +912,8 @@
 			assert(rmap);
 			uint8 *rgbs = findWrappedBlock(MKID('RGBS'), dataPtr, state, 0);
 			assert(rgbs);
-			warning("drawWizImage() unhandled flag 0x2");
-			// XXX modify 'RMAP' buffer
+			remapPalette(rgbs, rmap + 4);
+			warning("drawWizImage() flag 0x2");
 		}
 		if (flags & kWIFPrint) {
 			warning("WizImage printing is unimplemented");





More information about the Scummvm-git-logs mailing list