From f16505b128c5aac2a0b4d8c18e360b14058149e1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 Jun 2017 08:00:55 -0400 Subject: TITANIC: Change Bomb to use speech sound type --- engines/titanic/game/bomb.cpp | 23 +++++++++++++---------- engines/titanic/sound/proximity.cpp | 10 ++++++++++ engines/titanic/sound/proximity.h | 1 + 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/engines/titanic/game/bomb.cpp b/engines/titanic/game/bomb.cpp index 17c10c5082..93887ab7b1 100644 --- a/engines/titanic/game/bomb.cpp +++ b/engines/titanic/game/bomb.cpp @@ -158,7 +158,7 @@ bool CBomb::StatusChangeMsg(CStatusChangeMsg *msg) { break; } - _soundHandle = queueSound(name, _soundHandle, _volume); + _soundHandle = queueSound(name, _soundHandle, _volume, Audio::Mixer::kSpeechSoundType); } return true; @@ -174,7 +174,6 @@ bool CBomb::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (_active) { stopSound(_soundHandle); - //stopSound(_unusedHandle); if (_numCorrectWheels < CORRECT_WHEELS) { _tappedCtr = MIN(_tappedCtr + 1, 23); @@ -201,7 +200,7 @@ bool CBomb::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { break; } - _soundHandle = queueSound(name, _soundHandle, _volume); + _soundHandle = queueSound(name, _soundHandle, _volume, Audio::Mixer::kSpeechSoundType); _countdown = 999; } } else { @@ -258,7 +257,7 @@ bool CBomb::ActMsg(CActMsg *msg) { break; } - _soundHandle = queueSound(name, _soundHandle, _volume); + _soundHandle = queueSound(name, _soundHandle, _volume, Audio::Mixer::kSpeechSoundType); _countdown = 999; } @@ -267,7 +266,8 @@ bool CBomb::ActMsg(CActMsg *msg) { bool CBomb::TurnOn(CTurnOn *msg) { if (!_active) { - _soundHandle = playSound("z#389.wav", _volume); + CProximity prox(Audio::Mixer::kSpeechSoundType, _volume); + _soundHandle = playSound("z#389.wav", prox); _active = true; // WORKAROUND: Only reset the code wheels back to 'O' value @@ -295,8 +295,9 @@ bool CBomb::TurnOn(CTurnOn *msg) { bool CBomb::TimerMsg(CTimerMsg *msg) { if (msg->_action == "Disarmed") { + CProximity prox(Audio::Mixer::kSpeechSoundType, _volume); stopSound(_soundHandle); - playSound("z#364.wav", _volume); + playSound("z#364.wav", prox); CActMsg actMsg1("Disarm Bomb"); actMsg1.execute("EndExplodeShip"); @@ -330,8 +331,9 @@ bool CBomb::TimerMsg(CTimerMsg *msg) { if (_countdown >= 100) { // Play "x hundred and" or just "x hundred" + CProximity prox(Audio::Mixer::kSpeechSoundType, _volume); CString hName = remainder ? HUNDREDS_AND_WAVS[hundreds] : HUNDREDS_WAVS[hundreds]; - _soundHandle = playSound(hName, _volume); + _soundHandle = playSound(hName, prox); } CString ctrName = COUNTDOWN_WAVS[remainder]; @@ -342,9 +344,10 @@ bool CBomb::TimerMsg(CTimerMsg *msg) { // Play the sub-hundred portion of the countdown amount if (_soundHandle > 0) { - _soundHandle = queueSound(ctrName, _soundHandle, _volume); + _soundHandle = queueSound(ctrName, _soundHandle, _volume, 0, false, Audio::Mixer::kSpeechSoundType); } else { - _soundHandle = playSound(ctrName, _volume); + CProximity prox(Audio::Mixer::kSpeechSoundType, _volume); + _soundHandle = playSound(ctrName, prox); } // Reduce countdown and schedule another timer @@ -352,7 +355,7 @@ bool CBomb::TimerMsg(CTimerMsg *msg) { addTimer(0, 1000, 0); } } else { - // Bomb speech currently active, so schedule the method' + // Bomb speech currently active, so schedule the method // to re-trigger after 100ms to check if speech is finished addTimer(0, 100, 0); } diff --git a/engines/titanic/sound/proximity.cpp b/engines/titanic/sound/proximity.cpp index 796e344ae2..f949bada10 100644 --- a/engines/titanic/sound/proximity.cpp +++ b/engines/titanic/sound/proximity.cpp @@ -35,4 +35,14 @@ CProximity::CProximity() : _channelVolume(100), _balance(0), _soundDuration(0), _soundType(Audio::Mixer::kPlainSoundType) { } +CProximity::CProximity(Audio::Mixer::SoundType soundType, int volume) : + _soundType(soundType), _channelVolume(volume), + _balance(0), _priorSoundHandle(-1), _frequencyMultiplier(0.0), + _frequencyAdjust(1.875), _repeated(false), _channelMode(10), + _positioningMode(POSMODE_NONE), _azimuth(0.0), _range(0.5), _elevation(0), + _posX(0.0), _posY(0.0), _posZ(0.0), _hasVelocity(false), _velocityX(0), + _velocityY(0), _velocityZ(0), _disposeAfterUse(DisposeAfterUse::NO), + _endTalkerFn(nullptr), _talker(nullptr), _soundDuration(0) { +} + } // End of namespace Titanic diff --git a/engines/titanic/sound/proximity.h b/engines/titanic/sound/proximity.h index 2f0745240d..92e65bbf34 100644 --- a/engines/titanic/sound/proximity.h +++ b/engines/titanic/sound/proximity.h @@ -61,6 +61,7 @@ public: Audio::Mixer::SoundType _soundType; public: CProximity(); + CProximity(Audio::Mixer::SoundType soundType, int volume = 100); }; } // End of namespace Titanic -- cgit v1.2.3