diff options
author | Eugene Sandulenko | 2016-05-02 09:34:50 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-05-02 09:37:17 +0200 |
commit | 052f52747a8a1e40def138355906fbf0260df89b (patch) | |
tree | 844c0b9ada500a51641cc614d23555260358eb0b /engines/scumm | |
parent | 148a1a196cfb346134e0db170275b8dcf9b8c353 (diff) | |
download | scummvm-rg350-052f52747a8a1e40def138355906fbf0260df89b.tar.gz scummvm-rg350-052f52747a8a1e40def138355906fbf0260df89b.tar.bz2 scummvm-rg350-052f52747a8a1e40def138355906fbf0260df89b.zip |
SCUMM HE: Bugfix T14 decoder
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/he/moonbase/moonbase.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/engines/scumm/he/moonbase/moonbase.cpp b/engines/scumm/he/moonbase/moonbase.cpp index 8e8fd12722..4ddaa43f81 100644 --- a/engines/scumm/he/moonbase/moonbase.cpp +++ b/engines/scumm/he/moonbase/moonbase.cpp @@ -49,51 +49,54 @@ void Moonbase::blitT14WizImage(uint8 *dst, int dstw, int dsth, int dstPitch, con } } + dst += clipBox->top * dstPitch + clipBox->left * 2; + int width = READ_LE_UINT16(wizd + 0x8 + 0); int height = READ_LE_UINT16(wizd + 0x8 + 2); int headerSize = READ_LE_UINT32(wizd + 0x4); - uint8 *dataPointer = &wizd[0x8 + headerSize]; - - warning("w: %d, h: %d, size: %d", width, height, headerSize); + uint8 *dataPointer = wizd + 0x8 + headerSize; for (int i = 0; i < height; i++) { uint16 lineSize = READ_LE_UINT16(dataPointer + 0); - uint8 *singlesOffset = dataPointer + READ_LE_UINT16(dataPointer + 2); - uint8 *quadsOffset = dataPointer + READ_LE_UINT16(dataPointer + 4); + uint8 *singlesOffset = READ_LE_UINT16(dataPointer + 2) + dataPointer; + uint8 *quadsOffset = READ_LE_UINT16(dataPointer + 4) + dataPointer; - int linecount = width; + int pixels = width; byte *dst1 = dst; + byte *codes = dataPointer + 6; while (1) { - int code = *dataPointer - 2; + int code = *codes - 2; + codes++; if (code == 0) { // quad for (int c = 0; c < 4; c++) { WRITE_LE_UINT16(dst1, READ_LE_UINT16(quadsOffset)); - singlesOffset += 2; + quadsOffset += 2; dst1 += 2; - linecount--; + pixels--; } } else if (code < 0) { // single WRITE_LE_UINT16(dst1, READ_LE_UINT16(singlesOffset)); singlesOffset += 2; dst1 += 2; - linecount--; + pixels--; } else { // skip if ((code & 1) == 0) { code >>= 1; dst1 += code * 2; - linecount -= code; + pixels -= code; } else { // special case - uint16 color = READ_LE_UINT16(dataPointer); - WRITE_LE_UINT16(dst, color); + uint16 color = READ_LE_UINT16(singlesOffset); + WRITE_LE_UINT16(dst1, color); singlesOffset += 2; dst1 += 2; + pixels--; } } - if (linecount <= 0) + if (pixels <= 0) break; } |