aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2019-06-16 17:04:53 -0700
committerPaul Gilbert2019-06-16 17:04:53 -0700
commit0bf2dc6d7ba8650e7070484c1cd7707d307a9137 (patch)
treec57019dfe33ef832098ddb4fc0fa8ea708858367 /engines
parentc7a93064159395faf340109cd96b54874b8c2d14 (diff)
downloadscummvm-rg350-0bf2dc6d7ba8650e7070484c1cd7707d307a9137.tar.gz
scummvm-rg350-0bf2dc6d7ba8650e7070484c1cd7707d307a9137.tar.bz2
scummvm-rg350-0bf2dc6d7ba8650e7070484c1cd7707d307a9137.zip
GLK: ADVSYS: Fix actions using OP_SEND
Diffstat (limited to 'engines')
-rw-r--r--engines/glk/advsys/advsys.cpp1
-rw-r--r--engines/glk/advsys/vm.cpp5
-rw-r--r--engines/glk/advsys/vm.h5
3 files changed, 9 insertions, 2 deletions
diff --git a/engines/glk/advsys/advsys.cpp b/engines/glk/advsys/advsys.cpp
index a61033a506..c65cd1806f 100644
--- a/engines/glk/advsys/advsys.cpp
+++ b/engines/glk/advsys/advsys.cpp
@@ -83,6 +83,7 @@ void AdvSys::deinitialize() {
}
bool AdvSys::singleAction() {
+ debug("------------------");
// Do the before code
switch (execute(_beforeOffset)) {
case ABORT:
diff --git a/engines/glk/advsys/vm.cpp b/engines/glk/advsys/vm.cpp
index bfc22e764c..70b035977e 100644
--- a/engines/glk/advsys/vm.cpp
+++ b/engines/glk/advsys/vm.cpp
@@ -93,6 +93,7 @@ ExecutionResult VM::execute(int offset) {
_pc = offset;
// Clear the stack
+ _fp.clear();
_stack.clear();
// Iterate through the script
@@ -398,9 +399,9 @@ void VM::opSEND() {
if (val)
val = getObjectField(val, O_CLASS);
else
- val = _fp[_fp[FP_ARGS_SIZE] + FP_ARGS];
+ val = _fp[_fp[FP_ARGS_SIZE] + FP_ARGS - 1];
- if (val && (val = getObjectProperty(val, _fp[_fp[FP_ARGS_SIZE] + 1])) != 0) {
+ if (val && (val = getObjectProperty(val, _fp[_fp[FP_ARGS_SIZE] + FP_ARGS - 2])) != 0) {
_pc = getActionField(val, A_CODE);
} else {
// Return NIL if there's no action for the given message
diff --git a/engines/glk/advsys/vm.h b/engines/glk/advsys/vm.h
index 58689170e1..4531b2e426 100644
--- a/engines/glk/advsys/vm.h
+++ b/engines/glk/advsys/vm.h
@@ -181,6 +181,11 @@ public:
}
/**
+ * Clear the function pointer
+ */
+ void clear() { _index = 0; }
+
+ /**
* Returns the index in the stack of the function pointer
*/
operator int() const { return _index; }