From 23bd7eddf349414865f71088a77e12fcb2469d03 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 2 Sep 2019 22:39:48 +0200 Subject: GRIFFON: Move another method to sound.cpp --- engines/griffon/engine.cpp | 56 --------------------------------------------- engines/griffon/sound.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 56 deletions(-) (limited to 'engines') diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp index 2a170d9a41..e86e2abc1a 100644 --- a/engines/griffon/engine.cpp +++ b/engines/griffon/engine.cpp @@ -5344,62 +5344,6 @@ void GriffonEngine::updateY() { } } -void GriffonEngine::updateMusic() { - DataChunk *iplaysound = NULL; - - if (config.music) { - - // if(_curmap > 5 && _curmap < 42) iplaysound = macademy; - // if(_curmap > 47) iplaysound = _mgardens; - iplaysound = _mgardens; - if (_roomlock) - iplaysound = _mboss; - - if (iplaysound == _mboss && _pboss) - iplaysound = NULL; - if (iplaysound == _mgardens && _pgardens) - iplaysound = NULL; - - if (iplaysound != NULL) { - haltSoundChannel(_musicchannel); - - _pboss = false; - _pgardens = false; - _ptown = false; - _pacademy = false; - _pcitadel = false; - - if (iplaysound == _mboss) - _pboss = true; - if (iplaysound == _mgardens) - _pgardens = true; - - _musicchannel = playSound(iplaysound, true); - setChannelVolume(_musicchannel, config.musicvol); - } else { - if (!isSoundChannelPlaying(_musicchannel)) { - _loopseta += 1; - if (_loopseta == 4) - _loopseta = 0; - - if (_pgardens) { - haltSoundChannel(_musicchannel); - if (_pgardens && _loopseta == 0) - _musicchannel = playSound(_mgardens); - if (_pgardens && _loopseta == 1) - _musicchannel = playSound(_mgardens2); - if (_pgardens && _loopseta == 2) - _musicchannel = playSound(_mgardens3); - if (_pgardens && _loopseta == 3) - _musicchannel = playSound(_mgardens4); - } - - setChannelVolume(_musicchannel, config.musicvol); - } - } - } -} - void GriffonEngine::game_updnpcs() { for (int i = 1; i <= _lastnpc; i++) { if (_npcinfo[i].hp > 0) { diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp index a82cf4a62a..eaa99c3038 100644 --- a/engines/griffon/sound.cpp +++ b/engines/griffon/sound.cpp @@ -42,6 +42,7 @@ #include "common/system.h" #include "griffon/griffon.h" +#include "griffon/config.h" namespace Griffon { @@ -198,5 +199,61 @@ void GriffonEngine::setupAudio() { _sfx[14] = cacheSound("sfx/beep.ogg"); } +void GriffonEngine::updateMusic() { + DataChunk *iplaysound = NULL; + + if (config.music) { + + // if(_curmap > 5 && _curmap < 42) iplaysound = macademy; + // if(_curmap > 47) iplaysound = _mgardens; + iplaysound = _mgardens; + if (_roomlock) + iplaysound = _mboss; + + if (iplaysound == _mboss && _pboss) + iplaysound = NULL; + if (iplaysound == _mgardens && _pgardens) + iplaysound = NULL; + + if (iplaysound != NULL) { + haltSoundChannel(_musicchannel); + + _pboss = false; + _pgardens = false; + _ptown = false; + _pacademy = false; + _pcitadel = false; + + if (iplaysound == _mboss) + _pboss = true; + if (iplaysound == _mgardens) + _pgardens = true; + + _musicchannel = playSound(iplaysound, true); + setChannelVolume(_musicchannel, config.musicvol); + } else { + if (!isSoundChannelPlaying(_musicchannel)) { + _loopseta += 1; + if (_loopseta == 4) + _loopseta = 0; + + if (_pgardens) { + haltSoundChannel(_musicchannel); + if (_pgardens && _loopseta == 0) + _musicchannel = playSound(_mgardens); + if (_pgardens && _loopseta == 1) + _musicchannel = playSound(_mgardens2); + if (_pgardens && _loopseta == 2) + _musicchannel = playSound(_mgardens3); + if (_pgardens && _loopseta == 3) + _musicchannel = playSound(_mgardens4); + } + + setChannelVolume(_musicchannel, config.musicvol); + } + } + } +} + } // end of namespace Griffon -- cgit v1.2.3