aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/klists.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2011-10-18 03:10:19 +0300
committerFilippos Karapetis2011-10-18 03:10:19 +0300
commit7708a4ddbbcd7e7880890be252f5be1fa6a8eabb (patch)
tree9df1237d8b0677863a39f2bfd7d195ed58d1c4fd /engines/sci/engine/klists.cpp
parent021b09d35c9375750849fde8572c1ed28a1883e8 (diff)
downloadscummvm-rg350-7708a4ddbbcd7e7880890be252f5be1fa6a8eabb.tar.gz
scummvm-rg350-7708a4ddbbcd7e7880890be252f5be1fa6a8eabb.tar.bz2
scummvm-rg350-7708a4ddbbcd7e7880890be252f5be1fa6a8eabb.zip
SCI: Added some hacks related to new functionality in Phantasmagoria 2
The game will now start (but won't do anything exciting - it'll display its main menu, which doesn't work yet)
Diffstat (limited to 'engines/sci/engine/klists.cpp')
-rw-r--r--engines/sci/engine/klists.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index 68469f5c9a..8500f08211 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -691,6 +691,16 @@ reg_t kArray(EngineState *s, int argc, reg_t *argv) {
}
case 2: { // At (return value at an index)
SciArray<reg_t> *array = s->_segMan->lookupArray(argv[1]);
+ if (g_sci->getGameId() == GID_PHANTASMAGORIA2) {
+ // HACK: Phantasmagoria 2 keeps trying to access past the end of an
+ // array when it starts. I'm assuming it's trying to see where the
+ // array ends, or tries to resize it. Adjust the array size
+ // accordingly, and return NULL for now.
+ if (array->getSize() == argv[2].toUint16()) {
+ array->setSize(argv[2].toUint16());
+ return NULL_REG;
+ }
+ }
return array->getValue(argv[2].toUint16());
}
case 3: { // Atput (put value at an index)