aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/true_talk
diff options
context:
space:
mode:
authorPaul Gilbert2017-01-28 16:14:45 -0500
committerPaul Gilbert2017-01-28 16:14:45 -0500
commit4b1762d649364abd2c59056fcfb4840df02ee7be (patch)
tree4a70e97f6170dee6cfe4bcb0f8593a706d74e5d2 /engines/titanic/true_talk
parent4353fd8b662253323b038817f1aa4f36bdd1b82e (diff)
downloadscummvm-rg350-4b1762d649364abd2c59056fcfb4840df02ee7be.tar.gz
scummvm-rg350-4b1762d649364abd2c59056fcfb4840df02ee7be.tar.bz2
scummvm-rg350-4b1762d649364abd2c59056fcfb4840df02ee7be.zip
TITANIC: Revert field renamings in CScriptHandler
I initially thought the four concept fields could be given a relevant name for actor, object, and verb, but on further analysis, it looks like what fields go in which concept slot depends on the kind of sentence. I haven't been able to find any consistency, so I'm reverting them back to being called _concept1P through _concept4P
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r--engines/titanic/true_talk/script_handler.cpp54
-rw-r--r--engines/titanic/true_talk/script_handler.h28
-rw-r--r--engines/titanic/true_talk/tt_concept_node.cpp12
-rw-r--r--engines/titanic/true_talk/tt_npc_script.cpp4
-rw-r--r--engines/titanic/true_talk/tt_parser.cpp30
-rw-r--r--engines/titanic/true_talk/tt_parser.h2
-rw-r--r--engines/titanic/true_talk/tt_sentence.cpp24
7 files changed, 70 insertions, 84 deletions
diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp
index 04955a694b..be0b89bc65 100644
--- a/engines/titanic/true_talk/script_handler.cpp
+++ b/engines/titanic/true_talk/script_handler.cpp
@@ -32,8 +32,8 @@ namespace Titanic {
/*------------------------------------------------------------------------*/
CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) :
- _owner(owner), _script(owner->_script), _parser(this), _inputCtr(0), _conceptObject(nullptr),
- _conceptActor(nullptr), _conceptUnused(nullptr), _conceptVerb(nullptr) {
+ _owner(owner), _script(owner->_script), _parser(this), _inputCtr(0), _concept1P(nullptr),
+ _concept2P(nullptr), _concept3P(nullptr), _concept4P(nullptr) {
g_vm->_scriptHandler = this;
g_vm->_script = _script;
g_vm->_exeResources.reset(this, val1, val2);
@@ -42,10 +42,10 @@ CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) :
CScriptHandler::~CScriptHandler() {
delete _vocab;
- delete _conceptObject;
- delete _conceptActor;
- delete _conceptUnused;
- delete _conceptVerb;
+ delete _concept1P;
+ delete _concept2P;
+ delete _concept3P;
+ delete _concept4P;
}
ScriptChangedResult CScriptHandler::scriptChanged(TTroomScript *roomScript, TTnpcScript *npcScript, uint dialogueId) {
@@ -59,14 +59,14 @@ ScriptChangedResult CScriptHandler::scriptChanged(TTroomScript *roomScript, TTnp
result = npcScript->notifyScript(roomScript, dialogueId);
if (dialogueId == 3 || dialogueId == 4) {
- delete _conceptObject;
- delete _conceptActor;
- delete _conceptUnused;
- delete _conceptVerb;
- _conceptObject = nullptr;
- _conceptActor = nullptr;
- _conceptUnused = nullptr;
- _conceptVerb = nullptr;
+ delete _concept1P;
+ delete _concept2P;
+ delete _concept3P;
+ delete _concept4P;
+ _concept1P = nullptr;
+ _concept2P = nullptr;
+ _concept3P = nullptr;
+ _concept4P = nullptr;
}
++_inputCtr;
@@ -115,30 +115,30 @@ int CScriptHandler::setResponse(TTscriptBase *script, TTresponse *response) {
return _owner->setResponse(script, response);
}
-void CScriptHandler::setActorObject(const TTstring *str) {
- setActor(str);
- setObject(str);
+void CScriptHandler::handleWord(const TTstring *str) {
+ handleWord1(str);
+ handleWord2(str);
}
-void CScriptHandler::setActor(const TTstring *str) {
- if (_conceptActor)
- delete _conceptActor;
- _conceptActor = nullptr;
+void CScriptHandler::handleWord1(const TTstring *str) {
+ if (_concept2P)
+ delete _concept2P;
+ _concept2P = nullptr;
if (str) {
TTword word(*str, WC_UNKNOWN, 0);
- _conceptActor = new TTconcept(&word);
+ _concept2P = new TTconcept(&word);
}
}
-void CScriptHandler::setObject(const TTstring *str) {
- if (_conceptObject)
- delete _conceptObject;
- _conceptObject = nullptr;
+void CScriptHandler::handleWord2(const TTstring *str) {
+ if (_concept1P)
+ delete _concept1P;
+ _concept1P = nullptr;
if (str) {
TTword word(*str, WC_UNKNOWN, 0);
- _conceptObject = new TTconcept(&word);
+ _concept1P = new TTconcept(&word);
}
}
diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h
index 73419fc73e..b8e62a586c 100644
--- a/engines/titanic/true_talk/script_handler.h
+++ b/engines/titanic/true_talk/script_handler.h
@@ -39,23 +39,16 @@ private:
CTitleEngine *_owner;
int _inputCtr;
private:
- /**
- * Sets the text for the actor concept
- */
- void setActor(const TTstring *str);
-
- /**
- * Sets the text for the onject concept
- */
- void setObject(const TTstring *str);
+ void handleWord1(const TTstring *str);
+ void handleWord2(const TTstring *str);
public:
TTparser _parser;
TTvocab *_vocab;
TTscriptBase *_script;
- TTconcept *_conceptObject;
- TTconcept *_conceptActor;
- TTconcept *_conceptUnused;
- TTconcept *_conceptVerb;
+ TTconcept *_concept1P;
+ TTconcept *_concept2P;
+ TTconcept *_concept3P;
+ TTconcept *_concept4P;
public:
CScriptHandler(CTitleEngine *owner, int val1, int val2);
~CScriptHandler();
@@ -66,10 +59,6 @@ public:
ScriptChangedResult scriptChanged(TTroomScript *roomScript,
TTnpcScript *npcScript, uint dialogueId);
- /**
- * Main processing and handling for text lines entered into the
- * Conversation tab of the PET
- */
int processInput(TTroomScript *roomScript, TTnpcScript *npcScript,
const TTstring &line);
@@ -88,10 +77,7 @@ public:
*/
int setResponse(TTscriptBase *script, TTresponse *response);
- /**
- * Sets the concepts for both actor and object to the specified text
- */
- void setActorObject(const TTstring *str);
+ void handleWord(const TTstring *str);
};
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_concept_node.cpp b/engines/titanic/true_talk/tt_concept_node.cpp
index 3736418fb6..4573516a58 100644
--- a/engines/titanic/true_talk/tt_concept_node.cpp
+++ b/engines/titanic/true_talk/tt_concept_node.cpp
@@ -79,18 +79,18 @@ TTconcept **TTconceptNode::setConcept(int conceptIndex, TTconcept *src) {
if (!isPronoun) {
switch (conceptIndex) {
case 0:
- delete scrHandler._conceptActor;
- scrHandler._conceptActor = new TTconcept(*src);
+ delete scrHandler._concept2P;
+ scrHandler._concept2P = new TTconcept(*src);
break;
case 1:
- delete scrHandler._conceptVerb;
- scrHandler._conceptVerb = new TTconcept(*src);
+ delete scrHandler._concept4P;
+ scrHandler._concept4P = new TTconcept(*src);
break;
case 2:
- delete scrHandler._conceptObject;
- scrHandler._conceptObject = new TTconcept(*src);
+ delete scrHandler._concept1P;
+ scrHandler._concept1P = new TTconcept(*src);
break;
default:
diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp
index b1173276bb..ba205b6498 100644
--- a/engines/titanic/true_talk/tt_npc_script.cpp
+++ b/engines/titanic/true_talk/tt_npc_script.cpp
@@ -262,12 +262,12 @@ bool TTnpcScript::handleWord(uint id) const {
const TTwordEntry &we = _words[idx];
if (we._id == id) {
TTstring str(we._text);
- g_vm->_scriptHandler->setActorObject(&str);
+ g_vm->_scriptHandler->handleWord(&str);
return true;
}
}
- g_vm->_scriptHandler->setActorObject(nullptr);
+ g_vm->_scriptHandler->handleWord(nullptr);
return true;
}
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp
index dd786db34c..88a5ec3614 100644
--- a/engines/titanic/true_talk/tt_parser.cpp
+++ b/engines/titanic/true_talk/tt_parser.cpp
@@ -765,13 +765,13 @@ int TTparser::considerRequests(TTword *word) {
case SEEK_ACTOR:
case MKTAG('S', 'A', 'C', 'T'):
if (!_sentenceConcept->_concept0P) {
- flag = applyConcepts(5, 0);
+ flag = filterConcepts(5, 0);
} else if (_sentenceConcept->_concept0P->compareTo("?") &&
_sentenceConcept->_concept1P->isWordId(113) &&
word->_wordClass == WC_THING) {
TTconcept *oldConcept = _sentenceConcept->_concept0P;
_sentenceConcept->_concept0P = nullptr;
- flag = applyConcepts(5, 2);
+ flag = filterConcepts(5, 2);
if (flag)
delete oldConcept;
} else {
@@ -783,11 +783,11 @@ int TTparser::considerRequests(TTword *word) {
if (_sentenceConcept->_concept2P && _sentenceConcept->_concept2P->compareTo(word)) {
flag = true;
} else if (!_sentenceConcept->_concept2P) {
- if (applyConcepts(5, 2) && _sentenceConcept->_concept2P->checkWordId1())
+ if (filterConcepts(5, 2) && _sentenceConcept->_concept2P->checkWordId1())
addNode(SEEK_OBJECT);
} else if (word->_wordClass == WC_THING && _sentence->fn2(2, TTstring("?"), _sentenceConcept)) {
TTconcept *oldConcept = _sentenceConcept->_concept2P;
- flag = applyConcepts(5, 2);
+ flag = filterConcepts(5, 2);
_sentenceConcept->_concept2P->_field20 = oldConcept->get20();
if (flag)
delete oldConcept;
@@ -807,7 +807,7 @@ int TTparser::considerRequests(TTword *word) {
if (!status && !_sentenceConcept->_concept4P && _sentenceConcept->_concept0P) {
TTconcept *oldConcept = _sentenceConcept->_concept2P;
- flag = applyConcepts(5, 2);
+ flag = filterConcepts(5, 2);
_sentenceConcept->_concept2P->_field20 = oldConcept->get20();
if (flag)
delete oldConcept;
@@ -824,7 +824,7 @@ int TTparser::considerRequests(TTword *word) {
_sentenceConcept->_concept3P = _sentenceConcept->_concept2P;
_sentenceConcept->_concept2P = nullptr;
- flag = applyConcepts(5, 2);
+ flag = filterConcepts(5, 2);
if (!flag) {
status = _sentenceConcept->createConcept(0, 2, word);
}
@@ -833,8 +833,8 @@ int TTparser::considerRequests(TTword *word) {
case SEEK_TO:
if (!_sentenceConcept->_concept3P) {
- if (!applyConcepts(8, 3))
- flag = applyConcepts(3, 3);
+ if (!filterConcepts(8, 3))
+ flag = filterConcepts(3, 3);
} else {
flag = true;
}
@@ -842,8 +842,8 @@ int TTparser::considerRequests(TTword *word) {
case SEEK_FROM:
if (!_sentenceConcept->_concept4P) {
- if (!applyConcepts(8, 4))
- flag = applyConcepts(3, 3);
+ if (!filterConcepts(8, 4))
+ flag = filterConcepts(3, 3);
} else {
flag = true;
}
@@ -906,14 +906,14 @@ int TTparser::considerRequests(TTword *word) {
_sentenceConcept->_concept5P->findByWordId(904)) {
TTconcept *oldConcept = _sentenceConcept->_concept5P;
_sentenceConcept->_concept5P = nullptr;
- flag = applyConcepts(9, 5);
+ flag = filterConcepts(9, 5);
if (flag)
delete oldConcept;
} else {
flag = true;
}
} else {
- flag = applyConcepts(9, 5);
+ flag = filterConcepts(9, 5);
if (!flag && word->_wordClass == WC_ADVERB) {
status = _sentenceConcept->createConcept(1, 5, word);
flag = true;
@@ -1471,7 +1471,7 @@ int TTparser::checkForAction() {
if (!_sentenceConcept->_concept0P && !_sentenceConcept->_concept1P &&
!_sentenceConcept->_concept2P && !_sentenceConcept->_concept5P && !flag) {
if (_conceptP)
- applyConcepts(5, 2);
+ filterConcepts(5, 2);
if (!_sentenceConcept->_concept2P && _sentence->_category == 1)
_sentence->_category = 0;
@@ -1508,7 +1508,7 @@ int TTparser::checkForAction() {
} else if (!_sentenceConcept->_concept0P && !_sentenceConcept->_concept1P &&
!_sentenceConcept->_concept2P && !_sentenceConcept->_concept5P) {
if (_conceptP)
- applyConcepts(5, 2);
+ filterConcepts(5, 2);
if (!_sentenceConcept->_concept2P && _sentence->_category == 1)
_sentence->_category = 0;
@@ -1597,7 +1597,7 @@ bool TTparser::checkConcept2(TTconcept *concept, int conceptMode) {
return false;
}
-int TTparser::applyConcepts(int conceptMode, int conceptIndex) {
+int TTparser::filterConcepts(int conceptMode, int conceptIndex) {
int result = 0;
for (TTconcept *currP = _conceptP; currP && !result; currP = currP->_nextP) {
diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h
index d5e2d3a630..458a719e1f 100644
--- a/engines/titanic/true_talk/tt_parser.h
+++ b/engines/titanic/true_talk/tt_parser.h
@@ -174,7 +174,7 @@ private:
int checkForAction();
int fn2(TTword *word);
bool checkConcept2(TTconcept *concept, int conceptMode);
- int applyConcepts(int conceptMode, int conceptIndex);
+ int filterConcepts(int conceptMode, int conceptIndex);
bool resetConcept(TTconcept **conceptPP, int conceptIndex);
public:
CScriptHandler *_owner;
diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp
index 53062886b7..5a5bff7af8 100644
--- a/engines/titanic/true_talk/tt_sentence.cpp
+++ b/engines/titanic/true_talk/tt_sentence.cpp
@@ -195,24 +195,24 @@ bool TTsentence::fn2(int slotIndex, const TTstring &str, const TTconceptNode *no
return true;
}
- if (slotIndex == 1 && g_vm->_exeResources._owner->_conceptVerb) {
- if (str == g_vm->_exeResources._owner->_conceptVerb->getText() &&
+ if (slotIndex == 1 && g_vm->_exeResources._owner->_concept4P) {
+ if (str == g_vm->_exeResources._owner->_concept4P->getText() &&
conceptText == "do")
goto exit;
}
- if (g_vm->_exeResources._owner->_conceptActor && (slotIndex == 0 ||
+ if (g_vm->_exeResources._owner->_concept2P && (slotIndex == 0 ||
slotIndex == 3 || slotIndex == 4)) {
- if (str == g_vm->_exeResources._owner->_conceptActor->getText() &&
+ if (str == g_vm->_exeResources._owner->_concept2P->getText() &&
(conceptText == "it" || conceptText == "he" || conceptText == "she" ||
conceptText == "him" || conceptText == "her" || conceptText == "them" ||
conceptText == "they"))
goto exit;
}
- if (g_vm->_exeResources._owner->_conceptObject && (slotIndex == 0 ||
+ if (g_vm->_exeResources._owner->_concept1P && (slotIndex == 0 ||
slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5)) {
- if (str == g_vm->_exeResources._owner->_conceptObject->getText() &&
+ if (str == g_vm->_exeResources._owner->_concept1P->getText() &&
(conceptText == "it" || conceptText == "that" || conceptText == "he" ||
conceptText == "she" || conceptText == "him" || conceptText == "her" ||
conceptText == "them" || conceptText == "they" || conceptText == "those" ||
@@ -220,8 +220,8 @@ bool TTsentence::fn2(int slotIndex, const TTstring &str, const TTconceptNode *no
goto exit;
}
- if (g_vm->_exeResources._owner->_conceptObject && (slotIndex == 0 || slotIndex == 2)) {
- if (conceptText == "?" && str == g_vm->_exeResources._owner->_conceptObject->getText()) {
+ if (g_vm->_exeResources._owner->_concept1P && (slotIndex == 0 || slotIndex == 2)) {
+ if (conceptText == "?" && str == g_vm->_exeResources._owner->_concept1P->getText()) {
delete concept;
concept = getFrameSlot(5, node);
conceptText = concept->getText();
@@ -307,12 +307,12 @@ bool TTsentence::localWord(const char *str) const {
CScriptHandler &scriptHandler = *g_vm->_exeResources._owner;
bool foundMatch = false;
- if (scriptHandler._conceptObject) {
- TTstring s = scriptHandler._conceptObject->getText();
+ if (scriptHandler._concept1P) {
+ TTstring s = scriptHandler._concept1P->getText();
if (s == str)
foundMatch = true;
- } else if (scriptHandler._conceptActor) {
- TTstring s = scriptHandler._conceptActor->getText();
+ } else if (scriptHandler._concept2P) {
+ TTstring s = scriptHandler._concept2P->getText();
if (s == str)
foundMatch = true;
}