Skip to content

Commit

Permalink
NEVERHOOD: Implement the music toggle menu button
Browse files Browse the repository at this point in the history
  • Loading branch information
bluegr committed Sep 17, 2013
1 parent c1226b7 commit 783aa99
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions engines/neverhood/menumodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion engines/neverhood/menumodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class MainMenu : public Scene {
public:
MainMenu(NeverhoodEngine *vm, Module *parentModule);
protected:
Sprite *_musicOnButton;
uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
};

Expand Down
1 change: 1 addition & 0 deletions engines/neverhood/neverhood.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions engines/neverhood/neverhood.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,12 @@ class NeverhoodEngine : public ::Engine {
NPoint getMousePos();

void toggleSoundUpdate(bool state) { _updateSound = state; }
void toggleMusic(bool state) { _enableMusic = state; }
bool musicIsEnabled() { return _enableMusic; }

private:
bool _updateSound;
bool _enableMusic;

};

Expand Down

0 comments on commit 783aa99

Please sign in to comment.