diff options
author | Fabio Battaglia | 2009-05-24 13:59:47 +0000 |
---|---|---|
committer | Fabio Battaglia | 2009-05-24 13:59:47 +0000 |
commit | a4b733403a8ebc1acac608c953056eb498d900ba (patch) | |
tree | 688a2d323ea7a473288b898c71328f09571efbb6 /engines | |
parent | e6b62d945cf27942d69f6f6069967532b34c903d (diff) | |
download | scummvm-rg350-a4b733403a8ebc1acac608c953056eb498d900ba.tar.gz scummvm-rg350-a4b733403a8ebc1acac608c953056eb498d900ba.tar.bz2 scummvm-rg350-a4b733403a8ebc1acac608c953056eb498d900ba.zip |
tinsel: take into account clipping when drawing PSX 4-bit images
svn-id: r40862
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tinsel/graphics.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
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); } |