diff options
author | Gregory Montoir | 2004-07-25 19:05:16 +0000 |
---|---|---|
committer | Gregory Montoir | 2004-07-25 19:05:16 +0000 |
commit | db4c7d22bf1475b9460456bad01b4d73a6ab36d7 (patch) | |
tree | 9ef87ed4879c04fbfdfecbb8debc3e2fb7d37b37 | |
parent | 55a4164f3375bbad5890be5a4bdbe610f6280677 (diff) | |
download | scummvm-rg350-db4c7d22bf1475b9460456bad01b4d73a6ab36d7.tar.gz scummvm-rg350-db4c7d22bf1475b9460456bad01b4d73a6ab36d7.tar.bz2 scummvm-rg350-db4c7d22bf1475b9460456bad01b4d73a6ab36d7.zip |
smush codec37 sub1 (FT demo)
svn-id: r14326
-rw-r--r-- | scumm/smush/codec37.cpp | 71 | ||||
-rw-r--r-- | scumm/smush/codec37.h | 1 |
2 files changed, 71 insertions, 1 deletions
diff --git a/scumm/smush/codec37.cpp b/scumm/smush/codec37.cpp index f108c79b1d..facefa8bab 100644 --- a/scumm/smush/codec37.cpp +++ b/scumm/smush/codec37.cpp @@ -338,6 +338,71 @@ void Codec37Decoder::maketable(int pitch, int index) { dst += 4; \ } while (0) +void Codec37Decoder::proc1(byte *dst, const byte *src, int32 next_offs, int bw, int bh, int pitch, int16 *offset_table) { + uint8 code; + bool filling, skipCode; + int32 len; + int i, p; + uint32 pitches[16]; + + i = bw; + for (p = 0; p < 16; ++p) { + pitches[p] = (p >> 2) * pitch + (p & 0x3); + } + code = 0; + filling = false; + len = -1; + while (1) { + if (len < 0) { + filling = (*src & 1) == 1; + len = *src++ >> 1; + skipCode = false; + } else { + skipCode = true; + } + if (!filling || !skipCode) { + code = *src++; + if (code == 0xFF) { + --len; + for (p = 0; p < 0x10; ++p) { + if (len < 0) { + filling = (*src & 1) == 1; + len = *src++ >> 1; + if (filling) { + code = *src++; + } + } + if (filling) { + *(dst + pitches[p]) = code; + } else { + *(dst + pitches[p]) = *src++; + } + --len; + } + dst += 4; + --i; + if (i == 0) { + dst += pitch * 3; + --bh; + if (bh == 0) return; + i = bw; + } + continue; + } + } + byte *dst2 = dst + offset_table[code] + next_offs; + COPY_4X4(dst2, dst, pitch); + --i; + if (i == 0) { + dst += pitch * 3; + --bh; + if (bh == 0) return; + i = bw; + } + --len; + } +} + void Codec37Decoder::proc3WithFDFE(byte *dst, const byte *src, int32 next_offs, int bw, int bh, int pitch, int16 *offset_table) { do { int32 i = bw; @@ -464,7 +529,11 @@ void Codec37Decoder::decode(byte *dst, const byte *src) { memcpy(_deltaBufs[_curtable], src + 16, decoded_size); break; case 1: - warning("codec37: missing opcode 1"); + if ((seq_nb & 1) || !(mask_flags & 1)) { + _curtable ^= 1; + } + proc1(_deltaBufs[_curtable], src + 16, _deltaBufs[_curtable ^ 1] - _deltaBufs[_curtable], + bw, bh, pitch, _offsetTable); break; case 2: bompDecodeLine(_deltaBufs[_curtable], src + 16, decoded_size); diff --git a/scumm/smush/codec37.h b/scumm/smush/codec37.h index 96955afb22..fb2996c476 100644 --- a/scumm/smush/codec37.h +++ b/scumm/smush/codec37.h @@ -47,6 +47,7 @@ public: void deinit(); protected: void maketable(int, int); + void proc1(byte *dst, const byte *src, int32, int, int, int, int16 *); void proc3WithFDFE(byte *dst, const byte *src, int32, int, int, int, int16 *); void proc3WithoutFDFE(byte *dst, const byte *src, int32, int, int, int, int16 *); void proc4WithFDFE(byte *dst, const byte *src, int32, int, int, int, int16 *); |