aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-09 22:16:17 -0400
committerPaul Gilbert2016-08-09 22:16:17 -0400
commit17a665e2aab9466d7362168ded8d870986120eca (patch)
treeaaccb3962a51c4676d39b6e3e97e612bde7918d5 /engines/titanic
parent668c486f4fdf270a88cfd799ba54871d5a314383 (diff)
downloadscummvm-rg350-17a665e2aab9466d7362168ded8d870986120eca.tar.gz
scummvm-rg350-17a665e2aab9466d7362168ded8d870986120eca.tar.bz2
scummvm-rg350-17a665e2aab9466d7362168ded8d870986120eca.zip
TITANIC: Field renaming and warning fixes in sound code
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/core/game_object.cpp2
-rw-r--r--engines/titanic/sound/proximity.cpp2
-rw-r--r--engines/titanic/sound/proximity.h2
-rw-r--r--engines/titanic/sound/sound.cpp4
-rw-r--r--engines/titanic/sound/sound_manager.cpp14
-rw-r--r--engines/titanic/sound/sound_manager.h8
-rw-r--r--engines/titanic/true_talk/true_talk_manager.cpp9
7 files changed, 22 insertions, 19 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 3a100ffd29..67b7920f04 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -748,7 +748,7 @@ int CGameObject::queueSound(const CString &name, uint priorHandle, uint volume,
prox._fieldC = val3;
prox._repeated = repeated;
prox._channelVolume = volume;
- prox._soundHandle = priorHandle;
+ prox._priorSoundHandle = priorHandle;
return playSound(name, prox);
}
diff --git a/engines/titanic/sound/proximity.cpp b/engines/titanic/sound/proximity.cpp
index ce91a0770f..7502eb3ef8 100644
--- a/engines/titanic/sound/proximity.cpp
+++ b/engines/titanic/sound/proximity.cpp
@@ -26,7 +26,7 @@
namespace Titanic {
CProximity::CProximity() : _field4(0), _channelVolume(100), _fieldC(0),
- _soundHandle((uint)-1), _field14(0), _frequencyMultiplier(0.0), _field1C(1.875),
+ _priorSoundHandle(-1), _field14(0), _frequencyMultiplier(0.0), _field1C(1.875),
_repeated(false), _channel(10), _field28(0), _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),
diff --git a/engines/titanic/sound/proximity.h b/engines/titanic/sound/proximity.h
index d8eee4d9e5..7c1f8598e8 100644
--- a/engines/titanic/sound/proximity.h
+++ b/engines/titanic/sound/proximity.h
@@ -36,7 +36,7 @@ public:
int _field4;
int _channelVolume;
int _fieldC;
- uint _soundHandle;
+ int _priorSoundHandle;
int _field14;
double _frequencyMultiplier;
double _field1C;
diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp
index d86262ae23..d14c628a78 100644
--- a/engines/titanic/sound/sound.cpp
+++ b/engines/titanic/sound/sound.cpp
@@ -48,16 +48,12 @@ void CSound::preLoad() {
void CSound::preEnterView(CViewItem *newView, bool isNewRoom) {
CNodeItem *node = newView->findNode();
- CRoomItem *room = node->findRoom();
double xp, yp, zp;
node->getPosition(xp, yp, zp);
double cosVal = cos(newView->_angle);
double sinVal = -sin(newView->_angle);
- // WORKAROUND: The original does a weird call below, doing the room's
- // (width + height) / 2 and passing it in the isNewRoom field, along with
- // two extra unused parameters that aren't used
_soundManager.setListenerPosition(xp, yp, zp, cosVal, sinVal, 0, isNewRoom);
}
diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp
index 7f0834ccb1..a8bd0dfbe9 100644
--- a/engines/titanic/sound/sound_manager.cpp
+++ b/engines/titanic/sound/sound_manager.cpp
@@ -151,11 +151,15 @@ int QSoundManager::playSound(CWaveFile &waveFile, CProximity &prox) {
int channel = -1;
uint flags = QMIX_CLEARQUEUE;
- for (uint idx = 0; idx < _slots.size(); ++idx) {
- if (_slots[idx]._handle == prox._soundHandle) {
- channel = _slots[idx]._channel;
- flags = QMIX_QUEUEWAVE;
- break;
+ if (prox._priorSoundHandle >= 1) {
+ // This sound should only be started after a prior one finishes,
+ // so scan the slots for the specified sound
+ for (uint idx = 0; idx < _slots.size(); ++idx) {
+ if (_slots[idx]._handle == prox._priorSoundHandle) {
+ channel = _slots[idx]._channel;
+ flags = QMIX_QUEUEWAVE;
+ break;
+ }
}
}
diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h
index 466607a1d5..2c9975ede4 100644
--- a/engines/titanic/sound/sound_manager.h
+++ b/engines/titanic/sound/sound_manager.h
@@ -191,17 +191,17 @@ public:
/**
* Returns the music volume percent
*/
- int getMusicVolume() const { return _musicPercent; }
+ double getMusicVolume() const { return _musicPercent; }
/**
* Returns the speech volume percent
*/
- int getSpeechVolume() const { return _speechPercent; }
+ double getSpeechVolume() const { return _speechPercent; }
/**
* Returns the parrot volume percent
*/
- int getParrotVolume() const { return _parrotPercent; }
+ double getParrotVolume() const { return _parrotPercent; }
/**
* Gets the volume for a given mode? value
@@ -255,7 +255,7 @@ class QSoundManager : public CSoundManager, public QMixer {
bool _isTimed;
uint _ticks;
int _channel;
- uint _handle;
+ int _handle;
uint _val3;
Slot() : _waveFile(0), _isTimed(0), _ticks(0), _channel(-1), _handle(0), _val3(0) {}
diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp
index 82d443fcda..61ad924d90 100644
--- a/engines/titanic/true_talk/true_talk_manager.cpp
+++ b/engines/titanic/true_talk/true_talk_manager.cpp
@@ -523,6 +523,9 @@ void CTrueTalkManager::playSpeech(TTtalker *talker, TTroomScript *roomScript, CV
view->getPosition(p1._posX, p1._posY, p1._posZ);
}
+ // Loop through adding each of the speech portions in. We use the
+ // _priorSoundHandle of CProximity to chain each successive speech
+ // to start when the prior one finishes
for (uint idx = 0; idx < _titleEngine._indexes.size(); ++idx) {
uint id = _titleEngine._indexes[idx];
if (id > 100000)
@@ -535,18 +538,18 @@ void CTrueTalkManager::playSpeech(TTtalker *talker, TTroomScript *roomScript, CV
}
// Start the speech
- p1._soundHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p1);
+ p1._priorSoundHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p1);
if (!milli)
continue;
if (idx == 0)
g_vm->_events->sleep(milli);
- p3._soundHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p3);
+ p3._priorSoundHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p3);
if (idx == 0)
g_vm->_events->sleep(milli);
- p2._soundHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p2);
+ p2._priorSoundHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p2);
}
}