diff options
-rw-r--r-- | engines/hugo/parser.h | 20 | ||||
-rw-r--r-- | engines/hugo/parser_v1d.cpp | 26 | ||||
-rw-r--r-- | engines/hugo/parser_v1w.cpp | 12 | ||||
-rw-r--r-- | engines/hugo/parser_v2d.cpp | 16 | ||||
-rw-r--r-- | engines/hugo/parser_v3d.cpp | 30 |
5 files changed, 52 insertions, 52 deletions
diff --git a/engines/hugo/parser.h b/engines/hugo/parser.h index 2749343df9..948ba3bc92 100644 --- a/engines/hugo/parser.h +++ b/engines/hugo/parser.h @@ -88,14 +88,14 @@ public: protected: virtual void dropObject(object_t *obj); - virtual bool isBackgroundWord(char *noun, char *verb, objectList_t obj) const; - virtual bool isCatchallVerb(bool testNounFl, char *noun, char *verb, objectList_t obj) const; - virtual bool isGenericVerb(char *word, object_t *obj); - virtual bool isNear(char *verb, char *noun, object_t *obj, char *comment) const; - virtual bool isObjectVerb(char *word, object_t *obj); virtual void takeObject(object_t *obj); char *findNextNoun(char *noun) const; + bool isBackgroundWord_v1(char *noun, char *verb, objectList_t obj) const; + bool isCatchallVerb_v1(bool testNounFl, char *noun, char *verb, objectList_t obj) const; + bool isGenericVerb_v1(char *word, object_t *obj); + bool isNear_v1(char *verb, char *noun, object_t *obj, char *comment) const; + bool isObjectVerb_v1(char *word, object_t *obj); }; class Parser_v2d : public Parser_v1d { @@ -114,11 +114,11 @@ public: virtual void lineHandler(); protected: void dropObject(object_t *obj); - bool isBackgroundWord(objectList_t obj) const; - bool isCatchallVerb(objectList_t obj) const; - bool isGenericVerb(object_t *obj, char *comment); - bool isNear(object_t *obj, char *verb, char *comment) const; - bool isObjectVerb(object_t *obj, char *comment); + bool isBackgroundWord_v3(objectList_t obj) const; + bool isCatchallVerb_v3(objectList_t obj) const; + bool isGenericVerb_v3(object_t *obj, char *comment); + bool isNear_v3(object_t *obj, char *verb, char *comment) const; + bool isObjectVerb_v3(object_t *obj, char *comment); void takeObject(object_t *obj); }; diff --git a/engines/hugo/parser_v1d.cpp b/engines/hugo/parser_v1d.cpp index f82623d9f6..f9c2d1525a 100644 --- a/engines/hugo/parser_v1d.cpp +++ b/engines/hugo/parser_v1d.cpp @@ -80,7 +80,7 @@ char *Parser_v1d::findNextNoun(char *noun) const { * If object not near, return suitable string; may be similar object closer * If radius is -1, treat radius as infinity */ -bool Parser_v1d::isNear(char *verb, char *noun, object_t *obj, char *comment) const { +bool Parser_v1d::isNear_v1(char *verb, char *noun, object_t *obj, char *comment) const { debugC(1, kDebugParser, "isNear(%s, %s, obj, %s)", verb, noun, comment); if (!noun && !obj->verbOnlyFl) { // No noun specified & object not context senesitive @@ -142,7 +142,7 @@ bool Parser_v1d::isNear(char *verb, char *noun, object_t *obj, char *comment) co * say_ok needed for special case of take/drop which may be handled not only * here but also in a cmd_list with a donestr string simultaneously */ -bool Parser_v1d::isGenericVerb(char *word, object_t *obj) { +bool Parser_v1d::isGenericVerb_v1(char *word, object_t *obj) { debugC(1, kDebugParser, "isGenericVerb(%s, object_t *obj)", word); if (!obj->genericCmd) @@ -183,7 +183,7 @@ bool Parser_v1d::isGenericVerb(char *word, object_t *obj) { * and if it passes, perform the actions in the action list. If the verb * is catered for, return TRUE */ -bool Parser_v1d::isObjectVerb(char *word, object_t *obj) { +bool Parser_v1d::isObjectVerb_v1(char *word, object_t *obj) { debugC(1, kDebugParser, "isObjectVerb(%s, object_t *obj)", word); // First, find matching verb in cmd list @@ -225,7 +225,7 @@ bool Parser_v1d::isObjectVerb(char *word, object_t *obj) { _vm->_scheduler->insertActionList(cmnd->actIndex); // Special case if verb is Take or Drop. Assume additional generic actions if ((word == _vm->_text->getVerb(_vm->_take, 0)) || (word == _vm->_text->getVerb(_vm->_drop, 0))) - isGenericVerb(word, obj); + isGenericVerb_v1(word, obj); return true; } @@ -233,7 +233,7 @@ bool Parser_v1d::isObjectVerb(char *word, object_t *obj) { * Print text for possible background object. Return TRUE if match found * Only match if both verb and noun found. Test_ca will match verb-only */ -bool Parser_v1d::isBackgroundWord(char *noun, char *verb, objectList_t obj) const { +bool Parser_v1d::isBackgroundWord_v1(char *noun, char *verb, objectList_t obj) const { debugC(1, kDebugParser, "isBackgroundWord(%s, %s, object_list_t obj)", noun, verb); if (!noun) @@ -283,7 +283,7 @@ void Parser_v1d::dropObject(object_t *obj) { * Print text for possible background object. Return TRUE if match found * If test_noun TRUE, must have a noun given */ -bool Parser_v1d::isCatchallVerb(bool testNounFl, char *noun, char *verb, objectList_t obj) const { +bool Parser_v1d::isCatchallVerb_v1(bool testNounFl, char *noun, char *verb, objectList_t obj) const { debugC(1, kDebugParser, "isCatchallVerb(%d, %s, %s, object_list_t obj)", (testNounFl) ? 1 : 0, noun, verb); if (_maze.enabledFl) @@ -407,22 +407,22 @@ void Parser_v1d::lineHandler() { // Must try at least once for objects allowing verb-context for (int i = 0; i < _vm->_object->_numObj; i++) { object_t *obj = &_vm->_object->_objects[i]; - if (isNear(verb, noun, obj, farComment)) { - if (isObjectVerb(verb, obj) // Foreground object - || isGenericVerb(verb, obj)) // Common action type + if (isNear_v1(verb, noun, obj, farComment)) { + if (isObjectVerb_v1(verb, obj) // Foreground object + || isGenericVerb_v1(verb, obj))// Common action type return; } } - if ((*farComment == '\0') && isBackgroundWord(noun, verb, _vm->_backgroundObjects[*_vm->_screen_p])) + if ((*farComment == '\0') && isBackgroundWord_v1(noun, verb, _vm->_backgroundObjects[*_vm->_screen_p])) return; } while (noun); } noun = findNextNoun(noun); if (*farComment != '\0') // An object matched but not near enough Utils::Box(kBoxAny, "%s", farComment); - else if (!isCatchallVerb(true, noun, verb, _vm->_catchallList) && - !isCatchallVerb(false, noun, verb, _vm->_backgroundObjects[*_vm->_screen_p]) && - !isCatchallVerb(false, noun, verb, _vm->_catchallList)) + else if (!isCatchallVerb_v1(true, noun, verb, _vm->_catchallList) && + !isCatchallVerb_v1(false, noun, verb, _vm->_backgroundObjects[*_vm->_screen_p]) && + !isCatchallVerb_v1(false, noun, verb, _vm->_catchallList)) Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBEh_1d)); } diff --git a/engines/hugo/parser_v1w.cpp b/engines/hugo/parser_v1w.cpp index 7f4130076a..7cd6b19bb7 100644 --- a/engines/hugo/parser_v1w.cpp +++ b/engines/hugo/parser_v1w.cpp @@ -155,7 +155,7 @@ void Parser_v1w::lineHandler() { for (int i = 0; i < _vm->_object->_numObj; i++) { object_t *obj = &_vm->_object->_objects[i]; if (isWordPresent(_vm->_text->getNounArray(obj->nounIndex))) { - if (isObjectVerb(obj, farComment) || isGenericVerb(obj, farComment)) + if (isObjectVerb_v3(obj, farComment) || isGenericVerb_v3(obj, farComment)) return; } } @@ -166,20 +166,20 @@ void Parser_v1w::lineHandler() { object_t *obj = &_vm->_object->_objects[i]; if (obj->verbOnlyFl) { char contextComment[kCompLineSize * 5] = ""; // Unused comment for context objects - if (isObjectVerb(obj, contextComment) || isGenericVerb(obj, contextComment)) + if (isObjectVerb_v3(obj, contextComment) || isGenericVerb_v3(obj, contextComment)) return; } } // No objects match command line, try background and catchall commands - if (isBackgroundWord(_vm->_backgroundObjects[*_vm->_screen_p])) + if (isBackgroundWord_v3(_vm->_backgroundObjects[*_vm->_screen_p])) return; - if (isCatchallVerb(_vm->_backgroundObjects[*_vm->_screen_p])) + if (isCatchallVerb_v3(_vm->_backgroundObjects[*_vm->_screen_p])) return; - if (isBackgroundWord(_vm->_catchallList)) + if (isBackgroundWord_v3(_vm->_catchallList)) return; - if (isCatchallVerb(_vm->_catchallList)) + if (isCatchallVerb_v3(_vm->_catchallList)) return; // If a not-near comment was generated, print it diff --git a/engines/hugo/parser_v2d.cpp b/engines/hugo/parser_v2d.cpp index f73d4be5dc..3d37d97c01 100644 --- a/engines/hugo/parser_v2d.cpp +++ b/engines/hugo/parser_v2d.cpp @@ -159,22 +159,22 @@ void Parser_v2d::lineHandler() { // Must try at least once for objects allowing verb-context for (int i = 0; i < _vm->_object->_numObj; i++) { object_t *obj = &_vm->_object->_objects[i]; - if (isNear(verb, noun, obj, farComment)) { - if (isObjectVerb(verb, obj) // Foreground object - || isGenericVerb(verb, obj)) // Common action type + if (isNear_v1(verb, noun, obj, farComment)) { + if (isObjectVerb_v1(verb, obj) // Foreground object + || isGenericVerb_v1(verb, obj))// Common action type return; } } - if ((*farComment != '\0') && isBackgroundWord(noun, verb, _vm->_backgroundObjects[*_vm->_screen_p])) + if ((*farComment != '\0') && isBackgroundWord_v1(noun, verb, _vm->_backgroundObjects[*_vm->_screen_p])) return; } while (noun); } noun = findNextNoun(noun); - if ( !isCatchallVerb(true, noun, verb, _vm->_backgroundObjects[*_vm->_screen_p]) - && !isCatchallVerb(true, noun, verb, _vm->_catchallList) - && !isCatchallVerb(false, noun, verb, _vm->_backgroundObjects[*_vm->_screen_p]) - && !isCatchallVerb(false, noun, verb, _vm->_catchallList)) { + if ( !isCatchallVerb_v1(true, noun, verb, _vm->_backgroundObjects[*_vm->_screen_p]) + && !isCatchallVerb_v1(true, noun, verb, _vm->_catchallList) + && !isCatchallVerb_v1(false, noun, verb, _vm->_backgroundObjects[*_vm->_screen_p]) + && !isCatchallVerb_v1(false, noun, verb, _vm->_catchallList)) { if (*farComment != '\0') { // An object matched but not near enough Utils::Box(kBoxAny, "%s", farComment); } else if (_maze.enabledFl && (verb == _vm->_text->getVerb(_vm->_look, 0))) { diff --git a/engines/hugo/parser_v3d.cpp b/engines/hugo/parser_v3d.cpp index abd03038f7..413edfd4d1 100644 --- a/engines/hugo/parser_v3d.cpp +++ b/engines/hugo/parser_v3d.cpp @@ -157,7 +157,7 @@ void Parser_v3d::lineHandler() { for (int i = 0; i < _vm->_object->_numObj; i++) { object_t *obj = &_vm->_object->_objects[i]; if (isWordPresent(_vm->_text->getNounArray(obj->nounIndex))) { - if (isObjectVerb(obj, farComment) || isGenericVerb(obj, farComment)) + if (isObjectVerb_v3(obj, farComment) || isGenericVerb_v3(obj, farComment)) return; } } @@ -168,20 +168,20 @@ void Parser_v3d::lineHandler() { object_t *obj = &_vm->_object->_objects[i]; if (obj->verbOnlyFl) { char contextComment[kCompLineSize * 5] = ""; // Unused comment for context objects - if (isObjectVerb(obj, contextComment) || isGenericVerb(obj, contextComment)) + if (isObjectVerb_v3(obj, contextComment) || isGenericVerb_v3(obj, contextComment)) return; } } // No objects match command line, try background and catchall commands - if (isBackgroundWord(_vm->_backgroundObjects[*_vm->_screen_p])) + if (isBackgroundWord_v3(_vm->_backgroundObjects[*_vm->_screen_p])) return; - if (isCatchallVerb(_vm->_backgroundObjects[*_vm->_screen_p])) + if (isCatchallVerb_v3(_vm->_backgroundObjects[*_vm->_screen_p])) return; - if (isBackgroundWord(_vm->_catchallList)) + if (isBackgroundWord_v3(_vm->_catchallList)) return; - if (isCatchallVerb(_vm->_catchallList)) + if (isCatchallVerb_v3(_vm->_catchallList)) return; // If a not-near comment was generated, print it @@ -210,7 +210,7 @@ void Parser_v3d::lineHandler() { * If it does, and the object is near and passes the tests in the command * list then carry out the actions in the action list and return TRUE */ -bool Parser_v3d::isObjectVerb(object_t *obj, char *comment) { +bool Parser_v3d::isObjectVerb_v3(object_t *obj, char *comment) { debugC(1, kDebugParser, "isObjectVerb(object_t *obj, %s)", comment); // First, find matching verb in cmd list @@ -229,7 +229,7 @@ bool Parser_v3d::isObjectVerb(object_t *obj, char *comment) { // Verb match found. Check if object is Near char *verb = *_vm->_text->getVerbArray(_vm->_cmdList[cmdIndex][i].verbIndex); - if (!isNear(obj, verb, comment)) + if (!isNear_v3(obj, verb, comment)) return false; // Check all required objects are being carried @@ -258,21 +258,21 @@ bool Parser_v3d::isObjectVerb(object_t *obj, char *comment) { // See if any additional generic actions if ((verb == _vm->_text->getVerb(_vm->_look, 0)) || (verb == _vm->_text->getVerb(_vm->_take, 0)) || (verb == _vm->_text->getVerb(_vm->_drop, 0))) - isGenericVerb(obj, comment); + isGenericVerb_v3(obj, comment); return true; } /** * Test whether command line contains one of the generic actions */ -bool Parser_v3d::isGenericVerb(object_t *obj, char *comment) { +bool Parser_v3d::isGenericVerb_v3(object_t *obj, char *comment) { debugC(1, kDebugParser, "isGenericVerb(object_t *obj, %s)", comment); if (!obj->genericCmd) return false; // Following is equivalent to switch, but couldn't do one - if (isWordPresent(_vm->_text->getVerbArray(_vm->_look)) && isNear(obj, _vm->_text->getVerb(_vm->_look, 0), comment)) { + if (isWordPresent(_vm->_text->getVerbArray(_vm->_look)) && isNear_v3(obj, _vm->_text->getVerb(_vm->_look, 0), comment)) { // Test state-dependent look before general look if ((obj->genericCmd & LOOK_S) == LOOK_S) { Utils::Box(kBoxAny, "%s", _vm->_text->getTextData(obj->stateDataIndex[obj->state])); @@ -286,7 +286,7 @@ bool Parser_v3d::isGenericVerb(object_t *obj, char *comment) { Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBUnusual)); } } - } else if (isWordPresent(_vm->_text->getVerbArray(_vm->_take)) && isNear(obj, _vm->_text->getVerb(_vm->_take, 0), comment)) { + } else if (isWordPresent(_vm->_text->getVerbArray(_vm->_take)) && isNear_v3(obj, _vm->_text->getVerb(_vm->_take, 0), comment)) { if (obj->carriedFl) Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBHave)); else if ((TAKE & obj->genericCmd) == TAKE) @@ -319,7 +319,7 @@ bool Parser_v3d::isGenericVerb(object_t *obj, char *comment) { * If radius is -1, treat radius as infinity * Verb is included to determine correct comment if not near */ -bool Parser_v3d::isNear(object_t *obj, char *verb, char *comment) const { +bool Parser_v3d::isNear_v3(object_t *obj, char *verb, char *comment) const { debugC(1, kDebugParser, "isNear(object_t *obj, %s, %s)", verb, comment); if (obj->carriedFl) // Object is being carried @@ -413,7 +413,7 @@ void Parser_v3d::dropObject(object_t *obj) { * Note that if the background command list has match set TRUE then do not * print text if there are any recognizable nouns in the command line */ -bool Parser_v3d::isCatchallVerb(objectList_t obj) const { +bool Parser_v3d::isCatchallVerb_v3(objectList_t obj) const { debugC(1, kDebugParser, "isCatchallVerb(object_list_t obj)"); if (_maze.enabledFl) @@ -441,7 +441,7 @@ bool Parser_v3d::isCatchallVerb(objectList_t obj) const { * Search for matching verb/noun pairs in background command list * Print text for possible background object. Return TRUE if match found */ -bool Parser_v3d::isBackgroundWord(objectList_t obj) const { +bool Parser_v3d::isBackgroundWord_v3(objectList_t obj) const { debugC(1, kDebugParser, "isBackgroundWord(object_list_t obj)"); if (_maze.enabledFl) |