aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-11-13 15:39:59 -0500
committerPaul Gilbert2016-11-13 15:39:59 -0500
commitc6a24d1540f1fdcd69aa0afe64fbc4613a936772 (patch)
tree62b86732579482d64df2afc7c6002dd7f538ceaa /engines/titanic
parent923a484dae84941b02dfab953526db63ab5dc63b (diff)
downloadscummvm-rg350-c6a24d1540f1fdcd69aa0afe64fbc4613a936772.tar.gz
scummvm-rg350-c6a24d1540f1fdcd69aa0afe64fbc4613a936772.tar.bz2
scummvm-rg350-c6a24d1540f1fdcd69aa0afe64fbc4613a936772.zip
TITANIC: Properly initialize NPC scripts
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/true_talk/tt_concept.cpp12
-rw-r--r--engines/titanic/true_talk/tt_script_base.cpp14
-rw-r--r--engines/titanic/true_talk/tt_word.cpp1
3 files changed, 16 insertions, 11 deletions
diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp
index acb2e61e9e..cd24d7cc36 100644
--- a/engines/titanic/true_talk/tt_concept.cpp
+++ b/engines/titanic/true_talk/tt_concept.cpp
@@ -28,7 +28,7 @@
namespace Titanic {
TTconcept::TTconcept() : _string1(" "), _string2(" "),
- _scriptP(nullptr), _wordP(nullptr) {
+ _scriptP(nullptr), _wordP(nullptr), _status(SS_VALID) {
if (setStatus())
setScriptType(ST_UNKNOWN_SCRIPT);
else
@@ -36,7 +36,8 @@ TTconcept::TTconcept() : _string1(" "), _string2(" "),
}
TTconcept::TTconcept(TTscriptBase *script, ScriptType scriptType) :
- _string1(" "), _string2(" "), _wordP(nullptr), _scriptP(nullptr) {
+ _string1(" "), _string2(" "), _wordP(nullptr), _scriptP(nullptr),
+ _status(SS_VALID) {
if (!script->getStatus()) {
setScriptType(scriptType);
_scriptP = script;
@@ -50,8 +51,8 @@ TTconcept::TTconcept(TTscriptBase *script, ScriptType scriptType) :
}
TTconcept::TTconcept(TTword *word, ScriptType scriptType) :
- _string1(" "), _string2(" "), _wordP(nullptr), _scriptP(nullptr) {
-
+ _string1(" "), _string2(" "), _wordP(nullptr), _scriptP(nullptr),
+ _status(SS_VALID) {
if (!word || !setStatus() || word->getStatus()) {
_status = SS_5;
} else {
@@ -66,8 +67,7 @@ TTconcept::TTconcept(TTword *word, ScriptType scriptType) :
TTconcept::TTconcept(TTconcept &src) :
_string1(src._string1), _string2(src._string2),
- _wordP(nullptr), _scriptP(nullptr) {
-
+ _wordP(nullptr), _scriptP(nullptr), _status(SS_VALID) {
if (src.getStatus()) {
_status = SS_5;
} else {
diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp
index 1fa1ce3315..c1c052d4f3 100644
--- a/engines/titanic/true_talk/tt_script_base.cpp
+++ b/engines/titanic/true_talk/tt_script_base.cpp
@@ -33,7 +33,7 @@ TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int state,
_field20(0), _field24(0), _field28(0), _field2C(0),
_field30(0), _state(0), _hist2P(nullptr), _field3C(0),
_respHeadP(nullptr), _respTailP(nullptr), _oldResponseP(nullptr) {
- if (!isValid()) {
+ if (isValid()) {
if (!v7 || !getStatus()) {
_id = scriptId;
_field20 = v3;
@@ -43,7 +43,7 @@ TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int state,
_field30 = v7;
_state = state;
} else {
- _status = 5;
+ _status = SS_5;
}
}
@@ -65,9 +65,13 @@ TTscriptBase::~TTscriptBase() {
}
bool TTscriptBase::isValid() {
- bool result = !_charName.isValid() && !_charClass.isValid();
- _status = result ? 0 : 11;
- return result;
+ if (!_charName.empty() && !_charClass.empty()) {
+ _status = SS_VALID;
+ return true;
+ } else {
+ _status = SS_11;
+ return false;
+ }
}
void TTscriptBase::reset() {
diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp
index c8676e4b1e..01541de7dc 100644
--- a/engines/titanic/true_talk/tt_word.cpp
+++ b/engines/titanic/true_talk/tt_word.cpp
@@ -43,6 +43,7 @@ TTword::TTword(const TTword *src) {
_id = src->_id;
_tag = src->_tag;
_synP = nullptr;
+ _status = SS_VALID;
TTsynonym *priorSyn = nullptr;
for (TTsynonym *synP = _synP; synP && !_status;) {