diff options
author | Paul Gilbert | 2016-05-20 07:48:01 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:13:36 -0400 |
commit | 2d83f5b13104fd173d7272bec63cb76d42c2153e (patch) | |
tree | 8f69b2f0bc43d96bdf4582b5332ad6f9b93c318b /engines/titanic/true_talk | |
parent | 4d3ca910b7ba193eb118852380c2727747ed9eb6 (diff) | |
download | scummvm-rg350-2d83f5b13104fd173d7272bec63cb76d42c2153e.tar.gz scummvm-rg350-2d83f5b13104fd173d7272bec63cb76d42c2153e.tar.bz2 scummvm-rg350-2d83f5b13104fd173d7272bec63cb76d42c2153e.zip |
TITANIC: Starting TTparser loadRequests
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r-- | engines/titanic/true_talk/tt_parser.cpp | 32 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_parser.h | 18 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_word.h | 3 |
3 files changed, 51 insertions, 2 deletions
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 787e9767da..0d7c75c240 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -23,15 +23,24 @@ #include "titanic/true_talk/tt_parser.h" #include "titanic/true_talk/script_handler.h" #include "titanic/true_talk/tt_sentence.h" +#include "titanic/true_talk/tt_word.h" #include "titanic/titanic.h" namespace Titanic { TTparser::TTparser(CScriptHandler *owner) : _owner(owner), _sentenceSub(nullptr), - _sentence(nullptr), _fieldC(0), _field10(0), _field14(0), _field18(0) { + _sentence(nullptr), _fieldC(0), _field10(0), _field14(0), _field18(0), + _nodesP(nullptr) { loadArrays(); } +TTparser::~TTparser() { + if (_nodesP) { + _nodesP->deleteSiblings(); + delete _nodesP; + } +} + void TTparser::loadArrays() { Common::SeekableReadStream *r; r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS1"); @@ -495,4 +504,25 @@ int TTparser::findFrames(TTsentence *sentence) { return 0; } +void TTparser::loadRequests(TTword *word) { + if (word->_tag != MKTAG('Z', 'Z', 'Z', 'T')) + addNode(word->_tag); + + switch (word->_wordMode) { + case WMODE_NONE: + break; + + case WMODE_ACTION: + break; + } + // TODO +} + +void TTparser::addNode(uint tag) { + TTparserNode *newNode = new TTparserNode(tag); + if (_nodesP) + _nodesP->addToHead(newNode); + _nodesP = newNode; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 9ef84f93ad..96c54fb113 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -23,6 +23,7 @@ #ifndef TITANIC_TT_PARSER_H #define TITANIC_TT_PARSER_H +#include "titanic/true_talk/tt_node.h" #include "titanic/true_talk/tt_sentence.h" #include "titanic/true_talk/tt_string.h" @@ -43,6 +44,14 @@ struct NumberEntry { }; typedef Common::Array<NumberEntry> NumberArray; +class TTparserNode : public TTnode { +public: + uint _tag; +public: + TTparserNode() : TTnode(), _tag(0) {} + TTparserNode(uint tag) : TTnode(), _tag(tag) {} +}; + class TTparser { private: StringArray _replacements1; @@ -50,6 +59,7 @@ private: StringArray _replacements3; StringArray _phrases; NumberArray _numbers; + TTparserNode *_nodesP; private: /** * Loads the various replacement string data arrays @@ -112,6 +122,13 @@ private: * @returns Pointer to matching number entry, if match occurred */ const NumberEntry *replaceNumbers2(TTstring &line, int *startIndex); + + void loadRequests(TTword *word); + + /** + * Creates a new parser node, and adds it to the parser's list + */ + void addNode(uint tag); public: CScriptHandler *_owner; TTsentenceSub *_sentenceSub; @@ -122,6 +139,7 @@ public: int _field18; public: TTparser(CScriptHandler *owner); + ~TTparser(); /** * Preprocesses the passed input text, to handle things like lowercasing diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 9574bc3b0c..333bfb5bfe 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -31,7 +31,8 @@ namespace Titanic { enum WordMode { WMODE_NONE = 0, WMODE_ACTION = 1, WMODE_2 = 2, WMODE_3 = 3, - WMODE_6 = 6, WMODE_8 = 8, WMODE_9 = 9 + WMODE_4 = 4, WMODE_5 = 5, WMODE_6 = 6, WMODE_7 = 7, + WMODE_8 = 8, WMODE_9 = 9 }; class TTword { |