diff options
author | Paul Gilbert | 2016-05-07 18:41:13 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:38:43 -0400 |
commit | b480a2f53e3a48a0e741f86e59cc141f8325c958 (patch) | |
tree | 36a1391e9f0ea0fe17cc92e2b7b698a644afec37 /engines/titanic/true_talk | |
parent | 339df8657e883ba62bd5c4c474ab920dfa3d19c8 (diff) | |
download | scummvm-rg350-b480a2f53e3a48a0e741f86e59cc141f8325c958.tar.gz scummvm-rg350-b480a2f53e3a48a0e741f86e59cc141f8325c958.tar.bz2 scummvm-rg350-b480a2f53e3a48a0e741f86e59cc141f8325c958.zip |
TITANIC: Implementing TTTalker
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r-- | engines/titanic/true_talk/true_talk_manager.cpp | 20 | ||||
-rw-r--r-- | engines/titanic/true_talk/true_talk_manager.h | 22 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_talker.cpp | 35 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_talker.h | 56 |
4 files changed, 107 insertions, 26 deletions
diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 9e7fb773e5..2f7828bc52 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -42,6 +42,8 @@ bool CTrueTalkManager::_v10; int CTrueTalkManager::_v11[41]; CTrueTalkNPC *CTrueTalkManager::_currentNPC; +/*------------------------------------------------------------------------*/ + CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner), _scripts(&_titleEngine), _currentCharId(0), _dialogueFile(nullptr), _dialogueId(0) { @@ -306,18 +308,18 @@ void CTrueTalkManager::processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CView void CTrueTalkManager::setDialogue(CTrueTalkNPC *npc, TTRoomScript *roomScript, CViewItem *view) { // Get the dialog text - CString dialogStr = readDialogueString(); - if (dialogStr.empty()) + CString dialogueStr = readDialogueString(); + if (dialogueStr.empty()) return; + int soundId = readDialogSound(); TTTalker *talker = new TTTalker(this, npc); _talkers.push_back(talker); - bool isParrot = npc->getName() == "parrot"; - - - - warning("TODO: CTrueTalkManager::setDialogue"); + bool isParrot = npc->getName().contains("parrot"); + triggerNPC(npc); + setTalker(talker, roomScript, view, isParrot); + talker->speechStarted(dialogueStr, _titleEngine._indexes[0], soundId); } #define STRING_BUFFER_SIZE 2048 @@ -406,4 +408,8 @@ void CTrueTalkManager::triggerNPC(CTrueTalkNPC *npc) { } } +void CTrueTalkManager::setTalker(TTTalker *talker, TTRoomScript *roomScript, CViewItem *view, bool isParrot) { + warning("TODO: CTrueTalkManager::setTalker"); +} + } // 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 c11c34f326..1f6bf1641d 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -28,6 +28,7 @@ #include "titanic/true_talk/dialogue_file.h" #include "titanic/true_talk/title_engine.h" #include "titanic/true_talk/tt_scripts.h" +#include "titanic/true_talk/tt_talker.h" namespace Titanic { @@ -37,25 +38,6 @@ class CViewItem; class CTrueTalkManager; class CTrueTalkNPC; -class TTTalker : public ListItem { -public: - CTrueTalkManager *_owner; - CTrueTalkNPC *_npc; - CString _string1; - int _field20; - int _field24; - int _field28; -public: - TTTalker() : _owner(nullptr), _npc(nullptr), - _field20(0), _field24(0), _field28(0) {} - TTTalker(CTrueTalkManager *owner, CTrueTalkNPC *npc) : - _owner(owner), _npc(npc), _field20(0), _field24(0), _field28(0) {} - -}; - -class TTTalkerList : public List<TTTalker> { -}; - class CTrueTalkManager { private: CGameManager *_gameManager; @@ -118,6 +100,8 @@ private: * Triggers animation for the NPC */ void triggerNPC(CTrueTalkNPC *npc); + + void setTalker(TTTalker *talker, TTRoomScript *roomScript, CViewItem *view, bool isParrot); public: static int _v1; static int _v2; diff --git a/engines/titanic/true_talk/tt_talker.cpp b/engines/titanic/true_talk/tt_talker.cpp new file mode 100644 index 0000000000..3e86fdf597 --- /dev/null +++ b/engines/titanic/true_talk/tt_talker.cpp @@ -0,0 +1,35 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/true_talk/tt_talker.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +void TTTalker::speechStarted(const CString &dialogueStr, uint dialogueId, uint soundId) { + _dialogueId = dialogueId; + + CTrueTalkNotifySpeechStartedMsg msg(soundId, dialogueId, 0); + msg.execute(_npc, nullptr, MSGFLAG_BREAK_IF_HANDLED); +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_talker.h b/engines/titanic/true_talk/tt_talker.h new file mode 100644 index 0000000000..792c84c505 --- /dev/null +++ b/engines/titanic/true_talk/tt_talker.h @@ -0,0 +1,56 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_TT_TALKER_H +#define TITANIC_TT_TALKER_H + +#include "titanic/core/list.h" +#include "titanic/npcs/true_talk_npc.h" +#include "titanic/support/string.h" + +namespace Titanic { + +class CTrueTalkManager; + +class TTTalker : public ListItem { +public: + CTrueTalkManager *_owner; + CTrueTalkNPC *_npc; + CString _string1; + int _dialogueId; + int _field24; + int _field28; +public: + TTTalker() : _owner(nullptr), _npc(nullptr), + _dialogueId(0), _field24(0), _field28(0) {} + TTTalker(CTrueTalkManager *owner, CTrueTalkNPC *npc) : + _owner(owner), _npc(npc), _dialogueId(0), _field24(0), _field28(0) {} + + void speechStarted(const CString &dialogueStr, uint dialogueId, uint soundId); +}; + +class TTTalkerList : public List<TTTalker> { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_TALKER_H */ |