[Scummvm-cvs-logs] SF.net SVN: scummvm:[38817] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Mon Feb 23 13:17:25 CET 2009
Revision: 38817
http://scummvm.svn.sourceforge.net/scummvm/?rev=38817&view=rev
Author: peres001
Date: 2009-02-23 12:17:25 +0000 (Mon, 23 Feb 2009)
Log Message:
-----------
Cleanup.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/exec_ns.cpp
scummvm/trunk/engines/parallaction/input.cpp
scummvm/trunk/engines/parallaction/objects.cpp
scummvm/trunk/engines/parallaction/objects.h
scummvm/trunk/engines/parallaction/parallaction.cpp
scummvm/trunk/engines/parallaction/parallaction_br.cpp
scummvm/trunk/engines/parallaction/parser_br.cpp
scummvm/trunk/engines/parallaction/parser_ns.cpp
Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp 2009-02-23 11:55:25 UTC (rev 38816)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp 2009-02-23 12:17:25 UTC (rev 38817)
@@ -222,7 +222,7 @@
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;
Modified: scummvm/trunk/engines/parallaction/input.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/input.cpp 2009-02-23 11:55:25 UTC (rev 38816)
+++ scummvm/trunk/engines/parallaction/input.cpp 2009-02-23 12:17:25 UTC (rev 38817)
@@ -297,7 +297,7 @@
// 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 @@
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
Modified: scummvm/trunk/engines/parallaction/objects.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/objects.cpp 2009-02-23 11:55:25 UTC (rev 38816)
+++ scummvm/trunk/engines/parallaction/objects.cpp 2009-02-23 12:17:25 UTC (rev 38817)
@@ -180,7 +180,7 @@
Zone::~Zone() {
// printf("~Zone(%s)\n", _name);
- switch (_type & 0xFFFF) {
+ switch (ACTIONTYPE(this)) {
case kZoneExamine:
free(u.examine->_filename);
u.examine->_description.clear();
Modified: scummvm/trunk/engines/parallaction/objects.h
===================================================================
--- scummvm/trunk/engines/parallaction/objects.h 2009-02-23 11:55:25 UTC (rev 38816)
+++ scummvm/trunk/engines/parallaction/objects.h 2009-02-23 12:17:25 UTC (rev 38817)
@@ -287,7 +287,11 @@
}
};
+#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
struct Zone {
Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp 2009-02-23 11:55:25 UTC (rev 38816)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp 2009-02-23 12:17:25 UTC (rev 38817)
@@ -503,7 +503,7 @@
// 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 @@
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::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 @@
// 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 @@
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 @@
}
// 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 @@
// 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 @@
_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;
Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp 2009-02-23 11:55:25 UTC (rev 38816)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp 2009-02-23 12:17:25 UTC (rev 38817)
@@ -161,7 +161,7 @@
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 @@
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
Modified: scummvm/trunk/engines/parallaction/parser_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_br.cpp 2009-02-23 11:55:25 UTC (rev 38816)
+++ scummvm/trunk/engines/parallaction/parser_br.cpp 2009-02-23 12:17:25 UTC (rev 38817)
@@ -808,7 +808,7 @@
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;
Modified: scummvm/trunk/engines/parallaction/parser_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_ns.cpp 2009-02-23 11:55:25 UTC (rev 38816)
+++ scummvm/trunk/engines/parallaction/parser_ns.cpp 2009-02-23 12:17:25 UTC (rev 38817)
@@ -211,12 +211,12 @@
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::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;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list