diff options
author | Paul Gilbert | 2016-05-27 21:20:53 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:15:59 -0400 |
commit | 5ffe93ad9b78d1354df62dff2bbbb743629c56f3 (patch) | |
tree | 6bb8296c80b6a23b0fb31fac8d05999debe95c4d /engines/titanic/true_talk | |
parent | de1bb1e95c1a6eec7b0b505d1e4d44bb1a6f5098 (diff) | |
download | scummvm-rg350-5ffe93ad9b78d1354df62dff2bbbb743629c56f3.tar.gz scummvm-rg350-5ffe93ad9b78d1354df62dff2bbbb743629c56f3.tar.bz2 scummvm-rg350-5ffe93ad9b78d1354df62dff2bbbb743629c56f3.zip |
TITANIC: Finished TTparser processModifiers
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r-- | engines/titanic/true_talk/tt_concept.h | 6 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_parser.cpp | 66 |
2 files changed, 67 insertions, 5 deletions
diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 0a14482ba6..58646601a6 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -38,12 +38,9 @@ private: TTscriptBase *_scriptP; TTword *_wordP; TTstring _string1; - int _field14; int _field1C; - int _field20; TTword *_word2P; int _field30; - int _field34; bool _flag; int _status; private: @@ -74,6 +71,9 @@ private: public: TTconcept *_nextP; ScriptType _scriptType; + int _field14; + int _field20; + int _field34; TTstring _string2; public: TTconcept(); diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 9b078b4fd4..2cc9346019 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -1234,7 +1234,8 @@ bool TTparser::resetConcept(TTconcept **conceptPP, int conceptIndex) { int TTparser::processModifiers(int modifier, TTword *word) { TTconcept *newConcept = new TTconcept(word, ST_UNKNOWN_SCRIPT); - for (TTword *currP = _currentWordP; currP != word; currP = currP->_nextP) { + // Cycles through each word + for (TTword *currP = _currentWordP; currP != word; currP = _currentWordP) { if ((modifier == 2 && currP->_wordClass == WC_ADJECTIVE) || (modifier == 1 && currP->_wordClass == WC_ADVERB)) { newConcept->_string2 += ' '; @@ -1245,9 +1246,70 @@ int TTparser::processModifiers(int modifier, TTword *word) { } if (modifier == 2 || modifier == 3) { - // TODO + switch (_currentWordP->_id) { + case 94: + _currentConceptP->setOwner(newConcept); + if (_currentWordP) { + _currentWordP->deleteSiblings(); + delete _currentWordP; + _currentWordP = nullptr; + } + + delete newConcept; + newConcept = nullptr; + break; + + case 204: + newConcept->_field34 = 1; + if (_sentence->_field2C == 1) + _sentence->_field2C = 12; + newConcept->_field14 = 1; + break; + + case 300: + newConcept->set1C(atoi(_currentWordP->_text.c_str())); + break; + + case 400: + newConcept->_field14 = 2; + break; + + case 401: + newConcept->_field14 = 1; + break; + + case 601: + newConcept->setOwner(_currentWordP, false); + break; + + case 608: + if (_currentWordP->comparePronounTo(10)) { + newConcept->_field20 = 1; + } else if (_currentWordP->comparePronounTo(11)) { + newConcept->_field20 = 2; + } + + default: + break; + } + } + + if (_currentWordP) { + // Detaches word and deletes it + TTword *wordP = _currentWordP; + _currentWordP = wordP->_nextP; + + wordP->_nextP = nullptr; + delete wordP; } } + + if (newConcept) { + newConcept->setFlag(true); + _currentConceptP = newConcept; + addConcept(newConcept); + } + return 0; } |