aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-05-28 13:10:32 -0400
committerPaul Gilbert2016-07-15 19:16:12 -0400
commiteaab1605e089ad4abda5b64d85a4d2efe86d5328 (patch)
tree9518c3c951cd5025707050490137cd4262cb905b /engines
parent079a734831983dd26db7a2ef1f06d380b2af12dc (diff)
downloadscummvm-rg350-eaab1605e089ad4abda5b64d85a4d2efe86d5328.tar.gz
scummvm-rg350-eaab1605e089ad4abda5b64d85a4d2efe86d5328.tar.bz2
scummvm-rg350-eaab1605e089ad4abda5b64d85a4d2efe86d5328.zip
TITANIC: Finished inner switch of TTparser considerRequests
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/true_talk/tt_concept.cpp10
-rw-r--r--engines/titanic/true_talk/tt_concept.h10
-rw-r--r--engines/titanic/true_talk/tt_parser.cpp80
3 files changed, 90 insertions, 10 deletions
diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp
index 2c54f2fab6..30ecce1c3b 100644
--- a/engines/titanic/true_talk/tt_concept.cpp
+++ b/engines/titanic/true_talk/tt_concept.cpp
@@ -150,6 +150,16 @@ bool TTconcept::compareTo(const char *str) const {
_wordP->compareTo(str);
}
+bool TTconcept::compareTo(TTword *word) const {
+ if (_wordP && _wordP->compareTo(word->_text))
+ return true;
+
+ if (_scriptP && _scriptP->getId() == 1 && word->comparePronounTo(1))
+ return true;
+
+ return false;
+}
+
void TTconcept::initialize(TTconcept &src) {
_nextP = src._nextP;
_field14 = src._field14;
diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h
index 835ff60a5f..4584b514c7 100644
--- a/engines/titanic/true_talk/tt_concept.h
+++ b/engines/titanic/true_talk/tt_concept.h
@@ -93,12 +93,16 @@ public:
void copyFrom(TTconcept *src);
/**
- * Compares the name of the associated word, if any,
- * to the passed string
+ * Compares the name of the associated word, if any, to the passed string
*/
bool compareTo(const char *str) const;
/**
+ * Compares the concept to the specified word
+ */
+ bool compareTo(TTword *word) const;
+
+ /**
* Set an owner for the concept
*/
int setOwner(TTconcept *src);
@@ -126,8 +130,8 @@ public:
}
void setFlag(bool val) { _flag = val; }
-
void set1C(int val) { _field1C = val; }
+ int get20() const { return _field20; }
bool checkWordId1() const;
bool checkWordId2() const;
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp
index 45e941c82e..f949618be7 100644
--- a/engines/titanic/true_talk/tt_parser.cpp
+++ b/engines/titanic/true_talk/tt_parser.cpp
@@ -790,20 +790,58 @@ int TTparser::considerRequests(TTword *word) {
break;
case SEEK_ACTOR:
- if (_sentenceConcept->_concept0P) {
- if (_sentenceConcept->_concept0P->compareTo("?") &&
+ if (!_sentenceConcept->_concept0P) {
+ flag = filterConcepts(5, 0);
+ } else if (_sentenceConcept->_concept0P->compareTo("?") &&
_sentenceConcept->_concept1P->isWordId(113) &&
word->_wordClass == WC_THING) {
- // TODO
- }
-
-
+ TTconcept *oldConcept = _sentenceConcept->_concept0P;
+ _sentenceConcept->_concept0P = nullptr;
+ flag = filterConcepts(5, 2);
+ if (flag)
+ delete oldConcept;
} else {
-
+ flag = true;
}
break;
case SEEK_OBJECT:
+ if (_sentenceConcept->_concept2P && _sentenceConcept->_concept2P->compareTo(word)) {
+ flag = true;
+ } else if (!_sentenceConcept->_concept2P) {
+ if (filterConcepts(5, 2) && _sentenceConcept->_concept2P->checkWordId1())
+ addNode(5);
+ } else if (word->_wordClass == WC_THING && _sentence->fn2(2, TTstring("?"), _sentenceConcept)) {
+ TTconcept *oldConcept = _sentenceConcept->_concept2P;
+ flag = filterConcepts(5, 2);
+ _sentenceConcept->_concept2P->_field20 = oldConcept->get20();
+ if (flag)
+ delete oldConcept;
+ } else if (!_sentenceConcept->_concept3P &&
+ (!_sentenceConcept->_concept1P || (_sentenceConcept->_concept1P->getWordId() &&
+ _sentenceConcept->_concept1P->getWordId() == 112)) &&
+ _sentenceConcept->_concept2P->checkWordId1() &&
+ (word->_wordClass == WC_THING || word->_wordClass == WC_PRONOUN)) {
+ _sentenceConcept->changeConcept(0, &_sentenceConcept->_concept2P, 3);
+
+ if (_conceptP && _conceptP->isWordId(word->_id)) {
+ status = _sentenceConcept->replaceConcept(0, 2, _conceptP);
+ removeConcept(_conceptP);
+ } else {
+ status = _sentenceConcept->createConcept(0, 2, word);
+ }
+
+ if (!status && !_sentenceConcept->_concept4P && _sentenceConcept->_concept0P) {
+ TTconcept *oldConcept = _sentenceConcept->_concept2P;
+ flag = filterConcepts(5, 2);
+ _sentenceConcept->_concept2P->_field20 = oldConcept->get20();
+ if (flag)
+ delete oldConcept;
+ } else {
+ flag = true;
+ }
+ }
+ break;
case SEEK_OBJECT_OVERRIDE:
if ((word->_wordClass == WC_THING || word->_wordClass == WC_PRONOUN) &&
@@ -880,7 +918,35 @@ int TTparser::considerRequests(TTword *word) {
break;
case SEEK_OWNERSHIP:
+ if (word->_id == 601) {
+ if (_conceptP->findByWordClass(WC_THING))
+ status = _conceptP->setOwner(word, false);
+
+ flag = true;
+ }
+ break;
+
case SEEK_STATE:
+ if (_sentenceConcept->_concept5P) {
+ if (_sentenceConcept->_concept5P->findByWordId(306) ||
+ _sentenceConcept->_concept5P->findByWordId(904)) {
+ TTconcept *oldConcept = _sentenceConcept->_concept5P;
+ _sentenceConcept->_concept5P = nullptr;
+ flag = filterConcepts(9, 5);
+ if (flag)
+ delete oldConcept;
+ } else {
+ flag = true;
+ }
+ } else {
+ flag = filterConcepts(9, 5);
+ if (!flag && word->_wordClass == WC_ADVERB) {
+ status = _sentenceConcept->createConcept(1, 5, word);
+ flag = true;
+ }
+ }
+ break;
+
case SEEK_MODIFIERS:
if (!modifierFlag) {
bool tempFlag = false;