aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/exec_ns.cpp
diff options
context:
space:
mode:
authorNicola Mettifogo2009-03-23 11:38:09 +0000
committerNicola Mettifogo2009-03-23 11:38:09 +0000
commitd18274d0ee2bf8effcb36b726fc833503f7924aa (patch)
tree33eb6cd429e8d86e0f923370661765f30086f55d /engines/parallaction/exec_ns.cpp
parentca993d8b00e54c8523b5b9e708c94d3fc871e6db (diff)
downloadscummvm-rg350-d18274d0ee2bf8effcb36b726fc833503f7924aa.tar.gz
scummvm-rg350-d18274d0ee2bf8effcb36b726fc833503f7924aa.tar.bz2
scummvm-rg350-d18274d0ee2bf8effcb36b726fc833503f7924aa.zip
Implemented all variants of IF script instruction. Program class has been changed to store an Array of instruction instead of a List, so that references to instructions are integers.
svn-id: r39631
Diffstat (limited to 'engines/parallaction/exec_ns.cpp')
-rw-r--r--engines/parallaction/exec_ns.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp
index f50b3999ec..4c17f4910a 100644
--- a/engines/parallaction/exec_ns.cpp
+++ b/engines/parallaction/exec_ns.cpp
@@ -67,7 +67,7 @@ extern const char *_instructionNamesRes_ns[];
DECLARE_INSTRUCTION_OPCODE(on) {
- InstructionPtr inst = *ctxt._inst;
+ InstructionPtr inst = ctxt._inst;
inst->_a->_flags |= kFlagsActive;
inst->_a->_flags &= ~kFlagsRemove;
@@ -75,12 +75,12 @@ DECLARE_INSTRUCTION_OPCODE(on) {
DECLARE_INSTRUCTION_OPCODE(off) {
- (*ctxt._inst)->_a->_flags |= kFlagsRemove;
+ ctxt._inst->_a->_flags |= kFlagsRemove;
}
DECLARE_INSTRUCTION_OPCODE(loop) {
- InstructionPtr inst = *ctxt._inst;
+ InstructionPtr inst = ctxt._inst;
ctxt._program->_loopCounter = inst->_opB.getValue();
ctxt._program->_loopStart = ctxt._ip;
@@ -94,7 +94,7 @@ DECLARE_INSTRUCTION_OPCODE(endloop) {
}
DECLARE_INSTRUCTION_OPCODE(inc) {
- InstructionPtr inst = *ctxt._inst;
+ InstructionPtr inst = ctxt._inst;
int16 _si = inst->_opB.getValue();
if (inst->_flags & kInstMod) { // mod
@@ -118,13 +118,12 @@ DECLARE_INSTRUCTION_OPCODE(inc) {
DECLARE_INSTRUCTION_OPCODE(set) {
- InstructionPtr inst = *ctxt._inst;
- inst->_opA.setValue(inst->_opB.getValue());
+ ctxt._inst->_opA.setValue(ctxt._inst->_opB.getValue());
}
DECLARE_INSTRUCTION_OPCODE(put) {
- InstructionPtr inst = *ctxt._inst;
+ InstructionPtr inst = ctxt._inst;
Common::Rect r;
inst->_a->getFrameRect(r);
@@ -145,11 +144,11 @@ DECLARE_INSTRUCTION_OPCODE(show) {
}
DECLARE_INSTRUCTION_OPCODE(invalid) {
- error("Can't execute invalid opcode %i", (*ctxt._inst)->_index);
+ error("Can't execute invalid opcode %i", ctxt._inst->_index);
}
DECLARE_INSTRUCTION_OPCODE(call) {
- _vm->callFunction((*ctxt._inst)->_immediate, 0);
+ _vm->callFunction(ctxt._inst->_immediate, 0);
}
@@ -162,17 +161,17 @@ DECLARE_INSTRUCTION_OPCODE(wait) {
DECLARE_INSTRUCTION_OPCODE(start) {
- (*ctxt._inst)->_a->_flags |= (kFlagsActing | kFlagsActive);
+ ctxt._inst->_a->_flags |= (kFlagsActing | kFlagsActive);
}
DECLARE_INSTRUCTION_OPCODE(sound) {
- _vm->_activeZone = (*ctxt._inst)->_z;
+ _vm->_activeZone = ctxt._inst->_z;
}
DECLARE_INSTRUCTION_OPCODE(move) {
- InstructionPtr inst = (*ctxt._inst);
+ InstructionPtr inst = ctxt._inst;
int16 x = inst->_opA.getValue();
int16 y = inst->_opB.getValue();
@@ -187,7 +186,7 @@ DECLARE_INSTRUCTION_OPCODE(endscript) {
ctxt._program->_status = kProgramDone;
}
- ctxt._ip = ctxt._program->_instructions.begin();
+ ctxt._ip = 0;
ctxt._suspend = true;
}