aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/true_talk
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r--engines/titanic/true_talk/true_talk_manager.cpp14
-rw-r--r--engines/titanic/true_talk/true_talk_manager.h14
2 files changed, 26 insertions, 2 deletions
diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp
index 827cda99ec..a07f7fa242 100644
--- a/engines/titanic/true_talk/true_talk_manager.cpp
+++ b/engines/titanic/true_talk/true_talk_manager.cpp
@@ -192,7 +192,7 @@ void CTrueTalkManager::update2() {
//warning("CTrueTalkManager::update2");
}
-void CTrueTalkManager::fn1(CTreeItem *npc, int val2, int val3) {
+void CTrueTalkManager::fn1(CGameObject *npc, int val2, int val3) {
warning("CTrueTalkManager::fn1");
}
@@ -219,4 +219,16 @@ TTNamedScript *CTrueTalkManager::getTalker(const CString &name) {
return nullptr;
}
+TTNamedScript *CTrueTalkManager::getNpcScript(CGameObject *npc) {
+ CString npcName = npc->getName();
+ TTNamedScript *script = getTalker(npcName);
+
+ if (!script) {
+ // Fall back on the default NPC script
+ script = _scripts.getNamedScript(101);
+ }
+
+ return script;
+}
+
} // 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 8d2ea65667..5d5f67958d 100644
--- a/engines/titanic/true_talk/true_talk_manager.h
+++ b/engines/titanic/true_talk/true_talk_manager.h
@@ -31,6 +31,7 @@ namespace Titanic {
class CGameManager;
class CTreeItem;
+class CGameObject;
class CTrueTalkManager {
private:
@@ -48,9 +49,20 @@ private:
*/
static void saveStatics(SimpleFile *file);
+ /**
+ * Loads an NPC from file
+ */
void loadNPC(SimpleFile *file, int charId);
+ /**
+ * Saves the specified NPC to file
+ */
void saveNPC(SimpleFile *file, int charId) const;
+
+ /**
+ * Gets the script associated with an NPC game object
+ */
+ TTNamedScript *getNpcScript(CGameObject *npc);
public:
static int _v1;
static int _v2;
@@ -112,7 +124,7 @@ public:
void update2();
- void fn1(CTreeItem *npc, int val2, int val3);
+ void fn1(CGameObject *npc, int val2, int val3);
/**
* Return a TrueTalk talker/script