diff options
author | Paul Gilbert | 2017-02-03 20:49:17 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-02-03 20:49:17 -0500 |
commit | 9e0959265e81775cb228c179febf29302b70067c (patch) | |
tree | 49d89db567f0ebcad73adcd3831ac47a8472f906 /engines/titanic | |
parent | 74696f6c9267282bf14147dd54a98f63697bd9f0 (diff) | |
download | scummvm-rg350-9e0959265e81775cb228c179febf29302b70067c.tar.gz scummvm-rg350-9e0959265e81775cb228c179febf29302b70067c.tar.bz2 scummvm-rg350-9e0959265e81775cb228c179febf29302b70067c.zip |
TITANIC: Implementing more CMusicRoomHandler code
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/sound/music_room_handler.cpp | 18 | ||||
-rw-r--r-- | engines/titanic/sound/music_room_handler.h | 11 | ||||
-rw-r--r-- | engines/titanic/sound/music_wave.cpp | 18 | ||||
-rw-r--r-- | engines/titanic/sound/music_wave.h | 4 |
4 files changed, 27 insertions, 24 deletions
diff --git a/engines/titanic/sound/music_room_handler.cpp b/engines/titanic/sound/music_room_handler.cpp index ae08af7f69..4a76def5f4 100644 --- a/engines/titanic/sound/music_room_handler.cpp +++ b/engines/titanic/sound/music_room_handler.cpp @@ -37,6 +37,7 @@ CMusicRoomHandler::CMusicRoomHandler(CProjectItem *project, CSoundManager *sound for (int idx = 0; idx < 4; ++idx) _array3[idx] = new Object3(); Common::fill(&_array4[0], &_array4[4], 0); + Common::fill(&_array5[0], &_array5[4], 0.0); Common::fill(&_array6[0], &_array6[4], 0); _audioBuffer = new CAudioBuffer(176400); @@ -87,7 +88,7 @@ void CMusicRoomHandler::setVolume(int volume) { } _array6[idx] = _array4[idx]; - _array5[idx].clear(); + _array5[idx] = 0.0; } _field108 = 4; @@ -236,6 +237,7 @@ void CMusicRoomHandler::fn1() { for (int idx = 0; idx < 4; ++idx) { MusicRoomInstrument &ins1 = _array1[idx]; MusicRoomInstrument &ins2 = _array2[idx]; + CMusicWave *musicWave = _musicWaves[idx]; // Is this about checking playback position? if (_array6[idx] < 0 || ins1._muteControl || _array6[idx] >= _array3[idx]->_field4) { @@ -243,7 +245,14 @@ void CMusicRoomHandler::fn1() { continue; } - // TODO + uint ticks = g_vm->_events->getTicksCount() - _soundStartTicks; + double val = (double)ticks * 0.001 - 0.6; + + if (val >= musicWave->_floatVal) { + _array5[idx] += fn3(idx, _array6[idx]); + + // TODO + } } } } @@ -253,4 +262,9 @@ bool CMusicRoomHandler::fn2() { return false; } +double CMusicRoomHandler::fn3(int index, int val) { + // TODO + return 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/sound/music_room_handler.h b/engines/titanic/sound/music_room_handler.h index 81f50e4b12..ed8c7f59db 100644 --- a/engines/titanic/sound/music_room_handler.h +++ b/engines/titanic/sound/music_room_handler.h @@ -51,14 +51,6 @@ class CMusicRoomHandler { Object3() : _field0(nullptr), _field4(0) {} ~Object3() { delete[] _field0; } }; - - struct Array5Entry { - int _v1; - int _v2; - Array5Entry() : _v1(0), _v2(0) {} - - void clear() { _v1 = _v2 = 0; } - }; private: CProjectItem *_project; CSoundManager *_soundManager; @@ -67,7 +59,7 @@ private: MusicRoomInstrument _array2[4]; Object3 *_array3[4]; int _array4[4]; - Array5Entry _array5[4]; + double _array5[4]; int _array6[4]; bool _active; @@ -85,6 +77,7 @@ private: void updateAudio(); void fn1(); bool fn2(); + double fn3(int index, int val); public: CMusicRoomHandler(CProjectItem *project, CSoundManager *soundManager); ~CMusicRoomHandler(); diff --git a/engines/titanic/sound/music_wave.cpp b/engines/titanic/sound/music_wave.cpp index 3c4a4cf013..cbb4fbf3d6 100644 --- a/engines/titanic/sound/music_wave.cpp +++ b/engines/titanic/sound/music_wave.cpp @@ -47,7 +47,7 @@ void CMusicWave::deinit() { CMusicWave::CMusicWave(CProjectItem *project, CSoundManager *soundManager, MusicWaveInstrument instrument) : _soundManager(soundManager), _instrument(instrument) { Common::fill(&_gameObjects[0], &_gameObjects[4], (CGameObject *)nullptr); - _field20 = _field24 = 0; + _floatVal = 0.0; _field34 = -1; _field38 = 0; _field3C = 0; @@ -61,8 +61,7 @@ CMusicWave::CMusicWave(CProjectItem *project, CSoundManager *soundManager, Music _gameObjects[1] = static_cast<CGameObject *>(_project->findByName("Piano Mouth")); _gameObjects[2] = static_cast<CGameObject *>(_project->findByName("Piano Left Arm")); _gameObjects[3] = static_cast<CGameObject *>(_project->findByName("Piano Right Arm")); - _field20 = 0xCCCCCCCD; - _field24 = 0x3FDCCCCC; + _floatVal = 0.45; break; case MV_BASS: @@ -71,15 +70,14 @@ CMusicWave::CMusicWave(CProjectItem *project, CSoundManager *soundManager, Music case MV_BELLS: _gameObjects[0] = static_cast<CGameObject *>(_project->findByName("Tubular Bells")); - _field20 = 0x9999999A; - _field24 = 0x3FD99999; + _floatVal = 0.4; + break; case MV_SNAKE: _gameObjects[0] = static_cast<CGameObject *>(_project->findByName("Snake Hammer")); _gameObjects[1] = static_cast<CGameObject *>(_project->findByName("Snake Glass")); _gameObjects[2] = static_cast<CGameObject *>(_project->findByName("Snake Head")); - _field20 = 0x5C28F5C3; - _field24 = 0x3FC5C28F; + _floatVal = 0.17; break; } } @@ -158,13 +156,11 @@ void CMusicWave::start(int val) { case 60: _gameObjects[0]->movieSetAudioTiming(true); _gameObjects[0]->playMovie(0, 512, MOVIE_STOP_PREVIOUS); - _field20 = 0x33333333; - _field24 = 0x3FE33333; + _floatVal = 0.6; case 62: _gameObjects[0]->playMovie(828, 1023, MOVIE_STOP_PREVIOUS); - _field20 = 0x33333333; - _field24 = 0x3FD33333; + _floatVal = 0.3; break; case 63: diff --git a/engines/titanic/sound/music_wave.h b/engines/titanic/sound/music_wave.h index aa95770dac..b65363cef3 100644 --- a/engines/titanic/sound/music_wave.h +++ b/engines/titanic/sound/music_wave.h @@ -52,8 +52,6 @@ private: MusicWaveInstrument _instrument; CProjectItem *_project; CGameObject *_gameObjects[4]; - int _field20; - int _field24; int _field34; int _field38; int _field3C; @@ -66,6 +64,8 @@ private: */ CWaveFile *createWaveFile(const CString &name); public: + double _floatVal; +public: /** * Handles initialization of static fields */ |