aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-05-19 20:49:39 -0400
committerPaul Gilbert2016-07-15 19:13:22 -0400
commit54669e7b7e6c3e3ebad32f2d36932d8345814d2c (patch)
tree324a9b9e5459cfff632650ca9f23291dced69c3b /engines/titanic
parentc858190c54ec3c0bb6f0f9b4a22b4cda1d893bbb (diff)
downloadscummvm-rg350-54669e7b7e6c3e3ebad32f2d36932d8345814d2c.tar.gz
scummvm-rg350-54669e7b7e6c3e3ebad32f2d36932d8345814d2c.tar.bz2
scummvm-rg350-54669e7b7e6c3e3ebad32f2d36932d8345814d2c.zip
TITANIC: Added an enum for TTword wordMode
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/true_talk/tt_action.cpp6
-rw-r--r--engines/titanic/true_talk/tt_action.h2
-rw-r--r--engines/titanic/true_talk/tt_adj.cpp6
-rw-r--r--engines/titanic/true_talk/tt_adj.h2
-rw-r--r--engines/titanic/true_talk/tt_major_word.cpp4
-rw-r--r--engines/titanic/true_talk/tt_major_word.h2
-rw-r--r--engines/titanic/true_talk/tt_picture.cpp6
-rw-r--r--engines/titanic/true_talk/tt_picture.h2
-rw-r--r--engines/titanic/true_talk/tt_pronoun.cpp6
-rw-r--r--engines/titanic/true_talk/tt_pronoun.h2
-rw-r--r--engines/titanic/true_talk/tt_vocab.cpp50
-rw-r--r--engines/titanic/true_talk/tt_word.cpp4
-rw-r--r--engines/titanic/true_talk/tt_word.h11
13 files changed, 71 insertions, 32 deletions
diff --git a/engines/titanic/true_talk/tt_action.cpp b/engines/titanic/true_talk/tt_action.cpp
index 39e31747ee..028da46c4e 100644
--- a/engines/titanic/true_talk/tt_action.cpp
+++ b/engines/titanic/true_talk/tt_action.cpp
@@ -26,8 +26,8 @@ namespace Titanic {
bool TTaction::_staticFlag;
-TTaction::TTaction(TTstring &str, int val1, int val2, int val3, int val4) :
- TTmajorWord(str, val1, val2, val3), _field30(val4) {
+TTaction::TTaction(TTstring &str, WordMode mode, int val2, int val3, int val4) :
+ TTmajorWord(str, mode, val2, val3), _field30(val4) {
}
TTaction::TTaction(TTaction *src) : TTmajorWord(src) {
@@ -42,7 +42,7 @@ TTaction::TTaction(TTaction *src) : TTmajorWord(src) {
int TTaction::load(SimpleFile *file) {
int val;
- if (!TTword::load(file, 1) && file->scanf("%d", &val)) {
+ if (!TTword::load(file, WMODE_1) && 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 822ba4a3a2..b89d702614 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, int val1, int val2, int val3, int val4);
+ TTaction(TTstring &str, WordMode mode, int val2, int val3, int val4);
TTaction(TTaction *src);
/**
diff --git a/engines/titanic/true_talk/tt_adj.cpp b/engines/titanic/true_talk/tt_adj.cpp
index 8f62bb8e0a..850692f69c 100644
--- a/engines/titanic/true_talk/tt_adj.cpp
+++ b/engines/titanic/true_talk/tt_adj.cpp
@@ -26,8 +26,8 @@ namespace Titanic {
bool TTadj::_staticFlag;
-TTadj::TTadj(TTstring &str, int val1, int val2, int val3, int val4) :
- TTmajorWord(str, val1, val2, val3) {
+TTadj::TTadj(TTstring &str, WordMode mode, int val2, int val3, int val4) :
+ TTmajorWord(str, mode, val2, val3) {
if (val4 >= 0 && val4 <= 9) {
_field30 = val4;
} else {
@@ -48,7 +48,7 @@ TTadj::TTadj(TTadj *src) : TTmajorWord(src) {
int TTadj::load(SimpleFile *file) {
int val;
- if (!TTword::load(file, 8) && file->scanf("%d", &val)) {
+ if (!TTword::load(file, WMODE_8) && file->scanf("%d", &val)) {
_field30 = val;
return 0;
} else {
diff --git a/engines/titanic/true_talk/tt_adj.h b/engines/titanic/true_talk/tt_adj.h
index 301023ed5e..f18d249a99 100644
--- a/engines/titanic/true_talk/tt_adj.h
+++ b/engines/titanic/true_talk/tt_adj.h
@@ -33,7 +33,7 @@ private:
protected:
int _field30;
public:
- TTadj(TTstring &str, int val1, int val2, int val3, int val4);
+ TTadj(TTstring &str, WordMode mode, int val2, int val3, int val4);
TTadj(TTadj *src);
/**
diff --git a/engines/titanic/true_talk/tt_major_word.cpp b/engines/titanic/true_talk/tt_major_word.cpp
index 68af628dbb..b81ada4de1 100644
--- a/engines/titanic/true_talk/tt_major_word.cpp
+++ b/engines/titanic/true_talk/tt_major_word.cpp
@@ -26,8 +26,8 @@ namespace Titanic {
bool TTmajorWord::_staticFlag;
-TTmajorWord::TTmajorWord(TTstring &str, int val1, int val2, int val3) :
- TTword(str, val1, val2), _field2C(val3) {
+TTmajorWord::TTmajorWord(TTstring &str, WordMode mode, int val2, int val3) :
+ TTword(str, mode, val2), _field2C(val3) {
}
TTmajorWord::TTmajorWord(TTmajorWord *src) : TTword(src) {
diff --git a/engines/titanic/true_talk/tt_major_word.h b/engines/titanic/true_talk/tt_major_word.h
index 962fbaab6d..55eb882c8e 100644
--- a/engines/titanic/true_talk/tt_major_word.h
+++ b/engines/titanic/true_talk/tt_major_word.h
@@ -38,7 +38,7 @@ protected:
*/
int saveData(SimpleFile *file, int val) const;
public:
- TTmajorWord(TTstring &str, int val1, int val2, int val3);
+ TTmajorWord(TTstring &str, WordMode mode, int val2, int val3);
TTmajorWord(TTmajorWord *src);
/**
diff --git a/engines/titanic/true_talk/tt_picture.cpp b/engines/titanic/true_talk/tt_picture.cpp
index 6213cd557b..aab9c5d7aa 100644
--- a/engines/titanic/true_talk/tt_picture.cpp
+++ b/engines/titanic/true_talk/tt_picture.cpp
@@ -26,8 +26,8 @@ namespace Titanic {
bool TTpicture::_staticFlag;
-TTpicture::TTpicture(TTstring &str, int val1, int val2, int val3, int val4, int val5, int val6) :
- TTmajorWord(str, val1, val2, val4), _tag(val3), _field30(val5), _field3C(val6),
+TTpicture::TTpicture(TTstring &str, WordMode mode, int val2, int val3, int val4, int val5, int val6) :
+ TTmajorWord(str, mode, val2, val4), _tag(val3), _field30(val5), _field3C(val6),
_field38(0) {
}
@@ -50,7 +50,7 @@ int TTpicture::load(SimpleFile *file) {
CString str;
int val1, val2;
- if (!TTword::load(file, 2) && file->scanf("%s %d %d", &str, &val1, &val2)) {
+ if (!TTword::load(file, WMODE_2) && file->scanf("%s %d %d", &str, &val1, &val2)) {
_tag = readNumber(str.c_str());
_field30 = val1;
_field3C = val2;
diff --git a/engines/titanic/true_talk/tt_picture.h b/engines/titanic/true_talk/tt_picture.h
index c4cc2c19d3..404d9c4b03 100644
--- a/engines/titanic/true_talk/tt_picture.h
+++ b/engines/titanic/true_talk/tt_picture.h
@@ -36,7 +36,7 @@ protected:
int _field38;
int _field3C;
public:
- TTpicture(TTstring &str, int val1, int val2, int val3, int val4, int val5, int val6);
+ TTpicture(TTstring &str, WordMode mode, int val2, int val3, int val4, int val5, int val6);
TTpicture(TTpicture *src);
/**
diff --git a/engines/titanic/true_talk/tt_pronoun.cpp b/engines/titanic/true_talk/tt_pronoun.cpp
index 4b20b3341b..68fcef02a3 100644
--- a/engines/titanic/true_talk/tt_pronoun.cpp
+++ b/engines/titanic/true_talk/tt_pronoun.cpp
@@ -26,8 +26,8 @@ namespace Titanic {
bool TTpronoun::_staticFlag;
-TTpronoun::TTpronoun(TTstring &str, int val1, int val2, int val3, int val4) :
- TTmajorWord(str, val1, val2, val3), _field30(val4) {
+TTpronoun::TTpronoun(TTstring &str, WordMode mode, int val2, int val3, int val4) :
+ TTmajorWord(str, mode, val2, val3), _field30(val4) {
}
TTpronoun::TTpronoun(TTpronoun *src) : TTmajorWord(src) {
@@ -42,7 +42,7 @@ TTpronoun::TTpronoun(TTpronoun *src) : TTmajorWord(src) {
int TTpronoun::load(SimpleFile *file) {
int val;
- if (!TTword::load(file, 6) && file->scanf("%d", &val)) {
+ if (!TTword::load(file, WMODE_6) && file->scanf("%d", &val)) {
if (val >= 0 && val <= 12) {
_field30 = val;
return 0;
diff --git a/engines/titanic/true_talk/tt_pronoun.h b/engines/titanic/true_talk/tt_pronoun.h
index 6bb8113e15..5aa3e1e8fe 100644
--- a/engines/titanic/true_talk/tt_pronoun.h
+++ b/engines/titanic/true_talk/tt_pronoun.h
@@ -33,7 +33,7 @@ private:
protected:
int _field30;
public:
- TTpronoun(TTstring &str, int val1, int val2, int val3, int val4);
+ TTpronoun(TTstring &str, WordMode mode, int val2, int val3, int val4);
TTpronoun(TTpronoun *src);
/**
diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp
index 073c7c2260..b5276e1f85 100644
--- a/engines/titanic/true_talk/tt_vocab.cpp
+++ b/engines/titanic/true_talk/tt_vocab.cpp
@@ -52,7 +52,7 @@ int TTvocab::load(const CString &name) {
while (!result && !file->eos()) {
skipFlag = false;
- int mode = file->readNumber();
+ WordMode mode = (WordMode)file->readNumber();
TTstring space(" ");
switch (mode) {
@@ -64,14 +64,14 @@ int TTvocab::load(const CString &name) {
}
case 1: {
- TTaction *word = new TTaction(space, 0, 0, 0, 0);
+ TTaction *word = new TTaction(space, WMODE_NONE, 0, 0, 0);
result = word->load(file);
_word = word;
break;
}
case 2: {
- TTpicture *word = new TTpicture(space, 0, 0, 0, 0, 0, 0);
+ TTpicture *word = new TTpicture(space, WMODE_NONE, 0, 0, 0, 0, 0);
result = word->load(file);
_word = word;
break;
@@ -79,7 +79,7 @@ int TTvocab::load(const CString &name) {
case 3:
case 9: {
- TTmajorWord *word = new TTmajorWord(space, 0, 0, 0);
+ TTmajorWord *word = new TTmajorWord(space, WMODE_NONE, 0, 0);
result = word->load(file, mode);
_word = word;
break;
@@ -88,21 +88,21 @@ int TTvocab::load(const CString &name) {
case 4:
case 5:
case 7: {
- TTword *word = new TTword(space, 0, 0);
+ TTword *word = new TTword(space, WMODE_NONE, 0);
result = word->load(file, mode);
_word = word;
break;
}
case 8: {
- TTadj *word = new TTadj(space, 0, 0, 0, 0);
+ TTadj *word = new TTadj(space, WMODE_NONE, 0, 0, 0);
result = word->load(file);
_word = word;
break;
}
case 6: {
- TTpronoun *word = new TTpronoun(space, 0, 0, 0, 0);
+ TTpronoun *word = new TTpronoun(space, WMODE_NONE, 0, 0, 0);
result = word->load(file);
_word = word;
break;
@@ -198,7 +198,7 @@ TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const {
if (!Common::isDigit(c)) {
vocabP = _headP;
- newWord = new TTword(str, 3, 300);
+ newWord = new TTword(str, WMODE_3, 300);
} else {
for (vocabP = _headP; vocabP && !newWord; vocabP = vocabP->_nextP) {
if (_vocabMode == 3 && !strcmp(str.c_str(), vocabP->c_str())) {
@@ -246,8 +246,42 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
word = getPrimeWord(tempStr);
if (word) {
+ if (word->_wordMode == 1) {
+ delete word;
+ word = nullptr;
+ } else {
+ delete word;
+ word = new TTadj(str, WMODE_8, 0, 0, 0);
+ }
+ } else {
+ tempStr += "e";
+ word = getPrimeWord(tempStr);
+
+ if (word) {
+ if (word->_wordMode != 1) {
+ delete word;
+ word = new TTadj(str, WMODE_8, 0, 0, 0);
+ }
+ } else {
+ tempStr.deleteSuffix(2);
+ word = getPrimeWord(tempStr);
+ if (word) {
+ if (word->_wordMode != 1) {
+ delete word;
+ word = new TTadj(str, WMODE_8, 0, 0, 0);
+ }
+ } else {
+ tempStr = str;
+ }
+ }
}
+
+ } else if (tempStr.hasSuffix("ed")) {
+ tempStr.deleteSuffix(1);
+ word = getPrimeWord(tempStr);
+
+ // TODO
}
// TODO
diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp
index a4147a8662..eebb161167 100644
--- a/engines/titanic/true_talk/tt_word.cpp
+++ b/engines/titanic/true_talk/tt_word.cpp
@@ -26,7 +26,7 @@
namespace Titanic {
-TTword::TTword(TTstring &str, int mode, int val2) : _string(str),
+TTword::TTword(TTstring &str, WordMode mode, int val2) : _string(str),
_wordMode(mode), _field1C(val2), _field20(0), _field24(0),
_field28(0), _synP(nullptr), _nextP(nullptr) {
_status = str.getStatus() == SS_VALID ? SS_VALID : SS_5;
@@ -133,7 +133,7 @@ void TTword::appendNode(TTsynonym *node) {
_synP = node;
}
-int TTword::load(SimpleFile *file, int mode) {
+int TTword::load(SimpleFile *file, WordMode mode) {
CString str1, str2;
int val;
diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h
index ed32b35814..13a40b0262 100644
--- a/engines/titanic/true_talk/tt_word.h
+++ b/engines/titanic/true_talk/tt_word.h
@@ -29,6 +29,11 @@
namespace Titanic {
+enum WordMode {
+ WMODE_NONE = 0, WMODE_1 = 1, WMODE_2 = 2, WMODE_3 = 3,
+ WMODE_6 = 6, WMODE_8 = 8
+};
+
class TTword {
protected:
TTstringStatus _status;
@@ -48,9 +53,9 @@ public:
TTword *_nextP;
TTsynonym *_synP;
TTstring _string;
- int _wordMode;
+ WordMode _wordMode;
public:
- TTword(TTstring &str, int mode, int val2);
+ TTword(TTstring &str, WordMode mode, int val2);
TTword(TTword *src);
~TTword();
@@ -87,7 +92,7 @@ public:
/**
* Load the word
*/
- int load(SimpleFile *file, int mode);
+ int load(SimpleFile *file, WordMode mode);
/**
* Finds a synonym in the word by name, if one exists