diff options
author | Paul Gilbert | 2016-05-29 22:35:34 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:17:09 -0400 |
commit | 9f6a3d36f7778c5e530c03063b856212b4805ab9 (patch) | |
tree | c1c69bfac3f5d47af252502629e9bf98567d3e75 /engines/titanic/true_talk | |
parent | 4ee0ced047ddef1994879e23cb6a2bb160933c1c (diff) | |
download | scummvm-rg350-9f6a3d36f7778c5e530c03063b856212b4805ab9.tar.gz scummvm-rg350-9f6a3d36f7778c5e530c03063b856212b4805ab9.tar.bz2 scummvm-rg350-9f6a3d36f7778c5e530c03063b856212b4805ab9.zip |
TITANIC: Further fleshing out of TTscriptBase
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r-- | engines/titanic/true_talk/script_handler.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/true_talk/script_handler.h | 5 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_response.h | 7 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_script_base.cpp | 32 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_script_base.h | 15 |
5 files changed, 42 insertions, 21 deletions
diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index bfd7cdfdfc..b689aba031 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -112,4 +112,8 @@ void CScriptHandler::setParserConcept(TTconcept *newConcept, TTconcept *oldConce _parser.conceptChanged(newConcept, oldConcept); } +int CScriptHandler::setResponse(TTscriptBase *script, TTresponse *response) { + return _owner->setResponse(script, response); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 1c0824869c..10699f1157 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -85,6 +85,11 @@ public: * Called when concept data is copied from one to another */ void setParserConcept(TTconcept *newConcept, TTconcept *oldConcept); + + /** + * Sets a conversation reponse + */ + int setResponse(TTscriptBase *script, TTresponse *response); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_response.h b/engines/titanic/true_talk/tt_response.h index 38f7ec70a8..d39d18c193 100644 --- a/engines/titanic/true_talk/tt_response.h +++ b/engines/titanic/true_talk/tt_response.h @@ -35,14 +35,17 @@ private: int _dialogueId; TTresponse *_nextP; TTresponse *_linkP; - - TTresponse *copyChain() const; public: TTresponse(const TTstring &src); TTresponse(int val1, int val2); TTresponse(const TTresponse *src); virtual ~TTresponse(); + /** + * Makes a copy of the chain of responses + */ + TTresponse *copyChain() const; + TTresponse *getLink() const { return _linkP; } void addLink(TTresponse *item); diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index 25c0b781bd..218c86deb3 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -22,6 +22,7 @@ #include "common/textconsole.h" #include "titanic/true_talk/tt_script_base.h" +#include "titanic/titanic.h" namespace Titanic { @@ -31,7 +32,7 @@ TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int v2, _nodesP(nullptr), _id(0), _hist1P(nullptr), _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0), _field34(0), _hist2P(nullptr), _field3C(0), - _respHeadP(nullptr), _respTailP(nullptr), _responseP(nullptr) { + _respHeadP(nullptr), _respTailP(nullptr), _oldResponseP(nullptr) { if (!isValid()) { if (!v7 || !getStatus()) { _id = scriptId; @@ -52,7 +53,7 @@ TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int v2, TTscriptBase::~TTscriptBase() { deleteResponses(); - delete _responseP; + delete _oldResponseP; delete _hist1P; delete _hist2P; @@ -83,7 +84,7 @@ void TTscriptBase::reset() { _field3C = 0; _respHeadP = nullptr; _respTailP = nullptr; - _responseP = nullptr; + _oldResponseP = nullptr; } int TTscriptBase::preprocess(TTsentence *sentence) { @@ -93,20 +94,27 @@ int TTscriptBase::preprocess(TTsentence *sentence) { return _hist1P ? SS_VALID : SS_7; } -void TTscriptBase::proc2(int v) { - warning("TODO"); +void TTscriptBase::addResponse(const TTstring &str) { + appendResponse2(-1, nullptr, str); } -void TTscriptBase::proc3(int v) { - warning("TODO"); +void TTscriptBase::addResponse(int val) { + appendResponse(-1, nullptr, val); } -void TTscriptBase::proc4(int v) { - warning("TODO"); -} +void TTscriptBase::applyResponse() { + delete _oldResponseP; + _oldResponseP = nullptr; + + if (_respHeadP) { + g_vm->_scriptHandler->setResponse(this, _respHeadP); + _oldResponseP = _respHeadP->copyChain(); + TTresponse *oldRespP = _respHeadP; + _respHeadP = _respHeadP->getLink(); + _respTailP = nullptr; -void TTscriptBase::proc5() { - warning("TODO"); + delete oldRespP; + } } void TTscriptBase::deleteResponses() { diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index 1baff891bb..8387d24dbd 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -53,7 +53,7 @@ protected: int _field3C; TTresponse *_respHeadP; TTresponse *_respTailP; - TTresponse *_responseP; + TTresponse *_oldResponseP; int _status; protected: /** @@ -78,14 +78,15 @@ public: int v3, int v4, int v5, int v6, int v7); virtual ~TTscriptBase(); - virtual void proc2(int v); + virtual void addResponse(const TTstring &str); - virtual void proc3(int v); - - virtual void proc4(int v); - - virtual void proc5(); + virtual void addResponse(int val); + /** + * Passes on the list of dialogue Ids stored in the response(s) + * to the title engine for later display in the PET + */ + virtual void applyResponse(); /** * Returns true if the script is in a valid state |