SCI: partly reverting r50208, iceman has script code (fred::canBeHere) that asks for property 380. sierra also returned a zero when going out of bounds (see gregs engine object.cpp, ::getPropertyN - fixes iceman, lsl3 and probably more

svn-id: r50229
This commit is contained in:
Martin Kiewitz
2010-06-24 20:01:31 +00:00
parent 42ca630f46
commit 381a862d61
+11
View File
@@ -112,6 +112,7 @@ static reg_t &validate_property(Object *obj, int index) {
//return dummyReg;
}
<<<<<<< HEAD
// This occurs in LSL3, binoculars scene. This gets called from kDoBresen, so fix
// the relevant invalid selector index. TODO: Why does this occur? This looks like
// a script bug.
@@ -124,6 +125,14 @@ static reg_t &validate_property(Object *obj, int index) {
index, obj->getVarCount(), PRINT_REG(obj->getPos()),
s->_segMan->getObjectName(obj->getPos()));
//return dummyReg;
=======
if (index < 0 || (uint)index >= obj->getVarCount()) {
// This is same way sierra does it and there are some games, that contain such scripts like
// iceman script 998 (fred::canBeHere, executed right at the start)
debugC(2, kDebugLevelVM, "[VM] Invalid property #%d (out of [0..%d]) requested!",
index, obj->getVarCount());
return dummyReg;
>>>>>>> 208309a... SCI: partly reverting r50208, iceman has script code (fred::canBeHere) that asks for property 380. sierra also returned a zero when going out of bounds (see gregs engine object.cpp, ::getPropertyN - fixes iceman, lsl3 and probably more
}
return obj->getVariableRef(index);
@@ -929,6 +938,8 @@ void run_vm(EngineState *s, bool restoring) {
s->xs->addr.pc.offset += readPMachineInstruction(code_buf + s->xs->addr.pc.offset, extOpcode, opparams);
const byte opcode = extOpcode >> 1;
warning("%lx", opcode);
switch (opcode) {
case op_bnot: // 0x00 (00)