diff options
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/animation.cpp | 11 | ||||
-rw-r--r-- | engines/parallaction/commands.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/debug.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/dialogue.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 6 | ||||
-rw-r--r-- | engines/parallaction/zone.cpp | 2 |
7 files changed, 16 insertions, 13 deletions
diff --git a/engines/parallaction/animation.cpp b/engines/parallaction/animation.cpp index a308b8feba..c532e43bb7 100644 --- a/engines/parallaction/animation.cpp +++ b/engines/parallaction/animation.cpp @@ -94,7 +94,7 @@ Animation *Parallaction::parseAnimation(Script& script, AnimationList &list, cha vD0->_type = ((4 + _objectsNames->lookup(_tokens[2])) << 16) & 0xFFFF0000; } int16 _si = _zoneTypeNames->lookup(_tokens[1]); - if (_si != -1) { + if (_si != Table::notFound) { vD0->_type |= 1 << (_si-1); if (((vD0->_type & 0xFFFF) != kZoneNone) && ((vD0->_type & 0xFFFF) != kZoneCommand)) { parseZoneTypeBlock(script, vD0); @@ -295,8 +295,6 @@ void Parallaction::parseScriptLine(Instruction *inst, Animation *a, LocalVariabl int16 _si = _instructionNames->lookup(_tokens[0]); inst->_index = _si; -// printf("token[0] = %s (%i)\n", _tokens[0], inst->_index); - switch (inst->_index) { case INST_ON: // on case INST_OFF: // off @@ -392,9 +390,10 @@ void Parallaction::parseScriptLine(Instruction *inst, Animation *a, LocalVariabl break; case INST_CALL: { // call - int16 _ax = _callableNames->lookup(_tokens[1]); - inst->_opBase._index = _ax - 1; - if (_ax - 1 < 0) exit(0); + int index = _callableNames->lookup(_tokens[1]); + if (index == Table::notFound) + error("unknown callable '%s'", _tokens[1]); + inst->_opBase._index = index - 1; } break; diff --git a/engines/parallaction/commands.cpp b/engines/parallaction/commands.cpp index 62cd60b5d4..ba5b89e7e5 100644 --- a/engines/parallaction/commands.cpp +++ b/engines/parallaction/commands.cpp @@ -48,7 +48,7 @@ namespace Parallaction { #define CMD_STOP 16 DECLARE_COMMAND_PARSER(Flags) { - if (_globalTable->lookup(_tokens[1]) == -1) { + if (_globalTable->lookup(_tokens[1]) == Table::notFound) { do { char _al = _localFlagNames->lookup(_tokens[_cmdParseCtxt.nextToken]); _cmdParseCtxt.nextToken++; diff --git a/engines/parallaction/debug.cpp b/engines/parallaction/debug.cpp index 95091789a9..c94d0b4a69 100644 --- a/engines/parallaction/debug.cpp +++ b/engines/parallaction/debug.cpp @@ -116,7 +116,7 @@ bool Debugger::Cmd_Give(int argc, const char **argv) { DebugPrintf("give <item name>\n"); } else { int index = _vm->_objectsNames->lookup(argv[1]); - if (index != -1) + if (index != Table::notFound) _vm->addInventoryItem(index + 4); else DebugPrintf("invalid item name '%s'\n", argv[1]); diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index 9e0416f493..8d4e8f3e9d 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -151,7 +151,7 @@ Dialogue *Parallaction::parseDialogue(Script &script) { int16 index = forwards.lookup(answer->_following._name); free(answer->_following._name); - if (index == -1) + if (index == Table::notFound) answer->_following._question = 0; else answer->_following._question = dialogue->_questions[index - 1]; diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index c09ffba97d..1261086d2f 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -837,13 +837,13 @@ void Table::addData(const char* s) { } -int16 Table::lookup(const char* s) { +int Table::lookup(const char* s) { for (uint16 i = 0; i < _used; i++) { if (!scumm_stricmp(_data[i], s)) return i + 1; } - return -1; + return notFound; } } // namespace Parallaction diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 4fe4e7d77d..9907f9a956 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -275,9 +275,13 @@ public: ~Table(); + enum { + notFound = 0 + }; + void addData(const char* s); - int16 lookup(const char* s); + int lookup(const char* s); }; struct BackgroundInfo { diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp index be55509100..9cc5f28c8a 100644 --- a/engines/parallaction/zone.cpp +++ b/engines/parallaction/zone.cpp @@ -81,7 +81,7 @@ void Parallaction::parseZone(Script &script, ZoneList &list, char *name) { z->_type = (4 + _objectsNames->lookup(_tokens[2])) << 16; } int16 _si = _zoneTypeNames->lookup(_tokens[1]); - if (_si != -1) { + if (_si != Table::notFound) { z->_type |= 1 << (_si - 1); parseZoneTypeBlock(script, z); continue; |