diff options
author | Paul Gilbert | 2016-04-29 20:02:20 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:37:34 -0400 |
commit | e47494a4894301cf4034c6aad4abd65f45b38eca (patch) | |
tree | 8d75cdb1ca2ff8cd2f0d4d7c09b5310f137f7b35 /engines/titanic/pet_control | |
parent | d6b84cd9e16ac584c5b57b1b94e1d071c30060ce (diff) | |
download | scummvm-rg350-e47494a4894301cf4034c6aad4abd65f45b38eca.tar.gz scummvm-rg350-e47494a4894301cf4034c6aad4abd65f45b38eca.tar.bz2 scummvm-rg350-e47494a4894301cf4034c6aad4abd65f45b38eca.zip |
TITANIC: Implement TrueTalk script retrieval
Diffstat (limited to 'engines/titanic/pet_control')
-rw-r--r-- | engines/titanic/pet_control/pet_conversations.cpp | 21 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_conversations.h | 13 |
2 files changed, 33 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(); |