[Scummvm-git-logs] scummvm master -> c45d5442d13d4a7e9794c2db2ad27d91cfed0b52

dreammaster dreammaster at scummvm.org
Mon Feb 6 05:37:06 CET 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c45d5442d1 TITANIC: Fix crash in CMusicWave setupArray


Commit: c45d5442d13d4a7e9794c2db2ad27d91cfed0b52
    https://github.com/scummvm/scummvm/commit/c45d5442d13d4a7e9794c2db2ad27d91cfed0b52
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-02-05T23:36:57-05:00

Commit Message:
TITANIC: Fix crash in CMusicWave setupArray

Changed paths:
    engines/titanic/sound/music_wave.cpp


diff --git a/engines/titanic/sound/music_wave.cpp b/engines/titanic/sound/music_wave.cpp
index 5a1ae73..a1dd460 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;





More information about the Scummvm-git-logs mailing list