aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-05-04 23:17:08 -0400
committerPaul Gilbert2016-07-10 16:38:24 -0400
commit308926ba87c76dc3151c4ae3428a71656cdbdad2 (patch)
treec88509124f3945a603e62e797b8253ddb2bf5fba /engines
parent07cbf78fe119058b196127827638ab0d8bc71b7e (diff)
downloadscummvm-rg350-308926ba87c76dc3151c4ae3428a71656cdbdad2.tar.gz
scummvm-rg350-308926ba87c76dc3151c4ae3428a71656cdbdad2.tar.bz2
scummvm-rg350-308926ba87c76dc3151c4ae3428a71656cdbdad2.zip
TITANIC: Implementing getting TrueTalk room scripts
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/core/room_item.cpp55
-rw-r--r--engines/titanic/core/room_item.h5
-rw-r--r--engines/titanic/true_talk/true_talk_manager.cpp21
-rw-r--r--engines/titanic/true_talk/true_talk_manager.h9
4 files changed, 86 insertions, 4 deletions
diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp
index 7a6dfd968a..6dab983087 100644
--- a/engines/titanic/core/room_item.cpp
+++ b/engines/titanic/core/room_item.cpp
@@ -115,4 +115,59 @@ void CRoomItem::calcNodePosition(const Point &nodePos, double &xVal, double &yVa
}
}
+int CRoomItem::getScriptId() const {
+ CString name = getName();
+ if (name == "1stClassLobby")
+ return 130;
+ else if (name == "1stClassRestaurant")
+ return 132;
+ else if (name == "1stClassState")
+ return 131;
+ else if (name == "2ndClassLobby")
+ return 128;
+ else if (name == "Bar")
+ return 112;
+ else if (name == "BottomOfWell")
+ return 108;
+ else if (name == "Bridge")
+ return 121;
+ else if (name == "Dome")
+ return 122;
+ else if (name == "Home")
+ return 100;
+ else if (name == "Lift")
+ return 103;
+ else if (name == "MusicRoom")
+ return 117;
+ else if (name == "MusicRoomLobby")
+ return 118;
+ else if (name == "ParrotLobby")
+ return 111;
+ else if (name == "Pellerator")
+ return 104;
+ else if (name == "PromenadeDeck")
+ return 114;
+ else if (name == "SculptureChamber")
+ return 116;
+ else if (name == "secClassState")
+ return 129;
+ else if (name == "ServiceElevator")
+ return 102;
+ else if (name == "SGTLeisure")
+ return 125;
+ else if (name == "SGTLittleLift")
+ return 105;
+ else if (name == "SgtLobby")
+ return 124;
+ else if (name == "SGTState")
+ return 126;
+ else if (name == "Titania")
+ return 123;
+ else if (name == "TopOfWell")
+ return 107;
+
+ // TODO
+ return 0;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h
index f14c3ae32b..519accd79c 100644
--- a/engines/titanic/core/room_item.h
+++ b/engines/titanic/core/room_item.h
@@ -64,6 +64,11 @@ public:
* Calculates the positioning of a node within the overall room
*/
void calcNodePosition(const Point &nodePos, double &xVal, double &yVal) const;
+
+ /**
+ * Get the TrueTalk script Id associated with the room
+ */
+ int getScriptId() const;
};
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp
index a07f7fa242..805ebd368d 100644
--- a/engines/titanic/true_talk/true_talk_manager.cpp
+++ b/engines/titanic/true_talk/true_talk_manager.cpp
@@ -196,7 +196,7 @@ void CTrueTalkManager::fn1(CGameObject *npc, int val2, int val3) {
warning("CTrueTalkManager::fn1");
}
-TTNamedScript *CTrueTalkManager::getTalker(const CString &name) {
+TTNamedScript *CTrueTalkManager::getTalker(const CString &name) const {
if (name.contains("Doorbot"))
return _scripts.getNamedScript(104);
else if (name.contains("DeskBot"))
@@ -219,7 +219,7 @@ TTNamedScript *CTrueTalkManager::getTalker(const CString &name) {
return nullptr;
}
-TTNamedScript *CTrueTalkManager::getNpcScript(CGameObject *npc) {
+TTNamedScript *CTrueTalkManager::getNpcScript(CGameObject *npc) const {
CString npcName = npc->getName();
TTNamedScript *script = getTalker(npcName);
@@ -231,4 +231,21 @@ TTNamedScript *CTrueTalkManager::getNpcScript(CGameObject *npc) {
return script;
}
+TTUnnamedScript *CTrueTalkManager::getRoomScript() const {
+ CRoomItem *room = _gameManager->getRoom();
+ TTUnnamedScript *script = nullptr;
+ if (room) {
+ int scriptId = room->getScriptId();
+ if (scriptId)
+ script = _scripts.getUnnamedScript(scriptId);
+ }
+
+ if (!script) {
+ // Fall back on the default Room script
+ script = _scripts.getUnnamedScript(110);
+ }
+
+ 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 5d5f67958d..ae740cb9f1 100644
--- a/engines/titanic/true_talk/true_talk_manager.h
+++ b/engines/titanic/true_talk/true_talk_manager.h
@@ -62,7 +62,12 @@ private:
/**
* Gets the script associated with an NPC game object
*/
- TTNamedScript *getNpcScript(CGameObject *npc);
+ TTNamedScript *getNpcScript(CGameObject *npc) const;
+
+ /**
+ * Gets the script associated with the current room
+ */
+ TTUnnamedScript *getRoomScript() const;
public:
static int _v1;
static int _v2;
@@ -129,7 +134,7 @@ public:
/**
* Return a TrueTalk talker/script
*/
- TTNamedScript *getTalker(const CString &name);
+ TTNamedScript *getTalker(const CString &name) const;
};
} // End of namespace Titanic