aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/sound_lol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra/sound_lol.cpp')
-rw-r--r--engines/kyra/sound_lol.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/engines/kyra/sound_lol.cpp b/engines/kyra/sound_lol.cpp
index 968488eef3..cb9be43b07 100644
--- a/engines/kyra/sound_lol.cpp
+++ b/engines/kyra/sound_lol.cpp
@@ -167,8 +167,8 @@ void LoLEngine::snd_playSoundEffect(int track, int volume) {
volume &= 0xff;
int16 volIndex = (int16)READ_LE_UINT16(&_ingameSoundIndex[track * 2 + 1]);
- volume = (volIndex > 0) ? (volIndex * volume) >> 8 : -volIndex;
- volume = CLIP(volume >> 4, 2, 13) * 7 + 164;
+ uint16 vocLevel = (volIndex > 0) ? (volIndex * volume) >> 8 : -volIndex;
+ vocLevel = CLIP(volume >> 4, 2, 13) * 7 + 164;
int16 vocIndex = (int16)READ_LE_UINT16(&_ingameSoundIndex[track * 2]);
@@ -180,7 +180,7 @@ void LoLEngine::snd_playSoundEffect(int track, int volume) {
if (hasVocFile) {
if (_sound->isVoicePresent(_ingameSoundList[vocIndex]))
- _sound->voicePlay(_ingameSoundList[vocIndex], 0, volume & 0xff, true);
+ _sound->voicePlay(_ingameSoundList[vocIndex], 0, vocLevel & 0xff, true);
} else if (_flags.platform == Common::kPlatformPC) {
if (_sound->getSfxType() == Sound::kMidiMT32)
track = (track < _ingameMT32SoundIndexSize) ? (_ingameMT32SoundIndex[track] - 1) : -1;
@@ -197,24 +197,9 @@ void LoLEngine::snd_playSoundEffect(int track, int volume) {
}
}
-void LoLEngine::snd_processEnvironmentalSoundEffect(int soundId, int block) {
- if (!_sound->sfxEnabled() || shouldQuit())
- return;
-
- if (_environmentSfx)
- snd_playSoundEffect(_environmentSfx, _environmentSfxVol);
-
- int dist = 0;
- if (block) {
- dist = getMonsterDistance(_currentBlock, block);
- if (dist > _envSfxDistThreshold) {
- _environmentSfx = 0;
- return;
- }
- }
-
- _environmentSfx = soundId;
- _environmentSfxVol = (15 - ((block || dist < 2) ? dist : 0)) << 4;
+bool LoLEngine::snd_processEnvironmentalSoundEffect(int soundId, int block) {
+ if (!KyraRpgEngine::snd_processEnvironmentalSoundEffect(soundId, block))
+ return false;
if (block != _currentBlock) {
static const int8 blockShiftTable[] = { -32, -31, 1, 33, 32, 31, -1, -33 };
@@ -231,9 +216,9 @@ void LoLEngine::snd_processEnvironmentalSoundEffect(int soundId, int block) {
}
if (!soundId || _sceneUpdateRequired)
- return;
+ return false;
- snd_processEnvironmentalSoundEffect(0, 0);
+ return snd_processEnvironmentalSoundEffect(0, 0);
}
void LoLEngine::snd_queueEnvironmentalSoundEffect(int soundId, int block) {