NEVERHOOD: Play a single sound when losing the memory puzzle (bug #6672)

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
This commit is contained in:
Filippos Karapetis 2014-07-07 02:00:37 +03:00
parent 23f58229e9
commit 4207fbd2d6
3 changed files with 8 additions and 6 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;