aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorMartin Kiewitz2010-07-18 12:25:40 +0000
committerMartin Kiewitz2010-07-18 12:25:40 +0000
commit98f0b06fe3afcdff66646cf0f3bee5dd9c0b801e (patch)
tree0a234856bfa9c19b6ec1cbc8c9bf695eacfe2335 /engines/sci/engine
parent30d751734321cc97bd6591af5531ebc5e5f120a4 (diff)
downloadscummvm-rg350-98f0b06fe3afcdff66646cf0f3bee5dd9c0b801e.tar.gz
scummvm-rg350-98f0b06fe3afcdff66646cf0f3bee5dd9c0b801e.tar.bz2
scummvm-rg350-98f0b06fe3afcdff66646cf0f3bee5dd9c0b801e.zip
SCI: adding workaround for script bug in lsl6 when looking through tile
svn-id: r50987
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/vm.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 9fcf95f4d0..9d72562d03 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -338,6 +338,13 @@ static reg_t trackOriginAndFindWorkaround(int index, const SciWorkaroundEntry *w
return make_reg(0xFFFF, 0xFFFF);
}
+static bool validate_unsignedInteger(reg_t reg, uint16 &integer) {
+ if (reg.segment)
+ return false;
+ integer = reg.offset;
+ return true;
+}
+
static bool validate_signedInteger(reg_t reg, int16 &integer) {
if (reg.segment)
return false;
@@ -351,6 +358,12 @@ static const SciWorkaroundEntry opcodeDivWorkarounds[] = {
SCI_WORKAROUNDENTRY_TERMINATOR
};
+// gameID, scriptNr,lvl, object-name, method-name, call, index, replace
+static const SciWorkaroundEntry opcodeDptoaWorkarounds[] = {
+ { GID_LSL6, 938, 0, "ROsc", "cycleDone", -1, 0, { 0, 1 } }, // when looking through tile in the shower room initial cycles get set to an object instead of 2, we fix this by setting 1 after decrease
+ SCI_WORKAROUNDENTRY_TERMINATOR
+};
+
extern const char *opcodeNames[]; // from scriptdebug.cpp
static reg_t arithmetic_lookForWorkaround(const byte opcode, const SciWorkaroundEntry *workaroundList, reg_t value1, reg_t value2) {
@@ -1693,8 +1706,13 @@ void run_vm(EngineState *s, bool restoring) {
case op_dpToa: { // 0x36 (54)
// Decrement Property and copy To Accumulator
- s->r_acc = validate_property(obj, (opparams[0] >> 1));
- s->r_acc = validate_property(obj, (opparams[0] >> 1)) = ACC_ARITHMETIC_L(-1 + /*acc*/);
+ reg_t &opProperty = validate_property(obj, opparams[0] >> 1);
+ uint16 valueProperty;
+ if (validate_unsignedInteger(opProperty, valueProperty))
+ s->r_acc = make_reg(0, valueProperty - 1);
+ else
+ s->r_acc = arithmetic_lookForWorkaround(opcode, opcodeDptoaWorkarounds, opProperty, NULL_REG);
+ opProperty = s->r_acc;
break;
}