diff options
author | Norbert Lange | 2009-06-20 21:04:57 +0000 |
---|---|---|
committer | Norbert Lange | 2009-06-20 21:04:57 +0000 |
commit | 8e00db241f30774544bc22fb0499f08c0d39d8c4 (patch) | |
tree | 400d94a81892d43c34f4402d37a765a3b27c280b /engines | |
parent | 4725f4ab384e1c9ca3ec31d642c70b6a4e3b5f76 (diff) | |
download | scummvm-rg350-8e00db241f30774544bc22fb0499f08c0d39d8c4.tar.gz scummvm-rg350-8e00db241f30774544bc22fb0499f08c0d39d8c4.tar.bz2 scummvm-rg350-8e00db241f30774544bc22fb0499f08c0d39d8c4.zip |
fixed portamento-effect.
Added stopping of sfx, seems like Monkey Island is pretty messy when it comes to handling sfx though.
Those two changes fix the "mansion burglary"
svn-id: r41716
Diffstat (limited to 'engines')
-rw-r--r-- | engines/scumm/player_v4a.cpp | 40 | ||||
-rw-r--r-- | engines/scumm/player_v4a.h | 24 |
2 files changed, 52 insertions, 12 deletions
diff --git a/engines/scumm/player_v4a.cpp b/engines/scumm/player_v4a.cpp index 1c438392c4..f44d77089e 100644 --- a/engines/scumm/player_v4a.cpp +++ b/engines/scumm/player_v4a.cpp @@ -33,7 +33,7 @@ namespace Scumm { Player_V4A::Player_V4A(ScummEngine *scumm, Audio::Mixer *mixer) - : _vm(scumm), _mixer(mixer), _musicId(), _tfmxPlay(0), _tfmxSfx(0), _musicHandle(), _sfxHandle() { + : _vm(scumm), _mixer(mixer), _musicId(), _sfxSlots(), _tfmxPlay(0), _tfmxSfx(0), _musicHandle(), _sfxHandle() { init(); } @@ -72,21 +72,31 @@ Player_V4A::~Player_V4A() { } void Player_V4A::setMusicVolume(int vol) { - debug("player_v4a: setMusicVolume %i", vol); + debug(5, "player_v4a: setMusicVolume %i", vol); } void Player_V4A::stopAllSounds() { - if (_musicId) - stopSound(_musicId); + debug(5, "player_v4a: stopAllSounds"); + if (_tfmxPlay) + _tfmxPlay->stopSong(); + _musicId = 0; + if (_tfmxSfx) + _tfmxSfx->stopSong(); + clearSfxSlots(); } void Player_V4A::stopSound(int nr) { + debug(5, "player_v4a: stopSound %d", nr); if (nr == _musicId) { _tfmxPlay->stopSong(); - //_mixer->stopHandle(_musicHandle); _musicId = 0; - } else - warning("player_v4a: stop Sound %d", nr); + } else { + const int chan = getSfxChan(nr); + if (chan != -1) { + setSfxSlot(chan, 0); + _tfmxSfx->stopMacroEffect(chan); + } + } } void Player_V4A::startSound(int nr) { @@ -106,7 +116,7 @@ void Player_V4A::startSound(int nr) { const int val = ptr[9]; if (val < 0 || val >= ARRAYSIZE(monkeyCommands)) { - debug(3, "Tfmx: illegal Songnumber %i", val); + warning("player_v4a: illegal Songnumber %i", val); return; } @@ -114,21 +124,27 @@ void Player_V4A::startSound(int nr) { return; int index = monkeyCommands[val]; + const byte type = ptr[6]; if (index < 0) { // SoundFX index = -index - 1; - debug(5, "player_v4a: play custom %i", index); + debug(3, "player_v4a: play %d: custom %i - %02X", nr, index, type); if (_tfmxSfx->getSongIndex() < 0) _tfmxSfx->doSong(0x18); - _tfmxSfx->doSfx(index); + const int chan = _tfmxSfx->doSfx(index); + if (chan >= 0 && chan < ARRAYSIZE(_sfxSlots)) + setSfxSlot(chan, nr, type); + else + warning("player_v4a: custom %i is not of required type", index); if (!_mixer->isSoundHandleActive(_sfxHandle)) _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, _tfmxSfx, -1, Audio::Mixer::kMaxChannelVolume, 0, false, true); } else { // Song - debug(5, "player_v4a: play song %i", index); - assert(_tfmxPlay); + debug(3, "player_v4a: play %d: song %i - %02X", nr, index, type); + if (ptr[6] != 0x7F) + warning("player_v4a: Song has wrong type"); _tfmxPlay->doSong(index); _musicId = nr; diff --git a/engines/scumm/player_v4a.h b/engines/scumm/player_v4a.h index 5e83adbf67..a261235867 100644 --- a/engines/scumm/player_v4a.h +++ b/engines/scumm/player_v4a.h @@ -62,6 +62,30 @@ private: Audio::SoundHandle _sfxHandle; int _musicId; + + struct SfxChan { + int id; + byte type; + } _sfxSlots[4]; + + int getSfxChan(int id) const { + for (int i = 0; i < ARRAYSIZE(_sfxSlots); ++i) + if (_sfxSlots[i].id == id) + return i; + return -1; + } + + void setSfxSlot(int channel, int id, byte type = 0) { + _sfxSlots[channel].id = id; + _sfxSlots[channel].type = type; + } + + void clearSfxSlots() { + for (int i = 0; i < ARRAYSIZE(_sfxSlots); ++i){ + _sfxSlots[i].id = 0; + _sfxSlots[i].type = 0; + } + } bool init(); }; |