diff options
author | Paul Gilbert | 2017-02-05 23:36:57 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-02-05 23:36:57 -0500 |
commit | c45d5442d13d4a7e9794c2db2ad27d91cfed0b52 (patch) | |
tree | e94467b1769c002a9841f23a3b98b06c6bfe4e5d /engines/titanic/sound | |
parent | 0ad57c0fed30bf404165b90da86bf7862da4c59e (diff) | |
download | scummvm-rg350-c45d5442d13d4a7e9794c2db2ad27d91cfed0b52.tar.gz scummvm-rg350-c45d5442d13d4a7e9794c2db2ad27d91cfed0b52.tar.bz2 scummvm-rg350-c45d5442d13d4a7e9794c2db2ad27d91cfed0b52.zip |
TITANIC: Fix crash in CMusicWave setupArray
Diffstat (limited to 'engines/titanic/sound')
-rw-r--r-- | engines/titanic/sound/music_wave.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/engines/titanic/sound/music_wave.cpp b/engines/titanic/sound/music_wave.cpp index 5a1ae73884..a1dd460d0f 100644 --- a/engines/titanic/sound/music_wave.cpp +++ b/engines/titanic/sound/music_wave.cpp @@ -322,14 +322,14 @@ void CMusicWave::processArray(int index, int size) { } void CMusicWave::setupArray(int minVal, int maxVal) { + // Delete any prior array and recreate it delete[] _array; - // TODO: Figure out if the weird shift can be represented as a simpler equation - uint32 arrSize = ((uint32)minVal << 29) - (uint32)minVal + maxVal; - - _array = new double[arrSize / 8]; - _arrayIndex = maxVal; + int arrSize = maxVal - minVal + 1; + _array = new double[arrSize]; + _arrayIndex = ABS(minVal); + // Setup array contents _array[_arrayIndex] = 1.0; double val = 1.0594634; |