aboutsummaryrefslogtreecommitdiff
path: root/sword1
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-05-02 13:54:05 +0000
committerTorbjörn Andersson2004-05-02 13:54:05 +0000
commit7b9f508729311977ab2e594911c74d7cddcfb4be (patch)
tree70581d0553c367d48ebc6fd1a809467d3e911a32 /sword1
parentffb842c0269368b9bcbbc80f688502471826474b (diff)
downloadscummvm-rg350-7b9f508729311977ab2e594911c74d7cddcfb4be.tar.gz
scummvm-rg350-7b9f508729311977ab2e594911c74d7cddcfb4be.tar.bz2
scummvm-rg350-7b9f508729311977ab2e594911c74d7cddcfb4be.zip
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. svn-id: r13744
Diffstat (limited to 'sword1')
-rw-r--r--sword1/screen.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/sword1/screen.cpp b/sword1/screen.cpp
index c64551b88c..1b180fc962 100644
--- a/sword1/screen.cpp
+++ b/sword1/screen.cpp
@@ -451,19 +451,19 @@ void Screen::verticalMask(uint16 x, uint16 y, uint16 bWidth, uint16 bHeight) {
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;
+ }
}
}
}