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
This commit is contained in:
Torbjörn Andersson 2004-05-02 13:54:05 +00:00
parent ffb842c026
commit 7b9f508729

View File

@ -451,11 +451,10 @@ 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) {
// 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) {
@ -467,6 +466,7 @@ void Screen::verticalMask(uint16 x, uint16 y, uint16 bWidth, uint16 bHeight) {
}
}
}
}
}
void Screen::blitBlockClear(uint16 x, uint16 y, uint8 *data) {