[Scummvm-cvs-logs] SF.net SVN: scummvm:[51508] scummvm/trunk/engines/sci/engine/vm.cpp
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Fri Jul 30 16:56:40 CEST 2010
Revision: 51508
http://scummvm.svn.sourceforge.net/scummvm/?rev=51508&view=rev
Author: thebluegr
Date: 2010-07-30 14:56:38 +0000 (Fri, 30 Jul 2010)
Log Message:
-----------
SCI: Added handling of negative numbers to
op_mod for SCI01 and newer games. Fixes the
battlecruiser mini-game in SQ5. Many thanks
to lskovlun, wjp and m_kiewitz for their
joined effort on this issue
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 13:54:25 UTC (rev 51507)
+++ scummvm/trunk/engines/sci/engine/vm.cpp 2010-07-30 14:56:38 UTC (rev 51508)
@@ -1069,11 +1069,17 @@
case op_mod: { // 0x05 (05)
r_temp = POP32();
- int16 modulo, value;
- if (validate_signedInteger(s->r_acc, modulo) && validate_signedInteger(r_temp, value))
- s->r_acc = make_reg(0, (modulo != 0 ? value % modulo : 0));
- else
+ 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);
+ } 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