diff options
author | Paul Gilbert | 2017-02-04 17:20:37 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-02-04 17:20:37 -0500 |
commit | 8e87dc1754a2111d2db252ead2264157c82d0159 (patch) | |
tree | 6172094bbdc806a5169e3c86f34bb0d11618414b /engines | |
parent | b78b30cc75f9d666562fb532f464102fb535e14d (diff) | |
download | scummvm-rg350-8e87dc1754a2111d2db252ead2264157c82d0159.tar.gz scummvm-rg350-8e87dc1754a2111d2db252ead2264157c82d0159.tar.bz2 scummvm-rg350-8e87dc1754a2111d2db252ead2264157c82d0159.zip |
TITANIC: Implemented CMusicRoomHandler fn1 and getPitch
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/sound/music_object.h | 2 | ||||
-rw-r--r-- | engines/titanic/sound/music_room_handler.cpp | 27 | ||||
-rw-r--r-- | engines/titanic/sound/music_room_handler.h | 2 |
3 files changed, 29 insertions, 2 deletions
diff --git a/engines/titanic/sound/music_object.h b/engines/titanic/sound/music_object.h index aef826bdb0..6159a034d8 100644 --- a/engines/titanic/sound/music_object.h +++ b/engines/titanic/sound/music_object.h @@ -45,7 +45,7 @@ public: int size() const { return _data.size(); } - const CValuePair &operator[](int index) { return _data[index]; } + const CValuePair &operator[](int index) const { return _data[index]; } }; class CMusicParser { diff --git a/engines/titanic/sound/music_room_handler.cpp b/engines/titanic/sound/music_room_handler.cpp index 5cd02018c4..ea1aaf2b78 100644 --- a/engines/titanic/sound/music_room_handler.cpp +++ b/engines/titanic/sound/music_room_handler.cpp @@ -251,7 +251,17 @@ void CMusicRoomHandler::fn1() { if (val >= musicWave->_floatVal) { _array5[idx] += fn3(idx, _array6[idx]); - //_array3[idx]->_data[_array6[idx]]; + const CValuePair &vp = (*_array3[idx])[_array6[idx]]; + if (vp._field0 != 0x7FFFFFFF) { + int amount = getPitch(idx, _array6[idx]); + _musicWaves[idx]->start(amount); + } + + if (ins1._directionControl == ins2._directionControl) { + _array6[idx]++; + } else { + _array6[idx]--; + } } } } @@ -267,4 +277,19 @@ double CMusicRoomHandler::fn3(int index, int val) { return 0; } +int CMusicRoomHandler::getPitch(int index, int arrIndex) { + const CMusicObject &mObj = *_array3[index]; + const CValuePair &vp = mObj[arrIndex]; + int val = vp._field0; + const MusicRoomInstrument &ins1 = _array1[index]; + const MusicRoomInstrument &ins2 = _array2[index]; + + if (ins1._inversionControl != ins2._inversionControl) { + val -= mObj._minVal * 2 + mObj._range; + } + + val += ins1._pitchControl + ins2._pitchControl; + return val; +} + } // End of namespace Titanic diff --git a/engines/titanic/sound/music_room_handler.h b/engines/titanic/sound/music_room_handler.h index 52495bc7d7..dd8b62efe1 100644 --- a/engines/titanic/sound/music_room_handler.h +++ b/engines/titanic/sound/music_room_handler.h @@ -73,6 +73,8 @@ private: void fn1(); bool fn2(); double fn3(int index, int val); + int getPitch(int index, int arrIndex); + public: CMusicRoomHandler(CProjectItem *project, CSoundManager *soundManager); ~CMusicRoomHandler(); |