diff options
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/carry/phonograph_cylinder.cpp | 46 | ||||
-rw-r--r-- | engines/titanic/core/game_object_desc_item.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/core/game_object_desc_item.h | 7 | ||||
-rw-r--r-- | engines/titanic/game/music_console_button.cpp | 40 | ||||
-rw-r--r-- | engines/titanic/game/play_music_button.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/gfx/music_voice_mute.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/sound/music_handler.cpp | 57 | ||||
-rw-r--r-- | engines/titanic/sound/music_handler.h | 55 | ||||
-rw-r--r-- | engines/titanic/sound/music_player.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/sound/music_room.cpp | 38 | ||||
-rw-r--r-- | engines/titanic/sound/music_room.h | 31 | ||||
-rw-r--r-- | engines/titanic/sound/qmixer.cpp | 5 |
12 files changed, 217 insertions, 74 deletions
diff --git a/engines/titanic/carry/phonograph_cylinder.cpp b/engines/titanic/carry/phonograph_cylinder.cpp index 41df050d2b..de0ed0a67c 100644 --- a/engines/titanic/carry/phonograph_cylinder.cpp +++ b/engines/titanic/carry/phonograph_cylinder.cpp @@ -167,29 +167,29 @@ bool CPhonographCylinder::SetMusicControlsMsg(CSetMusicControlsMsg *msg) { return true; CMusicRoom *musicRoom = getMusicRoom(); - musicRoom->setItem5(BELLS, _bellsMuteControl); - musicRoom->setItem2(BELLS, _bellsPitchControl); - musicRoom->setItem1(BELLS, _bellsSpeedControl); - musicRoom->setItem4(BELLS, _bellsInversionControl); - musicRoom->setItem3(BELLS, _bellsDirectionControl); - - musicRoom->setItem5(SNAKE, _snakeMuteControl); - musicRoom->setItem2(SNAKE, _snakePitchControl); - musicRoom->setItem1(SNAKE, _snakeSpeedControl); - musicRoom->setItem4(SNAKE, _snakeInversionControl); - musicRoom->setItem3(SNAKE, _snakeDirectionControl); - - musicRoom->setItem5(PIANO, _pianoMuteControl); - musicRoom->setItem2(PIANO, _pianoPitchControl); - musicRoom->setItem1(PIANO, _pianoSpeedControl); - musicRoom->setItem4(PIANO, _pianoInversionControl); - musicRoom->setItem3(PIANO, _pianoDirectionControl); - - musicRoom->setItem5(BASS, _bassMuteControl); - musicRoom->setItem2(BASS, _bassPitchControl); - musicRoom->setItem1(BASS, _bassSpeedControl); - musicRoom->setItem4(BASS, _bassInversionControl); - musicRoom->setItem3(BASS, _bassDirectionControl); + musicRoom->setMuteControl(BELLS, _bellsMuteControl); + musicRoom->setPitchControl(BELLS, _bellsPitchControl); + musicRoom->setSpeedControl(BELLS, _bellsSpeedControl); + musicRoom->setInversionControl(BELLS, _bellsInversionControl); + musicRoom->setDirectionControl(BELLS, _bellsDirectionControl); + + musicRoom->setMuteControl(SNAKE, _snakeMuteControl); + musicRoom->setPitchControl(SNAKE, _snakePitchControl); + musicRoom->setSpeedControl(SNAKE, _snakeSpeedControl); + musicRoom->setInversionControl(SNAKE, _snakeInversionControl); + musicRoom->setDirectionControl(SNAKE, _snakeDirectionControl); + + musicRoom->setMuteControl(PIANO, _pianoMuteControl); + musicRoom->setPitchControl(PIANO, _pianoPitchControl); + musicRoom->setSpeedControl(PIANO, _pianoSpeedControl); + musicRoom->setInversionControl(PIANO, _pianoInversionControl); + musicRoom->setDirectionControl(PIANO, _pianoDirectionControl); + + musicRoom->setMuteControl(BASS, _bassMuteControl); + musicRoom->setPitchControl(BASS, _bassPitchControl); + musicRoom->setSpeedControl(BASS, _bassSpeedControl); + musicRoom->setInversionControl(BASS, _bassInversionControl); + musicRoom->setDirectionControl(BASS, _bassDirectionControl); return true; } diff --git a/engines/titanic/core/game_object_desc_item.cpp b/engines/titanic/core/game_object_desc_item.cpp index 409334c9d7..a6ee7e3cf5 100644 --- a/engines/titanic/core/game_object_desc_item.cpp +++ b/engines/titanic/core/game_object_desc_item.cpp @@ -30,7 +30,7 @@ CGameObjectDescItem::CGameObjectDescItem(): CTreeItem() { void CGameObjectDescItem::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); _clipList.save(file, indent); - file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_name, indent); file->writeQuotedLine(_string2, indent); _list1.save(file, indent); _list2.save(file, indent); @@ -45,7 +45,7 @@ void CGameObjectDescItem::load(SimpleFile *file) { if (val) _clipList.load(file); - _string1 = file->readString(); + _name = file->readString(); _string2 = file->readString(); _list1.load(file); _list1.load(file); diff --git a/engines/titanic/core/game_object_desc_item.h b/engines/titanic/core/game_object_desc_item.h index 7bfecaf5a2..4f485e0d55 100644 --- a/engines/titanic/core/game_object_desc_item.h +++ b/engines/titanic/core/game_object_desc_item.h @@ -31,7 +31,7 @@ namespace Titanic { class CGameObjectDescItem : public CTreeItem { protected: - CString _string1; + CString _name; CString _string2; List<ListItem> _list1; List<ListItem> _list2; @@ -49,6 +49,11 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + /** + * Gets the name of the item, if any + */ + virtual const CString getName() const { return _name; } }; } // End of namespace Titanic diff --git a/engines/titanic/game/music_console_button.cpp b/engines/titanic/game/music_console_button.cpp index 9cf385e3a7..6a64647e92 100644 --- a/engines/titanic/game/music_console_button.cpp +++ b/engines/titanic/game/music_console_button.cpp @@ -84,48 +84,48 @@ bool CMusicConsoleButton::SetMusicControlsMsg(CSetMusicControlsMsg *msg) { CQueryMusicControlSettingMsg queryMsg; queryMsg.execute("Bells Mute Control"); - musicRoom->setItem5(BELLS, queryMsg._value == 1 ? 1 : 0); + musicRoom->setMuteControl(BELLS, queryMsg._value == 1 ? 1 : 0); queryMsg.execute("Bells Pitch Control"); - musicRoom->setItem2(BELLS, queryMsg._value); + musicRoom->setPitchControl(BELLS, queryMsg._value); queryMsg.execute("Bells Speed Control"); - musicRoom->setItem1(BELLS, queryMsg._value); + musicRoom->setSpeedControl(BELLS, queryMsg._value); queryMsg.execute("Bells Inversion Control"); - musicRoom->setItem4(BELLS, queryMsg._value == 0 ? 1 : 0); + musicRoom->setInversionControl(BELLS, queryMsg._value == 0 ? 1 : 0); queryMsg.execute("Bells Direction Control"); - musicRoom->setItem3(BELLS, queryMsg._value == 0 ? 1 : 0); + musicRoom->setDirectionControl(BELLS, queryMsg._value == 0 ? 1 : 0); queryMsg.execute("Snake Mute Control"); - musicRoom->setItem5(SNAKE, queryMsg._value == 1 ? 1 : 0); + musicRoom->setMuteControl(SNAKE, queryMsg._value == 1 ? 1 : 0); queryMsg.execute("Snake Pitch Control"); - musicRoom->setItem2(SNAKE, queryMsg._value); + musicRoom->setPitchControl(SNAKE, queryMsg._value); queryMsg.execute("Snake Speed Control"); - musicRoom->setItem1(SNAKE, queryMsg._value); + musicRoom->setSpeedControl(SNAKE, queryMsg._value); queryMsg.execute("Snake Inversion Control"); - musicRoom->setItem4(SNAKE, queryMsg._value == 0 ? 1 : 0); + musicRoom->setInversionControl(SNAKE, queryMsg._value == 0 ? 1 : 0); queryMsg.execute("Snake Direction Control"); - musicRoom->setItem3(SNAKE, queryMsg._value == 0 ? 1 : 0); + musicRoom->setDirectionControl(SNAKE, queryMsg._value == 0 ? 1 : 0); queryMsg.execute("Piano Mute Control"); - musicRoom->setItem5(PIANO, queryMsg._value == 1 ? 1 : 0); + musicRoom->setMuteControl(PIANO, queryMsg._value == 1 ? 1 : 0); queryMsg.execute("Piano Pitch Control"); - musicRoom->setItem2(PIANO, queryMsg._value); + musicRoom->setPitchControl(PIANO, queryMsg._value); queryMsg.execute("Piano Speed Control"); - musicRoom->setItem1(PIANO, queryMsg._value); + musicRoom->setSpeedControl(PIANO, queryMsg._value); queryMsg.execute("Piano Inversion Control"); - musicRoom->setItem4(PIANO, queryMsg._value == 0 ? 1 : 0); + musicRoom->setInversionControl(PIANO, queryMsg._value == 0 ? 1 : 0); queryMsg.execute("Piano Direction Control"); - musicRoom->setItem3(PIANO, queryMsg._value == 0 ? 1 : 0); + musicRoom->setDirectionControl(PIANO, queryMsg._value == 0 ? 1 : 0); queryMsg.execute("Bass Mute Control"); - musicRoom->setItem5(BASS, queryMsg._value == 1 ? 1 : 0); + musicRoom->setMuteControl(BASS, queryMsg._value == 1 ? 1 : 0); queryMsg.execute("Bass Pitch Control"); - musicRoom->setItem2(BASS, queryMsg._value); + musicRoom->setPitchControl(BASS, queryMsg._value); queryMsg.execute("Bass Speed Control"); - musicRoom->setItem1(BASS, queryMsg._value); + musicRoom->setSpeedControl(BASS, queryMsg._value); queryMsg.execute("Bass Inversion Control"); - musicRoom->setItem4(BASS, queryMsg._value == 0 ? 1 : 0); + musicRoom->setInversionControl(BASS, queryMsg._value == 0 ? 1 : 0); queryMsg.execute("Bass Direction Control"); - musicRoom->setItem3(BASS, queryMsg._value == 0 ? 1 : 0); + musicRoom->setDirectionControl(BASS, queryMsg._value == 0 ? 1 : 0); return true; } diff --git a/engines/titanic/game/play_music_button.cpp b/engines/titanic/game/play_music_button.cpp index 93416911b8..21fd3c336a 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->isBusy()) { + if (_flag && !CMusicRoom::_musicHandler->poll()) { CMusicRoom *musicRoom = getMusicRoom(); musicRoom->stopMusic(); stopMovie(); diff --git a/engines/titanic/gfx/music_voice_mute.cpp b/engines/titanic/gfx/music_voice_mute.cpp index ff59edc988..034cb4f6a6 100644 --- a/engines/titanic/gfx/music_voice_mute.cpp +++ b/engines/titanic/gfx/music_voice_mute.cpp @@ -36,7 +36,7 @@ bool CMusicVoiceMute::MusicSettingChangedMsg(CMusicSettingChangedMsg *msg) { _controlVal = 0; CMusicRoom *musicRoom = getMusicRoom(); - musicRoom->setItem5(_controlArea, _controlVal == 1 ? 1 : 0); + musicRoom->setMuteControl(_controlArea, _controlVal == 1 ? 1 : 0); loadFrame(1 - _controlVal); playSound("z#55.wav", 50); @@ -46,7 +46,7 @@ bool CMusicVoiceMute::MusicSettingChangedMsg(CMusicSettingChangedMsg *msg) { bool CMusicVoiceMute::EnterViewMsg(CEnterViewMsg *msg) { loadFrame(1 - _controlVal); CMusicRoom *musicRoom = getMusicRoom(); - musicRoom->setItem5(_controlArea, _controlVal == 1 ? 1 : 0); + musicRoom->setMuteControl(_controlArea, _controlVal == 1 ? 1 : 0); return true; } diff --git a/engines/titanic/sound/music_handler.cpp b/engines/titanic/sound/music_handler.cpp index 07c3994334..e2f2ce8dec 100644 --- a/engines/titanic/sound/music_handler.cpp +++ b/engines/titanic/sound/music_handler.cpp @@ -28,12 +28,15 @@ namespace Titanic { CMusicHandler::CMusicHandler(CProjectItem *project, CSoundManager *soundManager) : _project(project), _soundManager(soundManager), _stopWaves(false), - _soundHandle(-1), _waveFile(nullptr) { + _soundHandle(-1), _waveFile(nullptr), _soundVolume(100), _ticks(0), + _field108(0) { Common::fill(&_musicWaves[0], &_musicWaves[4], (CMusicWave *)nullptr); } CMusicHandler::~CMusicHandler() { stop(); + for (int idx = 0; idx < 4; ++idx) + delete _musicWaves[idx]; } CMusicWave *CMusicHandler::createMusicWave(int waveIndex, int count) { @@ -58,7 +61,12 @@ CMusicWave *CMusicHandler::createMusicWave(int waveIndex, int count) { return _musicWaves[waveIndex]; } -bool CMusicHandler::isBusy() { +void CMusicHandler::createWaveFile(int musicVolume) { + _soundVolume = musicVolume; +// _waveFile = _soundManager->loadMusic() +} + +bool CMusicHandler::poll() { // TODO return false; } @@ -82,4 +90,49 @@ bool CMusicHandler::checkSound(int index) const { return false; } +void CMusicHandler::setSpeedControl2(MusicControlArea area, int value) { + if (area >= 0 && area <= 3 && value >= -2 && value <= 2) + _array2[area]._speedControl = value; +} + +void CMusicHandler::setPitchControl2(MusicControlArea area, int value) { + if (area >= 0 && area <= 3 && value >= -2 && value <= 2) + _array2[area]._pitchControl = value * 3; +} + +void CMusicHandler::setInversionControl2(MusicControlArea area, int value) { + if (area >= 0 && area <= 3 && value >= -2 && value <= 2) + _array2[area]._inversionControl = value; +} + +void CMusicHandler::setDirectionControl2(MusicControlArea area, int value) { + if (area >= 0 && area <= 3 && value >= -2 && value <= 2) + _array2[area]._directionControl = value; +} + +void CMusicHandler::setPitchControl(MusicControlArea area, int value) { + if (area >= 0 && area <= 3 && value >= -2 && value <= 2) + _array1[area]._pitchControl = value; +} + +void CMusicHandler::setSpeedControl(MusicControlArea area, int value) { + if (area >= 0 && area <= 3 && value >= -2 && value <= 2) + _array1[area]._speedControl = value; +} + +void CMusicHandler::setDirectionControl(MusicControlArea area, int value) { + if (area >= 0 && area <= 3 && value >= -2 && value <= 2) + _array1[area]._directionControl = value; +} + +void CMusicHandler::setInversionControl(MusicControlArea area, int value) { + if (area >= 0 && area <= 3 && value >= -2 && value <= 2) + _array1[area]._inversionControl = value; +} + +void CMusicHandler::setMuteControl(MusicControlArea area, int value) { + if (area >= 0 && area <= 3 && value >= -2 && value <= 2) + _array1[area]._muteControl = value; +} + } // End of namespace Titanic diff --git a/engines/titanic/sound/music_handler.h b/engines/titanic/sound/music_handler.h index 6792844cb5..27b429d523 100644 --- a/engines/titanic/sound/music_handler.h +++ b/engines/titanic/sound/music_handler.h @@ -31,14 +31,36 @@ namespace Titanic { class CProjectItem; class CSoundManager; +enum MusicControlArea { BELLS = 0, SNAKE = 1, PIANO = 2, BASS = 3 }; + class CMusicHandler { + struct Controls { + int _pitchControl; + int _speedControl; + int _directionControl; + int _inversionControl; + int _muteControl; + Controls() : _pitchControl(0), _speedControl(0), _directionControl(0), + _inversionControl(0), _muteControl(0) {} + }; + struct Array5Entry { + int _v1; + int _v2; + Array5Entry() : _v1(0), _v2(0) {} + }; private: CProjectItem *_project; CSoundManager *_soundManager; CMusicWave *_musicWaves[4]; + Controls _array1[4]; + Controls _array2[4]; + Array5Entry _array5[4]; bool _stopWaves; CWaveFile *_waveFile; int _soundHandle; + int _soundVolume; + uint _ticks; + int _field108; public: CMusicHandler(CProjectItem *project, CSoundManager *soundManager); ~CMusicHandler(); @@ -51,7 +73,12 @@ public: */ CMusicWave *createMusicWave(int waveIndex, int count); - bool isBusy(); + void createWaveFile(int musicVolume); + + /** + * Handles regular polling the music handler + */ + bool poll(); /** * Flags whether the loaded music waves will be stopped when the @@ -65,6 +92,32 @@ public: void stop(); bool checkSound(int index) const; + + /** + * Set a setting + */ + void setSpeedControl2(MusicControlArea area, int value); + + /** + * Set a setting + */ + void setPitchControl2(MusicControlArea area, int value); + + /** + * Set a setting + */ + void setInversionControl2(MusicControlArea area, int value); + + /** + * Set a setting + */ + void setDirectionControl2(MusicControlArea area, int value); + + void setPitchControl(MusicControlArea area, int value); + void setSpeedControl(MusicControlArea area, int value); + void setDirectionControl(MusicControlArea area, int value); + void setInversionControl(MusicControlArea area, int value); + void setMuteControl(MusicControlArea area, int value); }; } // End of namespace Titanic diff --git a/engines/titanic/sound/music_player.cpp b/engines/titanic/sound/music_player.cpp index cd764c7f93..9106160d1f 100644 --- a/engines/titanic/sound/music_player.cpp +++ b/engines/titanic/sound/music_player.cpp @@ -97,7 +97,7 @@ bool CMusicPlayer::StopMusicMsg(CStopMusicMsg *msg) { } bool CMusicPlayer::FrameMsg(CFrameMsg *msg) { - if (_isActive && !CMusicRoom::_musicHandler->isBusy()) { + if (_isActive && !CMusicRoom::_musicHandler->poll()) { getMusicRoom()->stopMusic(); _isActive = false; diff --git a/engines/titanic/sound/music_room.cpp b/engines/titanic/sound/music_room.cpp index 2e4ad904fa..29772cc65f 100644 --- a/engines/titanic/sound/music_room.cpp +++ b/engines/titanic/sound/music_room.cpp @@ -32,7 +32,7 @@ CMusicHandler *CMusicRoom::_musicHandler; CMusicRoom::CMusicRoom(CGameManager *gameManager) : _gameManager(gameManager) { _sound = &_gameManager->_sound; - _items.resize(4); + _controls.resize(4); } CMusicRoom::~CMusicRoom() { @@ -52,8 +52,40 @@ void CMusicRoom::destroyMusicHandler() { _musicHandler = nullptr; } -void CMusicRoom::startMusic(int musicId) { - // TODO +void CMusicRoom::startMusic(int volume) { + if (_musicHandler) { + _musicHandler->setSpeedControl2(BELLS, 0); + _musicHandler->setSpeedControl2(SNAKE, 1); + _musicHandler->setSpeedControl2(PIANO, -1); + _musicHandler->setSpeedControl2(BASS, -2); + + _musicHandler->setPitchControl2(BELLS, 1); + _musicHandler->setPitchControl2(SNAKE, 2); + _musicHandler->setPitchControl2(PIANO, 0); + _musicHandler->setPitchControl2(BELLS, 1); + + _musicHandler->setInversionControl2(BELLS, 1); + _musicHandler->setInversionControl2(SNAKE, 0); + _musicHandler->setInversionControl2(PIANO, 1); + _musicHandler->setInversionControl2(BASS, 0); + + _musicHandler->setDirectionControl2(BELLS, 0); + _musicHandler->setDirectionControl2(SNAKE, 0); + _musicHandler->setDirectionControl2(PIANO, 1); + _musicHandler->setDirectionControl2(BASS, 1); + + for (MusicControlArea idx = BELLS; idx <= BASS; + idx = (MusicControlArea)((int)idx + 1)) { + Controls &controls = _controls[idx]; + _musicHandler->setSpeedControl(idx, controls._speedControl); + _musicHandler->setPitchControl(idx, controls._pitchControl); + _musicHandler->setDirectionControl(idx, controls._directionControl); + _musicHandler->setInversionControl(idx, controls._inversionControl); + _musicHandler->setMuteControl(idx, controls._muteControl); + } + + _musicHandler->createWaveFile(volume); + } } void CMusicRoom::stopMusic() { diff --git a/engines/titanic/sound/music_room.h b/engines/titanic/sound/music_room.h index 5f0b271ab3..74f28acd29 100644 --- a/engines/titanic/sound/music_room.h +++ b/engines/titanic/sound/music_room.h @@ -31,20 +31,19 @@ namespace Titanic { class CGameManager; class CSound; -enum MusicControlArea { BELLS = 0, SNAKE = 1, PIANO = 2, BASS = 3 }; - class CMusicRoom { - struct Entry { - uint _val1; - uint _val2; - uint _val3; - uint _val4; - uint _val5; + struct Controls { + int _speedControl; + int _pitchControl; + int _directionControl; + int _inversionControl; + int _muteControl; - Entry() : _val1(0), _val2(0), _val3(0), _val4(0), _val5(0) {} + Controls() : _speedControl(0), _pitchControl(0), _directionControl(0), + _inversionControl(0), _muteControl(0) {} }; private: - Common::Array<Entry> _items; + Common::Array<Controls> _controls; public: static CMusicHandler *_musicHandler; public: @@ -64,16 +63,16 @@ public: */ void destroyMusicHandler(); - void setItem1(MusicControlArea index, int val) { _items[index]._val1 = val; } - void setItem2(MusicControlArea index, int val) { _items[index]._val2 = val; } - void setItem3(MusicControlArea index, int val) { _items[index]._val3 = val; } - void setItem4(MusicControlArea index, int val) { _items[index]._val4 = val; } - void setItem5(MusicControlArea index, int val) { _items[index]._val5 = val; } + void setSpeedControl(MusicControlArea index, int val) { _controls[index]._speedControl = val; } + void setPitchControl(MusicControlArea index, int val) { _controls[index]._pitchControl = val; } + void setDirectionControl(MusicControlArea index, int val) { _controls[index]._directionControl = val; } + void setInversionControl(MusicControlArea index, int val) { _controls[index]._inversionControl = val; } + void setMuteControl(MusicControlArea index, int val) { _controls[index]._muteControl = val; } /** * Start playing a given music number */ - void startMusic(int musicId); + void startMusic(int volume = 100); /** * Stop playing music diff --git a/engines/titanic/sound/qmixer.cpp b/engines/titanic/sound/qmixer.cpp index 145d142b2d..b5eb6d0b5c 100644 --- a/engines/titanic/sound/qmixer.cpp +++ b/engines/titanic/sound/qmixer.cpp @@ -67,7 +67,8 @@ void QMixer::qsWaveMixSetPanRate(int iChannel, uint flags, uint rate) { } void QMixer::qsWaveMixSetVolume(int iChannel, uint flags, uint volume) { - // Not currently implemented in ScummVM + + } void QMixer::qsWaveMixSetSourcePosition(int iChannel, uint flags, const QSVECTOR &position) { @@ -170,4 +171,4 @@ void QMixer::qsWaveMixPump() { } } -} // End of namespace Titanic z +} // End of namespace Titanic |