aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-05-28 11:55:45 -0400
committerPaul Gilbert2016-07-15 19:16:09 -0400
commit079a734831983dd26db7a2ef1f06d380b2af12dc (patch)
treefcb97208c6a1ccef1e9207134f7459bca75ca71c
parent23cd7fd2994c6438a37b243af432d5027ee6aeb8 (diff)
downloadscummvm-rg350-079a734831983dd26db7a2ef1f06d380b2af12dc.tar.gz
scummvm-rg350-079a734831983dd26db7a2ef1f06d380b2af12dc.tar.bz2
scummvm-rg350-079a734831983dd26db7a2ef1f06d380b2af12dc.zip
TITANIC: Fleshing out TTparser considerRequests
-rw-r--r--engines/titanic/true_talk/tt_action.cpp2
-rw-r--r--engines/titanic/true_talk/tt_action.h2
-rw-r--r--engines/titanic/true_talk/tt_parser.cpp77
3 files changed, 74 insertions, 7 deletions
diff --git a/engines/titanic/true_talk/tt_action.cpp b/engines/titanic/true_talk/tt_action.cpp
index 04135b550f..5bf91c71df 100644
--- a/engines/titanic/true_talk/tt_action.cpp
+++ b/engines/titanic/true_talk/tt_action.cpp
@@ -26,7 +26,7 @@ namespace Titanic {
bool TTaction::_staticFlag;
-TTaction::TTaction(TTstring &str, WordClass wordClass, int val2, int val3, int val4) :
+TTaction::TTaction(const TTstring &str, WordClass wordClass, int val2, int val3, int val4) :
TTmajorWord(str, wordClass, val2, val3), _field30(val4) {
}
diff --git a/engines/titanic/true_talk/tt_action.h b/engines/titanic/true_talk/tt_action.h
index 7b91b14743..29e2bc4e4a 100644
--- a/engines/titanic/true_talk/tt_action.h
+++ b/engines/titanic/true_talk/tt_action.h
@@ -33,7 +33,7 @@ private:
protected:
int _field30;
public:
- TTaction(TTstring &str, WordClass wordClass, int val2, int val3, int val4);
+ TTaction(const TTstring &str, WordClass wordClass, int val2, int val3, int val4);
TTaction(const TTaction *src);
/**
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp
index 1d2680ecc7..45e941c82e 100644
--- a/engines/titanic/true_talk/tt_parser.cpp
+++ b/engines/titanic/true_talk/tt_parser.cpp
@@ -733,7 +733,7 @@ int TTparser::considerRequests(TTword *word) {
int status = 0;
bool flag = false;
bool modifierFlag = false;
- int seekFlag = 0;
+ int seekVal = 0;
while (word) {
if (nodeP->_tag == MKTAG('C', 'O', 'M', 'E')) {
@@ -804,10 +804,65 @@ int TTparser::considerRequests(TTword *word) {
break;
case SEEK_OBJECT:
+
case SEEK_OBJECT_OVERRIDE:
+ if ((word->_wordClass == WC_THING || word->_wordClass == WC_PRONOUN) &&
+ _sentence->fn2(2, TTstring("thePlayer"), _sentenceConcept) &&
+ !_sentenceConcept->_concept3P) {
+ _sentenceConcept->_concept3P = _sentenceConcept->_concept2P;
+ _sentenceConcept->_concept2P = nullptr;
+
+ flag = filterConcepts(5, 2);
+ if (!flag) {
+ status = _sentenceConcept->createConcept(0, 2, word);
+ }
+ }
+ break;
+
case SEEK_TO:
+ if (!_sentenceConcept->_concept3P) {
+ if (!filterConcepts(8, 3))
+ flag = filterConcepts(3, 3);
+ } else {
+ flag = true;
+ }
+ break;
+
case SEEK_FROM:
+ if (!_sentenceConcept->_concept4P) {
+ if (!filterConcepts(8, 4))
+ flag = filterConcepts(3, 3);
+ } else {
+ flag = true;
+ }
+ break;
+
case SEEK_TO_OVERRIDE:
+ if (word->_wordClass == WC_ACTION) {
+ status = _sentenceConcept->createConcept(0, 1, word);
+ if (!status) {
+ seekVal = _sentenceConcept->_field18;
+ _sentenceConcept->_field18 = 4;
+ flag = true;
+ }
+ } else if (word->_id == 703) {
+ if (_sentenceConcept->_concept2P) {
+ delete _sentenceConcept->_concept2P;
+ _sentenceConcept->_concept2P = nullptr;
+ }
+
+ if (_sentenceConcept->_concept4P || !_sentenceConcept->_concept0P) {
+ addNode(7);
+ } else {
+ _sentenceConcept->changeConcept(1, &_sentenceConcept->_concept0P, 4);
+ concept = nullptr;
+ addNode(7);
+ }
+ } else {
+ flag = true;
+ }
+ break;
+
case SEEK_FROM_OVERRIDE:
if (_sentenceConcept->_concept4P) {
delete _sentenceConcept->_concept4P;
@@ -904,11 +959,11 @@ int TTparser::considerRequests(TTword *word) {
_sentenceConcept->_concept5P = oldNode->_concept5P;
_sentenceConcept->_concept2P = oldNode->_concept2P;
- if (seekFlag) {
- seekFlag = 0;
+ if (seekVal) {
+ seekVal = 0;
_sentenceConcept->_field18 = oldNode->_field18;
- oldNode->_field18 = seekFlag;
+ oldNode->_field18 = seekVal;
}
}
@@ -1039,7 +1094,19 @@ int TTparser::considerRequests(TTword *word) {
break;
case COMPLEX_VERB:
- // TODO
+ if (word->_wordClass == WC_ACTION) {
+ flag = true;
+ } else if (!_sentenceConcept->_concept1P) {
+ TTstring wordStr = word->getText();
+ if (wordStr == "do" || wordStr == "doing" || wordStr == "does" || wordStr == "done") {
+ TTaction *verbP = new TTaction(TTstring("do"), WC_ACTION, 112, 0,
+ _sentenceConcept->get18());
+ status = _sentenceConcept->createConcept(1, 1, verbP);
+ delete verbP;
+ }
+
+ flag = true;
+ }
break;
default: