aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-02 07:37:30 -0400
committerPaul Gilbert2016-08-02 07:37:30 -0400
commitcb7d7ed7c36bf59f88db218cdba989cb203a5c1a (patch)
treee781bb57b01e00e8ade22039695fa6238d6ac319 /engines/titanic
parent23317847aba98555911fda330ab8aa359e8a855e (diff)
downloadscummvm-rg350-cb7d7ed7c36bf59f88db218cdba989cb203a5c1a.tar.gz
scummvm-rg350-cb7d7ed7c36bf59f88db218cdba989cb203a5c1a.tar.bz2
scummvm-rg350-cb7d7ed7c36bf59f88db218cdba989cb203a5c1a.zip
TITANIC: Add TTsentence support methods
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/true_talk/tt_sentence.cpp62
-rw-r--r--engines/titanic/true_talk/tt_sentence.h8
2 files changed, 55 insertions, 15 deletions
diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp
index 253ec5253e..9588ee021e 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 8cecaed4f2..7b2c6400c5 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;