aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2006-06-02 22:57:02 +0000
committerJohannes Schickel2006-06-02 22:57:02 +0000
commit6ac60c9c7bc39f4e1d9f950d67b4e484220ebc9d (patch)
tree40e2845a46ae598892a9e87235533ba06298f2dd
parent50f12fb9aaba758d97a928bfa0ab197016b40cfe (diff)
downloadscummvm-rg350-6ac60c9c7bc39f4e1d9f950d67b4e484220ebc9d.tar.gz
scummvm-rg350-6ac60c9c7bc39f4e1d9f950d67b4e484220ebc9d.tar.bz2
scummvm-rg350-6ac60c9c7bc39f4e1d9f950d67b4e484220ebc9d.zip
Fix for bug # 1497961 ("KYRA1: in-game "Music" option not working").
svn-id: r22844
-rw-r--r--engines/kyra/gui.cpp10
-rw-r--r--engines/kyra/sound.cpp7
-rw-r--r--engines/kyra/sound.h10
-rw-r--r--engines/kyra/sound_adlib.cpp8
4 files changed, 31 insertions, 4 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index 5027792581..0e0d62d1ae 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -25,6 +25,7 @@
#include "kyra/script.h"
#include "kyra/text.h"
#include "kyra/animator.h"
+#include "kyra/sound.h"
#include "common/config-manager.h"
#include "common/savefile.h"
@@ -56,6 +57,9 @@ void KyraEngine::readSettings() {
_configMusic = ConfMan.getBool("music_mute") ? 0 : 1;
_configSounds = ConfMan.getBool("sfx_mute") ? 0 : 1;
+ _sound->enableMusic(_configMusic);
+ _sound->enableSFX(_configSounds);
+
bool speechMute = ConfMan.getBool("speech_mute");
bool subtitles = ConfMan.getBool("subtitles");
@@ -108,6 +112,12 @@ void KyraEngine::writeSettings() {
break;
}
+ if (!_configMusic)
+ _sound->beginFadeOut();
+
+ _sound->enableMusic(_configMusic);
+ _sound->enableSFX(_configSounds);
+
ConfMan.setBool("speech_mute", speechMute);
ConfMan.setBool("subtitles", subtitles);
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index 02208f9f5d..a96c46604b 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -36,7 +36,8 @@
namespace Kyra {
Sound::Sound(KyraEngine *engine, Audio::Mixer *mixer)
- : _engine(engine), _mixer(mixer), _currentVocFile(0), _vocHandle(), _compressHandle() {
+ : _engine(engine), _mixer(mixer), _currentVocFile(0), _vocHandle(), _compressHandle(),
+ _musicEnabled(true), _sfxEnabled(false) {
}
Sound::~Sound() {
@@ -363,7 +364,7 @@ void SoundMidiPC::onTimer(void *refCon) {
}
void SoundMidiPC::playTrack(uint8 track) {
- if (_parser && (track != 0 || _nativeMT32)) {
+ if (_parser && (track != 0 || _nativeMT32) && _musicEnabled) {
_isPlaying = true;
_fadeMusicOut = false;
_fadeStartTime = 0;
@@ -387,7 +388,7 @@ void SoundMidiPC::haltTrack() {
}
void SoundMidiPC::playSoundEffect(uint8 track) {
- if (_soundEffect) {
+ if (_soundEffect && _sfxEnabled) {
_sfxIsPlaying = true;
_soundEffect->setTrack(track);
_soundEffect->jumpToTick(0);
diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h
index 3252bee6d8..a7de851349 100644
--- a/engines/kyra/sound.h
+++ b/engines/kyra/sound.h
@@ -61,12 +61,20 @@ public:
virtual void beginFadeOut() = 0;
+ void enableMusic(bool enable) { _musicEnabled = enable; }
+ bool musicEnabled() const { return _musicEnabled; }
+ void enableSFX(bool enable) { _sfxEnabled = enable; }
+ bool sfxEnabled() const { return _sfxEnabled; }
+
void voicePlay(const char *file);
void voiceUnload() {}
bool voiceIsPlaying();
void voiceStop();
protected:
+ bool _musicEnabled;
+ bool _sfxEnabled;
+
KyraEngine *_engine;
Audio::Mixer *_mixer;
@@ -105,6 +113,8 @@ public:
void beginFadeOut();
private:
+ void play(uint8 track);
+
void loadSoundFile(const char *file);
void unk1();
diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp
index 79eb187dc5..9680fe4701 100644
--- a/engines/kyra/sound_adlib.cpp
+++ b/engines/kyra/sound_adlib.cpp
@@ -2196,7 +2196,8 @@ void SoundAdlibPC::loadMusicFile(const char *file) {
}
void SoundAdlibPC::playTrack(uint8 track) {
- playSoundEffect(track);
+ if (_musicEnabled)
+ play(track);
}
void SoundAdlibPC::haltTrack() {
@@ -2206,6 +2207,11 @@ void SoundAdlibPC::haltTrack() {
}
void SoundAdlibPC::playSoundEffect(uint8 track) {
+ if (_sfxEnabled)
+ play(track);
+}
+
+void SoundAdlibPC::play(uint8 track) {
uint8 soundId = _trackEntries[track];
if ((int8)soundId == -1 || !_soundDataPtr)
return;