From a4b733403a8ebc1acac608c953056eb498d900ba Mon Sep 17 00:00:00 2001 From: Fabio Battaglia Date: Sun, 24 May 2009 13:59:47 +0000 Subject: tinsel: take into account clipping when drawing PSX 4-bit images svn-id: r40862 --- engines/tinsel/graphics.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp index 1e1889ec84..6960e40f51 100644 --- a/engines/tinsel/graphics.cpp +++ b/engines/tinsel/graphics.cpp @@ -296,14 +296,12 @@ static void PsxDrawTiles(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply *(tempDest + SCREEN_WIDTH * (yp - boxBounds.top) + (xp - boxBounds.left)) = *(p + (xp - boxBounds.left)); } } else { - if (*p & 0x0f || !transparency) - *(tempDest + SCREEN_WIDTH * (yp - boxBounds.top) + 0) = (*p & 0x0f) + palStart; - if ((*p & 0xf0) >> 4 || !transparency) - *(tempDest + SCREEN_WIDTH * (yp - boxBounds.top) + 1) = ((*p & 0xf0) >> 4) + palStart; - if (*(p + 1) & 0x0f || !transparency) - *(tempDest + SCREEN_WIDTH * (yp - boxBounds.top) + 2) = (*(p + 1) & 0x0f) + palStart; - if ((*(p + 1) & 0xf0) >> 4 || !transparency) - *(tempDest + SCREEN_WIDTH * (yp - boxBounds.top) + 3) = ((*(p + 1) & 0xf0) >> 4) + palStart; + for (int xp = boxBounds.left; xp <= boxBounds.right; ++xp) { + // Extract pixel value from byte + byte pixValue = (*(p + (xp / 2)) & (xp % 2 ? 0xf0 : 0x0f)) >> (xp % 2 ? 4 : 0); + if (pixValue || !transparency) + *(tempDest + SCREEN_WIDTH * (yp - boxBounds.top) + (xp - boxBounds.left)) = pixValue; + } } } @@ -867,6 +865,11 @@ void DrawObject(DRAWOBJECT *pObj) { // WrtTrans with/without clipping WrtTrans(pObj, destPtr, typeId == 0xC4); break; + case 0x04: + case 0x44: + // WrtConst with/without clipping + WrtConst(pObj, destPtr, typeId == 0x44); + break; default: error("Unknown drawing type %d", typeId); } -- cgit v1.2.3