[Scummvm-cvs-logs] scummvm master -> 17a665e2aab9466d7362168ded8d870986120eca

dreammaster dreammaster at scummvm.org
Wed Aug 10 04:16:24 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:
17a665e2aa TITANIC: Field renaming and warning fixes in sound code


Commit: 17a665e2aab9466d7362168ded8d870986120eca
    https://github.com/scummvm/scummvm/commit/17a665e2aab9466d7362168ded8d870986120eca
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-09T22:16:17-04:00

Commit Message:
TITANIC: Field renaming and warning fixes in sound code

Changed paths:
    engines/titanic/core/game_object.cpp
    engines/titanic/sound/proximity.cpp
    engines/titanic/sound/proximity.h
    engines/titanic/sound/sound.cpp
    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 3a100ff..67b7920 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 ce91a07..7502eb3 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 d8eee4d..7c1f859 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 d86262a..d14c628 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 7f0834c..a8bd0df 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 466607a..2c9975e 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 82d443f..61ad924 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);
 	}
 }
 






More information about the Scummvm-git-logs mailing list