aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWalter van Niftrik2010-01-30 04:01:15 +0000
committerWalter van Niftrik2010-01-30 04:01:15 +0000
commit7dbd0fc181fabbe21896ece009f8d31445e13e46 (patch)
tree42a249ada4869c810783436abcc89eccf8e2b08e
parent2f68af90d5e793cb2d76ec748e515c58d961b3f7 (diff)
downloadscummvm-rg350-7dbd0fc181fabbe21896ece009f8d31445e13e46.tar.gz
scummvm-rg350-7dbd0fc181fabbe21896ece009f8d31445e13e46.tar.bz2
scummvm-rg350-7dbd0fc181fabbe21896ece009f8d31445e13e46.zip
SCI: Apply fix from r47683 to u> and u<= as well. Fixes Longbow.
svn-id: r47700
-rw-r--r--engines/sci/engine/vm.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 8b688858d9..83f8f5e01a 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -885,15 +885,6 @@ void run_vm(EngineState *s, int restoring) {
case op_ugt_: // 0x13 (19)
s->r_prev = s->r_acc;
r_temp = POP32();
- if (r_temp.segment && s->r_acc.segment)
- s->r_acc = make_reg(0, (r_temp.segment == s->r_acc.segment) && r_temp.offset > s->r_acc.offset);
- else
- s->r_acc = ACC_ARITHMETIC_L(validate_arithmetic(r_temp) > /*acc*/);
- break;
-
- case op_uge_: // 0x14 (20)
- s->r_prev = s->r_acc;
- r_temp = POP32();
// SCI0/SCI1 scripts use this to check whether a
// parameter is a pointer or a far text
@@ -905,8 +896,21 @@ void run_vm(EngineState *s, int restoring) {
// It works because in those games, the maximum resource number is 999,
// so any parameter value above that threshold must be a pointer.
- if (s->r_acc == make_reg(0, 0x3e8))
- s->r_acc = make_reg(0, r_temp.segment);
+ if (r_temp.segment && (s->r_acc == make_reg(0, 0x3e8)))
+ s->r_acc = make_reg(0, 1);
+ else if (r_temp.segment && s->r_acc.segment)
+ s->r_acc = make_reg(0, (r_temp.segment == s->r_acc.segment) && r_temp.offset > s->r_acc.offset);
+ else
+ s->r_acc = ACC_ARITHMETIC_L(validate_arithmetic(r_temp) > /*acc*/);
+ break;
+
+ case op_uge_: // 0x14 (20)
+ s->r_prev = s->r_acc;
+ r_temp = POP32();
+
+ // See above
+ if (r_temp.segment && (s->r_acc == make_reg(0, 0x3e8)))
+ s->r_acc = make_reg(0, 1);
else if (r_temp.segment && s->r_acc.segment)
s->r_acc = make_reg(0, (r_temp.segment == s->r_acc.segment) && r_temp.offset >= s->r_acc.offset);
else
@@ -918,8 +922,8 @@ void run_vm(EngineState *s, int restoring) {
r_temp = POP32();
// See above
- if (s->r_acc == make_reg(0, 0x3e8))
- s->r_acc = make_reg(0, !r_temp.segment);
+ if (r_temp.segment && (s->r_acc == make_reg(0, 0x3e8)))
+ s->r_acc = NULL_REG;
else if (r_temp.segment && s->r_acc.segment)
s->r_acc = make_reg(0, (r_temp.segment == s->r_acc.segment) && r_temp.offset < s->r_acc.offset);
else
@@ -929,7 +933,11 @@ void run_vm(EngineState *s, int restoring) {
case op_ule_: // 0x16 (22)
s->r_prev = s->r_acc;
r_temp = POP32();
- if (r_temp.segment && s->r_acc.segment)
+
+ // See above
+ if (r_temp.segment && (s->r_acc == make_reg(0, 0x3e8)))
+ s->r_acc = NULL_REG;
+ else if (r_temp.segment && s->r_acc.segment)
s->r_acc = make_reg(0, (r_temp.segment == s->r_acc.segment) && r_temp.offset <= s->r_acc.offset);
else
s->r_acc = ACC_ARITHMETIC_L(validate_arithmetic(r_temp) <= /*acc*/);