diff options
author | Travis Howell | 2007-06-10 01:05:55 +0000 |
---|---|---|
committer | Travis Howell | 2007-06-10 01:05:55 +0000 |
commit | 8dc7accf2dfa2f6272f665c9113a0fcaeaecd73c (patch) | |
tree | a534f1e8622e3b3a39ff69c5ad72f595fe44ce17 | |
parent | 3fd5347421710bb21d47c57dca2b11c6dd9da7aa (diff) | |
download | scummvm-rg350-8dc7accf2dfa2f6272f665c9113a0fcaeaecd73c.tar.gz scummvm-rg350-8dc7accf2dfa2f6272f665c9113a0fcaeaecd73c.tar.bz2 scummvm-rg350-8dc7accf2dfa2f6272f665c9113a0fcaeaecd73c.zip |
Fix single sound effect, failing to play multiple times regression, caused by changes for PP in the past.
svn-id: r27267
-rw-r--r-- | engines/agos/agos.h | 1 | ||||
-rw-r--r-- | engines/agos/script_pp.cpp | 15 | ||||
-rw-r--r-- | engines/agos/sound.cpp | 21 |
3 files changed, 24 insertions, 13 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 90bd73600e..f73161e437 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -1677,6 +1677,7 @@ public: void opp_sync(); void opp_saveUserGame(); void opp_loadUserGame(); + void opp_playTune(); void opp_saveOopsPosition(); void opp_resetGameTime(); void opp_resetPVCount(); diff --git a/engines/agos/script_pp.cpp b/engines/agos/script_pp.cpp index fd8ef9b859..1b454b3464 100644 --- a/engines/agos/script_pp.cpp +++ b/engines/agos/script_pp.cpp @@ -238,7 +238,7 @@ void AGOSEngine_PuzzlePack::setupOpcodes() { /* 160 */ OPCODE(oe2_ink), OPCODE(off_screenTextBox), - OPCODE(os1_screenTextMsg), + OPCODE(opp_playTune), OPCODE(o_invalid), /* 164 */ OPCODE(oe2_getDollar2), @@ -405,6 +405,19 @@ void AGOSEngine_PuzzlePack::opp_loadUserGame() { loadGame(genSaveName(1)); } +void AGOSEngine_PuzzlePack::opp_playTune() { + // 162: play tune + getVarOrByte(); + getVarOrByte(); + getNextWord(); + + uint16 music = (uint16)getVarOrWord(); + if (music != _lastMusicPlayed) { + _lastMusicPlayed = music; + playSpeech(music, 1); + } +} + void AGOSEngine_PuzzlePack::opp_saveOopsPosition() { // 173: save oops position if (!isVgaQueueEmpty()) { diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp index 21e065cc7f..2b64970f57 100644 --- a/engines/agos/sound.cpp +++ b/engines/agos/sound.cpp @@ -243,7 +243,7 @@ Audio::AudioStream *WavSound::makeAudioStream(uint sound) { void WavSound::playSound(uint sound, uint loopSound, Audio::SoundHandle *handle, byte flags, int vol) { convertVolume(vol); - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::Mixer::FLAG_LOOP) != 0), sound, vol); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::Mixer::FLAG_LOOP) != 0), -1, vol); } void VocSound::playSound(uint sound, uint loopSound, Audio::SoundHandle *handle, byte flags, int vol) { @@ -255,7 +255,7 @@ void VocSound::playSound(uint sound, uint loopSound, Audio::SoundHandle *handle, int size, rate; byte *buffer = Audio::loadVOCFromStream(*_file, size, rate); assert(buffer); - _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE, sound); + _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE); } void RawSound::playSound(uint sound, uint loopSound, Audio::SoundHandle *handle, byte flags, int vol) { @@ -268,7 +268,7 @@ void RawSound::playSound(uint sound, uint loopSound, Audio::SoundHandle *handle, byte *buffer = (byte *)malloc(size); assert(buffer); _file->read(buffer, size); - _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer, size, 22050, flags | Audio::Mixer::FLAG_AUTOFREE, sound); + _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer, size, 22050, flags | Audio::Mixer::FLAG_AUTOFREE); } #ifdef USE_MAD @@ -296,7 +296,7 @@ Audio::AudioStream *MP3Sound::makeAudioStream(uint sound) { void MP3Sound::playSound(uint sound, uint loopSound, Audio::SoundHandle *handle, byte flags, int vol) { convertVolume(vol); - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::Mixer::FLAG_LOOP) != 0), sound, vol); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::Mixer::FLAG_LOOP) != 0), -1, vol); } #endif @@ -325,7 +325,7 @@ Audio::AudioStream *VorbisSound::makeAudioStream(uint sound) { void VorbisSound::playSound(uint sound, uint loopSound, Audio::SoundHandle *handle, byte flags, int vol) { convertVolume(vol); - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::Mixer::FLAG_LOOP) != 0), sound, vol); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::Mixer::FLAG_LOOP) != 0), -1, vol); } #endif @@ -354,7 +354,7 @@ Audio::AudioStream *FlacSound::makeAudioStream(uint sound) { void FlacSound::playSound(uint sound, uint loopSound, Audio::SoundHandle *handle, byte flags, int vol) { convertVolume(vol); - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::Mixer::FLAG_LOOP) != 0), sound, vol); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::Mixer::FLAG_LOOP) != 0), -1, vol); } #endif @@ -589,9 +589,6 @@ void Sound::playVoice(uint sound) { if (!_voice) return; - if (_mixer->getSoundID(_voiceHandle) == (int)sound) - return; - _mixer->stopHandle(_voiceHandle); if (_vm->getGameType() == GType_PP) { if (sound < 11) @@ -681,9 +678,9 @@ void Sound::playRawData(byte *soundData, uint sound, uint size) { memcpy(buffer, soundData, size); if (_vm->getPlatform() == Common::kPlatformPC) - _mixer->playRaw(Audio::Mixer::kSFXSoundType, &_effectsHandle, buffer, size, 8000, Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE, sound); + _mixer->playRaw(Audio::Mixer::kSFXSoundType, &_effectsHandle, buffer, size, 8000, Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE); else - _mixer->playRaw(Audio::Mixer::kSFXSoundType, &_effectsHandle, buffer, size, 8000, Audio::Mixer::FLAG_AUTOFREE, sound); + _mixer->playRaw(Audio::Mixer::kSFXSoundType, &_effectsHandle, buffer, size, 8000, Audio::Mixer::FLAG_AUTOFREE); } // Feeble Files specific @@ -747,7 +744,7 @@ void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint soun memcpy(buffer, soundData + stream.pos(), size); } - _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE, sound, vol, pan); + _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE, -1, vol, pan); } void Sound::stopSfx5() { |