diff options
author | Paul Gilbert | 2016-09-24 10:11:44 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-09-24 10:11:44 -0400 |
commit | c070d109ee5979b45c89930a32fbed37f6fcabc5 (patch) | |
tree | 857cf8ee46a9e8a535133e1ece8322789f5a7cca | |
parent | c0bffdf60caae79ce8a4c4747bad0a2dadaf9aae (diff) | |
download | scummvm-rg350-c070d109ee5979b45c89930a32fbed37f6fcabc5.tar.gz scummvm-rg350-c070d109ee5979b45c89930a32fbed37f6fcabc5.tar.bz2 scummvm-rg350-c070d109ee5979b45c89930a32fbed37f6fcabc5.zip |
XEEN: Fixes for setup of Clouds decompressor
-rw-r--r-- | engines/xeen/worldofxeen/clouds_cutscenes.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/engines/xeen/worldofxeen/clouds_cutscenes.cpp b/engines/xeen/worldofxeen/clouds_cutscenes.cpp index ae4ec007c8..9ae9c45df3 100644 --- a/engines/xeen/worldofxeen/clouds_cutscenes.cpp +++ b/engines/xeen/worldofxeen/clouds_cutscenes.cpp @@ -440,31 +440,29 @@ void CloudsCutscenes::loadScreen(const Common::String &name) { array3[ARRAY_LAST2] = -1; array2[ARRAY_LAST2] = 4036; + // Get the decompressed size and default buffer contents uint16 bits = 0x8000; byte *bufferP = &buffer[0]; - WRITE_LE_UINT16(bufferP, READ_LE_UINT16(srcP)); - bufferP += 2; - - int count = srcP[2]; + Common::fill((uint16 *)buffer, (uint16 *)(buffer + 4164), + *((uint16 *)srcP)); + int count = READ_BE_UINT16(&srcP[2]); srcP += 4; - int vCx = 0; for (int byteIdx = 0; byteIdx < count; ) { int vMin = array2[(ARRAY_SIZE - 1) * 2]; int vThreshold = (ARRAY_SIZE - 1) * 4; while (vMin < vThreshold) { - vCx = 0; bool flag = (bits & 0x8000); bits <<= 1; - if (!vCx) { + if (!bits) { bits = READ_BE_UINT16(srcP); srcP += 2; flag = (bits & 0x8000); bits = (bits << 1) | 1; } - vMin = array2[vMin / 2 + flag ? 2 : 0]; + vMin = array2[vMin / 2 + (flag ? 2 : 0)]; } vMin -= vThreshold; @@ -584,15 +582,14 @@ void CloudsCutscenes::loadScreen(const Common::String &name) { } t2Val |= (bitsHigh & 0x3F); - int buffOffset = array2[ARRAY_SIZE * 4 - 1] - t2Val - 1; - + int buffOffset = array2[ARRAY_LAST2] - t2Val - 1; for (int ctr = 0; ctr < vMin - 253; ++ctr, ++buffOffset) { buffOffset &= 0xfff; byte b = buffer[buffOffset]; *destP++ = b; - int &buffOffset2 = array2[ARRAY_SIZE * 4 - 1]; + int &buffOffset2 = array2[ARRAY_LAST2]; buffer[buffOffset2++] = b; ++byteIdx; } |