[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,1.25,1.26 gfx.h,1.3,1.4 object.cpp,1.4,1.5

James Brown ender at users.sourceforge.net
Sun Sep 29 08:21:02 CEST 2002


Update of /cvsroot/scummvm/scummvm/scumm
In directory usw-pr-cvs1:/tmp/cvs-serv24128/scumm

Modified Files:
	gfx.cpp gfx.h object.cpp 
Log Message:
Patch 616144: Sam and Max layering fix (drawMaskOnBoth rewrite)


Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- gfx.cpp	24 Sep 2002 15:46:09 -0000	1.25
+++ gfx.cpp	29 Sep 2002 15:20:01 -0000	1.26
@@ -924,44 +924,62 @@
 			}
 		}
 		CHECK_HEAP;
-		if (flag & dbDrawMaskOnBoth) {
-			_z_plane_ptr = zplane_list[1] + READ_LE_UINT16(zplane_list[1] + stripnr * 2 + 8);
-			_mask_ptr_dest = _vm->getResourceAddress(rtBuffer, 9) + y * NUM_STRIPS + x;
-			if (_useOrDecompress && flag & dbAllowMaskOr)
-				decompressMaskImgOr();
-			else
-				decompressMaskImg();
-		}
-
-		for (i = 1; i < numzbuf; i++) {
-			uint16 offs;
 
-			if (!zplane_list[i])
-				continue;
-
-			if (_vm->_features & GF_SMALL_HEADER)
-				if (_vm->_features & GF_OLD256)
-					offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 4);
-				else
-					offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 2);
-			else
-				offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 8);
-
-			_mask_ptr_dest = _vm->getResourceAddress(rtBuffer, 9) + y * NUM_STRIPS + x + _imgBufOffs[i];
-
-			if (offs) {
-				_z_plane_ptr = zplane_list[i] + offs;
+		// Sam & Max uses dbDrawMaskOnAll for things like the inventory
+		// box and the speech icons. While these objects only have one
+		// mask, it should be applied to all the Z-planes in the room,
+		// i.e. they should mask every actor.
+		//
+		// This flag used to be called dbDrawMaskOnBoth, and all it
+		// would do was to mask Z-plane 0. (Z-plane 1 would also be
+		// masked, because what is now the else-clause used to be run
+		// always.) While this seems to be the only way there is to
+		// mask Z-plane 0, this wasn't good enough since actors in
+		// Z-planes >= 2 would not be masked.
+		//
+		// The flag is also used by The Dig and Full Throttle, but I
+		// don't know what for. At the time of writing, these games
+		// are still too unstable for me to investigate.
 
+		if (flag & dbDrawMaskOnAll) {
+			_z_plane_ptr = zplane_list[1] + READ_LE_UINT16(zplane_list[1] + stripnr * 2 + 8);
+			for (i = 0; i < numzbuf; i++) {
+				_mask_ptr_dest = _vm->getResourceAddress(rtBuffer, 9) + y * NUM_STRIPS + x + _imgBufOffs[i];
 				if (_useOrDecompress && flag & dbAllowMaskOr)
 					decompressMaskImgOr();
 				else
 					decompressMaskImg();
-			} else {
-				if (_useOrDecompress && flag & dbAllowMaskOr);	/* nothing */
-				else
-					for (int h = 0; h < _numLinesToProcess; h++)
-						_mask_ptr_dest[h * NUM_STRIPS] = 0;
-				/* needs better abstraction, FIXME */
+			}
+		} else {
+			for (i = 1; i < numzbuf; i++) {
+				uint16 offs;
+
+				if (!zplane_list[i])
+					continue;
+
+				if (_vm->_features & GF_SMALL_HEADER) {
+					if (_vm->_features & GF_OLD256)
+						offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 4);
+					else
+						offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 2);
+				} else
+					offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 8);
+
+				_mask_ptr_dest = _vm->getResourceAddress(rtBuffer, 9) + y * NUM_STRIPS + x + _imgBufOffs[i];
+
+				if (offs) {
+					_z_plane_ptr = zplane_list[i] + offs;
+
+					if (_useOrDecompress && flag & dbAllowMaskOr)
+						decompressMaskImgOr();
+					else
+						decompressMaskImg();
+				} else {
+					if (!(_useOrDecompress && flag & dbAllowMaskOr));
+						for (int h = 0; h < _numLinesToProcess; h++)
+							_mask_ptr_dest[h * NUM_STRIPS] = 0;
+					/* needs better abstraction, FIXME */
+				}
 			}
 		}
 		CHECK_HEAP;

Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- gfx.h	19 Sep 2002 11:06:10 -0000	1.3
+++ gfx.h	29 Sep 2002 15:20:02 -0000	1.4
@@ -184,7 +184,7 @@
 
 	enum DrawBitmapFlags {
 		dbAllowMaskOr = 1,
-		dbDrawMaskOnBoth = 2,
+		dbDrawMaskOnAll = 2,
 		dbClear = 4
 	};
 };

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- object.cpp	24 Sep 2002 15:23:57 -0000	1.4
+++ object.cpp	29 Sep 2002 15:20:02 -0000	1.5
@@ -378,7 +378,7 @@
 		// Sam & Max needs this to fix object-layering problems with
 		// the inventory and conversation icons.
 		if ((_features & GF_AFTER_V7 || _gameId == GID_SAMNMAX) && getClass(od->obj_nr, 22))
-			flags |= Gdi::dbDrawMaskOnBoth;
+			flags |= Gdi::dbDrawMaskOnAll;
 		gdi.drawBitmap(ptr, _curVirtScreen, x, ypos, height, x - xpos, numstrip, flags);
 	}
 }





More information about the Scummvm-git-logs mailing list