From 7aa804b5ccd3489c852bbde01362bd2ce91d6cf8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 May 2015 22:27:36 -0400 Subject: SHERLOCK: Implement Tattoo version of image RLE compression --- engines/sherlock/resources.cpp | 22 ++++++++++++++++++++++ engines/sherlock/scene.cpp | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) (limited to 'engines/sherlock') diff --git a/engines/sherlock/resources.cpp b/engines/sherlock/resources.cpp index 1c154a3a5f..24fef3f235 100644 --- a/engines/sherlock/resources.cpp +++ b/engines/sherlock/resources.cpp @@ -383,6 +383,28 @@ void ImageFile::decompressFrame(ImageFrame &frame, const byte *src) { *pDest++ = *src & 0xF; *pDest++ = (*src >> 4); } + } else if (frame._rleEncoded && _vm->getGameID() == GType_RoseTattoo) { + // Rose Tattoo run length encoding doesn't use the RLE marker byte + byte *dst = (byte *)frame._frame.getPixels(); + + for (int yp = 0; yp < frame._height; ++yp) { + int xSize = frame._width; + while (xSize > 0) { + // Skip a given number of pixels + byte skip = *src++; + dst += skip; + xSize -= skip; + if (!xSize) + break; + + // Get a run length, and copy the following number of pixels + int rleCount = *src++; + xSize -= rleCount; + while (rleCount-- > 0) + *dst++ = *src++; + } + assert(xSize == 0); + } } else if (frame._rleEncoded) { // RLE encoded byte *dst = (byte *)frame._frame.getPixels(); diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp index bf8d837f9e..034896486e 100644 --- a/engines/sherlock/scene.cpp +++ b/engines/sherlock/scene.cpp @@ -370,7 +370,7 @@ bool Scene::loadScene(const Common::String &filename) { // Read in the image data Common::SeekableReadStream *imageStream = _lzwMode ? - Resources::decompressLZ(*rrmStream, bgInfo[idx]._filesize) : + res.decompress(*rrmStream, bgInfo[idx]._filesize) : rrmStream->readStream(bgInfo[idx]._filesize); _images[idx + 1]._images = new ImageFile(*imageStream); -- cgit v1.2.3