aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/agos/agos.h1
-rw-r--r--engines/agos/script_pp.cpp15
-rw-r--r--engines/agos/sound.cpp21
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() {