Ticket #4930: sword2_mute.patch

File sword2_mute.patch, 1.7 KB (added by lordhoto, 14 years ago)

Patch against r51098

  • engines/sword2/sword2.cpp

    diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
    index 1060dcf..43cb873 100644
    a b void Sword2Engine::registerDefaultSettings() {  
    326326}
    327327
    328328void Sword2Engine::syncSoundSettings() {
     329        // Sync the engine with the config manager
     330        int soundVolumeMusic = ConfMan.getInt("music_volume");
     331        int soundVolumeSFX = ConfMan.getInt("sfx_volume");
     332        int soundVolumeSpeech = ConfMan.getInt("speech_volume");
     333
     334        bool mute = false;
     335        if (ConfMan.hasKey("mute"))
     336                mute = ConfMan.getBool("mute");
     337
    329338        // Sound settings. At the time of writing, not all of these can be set
    330339        // by the global options dialog, but it seems silly to split them up.
    331         _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
    332         _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
    333         _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
     340        _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, (mute ? 0 : soundVolumeMusic));
     341        _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, (mute ? 0 : soundVolumeSFX));
     342        _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, (mute ? 0 : soundVolumeSpeech));
     343
    334344        setSubtitles(ConfMan.getBool("subtitles"));
    335         _sound->muteMusic(ConfMan.getBool("music_mute"));
    336         _sound->muteSpeech(ConfMan.getBool("speech_mute"));
    337         _sound->muteFx(ConfMan.getBool("sfx_mute"));
     345
     346        _sound->muteMusic((mute ? true : ConfMan.getBool("music_mute")));
     347        _sound->muteSpeech((mute ? true : ConfMan.getBool("speech_mute")));
     348        _sound->muteFx((mute ? true : ConfMan.getBool("sfx_mute")));
     349
    338350        _sound->setReverseStereo(ConfMan.getBool("reverse_stereo"));
    339351}
    340352