[Scummvm-cvs-logs] SF.net SVN: scummvm:[53545] scummvm/trunk/engines/toon

sylvaintv at users.sourceforge.net sylvaintv at users.sourceforge.net
Sat Oct 16 21:27:12 CEST 2010


Revision: 53545
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53545&view=rev
Author:   sylvaintv
Date:     2010-10-16 19:27:11 +0000 (Sat, 16 Oct 2010)

Log Message:
-----------
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)

Modified Paths:
--------------
    scummvm/trunk/engines/toon/audio.cpp
    scummvm/trunk/engines/toon/audio.h
    scummvm/trunk/engines/toon/toon.cpp
    scummvm/trunk/engines/toon/toon.h

Modified: scummvm/trunk/engines/toon/audio.cpp
===================================================================
--- scummvm/trunk/engines/toon/audio.cpp	2010-10-16 17:25:08 UTC (rev 53544)
+++ scummvm/trunk/engines/toon/audio.cpp	2010-10-16 19:27:11 UTC (rev 53545)
@@ -45,11 +45,31 @@
 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 @@
 	//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 @@
 
 	_channels[2] = new AudioStreamInstance(this, _mixer, stream);
 	_channels[2]->play(false, Audio::Mixer::kSpeechSoundType);
+	_channels[2]->setVolume(voiceMuted ? 0 : 255);
 
 }
 
@@ -146,7 +168,7 @@
 		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 @@
 	_fadeTime = 0;
 	_soundType = soundType;
 	_musicAttenuation = 1000; // max volume
-	_mixer->playStream(soundType, &_handle, this);
+	_mixer->playStream(soundType, &_handle, this, -1);
 	handleFade(0);
 }
 

Modified: scummvm/trunk/engines/toon/audio.h
===================================================================
--- scummvm/trunk/engines/toon/audio.h	2010-10-16 17:25:08 UTC (rev 53544)
+++ scummvm/trunk/engines/toon/audio.h	2010-10-16 19:27:11 UTC (rev 53545)
@@ -124,8 +124,13 @@
 	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);
 
 	AudioStreamInstance *_channels[16];  // 0-1 : music
@@ -140,6 +145,11 @@
 	Common::String _currentMusicName;
 	ToonEngine *_vm;
 	Audio::Mixer *_mixer;
+
+protected:
+	bool voiceMuted;
+	bool musicMuted;
+	bool sfxMuted;
 };
 
 } // End of namespace Toon

Modified: scummvm/trunk/engines/toon/toon.cpp
===================================================================
--- scummvm/trunk/engines/toon/toon.cpp	2010-10-16 17:25:08 UTC (rev 53544)
+++ scummvm/trunk/engines/toon/toon.cpp	2010-10-16 19:27:11 UTC (rev 53545)
@@ -187,6 +187,18 @@
 			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 @@
 	_currentPicture = 0;
 	_roomScaleData = 0;
 	_shadowLUT = 0;
+	_showConversationText = true;
 	_isDemo = _gameDescription->flags & ADGF_DEMO;
 
 	DebugMan.addDebugChannel(kDebugAnim, "Anim", "Animation debug level");
@@ -2710,7 +2723,7 @@
 }
 
 void ToonEngine::drawConversationLine() {
-	if (_currentTextLine) {
+	if (_currentTextLine && _showConversationText) {
 		_fontRenderer->setFontColorByCharacter(_currentTextLineCharacterId);
 		_fontRenderer->setFont(_fontToon);
 		_fontRenderer->renderMultiLineText(_currentTextLineX, _currentTextLineY, Common::String(_currentTextLine), 0);

Modified: scummvm/trunk/engines/toon/toon.h
===================================================================
--- scummvm/trunk/engines/toon/toon.h	2010-10-16 17:25:08 UTC (rev 53544)
+++ scummvm/trunk/engines/toon/toon.h	2010-10-16 19:27:11 UTC (rev 53545)
@@ -395,6 +395,7 @@
 
 	bool _firstFrame;
 	bool _isDemo;
+	bool _showConversationText;
 };
 
 } // End of namespace Toon


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