[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.453,2.454 gfx.h,1.119,1.120

kirben kirben at users.sourceforge.net
Sat May 21 02:10:07 CEST 2005


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

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

Initial support for TMSK masking in HE72+ games.


Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.453
retrieving revision 2.454
diff -u -d -r2.453 -r2.454
--- gfx.cpp	18 May 2005 23:57:17 -0000	2.453
+++ gfx.cpp	21 May 2005 09:05:57 -0000	2.454
@@ -1386,6 +1386,11 @@
 
 	numzbuf = getZPlanes(ptr, zplane_list, false);
 	
+	const byte *tmsk_ptr = NULL;
+	if (_vm->_heversion >= 72) {
+		tmsk_ptr = _vm->findResourceData(MKID('TMSK'), ptr);
+	}
+
 	bottom = y + height;
 	if (bottom > vs->h) {
 		warning("Gdi::drawBitmap, strip drawn to %d below window bottom %d", bottom, vs->h);
@@ -1551,7 +1556,10 @@
 				if (offs) {
 					z_plane_ptr = zplane_list[i] + offs;
 
-					if (useOrDecompress && (flag & dbAllowMaskOr)) {
+					if (tmsk_ptr) {
+						const byte *tmsk = tmsk_ptr + stripnr * 2 + 8;
+						decompressTMSK(mask_ptr, tmsk, z_plane_ptr, height);
+					} else if (useOrDecompress && (flag & dbAllowMaskOr)) {
 						decompressMaskImgOr(mask_ptr, z_plane_ptr, height);
 					} else {
 						decompressMaskImg(mask_ptr, z_plane_ptr, height);
@@ -1862,6 +1870,65 @@
 	}
 }
 
+void Gdi::decompressTMSK(byte *dst, const byte *tmsk, const byte *src, int height) const {
+	int edx;
+	int var_10 = 0;
+	int var_14 = 0;
+	int tmp1 = 0;
+	int tmp2 = 0;
+
+	int esi = 0;
+	int edi = 0;
+	int ebx = 0;
+
+	while (height) {
+		if (esi == 0) {
+			esi = *src++;
+			edx = esi & 0x80;
+			tmp1 = edx;
+			if (edx) {
+				esi &= 0x7F;
+				var_10 = *src++;
+			}
+		}
+
+
+		if (tmp1 == 0) {
+			var_10 = *src++;
+		}
+
+		esi--;
+		if (edi == 0) {
+			edi = *tmsk++;
+			edx = edi & 0x80;
+			tmp2 = edx;
+			if (edx) {
+				edi &= 0x7F;
+				ebx = *tmsk++;
+			}
+		}
+
+		if (tmp2 == 0) {
+			ebx = *tmsk++;
+		}
+
+		edi--;
+
+		edx = ebx;
+		edx = !edx;
+		edx &= *dst;
+
+		var_14 = var_10;
+		var_14 &= ebx;
+
+		edx |= var_14;
+		*dst = edx;
+
+		dst += 80;
+		height--;
+	}
+}
+
 void Gdi::decompressMaskImgOr(byte *dst, const byte *src, int height) const {
 	byte b, c;
 

Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- gfx.h	18 May 2005 23:17:04 -0000	1.119
+++ gfx.h	21 May 2005 09:05:58 -0000	1.120
@@ -256,6 +256,7 @@
 	/* Mask decompressors */
 	void drawStripC64Mask(byte *dst, int stripnr, int width, int height) const;
 	void drawStripNESMask(byte *dst, int stripnr, int top, int height) const;
+	void decompressTMSK(byte *dst, const byte *tmsk, const byte *src, int height) const;
 	void decompressMaskImgOr(byte *dst, const byte *src, int height) const;
 	void decompressMaskImg(byte *dst, const byte *src, int height) const;
 





More information about the Scummvm-git-logs mailing list