diff options
author | Paul Gilbert | 2017-02-01 20:25:36 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-02-01 20:25:36 -0500 |
commit | 0d6578dac704dc1ae3c3658245ed2320fb05e05a (patch) | |
tree | 5520256f13d91c7ebc4b77efa05044669d6bccb4 | |
parent | d39404c8e8144af504f8a4dfef69f2009c05582e (diff) | |
download | scummvm-rg350-0d6578dac704dc1ae3c3658245ed2320fb05e05a.tar.gz scummvm-rg350-0d6578dac704dc1ae3c3658245ed2320fb05e05a.tar.bz2 scummvm-rg350-0d6578dac704dc1ae3c3658245ed2320fb05e05a.zip |
TITANIC: Git rid of old stubs in CMusicRoomHandler, start fleshing it out
-rw-r--r-- | engines/titanic/game/play_music_button.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/sound/music_player.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/sound/music_room_handler.cpp | 38 | ||||
-rw-r--r-- | engines/titanic/sound/music_room_handler.h | 22 |
4 files changed, 43 insertions, 21 deletions
diff --git a/engines/titanic/game/play_music_button.cpp b/engines/titanic/game/play_music_button.cpp index 604938fa23..d4d7e1cd35 100644 --- a/engines/titanic/game/play_music_button.cpp +++ b/engines/titanic/game/play_music_button.cpp @@ -64,7 +64,7 @@ bool CPlayMusicButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { } bool CPlayMusicButton::FrameMsg(CFrameMsg *msg) { - if (_flag && !CMusicRoom::_musicHandler->poll()) { + if (_flag && !CMusicRoom::_musicHandler->update()) { CMusicRoom *musicRoom = getMusicRoom(); musicRoom->stopMusic(); stopMovie(); diff --git a/engines/titanic/sound/music_player.cpp b/engines/titanic/sound/music_player.cpp index 6fb073b189..c05a5196da 100644 --- a/engines/titanic/sound/music_player.cpp +++ b/engines/titanic/sound/music_player.cpp @@ -98,7 +98,7 @@ bool CMusicPlayer::StopMusicMsg(CStopMusicMsg *msg) { } bool CMusicPlayer::FrameMsg(CFrameMsg *msg) { - if (_isActive && !CMusicRoom::_musicHandler->poll()) { + if (_isActive && !CMusicRoom::_musicHandler->update()) { getMusicRoom()->stopMusic(); _isActive = false; diff --git a/engines/titanic/sound/music_room_handler.cpp b/engines/titanic/sound/music_room_handler.cpp index fdc98b93f3..c9e4d76fe4 100644 --- a/engines/titanic/sound/music_room_handler.cpp +++ b/engines/titanic/sound/music_room_handler.cpp @@ -70,11 +70,6 @@ void CMusicRoomHandler::createWaveFile(int musicVolume) { // _waveFile = _soundManager->loadMusic() } -bool CMusicRoomHandler::poll() { - // TODO - return false; -} - void CMusicRoomHandler::stop() { if (_waveFile) { _soundManager->stopSound(_soundHandle); @@ -147,11 +142,6 @@ void CMusicRoomHandler::setMuteControl(MusicInstrument instrument, bool value) { _array1[instrument]._muteControl = value; } -bool CMusicRoomHandler::isBusy() { - // TODO: stuff - return _field108 > 0; -} - void CMusicRoomHandler::trigger() { if (_active) { for (int idx = 0; idx < 4; ++idx) @@ -159,7 +149,7 @@ void CMusicRoomHandler::trigger() { } } -void CMusicRoomHandler::update() { +bool CMusicRoomHandler::update() { uint currentTicks = g_vm->_events->getTicksCount(); if (!_startTicks) { @@ -174,6 +164,32 @@ void CMusicRoomHandler::update() { _soundStartTicks = currentTicks; } + + updateAudio(); + fn1(); + + return _field108 > 0; +} + +void CMusicRoomHandler::updateAudio() { + // TODO +} + +void CMusicRoomHandler::fn1() { + if (_active && _soundStartTicks) { + for (int idx = 0; idx < 4; ++idx) { + MusicRoomInstrument &ins1 = _array1[idx]; + MusicRoomInstrument &ins2 = _array2[idx]; + + // Is this about checking playback position? + if (_array6[idx] < 0 || ins1._muteControl || _array6[idx] >= _array3[idx]->_field4) { + _array6[idx] = -1; + continue; + } + + // TODO + } + } } } // End of namespace Titanic diff --git a/engines/titanic/sound/music_room_handler.h b/engines/titanic/sound/music_room_handler.h index 68a0c51e21..b8ab277a1e 100644 --- a/engines/titanic/sound/music_room_handler.h +++ b/engines/titanic/sound/music_room_handler.h @@ -44,6 +44,13 @@ struct MusicRoomInstrument { }; class CMusicRoomHandler { + struct Object3 { + byte *_field0; + int _field4; + Object3() : _field0(nullptr), _field4(0) {} + ~Object3() { delete[] _field0; } + }; + struct Array5Entry { int _v1; int _v2; @@ -55,7 +62,9 @@ private: CMusicWave *_musicWaves[4]; MusicRoomInstrument _array1[4]; MusicRoomInstrument _array2[4]; + Object3 *_array3[4]; Array5Entry _array5[4]; + int _array6[4]; bool _active; CWaveFile *_waveFile; int _soundHandle; @@ -66,6 +75,9 @@ private: int _volume; private: void trigger(); + + void updateAudio(); + void fn1(); public: CMusicRoomHandler(CProjectItem *project, CSoundManager *soundManager); ~CMusicRoomHandler(); @@ -81,13 +93,6 @@ public: void createWaveFile(int musicVolume); /** - * Handles regular polling the music handler - */ - bool poll(); - - bool isBusy(); - - /** * Flags whether the music handler is active */ void setActive(bool flag) { _active = flag; } @@ -149,8 +154,9 @@ public: /** * Handles regular updates + * @returns True if the music is still playing */ - void update(); + bool update(); }; } // End of namespace Titanic |