aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/parallaction/exec_br.cpp10
-rw-r--r--engines/parallaction/exec_ns.cpp43
-rw-r--r--engines/parallaction/parallaction.h6
3 files changed, 24 insertions, 35 deletions
diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index cb123dc19a..5c718bf61a 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -122,19 +122,13 @@ DECLARE_COMMAND_OPCODE(location) {
DECLARE_COMMAND_OPCODE(open) {
warning("Parallaction_br::cmdOp_open command not yet implemented");
- _ctxt.cmd->u._zone->_flags &= ~kFlagsClosed;
- if (_ctxt.cmd->u._zone->u.door->gfxobj) {
- _vm->updateDoor(_ctxt.cmd->u._zone);
- }
+ _vm->updateDoor(_ctxt.cmd->u._zone, false);
}
DECLARE_COMMAND_OPCODE(close) {
warning("Parallaction_br::cmdOp_close not yet implemented");
- _ctxt.cmd->u._zone->_flags |= kFlagsClosed;
- if (_ctxt.cmd->u._zone->u.door->gfxobj) {
- _vm->updateDoor(_ctxt.cmd->u._zone);
- }
+ _vm->updateDoor(_ctxt.cmd->u._zone, true);
}
diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp
index bad0b34327..12ee68a3ed 100644
--- a/engines/parallaction/exec_ns.cpp
+++ b/engines/parallaction/exec_ns.cpp
@@ -246,18 +246,12 @@ DECLARE_COMMAND_OPCODE(location) {
DECLARE_COMMAND_OPCODE(open) {
- _ctxt.cmd->u._zone->_flags &= ~kFlagsClosed;
- if (_ctxt.cmd->u._zone->u.door->gfxobj) {
- _vm->updateDoor(_ctxt.cmd->u._zone);
- }
+ _vm->updateDoor(_ctxt.cmd->u._zone, false);
}
DECLARE_COMMAND_OPCODE(close) {
- _ctxt.cmd->u._zone->_flags |= kFlagsClosed;
- if (_ctxt.cmd->u._zone->u.door->gfxobj) {
- _vm->updateDoor(_ctxt.cmd->u._zone);
- }
+ _vm->updateDoor(_ctxt.cmd->u._zone, true);
}
void Parallaction::showZone(ZonePtr z, bool visible) {
@@ -598,7 +592,7 @@ void Parallaction::runCommentFrame() {
}
-uint16 Parallaction::runZone(ZonePtr z) {
+void Parallaction::runZone(ZonePtr z) {
debugC(3, kDebugExec, "runZone (%s)", z->_name);
uint16 subtype = z->_type & 0xFFFF;
@@ -608,19 +602,15 @@ uint16 Parallaction::runZone(ZonePtr z) {
case kZoneExamine:
enterCommentMode(z);
- return 0;
+ return;
case kZoneGet:
- if (z->_flags & kFlagsFixed) break;
- if (pickupItem(z) != 0) {
- return 1;
- }
+ pickupItem(z);
break;
case kZoneDoor:
if (z->_flags & kFlagsLocked) break;
- z->_flags ^= kFlagsClosed;
- updateDoor(z);
+ updateDoor(z, !(z->_flags & kFlagsClosed));
break;
case kZoneHear:
@@ -629,23 +619,24 @@ uint16 Parallaction::runZone(ZonePtr z) {
case kZoneSpeak:
enterDialogueMode(z);
- return 0;
+ return;
}
debugC(3, kDebugExec, "runZone completed");
_cmdExec->run(z->_commands, z);
- return 0;
+ return;
}
//
// ZONE TYPE: DOOR
//
-void Parallaction::updateDoor(ZonePtr z) {
+void Parallaction::updateDoor(ZonePtr z, bool close) {
+ z->_flags = close ? (z->_flags |= kFlagsClosed) : (z->_flags &= ~kFlagsClosed);
if (z->u.door->gfxobj) {
- uint frame = (z->_flags & kFlagsClosed ? 0 : 1);
+ uint frame = (close ? 0 : 1);
// z->u.door->gfxobj->setFrame(frame);
z->u.door->gfxobj->frame = frame;
}
@@ -659,13 +650,17 @@ void Parallaction::updateDoor(ZonePtr z) {
// ZONE TYPE: GET
//
-int16 Parallaction::pickupItem(ZonePtr z) {
- int r = addInventoryItem(z->u.get->_icon);
- if (r != -1) {
+bool Parallaction::pickupItem(ZonePtr z) {
+ if (z->_flags & kFlagsFixed) {
+ return false;
+ }
+
+ int slot = addInventoryItem(z->u.get->_icon);
+ if (slot != -1) {
showZone(z, false);
}
- return (r == -1);
+ return (slot != -1);
}
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 661cf169d3..98d91ed16a 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -263,7 +263,7 @@ public:
ZonePtr findZone(const char *name);
ZonePtr hitZone(uint32 type, uint16 x, uint16 y);
- uint16 runZone(ZonePtr z);
+ void runZone(ZonePtr z);
void freeZones();
AnimationPtr findAnimation(const char *name);
@@ -354,7 +354,7 @@ protected: // members
void freeCharacter();
- int16 pickupItem(ZonePtr z);
+ bool pickupItem(ZonePtr z);
void clearSet(OpcodeSet &opcodes);
@@ -370,7 +370,7 @@ public:
virtual void parseLocation(const char* name) = 0;
- void updateDoor(ZonePtr z);
+ void updateDoor(ZonePtr z, bool close);
virtual void drawAnimations() = 0;