aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-05-19 22:51:25 -0400
committerPaul Gilbert2016-07-15 19:13:25 -0400
commitc4084e731b60b97bbe0cdf5d6f61f1894b70f96c (patch)
treeb382853918713f01b2e5a6b33b367caa61b3275b
parent54669e7b7e6c3e3ebad32f2d36932d8345814d2c (diff)
downloadscummvm-rg350-c4084e731b60b97bbe0cdf5d6f61f1894b70f96c.tar.gz
scummvm-rg350-c4084e731b60b97bbe0cdf5d6f61f1894b70f96c.tar.bz2
scummvm-rg350-c4084e731b60b97bbe0cdf5d6f61f1894b70f96c.zip
TITANIC: Implemented TTvocab getSuffixedWord
-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_vocab.cpp199
-rw-r--r--engines/titanic/true_talk/tt_word.h6
4 files changed, 202 insertions, 7 deletions
diff --git a/engines/titanic/true_talk/tt_action.cpp b/engines/titanic/true_talk/tt_action.cpp
index 028da46c4e..e0c7284b7a 100644
--- a/engines/titanic/true_talk/tt_action.cpp
+++ b/engines/titanic/true_talk/tt_action.cpp
@@ -42,7 +42,7 @@ TTaction::TTaction(TTaction *src) : TTmajorWord(src) {
int TTaction::load(SimpleFile *file) {
int val;
- if (!TTword::load(file, WMODE_1) && file->scanf("%d", &val)) {
+ if (!TTword::load(file, WMODE_ACTION) && file->scanf("%d", &val)) {
_field30 = val;
return 0;
} else {
diff --git a/engines/titanic/true_talk/tt_action.h b/engines/titanic/true_talk/tt_action.h
index b89d702614..1103da8dcb 100644
--- a/engines/titanic/true_talk/tt_action.h
+++ b/engines/titanic/true_talk/tt_action.h
@@ -41,6 +41,8 @@ public:
*/
int load(SimpleFile *file);
+ void setVal(int val) { _field30 = val; }
+
/**
* Creates a copy of the word
*/
diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp
index b5276e1f85..2e5a7cc794 100644
--- a/engines/titanic/true_talk/tt_vocab.cpp
+++ b/engines/titanic/true_talk/tt_vocab.cpp
@@ -280,12 +280,205 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
} else if (tempStr.hasSuffix("ed")) {
tempStr.deleteSuffix(1);
word = getPrimeWord(tempStr);
+
+ if (!word) {
+ tempStr.deleteSuffix(1);
+ word = getPrimeWord(tempStr);
+ }
+
+ if (word) {
+ if (word->_wordMode == WMODE_ACTION) {
+ static_cast<TTaction *>(word)->setVal(1);
+ }
+ } else {
+ tempStr = str;
+ }
+
+ } else if (tempStr.hasSuffix("ly")) {
+ tempStr.deleteSuffix(2);
+ word = getPrimeWord(tempStr);
+
+ if (word) {
+ delete word;
+ word = new TTword(str, WMODE_9, 0);
+ } else {
+ tempStr = str;
+ }
+
+ } else if (tempStr.hasSuffix("er")) {
+ tempStr.deleteSuffix(1);
+ word = getPrimeWord(tempStr);
+
+ if (word) {
+ if (word->_wordMode == WMODE_8) {
+ int val1 = word->proc15();
+ int val2 = word->proc15();
+
+ if (val2 < 5) {
+ if (--val1 > 0) {
+ word->unkFn1(val1);
+ }
+ } else {
+ if (++val1 < 11) {
+ word->unkFn1(val1);
+ }
+ }
+ }
+ } else {
+ tempStr.deleteSuffix(1);
+ word = getPrimeWord(tempStr);
+
+ if (word) {
+ if (word->_wordMode == WMODE_8) {
+ int val1 = word->proc15();
+ int val2 = word->proc15();
+
+ if (val2 < 5) {
+ if (--val1 > 0) {
+ word->unkFn1(val1);
+ }
+ } else {
+ if (++val1 < 11) {
+ word->unkFn1(val1);
+ }
+ }
+ }
+ } else {
+ tempStr.deleteSuffix(1);
+ word = getPrimeWord(tempStr);
+
+ if (word && word->_wordMode == WMODE_8) {
+ int val1 = word->proc15();
+ int val2 = word->proc15();
+
+ if (val2 < 5) {
+ if (--val1 > 0) {
+ word->unkFn1(val1);
+ }
+ } else {
+ if (++val1 < 11) {
+ word->unkFn1(val1);
+ }
+ }
+ }
+ }
+ }
+
+ } else if (tempStr.hasSuffix("est")) {
+ tempStr.deleteSuffix(2);
+ word = getPrimeWord(tempStr);
+
+ if (word) {
+ if (word->_wordMode == WMODE_8) {
+ int val1 = word->proc15();
+ int val2 = word->proc15();
+
+ if (val2 < 5) {
+ if (--val1 > 0) {
+ word->unkFn1(val1);
+ }
+ } else {
+ if (++val1 < 11) {
+ word->unkFn1(val1);
+ }
+ }
+ }
+ } else {
+ tempStr.deleteSuffix(1);
+ word = getPrimeWord(tempStr);
+
+ if (word) {
+ if (word->_wordMode == WMODE_8) {
+ int val1 = word->proc15();
+ int val2 = word->proc15();
+
+ if (val2 < 5) {
+ if (--val1 > 0) {
+ word->unkFn1(val1);
+ }
+ } else {
+ if (++val1 < 11) {
+ word->unkFn1(val1);
+ }
+ }
+ }
+ } else {
+ tempStr.deleteSuffix(1);
+ word = getPrimeWord(tempStr);
+
+ if (word) {
+ int val1 = word->proc15();
+ int val2 = word->proc15();
+
+ if (val2 < 5) {
+ if (--val1 > 0) {
+ word->unkFn1(val1);
+ }
+ } else {
+ if (++val1 < 11) {
+ word->unkFn1(val1);
+ }
+ }
+ }
+ }
+ }
+
+ } else if (tempStr.hasSuffix("s*")) {
+ tempStr.deleteSuffix(2);
+ word = getPrimeWord(tempStr);
+
+ if (word) {
+ if (word->_wordMode == WMODE_6 || word->_wordMode == WMODE_9) {
+ delete word;
+ TTstring isStr("is");
+ word = getPrimeWord(isStr);
+ } else {
+ switch (word->_field1C) {
+ case 200:
+ if (word->proc10() == 2) {
+ delete word;
+ word = new TTpronoun(tempStr, WMODE_6, 601, 0, 5);
+ } else if (word->proc10() == 1) {
+ delete word;
+ word = new TTpronoun(tempStr, WMODE_6, 601, 0, 4);
+ }
+ break;
+
+ case 201:
+ delete word;
+ word = new TTpronoun(tempStr, WMODE_6, 601, 0, 5);
+ break;
+
+ case 202:
+ case 203:
+ if (word->proc10() == 2) {
+ delete word;
+ word = new TTpronoun(tempStr, WMODE_6, 601, 0, 5);
+ } else {
+ int val = word->proc10() == 1 ? 0 : 4;
+ delete word;
+ word = new TTpronoun(tempStr, WMODE_6, 601, 0, val);
+ }
+ break;
- // TODO
+ case 204:
+ delete word;
+ word = new TTpronoun(tempStr, WMODE_6, 601, 0, 6);
+ break;
+
+ default:
+ delete word;
+ word = new TTpronoun(tempStr, WMODE_6, 601, 0, 0);
+ break;
+ }
+ }
+ }
}
- // TODO
- return nullptr;
+ if (word)
+ word->setSynStr(&str);
+
+ return word;
}
TTword *TTvocab::getPrefixedWord(TTstring &str) const {
diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h
index 13a40b0262..0823e3d2a8 100644
--- a/engines/titanic/true_talk/tt_word.h
+++ b/engines/titanic/true_talk/tt_word.h
@@ -30,14 +30,13 @@
namespace Titanic {
enum WordMode {
- WMODE_NONE = 0, WMODE_1 = 1, WMODE_2 = 2, WMODE_3 = 3,
- WMODE_6 = 6, WMODE_8 = 8
+ WMODE_NONE = 0, WMODE_ACTION = 1, WMODE_2 = 2, WMODE_3 = 3,
+ WMODE_6 = 6, WMODE_8 = 8, WMODE_9 = 9
};
class TTword {
protected:
TTstringStatus _status;
- int _field1C;
int _field20;
int _field24;
int _field28;
@@ -54,6 +53,7 @@ public:
TTsynonym *_synP;
TTstring _string;
WordMode _wordMode;
+ int _field1C;
public:
TTword(TTstring &str, WordMode mode, int val2);
TTword(TTword *src);