diff options
author | Filippos Karapetis | 2010-01-27 12:13:39 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-01-27 12:13:39 +0000 |
commit | b24be4f52620d01fd2928d8afddd9fe884b392ed (patch) | |
tree | 2f281944483293f54f9fd2e0a50c1bda0dda81ff /engines/sci/engine | |
parent | f27c8284a57bf77aa96a2950f5695d81a15b8bdc (diff) | |
download | scummvm-rg350-b24be4f52620d01fd2928d8afddd9fe884b392ed.tar.gz scummvm-rg350-b24be4f52620d01fd2928d8afddd9fe884b392ed.tar.bz2 scummvm-rg350-b24be4f52620d01fd2928d8afddd9fe884b392ed.zip |
Added support of the subtraction of two pointers, when they got the same segment. This operation will yield a number, like in C, and it's used by script 385 in Castle of Dr. Brain (the hangman script). Fixes exiting room 360 (the puzzle room) in Castle of Dr. Brain
svn-id: r47595
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/vm.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index e921d0f8fc..3d320d485c 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -763,7 +763,7 @@ void run_vm(EngineState *s, int restoring) { case 0x02: // sub r_temp = POP32(); - if (r_temp.segment || s->r_acc.segment) { + if (r_temp.segment != s->r_acc.segment) { reg_t r_ptr = NULL_REG; int offset; // Pointer arithmetics! @@ -783,8 +783,11 @@ void run_vm(EngineState *s, int restoring) { s->r_acc = pointer_add(s, r_ptr, -offset); - } else + } else { + // We can subtract numbers, or pointers with the same segment, + // an operation which will yield a number like in C s->r_acc = make_reg(0, r_temp.offset - s->r_acc.offset); + } break; case 0x03: // mul |