diff options
author | Paul Gilbert | 2017-01-28 15:08:15 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-01-28 15:08:15 -0500 |
commit | 3087136bab8b571fd13648ba4dcff6d779d740a6 (patch) | |
tree | e9e5594d8d5bf7b1989e02b67108caa99e2b791d /engines/titanic/true_talk | |
parent | 0a5e36d689d19d11129a5ecd243342be0a8a8b81 (diff) | |
download | scummvm-rg350-3087136bab8b571fd13648ba4dcff6d779d740a6.tar.gz scummvm-rg350-3087136bab8b571fd13648ba4dcff6d779d740a6.tar.bz2 scummvm-rg350-3087136bab8b571fd13648ba4dcff6d779d740a6.zip |
TITANIC: Renamed sentence concept fields in CScriptHandler
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r-- | engines/titanic/true_talk/script_handler.cpp | 52 | ||||
-rw-r--r-- | engines/titanic/true_talk/script_handler.h | 12 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_concept_node.cpp | 12 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_parser.cpp | 30 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_parser.h | 2 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_sentence.cpp | 24 |
6 files changed, 66 insertions, 66 deletions
diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index be0b89bc65..13c88e21db 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -32,8 +32,8 @@ namespace Titanic { /*------------------------------------------------------------------------*/ CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) : - _owner(owner), _script(owner->_script), _parser(this), _inputCtr(0), _concept1P(nullptr), - _concept2P(nullptr), _concept3P(nullptr), _concept4P(nullptr) { + _owner(owner), _script(owner->_script), _parser(this), _inputCtr(0), _conceptObject(nullptr), + _conceptActor(nullptr), _conceptUnused(nullptr), _conceptVerb(nullptr) { g_vm->_scriptHandler = this; g_vm->_script = _script; g_vm->_exeResources.reset(this, val1, val2); @@ -42,10 +42,10 @@ CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) : CScriptHandler::~CScriptHandler() { delete _vocab; - delete _concept1P; - delete _concept2P; - delete _concept3P; - delete _concept4P; + delete _conceptObject; + delete _conceptActor; + delete _conceptUnused; + delete _conceptVerb; } ScriptChangedResult CScriptHandler::scriptChanged(TTroomScript *roomScript, TTnpcScript *npcScript, uint dialogueId) { @@ -59,14 +59,14 @@ ScriptChangedResult CScriptHandler::scriptChanged(TTroomScript *roomScript, TTnp result = npcScript->notifyScript(roomScript, dialogueId); if (dialogueId == 3 || dialogueId == 4) { - delete _concept1P; - delete _concept2P; - delete _concept3P; - delete _concept4P; - _concept1P = nullptr; - _concept2P = nullptr; - _concept3P = nullptr; - _concept4P = nullptr; + delete _conceptObject; + delete _conceptActor; + delete _conceptUnused; + delete _conceptVerb; + _conceptObject = nullptr; + _conceptActor = nullptr; + _conceptUnused = nullptr; + _conceptVerb = nullptr; } ++_inputCtr; @@ -116,29 +116,29 @@ int CScriptHandler::setResponse(TTscriptBase *script, TTresponse *response) { } void CScriptHandler::handleWord(const TTstring *str) { - handleWord1(str); - handleWord2(str); + setActor(str); + setObject(str); } -void CScriptHandler::handleWord1(const TTstring *str) { - if (_concept2P) - delete _concept2P; - _concept2P = nullptr; +void CScriptHandler::setActor(const TTstring *str) { + if (_conceptActor) + delete _conceptActor; + _conceptActor = nullptr; if (str) { TTword word(*str, WC_UNKNOWN, 0); - _concept2P = new TTconcept(&word); + _conceptActor = new TTconcept(&word); } } -void CScriptHandler::handleWord2(const TTstring *str) { - if (_concept1P) - delete _concept1P; - _concept1P = nullptr; +void CScriptHandler::setObject(const TTstring *str) { + if (_conceptObject) + delete _conceptObject; + _conceptObject = nullptr; if (str) { TTword word(*str, WC_UNKNOWN, 0); - _concept1P = new TTconcept(&word); + _conceptObject = new TTconcept(&word); } } diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index b8e62a586c..824738d1f7 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -39,16 +39,16 @@ private: CTitleEngine *_owner; int _inputCtr; private: - void handleWord1(const TTstring *str); - void handleWord2(const TTstring *str); + void setActor(const TTstring *str); + void setObject(const TTstring *str); public: TTparser _parser; TTvocab *_vocab; TTscriptBase *_script; - TTconcept *_concept1P; - TTconcept *_concept2P; - TTconcept *_concept3P; - TTconcept *_concept4P; + TTconcept *_conceptObject; + TTconcept *_conceptActor; + TTconcept *_conceptUnused; + TTconcept *_conceptVerb; public: CScriptHandler(CTitleEngine *owner, int val1, int val2); ~CScriptHandler(); diff --git a/engines/titanic/true_talk/tt_concept_node.cpp b/engines/titanic/true_talk/tt_concept_node.cpp index 4573516a58..3736418fb6 100644 --- a/engines/titanic/true_talk/tt_concept_node.cpp +++ b/engines/titanic/true_talk/tt_concept_node.cpp @@ -79,18 +79,18 @@ TTconcept **TTconceptNode::setConcept(int conceptIndex, TTconcept *src) { if (!isPronoun) { switch (conceptIndex) { case 0: - delete scrHandler._concept2P; - scrHandler._concept2P = new TTconcept(*src); + delete scrHandler._conceptActor; + scrHandler._conceptActor = new TTconcept(*src); break; case 1: - delete scrHandler._concept4P; - scrHandler._concept4P = new TTconcept(*src); + delete scrHandler._conceptVerb; + scrHandler._conceptVerb = new TTconcept(*src); break; case 2: - delete scrHandler._concept1P; - scrHandler._concept1P = new TTconcept(*src); + delete scrHandler._conceptObject; + scrHandler._conceptObject = new TTconcept(*src); break; default: diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 88a5ec3614..dd786db34c 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -765,13 +765,13 @@ int TTparser::considerRequests(TTword *word) { case SEEK_ACTOR: case MKTAG('S', 'A', 'C', 'T'): if (!_sentenceConcept->_concept0P) { - flag = filterConcepts(5, 0); + flag = applyConcepts(5, 0); } else if (_sentenceConcept->_concept0P->compareTo("?") && _sentenceConcept->_concept1P->isWordId(113) && word->_wordClass == WC_THING) { TTconcept *oldConcept = _sentenceConcept->_concept0P; _sentenceConcept->_concept0P = nullptr; - flag = filterConcepts(5, 2); + flag = applyConcepts(5, 2); if (flag) delete oldConcept; } else { @@ -783,11 +783,11 @@ int TTparser::considerRequests(TTword *word) { if (_sentenceConcept->_concept2P && _sentenceConcept->_concept2P->compareTo(word)) { flag = true; } else if (!_sentenceConcept->_concept2P) { - if (filterConcepts(5, 2) && _sentenceConcept->_concept2P->checkWordId1()) + if (applyConcepts(5, 2) && _sentenceConcept->_concept2P->checkWordId1()) addNode(SEEK_OBJECT); } else if (word->_wordClass == WC_THING && _sentence->fn2(2, TTstring("?"), _sentenceConcept)) { TTconcept *oldConcept = _sentenceConcept->_concept2P; - flag = filterConcepts(5, 2); + flag = applyConcepts(5, 2); _sentenceConcept->_concept2P->_field20 = oldConcept->get20(); if (flag) delete oldConcept; @@ -807,7 +807,7 @@ int TTparser::considerRequests(TTword *word) { if (!status && !_sentenceConcept->_concept4P && _sentenceConcept->_concept0P) { TTconcept *oldConcept = _sentenceConcept->_concept2P; - flag = filterConcepts(5, 2); + flag = applyConcepts(5, 2); _sentenceConcept->_concept2P->_field20 = oldConcept->get20(); if (flag) delete oldConcept; @@ -824,7 +824,7 @@ int TTparser::considerRequests(TTword *word) { _sentenceConcept->_concept3P = _sentenceConcept->_concept2P; _sentenceConcept->_concept2P = nullptr; - flag = filterConcepts(5, 2); + flag = applyConcepts(5, 2); if (!flag) { status = _sentenceConcept->createConcept(0, 2, word); } @@ -833,8 +833,8 @@ int TTparser::considerRequests(TTword *word) { case SEEK_TO: if (!_sentenceConcept->_concept3P) { - if (!filterConcepts(8, 3)) - flag = filterConcepts(3, 3); + if (!applyConcepts(8, 3)) + flag = applyConcepts(3, 3); } else { flag = true; } @@ -842,8 +842,8 @@ int TTparser::considerRequests(TTword *word) { case SEEK_FROM: if (!_sentenceConcept->_concept4P) { - if (!filterConcepts(8, 4)) - flag = filterConcepts(3, 3); + if (!applyConcepts(8, 4)) + flag = applyConcepts(3, 3); } else { flag = true; } @@ -906,14 +906,14 @@ int TTparser::considerRequests(TTword *word) { _sentenceConcept->_concept5P->findByWordId(904)) { TTconcept *oldConcept = _sentenceConcept->_concept5P; _sentenceConcept->_concept5P = nullptr; - flag = filterConcepts(9, 5); + flag = applyConcepts(9, 5); if (flag) delete oldConcept; } else { flag = true; } } else { - flag = filterConcepts(9, 5); + flag = applyConcepts(9, 5); if (!flag && word->_wordClass == WC_ADVERB) { status = _sentenceConcept->createConcept(1, 5, word); flag = true; @@ -1471,7 +1471,7 @@ int TTparser::checkForAction() { if (!_sentenceConcept->_concept0P && !_sentenceConcept->_concept1P && !_sentenceConcept->_concept2P && !_sentenceConcept->_concept5P && !flag) { if (_conceptP) - filterConcepts(5, 2); + applyConcepts(5, 2); if (!_sentenceConcept->_concept2P && _sentence->_category == 1) _sentence->_category = 0; @@ -1508,7 +1508,7 @@ int TTparser::checkForAction() { } else if (!_sentenceConcept->_concept0P && !_sentenceConcept->_concept1P && !_sentenceConcept->_concept2P && !_sentenceConcept->_concept5P) { if (_conceptP) - filterConcepts(5, 2); + applyConcepts(5, 2); if (!_sentenceConcept->_concept2P && _sentence->_category == 1) _sentence->_category = 0; @@ -1597,7 +1597,7 @@ bool TTparser::checkConcept2(TTconcept *concept, int conceptMode) { return false; } -int TTparser::filterConcepts(int conceptMode, int conceptIndex) { +int TTparser::applyConcepts(int conceptMode, int conceptIndex) { int result = 0; for (TTconcept *currP = _conceptP; currP && !result; currP = currP->_nextP) { diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 458a719e1f..d5e2d3a630 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -174,7 +174,7 @@ private: int checkForAction(); int fn2(TTword *word); bool checkConcept2(TTconcept *concept, int conceptMode); - int filterConcepts(int conceptMode, int conceptIndex); + int applyConcepts(int conceptMode, int conceptIndex); bool resetConcept(TTconcept **conceptPP, int conceptIndex); public: CScriptHandler *_owner; diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 5a5bff7af8..53062886b7 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -195,24 +195,24 @@ bool TTsentence::fn2(int slotIndex, const TTstring &str, const TTconceptNode *no return true; } - if (slotIndex == 1 && g_vm->_exeResources._owner->_concept4P) { - if (str == g_vm->_exeResources._owner->_concept4P->getText() && + if (slotIndex == 1 && g_vm->_exeResources._owner->_conceptVerb) { + if (str == g_vm->_exeResources._owner->_conceptVerb->getText() && conceptText == "do") goto exit; } - if (g_vm->_exeResources._owner->_concept2P && (slotIndex == 0 || + if (g_vm->_exeResources._owner->_conceptActor && (slotIndex == 0 || slotIndex == 3 || slotIndex == 4)) { - if (str == g_vm->_exeResources._owner->_concept2P->getText() && + if (str == g_vm->_exeResources._owner->_conceptActor->getText() && (conceptText == "it" || conceptText == "he" || conceptText == "she" || conceptText == "him" || conceptText == "her" || conceptText == "them" || conceptText == "they")) goto exit; } - if (g_vm->_exeResources._owner->_concept1P && (slotIndex == 0 || + if (g_vm->_exeResources._owner->_conceptObject && (slotIndex == 0 || slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5)) { - if (str == g_vm->_exeResources._owner->_concept1P->getText() && + if (str == g_vm->_exeResources._owner->_conceptObject->getText() && (conceptText == "it" || conceptText == "that" || conceptText == "he" || conceptText == "she" || conceptText == "him" || conceptText == "her" || conceptText == "them" || conceptText == "they" || conceptText == "those" || @@ -220,8 +220,8 @@ bool TTsentence::fn2(int slotIndex, const TTstring &str, const TTconceptNode *no goto exit; } - if (g_vm->_exeResources._owner->_concept1P && (slotIndex == 0 || slotIndex == 2)) { - if (conceptText == "?" && str == g_vm->_exeResources._owner->_concept1P->getText()) { + if (g_vm->_exeResources._owner->_conceptObject && (slotIndex == 0 || slotIndex == 2)) { + if (conceptText == "?" && str == g_vm->_exeResources._owner->_conceptObject->getText()) { delete concept; concept = getFrameSlot(5, node); conceptText = concept->getText(); @@ -307,12 +307,12 @@ bool TTsentence::localWord(const char *str) const { CScriptHandler &scriptHandler = *g_vm->_exeResources._owner; bool foundMatch = false; - if (scriptHandler._concept1P) { - TTstring s = scriptHandler._concept1P->getText(); + if (scriptHandler._conceptObject) { + TTstring s = scriptHandler._conceptObject->getText(); if (s == str) foundMatch = true; - } else if (scriptHandler._concept2P) { - TTstring s = scriptHandler._concept2P->getText(); + } else if (scriptHandler._conceptActor) { + TTstring s = scriptHandler._conceptActor->getText(); if (s == str) foundMatch = true; } |