aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-11 18:30:24 -0400
committerPaul Gilbert2016-08-11 18:30:24 -0400
commite8ea243a1468168d78d4c2d61f5d22a7421f8f2e (patch)
tree2723358c6cb6a6a75d7ac77a9882434c4ecc8c2b /engines/titanic
parent22408230ec9e82665a80fd4476a9f2747ffaff0e (diff)
downloadscummvm-rg350-e8ea243a1468168d78d4c2d61f5d22a7421f8f2e.tar.gz
scummvm-rg350-e8ea243a1468168d78d4c2d61f5d22a7421f8f2e.tar.bz2
scummvm-rg350-e8ea243a1468168d78d4c2d61f5d22a7421f8f2e.zip
TITANIC: Set up positioning mode in sound manager & CProximity
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/core/game_object.cpp2
-rw-r--r--engines/titanic/sound/auto_sound_player.cpp2
-rw-r--r--engines/titanic/sound/proximity.cpp2
-rw-r--r--engines/titanic/sound/proximity.h4
-rw-r--r--engines/titanic/sound/sound_manager.cpp12
-rw-r--r--engines/titanic/sound/sound_manager.h5
-rw-r--r--engines/titanic/true_talk/true_talk_manager.cpp6
7 files changed, 18 insertions, 15 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 67b7920f04..0661f25478 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -726,7 +726,7 @@ int CGameObject::playSound(const CString &name, uint volume, int val3, bool repe
}
int CGameObject::playSound(const CString &name, CProximity &prox) {
- if (prox._field28 == 2) {
+ if (prox._positioningMode == POSMODE_VECTOR) {
// If the proximity doesn't have a position defined, default it to
// the position of the view to which the game object belongs
if (prox._posX == 0.0 && prox._posY == 0.0 && prox._posZ == 0.0)
diff --git a/engines/titanic/sound/auto_sound_player.cpp b/engines/titanic/sound/auto_sound_player.cpp
index 1fb67858da..8267d65037 100644
--- a/engines/titanic/sound/auto_sound_player.cpp
+++ b/engines/titanic/sound/auto_sound_player.cpp
@@ -75,7 +75,7 @@ bool CAutoSoundPlayer::TurnOn(CTurnOn *msg) {
prox._fieldC = _fieldD0;
prox._repeated = _repeated;
if (_fieldE8)
- prox._field28 = 2;
+ prox._positioningMode = POSMODE_VECTOR;
prox._channelVolume = (_startSeconds == -1) ? _volume : 0;
_soundHandle = playSound(_filename, prox);
diff --git a/engines/titanic/sound/proximity.cpp b/engines/titanic/sound/proximity.cpp
index 7502eb3ef8..b4cd16077c 100644
--- a/engines/titanic/sound/proximity.cpp
+++ b/engines/titanic/sound/proximity.cpp
@@ -27,7 +27,7 @@ namespace Titanic {
CProximity::CProximity() : _field4(0), _channelVolume(100), _fieldC(0),
_priorSoundHandle(-1), _field14(0), _frequencyMultiplier(0.0), _field1C(1.875),
- _repeated(false), _channel(10), _field28(0), _azimuth(0.0),
+ _repeated(false), _channel(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),
_field54(0), _field58(0), _field5C(0), _field60(0), _endTalkerFn(nullptr),
diff --git a/engines/titanic/sound/proximity.h b/engines/titanic/sound/proximity.h
index 7c1f8598e8..933598900d 100644
--- a/engines/titanic/sound/proximity.h
+++ b/engines/titanic/sound/proximity.h
@@ -27,6 +27,8 @@
namespace Titanic {
+enum PositioningMode { POSMODE_NONE = 0, POSMODE_POLAR = 1, POSMODE_VECTOR = 2 };
+
class TTtalker;
typedef void (*CEndTalkerFn)(TTtalker *talker);
@@ -42,7 +44,7 @@ public:
double _field1C;
bool _repeated;
int _channel;
- int _field28;
+ PositioningMode _positioningMode;
double _azimuth;
double _range;
double _elevation;
diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp
index 6544f6bd2f..d466488ceb 100644
--- a/engines/titanic/sound/sound_manager.cpp
+++ b/engines/titanic/sound/sound_manager.cpp
@@ -97,7 +97,7 @@ void QSoundManager::Slot::clear() {
_ticks = 0;
_channel = -1;
_handle = 0;
- _val3 = 0;
+ _positioningMode = POSMODE_NONE;
}
/*------------------------------------------------------------------------*/
@@ -346,7 +346,7 @@ void QSoundManager::setListenerPosition(double posX, double posY, double posZ,
if (stopSounds) {
// Stop any running sounds
for (uint idx = 0; idx < _slots.size(); ++idx) {
- if (_slots[idx]._val3)
+ if (_slots[idx]._positioningMode != 0)
stopSound(_slots[idx]._handle);
}
}
@@ -367,14 +367,14 @@ int QSoundManager::playWave(CWaveFile *waveFile, int iChannel, uint flags, CProx
if (slotIndex == -1)
return -1;
- switch (prox._field28) {
- case 1:
+ switch (prox._positioningMode) {
+ case POSMODE_POLAR:
qsWaveMixSetPolarPosition(iChannel, 8, QSPOLAR(prox._azimuth, prox._range, prox._elevation));
qsWaveMixEnableChannel(iChannel, QMIX_CHANNEL_ELEVATION, true);
qsWaveMixSetDistanceMapping(iChannel, 8, QMIX_DISTANCES(5.0, 3.0, 1.0));
break;
- case 2:
+ case POSMODE_VECTOR:
qsWaveMixSetSourcePosition(iChannel, 8, QSVECTOR(prox._posX, prox._posY, prox._posZ));
qsWaveMixEnableChannel(iChannel, QMIX_CHANNEL_ELEVATION, true);
qsWaveMixSetDistanceMapping(iChannel, 8, QMIX_DISTANCES(5.0, 3.0, 1.0));
@@ -401,7 +401,7 @@ int QSoundManager::playWave(CWaveFile *waveFile, int iChannel, uint flags, CProx
slot._handle = _handleCtr++;
slot._channel = iChannel;
slot._waveFile = waveFile;
- slot._val3 = prox._field28;
+ slot._positioningMode = prox._positioningMode;
return slot._handle;
} else {
diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h
index 594d7ec34f..d1afdb4ad4 100644
--- a/engines/titanic/sound/sound_manager.h
+++ b/engines/titanic/sound/sound_manager.h
@@ -264,9 +264,10 @@ class QSoundManager : public CSoundManager, public QMixer {
uint _ticks;
int _channel;
int _handle;
- uint _val3;
+ PositioningMode _positioningMode;
- Slot() : _waveFile(0), _isTimed(0), _ticks(0), _channel(-1), _handle(0), _val3(0) {}
+ Slot() : _waveFile(0), _isTimed(0), _ticks(0), _channel(-1),
+ _handle(0), _positioningMode(POSMODE_NONE) {}
void clear();
};
private:
diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp
index 61ad924d90..977edd5399 100644
--- a/engines/titanic/true_talk/true_talk_manager.cpp
+++ b/engines/titanic/true_talk/true_talk_manager.cpp
@@ -505,13 +505,13 @@ void CTrueTalkManager::playSpeech(TTtalker *talker, TTroomScript *roomScript, CV
if (milli > 0) {
p3._channelVolume = (index * 3) / 2;
- p3._field28 = 1;
+ p3._positioningMode = POSMODE_POLAR;
p3._azimuth = -135.0;
p3._range = 1.0;
p3._elevation = 0;
p2._channelVolume = (index * 3) / 4;
- p2._field28 = 0;
+ p2._positioningMode = POSMODE_NONE;
p2._azimuth = 135.0;
p2._range = 1.0;
p2._elevation = 0;
@@ -519,7 +519,7 @@ void CTrueTalkManager::playSpeech(TTtalker *talker, TTroomScript *roomScript, CV
_gameManager->_sound.stopChannel(p1._channel);
if (view) {
- p1._field28 = 2;
+ p1._positioningMode = POSMODE_VECTOR;
view->getPosition(p1._posX, p1._posY, p1._posZ);
}