From 8eb8e7366c5c68c3d44a7ce5234f4b7c8bf2015f Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Mon, 7 Nov 2016 19:50:49 -0600 Subject: IMAGE: Add support for 16-bit RLE TGA images Used by Titanic engine. --- image/tga.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'image/tga.cpp') diff --git a/image/tga.cpp b/image/tga.cpp index f22cfcb1ad..adfe7eefbb 100644 --- a/image/tga.cpp +++ b/image/tga.cpp @@ -152,7 +152,7 @@ bool TGADecoder::readHeader(Common::SeekableReadStream &tga, byte &imageType, by // of alpha-bits, however, as the game files that use this decoder seems // to ignore that fact, we force the amount to 8 for 32bpp files for now. _format = Graphics::PixelFormat(4, 8, 8, 8, /* attributeBits */ 8, 16, 8, 0, 24); - } else if (pixelDepth == 16 && imageType == TYPE_TRUECOLOR) { + } else if (pixelDepth == 16) { // 16bpp TGA is ARGB1555 _format = Graphics::PixelFormat(2, 5, 5, 5, attributeBits, 10, 5, 0, 15); } else { @@ -353,6 +353,13 @@ bool TGADecoder::readDataRLE(Common::SeekableReadStream &tga, byte imageType, by #endif count--; } + } else if (pixelDepth == 16 && imageType == TYPE_RLE_TRUECOLOR) { + const uint16 rgb = tga.readUint16LE(); + while (rleCount-- > 0) { + *((uint16 *)data) = rgb; + data += 2; + count--; + } } else if (pixelDepth == 8 && imageType == TYPE_RLE_BW) { byte color = tga.readByte(); while (rleCount-- > 0) { @@ -397,6 +404,12 @@ bool TGADecoder::readDataRLE(Common::SeekableReadStream &tga, byte imageType, by #endif count--; } + } else if (pixelDepth == 16 && imageType == TYPE_RLE_TRUECOLOR) { + while (rleCount-- > 0) { + *((uint16 *)data) = tga.readUint16LE(); + data += 2; + count--; + } } else if (pixelDepth == 8 && imageType == TYPE_RLE_BW) { while (rleCount-- > 0) { byte color = tga.readByte(); -- cgit v1.2.3