aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorathrxx2018-10-28 15:45:55 +0100
committerathrxx2018-10-28 15:45:55 +0100
commit3ae1d92f179d7062bb3291eb69748be060a046f3 (patch)
tree1575c4de9307df38dcaf55403b80b2e65afb1531 /engines
parent0b746971f103a620013dc9145ab6d3038e378192 (diff)
downloadscummvm-rg350-3ae1d92f179d7062bb3291eb69748be060a046f3.tar.gz
scummvm-rg350-3ae1d92f179d7062bb3291eb69748be060a046f3.tar.bz2
scummvm-rg350-3ae1d92f179d7062bb3291eb69748be060a046f3.zip
KYRA: (LOL) - clean up sound map data formatting
This is a followup to the fix for bug #10665 (Urbish mines lobster having an invalid sound track number and causing invalid memory access).
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/lol.h2
-rw-r--r--engines/kyra/sound_lol.cpp6
-rw-r--r--engines/kyra/staticres.cpp2
-rw-r--r--engines/kyra/staticres_lol.cpp2
4 files changed, 6 insertions, 6 deletions
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 9f952e5df6..5d9804ea4c 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -462,7 +462,7 @@ private:
int _ingameSoundListSize;
const uint8 *_musicTrackMap;
- const uint16 *_ingameSoundIndex;
+ const int16 *_ingameSoundIndex;
int _ingameSoundIndexSize;
const uint8 *_ingameGMSoundIndex;
int _ingameGMSoundIndexSize;
diff --git a/engines/kyra/sound_lol.cpp b/engines/kyra/sound_lol.cpp
index ec48dc8c30..5871040cd7 100644
--- a/engines/kyra/sound_lol.cpp
+++ b/engines/kyra/sound_lol.cpp
@@ -161,11 +161,11 @@ void LoLEngine::snd_playSoundEffect(int track, int volume) {
return;
_lastSfxTrack = track;
- if (track == -1 || track >= (_ingameSoundIndexSize - 500) / 2)
+ if (track == -1 || track >= _ingameSoundIndexSize / 2)
return;
volume &= 0xFF;
- int16 prIndex = (int16)READ_LE_UINT16(&_ingameSoundIndex[track * 2 + 1]);
+ int16 prIndex = _ingameSoundIndex[track * 2 + 1];
uint16 priority = (prIndex > 0) ? (prIndex * volume) >> 8 : -prIndex;
static const uint8 volTable1[] = { 223, 159, 95, 47, 15, 0 };
@@ -178,7 +178,7 @@ void LoLEngine::snd_playSoundEffect(int track, int volume) {
}
}
- int16 vocIndex = (int16)READ_LE_UINT16(&_ingameSoundIndex[track * 2]);
+ int16 vocIndex = _ingameSoundIndex[track * 2];
bool hasVocFile = false;
if (vocIndex != -1) {
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 5a45566c9a..7cb102b0c4 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -39,7 +39,7 @@
namespace Kyra {
-#define RESFILE_VERSION 89
+#define RESFILE_VERSION 90
namespace {
bool checkKyraDat(Common::SeekableReadStream *file) {
diff --git a/engines/kyra/staticres_lol.cpp b/engines/kyra/staticres_lol.cpp
index c40b4a0c7d..e8d2a4ce70 100644
--- a/engines/kyra/staticres_lol.cpp
+++ b/engines/kyra/staticres_lol.cpp
@@ -255,7 +255,7 @@ void LoLEngine::initStaticResource() {
int tempSize;
_pakFileList = _staticres->loadStrings(kLoLIngamePakFiles, _pakFileListSize);
_charDefaults = _staticres->loadCharData(kLoLCharacterDefs, _charDefaultsSize);
- _ingameSoundIndex = (const uint16 *)_staticres->loadRawData(kLoLIngameSfxIndex, _ingameSoundIndexSize);
+ _ingameSoundIndex = (const int16 *)_staticres->loadRawDataBe16(kLoLIngameSfxIndex, _ingameSoundIndexSize);
_musicTrackMap = _staticres->loadRawData(kLoLMusicTrackMap, tempSize);
_ingameGMSoundIndex = _staticres->loadRawData(kLoLIngameGMSfxIndex, _ingameGMSoundIndexSize);
_ingameMT32SoundIndex = _staticres->loadRawData(kLoLIngameMT32SfxIndex, _ingameMT32SoundIndexSize);