Skip to content

Commit

Permalink
NEVERHOOD: Play a single sound when losing the memory puzzle (bug #6672)
Browse files Browse the repository at this point in the history
When the memory puzzle is reset, each revealed tile gets hidden again.
When a lot of tiles were hidden, the multiple clicking sounds would
fill the available sound slots. To avoid this, only a single click is
sounded when losing
  • Loading branch information
bluegr committed Jul 6, 2014
1 parent 23f5822 commit 4207fbd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions engines/neverhood/modules/module1400.cpp
Expand Up @@ -709,13 +709,14 @@ Scene1405::Scene1405(NeverhoodEngine *vm, Module *parentModule)

void Scene1405::update() {
Scene::update();
// Check if the player chose a wrong tile, in which case the whole grid gets reset
if (_countdown != 0 && (--_countdown == 0)) {
_tilesLeft = 48;
_tiles[_firstTileIndex]->hide();
_tiles[_secondTileIndex]->hide();
_tiles[_firstTileIndex]->hide(true);
_tiles[_secondTileIndex]->hide(false);
for (uint32 i = 0; i < 48; i++) {
if (getSubVar(VA_IS_TILE_MATCH, i)) {
_tiles[i]->hide();
_tiles[i]->hide(false);
setSubVar(VA_IS_TILE_MATCH, i, 0);
}
}
Expand Down
5 changes: 3 additions & 2 deletions engines/neverhood/modules/module1400_sprites.cpp
Expand Up @@ -873,10 +873,11 @@ void AsScene1405Tile::show() {
}
}

void AsScene1405Tile::hide() {
void AsScene1405Tile::hide(bool playClickSound) {
if (_isShowing) {
_isShowing = false;
playSound(0);
if (playClickSound)
playSound(0);
setVisible(false);
}
}
Expand Down
2 changes: 1 addition & 1 deletion engines/neverhood/modules/module1400_sprites.h
Expand Up @@ -155,7 +155,7 @@ class AsScene1405Tile : public AnimatedSprite {
public:
AsScene1405Tile(NeverhoodEngine *vm, Scene1405 *parentScene, uint32 tileIndex);
void show();
void hide();
void hide(bool playClickSound);
protected:
Scene1405 *_parentScene;
bool _isShowing;
Expand Down

0 comments on commit 4207fbd

Please sign in to comment.