diff options
author | Strangerke | 2013-06-26 23:11:34 +0200 |
---|---|---|
committer | Strangerke | 2013-06-26 23:11:34 +0200 |
commit | 6e2d567bca53b6ffee771b4105e2e73dbd73f5b4 (patch) | |
tree | 9880f0c496263ffb6928248d495ce4172dabed18 /engines/kyra/sound_lol.cpp | |
parent | ac387835e4527c1814919093b4e4bc9798d5742d (diff) | |
parent | 6716fa39a6fb2a3925576288c256688c5aadd7e9 (diff) | |
download | scummvm-rg350-6e2d567bca53b6ffee771b4105e2e73dbd73f5b4.tar.gz scummvm-rg350-6e2d567bca53b6ffee771b4105e2e73dbd73f5b4.tar.bz2 scummvm-rg350-6e2d567bca53b6ffee771b4105e2e73dbd73f5b4.zip |
Merge branch 'master' of https://github.com/scummvm/scummvm into mortevielle
Conflicts:
engines/engines.mk
Diffstat (limited to 'engines/kyra/sound_lol.cpp')
-rw-r--r-- | engines/kyra/sound_lol.cpp | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/engines/kyra/sound_lol.cpp b/engines/kyra/sound_lol.cpp index cb9be43b07..7ac33967dd 100644 --- a/engines/kyra/sound_lol.cpp +++ b/engines/kyra/sound_lol.cpp @@ -60,7 +60,7 @@ bool LoLEngine::snd_playCharacterSpeech(int id, int8 speaker, int) { Common::String pattern2 = Common::String::format("%02d", id & 0x4000 ? 0 : _curTlkFile); if (id & 0x4000) { - pattern1 = Common::String::format("%03X", id & 0x3fff); + pattern1 = Common::String::format("%03X", id & 0x3FFF); } else if (id < 1000) { pattern1 = Common::String::format("%03d", id); } else { @@ -164,11 +164,19 @@ void LoLEngine::snd_playSoundEffect(int track, int volume) { if (track == -1 || track >= _ingameSoundListSize) return; - volume &= 0xff; - int16 volIndex = (int16)READ_LE_UINT16(&_ingameSoundIndex[track * 2 + 1]); + volume &= 0xFF; + int16 prIndex = (int16)READ_LE_UINT16(&_ingameSoundIndex[track * 2 + 1]); + uint16 priority = (prIndex > 0) ? (prIndex * volume) >> 8 : -prIndex; - uint16 vocLevel = (volIndex > 0) ? (volIndex * volume) >> 8 : -volIndex; - vocLevel = CLIP(volume >> 4, 2, 13) * 7 + 164; + static const uint8 volTable1[] = { 223, 159, 95, 47, 15, 0 }; + static const uint8 volTable2[] = { 255, 191, 127, 63, 30, 0 }; + + for (int i = 0; i < 6; i++) { + if (volTable1[i] < volume) { + volume = volTable2[i]; + break; + } + } int16 vocIndex = (int16)READ_LE_UINT16(&_ingameSoundIndex[track * 2]); @@ -180,8 +188,8 @@ void LoLEngine::snd_playSoundEffect(int track, int volume) { if (hasVocFile) { if (_sound->isVoicePresent(_ingameSoundList[vocIndex])) - _sound->voicePlay(_ingameSoundList[vocIndex], 0, vocLevel & 0xff, true); - } else if (_flags.platform == Common::kPlatformPC) { + _sound->voicePlay(_ingameSoundList[vocIndex], 0, volume, priority, true); + } else if (_flags.platform == Common::kPlatformDOS) { if (_sound->getSfxType() == Sound::kMidiMT32) track = (track < _ingameMT32SoundIndexSize) ? (_ingameMT32SoundIndex[track] - 1) : -1; else if (_sound->getSfxType() == Sound::kMidiGM) @@ -206,8 +214,8 @@ bool LoLEngine::snd_processEnvironmentalSoundEffect(int soundId, int block) { uint16 cbl = _currentBlock; for (int i = 3; i > 0; i--) { - int dir = calcMonsterDirection(cbl & 0x1f, cbl >> 5, block & 0x1f, block >> 5); - cbl = (cbl + blockShiftTable[dir]) & 0x3ff; + int dir = calcMonsterDirection(cbl & 0x1F, cbl >> 5, block & 0x1F, block >> 5); + cbl = (cbl + blockShiftTable[dir]) & 0x3FF; if (cbl != block) { if (testWallFlag(cbl, 0, 1)) _environmentSfxVol >>= 1; @@ -239,7 +247,7 @@ void LoLEngine::snd_playQueuedEffects() { void LoLEngine::snd_loadSoundFile(int track) { if (_sound->musicEnabled()) { - if (_flags.platform != Common::kPlatformPC98) { + if (_flags.platform == Common::kPlatformDOS) { int t = (track - 250) * 3; if (_curMusicFileIndex != _musicTrackMap[t] || _curMusicFileExt != (char)_musicTrackMap[t + 1]) { snd_stopMusic(); @@ -261,12 +269,12 @@ int LoLEngine::snd_playTrack(int track) { _lastMusicTrack = track; if (_sound->musicEnabled()) { - if (_flags.platform == Common::kPlatformPC98) { - _sound->playTrack(track - 249); - } else { + if (_flags.platform == Common::kPlatformDOS) { snd_loadSoundFile(track); int t = (track - 250) * 3; _sound->playTrack(_musicTrackMap[t + 2]); + } else { + _sound->playTrack(track - 249); } } |