[Scummvm-cvs-logs] CVS: scummvm/scumm costume.cpp,1.168,1.169 gfx.cpp,2.421,2.422 gfx.h,1.110,1.111 script_v2.cpp,2.266,2.267

Eugene Sandulenko sev at users.sourceforge.net
Fri Mar 25 19:50:01 CET 2005


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

Modified Files:
	costume.cpp gfx.cpp gfx.h script_v2.cpp 
Log Message:
Fixes for MM NES costume mask from Quietust.


Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -d -r1.168 -r1.169
--- costume.cpp	25 Mar 2005 02:13:02 -0000	1.168
+++ costume.cpp	26 Mar 2005 03:49:06 -0000	1.169
@@ -670,6 +670,8 @@
 	const CostumeData &cost = a->_cost;
 	int anim = cost.frame[limb];
 	int frameNum = cost.curpos[limb];
+	byte *bgTransBuf = _vm->getMaskBuffer(0, 0, 0);
+	byte *gfxMaskBuf = _vm->getMaskBuffer(0, 0, 1);
 
 	src = _loaded._dataOffsets;
 
@@ -692,7 +694,6 @@
 	numSprites = numSpritesTab[frame] + 1;
 
 	int left = 239, right = 0, top = 239, bottom = 0;
-	byte *gfxMaskBuf = _vm->getMaskBuffer(0, 0, 1);
 
 	for (int spr = 0; spr < numSprites; spr++) {
 		byte mask = (ptr[0] & 0x80) ? 0x01 : 0x80;
@@ -713,28 +714,27 @@
 		if ((_actorY + y < 0) || (_actorY + y + 8 >= _out.h))
 			continue;
 
-
+		bool doMask = (_zbuf && gfxMaskBuf[(_actorY + y) * _numStrips + (_actorX + x + 4) / 8 - 2]);
+				
 		for (int ty = 0; ty < 8; ty++) {
 			byte c1 = _vm->_NESPatTable[0][tile * 16 + ty];
 			byte c2 = _vm->_NESPatTable[0][tile * 16 + ty + 8];
-			byte gfxMask = gfxMaskBuf[(_actorY + y + ty) * _numStrips + (_actorX + x) / 8 - 2];
 
 			for (int tx = 0; tx < 8; tx++) {
 				unsigned char c = ((c1 & mask) ? 1 : 0) | ((c2 & mask) ? 2 : 0) | palette;
-				bool draw = ((gfxMask & mask) == 0);
 				if (mask == 0x01) {
 					c1 >>= 1;
 					c2 >>= 1;
-					gfxMask >>= 1;
 				} else {
 					c1 <<= 1;
 					c2 <<= 1;
-					gfxMask <<= 1;
 				}
 				if (!(c & 3))
 					continue;
-				if (draw)
-					*((byte *)_out.pixels + (_actorY + y + ty) * _out.pitch + (_actorX + x + tx)) = _vm->_NESPalette[1][c];
+				int my = _actorY + y + ty;
+				int mx = _actorX + x + tx;
+				if (!doMask || !(bgTransBuf[my * _numStrips + mx / 8] & (0x80 >> (mx & 7))))
+					*((byte *)_out.pixels + my * _out.pitch + mx) = _vm->_NESPalette[1][c];
 			}
 		}
 		if (left > _actorX + x)

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.421
retrieving revision 2.422
diff -u -d -r2.421 -r2.422
--- gfx.cpp	25 Mar 2005 22:25:40 -0000	2.421
+++ gfx.cpp	26 Mar 2005 03:49:06 -0000	2.422
@@ -1399,8 +1399,10 @@
 			dstPtr = (byte *)vs->pixels + y * vs->pitch + x * 8;
 
 		if (_vm->_version == 1) {
-			if (_vm->_features & GF_NES)
-				drawStripNES(dstPtr, vs->pitch, stripnr, y, height);
+			if (_vm->_features & GF_NES) {
+				mask_ptr = getMaskBuffer(x, y, 0);
+				drawStripNES(dstPtr, mask_ptr, vs->pitch, stripnr, y, height);
+			}
 			else if (_objectMode)
 				drawStripC64Object(dstPtr, vs->pitch, stripnr, width, height);
 			else
@@ -2037,8 +2039,7 @@
 	} while (y < height);
 }
 
-void Gdi::drawStripNES(byte *dst, int dstPitch, int stripnr, int top, int height) {
-//	printf("drawStripNES, pitch=%i, strip=%i, height=%i\n",dstPitch,stripnr,height);
+void Gdi::drawStripNES(byte *dst, byte *mask, int dstPitch, int stripnr, int top, int height) {
 	top /= 8;
 	height /= 8;
 	int x = stripnr + 2;	// NES version has a 2 tile gap on each edge
@@ -2059,6 +2060,8 @@
 			for (int j = 0; j < 8; j++)
 				dst[j] = _vm->_NESPalette[0][((c0 >> (7 - j)) & 1) | (((c1 >> (7 - j)) & 1) << 1) | (palette << 2)];
 			dst += dstPitch;
+			*mask = c0 | c1;
+			mask += _numStrips;
 		}
 	}
 }

Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- gfx.h	25 Mar 2005 01:59:47 -0000	1.110
+++ gfx.h	26 Mar 2005 03:49:06 -0000	1.111
@@ -248,7 +248,7 @@
 	void drawStripEGA(byte *dst, int dstPitch, const byte *src, int height) const;
 	void drawStripC64Object(byte *dst, int dstPitch, int stripnr, int width, int height);
 	void drawStripC64Background(byte *dst, int dstPitch, int stripnr, int height);
-	void drawStripNES(byte *dst, int dstPitch, int stripnr, int top, int height);
+	void drawStripNES(byte *dst, byte *mask, int dstPitch, int stripnr, int top, int height);
 
 	void drawStripComplex(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;
 	void drawStripBasicH(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;

Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.266
retrieving revision 2.267
diff -u -d -r2.266 -r2.267
--- script_v2.cpp	24 Mar 2005 21:34:34 -0000	2.266
+++ script_v2.cpp	26 Mar 2005 03:49:06 -0000	2.267
@@ -991,7 +991,7 @@
 	
 		// For V1 games, the engine must compute the preposition.
 		// In all other Scumm versions, this is done by the sentence script.
-		if ((_gameId == GID_MANIAC && _version == 1) && (VAR(VAR_SENTENCE_PREPOSITION) == 0)) {
+		if ((_gameId == GID_MANIAC && _version == 1 && !(_features & GF_NES)) && (VAR(VAR_SENTENCE_PREPOSITION) == 0)) {
 			if (_verbs[slot].prep == 0xFF) {
 				byte *ptr = getOBCDFromObject(VAR(VAR_SENTENCE_OBJECT1));
 				assert(ptr);





More information about the Scummvm-git-logs mailing list