[Scummvm-cvs-logs] SF.net SVN: scummvm:[51509] scummvm/trunk/engines/sci/engine/vm.cpp
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Fri Jul 30 17:19:22 CEST 2010
Revision: 51509
http://scummvm.svn.sourceforge.net/scummvm/?rev=51509&view=rev
Author: thebluegr
Date: 2010-07-30 15:19:21 +0000 (Fri, 30 Jul 2010)
Log Message:
-----------
SCI: Updated the op_mod changes and added a link to the original bug report
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-30 14:56:38 UTC (rev 51508)
+++ scummvm/trunk/engines/sci/engine/vm.cpp 2010-07-30 15:19:21 UTC (rev 51509)
@@ -1069,16 +1069,29 @@
case op_mod: { // 0x05 (05)
r_temp = POP32();
- int16 modulo, value, result;
- if (validate_signedInteger(s->r_acc, modulo) && validate_signedInteger(r_temp, value)) {
- modulo = ABS(modulo);
- result = (modulo != 0 ? value % modulo : 0);
- // In SCI01, handling for negative numbers was added
- if (getSciVersion() >= SCI_VERSION_01 && result < 0)
- result += modulo;
- s->r_acc = make_reg(0, result);
+
+ if (getSciVersion() <= SCI_VERSION_0_LATE) {
+ uint16 modulo, value;
+ if (validate_unsignedInteger(s->r_acc, modulo) && validate_unsignedInteger(r_temp, value))
+ s->r_acc = make_reg(0, (modulo != 0 ? value % modulo : 0));
+ else
+ s->r_acc = arithmetic_lookForWorkaround(opcode, NULL, s->r_acc, r_temp);
} else {
- s->r_acc = arithmetic_lookForWorkaround(opcode, NULL, s->r_acc, r_temp);
+ // In Iceman (and perhaps from SCI0 0.000.685 onwards in general),
+ // handling for negative numbers was added. Since Iceman doesn't
+ // seem to have issues with the older code, we exclude it for now
+ // for simplicity's sake and use the new code for SCI01 and newer
+ // games. Fixes the battlecruiser mini game in SQ5 (room 850),
+ // bug #3035755
+ int16 modulo, value, result;
+ if (validate_signedInteger(s->r_acc, modulo) && validate_signedInteger(r_temp, value)) {
+ modulo = ABS(modulo);
+ result = (modulo != 0 ? value % modulo : 0);
+ if (result < 0)
+ result += modulo;
+ s->r_acc = make_reg(0, result);
+ } else
+ s->r_acc = arithmetic_lookForWorkaround(opcode, NULL, s->r_acc, r_temp);
}
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