aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gui
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-05 16:51:01 +0000
committerMartin Kiewitz2009-10-05 16:51:01 +0000
commitd7f584166dcde5e183c89b0e9fcfa2c99ba43061 (patch)
tree7a0702fbffbe3bb7810fba789300314ee83d90cd /engines/sci/gui
parent91a16e0c7dd97b24461901d03b1b485eea833dcc (diff)
downloadscummvm-rg350-d7f584166dcde5e183c89b0e9fcfa2c99ba43061.tar.gz
scummvm-rg350-d7f584166dcde5e183c89b0e9fcfa2c99ba43061.tar.bz2
scummvm-rg350-d7f584166dcde5e183c89b0e9fcfa2c99ba43061.zip
SVN/newgui: ega cel uncompression implemented
svn-id: r44665
Diffstat (limited to 'engines/sci/gui')
-rw-r--r--engines/sci/gui/gui_view.cpp42
1 files changed, 24 insertions, 18 deletions
diff --git a/engines/sci/gui/gui_view.cpp b/engines/sci/gui/gui_view.cpp
index 4eaf45e662..6d6de0f118 100644
--- a/engines/sci/gui/gui_view.cpp
+++ b/engines/sci/gui/gui_view.cpp
@@ -233,12 +233,18 @@ void SciGuiView::unpackCel(GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte *outPt
sciViewCelInfo *celInfo = getCelInfo(loopNo, celNo);
byte *rlePtr;
byte *literalPtr;
- uint16 pixelNo = 0, brun;
- byte b;
+ uint16 pixelNo = 0, runLength;
+ byte byte;
if (celInfo->offsetEGA) { // EGA data
literalPtr = _resourceData + _loop[loopNo].cel[celNo].offsetEGA;
- // FIXME: Implement EGA "decompression"
+ while (pixelNo < pixelCount) {
+ byte = *literalPtr++;
+ runLength = byte >> 4;
+ byte = _EGAMapping[byte & 0x0F];
+ memset(outPtr + pixelNo, byte, MIN<uint16>(runLength, pixelCount - pixelNo));
+ pixelNo += runLength;
+ }
return;
}
@@ -246,38 +252,38 @@ void SciGuiView::unpackCel(GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte *outPt
rlePtr = _resourceData + celInfo->offsetRLE;
if (!celInfo->offsetLiteral) { // no extra literal data
while (pixelNo < pixelCount) {
- b = *rlePtr++;
- brun = b & 0x3F; // bytes run length on this step
- switch (b & 0xC0) {
+ byte = *rlePtr++;
+ runLength = byte & 0x3F;
+ switch (byte & 0xC0) {
case 0: // copy bytes as-is
- while (brun-- && pixelNo < pixelCount)
+ while (runLength-- && pixelNo < pixelCount)
outPtr[pixelNo++] = *rlePtr++;
break;
case 0x80: // fill with color
- memset(outPtr + pixelNo, *rlePtr++, MIN<uint16>(brun, pixelCount - pixelNo));
- pixelNo += brun;
+ memset(outPtr + pixelNo, *rlePtr++, MIN<uint16>(runLength, pixelCount - pixelNo));
+ pixelNo += runLength;
break;
case 0xC0: // fill with transparent
- pixelNo += brun;
+ pixelNo += runLength;
break;
}
}
} else {
literalPtr = _resourceData + celInfo->offsetLiteral;
while (pixelNo < pixelCount) {
- b = *rlePtr++;
- brun = b & 0x3F; // bytes run length on this step
- switch (b & 0xC0) {
+ byte = *rlePtr++;
+ runLength = byte & 0x3F;
+ switch (byte & 0xC0) {
case 0: // copy bytes as-is
- while (brun-- && pixelNo < pixelCount)
+ while (runLength-- && pixelNo < pixelCount)
outPtr[pixelNo++] = *literalPtr++;
break;
case 0x80: // fill with color
- memset(outPtr + pixelNo, *literalPtr++, MIN<uint16>(brun, pixelCount - pixelNo));
- pixelNo += brun;
+ memset(outPtr + pixelNo, *literalPtr++, MIN<uint16>(runLength, pixelCount - pixelNo));
+ pixelNo += runLength;
break;
case 0xC0: // fill with transparent
- pixelNo += brun;
+ pixelNo += runLength;
break;
}
}
@@ -304,7 +310,7 @@ byte *SciGuiView::getBitmap(GuiViewLoopNo loopNo, GuiViewCelNo celNo) {
memset(pOut, _loop[loopNo].cel[celNo].clearKey, pixelCount);
unpackCel(loopNo, celNo, pOut, pixelCount);
- // mirroring the view if needed
+ // mirroring the cel if needed
if (_loop[loopNo].mirrorFlag) {
for (int i = 0; i < height; i++, pOut += width)
for (int j = 0; j < width / 2; j++)