From 1ac0680a77df8ee59ba2435362bb620ac2bf6e97 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 1 Feb 2011 03:50:29 +0000 Subject: SCI: Fix SCI1.1+ Mac views with uint16 rle lengths (thanks, Walter) svn-id: r55705 --- engines/sci/graphics/view.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index a25ae805d5..603169a931 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -449,12 +449,24 @@ void GfxView::unpackCel(int16 loopNo, int16 celNo, byte *outPtr, uint32 pixelCou literalPtr = _resourceData + celInfo->offsetLiteral; if (celInfo->offsetRLE) { if (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() >= SCI_VERSION_1_1) { + // KQ6 uses byte lengths, all others use uint16 + // The SCI devs must have quickly realized that a max of 255 pixels wide + // was not very good for 320 or 640 width games. + bool hasByteLengths = (g_sci->getGameId() == GID_KQ6); + // compression for SCI1.1+ Mac while (pixelNo < pixelCount) { uint32 pixelLine = pixelNo; - runLength = *rlePtr++; - pixelNo += runLength; - runLength = *rlePtr++; + + if (hasByteLengths) { + pixelNo += *rlePtr++; + runLength = *rlePtr++; + } else { + pixelNo += READ_BE_UINT16(rlePtr); + runLength = READ_BE_UINT16(rlePtr + 2); + rlePtr += 4; + } + while (runLength-- && pixelNo < pixelCount) { outPtr[pixelNo] = *literalPtr++; if (outPtr[pixelNo] == 255) -- cgit v1.2.3