Turned ZoneTypes into a regular numeric id (no more a bitfield).

svn-id: r39648
This commit is contained in:
Nicola Mettifogo 2009-03-23 22:34:46 +00:00
parent 52b1c9e32f
commit d82aea1e54
4 changed files with 31 additions and 34 deletions

View File

@ -56,20 +56,20 @@ typedef Common::List<Common::Point> 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
};

View File

@ -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);

View File

@ -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...);
// }
}

View File

@ -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);
}