diff options
-rw-r--r-- | engines/titanic/true_talk/tt_concept.cpp | 31 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_concept.h | 17 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_parser.cpp | 10 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_parser.h | 2 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_string.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_string.h | 1 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_word.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_word.h | 5 |
8 files changed, 72 insertions, 2 deletions
diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index bc2da4c936..a9794cabe7 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -58,6 +58,28 @@ TTconcept::TTconcept(TTword *word, ScriptType scriptType) : reset(); } +TTconcept::TTconcept(const TTconcept &src) : + _string1(src._string1), _string2(src._string2), + _wordP(nullptr), _scriptP(nullptr) { + + if (src.getStatus()) { + _status = SS_5; + } else { + if (setStatus()) { + _status = SS_VALID; + _scriptP = src._scriptP; + + if (src._wordP) { + _status = initializeWordRef(src._wordP); + copyFrom(src); + } + } + } + + if (_status) + reset(); +} + bool TTconcept::setStatus() { if (_string1.isValid() && _string2.isValid()) { _status = SS_VALID; @@ -97,4 +119,13 @@ void TTconcept::reset() { _status = oldStatus; } +bool TTconcept::compareTo(const char *str) const { + return this != nullptr && _wordP != nullptr && + _wordP->compareTo(str); +} + +void TTconcept::copyFrom(const TTconcept &src) { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 787013e6c3..8006e56240 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -67,12 +67,29 @@ private: * Resets the concept */ void reset(); + + /** + * Copy auxiliary data from the specified source concept + */ + void copyFrom(const TTconcept &src); public: TTconcept *_nextP; public: TTconcept(); TTconcept(TTscriptBase *script, ScriptType scriptType); TTconcept(TTword *word, ScriptType scriptType); + TTconcept(const TTconcept &src); + + /** + * Compares the name of the associated word, if any, + * to the passed string + */ + bool compareTo(const char *str) const; + + /** + * Return the status of the concept + */ + int getStatus() const { return _status; } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 9b56aef558..3a49e291d0 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -781,11 +781,12 @@ int TTparser::considerRequests(TTword *word) { break; case OBJECT_IS_TO: - // TODO - //flag = _sentenceSub + flag = fn3(&_sentenceSub->_field8, 3); break; case SEEK_ACTOR: + + case SEEK_OBJECT: case SEEK_OBJECT_OVERRIDE: case SEEK_TO: @@ -865,6 +866,11 @@ int TTparser::fn2(TTword *word) { } } +bool TTparser::fn3(int *v, int v2) { + // TODO + return false; +} + int TTparser::checkReferent(TTpronoun *pronoun) { TTconcept *concept; diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index aba034416c..b73dd7655d 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -152,6 +152,8 @@ private: * Add a concept node */ int addConcept(TTconcept *concept); + + bool fn3(int *v, int v2); public: CScriptHandler *_owner; TTsentenceSub *_sentenceSub; diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index 90a9aaa635..1491937bd5 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -99,6 +99,10 @@ bool TTstring::operator==(const TTstring &str) { return _data && str._data && _data->_string == str._data->_string; } +bool TTstring::operator==(const char *str) { + return _data && _data->_string == str; +} + void TTstring::save(SimpleFile *file) const { file->writeFormat("%s", c_str()); } diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 600312431c..435efa14b6 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -58,6 +58,7 @@ public: TTstring &operator+=(const TTstring &str); TTstring &operator+=(char c); bool operator==(const TTstring &str); + bool operator==(const char *str); const char &operator[](int index) { return *(c_str() + index); diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 028ee81008..24221e12da 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -185,6 +185,10 @@ bool TTword::findSynByName(const TTstring &str, TTsynonym *dest, int mode) const } } +bool TTword::compareTo(const char *str) const { + return _string == str; +} + TTword *TTword::copy() { return new TTword(this); } diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index fa7f31ef75..f7550b4c0a 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -115,6 +115,11 @@ public: operator const char *() const { return c_str(); } /** + * Compares the word's text to a passed string + */ + bool compareTo(const char *str) const; + + /** * Return the status of the word */ TTstringStatus getStatus() const { return _status; } |