aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/pet_control/pet_conversations.cpp21
-rw-r--r--engines/titanic/pet_control/pet_conversations.h13
-rw-r--r--engines/titanic/true_talk/true_talk_manager.cpp23
-rw-r--r--engines/titanic/true_talk/true_talk_manager.h5
4 files changed, 61 insertions, 1 deletions
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp
index 7596e65961..988df5de33 100644
--- a/engines/titanic/pet_control/pet_conversations.cpp
+++ b/engines/titanic/pet_control/pet_conversations.cpp
@@ -22,6 +22,7 @@
#include "titanic/pet_control/pet_conversations.h"
#include "titanic/pet_control/pet_control.h"
+#include "titanic/game_manager.h"
namespace Titanic {
@@ -243,6 +244,19 @@ void CPetConversations::stopNPCTimer() {
_petControl->stopPetTimer(1);
}
+TTNamedScript *CPetConversations::getNPCScript(const CString &name) const {
+ if (name.empty() || !_petControl)
+ return nullptr;
+ CGameManager *gameManager = _petControl->getGameManager();
+ if (!gameManager)
+ return nullptr;
+ CTrueTalkManager *trueTalk = gameManager->getTalkManager();
+ if (!trueTalk)
+ return nullptr;
+
+ return trueTalk->getTalker(name);
+}
+
bool CPetConversations::handleKey(const Common::KeyState &keyState) {
switch (keyState.keycode) {
case Common::KEYCODE_UP:
@@ -307,4 +321,11 @@ void CPetConversations::textLineEntered(const CString &textLine) {
scrollToBottom();
}
+CString CPetConversations::getActiveNPCName() const {
+ if (_petControl && _petControl->_activeNPC)
+ return _petControl->_activeNPC->getName();
+ else
+ return CString();
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h
index c7fb207615..c3eefa9e69 100644
--- a/engines/titanic/pet_control/pet_conversations.h
+++ b/engines/titanic/pet_control/pet_conversations.h
@@ -26,6 +26,7 @@
#include "titanic/pet_control/pet_section.h"
#include "titanic/pet_control/pet_text.h"
#include "titanic/pet_control/pet_gfx_element.h"
+#include "titanic/true_talk/true_talk_manager.h"
namespace Titanic {
@@ -49,7 +50,7 @@ private:
int _valArray3[3];
bool _logScrolled;
int _field418;
- CString _string1;
+ CString _npcName;
private:
/**
* Sets up the control
@@ -107,6 +108,11 @@ private:
void stopNPCTimer();
/**
+ * Get the TrueTalk script associated with a given NPC
+ */
+ TTNamedScript *getNPCScript(const CString &name) const;
+
+ /**
* Handle a keypress
*/
bool handleKey(const Common::KeyState &keyState);
@@ -115,6 +121,11 @@ private:
* Handles an entered text line
*/
void textLineEntered(const CString &textLine);
+
+ /**
+ * Returns the name of the currently active NPC, if any
+ */
+ CString getActiveNPCName() const;
public:
CPetConversations();
diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp
index 03f8ac5b3e..b97b51931c 100644
--- a/engines/titanic/true_talk/true_talk_manager.cpp
+++ b/engines/titanic/true_talk/true_talk_manager.cpp
@@ -195,4 +195,27 @@ void CTrueTalkManager::fn1(CTreeItem *item, int val2, int val3) {
warning("CTrueTalkManager::fn1");
}
+TTNamedScript *CTrueTalkManager::getTalker(const CString &name) {
+ if (name.contains("Doorbot"))
+ return _scripts.getNamedScript(104);
+ else if (name.contains("DeskBot"))
+ return _scripts.getNamedScript(103);
+ else if (name.contains("LiftBot"))
+ return _scripts.getNamedScript(105);
+ else if (name.contains("Parrot"))
+ return _scripts.getNamedScript(107);
+ else if (name.contains("BarBot"))
+ return _scripts.getNamedScript(100);
+ else if (name.contains("ChatterBot"))
+ return _scripts.getNamedScript(102);
+ else if (name.contains("BellBot"))
+ return _scripts.getNamedScript(101);
+ else if (name.contains("MaitreD"))
+ return _scripts.getNamedScript(112);
+ else if (name.contains("Succubus") || name.contains("Sub"))
+ return _scripts.getNamedScript(111);
+
+ return nullptr;
+}
+
} // 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 2e366a6a35..9da1c06242 100644
--- a/engines/titanic/true_talk/true_talk_manager.h
+++ b/engines/titanic/true_talk/true_talk_manager.h
@@ -113,6 +113,11 @@ public:
void update2();
void fn1(CTreeItem *item, int val2, int val3);
+
+ /**
+ * Return a TrueTalk talker/script
+ */
+ TTNamedScript *getTalker(const CString &name);
};
} // End of namespace Titanic