aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-05-29 09:03:31 -0400
committerPaul Gilbert2016-07-15 19:16:54 -0400
commitd0301bce6f932b34810110796fa86bc367ddf89f (patch)
tree3044c0ba9fe8140168b15c7da19fb1fafede747b
parent703bb288c17e207f083e75facc750f5c8c30a09e (diff)
downloadscummvm-rg350-d0301bce6f932b34810110796fa86bc367ddf89f.tar.gz
scummvm-rg350-d0301bce6f932b34810110796fa86bc367ddf89f.tar.bz2
scummvm-rg350-d0301bce6f932b34810110796fa86bc367ddf89f.zip
TITANIC: Move unknown method from TTword to TTadj
-rw-r--r--engines/titanic/true_talk/tt_adj.cpp19
-rw-r--r--engines/titanic/true_talk/tt_adj.h16
-rw-r--r--engines/titanic/true_talk/tt_vocab.cpp37
-rw-r--r--engines/titanic/true_talk/tt_word.cpp4
-rw-r--r--engines/titanic/true_talk/tt_word.h2
5 files changed, 45 insertions, 33 deletions
diff --git a/engines/titanic/true_talk/tt_adj.cpp b/engines/titanic/true_talk/tt_adj.cpp
index 1c16d5894c..a14784798f 100644
--- a/engines/titanic/true_talk/tt_adj.cpp
+++ b/engines/titanic/true_talk/tt_adj.cpp
@@ -29,19 +29,19 @@ bool TTadj::_staticFlag;
TTadj::TTadj(TTstring &str, WordClass wordClass, int val2, int val3, int val4) :
TTmajorWord(str, wordClass, val2, val3) {
if (val4 >= 0 && val4 <= 9) {
- _field30 = val4;
+ _val = val4;
} else {
- _field30 = 0;
+ _val = 0;
_status = SS_5;
}
}
TTadj::TTadj(const TTadj *src) : TTmajorWord(src) {
if (src->getStatus()) {
- _field30 = 0;
+ _val = 0;
_status = SS_5;
} else {
- _field30 = src->_field30;
+ _val = src->_val;
}
}
@@ -49,13 +49,22 @@ int TTadj::load(SimpleFile *file) {
int val;
if (!TTword::load(file, WC_ADJECTIVE) && file->scanf("%d", &val)) {
- _field30 = val;
+ _val = val;
return 0;
} else {
return 8;
}
}
+int TTadj::adjFn1(int val) {
+ if (_val < 0 || _val > 9) {
+ return SS_4;
+ } else {
+ _val = val;
+ return SS_VALID;
+ }
+}
+
TTword *TTadj::copy() const {
TTadj *returnWordP = new TTadj(this);
returnWordP->_status = _status;
diff --git a/engines/titanic/true_talk/tt_adj.h b/engines/titanic/true_talk/tt_adj.h
index 813cc8cfa0..1dec8a77d2 100644
--- a/engines/titanic/true_talk/tt_adj.h
+++ b/engines/titanic/true_talk/tt_adj.h
@@ -31,7 +31,7 @@ class TTadj : public TTmajorWord {
private:
static bool _staticFlag;
protected:
- int _field30;
+ int _val;
public:
TTadj(TTstring &str, WordClass wordClass, int val2, int val3, int val4);
TTadj(const TTadj *src);
@@ -41,22 +41,24 @@ public:
*/
int load(SimpleFile *file);
+ int adjFn1(int val);
+
/**
* Creates a copy of the word
*/
virtual TTword *copy() const;
- virtual bool proc14(int val) const { return _field30 == val; }
- virtual int proc15() const { return _field30; }
- virtual bool proc16() const { return _field30 >= 7; }
- virtual bool proc17() const { return _field30 <= 3; }
- virtual bool proc18() const { return _field30 > 3 && _field30 < 7; }
+ virtual bool proc14(int val) const { return _val == val; }
+ virtual int proc15() const { return _val; }
+ virtual bool proc16() const { return _val >= 7; }
+ virtual bool proc17() const { return _val <= 3; }
+ virtual bool proc18() const { return _val > 3 && _val < 7; }
/**
* Dumps data associated with the word to file
*/
virtual int save(SimpleFile *file) const {
- return saveData(file, _field30);
+ return saveData(file, _val);
}
};
diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp
index 350fc71d35..08d6e9e1a7 100644
--- a/engines/titanic/true_talk/tt_vocab.cpp
+++ b/engines/titanic/true_talk/tt_vocab.cpp
@@ -311,16 +311,17 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
if (word) {
if (word->_wordClass == WC_ADJECTIVE) {
+ TTadj *adj = static_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
if (val2 < 5) {
if (--val1 > 0) {
- word->unkFn1(val1);
+ adj->adjFn1(val1);
}
} else {
if (++val1 < 11) {
- word->unkFn1(val1);
+ adj->adjFn1(val1);
}
}
}
@@ -330,16 +331,17 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
if (word) {
if (word->_wordClass == WC_ADJECTIVE) {
+ TTadj *adj = static_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
if (val2 < 5) {
if (--val1 > 0) {
- word->unkFn1(val1);
+ adj->adjFn1(val1);
}
} else {
if (++val1 < 11) {
- word->unkFn1(val1);
+ adj->adjFn1(val1);
}
}
}
@@ -348,16 +350,17 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
word = getPrimeWord(tempStr);
if (word && word->_wordClass == WC_ADJECTIVE) {
+ TTadj *adj = static_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
if (val2 < 5) {
if (--val1 > 0) {
- word->unkFn1(val1);
+ adj->adjFn1(val1);
}
} else {
if (++val1 < 11) {
- word->unkFn1(val1);
+ adj->adjFn1(val1);
}
}
}
@@ -370,16 +373,17 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
if (word) {
if (word->_wordClass == WC_ADJECTIVE) {
+ TTadj *adj = static_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
if (val2 < 5) {
if (--val1 > 0) {
- word->unkFn1(val1);
+ adj->adjFn1(val1);
}
} else {
if (++val1 < 11) {
- word->unkFn1(val1);
+ adj->adjFn1(val1);
}
}
}
@@ -389,16 +393,17 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
if (word) {
if (word->_wordClass == WC_ADJECTIVE) {
+ TTadj *adj = static_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
if (val2 < 5) {
if (--val1 > 0) {
- word->unkFn1(val1);
+ adj->adjFn1(val1);
}
} else {
if (++val1 < 11) {
- word->unkFn1(val1);
+ adj->adjFn1(val1);
}
}
}
@@ -407,16 +412,17 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
word = getPrimeWord(tempStr);
if (word) {
+ TTadj *adj = static_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
if (val2 < 5) {
if (--val1 > 0) {
- word->unkFn1(val1);
+ adj->adjFn1(val1);
}
} else {
if (++val1 < 11) {
- word->unkFn1(val1);
+ adj->adjFn1(val1);
}
}
}
@@ -522,15 +528,16 @@ TTword *TTvocab::getPrefixedWord(TTstring &str) const {
if (!word)
tempStr = str;
- else if (word->_wordClass == 8) {
+ else if (word->_wordClass == WC_ADJECTIVE) {
+ TTadj *adj = static_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
if (val2 < 5) {
if (--val1 > 0)
- word->unkFn1(val1);
+ adj->adjFn1(val1);
} else if (++val1 < 11) {
- word->unkFn1(val1);
+ adj->adjFn1(val1);
}
}
}
diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp
index 1dccd30a0b..df6ee5c7bc 100644
--- a/engines/titanic/true_talk/tt_word.cpp
+++ b/engines/titanic/true_talk/tt_word.cpp
@@ -193,10 +193,6 @@ TTword *TTword::copy() const {
return new TTword(this);
}
-void TTword::unkFn1(int val) {
- // TODO: This method seems to reference a field beyond the size of TTword
-}
-
FileHandle TTword::getSynFile() const {
return _synP ? _synP->_file : HANDLE_STDIN;
}
diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h
index 537d1e923b..b16e6a50ce 100644
--- a/engines/titanic/true_talk/tt_word.h
+++ b/engines/titanic/true_talk/tt_word.h
@@ -161,8 +161,6 @@ public:
*/
virtual TTword *copy() const;
- void unkFn1(int val);
-
virtual bool proc2(int val) const { return false; }
virtual int proc3() const { return -1; }
virtual void proc4() {}