aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/true_talk/tt_action.h1
-rw-r--r--engines/titanic/true_talk/tt_parser.cpp151
-rw-r--r--engines/titanic/true_talk/tt_parser.h7
-rw-r--r--engines/titanic/true_talk/tt_sentence.cpp12
-rw-r--r--engines/titanic/true_talk/tt_sentence.h13
-rw-r--r--engines/titanic/true_talk/tt_vocab.cpp2
-rw-r--r--engines/titanic/true_talk/tt_word.cpp12
-rw-r--r--engines/titanic/true_talk/tt_word.h2
8 files changed, 189 insertions, 11 deletions
diff --git a/engines/titanic/true_talk/tt_action.h b/engines/titanic/true_talk/tt_action.h
index 1103da8dcb..213bdab8e4 100644
--- a/engines/titanic/true_talk/tt_action.h
+++ b/engines/titanic/true_talk/tt_action.h
@@ -42,6 +42,7 @@ public:
int load(SimpleFile *file);
void setVal(int val) { _field30 = val; }
+ int getVal() const { return _field30; }
/**
* Creates a copy of the word
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp
index 0d7c75c240..b81d3cc3bc 100644
--- a/engines/titanic/true_talk/tt_parser.cpp
+++ b/engines/titanic/true_talk/tt_parser.cpp
@@ -22,6 +22,7 @@
#include "titanic/true_talk/tt_parser.h"
#include "titanic/true_talk/script_handler.h"
+#include "titanic/true_talk/tt_action.h"
#include "titanic/true_talk/tt_sentence.h"
#include "titanic/true_talk/tt_word.h"
#include "titanic/titanic.h"
@@ -504,7 +505,9 @@ int TTparser::findFrames(TTsentence *sentence) {
return 0;
}
-void TTparser::loadRequests(TTword *word) {
+int TTparser::loadRequests(TTword *word) {
+ int status = 0;
+
if (word->_tag != MKTAG('Z', 'Z', 'Z', 'T'))
addNode(word->_tag);
@@ -513,9 +516,127 @@ void TTparser::loadRequests(TTword *word) {
break;
case WMODE_ACTION:
+ if (word->_id != 0x70 && word->_id != 0x71)
+ addNode(1);
+ addNode(17);
+
+ switch (word->_id) {
+ case 101:
+ case 110:
+ addNode(5);
+ addNode(4);
+ break;
+
+ case 102:
+ addNode(4);
+ break;
+
+ case 103:
+ case 111:
+ addNode(8);
+ addNode(7);
+ addNode(5);
+ addNode(4);
+ break;
+
+ case 104:
+ case 107:
+ addNode(15);
+ addNode(5);
+ addNode(4);
+ break;
+
+ case 106:
+ addNode(7);
+ addNode(4);
+ break;
+
+ case 108:
+ addNode(5);
+ addNode(4);
+ addNode(23);
+ break;
+
+ case 112:
+ case 113:
+ addNode(13);
+ addNode(5);
+ break;
+
+ default:
+ break;
+ }
+
+ if (_sentenceSub) {
+ if (_sentenceSub->get18() == 0 || _sentenceSub->get18() == 2) {
+ TTaction *action = static_cast<TTaction *>(word);
+ _sentenceSub->set18(action->getVal());
+ }
+ }
+ break;
+
+ case WMODE_2:
+ if (word->checkTag() && _sentence->_field58 > 0)
+ _sentence->_field58--;
+ addNode(14);
+ break;
+
+ case WMODE_3:
+ switch (word->_id) {
+ case 300:
+ addNode(14);
+ status = 1;
+ break;
+
+ case 306:
+ addNode(23);
+ addNode(4);
+ break;
+
+ case 307:
+ case 308:
+ addNode(23);
+ break;
+
+ default:
+ break;
+ }
+
+ if (status != 1) {
+ addToConceptList(word);
+ addNode(14);
+ }
+ break;
+
+ case WMODE_4:
+ addNode(2);
+ status = 1;
+ break;
+
+ case WMODE_5:
+ if (_sentence->check2C()) {
+ _sentenceSub->_field1C = 1;
+ _sentenceSub = _sentenceSub->addSibling();
+ delete this;
+ } else {
+ addNode(23);
+ }
+ break;
+
+ case WMODE_6:
+ status = fn2(word);
+ break;
+
+ default:
break;
}
// TODO
+
+ return status;
+}
+
+void TTparser::addToConceptList(TTword *word) {
+ // TODO
}
void TTparser::addNode(uint tag) {
@@ -525,4 +646,32 @@ void TTparser::addNode(uint tag) {
_nodesP = newNode;
}
+int TTparser::fn2(TTword *word) {
+ switch (word->_id) {
+ case 600:
+ addNode(13);
+ return 0;
+
+ case 601:
+ addNode(12);
+ return 1;
+
+ case 602:
+ case 607:
+ return checkReferent(static_cast<TTpronoun *>(word));
+
+ case 608:
+ return 1;
+
+ default:
+ return 0;
+ }
+ int checkReferent(TTpronoun *pronoun);
+}
+
+int TTparser::checkReferent(TTpronoun *pronoun) {
+ // TODO
+ return 0;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h
index 96c54fb113..07af2dd59c 100644
--- a/engines/titanic/true_talk/tt_parser.h
+++ b/engines/titanic/true_talk/tt_parser.h
@@ -24,6 +24,7 @@
#define TITANIC_TT_PARSER_H
#include "titanic/true_talk/tt_node.h"
+#include "titanic/true_talk/tt_pronoun.h"
#include "titanic/true_talk/tt_sentence.h"
#include "titanic/true_talk/tt_string.h"
@@ -123,12 +124,16 @@ private:
*/
const NumberEntry *replaceNumbers2(TTstring &line, int *startIndex);
- void loadRequests(TTword *word);
+ int loadRequests(TTword *word);
+ void addToConceptList(TTword *word);
+ int fn2(TTword *word);
+ int checkReferent(TTpronoun *pronoun);
/**
* Creates a new parser node, and adds it to the parser's list
*/
void addNode(uint tag);
+
public:
CScriptHandler *_owner;
TTsentenceSub *_sentenceSub;
diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp
index 67e1a977ce..c383bd3fc3 100644
--- a/engines/titanic/true_talk/tt_sentence.cpp
+++ b/engines/titanic/true_talk/tt_sentence.cpp
@@ -42,6 +42,18 @@ void TTsentenceSubBase::deleteSiblings() {
/*------------------------------------------------------------------------*/
+TTsentenceSub *TTsentenceSub::addSibling() {
+ if (this == nullptr || _nextP != nullptr)
+ // This should never happen
+ return nullptr;
+
+ TTsentenceSub *nextP = new TTsentenceSub();
+ _nextP = nextP;
+ return nextP;
+}
+
+/*------------------------------------------------------------------------*/
+
TTsentence::TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner,
TTroomScript *roomScript, TTnpcScript *npcScript) :
_owner(owner), _field2C(1), _inputCtr(inputCtr), _field34(0),
diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h
index 998aad2500..902ad102ce 100644
--- a/engines/titanic/true_talk/tt_sentence.h
+++ b/engines/titanic/true_talk/tt_sentence.h
@@ -52,10 +52,20 @@ public:
* Delete any sibling chain attached to this node
*/
void deleteSiblings();
+
+ void set18(int val) { _field18 = val; }
+ int get18() const { return _field18; }
+ bool is24() const { return _field24 == 0; }
};
class TTsentenceSub : public TTsentenceSubBase {
public:
+ TTsentenceSub() : TTsentenceSubBase() {}
+
+ /**
+ * Adds a new sibling instance
+ */
+ TTsentenceSub *addSibling();
};
class TTsentence {
@@ -68,7 +78,6 @@ private:
TTsentenceNode *_nodesP;
TTroomScript *_roomScript;
TTnpcScript *_npcScript;
- int _field58;
int _field5C;
int _status;
private:
@@ -80,6 +89,7 @@ public:
TTsentenceSub _sub;
TTstring _initialLine;
TTstring _normalizedLine;
+ int _field58;
public:
TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner,
TTroomScript *roomScript, TTnpcScript *npcScript);
@@ -88,6 +98,7 @@ public:
void set34(int v) { _field34 = v; }
void set38(int v) { _field38 = v; }
+ bool check2C() const { return _field2C > 1 && _field2C <= 10; }
int getStatus() const { return _status; }
diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp
index 66497a5ada..1ae7e1cdf1 100644
--- a/engines/titanic/true_talk/tt_vocab.cpp
+++ b/engines/titanic/true_talk/tt_vocab.cpp
@@ -433,7 +433,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
TTstring isStr("is");
word = getPrimeWord(isStr);
} else {
- switch (word->_field1C) {
+ switch (word->_id) {
case 200:
if (word->proc10() == 2) {
delete word;
diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp
index dc686b88b6..a0cb5dfd94 100644
--- a/engines/titanic/true_talk/tt_word.cpp
+++ b/engines/titanic/true_talk/tt_word.cpp
@@ -26,8 +26,8 @@
namespace Titanic {
-TTword::TTword(TTstring &str, WordMode mode, int val2) : _string(str),
- _wordMode(mode), _field1C(val2), _tag(0), _field24(0),
+TTword::TTword(TTstring &str, WordMode mode, int id) : _string(str),
+ _wordMode(mode), _id(id), _tag(0), _field24(0),
_field28(0), _synP(nullptr), _nextP(nullptr) {
_status = str.getStatus() == SS_VALID ? SS_VALID : SS_5;
}
@@ -40,7 +40,7 @@ TTword::TTword(TTword *src) {
_string = src->_string;
_wordMode = src->_wordMode;
- _field1C = src->_field1C;
+ _id = src->_id;
_tag = src->_tag;
_synP = nullptr;
@@ -135,11 +135,11 @@ void TTword::appendNode(TTsynonym *node) {
int TTword::load(SimpleFile *file, WordMode mode) {
CString str1, str2;
- int val;
+ int id;
- if (file->scanf("%d %s %s", &val, &str1, &str2)) {
+ if (file->scanf("%d %s %s", &id, &str1, &str2)) {
_string = str1;
- _field1C = val;
+ _id = id;
_tag = readNumber(str2.c_str());
_wordMode = mode;
return 0;
diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h
index 333bfb5bfe..010aa66196 100644
--- a/engines/titanic/true_talk/tt_word.h
+++ b/engines/titanic/true_talk/tt_word.h
@@ -53,7 +53,7 @@ public:
TTsynonym *_synP;
TTstring _string;
WordMode _wordMode;
- int _field1C;
+ int _id;
uint _tag;
public:
TTword(TTstring &str, WordMode mode, int val2);