[Scummvm-git-logs] scummvm master -> dd4fee37e35fab40076b6e9070a9a0ab987750a9

dreammaster dreammaster at scummvm.org
Thu Sep 1 02:22: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:
dd4fee37e3 TITANIC: Add support for specifying a sound is music or SFX


Commit: dd4fee37e35fab40076b6e9070a9a0ab987750a9
    https://github.com/scummvm/scummvm/commit/dd4fee37e35fab40076b6e9070a9a0ab987750a9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-31T20:20:10-04:00

Commit Message:
TITANIC: Add support for specifying a sound is music or SFX

Apart from the CMusicRoom music, the game doesn't differentiate between
music and sound effects. This adds an optional _soundType field to the
CProximity class, so I can manually specify which is which

Changed paths:
    engines/titanic/core/game_object.cpp
    engines/titanic/core/game_object.h
    engines/titanic/game/bar_bell.cpp
    engines/titanic/sound/proximity.cpp
    engines/titanic/sound/proximity.h
    engines/titanic/sound/sound.cpp



diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 2c7b7db..4b88f07 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -438,7 +438,8 @@ bool CGameObject::isSoundActive(int handle) const {
 	return false;
 }
 
-void CGameObject::playGlobalSound(const CString &resName, int mode, bool initialMute, bool repeated, int handleIndex) {
+void CGameObject::playGlobalSound(const CString &resName, int mode, bool initialMute, bool repeated,
+		int handleIndex, Audio::Mixer::SoundType soundType) {
 	if (handleIndex < 0 || handleIndex > 3)
 		return;
 	CGameManager *gameManager = getGameManager();
@@ -463,6 +464,7 @@ void CGameObject::playGlobalSound(const CString &resName, int mode, bool initial
 	CProximity prox;
 	prox._channelVolume = volume;
 	prox._repeated = repeated;
+	prox._soundType = soundType;
 
 	switch (handleIndex) {
 	case 0:
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index 182d165..d72fd94 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -23,6 +23,7 @@
 #ifndef TITANIC_GAME_OBJECT_H
 #define TITANIC_GAME_OBJECT_H
 
+#include "audio/mixer.h"
 #include "common/stream.h"
 #include "titanic/support/mouse_cursor.h"
 #include "titanic/support/credit_text.h"
@@ -234,8 +235,10 @@ protected:
 	 * @param initialMute	If set, sound transitions in from mute over 2 seconds
 	 * @param repeated		Flag for repeating sounds
 	 * @param handleIndex	Slot 0 to 3 in the shared sound handle list to store the sound's handle
+	 * @param soundType		Specifies whether the sound is a sound effect or music
 	 */
-	void playGlobalSound(const CString &resName, int mode, bool initialMute, bool repeated, int handleIndex);
+	void playGlobalSound(const CString &resName, int mode, bool initialMute, bool repeated,
+		int handleIndex, Audio::Mixer::SoundType soundType = Audio::Mixer::kMusicSoundType);
 
 	/**
 	 * Stops a sound saved in the global sound handle list
diff --git a/engines/titanic/game/bar_bell.cpp b/engines/titanic/game/bar_bell.cpp
index 207644a..5f17dff 100644
--- a/engines/titanic/game/bar_bell.cpp
+++ b/engines/titanic/game/bar_bell.cpp
@@ -116,7 +116,7 @@ bool CBarBell::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
 	}
 
 	++_fieldBC;
-	return 2;
+	return true;
 }
 
 bool CBarBell::ActMsg(CActMsg *msg) {
diff --git a/engines/titanic/sound/proximity.cpp b/engines/titanic/sound/proximity.cpp
index 7f4e678..992e76a 100644
--- a/engines/titanic/sound/proximity.cpp
+++ b/engines/titanic/sound/proximity.cpp
@@ -31,7 +31,7 @@ CProximity::CProximity() : _field4(0), _channelVolume(100), _fieldC(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), _freeSoundFlag(false), _endTalkerFn(nullptr),
-		_talker(nullptr), _field6C(0) {
+		_talker(nullptr), _field6C(0), _soundType(Audio::Mixer::kPlainSoundType) {
 }
 
 } // End of namespace Titanic
diff --git a/engines/titanic/sound/proximity.h b/engines/titanic/sound/proximity.h
index b728f22..cedb4bd 100644
--- a/engines/titanic/sound/proximity.h
+++ b/engines/titanic/sound/proximity.h
@@ -23,6 +23,7 @@
 #ifndef TITANIC_PROXIMITY_H
 #define TITANIC_PROXIMITY_H
 
+#include "audio/mixer.h"
 #include "common/scummsys.h"
 
 namespace Titanic {
@@ -62,6 +63,7 @@ public:
 	CEndTalkerFn _endTalkerFn;
 	TTtalker *_talker;
 	int _field6C;
+	Audio::Mixer::SoundType _soundType;
 public:
 	CProximity();
 };
diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp
index 045f5aa..30772e7 100644
--- a/engines/titanic/sound/sound.cpp
+++ b/engines/titanic/sound/sound.cpp
@@ -158,6 +158,9 @@ int CSound::playSound(const CString &name, CProximity &prox) {
 		return -1;
 
 	prox._field6C = waveFile->fn1();
+	if (prox._soundType != Audio::Mixer::kPlainSoundType)
+		waveFile->_soundType = prox._soundType;
+
 	activateSound(waveFile, prox._freeSoundFlag);
 
 	return _soundManager.playSound(*waveFile, prox);





More information about the Scummvm-git-logs mailing list