aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/true_talk
diff options
context:
space:
mode:
authorPaul Gilbert2016-05-06 21:27:50 -0400
committerPaul Gilbert2016-07-10 16:38:36 -0400
commit1e42f6ffed4c1d187863b548c708b42d611aab0e (patch)
tree0418e2f57b2713940968c8c7940754cd0709c552 /engines/titanic/true_talk
parent7396781cd44c2ec340308e5ad9de9cefc0ef3eeb (diff)
downloadscummvm-rg350-1e42f6ffed4c1d187863b548c708b42d611aab0e.tar.gz
scummvm-rg350-1e42f6ffed4c1d187863b548c708b42d611aab0e.tar.bz2
scummvm-rg350-1e42f6ffed4c1d187863b548c708b42d611aab0e.zip
TITANIC: Beginnings of input line processing
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r--engines/titanic/true_talk/script_handler.cpp6
-rw-r--r--engines/titanic/true_talk/script_handler.h4
-rw-r--r--engines/titanic/true_talk/title_engine.cpp4
-rw-r--r--engines/titanic/true_talk/title_engine.h3
-rw-r--r--engines/titanic/true_talk/true_talk_manager.cpp22
-rw-r--r--engines/titanic/true_talk/true_talk_manager.h9
-rw-r--r--engines/titanic/true_talk/tt_string.h1
7 files changed, 45 insertions, 4 deletions
diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp
index de101214bf..eb7979e1e5 100644
--- a/engines/titanic/true_talk/script_handler.cpp
+++ b/engines/titanic/true_talk/script_handler.cpp
@@ -30,8 +30,12 @@ CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) {
}
void CScriptHandler::setup(TTNamedScript *npcScript, TTRoomScript *roomScript, uint charId) {
-
+ // TODO
}
+void CScriptHandler::processInput(TTNamedScript *npcScript, TTRoomScript *roomScript,
+ const TTString &line) {
+ // TODO
+}
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h
index 69c1c9486a..1959468ed0 100644
--- a/engines/titanic/true_talk/script_handler.h
+++ b/engines/titanic/true_talk/script_handler.h
@@ -25,6 +25,7 @@
#include "titanic/true_talk/tt_named_script.h"
#include "titanic/true_talk/tt_room_script.h"
+#include "titanic/true_talk/tt_string.h"
namespace Titanic {
@@ -40,6 +41,9 @@ public:
* Set the character and room
*/
void setup(TTNamedScript *npcScript, TTRoomScript *roomScript, uint charId);
+
+ void processInput(TTNamedScript *npcScript, TTRoomScript *roomScript,
+ const TTString &line);
};
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/title_engine.cpp b/engines/titanic/true_talk/title_engine.cpp
index d5015b430c..528c4b12b0 100644
--- a/engines/titanic/true_talk/title_engine.cpp
+++ b/engines/titanic/true_talk/title_engine.cpp
@@ -24,12 +24,12 @@
namespace Titanic {
-CTitleEngine::CTitleEngine() : _script(nullptr), _handler(nullptr) {
+CTitleEngine::CTitleEngine() : _script(nullptr), _scriptHandler(nullptr) {
}
CTitleEngine::~CTitleEngine() {
delete _script;
- delete _handler;
+ delete _scriptHandler;
}
void CTitleEngine::setup(int val1, int val2) {
diff --git a/engines/titanic/true_talk/title_engine.h b/engines/titanic/true_talk/title_engine.h
index 8d32067616..e9bc6249eb 100644
--- a/engines/titanic/true_talk/title_engine.h
+++ b/engines/titanic/true_talk/title_engine.h
@@ -33,9 +33,10 @@ namespace Titanic {
class CTitleEngine {
protected:
- CScriptHandler *_handler;
TTScriptBase *_script;
public:
+ CScriptHandler *_scriptHandler;
+public:
CTitleEngine();
~CTitleEngine();
diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp
index 091e3f8e48..dc93bf438b 100644
--- a/engines/titanic/true_talk/true_talk_manager.cpp
+++ b/engines/titanic/true_talk/true_talk_manager.cpp
@@ -286,4 +286,26 @@ void CTrueTalkManager::loadAssets(CTrueTalkNPC *npc, int charId) {
}
}
+void CTrueTalkManager::processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CViewItem *view) {
+ TTNamedScript *npcScript = getNpcScript(npc);
+ TTRoomScript *roomScript = getRoomScript();
+ _titleEngine.reset();
+
+ if (npcScript && roomScript) {
+ _currentNPC = npc;
+ _titleEngine._scriptHandler->processInput(npcScript, roomScript,
+ TTString(msg->_input));
+ _currentNPC = nullptr;
+
+ loadAssets(npc, npcScript->charId());
+ setView(npcScript, roomScript, view);
+ }
+
+ _currentNPC = nullptr;
+}
+
+void CTrueTalkManager::setView(TTNamedScript *npcScript, TTRoomScript *roomScript, CViewItem *view) {
+ warning("TODO: CTrueTalkManager::setView");
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h
index d2bba4b4ba..3c24ade6cb 100644
--- a/engines/titanic/true_talk/true_talk_manager.h
+++ b/engines/titanic/true_talk/true_talk_manager.h
@@ -23,6 +23,7 @@
#ifndef TITANIC_TRUE_TALK_MANAGER_H
#define TITANIC_TRUE_TALK_MANAGER_H
+#include "titanic/messages/messages.h"
#include "titanic/support/simple_file.h"
#include "titanic/true_talk/dialogue_file.h"
#include "titanic/true_talk/title_engine.h"
@@ -32,6 +33,7 @@ namespace Titanic {
class CGameManager;
class CTreeItem;
+class CViewItem;
class CTrueTalkNPC;
class CTrueTalkManager {
@@ -77,6 +79,8 @@ private:
* Loads assets for the current character, if it's changed
*/
void loadAssets(CTrueTalkNPC *npc, int charId);
+
+ void setView(TTNamedScript *npcScript, TTRoomScript *roomScript, CViewItem *view);
public:
static int _v1;
static int _v2;
@@ -149,6 +153,11 @@ public:
* Return a TrueTalk talker/script
*/
TTNamedScript *getTalker(const CString &name) const;
+
+ /**
+ * Process player's input
+ */
+ void processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CViewItem *view);
};
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h
index 60fdde0ff5..d593553f5c 100644
--- a/engines/titanic/true_talk/tt_string.h
+++ b/engines/titanic/true_talk/tt_string.h
@@ -33,6 +33,7 @@ public:
public:
TTString() : CString(), _status(0) {}
TTString(const char *str) : CString(str), _status(0) {}
+ TTString(const CString &str) : CString(str), _status(0) {}
virtual ~TTString() {}
bool isValid() const { return !_status; }