[Scummvm-cvs-logs] CVS: scummvm/scumm costume.cpp,1.167,1.168

Eugene Sandulenko sev at users.sourceforge.net
Thu Mar 24 18:13:51 CET 2005


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

Modified Files:
	costume.cpp 
Log Message:
First attempt to use mask for costumes:
  o Now it shows that our mask is too blocky
  o Mask is always applied, i.e. even when actor is in front of masking
    object
  o Probably we need to shift mask up.


Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -d -r1.167 -r1.168
--- costume.cpp	24 Mar 2005 03:38:51 -0000	1.167
+++ costume.cpp	25 Mar 2005 02:13:02 -0000	1.168
@@ -692,6 +692,7 @@
 	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;
@@ -712,21 +713,28 @@
 		if ((_actorY + y < 0) || (_actorY + y + 8 >= _out.h))
 			continue;
 
+
 		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;
-				*((byte *)_out.pixels + (_actorY + y + ty) * _out.pitch + (_actorX + x + tx)) = _vm->_NESPalette[1][c];
+				if (draw)
+					*((byte *)_out.pixels + (_actorY + y + ty) * _out.pitch + (_actorX + x + tx)) = _vm->_NESPalette[1][c];
 			}
 		}
 		if (left > _actorX + x)





More information about the Scummvm-git-logs mailing list