aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-06-23 23:18:30 -0400
committerPaul Gilbert2016-07-15 19:24:36 -0400
commitec5dcc17dc75a1b74a417676edf0c51048e19b6c (patch)
treeb5cb35f7f30d93722a9e1822e2e9fc71e7267bb7 /engines/titanic
parent934787b19be3aa86e02d77eea0a1a5ffa1771075 (diff)
downloadscummvm-rg350-ec5dcc17dc75a1b74a417676edf0c51048e19b6c.tar.gz
scummvm-rg350-ec5dcc17dc75a1b74a417676edf0c51048e19b6c.tar.bz2
scummvm-rg350-ec5dcc17dc75a1b74a417676edf0c51048e19b6c.zip
TITANIC: Added TTtalker methods
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/core/game_object.h10
-rw-r--r--engines/titanic/pet_control/pet_control.cpp2
-rw-r--r--engines/titanic/pet_control/pet_control.h21
-rw-r--r--engines/titanic/pet_control/pet_conversations.cpp11
-rw-r--r--engines/titanic/pet_control/pet_conversations.h10
-rw-r--r--engines/titanic/true_talk/tt_npc_script.cpp2
-rw-r--r--engines/titanic/true_talk/tt_talker.cpp17
-rw-r--r--engines/titanic/true_talk/tt_talker.h11
8 files changed, 70 insertions, 14 deletions
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index 059b705700..4b9fab98f7 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -328,11 +328,6 @@ protected:
* Clear the PET display
*/
void clearPet() const;
-
- /**
- * Returns the PET control
- */
- CPetControl *getPetControl() const;
/**
* Returns the MailMan
@@ -471,6 +466,11 @@ public:
* Returns true if the item is the PET control
*/
virtual bool isPet() const;
+
+ /**
+ * Returns the PET control
+ */
+ CPetControl *getPetControl() const;
/**
* Play the movie specified in _resource
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index 5de87cd04b..549ba728a8 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -521,7 +521,7 @@ CString CPetControl::getFullViewName() {
return gameManager ? gameManager->getFullViewName() : CString();
}
-void CPetControl::resetDials(int flag) {
+void CPetControl::convResetDials(int flag) {
if (flag == 1)
_conversations.resetDials(_activeNPCName);
}
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index 8093152089..fb5e0093da 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -312,16 +312,25 @@ public:
*/
CString getFullViewName();
- /**
- * Resets the dial display to reflect new values
- */
- void resetDials(int flag = 1);
-
bool getC0() const { return _fieldC0 > 0; }
void incC0() { ++_fieldC0; }
void decC0() { --_fieldC0; }
- /* CPetRooms methods */
+ /*--- CPetConversations methods ---*/
+
+ /**
+ * Resets the dial display in the conversation tab to reflect new values
+ */
+ void convResetDials(int flag = 1);
+
+ /**
+ * Adds a line to the conversation log
+ */
+ void convAddLine(const CString &line) {
+ _conversations.addLine(line);
+ }
+
+ /*--- CPetRooms methods ---*/
/**
* Gives the player a new assigned room in the specified passenger class
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp
index 4e2d905960..b1c3ef3763 100644
--- a/engines/titanic/pet_control/pet_conversations.cpp
+++ b/engines/titanic/pet_control/pet_conversations.cpp
@@ -239,6 +239,8 @@ void CPetConversations::save(SimpleFile *file, int indent) const {
}
void CPetConversations::enter(PetArea oldArea) {
+ resetDials();
+
if (_petControl && _petControl->_activeNPC)
// Start a timer for the NPC
startNPCTimer();
@@ -558,6 +560,10 @@ void CPetConversations::npcDialChange(uint dialNum, int oldLevel, int newLevel)
}
}
+void CPetConversations::resetDials() {
+ resetDials(getActiveNPCName());
+}
+
void CPetConversations::resetDials(const CString &name) {
TTnpcScript *script = getNPCScript(name);
@@ -569,4 +575,9 @@ void CPetConversations::resetDials(const CString &name) {
}
}
+void CPetConversations::addLine(const CString &line) {
+ _log.addLine(line);
+ scrollToBottom();
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h
index cefdf1b8f1..d6a3e252d1 100644
--- a/engines/titanic/pet_control/pet_conversations.h
+++ b/engines/titanic/pet_control/pet_conversations.h
@@ -238,9 +238,19 @@ public:
virtual void hideCursor();
/**
+ * Resets the dials with the data for the currently active NPC
+ */
+ void resetDials();
+
+ /**
* Reset the dials with those for a given NPC
*/
void resetDials(const CString &name);
+
+ /**
+ * Adds a line to the log
+ */
+ void addLine(const CString &line);
};
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp
index 1ee5785907..8289b53504 100644
--- a/engines/titanic/true_talk/tt_npc_script.cpp
+++ b/engines/titanic/true_talk/tt_npc_script.cpp
@@ -464,7 +464,7 @@ void TTnpcScript::setDial(int dialNum, int value) {
if (g_vm->_trueTalkManager) {
CPetControl *petControl = getPetControl(g_vm->_trueTalkManager->getGameManager());
if (petControl)
- petControl->resetDials();
+ petControl->convResetDials();
}
}
diff --git a/engines/titanic/true_talk/tt_talker.cpp b/engines/titanic/true_talk/tt_talker.cpp
index 1eb7fc8b2e..61443a4835 100644
--- a/engines/titanic/true_talk/tt_talker.cpp
+++ b/engines/titanic/true_talk/tt_talker.cpp
@@ -22,6 +22,7 @@
#include "titanic/true_talk/tt_talker.h"
#include "titanic/messages/messages.h"
+#include "titanic/pet_control/pet_control.h"
namespace Titanic {
@@ -32,4 +33,20 @@ void TTtalker::speechStarted(const CString &dialogueStr, uint dialogueId, uint s
msg.execute(_npc, nullptr, MSGFLAG_BREAK_IF_HANDLED);
}
+TTtalker::~TTtalker() {
+ CPetControl *petControl = _npc->getPetControl();
+ if (petControl)
+ // Add in final line
+ petControl->convAddLine(_line);
+
+ // Notify the end of the speech
+ CTrueTalkNotifySpeechEndedMsg endedMsg(_field24, _dialogueId);
+ endedMsg.execute(_npc, nullptr, MSGFLAG_BREAK_IF_HANDLED);
+}
+
+void TTtalker::endSpeech(int val) {
+ _done = true;
+ _field24 = val;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_talker.h b/engines/titanic/true_talk/tt_talker.h
index 9bb59fbe64..636eb0c022 100644
--- a/engines/titanic/true_talk/tt_talker.h
+++ b/engines/titanic/true_talk/tt_talker.h
@@ -35,7 +35,7 @@ class TTtalker : public ListItem {
public:
CTrueTalkManager *_owner;
CTrueTalkNPC *_npc;
- CString _string1;
+ CString _line;
int _dialogueId;
int _field24;
int _done;
@@ -44,8 +44,17 @@ public:
_dialogueId(0), _field24(0), _done(0) {}
TTtalker(CTrueTalkManager *owner, CTrueTalkNPC *npc) :
_owner(owner), _npc(npc), _dialogueId(0), _field24(0), _done(0) {}
+ ~TTtalker();
+ /**
+ * Start a new speech
+ */
void speechStarted(const CString &dialogueStr, uint dialogueId, uint soundId);
+
+ /**
+ * End the speech
+ */
+ void endSpeech(int val);
};
class TTtalkerList : public List<TTtalker> {