[Scummvm-cvs-logs] scummvm master -> cb7d7ed7c36bf59f88db218cdba989cb203a5c1a

dreammaster dreammaster at scummvm.org
Tue Aug 2 13:37:38 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:
cb7d7ed7c3 TITANIC: Add TTsentence support methods


Commit: cb7d7ed7c36bf59f88db218cdba989cb203a5c1a
    https://github.com/scummvm/scummvm/commit/cb7d7ed7c36bf59f88db218cdba989cb203a5c1a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-02T07:37:30-04:00

Commit Message:
TITANIC: Add TTsentence support methods

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



diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp
index 253ec52..9588ee0 100644
--- a/engines/titanic/true_talk/tt_sentence.cpp
+++ b/engines/titanic/true_talk/tt_sentence.cpp
@@ -108,22 +108,62 @@ int TTsentence::storeVocabHit(TTword *word) {
 }
 
 bool TTsentence::fn1(const CString &str, int wordId1, const CString &str1, const CString &str2,
-		const CString &str3, int wordId2, int val, int val2, const TTconceptNode *node) const {
-	// TODO
-	return false;
+		const CString &str3, int wordId2, int val1, int val2, const TTconceptNode *node) const {
+	if (node)
+		node = &_sentenceConcept;
+
+	if (!node && !node)
+		return false;
+	if (val1 && !is18(val1, node))
+		return false;
+	if (!str.empty() && !fn2(0, str, node))
+		return false;
+	if (wordId1 && !fn4(1, wordId1, node))
+		return false;
+	if (!str1.empty() && !fn2(2, str1, node))
+		return false;
+	if (!str2.empty() && !fn2(3, str2, node))
+		return false;
+	if (!str3.empty() && !fn2(4, str3, node))
+		return false;
+	if (wordId2 && !fn4(5, wordId2, node))
+		return false;
+	if (val2 && !is1C(val2, node))
+		return false;
+
+	return true;
 }
 
 bool TTsentence::fn3(const CString &str1, const CString &str2, const CString &str3,
 		const CString &str4, const CString &str5, const CString &str6,
-		int val, int val2, const TTconceptNode *node) const {
-	// TODO
-	return false;
+		int val1, int val2, const TTconceptNode *node) const {
+	if (!node)
+		node = &_sentenceConcept;
+
+	if (val1 && !is18(val1, node))
+		return false;
+	if (!str1.empty() && !fn2(0, str1, node))
+		return false;
+	if (!str2.empty() && !fn2(1, str2, node))
+		return false;
+	if (!str3.empty() && !fn2(2, str3, node))
+		return false;
+	if (!str4.empty() && !fn2(3, str4, node))
+		return false;
+	if (!str5.empty() && !fn2(4, str5, node))
+		return false;
+	if (!str6.empty() && !fn2(5, str6, node))
+		return false;
+	if (!val2 && !is1C(val2, node))
+		return false;
+
+	return true;
 }
 
-bool TTsentence::fn2(int slotIndex, const TTstring &str, const TTconceptNode *conceptNode) const {
-	if (!conceptNode)
-		conceptNode = &_sentenceConcept;
-	TTconcept *concept = getFrameSlot(slotIndex, conceptNode);
+bool TTsentence::fn2(int slotIndex, const TTstring &str, const TTconceptNode *node) const {
+	if (!node)
+		node = &_sentenceConcept;
+	TTconcept *concept = getFrameSlot(slotIndex, node);
 
 	if (!concept)
 		return str == "isEmpty";
@@ -183,7 +223,7 @@ bool TTsentence::fn2(int slotIndex, const TTstring &str, const TTconceptNode *co
 	if (g_vm->_exeResources._owner->_concept1P && (slotIndex == 0 || slotIndex == 2)) {
 		if (conceptText == "?" && str == g_vm->_exeResources._owner->_concept2P->getText()) {
 			delete concept;
-			concept = getFrameSlot(5, conceptNode);
+			concept = getFrameSlot(5, node);
 			conceptText = concept->getText();
 
 			if (conceptText == "it" || conceptText == "that" || conceptText == "he" ||
diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h
index 8cecaed..7b2c640 100644
--- a/engines/titanic/true_talk/tt_sentence.h
+++ b/engines/titanic/true_talk/tt_sentence.h
@@ -109,12 +109,12 @@ public:
 	int storeVocabHit(TTword *word);
 
 	bool fn1(const CString &str, int wordId1, const CString &str1, const CString &str2,
-		const CString &str3, int wordId2, int val, int val2, const TTconceptNode *node) const;
+		const CString &str3, int wordId2, int val1, int val2, const TTconceptNode *node) const;
 	bool fn3(const CString &str1, const CString &str2, const CString &str3,
 		const CString &str4, const CString &str5, const CString &str6,
-		int val, int val2, const TTconceptNode *node) const;
-	bool fn2(int slotIndex, const TTstring &str, const TTconceptNode *conceptNode) const;
-	bool fn4(int mode, int wordId, const TTconceptNode *node) const;
+		int val1, int val2, const TTconceptNode *node) const;
+	bool fn2(int slotIndex, const TTstring &str, const TTconceptNode *node = nullptr) const;
+	bool fn4(int mode, int wordId, const TTconceptNode *node = nullptr) const;
 
 	bool isConcept34(int slotIndex, const TTconceptNode *node = nullptr) const;
 






More information about the Scummvm-git-logs mailing list