mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 06:41:51 +00:00
TUCKER: fix #3106542 - Ego drawn behind background
Looks like an original game glitch, the location 14 background bitmap contains some pixels in range [0xE0-0xF8] which is usually reserved ; add workaround.
This commit is contained in:
parent
3557ff5747
commit
e552b5a8c3
@ -112,7 +112,7 @@ void Graphics::decodeRLE_224(uint8 *dst, const uint8 *src, int w, int h) {
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::decodeRLE_248(uint8 *dst, const uint8 *src, int w, int h, int y1, int y2, bool xflip) {
|
||||
void Graphics::decodeRLE_248(uint8 *dst, const uint8 *src, int w, int h, int y1, int y2, bool xflip, bool color248Only) {
|
||||
int code = 0;
|
||||
int color = 0;
|
||||
for (int y = 0; y < h; ++y) {
|
||||
@ -125,7 +125,7 @@ void Graphics::decodeRLE_248(uint8 *dst, const uint8 *src, int w, int h, int y1,
|
||||
}
|
||||
}
|
||||
if (color != 0) {
|
||||
if ((dst[offset] < 0xE0 || y + y1 < y2) && dst[offset] < 0xF8) {
|
||||
if ((color248Only || dst[offset] < 0xE0 || y + y1 < y2) && dst[offset] < 0xF8) {
|
||||
dst[offset] = color;
|
||||
}
|
||||
} else {
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
|
||||
static void decodeRLE(uint8 *dst, const uint8 *src, int w, int h);
|
||||
static void decodeRLE_224(uint8 *dst, const uint8 *src, int w, int h);
|
||||
static void decodeRLE_248(uint8 *dst, const uint8 *src, int w, int h, int y1, int y2, bool xflip);
|
||||
static void decodeRLE_248(uint8 *dst, const uint8 *src, int w, int h, int y1, int y2, bool xflip, bool color248Only = false);
|
||||
static void decodeRLE_320(uint8 *dst, const uint8 *src, int w, int h);
|
||||
|
||||
static void copyRect(uint8 *dst, int dstPitch, uint8 *src, int srcPitch, int w, int h);
|
||||
|
@ -1749,6 +1749,8 @@ void TuckerEngine::drawCurrentSprite() {
|
||||
if ((_locationNum == 17 || _locationNum == 18) && _currentSpriteAnimationFrame == 16) {
|
||||
return;
|
||||
}
|
||||
// Workaround original game glitch: location 14 contains some colors from [0xE0-0xF8] in a walkable area (tracker item #3106542)
|
||||
const bool color248Only = (_locationNum == 14);
|
||||
SpriteFrame *chr = &_spriteFramesTable[_currentSpriteAnimationFrame];
|
||||
int yPos = _yPosCurrent + _mainSpritesBaseOffset - 54 + chr->yOffset;
|
||||
int xPos = _xPosCurrent;
|
||||
@ -1758,7 +1760,7 @@ void TuckerEngine::drawCurrentSprite() {
|
||||
xPos -= chr->xSize + chr->xOffset - 14;
|
||||
}
|
||||
Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr->sourceOffset, chr->xSize, chr->ySize,
|
||||
chr->yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0);
|
||||
chr->yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0, color248Only);
|
||||
addDirtyRect(xPos, yPos, chr->xSize, chr->ySize);
|
||||
if (_currentSpriteAnimationLength > 1) {
|
||||
SpriteFrame *chr2 = &_spriteFramesTable[_currentSpriteAnimationFrame2];
|
||||
@ -1770,7 +1772,7 @@ void TuckerEngine::drawCurrentSprite() {
|
||||
xPos -= chr2->xSize + chr2->xOffset - 14;
|
||||
}
|
||||
Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr2->sourceOffset, chr2->xSize, chr2->ySize,
|
||||
chr2->yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0);
|
||||
chr2->yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0, color248Only);
|
||||
addDirtyRect(xPos, yPos, chr2->xSize, chr2->ySize);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user