aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/exec_ns.cpp2
-rw-r--r--engines/parallaction/input.cpp4
-rw-r--r--engines/parallaction/objects.cpp2
-rw-r--r--engines/parallaction/objects.h4
-rw-r--r--engines/parallaction/parallaction.cpp28
-rw-r--r--engines/parallaction/parallaction_br.cpp4
-rw-r--r--engines/parallaction/parser_br.cpp2
-rw-r--r--engines/parallaction/parser_ns.cpp6
8 files changed, 28 insertions, 24 deletions
diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp
index 4f7db7749e..861ddec82b 100644
--- a/engines/parallaction/exec_ns.cpp
+++ b/engines/parallaction/exec_ns.cpp
@@ -222,7 +222,7 @@ DECLARE_COMMAND_OPCODE(start) {
DECLARE_COMMAND_OPCODE(speak) {
- if ((_ctxt.cmd->u._zone->_type & 0xFFFF) == kZoneSpeak) {
+ if (ACTIONTYPE(_ctxt.cmd->u._zone) == kZoneSpeak) {
_vm->enterDialogueMode(_ctxt.cmd->u._zone);
} else {
_vm->_activeZone = _ctxt.cmd->u._zone;
diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp
index 3bedebb7f3..0967484513 100644
--- a/engines/parallaction/input.cpp
+++ b/engines/parallaction/input.cpp
@@ -297,7 +297,7 @@ bool Input::translateGameInput() {
// test if mouse is hovering on an interactive zone for the currently selected inventory item
ZonePtr z = _vm->hitZone(_activeItem._id, mousePos.x, mousePos.y);
- if (((_mouseButtons == kMouseLeftUp) && (_activeItem._id == 0) && ((_engineFlags & kEngineWalking) == 0)) && ((!z) || ((z->_type & 0xFFFF) != kZoneCommand))) {
+ if (((_mouseButtons == kMouseLeftUp) && (_activeItem._id == 0) && ((_engineFlags & kEngineWalking) == 0)) && ((!z) || (ACTIONTYPE(z) != kZoneCommand))) {
walkTo(mousePos);
return true;
}
@@ -307,7 +307,7 @@ bool Input::translateGameInput() {
return true;
}
- if ((_mouseButtons == kMouseLeftUp) && ((_activeItem._id != 0) || ((z->_type & 0xFFFF) == kZoneCommand))) {
+ if ((_mouseButtons == kMouseLeftUp) && ((_activeItem._id != 0) || (ACTIONTYPE(z) == kZoneCommand))) {
if (z->_flags & kFlagsNoWalk) {
// character doesn't need to walk to take specified action
diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp
index 8a3ae135ab..d132da4dcc 100644
--- a/engines/parallaction/objects.cpp
+++ b/engines/parallaction/objects.cpp
@@ -180,7 +180,7 @@ Zone::Zone() {
Zone::~Zone() {
// printf("~Zone(%s)\n", _name);
- switch (_type & 0xFFFF) {
+ switch (ACTIONTYPE(this)) {
case kZoneExamine:
free(u.examine->_filename);
u.examine->_description.clear();
diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h
index 029c498948..034caa56b1 100644
--- a/engines/parallaction/objects.h
+++ b/engines/parallaction/objects.h
@@ -287,6 +287,10 @@ struct TypeData {
}
};
+#define ACTIONTYPE(z) ((z)->_type & 0xFFFF)
+#define ITEMTYPE(z) ((z)->_type & 0xFFFF0000)
+
+#define PACK_ZONETYPE(zt,it) ((zt) & 0xFFFF | (((it) & 0xFFFF) << 16))
#define ZONENAME_LENGTH 32
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index e04c6fb925..e26d9233eb 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -503,7 +503,7 @@ void Parallaction::updateZones() {
// examine the list of get zones to update
for (ZoneList::iterator zit = _zonesToUpdate.begin(); zit != _zonesToUpdate.end(); zit++) {
ZonePtr z = *zit;
- if ((z->_type & 0xFFFF) == kZoneGet) {
+ if (ACTIONTYPE(z) == kZoneGet) {
GfxObj *obj = z->u.get->gfxobj;
obj->x = z->getX();
obj->y = z->getY();
@@ -527,7 +527,7 @@ void Parallaction::showZone(ZonePtr z, bool visible) {
z->_flags |= kFlagsRemove;
}
- if ((z->_type & 0xFFFF) == kZoneGet) {
+ if (ACTIONTYPE(z) == kZoneGet) {
_gfx->showGfxObj(z->u.get->gfxobj, visible);
}
}
@@ -600,10 +600,10 @@ void Parallaction::runCommentFrame() {
void Parallaction::runZone(ZonePtr z) {
debugC(3, kDebugExec, "runZone (%s)", z->_name);
- uint16 subtype = z->_type & 0xFFFF;
+ uint16 actionType = ACTIONTYPE(z);
- debugC(3, kDebugExec, "type = %x, object = %x", subtype, (z->_type & 0xFFFF0000) >> 16);
- switch(subtype) {
+ debugC(3, kDebugExec, "actionType = %x, itemType = %x", actionType, ITEMTYPE(z));
+ switch(actionType) {
case kZoneExamine:
enterCommentMode(z);
@@ -678,8 +678,8 @@ bool Parallaction::checkSpecialZoneBox(ZonePtr z, uint32 type, uint x, uint y) {
// WORKAROUND: this huge condition is needed because we made TypeData a collection of structs
// instead of an union. So, merge->_obj1 and get->_icon were just aliases in the original engine,
// but we need to check it separately here. The same workaround is applied in freeZones.
- if ((((z->_type & 0xFFFF) == kZoneMerge) && (((x == z->u.merge->_obj1) && (y == z->u.merge->_obj2)) || ((x == z->u.merge->_obj2) && (y == z->u.merge->_obj1)))) ||
- (((z->_type & 0xFFFF) == kZoneGet) && ((x == z->u.get->_icon) || (y == z->u.get->_icon)))) {
+ if (((ACTIONTYPE(z) == kZoneMerge) && (((x == z->u.merge->_obj1) && (y == z->u.merge->_obj2)) || ((x == z->u.merge->_obj2) && (y == z->u.merge->_obj1)))) ||
+ ((ACTIONTYPE(z) == kZoneGet) && ((x == z->u.get->_icon) || (y == z->u.get->_icon)))) {
// WORKAROUND for bug 2070751: special zones are only used in NS, to allow the
// the EXAMINE/USE action to be applied on some particular item in the inventory.
@@ -691,7 +691,7 @@ bool Parallaction::checkSpecialZoneBox(ZonePtr z, uint32 type, uint x, uint y) {
if (z->_type == type)
return true;
// look for item match, but don't accept 0 types
- if (((z->_type & 0xFFFF0000) == type) && (type))
+ if ((ITEMTYPE(z) == type) && (type))
return true;
}
@@ -718,11 +718,11 @@ bool Parallaction::checkZoneBox(ZonePtr z, uint32 type, uint x, uint y) {
}
// normal Zone
- if ((type == 0) && ((z->_type & 0xFFFF0000) == 0))
+ if ((type == 0) && (ITEMTYPE(z) == 0))
return true;
if (z->_type == type)
return true;
- if ((z->_type & 0xFFFF0000) == type)
+ if (ITEMTYPE(z) == type)
return true;
return false;
@@ -744,11 +744,11 @@ bool Parallaction::checkLinkedAnimBox(ZonePtr z, uint32 type, uint x, uint y) {
// NOTE: the implementation of the following lines is a different in the
// original... it is working so far, though
- if ((type == 0) && ((z->_type & 0xFFFF0000) == 0))
+ if ((type == 0) && (ITEMTYPE(z) == 0))
return true;
if (z->_type == type)
return true;
- if ((z->_type & 0xFFFF0000) == type)
+ if (ITEMTYPE(z) == type)
return true;
return false;
@@ -778,8 +778,8 @@ ZonePtr Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
_ef = a->hitFrameRect(_si, _di);
_b = ((type != 0) || (a->_type == kZoneYou)) ? 0 : 1; // _b: (no type specified) AND (Animation is not the character)
- _c = (a->_type & 0xFFFF0000) ? 0 : 1; // _c: Animation is not an object
- _d = ((a->_type & 0xFFFF0000) != type) ? 0 : 1; // _d: Animation is an object of the same type
+ _c = ITEMTYPE(a) ? 0 : 1; // _c: Animation is not an object
+ _d = (ITEMTYPE(a) != type) ? 0 : 1; // _d: Animation is an object of the same type
if ((_a != 0 && _ef) && ((_b != 0 && _c != 0) || (a->_type == type) || (_d != 0))) {
return a;
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index bb9e5a3f82..403d425bd8 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -161,7 +161,7 @@ void Parallaction_br::runPendingZones() {
if (_activeZone) {
z = _activeZone; // speak Zone or sound
_activeZone = nullZonePtr;
- if ((z->_type & 0xFFFF) == kZoneSpeak) {
+ if (ACTIONTYPE(z) == kZoneSpeak) {
enterDialogueMode(z);
} else {
runZone(z); // FIXME: BRA doesn't handle sound yet
@@ -171,7 +171,7 @@ void Parallaction_br::runPendingZones() {
if (_activeZone2) {
z = _activeZone2; // speak Zone or sound
_activeZone2 = nullZonePtr;
- if ((z->_type & 0xFFFF) == kZoneSpeak) {
+ if (ACTIONTYPE(z) == kZoneSpeak) {
enterDialogueMode(z);
} else {
runZone(z); // FIXME: BRA doesn't handle sound yet
diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp
index 2721763383..d91c0b485c 100644
--- a/engines/parallaction/parser_br.cpp
+++ b/engines/parallaction/parser_br.cpp
@@ -808,7 +808,7 @@ void LocationParser_br::parseGetData(ZonePtr z) {
void LocationParser_br::parseZoneTypeBlock(ZonePtr z) {
debugC(7, kDebugParser, "parseZoneTypeBlock(name: %s, type: %x)", z->_name, z->_type);
- switch (z->_type & 0xFFFF) {
+ switch (ACTIONTYPE(z)) {
case kZoneExamine: // examine Zone alloc
parseExamineData(z);
break;
diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp
index 22087b8422..fee7180c32 100644
--- a/engines/parallaction/parser_ns.cpp
+++ b/engines/parallaction/parser_ns.cpp
@@ -211,12 +211,12 @@ DECLARE_ANIM_PARSER(type) {
debugC(7, kDebugParser, "ANIM_PARSER(type) ");
if (_tokens[2][0] != '\0') {
- ctxt.a->_type = ((4 + _vm->_objectsNames->lookup(_tokens[2])) << 16) & 0xFFFF0000;
+ ctxt.a->_type = PACK_ZONETYPE(0, 4 + _vm->_objectsNames->lookup(_tokens[2]));
}
int16 _si = _zoneTypeNames->lookup(_tokens[1]);
if (_si != Table::notFound) {
ctxt.a->_type |= 1 << (_si-1);
- if (/*((ctxt.a->_type & 0xFFFF) != kZoneNone) &&*/ ((ctxt.a->_type & 0xFFFF) != kZoneCommand)) {
+ if (/*(ACTIONTYPE(ctxt.a) != kZoneNone) &&*/ (ACTIONTYPE(ctxt.a) != kZoneCommand)) {
parseZoneTypeBlock(ctxt.a);
}
}
@@ -1539,7 +1539,7 @@ void LocationParser_ns::parseSpeakData(ZonePtr z) {
void LocationParser_ns::parseZoneTypeBlock(ZonePtr z) {
debugC(7, kDebugParser, "parseZoneTypeBlock(name: %s, type: %x)", z->_name, z->_type);
- switch (z->_type & 0xFFFF) {
+ switch (ACTIONTYPE(z)) {
case kZoneExamine: // examine Zone alloc
parseExamineData(z);
break;