Skip to content

Commit

Permalink
NEVERHOOD: Stop sound updates while the main menu is active
Browse files Browse the repository at this point in the history
  • Loading branch information
bluegr committed Jun 26, 2013
1 parent e26fb8e commit 3d37328
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions engines/neverhood/menumodule.cpp
Expand Up @@ -73,12 +73,14 @@ MenuModule::MenuModule(NeverhoodEngine *vm, Module *parentModule, int which)

_savedPaletteData = _vm->_screen->getPaletteData();
_vm->_mixer->pauseAll(true);
_vm->toggleSoundUpdate(false);

createScene(MAIN_MENU, -1);
}

MenuModule::~MenuModule() {
_vm->_mixer->pauseAll(false);
_vm->toggleSoundUpdate(true);
_vm->_screen->setPaletteData(_savedPaletteData);
}

Expand Down
11 changes: 8 additions & 3 deletions engines/neverhood/neverhood.cpp
Expand Up @@ -105,7 +105,8 @@ Common::Error NeverhoodEngine::run() {
_gameModule = new GameModule(this);

_isSaveAllowed = true;

_updateSound = true;

if (isDemo()) {
// Adjust this navigation list for the demo version
NavigationList *navigationList = _staticData->getNavigationList(0x004B67E8);
Expand Down Expand Up @@ -186,8 +187,12 @@ void NeverhoodEngine::mainLoop() {
_screen->update();
nextFrameTime = _screen->getNextFrameTime();
};
_soundMan->update();
_audioResourceMan->updateMusic();

if (_updateSound) {
_soundMan->update();
_audioResourceMan->updateMusic();
}

_system->updateScreen();
_system->delayMillis(10);
}
Expand Down
5 changes: 4 additions & 1 deletion engines/neverhood/neverhood.h
Expand Up @@ -134,7 +134,10 @@ class NeverhoodEngine : public ::Engine {
int16 getMouseY() const { return _mouseY; }
NPoint getMousePos();

public:
void toggleSoundUpdate(bool state) { _updateSound = state; }

private:
bool _updateSound;

};

Expand Down

0 comments on commit 3d37328

Please sign in to comment.