From d82aea1e5449e08e45a346398d7e53060d56faf8 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Mon, 23 Mar 2009 22:34:46 +0000 Subject: Turned ZoneTypes into a regular numeric id (no more a bitfield). svn-id: r39648 --- engines/parallaction/objects.h | 24 ++++++++++++------------ engines/parallaction/parser.h | 2 ++ engines/parallaction/parser_br.cpp | 10 +++------- engines/parallaction/parser_ns.cpp | 29 ++++++++++++++--------------- 4 files changed, 31 insertions(+), 34 deletions(-) (limited to 'engines/parallaction') diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h index 628e4b8d9b..bf8daa173e 100644 --- a/engines/parallaction/objects.h +++ b/engines/parallaction/objects.h @@ -56,20 +56,20 @@ typedef Common::List PointList; enum ZoneTypes { kZoneExamine = 1, // zone displays comment if activated kZoneDoor = 2, // zone activated on click (after some walk if needed) - kZoneGet = 4, // for pickable items - kZoneMerge = 8, // tags items which can be merged in inventory - kZoneTaste = 0x10, // NEVER USED - kZoneHear = 0x20, // NEVER USED: they ran out of time before integrating sfx - kZoneFeel = 0x40, // NEVER USED - kZoneSpeak = 0x80, // tags NPCs the character can talk with - kZoneNone = 0x100, // used to prevent parsing on peculiar Animations - kZoneTrap = 0x200, // zone activated when character enters - kZoneYou = 0x400, // marks the character - kZoneCommand = 0x800, + kZoneGet = 3, // for pickable items + kZoneMerge = 4, // tags items which can be merged in inventory + kZoneTaste = 5, // NEVER USED + kZoneHear = 6, // NEVER USED: they ran out of time before integrating sfx + kZoneFeel = 7, // NEVER USED + kZoneSpeak = 8, // tags NPCs the character can talk with + kZoneNone = 9, // used to prevent parsing on peculiar Animations + kZoneTrap = 10, // zone activated when character enters + kZoneYou = 11, // marks the character + kZoneCommand = 12, // BRA specific - kZonePath = 0x1000, // defines nodes for assisting walk calculation routines - kZoneBox = 0x2000 + kZonePath = 13, // defines nodes for assisting walk calculation routines + kZoneBox = 14 }; diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h index 0c9d053bf3..ed28dfc1d1 100644 --- a/engines/parallaction/parser.h +++ b/engines/parallaction/parser.h @@ -196,6 +196,8 @@ protected: void parseAnswerBody(Answer *answer); Question *parseQuestion(); + uint32 buildZoneType(const char *t0, const char* t1); + void parseZone(ZoneList &list, char *name); virtual void parseZoneTypeBlock(ZonePtr z); void parsePointList(PointList &list); diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp index 718bb9ccdb..b17f6c8afd 100644 --- a/engines/parallaction/parser_br.cpp +++ b/engines/parallaction/parser_br.cpp @@ -737,15 +737,11 @@ DECLARE_ZONE_PARSER(moveto) { DECLARE_ZONE_PARSER(type) { debugC(7, kDebugParser, "ZONE_PARSER(type) "); - if (_tokens[2][0] != '\0') { - ctxt.z->_type = (4 + _vm->_objectsNames->lookup(_tokens[2])) << 16; - } - int16 _si = _zoneTypeNames->lookup(_tokens[1]); - if (_si != Table::notFound) { - ctxt.z->_type |= 1 << (_si - 1); + ctxt.z->_type = buildZoneType(_tokens[1], _tokens[2]); + if (ACTIONTYPE(ctxt.z) != 0) { parseZoneTypeBlock(ctxt.z); -// if (ctxt.z->_type & kZoneHear) { +// if (ACTIONTYPE(ctxt.z) == kZoneHear) { // _soundMan->sfxCommand(START...); // } } diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp index 02e23393f8..df250cee7a 100644 --- a/engines/parallaction/parser_ns.cpp +++ b/engines/parallaction/parser_ns.cpp @@ -211,15 +211,9 @@ DECLARE_ANIM_PARSER(commands) { DECLARE_ANIM_PARSER(type) { debugC(7, kDebugParser, "ANIM_PARSER(type) "); - if (_tokens[2][0] != '\0') { - 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 (/*(ACTIONTYPE(ctxt.a) != kZoneNone) &&*/ (ACTIONTYPE(ctxt.a) != kZoneCommand)) { - parseZoneTypeBlock(ctxt.a); - } + ctxt.a->_type = buildZoneType(_tokens[1], _tokens[2]); + if ((ACTIONTYPE(ctxt.a) != 0) && (ACTIONTYPE(ctxt.a) != kZoneCommand)) { + parseZoneTypeBlock(ctxt.a); } ctxt.a->_flags |= 0x1000000; @@ -1314,16 +1308,21 @@ DECLARE_ZONE_PARSER(moveto) { ctxt.z->_moveTo.y = atoi(_tokens[2]); } +uint32 LocationParser_ns::buildZoneType(const char *t0, const char* t1) { + uint16 it = 0; + if (t1[0] != '\0') { + it = 4 + _vm->_objectsNames->lookup(t1); + } + uint16 zt = _zoneTypeNames->lookup(t0); + return PACK_ZONETYPE(zt, it); +} + DECLARE_ZONE_PARSER(type) { debugC(7, kDebugParser, "ZONE_PARSER(type) "); - if (_tokens[2][0] != '\0') { - ctxt.z->_type = (4 + _vm->_objectsNames->lookup(_tokens[2])) << 16; - } - int16 _si = _zoneTypeNames->lookup(_tokens[1]); - if (_si != Table::notFound) { - ctxt.z->_type |= 1 << (_si - 1); + ctxt.z->_type = buildZoneType(_tokens[1], _tokens[2]); + if (ACTIONTYPE(ctxt.z) != 0) { parseZoneTypeBlock(ctxt.z); } -- cgit v1.2.3