diff options
author | Paul Gilbert | 2017-02-12 13:05:37 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-02-12 13:05:37 -0500 |
commit | e00fb1380949e85afc76163eee47c76027b30e10 (patch) | |
tree | f89e1eda2a45b0c7057144b67fe812c72552dbf5 /engines/titanic/sound | |
parent | a542104f3ceb69086c8b4f2ea259bacb93f719ed (diff) | |
download | scummvm-rg350-e00fb1380949e85afc76163eee47c76027b30e10.tar.gz scummvm-rg350-e00fb1380949e85afc76163eee47c76027b30e10.tar.bz2 scummvm-rg350-e00fb1380949e85afc76163eee47c76027b30e10.zip |
TITANIC: Fix method names in CMusicRoomInstrument
Diffstat (limited to 'engines/titanic/sound')
-rw-r--r-- | engines/titanic/sound/music_room_handler.cpp | 16 | ||||
-rw-r--r-- | engines/titanic/sound/music_room_handler.h | 5 | ||||
-rw-r--r-- | engines/titanic/sound/music_room_instrument.cpp | 108 | ||||
-rw-r--r-- | engines/titanic/sound/music_room_instrument.h | 21 |
4 files changed, 81 insertions, 69 deletions
diff --git a/engines/titanic/sound/music_room_handler.cpp b/engines/titanic/sound/music_room_handler.cpp index b013bb1e79..81ba1960cd 100644 --- a/engines/titanic/sound/music_room_handler.cpp +++ b/engines/titanic/sound/music_room_handler.cpp @@ -108,7 +108,7 @@ void CMusicRoomHandler::stop() { } for (int idx = 0; idx < 4; ++idx) { - _instruments[idx]->reset(); + _instruments[idx]->clear(); if (_active && _instruments[idx]) _instruments[idx]->stop(); } @@ -171,10 +171,10 @@ void CMusicRoomHandler::setMuteControl(MusicInstrument instrument, bool value) { _array1[instrument]._muteControl = value; } -void CMusicRoomHandler::trigger() { +void CMusicRoomHandler::start() { if (_active) { for (int idx = 0; idx < 4; ++idx) - _instruments[idx]->trigger(); + _instruments[idx]->start(); } } @@ -182,7 +182,7 @@ bool CMusicRoomHandler::update() { uint currentTicks = g_vm->_events->getTicksCount(); if (!_startTicks) { - trigger(); + start(); _startTicks = currentTicks; } else if (!_soundStartTicks && currentTicks >= (_startTicks + 3000)) { if (_waveFile) { @@ -260,7 +260,7 @@ void CMusicRoomHandler::fn1() { const CValuePair &vp = (*_musicObjs[instrument])[_position[instrument]]; if (vp._field0 != 0x7FFFFFFF) { int amount = getPitch(instrument, _position[instrument]); - _instruments[instrument]->start(amount); + _instruments[instrument]->update(amount); } if (ins1._directionControl == ins2._directionControl) { @@ -276,14 +276,14 @@ void CMusicRoomHandler::fn1() { bool CMusicRoomHandler::updateInstrument(MusicInstrument instrument) { int &arrIndex = _startPos[instrument]; if (arrIndex < 0) { - _instruments[instrument]->reset(); + _instruments[instrument]->clear(); return false; } const CMusicObject &mObj = *_musicObjs[instrument]; if (arrIndex >= mObj.size()) { arrIndex = -1; - _instruments[instrument]->reset(); + _instruments[instrument]->clear(); return false; } @@ -291,7 +291,7 @@ bool CMusicRoomHandler::updateInstrument(MusicInstrument instrument) { int size = static_cast<int>(fn3(instrument, arrIndex) * 44100.0) & ~1; if (vp._field0 == 0x7FFFFFFF || _array1[instrument]._muteControl) - _instruments[instrument]->setSize(size); + _instruments[instrument]->reset(size); else _instruments[instrument]->chooseWaveFile(getPitch(instrument, arrIndex), size); diff --git a/engines/titanic/sound/music_room_handler.h b/engines/titanic/sound/music_room_handler.h index 999784e4fc..eb274aa10c 100644 --- a/engines/titanic/sound/music_room_handler.h +++ b/engines/titanic/sound/music_room_handler.h @@ -67,7 +67,10 @@ private: uint _startTicks; int _volume; private: - void trigger(); + /** + * Starts music room instruments animation + */ + void start(); void updateAudio(); void fn1(); diff --git a/engines/titanic/sound/music_room_instrument.cpp b/engines/titanic/sound/music_room_instrument.cpp index 5ec158f31f..144f9d190b 100644 --- a/engines/titanic/sound/music_room_instrument.cpp +++ b/engines/titanic/sound/music_room_instrument.cpp @@ -104,7 +104,58 @@ CWaveFile *CMusicRoomInstrument::createWaveFile(const CString &name) { return _soundManager->loadSound(name); } -void CMusicRoomInstrument::start(int val) { +void CMusicRoomInstrument::start() { + if (_gameObjects[0]) { + switch (_instrument) { + case MV_PIANO: + _gameObjects[0]->playMovie(0, 29, MOVIE_STOP_PREVIOUS); + _gameObjects[2]->loadFrame(14); + _gameObjects[3]->loadFrame(22); + break; + + case MV_BELLS: + _gameObjects[0]->loadFrame(0); + _gameObjects[0]->movieSetAudioTiming(true); + break; + + case MV_SNAKE: + _field4C = 22; + _gameObjects[1]->playMovie(0, 22, 0); + _gameObjects[2]->playMovie(0, 35, MOVIE_STOP_PREVIOUS); + _gameObjects[0]->playMovie(0, 1, MOVIE_STOP_PREVIOUS); + _gameObjects[0]->playMovie(0, 1, 0); + _gameObjects[0]->playMovie(0, 1, 0); + _gameObjects[0]->playMovie(0, 1, 0); + _gameObjects[0]->playMovie(0, 1, 0); + break; + + default: + break; + } + } +} + +void CMusicRoomInstrument::stop() { + if (_gameObjects[0]) { + switch (_instrument) { + case MV_PIANO: + _gameObjects[1]->setVisible(false); + _gameObjects[2]->setVisible(false); + _gameObjects[3]->setVisible(false); + _gameObjects[0]->playMovie(29, 58, MOVIE_STOP_PREVIOUS); + break; + + case MV_BELLS: + _gameObjects[0]->stopMovie(); + break; + + default: + break; + } + } +} + +void CMusicRoomInstrument::update(int val) { if (_gameObjects[0]) { switch (_instrument) { case MV_PIANO: @@ -202,58 +253,7 @@ void CMusicRoomInstrument::start(int val) { } } -void CMusicRoomInstrument::stop() { - if (_gameObjects[0]) { - switch (_instrument) { - case MV_PIANO: - _gameObjects[1]->setVisible(false); - _gameObjects[2]->setVisible(false); - _gameObjects[3]->setVisible(false); - _gameObjects[0]->playMovie(29, 58, MOVIE_STOP_PREVIOUS); - break; - - case MV_BELLS: - _gameObjects[0]->stopMovie(); - break; - - default: - break; - } - } -} - -void CMusicRoomInstrument::trigger() { - if (_gameObjects[0]) { - switch (_instrument) { - case MV_PIANO: - _gameObjects[0]->playMovie(0, 29, MOVIE_STOP_PREVIOUS); - _gameObjects[2]->loadFrame(14); - _gameObjects[3]->loadFrame(22); - break; - - case MV_BELLS: - _gameObjects[0]->loadFrame(0); - _gameObjects[0]->movieSetAudioTiming(true); - break; - - case MV_SNAKE: - _field4C = 22; - _gameObjects[1]->playMovie(0, 22, 0); - _gameObjects[2]->playMovie(0, 35, MOVIE_STOP_PREVIOUS); - _gameObjects[0]->playMovie(0, 1, MOVIE_STOP_PREVIOUS); - _gameObjects[0]->playMovie(0, 1, 0); - _gameObjects[0]->playMovie(0, 1, 0); - _gameObjects[0]->playMovie(0, 1, 0); - _gameObjects[0]->playMovie(0, 1, 0); - break; - - default: - break; - } - } -} - -void CMusicRoomInstrument::reset() { +void CMusicRoomInstrument::clear() { _waveIndex = 0; _readPos = 0; _readIncrement = 0; @@ -261,7 +261,7 @@ void CMusicRoomInstrument::reset() { _count = 0; } -void CMusicRoomInstrument::setSize(uint total) { +void CMusicRoomInstrument::reset(uint total) { _waveIndex = -1; _readPos = 0; _readIncrement = 0; diff --git a/engines/titanic/sound/music_room_instrument.h b/engines/titanic/sound/music_room_instrument.h index 0a8ff16b35..d63fe93f20 100644 --- a/engines/titanic/sound/music_room_instrument.h +++ b/engines/titanic/sound/music_room_instrument.h @@ -97,10 +97,11 @@ public: */ void load(int index, const CString &filename, int v3); + /** * Starts the music and associated animations */ - void start(int val); + void start(); /** * Stops the music and associated animations @@ -108,13 +109,21 @@ public: void stop(); /** - * Called regularly to handle triggering the animation of the - * musical instrument associated with the instance + * Handles regular updates of the instrument, allowing associated + * objects to start animations as the music is played + */ + void update(int val); + + /** + * Clear the instrument */ - void trigger(); + void clear(); - void reset(); - void setSize(uint total); + /** + * Resets the instrument, and sets the maximum for how much data can + * be read from the wave files during each read action + */ + void reset(uint total); /** * If there is any wave file currently specified, reads it in |