aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2018-10-24 18:42:21 +0300
committerFilippos Karapetis2018-10-24 18:46:56 +0300
commitf4ae043d70d17f13922fb3e2314b46f2ce80f038 (patch)
treeb0acbff738689ff88037f9a652cf7a0c8628bf1a /engines
parent2b28bf942e0e140136aa4b95628ea19f40512b67 (diff)
downloadscummvm-rg350-f4ae043d70d17f13922fb3e2314b46f2ce80f038.tar.gz
scummvm-rg350-f4ae043d70d17f13922fb3e2314b46f2ce80f038.tar.bz2
scummvm-rg350-f4ae043d70d17f13922fb3e2314b46f2ce80f038.zip
SCI32: Fix an array initialization in the floppy version of QFG4
The array used for the trap machine's messages outside Dr. Cranium's lab is set correctly now. Fixes bug #10766.
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/klists.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index 330b78b2b2..e103a13443 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -818,7 +818,22 @@ reg_t kArray(EngineState *s, int argc, reg_t *argv) {
reg_t kArrayNew(EngineState *s, int argc, reg_t *argv) {
uint16 size = argv[0].toUint16();
- const SciArrayType type = (SciArrayType)argv[1].toUint16();
+ SciArrayType type = (SciArrayType)argv[1].toUint16();
+
+ // WORKAROUND: QFG4 floppy has a different Array class in script 64920 than
+ // the CD version. Script 380 (the trap machine outside of Dr. Cranium's
+ // lab) creates 3 integer arrays, and the largest one is used to hold
+ // messages from the machine. In the CD version, the type of that array is
+ // correctly changed to 2 (a byte array), but in the floppy version, the type
+ // remains 0 (an array of 16-bit integers) inside the Array class.
+ // I haven't found a reliable way to patch the array creation in the game
+ // scripts, so we set the large array in the floppy version to be initialized
+ // with the same parameters as in the same way as in the CD version. This
+ // fixes the trap machine's messages in the floppy version.
+ if (g_sci->getGameId() == GID_QFG4 && !g_sci->isCD() && s->currentRoomNumber() == 380 && size == 128 && type == kArrayTypeInt16) {
+ size = 256;
+ type = kArrayTypeByte;
+ }
if (type == kArrayTypeString) {
++size;