[Scummvm-cvs-logs] SF.net SVN: scummvm: [22844] scummvm/trunk/engines/kyra
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sat Jun 3 00:57:10 CEST 2006
Revision: 22844
Author: lordhoto
Date: 2006-06-02 15:57:02 -0700 (Fri, 02 Jun 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=22844&view=rev
Log Message:
-----------
Fix for bug # 1497961 ("KYRA1: in-game "Music" option not working").
Modified Paths:
--------------
scummvm/trunk/engines/kyra/gui.cpp
scummvm/trunk/engines/kyra/sound.cpp
scummvm/trunk/engines/kyra/sound.h
scummvm/trunk/engines/kyra/sound_adlib.cpp
Modified: scummvm/trunk/engines/kyra/gui.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui.cpp 2006-06-02 20:42:41 UTC (rev 22843)
+++ scummvm/trunk/engines/kyra/gui.cpp 2006-06-02 22:57:02 UTC (rev 22844)
@@ -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 @@
_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 @@
break;
}
+ if (!_configMusic)
+ _sound->beginFadeOut();
+
+ _sound->enableMusic(_configMusic);
+ _sound->enableSFX(_configSounds);
+
ConfMan.setBool("speech_mute", speechMute);
ConfMan.setBool("subtitles", subtitles);
Modified: scummvm/trunk/engines/kyra/sound.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound.cpp 2006-06-02 20:42:41 UTC (rev 22843)
+++ scummvm/trunk/engines/kyra/sound.cpp 2006-06-02 22:57:02 UTC (rev 22844)
@@ -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::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::playSoundEffect(uint8 track) {
- if (_soundEffect) {
+ if (_soundEffect && _sfxEnabled) {
_sfxIsPlaying = true;
_soundEffect->setTrack(track);
_soundEffect->jumpToTick(0);
Modified: scummvm/trunk/engines/kyra/sound.h
===================================================================
--- scummvm/trunk/engines/kyra/sound.h 2006-06-02 20:42:41 UTC (rev 22843)
+++ scummvm/trunk/engines/kyra/sound.h 2006-06-02 22:57:02 UTC (rev 22844)
@@ -61,12 +61,20 @@
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 @@
void beginFadeOut();
private:
+ void play(uint8 track);
+
void loadSoundFile(const char *file);
void unk1();
Modified: scummvm/trunk/engines/kyra/sound_adlib.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_adlib.cpp 2006-06-02 20:42:41 UTC (rev 22843)
+++ scummvm/trunk/engines/kyra/sound_adlib.cpp 2006-06-02 22:57:02 UTC (rev 22844)
@@ -2196,7 +2196,8 @@
}
void SoundAdlibPC::playTrack(uint8 track) {
- playSoundEffect(track);
+ if (_musicEnabled)
+ play(track);
}
void SoundAdlibPC::haltTrack() {
@@ -2206,6 +2207,11 @@
}
void SoundAdlibPC::playSoundEffect(uint8 track) {
+ if (_sfxEnabled)
+ play(track);
+}
+
+void SoundAdlibPC::play(uint8 track) {
uint8 soundId = _trackEntries[track];
if ((int8)soundId == -1 || !_soundDataPtr)
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list