[Scummvm-cvs-logs] SF.net SVN: scummvm:[50987] scummvm/trunk/engines/sci/engine/vm.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sun Jul 18 14:25:41 CEST 2010


Revision: 50987
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50987&view=rev
Author:   m_kiewitz
Date:     2010-07-18 12:25:40 +0000 (Sun, 18 Jul 2010)

Log Message:
-----------
SCI: adding workaround for script bug in lsl6 when looking through tile

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/vm.cpp

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2010-07-18 09:50:05 UTC (rev 50986)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2010-07-18 12:25:40 UTC (rev 50987)
@@ -338,6 +338,13 @@
 	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 @@
     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 @@
 
 		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;
 		}
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list