aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-05-07 18:41:13 -0400
committerPaul Gilbert2016-07-10 16:38:43 -0400
commitb480a2f53e3a48a0e741f86e59cc141f8325c958 (patch)
tree36a1391e9f0ea0fe17cc92e2b7b698a644afec37
parent339df8657e883ba62bd5c4c474ab920dfa3d19c8 (diff)
downloadscummvm-rg350-b480a2f53e3a48a0e741f86e59cc141f8325c958.tar.gz
scummvm-rg350-b480a2f53e3a48a0e741f86e59cc141f8325c958.tar.bz2
scummvm-rg350-b480a2f53e3a48a0e741f86e59cc141f8325c958.zip
TITANIC: Implementing TTTalker
-rw-r--r--engines/titanic/messages/messages.h2
-rw-r--r--engines/titanic/module.mk1
-rw-r--r--engines/titanic/npcs/true_talk_npc.cpp14
-rw-r--r--engines/titanic/npcs/true_talk_npc.h3
-rw-r--r--engines/titanic/pet_control/pet_text.cpp5
-rw-r--r--engines/titanic/true_talk/true_talk_manager.cpp20
-rw-r--r--engines/titanic/true_talk/true_talk_manager.h22
-rw-r--r--engines/titanic/true_talk/tt_talker.cpp35
-rw-r--r--engines/titanic/true_talk/tt_talker.h56
9 files changed, 119 insertions, 39 deletions
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index 561120de34..ad5c4bc485 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -345,7 +345,7 @@ MESSAGE4(CTrueTalkGetAnimSetMsg, int, value1, 0, uint, index, 0, uint, startFram
MESSAGE2(CTrueTalkGetAssetDetailsMsg, CString, filename, "", int, numValue, 0);
MESSAGE2(CTrueTalkGetStateValueMsg, int, value1, 0, int, value2, -1000);
MESSAGE2(CTrueTalkNotifySpeechEndedMsg, int, value1, 0, int, value2, 0);
-MESSAGE3(CTrueTalkNotifySpeechStartedMsg, int, value1, 0, int, value2, 0, int, value, 0);
+MESSAGE3(CTrueTalkNotifySpeechStartedMsg, uint, soundId, 0, uint, dialogueId, 0, int, value, 0);
MESSAGE1(CTrueTalkQueueUpAnimSetMsg, int, value, 0);
MESSAGE0(CTrueTalkSelfQueueAnimSetMsg);
MESSAGE3(CTrueTalkTriggerActionMsg, int, value1, 0, int, value2, 0, int, value3, 0);
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index df8f0534f4..aaccb77445 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -464,6 +464,7 @@ MODULE_OBJS := \
true_talk/tt_named_script.o \
true_talk/tt_scripts.o \
true_talk/tt_string.o \
+ true_talk/tt_talker.o \
true_talk/tt_title_script.o
# This module can be built as a plugin
diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp
index bc562efac4..297de59178 100644
--- a/engines/titanic/npcs/true_talk_npc.cpp
+++ b/engines/titanic/npcs/true_talk_npc.cpp
@@ -39,7 +39,7 @@ BEGIN_MESSAGE_MAP(CTrueTalkNPC, CCharacter)
END_MESSAGE_MAP()
CTrueTalkNPC::CTrueTalkNPC() : _assetName("z451.dlg"),
- _assetNumber(0x11170), _fieldE4(0), _npcFlags(0), _fieldEC(0), _fieldF0(0),
+ _assetNumber(0x11170), _fieldE4(0), _npcFlags(0), _soundId(0), _fieldF0(0),
_fieldF4(0), _fieldF8(0), _speechTimerId(0), _field100(0), _field104(0) {
}
@@ -49,7 +49,7 @@ void CTrueTalkNPC::save(SimpleFile *file, int indent) const {
file->writeQuotedLine(_assetName, indent);
file->writeNumberLine(_fieldE4, indent);
file->writeNumberLine(_npcFlags, indent);
- file->writeNumberLine(_fieldEC, indent);
+ file->writeNumberLine(_soundId, indent);
file->writeNumberLine(_fieldF0, indent);
file->writeNumberLine(_fieldF4, indent);
file->writeNumberLine(_fieldF8, indent);
@@ -66,7 +66,7 @@ void CTrueTalkNPC::load(SimpleFile *file) {
_assetName = file->readString();
_fieldE4 = file->readNumber();
_npcFlags = file->readNumber();
- _fieldEC = file->readNumber();
+ _soundId = file->readNumber();
_fieldF0 = file->readNumber();
_fieldF4 = file->readNumber();
_fieldF8 = file->readNumber();
@@ -101,14 +101,14 @@ bool CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMs
if (_speechTimerId)
stopTimer(_speechTimerId);
- _fieldEC = msg->_value1;
+ _soundId = msg->_soundId;
_fieldF0 = g_vm->_events->getTicksCount();
if (hasActiveMovie() || (_npcFlags & NPCFLAG_2)) {
_npcFlags &= ~NPCFLAG_2;
stopMovie();
- CNPCPlayTalkingAnimationMsg msg1(_fieldEC, 0, 0);
+ CNPCPlayTalkingAnimationMsg msg1(_soundId, 0, 0);
msg1.execute(this);
if (msg1._value3) {
@@ -124,7 +124,7 @@ bool CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMs
bool CTrueTalkNPC::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) {
_npcFlags &= ~NPCFLAG_SPEAKING;
--_field100;
- _fieldEC = 0;
+ _soundId = 0;
if (!(_npcFlags & NPCFLAG_8)) {
CNPCPlayTalkingAnimationMsg msg1(0, 2, 0);
@@ -147,7 +147,7 @@ bool CTrueTalkNPC::MovieEndMsg(CMovieEndMsg *msg) {
}
int diff = g_vm->_events->getTicksCount() - _fieldF0;
- int ticks = MAX((int)_fieldEC - diff, 0);
+ int ticks = MAX((int)_soundId - diff, 0);
CNPCPlayTalkingAnimationMsg msg1(ticks, ticks > 1000 ? 2 : 1, 0);
msg1.execute(this);
diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h
index ad436a5582..8277b55e45 100644
--- a/engines/titanic/npcs/true_talk_npc.h
+++ b/engines/titanic/npcs/true_talk_npc.h
@@ -25,6 +25,7 @@
#include "titanic/npcs/character.h"
#include "titanic/messages/messages.h"
+#include "titanic/true_talk/tt_talker.h"
namespace Titanic {
@@ -50,7 +51,7 @@ protected:
CString _assetName;
int _fieldE4;
uint _npcFlags;
- int _fieldEC;
+ uint _soundId;
int _fieldF0;
int _fieldF4;
int _fieldF8;
diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp
index a4e00424fe..e6b90c127c 100644
--- a/engines/titanic/pet_control/pet_text.cpp
+++ b/engines/titanic/pet_control/pet_text.cpp
@@ -236,9 +236,6 @@ void CPetText::setColor(byte r, byte g, byte b) {
void CPetText::remapColors(uint count, uint *srcColors, uint *destColors) {
if (_lineCount >= 0) {
- int lineNum = 0;
- int index1 = 0;
-
for (int lineNum = 0; lineNum <= _lineCount; ++lineNum) {
// Get the rgb values
uint r = _array[lineNum]._rgb[1];
@@ -442,7 +439,7 @@ int CPetText::getNPCNum(uint npcId, uint startIndex) {
return -1;
}
- int size = _lines.size();
+ uint size = _lines.size();
if (startIndex < 5 || startIndex >= size)
return -1;
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 */