[Scummvm-cvs-logs] scummvm master -> e8ea243a1468168d78d4c2d61f5d22a7421f8f2e

dreammaster dreammaster at scummvm.org
Fri Aug 12 00:30:31 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e8ea243a14 TITANIC: Set up positioning mode in sound manager & CProximity


Commit: e8ea243a1468168d78d4c2d61f5d22a7421f8f2e
    https://github.com/scummvm/scummvm/commit/e8ea243a1468168d78d4c2d61f5d22a7421f8f2e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-11T18:30:24-04:00

Commit Message:
TITANIC: Set up positioning mode in sound manager & CProximity

Changed paths:
    engines/titanic/core/game_object.cpp
    engines/titanic/sound/auto_sound_player.cpp
    engines/titanic/sound/proximity.cpp
    engines/titanic/sound/proximity.h
    engines/titanic/sound/sound_manager.cpp
    engines/titanic/sound/sound_manager.h
    engines/titanic/true_talk/true_talk_manager.cpp



diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 67b7920..0661f25 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 1fb6785..8267d65 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 7502eb3..b4cd160 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 7c1f859..9335989 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 6544f6b..d466488 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 594d7ec..d1afdb4 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 61ad924..977edd5 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);
 	}
 






More information about the Scummvm-git-logs mailing list