diff options
author | Paul Gilbert | 2011-05-02 21:30:20 +1000 |
---|---|---|
committer | Paul Gilbert | 2011-05-02 21:30:20 +1000 |
commit | 765a82dd9699bb952803c9941b5f942a82c16c7c (patch) | |
tree | d7fdd787e66424e58f1ad75354318d24579fd953 /engines/tsage/sound.cpp | |
parent | bc3469eef29b95fcdd002ba7d64b6f041d52ea77 (diff) | |
download | scummvm-rg350-765a82dd9699bb952803c9941b5f942a82c16c7c.tar.gz scummvm-rg350-765a82dd9699bb952803c9941b5f942a82c16c7c.tar.bz2 scummvm-rg350-765a82dd9699bb952803c9941b5f942a82c16c7c.zip |
TSAGE: Bugfixes for extracting sound data properties
Diffstat (limited to 'engines/tsage/sound.cpp')
-rw-r--r-- | engines/tsage/sound.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index 834395e7da..a8dcb5cd07 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -38,8 +38,12 @@ SoundManager::SoundManager() { _minVersion = 0x102; _maxVersion = 0x10A; - for (int i = 0; i < 16; ++i) + for (int i = 0; i < SOUND_ARR_SIZE; ++i) { + _field89[i] = 0; + _groupList[i] = 0; + _fieldE9[i] = 0; _field109[i] = 0; + } _groupMask = 0; _volume = 127; @@ -90,12 +94,12 @@ void SoundManager::listenerSynchronise(Serialiser &s) { } void SoundManager::checkResVersion(const byte *soundData) { - int minVersion = READ_LE_UINT16(soundData + 4); - int maxVersion = READ_LE_UINT16(soundData + 6); + int maxVersion = READ_LE_UINT16(soundData + 4); + int minVersion = READ_LE_UINT16(soundData + 6); - if (_globals->_soundManager._minVersion >= maxVersion) + if (_globals->_soundManager._minVersion < minVersion) error("Attempt to play/prime sound resource that is too new"); - if (_globals->_soundManager._minVersion > minVersion) + if (_globals->_soundManager._minVersion > maxVersion) error("Attempt to play/prime sound resource that is too old"); } @@ -216,7 +220,7 @@ int SoundManager::_sfDetermineGroup(const byte *soundData) { if ((v & _globals->_soundManager._groupMask) == v) return v; - p = soundData + 6 + (READ_LE_UINT16(p + 4) * 4); + p += 6 + (READ_LE_UINT16(p + 4) * 4); } return 0; @@ -300,7 +304,7 @@ void SoundManager::_sfExtractTrackInfo(trackInfoStruct *trackInfo, const byte *s } } - p = soundData + 6 + (READ_LE_UINT16(p + 4) * 4); + p += 6 + (READ_LE_UINT16(p + 4) * 4); } } @@ -308,6 +312,14 @@ void SoundManager::_sfTerminate() { } +void SoundManager::_sfExtractGroupMask() { + uint32 mask = 0; + for (int idx = 0; idx < SOUND_ARR_SIZE; ++idx) + mask |= _globals->_soundManager._groupList[idx]; + + _globals->_soundManager._groupMask = mask; +} + /*--------------------------------------------------------------------------*/ Sound::Sound() { |