[Scummvm-cvs-logs] CVS: scummvm/sword1 screen.cpp,1.43,1.44

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Sun May 2 06:55:01 CEST 2004


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

Modified Files:
	screen.cpp 
Log Message:
This fixes bug #917427, a masking problem, hopefully without causing any
regressions.

What the patch does is to make sure to check all layers when masking a
sprite, since it's possible that it's being masked by several layers at the
same time. The old code simply picked the first masking layer.


Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- screen.cpp	28 Mar 2004 16:30:49 -0000	1.43
+++ screen.cpp	2 May 2004 13:54:05 -0000	1.44
@@ -451,19 +451,19 @@
 	uint16 lGridSizeX = _gridSizeX + 2 * (SCREEN_LEFT_EDGE / SCRNGRID_X); // width of the grid for the imaginary screen
 
 	for (uint16 blkx = 0; blkx < bWidth; blkx++) {
-		uint16 level = 0;
-		while ((level < _roomDefTable[_currentScreen].totalLayers - 1) && 
-			(!_layerGrid[level][gridX + blkx + gridY * lGridSizeX]))
-			level++;
-		if (level < _roomDefTable[_currentScreen].totalLayers - 1) {
-			uint16 *grid = _layerGrid[level] + gridX + blkx + gridY * lGridSizeX;
-			for (int16 blky = bHeight - 1; blky >= 0; blky--) {
-				if (*grid) {
-					uint8 *blkData = _layerBlocks[level + 1] + (READ_LE_UINT16(grid) - 1) * 128;
-					blitBlockClear(x + blkx, y + blky, blkData);
-				} else 
-					break;
-				grid -= lGridSizeX;
+		// A sprite can be masked by several layers at the same time,
+		// so we have to check them all. See bug #917427.
+		for (int16 level = _roomDefTable[_currentScreen].totalLayers - 2; level >= 0; level--) {
+			if (_layerGrid[level][gridX + blkx + gridY * lGridSizeX]) {
+				uint16 *grid = _layerGrid[level] + gridX + blkx + gridY * lGridSizeX;
+				for (int16 blky = bHeight - 1; blky >= 0; blky--) {
+					if (*grid) {
+						uint8 *blkData = _layerBlocks[level + 1] + (READ_LE_UINT16(grid) - 1) * 128;
+						blitBlockClear(x + blkx, y + blky, blkData);
+					} else 
+						break;
+					grid -= lGridSizeX;
+				}
 			}
 		}
 	}





More information about the Scummvm-git-logs mailing list