diff options
author | Filippos Karapetis | 2013-09-17 03:26:12 +0300 |
---|---|---|
committer | Filippos Karapetis | 2013-09-17 03:27:12 +0300 |
commit | 783aa9977c544c7e63aef3dac4fff85abcb682ce (patch) | |
tree | 67d14af6380a52c7490ca6ec8e6d3759f1cad3b4 /engines | |
parent | c1226b7d4a305dba7b62b046be4d3fe728a8209d (diff) | |
download | scummvm-rg350-783aa9977c544c7e63aef3dac4fff85abcb682ce.tar.gz scummvm-rg350-783aa9977c544c7e63aef3dac4fff85abcb682ce.tar.bz2 scummvm-rg350-783aa9977c544c7e63aef3dac4fff85abcb682ce.zip |
NEVERHOOD: Implement the music toggle menu button
Diffstat (limited to 'engines')
-rw-r--r-- | engines/neverhood/menumodule.cpp | 7 | ||||
-rw-r--r-- | engines/neverhood/menumodule.h | 1 | ||||
-rw-r--r-- | engines/neverhood/neverhood.cpp | 1 | ||||
-rw-r--r-- | engines/neverhood/neverhood.h | 3 |
4 files changed, 8 insertions, 4 deletions
diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index 7bf64a4602..86434452f5 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -160,7 +160,8 @@ void MenuModule::updateScene() { createScene(MAKING_OF, -1); break; case kMainMenuToggleMusic: - // TODO Toggle music 0048A367 + _vm->toggleMusic(!_vm->musicIsEnabled()); + _vm->_mixer->muteSoundType(Audio::Mixer::kMusicSoundType, !_vm->musicIsEnabled()); createScene(MAIN_MENU, -1); break; case kMainMenuDeleteGame: @@ -356,8 +357,8 @@ MainMenu::MainMenu(NeverhoodEngine *vm, Module *parentModule) insertStaticSprite(0x41137051, 100); insertStaticSprite(0xC10B2015, 100); - // TODO Only if music is enabled - _musicOnButton = insertStaticSprite(0x0C24C0EE, 100); + if (!_vm->musicIsEnabled()) + insertStaticSprite(0x0C24C0EE, 100); // "Music is off" button for (uint buttonIndex = 0; buttonIndex < 9; ++buttonIndex) { Sprite *menuButton = insertSprite<MenuButton>(this, buttonIndex, diff --git a/engines/neverhood/menumodule.h b/engines/neverhood/menumodule.h index f201654ceb..9da9c849a9 100644 --- a/engines/neverhood/menumodule.h +++ b/engines/neverhood/menumodule.h @@ -79,7 +79,6 @@ class MainMenu : public Scene { public: MainMenu(NeverhoodEngine *vm, Module *parentModule); protected: - Sprite *_musicOnButton; uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index 061e6d1279..1fb32a1834 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -109,6 +109,7 @@ Common::Error NeverhoodEngine::run() { _isSaveAllowed = true; _updateSound = true; + _enableMusic = !_mixer->isSoundTypeMuted(Audio::Mixer::kMusicSoundType); if (isDemo()) { // Adjust this navigation list for the demo version diff --git a/engines/neverhood/neverhood.h b/engines/neverhood/neverhood.h index 5643e345ad..9b65f6740e 100644 --- a/engines/neverhood/neverhood.h +++ b/engines/neverhood/neverhood.h @@ -135,9 +135,12 @@ public: NPoint getMousePos(); void toggleSoundUpdate(bool state) { _updateSound = state; } + void toggleMusic(bool state) { _enableMusic = state; } + bool musicIsEnabled() { return _enableMusic; } private: bool _updateSound; + bool _enableMusic; }; |