aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine/object.cpp')
-rw-r--r--engines/sci/engine/object.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/engines/sci/engine/object.cpp b/engines/sci/engine/object.cpp
index bc79e30129..d8b62fa839 100644
--- a/engines/sci/engine/object.cpp
+++ b/engines/sci/engine/object.cpp
@@ -172,6 +172,17 @@ bool Object::initBaseObject(SegManager *segMan, reg_t addr, bool doInitSuperClas
const Object *baseObj = segMan->getObject(getSpeciesSelector());
if (baseObj) {
+ if (_variables.size() != baseObj->getVarCount()) {
+ warning("Object %04x:%04x varnum doesn't match baseObj's: obj %d, base %d ", PRINT_REG(_pos), _variables.size(), baseObj->getVarCount());
+ // These objects are probably broken.
+ // An example is 'witchCage' in script 200 in KQ5, but also
+ // 'girl' in script 216 and 'door' in script 22.
+ // In LSL3 a number of sound objects trigger this right away.
+
+ // The effect is that a number of its method selectors may be
+ // treated as variable selectors, causing unpredictable effects.
+ // In the case of KQ5/witchCage, this caused bug #3034714.
+ }
_variables.resize(baseObj->getVarCount());
// Copy base from species class, as we need its selector IDs
_baseObj = baseObj->_baseObj;