diff options
author | Paul Gilbert | 2016-09-02 20:10:48 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-09-02 20:10:48 -0400 |
commit | 6e5072e1b253038d1eb05e66937637069a3a84f8 (patch) | |
tree | 30244e044c8041dd1652d092c6cbd64aa75394ca /engines/titanic/true_talk | |
parent | a4d577beffbd33e0472efe5b3d3a99cb97b8ecb5 (diff) | |
download | scummvm-rg350-6e5072e1b253038d1eb05e66937637069a3a84f8.tar.gz scummvm-rg350-6e5072e1b253038d1eb05e66937637069a3a84f8.tar.bz2 scummvm-rg350-6e5072e1b253038d1eb05e66937637069a3a84f8.zip |
TITANIC: Figured out sound durations for speeches & SFX
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r-- | engines/titanic/true_talk/true_talk_manager.cpp | 22 | ||||
-rw-r--r-- | engines/titanic/true_talk/true_talk_manager.h | 7 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_talker.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_talker.h | 2 |
4 files changed, 18 insertions, 17 deletions
diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 085f0bd310..be9ca667de 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -347,14 +347,14 @@ void CTrueTalkManager::setDialogue(CTrueTalkNPC *npc, TTroomScript *roomScript, if (dialogueStr.empty()) return; - int soundId = readDialogSound(); + uint speechDuration = readDialogueSpeech(); TTtalker *talker = new TTtalker(this, npc); _talkers.push_back(talker); bool isParrot = npc->getName().contains("parrot"); triggerNPC(npc); playSpeech(talker, roomScript, view, isParrot); - talker->speechStarted(dialogueStr, _titleEngine._indexes[0], soundId); + talker->speechStarted(dialogueStr, _titleEngine._indexes[0], speechDuration); } #define STRING_BUFFER_SIZE 2048 @@ -400,30 +400,30 @@ CString CTrueTalkManager::readDialogueString() { return result; } -int CTrueTalkManager::readDialogSound() { - _field18 = 0; +uint CTrueTalkManager::readDialogueSpeech() { + _speechDuration = 0; for (uint idx = 0; idx < _titleEngine._indexes.size(); ++idx) { CWaveFile *waveFile = _gameManager->_sound.getTrueTalkSound( _dialogueFile, _titleEngine._indexes[idx] - _dialogueId); if (waveFile) { - _field18 = waveFile->fn1(); + _speechDuration += waveFile->getDuration(); } } - return _field18; + return _speechDuration; } void CTrueTalkManager::triggerNPC(CTrueTalkNPC *npc) { CTrueTalkSelfQueueAnimSetMsg queueSetMsg; if (queueSetMsg.execute(npc)) { - if (_field18 > 300) { - CTrueTalkQueueUpAnimSetMsg upMsg(_field18); + if (_speechDuration > 300) { + CTrueTalkQueueUpAnimSetMsg upMsg(_speechDuration); upMsg.execute(npc); } } else { CTrueTalkGetAnimSetMsg getAnimMsg; - if (_field18 > 300) { + if (_speechDuration > 300) { do { getAnimMsg.execute(npc); if (!getAnimMsg._endFrame) @@ -435,10 +435,10 @@ void CTrueTalkManager::triggerNPC(CTrueTalkNPC *npc) { uint numFrames = getAnimMsg._endFrame - getAnimMsg._startFrame; int64 val = (numFrames * 1000) * 0x88888889; uint diff = (val >> (32 + 5)) - 500; - _field18 += diff; + _speechDuration += diff; getAnimMsg._index++; - } while (_field18 > 0); + } while (_speechDuration > 0); } } } diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index e891f6112a..3abf4c181c 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -50,7 +50,7 @@ private: int _currentCharId; CDialogueFile *_dialogueFile; int _dialogueId; - int _field18; + uint _speechDuration; TTtalkerList _talkers; private: /** @@ -96,9 +96,10 @@ private: CString readDialogueString(); /** - * Read in the sound from the dialogue file + * Read in the speech from the dialogue file + * @returns Duration of the speech in seconds */ - int readDialogSound(); + uint readDialogueSpeech(); /** * Triggers animation for the NPC diff --git a/engines/titanic/true_talk/tt_talker.cpp b/engines/titanic/true_talk/tt_talker.cpp index 61443a4835..9bb998617b 100644 --- a/engines/titanic/true_talk/tt_talker.cpp +++ b/engines/titanic/true_talk/tt_talker.cpp @@ -26,10 +26,10 @@ namespace Titanic { -void TTtalker::speechStarted(const CString &dialogueStr, uint dialogueId, uint soundId) { +void TTtalker::speechStarted(const CString &dialogueStr, uint dialogueId, uint speechHandle) { _dialogueId = dialogueId; - CTrueTalkNotifySpeechStartedMsg msg(soundId, dialogueId, 0); + CTrueTalkNotifySpeechStartedMsg msg(speechHandle, dialogueId, 0); msg.execute(_npc, nullptr, MSGFLAG_BREAK_IF_HANDLED); } diff --git a/engines/titanic/true_talk/tt_talker.h b/engines/titanic/true_talk/tt_talker.h index 636eb0c022..bc1687e0ce 100644 --- a/engines/titanic/true_talk/tt_talker.h +++ b/engines/titanic/true_talk/tt_talker.h @@ -49,7 +49,7 @@ public: /** * Start a new speech */ - void speechStarted(const CString &dialogueStr, uint dialogueId, uint soundId); + void speechStarted(const CString &dialogueStr, uint dialogueId, uint speechHandle); /** * End the speech |