Skip to content

Commit

Permalink
MORTEVIELLE: Wait for the end of sound in some more places
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Aug 13, 2013
1 parent 7c58e9a commit 3e75c5a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
11 changes: 3 additions & 8 deletions engines/mortevielle/actions.cpp
Expand Up @@ -633,6 +633,7 @@ void MortevielleEngine::fctOpen() {
}
_openObjects[i] = _num;
displayAnimFrame(1, _num);
_soundManager.waitSpeech();
}
int tmpPlace = _coreVar._currPlace;
if (_coreVar._currPlace == CRYPT)
Expand Down Expand Up @@ -1147,10 +1148,7 @@ void MortevielleEngine::fctEnter() {
int randVal = (getRandomNumber(0, 10)) - 5;
_soundManager.startSpeech(7, randVal, 1);
displayAnimFrame(1, 1);
while (_mixer->isSoundHandleActive(_soundManager._soundHandle) && !keyPressed() && !_mouseClick && !shouldQuit())
;
// In case the handle is still active, stop it.
_mixer->stopHandle(_soundManager._soundHandle);
_soundManager.waitSpeech();

int charIndex = convertBitIndexToCharacterIndex(z);
++_coreVar._faithScore;
Expand All @@ -1172,10 +1170,7 @@ void MortevielleEngine::fctEnter() {
int randVal = (getRandomNumber(0, 10)) - 5;
_soundManager.startSpeech(7, randVal, 1);
displayAnimFrame(1, 1);
while (_mixer->isSoundHandleActive(_soundManager._soundHandle) && !keyPressed() && !_mouseClick && !shouldQuit())
;
// In case the handle is still active, stop it.
_mixer->stopHandle(_soundManager._soundHandle);
_soundManager.waitSpeech();

_coreVar._currPlace = _roomDoorId;
prepareDisplayText();
Expand Down
9 changes: 9 additions & 0 deletions engines/mortevielle/sound.cpp
Expand Up @@ -784,4 +784,13 @@ void SoundManager::startSpeech(int rep, int ht, int typ) {
_vm->setPal(_vm->_numpal);
}

void SoundManager::waitSpeech() {
while (_mixer->isSoundHandleActive(_soundHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit())
;
// In case the handle is still active, stop it.
_mixer->stopHandle(_soundHandle);

if (!_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit())
g_system->delayMillis(600);
}
} // End of namespace Mortevielle
1 change: 1 addition & 0 deletions engines/mortevielle/sound.h
Expand Up @@ -98,6 +98,7 @@ class SoundManager {
void loadAmbiantSounds();
void loadNoise();
void startSpeech(int rep, int ht, int typ);
void waitSpeech();
};

} // End of namespace Mortevielle
Expand Down
3 changes: 2 additions & 1 deletion engines/mortevielle/utils.cpp
Expand Up @@ -2385,6 +2385,7 @@ void MortevielleEngine::prepareRoom() {
displayTextInVerbBar(getEngineString(S_HEAR_NOISE));
int rand = (getRandomNumber(0, 4)) - 2;
_soundManager.startSpeech(1, rand, 1);
_soundManager.waitSpeech();
clearVerbBar();
}
}
Expand Down Expand Up @@ -2511,7 +2512,7 @@ void MortevielleEngine::initCaveOrCellar() {
displayTextInVerbBar(getEngineString(S_SOMEONE_ENTERS));
int rand = (getRandomNumber(0, 4)) - 2;
_soundManager.startSpeech(2, rand, 1);

_soundManager.waitSpeech();
// The original was doing here a useless loop.
// It has been removed

Expand Down

0 comments on commit 3e75c5a

Please sign in to comment.