diff options
-rw-r--r-- | engines/titanic/true_talk/tt_parser.cpp | 75 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_parser.h | 4 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_sentence.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_sentence.h | 3 |
4 files changed, 83 insertions, 5 deletions
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 2ee080d984..9316a907a6 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -719,8 +719,81 @@ int TTparser::loadRequests(TTword *word) { } int TTparser::considerRequests(TTword *word) { + if (_nodesP) + return 0; + + TTparserNode *nodeP = _nodesP; + TTconcept *concept = nullptr; + int status = 0; + bool flag = false; + + while (word) { + int ecx = 906; + int edx = 12; + + if (nodeP->_tag == MKTAG('C', 'O', 'M', 'E')) { + addNode(7); + addNode(5); + addNode(21); + + if (!_sentence->_field2C) + _sentence->_field2C = 15; + } else if (nodeP->_tag == MKTAG('C', 'U', 'R', 'S') || + nodeP->_tag == MKTAG('S', 'E', 'X', 'X')) { + if (_sentence->_field58 > 1) + _sentence->_field58--; + flag = true; + + } else if (nodeP->_tag == MKTAG('E', 'X', 'I', 'T')) { + addNode(8); + addNode(5); + addNode(21); + + if (!_sentence->_field2C) + _sentence->_field2C = 14; + + + } else if (nodeP->_tag < MKTAG('C', 'O', 'M', 'E')) { + if (_sentence->_field58 > 1) + _sentence->_field58--; + flag = true; + } else { + switch (nodeP->_tag) { + case CHECK_COMMAND_FORM: + if (_sentenceSub->_field4 && _sentence->_field2C == 1 && + !_sentenceSub->_conceptP) { + concept = new TTconcept(_sentence->_npcScript, ST_NPC_SCRIPT); + _sentenceSub->_conceptP = concept; + _sentenceSub->_field18 = 3; + } + + flag = true; + break; + + case 2: + if (!word->_wordMode) { + word->_wordMode = WMODE_2; + addToConceptList(word); + addNode(14); + } + + flag = true; + break; + + case 3: + // TODO + //flag = _sentenceSub + break; + + default: + break; + } + } + } + // TODO - return 0; + delete concept; + return status; } void TTparser::addToConceptList(TTword *word) { diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 461bcc285d..6b490f8228 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -32,6 +32,10 @@ namespace Titanic { enum NumberFlag { NF_1 = 1, NF_2 = 2, NF_4 = 4, NF_8 = 8, NF_10 = 0x10 }; +enum ParserTag { + CHECK_COMMAND_FORM = 1 +}; + class CScriptHandler; class TTconcept; diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index c383bd3fc3..40e3bb09e2 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -25,9 +25,9 @@ namespace Titanic { -TTsentenceSubBase::TTsentenceSubBase() : _field0(0), _field4(0), _field8(0), - _fieldC(0), _field10(0), _field14(0), _field18(0), _field1C(0), - _nextP(nullptr), _field24(0) { +TTsentenceSubBase::TTsentenceSubBase() : _conceptP(nullptr), _field4(0), + _field8(0), _fieldC(0), _field10(0), _field14(0), _field18(0), + _field1C(0), _nextP(nullptr), _field24(0) { } void TTsentenceSubBase::deleteSiblings() { diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index fb060c1a45..e6d0d0c2b3 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -31,11 +31,12 @@ namespace Titanic { class CScriptHandler; +class TTconcept; class TTword; class TTsentenceSubBase { public: - int _field0; + TTconcept *_conceptP; int _field4; int _field8; int _fieldC; |