diff options
author | Paul Gilbert | 2016-05-22 14:28:47 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:14:27 -0400 |
commit | 6ab35972e87fd1ac6a2eab7a4a07683f2e844d76 (patch) | |
tree | d2fa9689e2929f338a3f98dd3b9b321e7a1fdcbd | |
parent | 8c99ff510c2e8a7d4cde30dc6d8b3698fb998907 (diff) | |
download | scummvm-rg350-6ab35972e87fd1ac6a2eab7a4a07683f2e844d76.tar.gz scummvm-rg350-6ab35972e87fd1ac6a2eab7a4a07683f2e844d76.tar.bz2 scummvm-rg350-6ab35972e87fd1ac6a2eab7a4a07683f2e844d76.zip |
TITANIC: Implement TTconcept getText
-rw-r--r-- | engines/titanic/true_talk/tt_concept.cpp | 25 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_concept.h | 9 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_parser.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_script_base.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_script_base.h | 17 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_word.h | 5 |
6 files changed, 59 insertions, 9 deletions
diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index 8ecaf89289..f88722eb48 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -41,7 +41,7 @@ TTconcept::TTconcept(TTscriptBase *script, ScriptType scriptType) : setScriptType(scriptType); _scriptP = script; - if (scriptType == ST_UNKNOWN_SCRIPT && script->_field8 == 1) + if (scriptType == ST_UNKNOWN_SCRIPT && script->_id == 1) _scriptType = ST_ROOM_SCRIPT; } @@ -202,4 +202,27 @@ void TTconcept::copyFrom(TTconcept *src) { reset(); } +bool TTconcept::checkWordId1() const { + return (_wordP && (_wordP->_id == 200 || _wordP->_id == 201 || + _wordP->_id == 602 || _wordP->_id == 607)) || + (_scriptP && _scriptP->_id <= 2); +} + +bool TTconcept::checkWordId2() const { + return (_wordP && _wordP->_id == 204) || (_scriptP && _scriptP->getId() == 3); +} + +bool TTconcept::checkWordClass() const { + return !_scriptP && _wordP && (_wordP->_wordClass == WC_THING || _wordP->_wordClass == WC_PRONOUN); +} + +const TTstring TTconcept::getText() { + if (_scriptP) + return _scriptP->getText(); + else if (_wordP) + return _wordP->getText(); + else + return TTstring(); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index ae956c14f1..a2e5fb2e2a 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -103,6 +103,15 @@ public: int getStatus() const { return _status; } void setFlag(bool val) { _flag = val; } + + bool checkWordId1() const; + bool checkWordId2() const; + bool checkWordClass() const; + + /** + * Return text assocaited with the concept's word or script + */ + const TTstring getText(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 7c3737b949..cb12e04afb 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -735,8 +735,8 @@ int TTparser::considerRequests(TTword *word) { bool flag = false; while (word) { - int ecx = 906; - int edx = 12; + //int ecx = 906; + //int edx = 12; if (nodeP->_tag == MKTAG('C', 'O', 'M', 'E')) { addNode(7); diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index a8e0940471..85c329c330 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -25,16 +25,16 @@ namespace Titanic { -TTscriptBase::TTscriptBase(int v1, const char *charClass, int v2, +TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int v2, const char *charName, int v3, int v4, int v5, int v6, int v7) : _charName(charName), _charClass(charClass), - _nodesP(nullptr), _field8(0), _hist(nullptr), + _nodesP(nullptr), _id(0), _hist(nullptr), _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0), _field34(0), _field38(0), _field3C(0), _field40(0), _field44(0), _field48(0), _status(0) { if (!areNamesValid()) { if (!v7 || !getStatus()) { - _field8 = v1; + _id = scriptId; _field20 = v3; _field24 = v4; _field28 = v5; @@ -65,7 +65,7 @@ bool TTscriptBase::areNamesValid() { void TTscriptBase::reset() { _nodesP = nullptr; - _field8 = 4; + _id = 4; _hist = nullptr; _field20 = 0; _field24 = -1; diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index 2b748db93b..2ffbf60760 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -55,17 +55,30 @@ protected: int _field48; int _status; public: - int _field8; + int _id; public: - TTscriptBase(int v1, const char *charClass, int v2, const char *charName, + TTscriptBase(int scriptId, const char *charClass, int v2, const char *charName, int v3, int v4, int v5, int v6, int v7); virtual ~TTscriptBase(); bool areNamesValid(); + /** + * Return the Id of the script + */ + int getId() const { return _id; } + + /** + * Return the status + */ int getStatus() const { return _status; } /** + * Return the script text + */ + const TTstring getText() { return _charClass; } + + /** * Gets passed a newly created input wrapper during conversation text processing */ int preprocess(TTsentence *sentence); diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index f8239923d4..09d9f5e667 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(); } /** + * Return the text of the word + */ + const TTstring getText() { return _string; } + + /** * Compares the word's text to a passed string */ bool compareTo(const char *str) const; |