aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/true_talk
diff options
context:
space:
mode:
authorPaul Gilbert2016-05-20 07:12:32 -0400
committerPaul Gilbert2016-07-15 19:13:30 -0400
commit378c96736a4ce86d6812886f7c06a3c6484b9de9 (patch)
tree644c9dfeb8a1eec10b7b20af1e740339a9115251 /engines/titanic/true_talk
parentbb459dd5a8219e9f096c8ea52372f07484c2bf19 (diff)
downloadscummvm-rg350-378c96736a4ce86d6812886f7c06a3c6484b9de9.tar.gz
scummvm-rg350-378c96736a4ce86d6812886f7c06a3c6484b9de9.tar.bz2
scummvm-rg350-378c96736a4ce86d6812886f7c06a3c6484b9de9.zip
TITANIC: Fields renaming
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r--engines/titanic/true_talk/script_handler.h3
-rw-r--r--engines/titanic/true_talk/tt_parser.cpp11
-rw-r--r--engines/titanic/true_talk/tt_sentence.cpp16
-rw-r--r--engines/titanic/true_talk/tt_sentence.h8
-rw-r--r--engines/titanic/true_talk/tt_sentence_node.cpp4
-rw-r--r--engines/titanic/true_talk/tt_sentence_node.h5
-rw-r--r--engines/titanic/true_talk/tt_word.cpp6
-rw-r--r--engines/titanic/true_talk/tt_word.h2
8 files changed, 43 insertions, 12 deletions
diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h
index 86cc99cdf9..891a40f527 100644
--- a/engines/titanic/true_talk/script_handler.h
+++ b/engines/titanic/true_talk/script_handler.h
@@ -51,7 +51,6 @@ class CScriptHandler {
private:
CTitleEngine *_owner;
TTscriptBase *_script;
- TTvocab *_vocab;
CExeResources &_resources;
int _field10;
CScriptHandlerSub1 _sub1;
@@ -63,6 +62,8 @@ private:
int _field2C;
int _field30;
public:
+ TTvocab *_vocab;
+public:
CScriptHandler(CTitleEngine *owner, int val1, int val2);
~CScriptHandler();
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp
index efed166a6b..787e9767da 100644
--- a/engines/titanic/true_talk/tt_parser.cpp
+++ b/engines/titanic/true_talk/tt_parser.cpp
@@ -478,8 +478,15 @@ int TTparser::findFrames(TTsentence *sentence) {
if (wordString.empty())
break;
- //TTword *word = nullptr;
- //_owner->_vocab.fn1(wordString, &word);
+ TTword *srcWord = nullptr;
+ TTword *word = _owner->_vocab->getWord(wordString, &word);
+ sentence->storeVocabHit(srcWord);
+
+ if (word) {
+ // TODO
+ } else {
+
+ }
}
diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp
index 2654a55d67..ca808884d7 100644
--- a/engines/titanic/true_talk/tt_sentence.cpp
+++ b/engines/titanic/true_talk/tt_sentence.cpp
@@ -87,7 +87,7 @@ void TTsentence::copyFrom(const TTsentence &src) {
// Source has processed nodes, so duplicate them
for (TTsentenceNode *node = src._nodesP; node;
node = static_cast<TTsentenceNode *>(node->_nextP)) {
- TTsentenceNode *newNode = new TTsentenceNode(node->_val);
+ TTsentenceNode *newNode = new TTsentenceNode(node->_wordP);
if (_nodesP)
_nodesP->addNode(newNode);
else
@@ -96,4 +96,18 @@ void TTsentence::copyFrom(const TTsentence &src) {
}
}
+int TTsentence::storeVocabHit(TTword *word) {
+ if (!word)
+ return 0;
+
+ TTsentenceNode *node = new TTsentenceNode(word);
+ if (_nodesP) {
+ _nodesP->addNode(node);
+ } else {
+ _nodesP = node;
+ }
+
+ return 0;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h
index 042e0558ac..998aad2500 100644
--- a/engines/titanic/true_talk/tt_sentence.h
+++ b/engines/titanic/true_talk/tt_sentence.h
@@ -31,6 +31,7 @@
namespace Titanic {
class CScriptHandler;
+class TTword;
class TTsentenceSubBase {
public:
@@ -89,6 +90,13 @@ public:
void set38(int v) { _field38 = v; }
int getStatus() const { return _status; }
+
+ /**
+ * Adds a found vocab word to the list of words representing
+ * the player's input
+ * @param word Word to node
+ */
+ int storeVocabHit(TTword *word);
};
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_sentence_node.cpp b/engines/titanic/true_talk/tt_sentence_node.cpp
index 2bec287b44..33d7501c55 100644
--- a/engines/titanic/true_talk/tt_sentence_node.cpp
+++ b/engines/titanic/true_talk/tt_sentence_node.cpp
@@ -25,10 +25,10 @@
namespace Titanic {
-TTsentenceNode::TTsentenceNode() : TTnode(), _val(0) {
+TTsentenceNode::TTsentenceNode() : TTnode(), _wordP(nullptr) {
}
-TTsentenceNode::TTsentenceNode(int val) : TTnode(), _val(val) {
+TTsentenceNode::TTsentenceNode(TTword *word) : TTnode(), _wordP(word) {
}
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_sentence_node.h b/engines/titanic/true_talk/tt_sentence_node.h
index 09d106cb71..18fa56fd57 100644
--- a/engines/titanic/true_talk/tt_sentence_node.h
+++ b/engines/titanic/true_talk/tt_sentence_node.h
@@ -24,15 +24,16 @@
#define TITANIC_TT_SENTENCE_NODE_H
#include "titanic/true_talk/tt_node.h"
+#include "titanic/true_talk/tt_word.h"
namespace Titanic {
class TTsentenceNode : public TTnode {
public:
- int _val;
+ TTword *_wordP;
public:
TTsentenceNode();
- TTsentenceNode(int val);
+ TTsentenceNode(TTword *word);
};
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp
index bb9d63d691..c277b871a4 100644
--- a/engines/titanic/true_talk/tt_word.cpp
+++ b/engines/titanic/true_talk/tt_word.cpp
@@ -27,7 +27,7 @@
namespace Titanic {
TTword::TTword(TTstring &str, WordMode mode, int val2) : _string(str),
- _wordMode(mode), _field1C(val2), _field20(0), _field24(0),
+ _wordMode(mode), _field1C(val2), _tag(0), _field24(0),
_field28(0), _synP(nullptr), _nextP(nullptr) {
_status = str.getStatus() == SS_VALID ? SS_VALID : SS_5;
}
@@ -41,7 +41,7 @@ TTword::TTword(TTword *src) {
_string = src->_string;
_wordMode = src->_wordMode;
_field1C = src->_field1C;
- _field20 = src->_field20;
+ _tag = src->_tag;
_synP = nullptr;
TTsynonym *priorSyn = nullptr;
@@ -140,7 +140,7 @@ int TTword::load(SimpleFile *file, WordMode mode) {
if (file->scanf("%d %s %s", &val, &str1, &str2)) {
_string = str1;
_field1C = val;
- _field20 = readNumber(str2.c_str());
+ _tag = readNumber(str2.c_str());
_wordMode = mode;
return 0;
} else {
diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h
index 01482a97ea..9574bc3b0c 100644
--- a/engines/titanic/true_talk/tt_word.h
+++ b/engines/titanic/true_talk/tt_word.h
@@ -37,7 +37,6 @@ enum WordMode {
class TTword {
protected:
TTstringStatus _status;
- int _field20;
int _field24;
int _field28;
protected:
@@ -54,6 +53,7 @@ public:
TTstring _string;
WordMode _wordMode;
int _field1C;
+ uint _tag;
public:
TTword(TTstring &str, WordMode mode, int val2);
TTword(TTword *src);