[Scummvm-cvs-logs] scummvm master -> 23317847aba98555911fda330ab8aa359e8a855e

dreammaster dreammaster at scummvm.org
Tue Aug 2 05:27:51 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
23317847ab TITANIC: Added TTsentence localWord


Commit: 23317847aba98555911fda330ab8aa359e8a855e
    https://github.com/scummvm/scummvm/commit/23317847aba98555911fda330ab8aa359e8a855e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-01T23:27:41-04:00

Commit Message:
TITANIC: Added TTsentence localWord

Changed paths:
    engines/titanic/support/exe_resources.h
    engines/titanic/true_talk/tt_sentence.cpp



diff --git a/engines/titanic/support/exe_resources.h b/engines/titanic/support/exe_resources.h
index 49e05aa..993c34d 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 6a8e74d..253ec52 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 {






More information about the Scummvm-git-logs mailing list