Skip to content

Commit

Permalink
SCI: Fix Mac SCI1.1 view decompression
Browse files Browse the repository at this point in the history
A regression from d2ad789
  • Loading branch information
Matthew Hoops committed Mar 6, 2011
1 parent 6a8fade commit adfa5e1
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions engines/sci/graphics/view.cpp
Expand Up @@ -456,23 +456,24 @@ void unpackCelData(byte *inBuffer, byte *celBitmap, byte clearColor, int pixelCo

pixelNr = pixelLine + width;
}
}
// decompression for data that has two separate streams (probably SCI 1.1 view)
while (pixelNr < pixelCount) {
curByte = *rlePtr++;
runLength = curByte & 0x3F;
switch (curByte & 0xC0) {
case 0: // copy bytes as-is
while (runLength-- && pixelNr < pixelCount)
outPtr[pixelNr++] = *literalPtr++;
break;
case 0x80: // fill with color
memset(outPtr + pixelNr, *literalPtr++, MIN<uint16>(runLength, pixelCount - pixelNr));
pixelNr += runLength;
break;
case 0xC0: // fill with transparent
pixelNr += runLength;
break;
} else {
// decompression for data that has two separate streams (probably SCI 1.1 view)
while (pixelNr < pixelCount) {
curByte = *rlePtr++;
runLength = curByte & 0x3F;
switch (curByte & 0xC0) {
case 0: // copy bytes as-is
while (runLength-- && pixelNr < pixelCount)
outPtr[pixelNr++] = *literalPtr++;
break;
case 0x80: // fill with color
memset(outPtr + pixelNr, *literalPtr++, MIN<uint16>(runLength, pixelCount - pixelNr));
pixelNr += runLength;
break;
case 0xC0: // fill with transparent
pixelNr += runLength;
break;
}
}
}
}
Expand Down

0 comments on commit adfa5e1

Please sign in to comment.