[Scummvm-cvs-logs] CVS: scummvm/scumm wiz_he.cpp,2.71,2.72 wiz_he.h,2.19,2.20

kirben kirben at users.sourceforge.net
Mon May 2 00:36:52 CEST 2005


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

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

Add temporary hack for wizImages using compression type 2 for now.


Index: wiz_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.cpp,v
retrieving revision 2.71
retrieving revision 2.72
diff -u -d -r2.71 -r2.72
--- wiz_he.cpp	1 May 2005 14:22:00 -0000	2.71
+++ wiz_he.cpp	2 May 2005 07:36:23 -0000	2.72
@@ -319,6 +319,53 @@
 	}
 }
 
+void Wiz::copyRaw16BitWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags, const uint8 *palPtr, int transColor) {
+	// RAW 16 bits in 555 format
+
+	// HACK: Skip every second bit for now
+	Common::Rect r1, r2;
+	if (calcClipRects(dstw, dsth, srcx, srcy, srcw, srch, rect, r1, r2)) {
+		if (flags & kWIFFlipX) {
+			int l = r1.left;
+			int r = r1.right;
+			r1.left = srcw - r;
+			r1.right = srcw - l;
+		}
+		if (flags & kWIFFlipY) {
+			int t = r1.top;
+			int b = r1.bottom;
+			r1.top = srch - b;
+			r1.bottom = srch - t;
+		}
+		byte imagePal[256];
+		if (!palPtr) {
+			for (int i = 0; i < 256; i++) {
+				imagePal[i] = i;
+			}
+			palPtr = imagePal;
+		}
+
+		int h = r1.height();
+		int w = r1.width();
+		src += r1.left + r1.top * srcw * 2;
+		dst += r2.left + r2.top * dstw;
+
+		while (h--) {
+			const uint8 *p = src;
+			for (int i = 0; i < w; ++i) {
+				uint8 col = *p;
+				if (transColor == -1 || transColor != col) {
+					dst[i] = palPtr[col];
+				}
+				p += 2;
+			}
+			src += srcw * 2;
+			dst += dstw;
+		}
+
+	}
+}
+
 void Wiz::copyRawWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags, const uint8 *palPtr, int transColor) {
 	Common::Rect r1, r2;
 	if (calcClipRects(dstw, dsth, srcx, srcy, srcw, srch, rect, r1, r2)) {
@@ -1005,13 +1052,12 @@
 			palPtr = rmap + 4;
 		}
 
+		uint8 *trns = findWrappedBlock(MKID('TRNS'), dataPtr, state, 0);
+		int color = (trns == NULL) ? VAR(VAR_WIZ_TCOLOR) : -1;
+
 		switch (comp) {
 		case 0:
-			{
-			uint8 *trns = findWrappedBlock(MKID('TRNS'), dataPtr, state, 0);
-			int color = (trns == NULL) ? VAR(VAR_WIZ_TCOLOR) : -1;
 			_wiz.copyRawWizImage(dst, wizd, cw, ch, x1, y1, width, height, &rScreen, flags, palPtr, color);
-			}
 			break;
 		case 1:
 			// TODO Adding masking for flags 0x80 and 0x100
@@ -1025,8 +1071,7 @@
 			_wiz.copyWizImage(dst, wizd, cw, ch, x1, y1, width, height, &rScreen, palPtr);
 			break;
 		case 2:
-			// RAW 16 bits in 555 format
-			warning("drawWizImage: Unhandled wiz compression type %d", comp);
+			_wiz.copyRaw16BitWizImage(dst, wizd, cw, ch, x1, y1, width, height, &rScreen, flags, palPtr, color);
 			break;
 		case 5:
 			// Used in Moonbase Commander

Index: wiz_he.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.h,v
retrieving revision 2.19
retrieving revision 2.20
diff -u -d -r2.19 -r2.20
--- wiz_he.h	30 Apr 2005 05:25:06 -0000	2.19
+++ wiz_he.h	2 May 2005 07:36:23 -0000	2.20
@@ -161,6 +161,7 @@
 	static void copyAuxImage(uint8 *dst1, uint8 *dst2, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch);	
 	static void copyWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, const uint8 *palPtr = NULL);
 	static void copyRawWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags, const uint8 *palPtr, int transColor);
+	static void copyRaw16BitWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags, const uint8 *palPtr, int transColor);
 	static void decompressWizImage(uint8 *dst, int dstPitch, const Common::Rect &dstRect, const uint8 *src, const Common::Rect &srcRect, const uint8 *palPtr = NULL);
 	int isWizPixelNonTransparent(const uint8 *data, int x, int y, int w, int h);
 	uint8 getWizPixelColor(const uint8 *data, int x, int y, int w, int h, uint8 color);





More information about the Scummvm-git-logs mailing list