diff options
author | Nicola Mettifogo | 2009-03-23 11:38:09 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2009-03-23 11:38:09 +0000 |
commit | d18274d0ee2bf8effcb36b726fc833503f7924aa (patch) | |
tree | 33eb6cd429e8d86e0f923370661765f30086f55d /engines/parallaction/exec_br.cpp | |
parent | ca993d8b00e54c8523b5b9e708c94d3fc871e6db (diff) | |
download | scummvm-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_br.cpp')
-rw-r--r-- | engines/parallaction/exec_br.cpp | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp index 397ab293fa..836dd14f7d 100644 --- a/engines/parallaction/exec_br.cpp +++ b/engines/parallaction/exec_br.cpp @@ -312,7 +312,7 @@ DECLARE_COMMAND_OPCODE(offsave) { } 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_COMMAND_OPCODE(clear) { @@ -367,24 +367,23 @@ DECLARE_COMMAND_OPCODE(set) { DECLARE_INSTRUCTION_OPCODE(on) { - _vm->showZone((*ctxt._inst)->_z, true); + _vm->showZone(ctxt._inst->_z, true); } DECLARE_INSTRUCTION_OPCODE(off) { - _vm->showZone((*ctxt._inst)->_z, false); + _vm->showZone(ctxt._inst->_z, false); } 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(inc) { - InstructionPtr inst = *ctxt._inst; + InstructionPtr inst = ctxt._inst; int16 rvalue = inst->_opB.getValue(); @@ -437,25 +436,25 @@ DECLARE_INSTRUCTION_OPCODE(wait) { DECLARE_INSTRUCTION_OPCODE(start) { - (*ctxt._inst)->_z->_flags |= kFlagsActing; + ctxt._inst->_z->_flags |= kFlagsActing; } DECLARE_INSTRUCTION_OPCODE(process) { - _vm->_activeZone2 = (*ctxt._inst)->_z; + _vm->_activeZone2 = ctxt._inst->_z; } DECLARE_INSTRUCTION_OPCODE(move) { // NOTE: I couldn't find evidence of scripts containing this instruction being used - InstructionPtr inst =*ctxt._inst; + InstructionPtr inst = ctxt._inst; _vm->scheduleWalk(inst->_opA.getValue(), inst->_opB.getValue(), false); ctxt._suspend = true; } DECLARE_INSTRUCTION_OPCODE(color) { - InstructionPtr inst = *ctxt._inst; + InstructionPtr inst = ctxt._inst; _vm->_gfx->_palette.setEntry(inst->_opB.getValue(), inst->_colors[0], inst->_colors[1], inst->_colors[2]); } @@ -477,33 +476,45 @@ DECLARE_INSTRUCTION_OPCODE(print) { } DECLARE_INSTRUCTION_OPCODE(text) { - InstructionPtr inst = (*ctxt._inst); + InstructionPtr inst = ctxt._inst; _vm->setupSubtitles(inst->_text, inst->_text2, inst->_y); } DECLARE_INSTRUCTION_OPCODE(ifeq) { - warning("Parallaction_br::instOp_ifeq not yet implemented"); + InstructionPtr inst = ctxt._inst; + bool cond = inst->_opA.getValue() == inst->_opB.getValue(); + if (!cond) { + ctxt._ip = inst->_endif; + } } DECLARE_INSTRUCTION_OPCODE(iflt) { - warning("Parallaction_br::instOp_iflt not yet implemented"); + InstructionPtr inst = ctxt._inst; + bool cond = inst->_opA.getValue() < inst->_opB.getValue(); + if (!cond) { + ctxt._ip = inst->_endif; + } } DECLARE_INSTRUCTION_OPCODE(ifgt) { - warning("Parallaction_br::instOp_ifgt not yet implemented"); + InstructionPtr inst = ctxt._inst; + bool cond = inst->_opA.getValue() > inst->_opB.getValue(); + if (!cond) { + ctxt._ip = inst->_endif; + } } DECLARE_INSTRUCTION_OPCODE(endif) { - warning("Parallaction_br::instOp_endif not yet implemented"); + // nothing to do here } DECLARE_INSTRUCTION_OPCODE(stop) { - ZonePtr z = (*ctxt._inst)->_z; + ZonePtr z = ctxt._inst->_z; if (ACTIONTYPE(z) == kZoneHear) { warning("Parallaction_br::instOp_stop not yet implemented for HEAR zones"); // TODO: stop music or sound effects generated by a zone. @@ -513,7 +524,7 @@ DECLARE_INSTRUCTION_OPCODE(stop) { } DECLARE_INSTRUCTION_OPCODE(loop) { - InstructionPtr inst = *ctxt._inst; + InstructionPtr inst = ctxt._inst; ctxt._program->_loopCounter = inst->_opB.getValue(); ctxt._program->_loopStart = ctxt._ip; @@ -531,7 +542,7 @@ DECLARE_INSTRUCTION_OPCODE(show) { } DECLARE_INSTRUCTION_OPCODE(call) { - _vm->callFunction((*ctxt._inst)->_immediate, 0); + _vm->callFunction(ctxt._inst->_immediate, 0); } @@ -542,7 +553,7 @@ DECLARE_INSTRUCTION_OPCODE(endscript) { ctxt._program->_status = kProgramDone; } - ctxt._ip = ctxt._program->_instructions.begin(); + ctxt._ip = 0; ctxt._suspend = true; } |