diff options
author | Sylvain Dupont | 2010-10-16 19:27:11 +0000 |
---|---|---|
committer | Sylvain Dupont | 2010-10-16 19:27:11 +0000 |
commit | 748e00f1cf30e9690532bd98087de2e65ca2bac2 (patch) | |
tree | 5cf53064657bf66cf37ab452e1dc2449cec9b871 /engines | |
parent | c9f9c75a838719921003287af6c44625ee71352c (diff) | |
download | scummvm-rg350-748e00f1cf30e9690532bd98087de2e65ca2bac2.tar.gz scummvm-rg350-748e00f1cf30e9690532bd98087de2e65ca2bac2.tar.bz2 scummvm-rg350-748e00f1cf30e9690532bd98087de2e65ca2bac2.zip |
TOON: Implemented the 4 different mute modes for sound/text
As specified in the hotkeys screen (music,dialog,sound,text on/off)
Sounds are still played but with a volume = 0 (for timing issues)
svn-id: r53545
Diffstat (limited to 'engines')
-rw-r--r-- | engines/toon/audio.cpp | 26 | ||||
-rw-r--r-- | engines/toon/audio.h | 12 | ||||
-rw-r--r-- | engines/toon/toon.cpp | 15 | ||||
-rw-r--r-- | engines/toon/toon.h | 1 |
4 files changed, 50 insertions, 4 deletions
diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp index 2ae2b2cc31..fb2eb18c0d 100644 --- a/engines/toon/audio.cpp +++ b/engines/toon/audio.cpp @@ -45,11 +45,31 @@ static int ADPCM_table[89] = { AudioManager::AudioManager(ToonEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) { for (int32 i = 0; i < 16; i++) _channels[i] = 0; + + voiceMuted = false; + musicMuted = false; + sfxMuted = false; } AudioManager::~AudioManager(void) { } +void AudioManager::muteMusic(bool muted) { + setMusicVolume(muted ? 0 : 255); + musicMuted = muted; +} + +void AudioManager::muteVoice(bool muted) { + if(voiceStillPlaying() && _channels[2]) { + _channels[2]->setVolume(muted ? 0 : 255); + } + voiceMuted = muted; +} + +void AudioManager::muteSfx(bool muted) { + sfxMuted = muted; +} + void AudioManager::removeInstance(AudioStreamInstance *inst) { debugC(1, kDebugAudio, "removeInstance(inst)"); @@ -99,6 +119,7 @@ void AudioManager::playMusic(Common::String dir, Common::String music) { //if (!_channels[_currentMusicChannel]) // delete _channels[_currentMusicChannel]; _channels[_currentMusicChannel] = new AudioStreamInstance(this, _mixer, srs, true); + _channels[_currentMusicChannel]->setVolume(musicMuted ? 0 : 255); _channels[_currentMusicChannel]->play(true, Audio::Mixer::kMusicSoundType); } @@ -125,6 +146,7 @@ void AudioManager::playVoice(int32 id, bool genericVoice) { _channels[2] = new AudioStreamInstance(this, _mixer, stream); _channels[2]->play(false, Audio::Mixer::kSpeechSoundType); + _channels[2]->setVolume(voiceMuted ? 0 : 255); } @@ -146,7 +168,7 @@ void AudioManager::playSFX(int32 id, int volume , bool genericSFX) { if (!_channels[i]) { _channels[i] = new AudioStreamInstance(this, _mixer, stream); _channels[i]->play(false, Audio::Mixer::kSFXSoundType); - _channels[i]->setVolume(volume); + _channels[i]->setVolume(sfxMuted ? 0 : volume); break; } } @@ -349,7 +371,7 @@ void AudioStreamInstance::play(bool fade, Audio::Mixer::SoundType soundType) { _fadeTime = 0; _soundType = soundType; _musicAttenuation = 1000; // max volume - _mixer->playStream(soundType, &_handle, this); + _mixer->playStream(soundType, &_handle, this, -1); handleFade(0); } diff --git a/engines/toon/audio.h b/engines/toon/audio.h index 4527e1fe4b..70d399dd1a 100644 --- a/engines/toon/audio.h +++ b/engines/toon/audio.h @@ -124,7 +124,12 @@ public: void stopCurrentVoice(); void setMusicVolume(int32 volume); void stopMusic(); - + void muteVoice(bool mute); + void muteMusic(bool mute); + void muteSfx(bool mute); + bool isVoiceMuted() { return voiceMuted; } + bool isMusicMuted() { return musicMuted; } + bool isSfxMuted() { return sfxMuted; } bool loadAudioPack(int32 id, Common::String indexFile, Common::String packFile); @@ -140,6 +145,11 @@ public: Common::String _currentMusicName; ToonEngine *_vm; Audio::Mixer *_mixer; + +protected: + bool voiceMuted; + bool musicMuted; + bool sfxMuted; }; } // End of namespace Toon diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp index dfb25a7777..e11b29cd6e 100644 --- a/engines/toon/toon.cpp +++ b/engines/toon/toon.cpp @@ -187,6 +187,18 @@ void ToonEngine::parseInput() { if (event.kbd.keycode == Common::KEYCODE_F6) { loadGame(-1); } + if (event.kbd.ascii == 't') { + _showConversationText = !_showConversationText; + } + if (event.kbd.ascii == 'm') { + _audioManager->muteMusic(!_audioManager->isMusicMuted()); + } + if (event.kbd.ascii == 'd') { + _audioManager->muteVoice(!_audioManager->isVoiceMuted()); + } + if (event.kbd.ascii == 's') { + _audioManager->muteSfx(!_audioManager->isSfxMuted()); + } if (event.kbd.flags & Common::KBD_ALT) { int32 slotNum = event.kbd.ascii - '0'; @@ -710,6 +722,7 @@ ToonEngine::ToonEngine(OSystem *syst, const ADGameDescription *gameDescription) _currentPicture = 0; _roomScaleData = 0; _shadowLUT = 0; + _showConversationText = true; _isDemo = _gameDescription->flags & ADGF_DEMO; DebugMan.addDebugChannel(kDebugAnim, "Anim", "Animation debug level"); @@ -2710,7 +2723,7 @@ Character *ToonEngine::getCharacterById(int32 charId) { } void ToonEngine::drawConversationLine() { - if (_currentTextLine) { + if (_currentTextLine && _showConversationText) { _fontRenderer->setFontColorByCharacter(_currentTextLineCharacterId); _fontRenderer->setFont(_fontToon); _fontRenderer->renderMultiLineText(_currentTextLineX, _currentTextLineY, Common::String(_currentTextLine), 0); diff --git a/engines/toon/toon.h b/engines/toon/toon.h index ba3f4a4fd0..a274f03711 100644 --- a/engines/toon/toon.h +++ b/engines/toon/toon.h @@ -395,6 +395,7 @@ protected: bool _firstFrame; bool _isDemo; + bool _showConversationText; }; } // End of namespace Toon |