From b78b30cc75f9d666562fb532f464102fb535e14d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 4 Feb 2017 15:37:58 -0500 Subject: TITANIC: Fix CMusicObject initialization --- engines/titanic/sound/music_object.cpp | 15 +++++++-------- engines/titanic/sound/music_object.h | 8 ++++---- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'engines') diff --git a/engines/titanic/sound/music_object.cpp b/engines/titanic/sound/music_object.cpp index 0b6951b2d9..3e8d887412 100644 --- a/engines/titanic/sound/music_object.cpp +++ b/engines/titanic/sound/music_object.cpp @@ -73,21 +73,20 @@ CMusicObject::CMusicObject(int index) { for (int idx = 0; idx < count; ++idx) parser.parse(_data[idx]); - _field8 = 0x7FFFFFFF; - uint val = 0x80000000; + _minVal = 0x7FFFFFFF; + int maxVal = -0x7FFFFFFF; for (int idx = 0; idx < count; ++idx) { CValuePair &vp = _data[idx]; if (vp._field0 != 0x7FFFFFFF) { - if (vp._field0 < _field8) - _field8 = vp._field0; - if (vp._field0 > val) - val = vp._field0; + if (vp._field0 < _minVal) + _minVal = vp._field0; + if (vp._field0 > maxVal) + maxVal = vp._field0; } } - val -= _field8; - _fieldC = val; + _range = maxVal - _minVal; } CMusicObject::~CMusicObject() { diff --git a/engines/titanic/sound/music_object.h b/engines/titanic/sound/music_object.h index 67fef67b85..aef826bdb0 100644 --- a/engines/titanic/sound/music_object.h +++ b/engines/titanic/sound/music_object.h @@ -29,16 +29,16 @@ namespace Titanic { struct CValuePair { - uint _field0; - uint _field4; + int _field0; + int _field4; CValuePair() : _field0(0), _field4(0) {} }; class CMusicObject { public: Common::Array _data; - uint _field8; - uint _fieldC; + int _minVal; + int _range; public: CMusicObject(int index); ~CMusicObject(); -- cgit v1.2.3