From 6e50033d07011d8fcae941c5c10530081d522db0 Mon Sep 17 00:00:00 2001 From: Joost Peters Date: Sat, 21 Feb 2004 20:50:56 +0000 Subject: I am an idiot. Better fix for bug #899881 (Sounds played when sound turned off) - I forgot I added the isSpeech flag a while back. :) svn-id: r12976 --- queen/graphics.cpp | 6 ++---- queen/logic.cpp | 3 +-- queen/sound.cpp | 6 ++++++ queen/talk.cpp | 3 +-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/queen/graphics.cpp b/queen/graphics.cpp index dc7301a8f7..e845b4e6c8 100644 --- a/queen/graphics.cpp +++ b/queen/graphics.cpp @@ -343,8 +343,7 @@ void Graphics::sortBobs() { if (pbs->animating) { pbs->animOneStep(); if (pbs->frameNum > 500) { // SFX frame - if (_vm->sound()->sfxOn()) - _vm->sound()->playSfx(_vm->logic()->currentRoomSfx(), false); + _vm->sound()->playSfx(_vm->logic()->currentRoomSfx(), false); pbs->frameNum -= 500; } } @@ -1113,8 +1112,7 @@ void BamScene::playSfx() { // this problem since their playSfx() function returns immediately // if a sound is already being played. if (_lastSoundIndex == 0 || _index - _lastSoundIndex >= SFX_SKIP) { - if (_vm->sound()->sfxOn()) - _vm->sound()->playSfx(_vm->logic()->currentRoomSfx(), false); + _vm->sound()->playSfx(_vm->logic()->currentRoomSfx(), false); _lastSoundIndex = _index; } } diff --git a/queen/logic.cpp b/queen/logic.cpp index 4f6edb14b3..8181abe32e 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -1723,8 +1723,7 @@ void Logic::asmMakeLightningHitPlane() { lightningBob->y = 0; // 23/2/95 - Play lightning SFX - if (_vm->sound()->sfxOn()) - _vm->sound()->playSfx(currentRoomSfx(), false); + _vm->sound()->playSfx(currentRoomSfx(), false); _vm->bankMan()->unpack(18, lightningBob->frameNum, 15); _vm->bankMan()->unpack(4, planeBob ->frameNum, 15); diff --git a/queen/sound.cpp b/queen/sound.cpp index ccfcf23a5d..c403d32b1c 100644 --- a/queen/sound.cpp +++ b/queen/sound.cpp @@ -77,6 +77,9 @@ void Sound::waitFinished(bool isSpeech) { } void Sound::playSfx(uint16 sfx, bool isSpeech) { + if (isSpeech && !speechOn()) return; + else if (!sfxOn()) return; + if (sfx != 0) { char name[13]; strcpy(name, _sfxName[sfx - 1]); @@ -87,6 +90,9 @@ void Sound::playSfx(uint16 sfx, bool isSpeech) { } void Sound::playSfx(const char *base, bool isSpeech) { + if (isSpeech && !speechOn()) return; + else if (!sfxOn()) return; + char name[13]; strcpy(name, base); // alter filename to add zeros and append ".SB" diff --git a/queen/talk.cpp b/queen/talk.cpp index c0d7fd02e8..1d0223f19b 100644 --- a/queen/talk.cpp +++ b/queen/talk.cpp @@ -773,8 +773,7 @@ void Talk::stringAnimation(const SpeechParameters *parameters, int startFrame, i if (frame > 500) { frame -= 500; - if (_vm->sound()->sfxOn()) - _vm->sound()->playSfx(_vm->logic()->currentRoomSfx(), false); + _vm->sound()->playSfx(_vm->logic()->currentRoomSfx(), false); } if (torso) { -- cgit v1.2.3