diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/parallaction/exec.h | 2 | ||||
-rw-r--r-- | engines/parallaction/exec_br.cpp | 46 | ||||
-rw-r--r-- | engines/parallaction/exec_ns.cpp | 30 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 2 |
4 files changed, 19 insertions, 61 deletions
diff --git a/engines/parallaction/exec.h b/engines/parallaction/exec.h index 22e75744f1..4239857ec0 100644 --- a/engines/parallaction/exec.h +++ b/engines/parallaction/exec.h @@ -84,8 +84,6 @@ class CommandExec_ns : public CommandExec { Parallaction_ns *_vm; protected: - void updateGetZone(ZonePtr z, bool visible); - DECLARE_UNQUALIFIED_COMMAND_OPCODE(invalid); DECLARE_UNQUALIFIED_COMMAND_OPCODE(set); DECLARE_UNQUALIFIED_COMMAND_OPCODE(clear); diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp index 0b7400f0f7..cb123dc19a 100644 --- a/engines/parallaction/exec_br.cpp +++ b/engines/parallaction/exec_br.cpp @@ -139,31 +139,12 @@ DECLARE_COMMAND_OPCODE(close) { DECLARE_COMMAND_OPCODE(on) { - CommandData *data = &_ctxt.cmd->u; - ZonePtr z = data->_zone; - - if (z) { - z->_flags |= kFlagsActive; - z->_flags &= ~kFlagsRemove; - - if ((z->_type & 0xFFFF) & kZoneGet) { - _vm->_gfx->showGfxObj(z->u.get->gfxobj, true); - } - } + _vm->showZone(_ctxt.cmd->u._zone, true); } DECLARE_COMMAND_OPCODE(off) { - CommandData *data = &_ctxt.cmd->u; - ZonePtr z = data->_zone; - - if (z) { - z->_flags |= kFlagsRemove; - - if ((z->_type & 0xFFFF) & kZoneGet) { - _vm->_gfx->showGfxObj(z->u.get->gfxobj, false); - } - } + _vm->showZone(_ctxt.cmd->u._zone, false); } @@ -335,31 +316,12 @@ DECLARE_COMMAND_OPCODE(offsave) { DECLARE_INSTRUCTION_OPCODE(on) { - InstructionPtr inst = *_ctxt.inst; - ZonePtr z = inst->_z; - - if (z) { - z->_flags |= kFlagsActive; - z->_flags &= ~kFlagsRemove; - - if ((z->_type & 0xFFFF) & kZoneGet) { - _vm->_gfx->showGfxObj(z->u.get->gfxobj, true); - } - } + _vm->showZone((*_ctxt.inst)->_z, true); } DECLARE_INSTRUCTION_OPCODE(off) { - InstructionPtr inst = *_ctxt.inst; - ZonePtr z = inst->_z; - - if (z) { - z->_flags |= kFlagsRemove; - - if ((z->_type & 0xFFFF) & kZoneGet) { - _vm->_gfx->showGfxObj(z->u.get->gfxobj, false); - } - } + _vm->showZone((*_ctxt.inst)->_z, false); } diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp index 99a492863b..bad0b34327 100644 --- a/engines/parallaction/exec_ns.cpp +++ b/engines/parallaction/exec_ns.cpp @@ -260,34 +260,31 @@ DECLARE_COMMAND_OPCODE(close) { } } -void CommandExec_ns::updateGetZone(ZonePtr z, bool visible) { +void Parallaction::showZone(ZonePtr z, bool visible) { if (!z) { return; } + if (visible) { + z->_flags &= ~kFlagsRemove; + z->_flags |= kFlagsActive; + } else { + z->_flags |= kFlagsRemove; + } + if ((z->_type & 0xFFFF) == kZoneGet) { - _vm->_gfx->showGfxObj(z->u.get->gfxobj, visible); + _gfx->showGfxObj(z->u.get->gfxobj, visible); } + } DECLARE_COMMAND_OPCODE(on) { - ZonePtr z = _ctxt.cmd->u._zone; - - if (z) { - z->_flags &= ~kFlagsRemove; - z->_flags |= kFlagsActive; - updateGetZone(z, true); - } + _vm->showZone(_ctxt.cmd->u._zone, true); } DECLARE_COMMAND_OPCODE(off) { - ZonePtr z = _ctxt.cmd->u._zone; - - if (z) { - _ctxt.cmd->u._zone->_flags |= kFlagsRemove; - updateGetZone(z, false); - } + _vm->showZone(_ctxt.cmd->u._zone, false); } @@ -618,7 +615,6 @@ uint16 Parallaction::runZone(ZonePtr z) { if (pickupItem(z) != 0) { return 1; } - z->_flags |= kFlagsRemove; break; case kZoneDoor: @@ -666,7 +662,7 @@ void Parallaction::updateDoor(ZonePtr z) { int16 Parallaction::pickupItem(ZonePtr z) { int r = addInventoryItem(z->u.get->_icon); if (r != -1) { - _gfx->showGfxObj(z->u.get->gfxobj, false); + showZone(z, false); } return (r == -1); diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index e5c5221414..661cf169d3 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -424,6 +424,8 @@ public: void setInternLanguage(uint id); uint getInternLanguage(); + + void showZone(ZonePtr z, bool visible); }; |