aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-01 23:27:41 -0400
committerPaul Gilbert2016-08-01 23:27:41 -0400
commit23317847aba98555911fda330ab8aa359e8a855e (patch)
treea2362a4f4c950febd3936f59c88db6d98e5e2d2c /engines/titanic
parent944cabd9cbb9dd61e2ff276dd230b85dc028370a (diff)
downloadscummvm-rg350-23317847aba98555911fda330ab8aa359e8a855e.tar.gz
scummvm-rg350-23317847aba98555911fda330ab8aa359e8a855e.tar.bz2
scummvm-rg350-23317847aba98555911fda330ab8aa359e8a855e.zip
TITANIC: Added TTsentence localWord
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/support/exe_resources.h1
-rw-r--r--engines/titanic/true_talk/tt_sentence.cpp38
2 files changed, 37 insertions, 2 deletions
diff --git a/engines/titanic/support/exe_resources.h b/engines/titanic/support/exe_resources.h
index 49e05aa56f..993c34db97 100644
--- a/engines/titanic/support/exe_resources.h
+++ b/engines/titanic/support/exe_resources.h
@@ -44,6 +44,7 @@ public:
void reset(CScriptHandler *owner, int val1, int val2);
bool is18Equals(int val) const { return _field18 == val; }
+ int get18() const { return _field18; }
};
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp
index 6a8e74d976..253ec5253e 100644
--- a/engines/titanic/true_talk/tt_sentence.cpp
+++ b/engines/titanic/true_talk/tt_sentence.cpp
@@ -262,8 +262,42 @@ bool TTsentence::isConcept34(int slotIndex, const TTconceptNode *node) const {
}
bool TTsentence::localWord(const char *str) const {
- // TODO
- return false;
+ CScriptHandler &scriptHandler = *g_vm->_exeResources._owner;
+ bool foundMatch = false;
+
+ if (scriptHandler._concept1P) {
+ TTstring s = scriptHandler._concept1P->getText();
+ if (s == str)
+ foundMatch = true;
+ } else if (scriptHandler._concept2P) {
+ TTstring s = scriptHandler._concept2P->getText();
+ if (s == str)
+ foundMatch = true;
+ }
+
+ int val = g_vm->_exeResources.get18();
+ bool result = false;
+
+ for (TTsentenceNode *nodeP = _nodesP; nodeP && !result;
+ nodeP = static_cast<TTsentenceNode *>(nodeP->_nextP)) {
+ TTsynonym syn;
+ if (!nodeP->_wordP)
+ continue;
+
+ const TTstring wordStr = nodeP->_wordP->_text;
+ if (val == 3 && wordStr == str) {
+ result = true;
+ } else if (nodeP->_wordP->findSynByName(str, &syn, val)) {
+ result = true;
+ } else if (foundMatch) {
+ result = wordStr == "it" || wordStr == "that" || wordStr == "he"
+ || wordStr == "she" || wordStr == "him" || wordStr == "her"
+ || wordStr == "them" || wordStr == "they" || wordStr == "those"
+ || wordStr == "1" || wordStr == "thing";
+ }
+ }
+
+ return result;
}
bool TTsentence::contains(const char *str) const {