Fixed premature stopping of sounds/voices.

svn-id: r32354
This commit is contained in:
Benjamin Haisch 2008-05-28 22:15:10 +00:00
parent 8757db728a
commit 4afd19ad0f
3 changed files with 20 additions and 15 deletions

View File

@ -280,6 +280,7 @@ int MadeEngine::go() {
// NOTE: Disabled again since it causes major graphics errors.
//_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true);
_autoStopSound = false;
_eventNum = _eventKey = _eventMouseX = _eventMouseY = 0;
#ifdef DUMP_SCRIPTS

View File

@ -108,7 +108,10 @@ public:
uint16 _eventNum;
int _eventMouseX, _eventMouseY;
uint16 _eventKey;
int _soundRate;
bool _autoStopSound;
int _musicVolume;
// 2 = LGOP2, Manhole N&E

View File

@ -183,13 +183,15 @@ int16 ScriptFunctions::sfDrawPicture(int16 argc, int16 *argv) {
}
int16 ScriptFunctions::sfClearScreen(int16 argc, int16 *argv) {
if (_vm->_autoStopSound) {
_vm->_mixer->stopHandle(_audioStreamHandle);
_vm->_autoStopSound = false;
}
_vm->_screen->clearScreen();
return 0;
}
int16 ScriptFunctions::sfShowPage(int16 argc, int16 *argv) {
if (_vm->getGameID() != GID_RTZ)
_vm->_mixer->stopHandle(_audioStreamHandle);
_vm->_screen->show();
return 0;
}
@ -221,21 +223,17 @@ int16 ScriptFunctions::sfSetVisualEffect(int16 argc, int16 *argv) {
}
int16 ScriptFunctions::sfPlaySound(int16 argc, int16 *argv) {
int soundNum = argv[0];
bool loop = false;
int16 soundNum = argv[0];
_vm->_autoStopSound = false;
_vm->_mixer->stopHandle(_audioStreamHandle);
if (argc > 1) {
soundNum = argv[1];
loop = (argv[0] == 1);
_vm->_autoStopSound = (argv[0] == 1);
}
if (soundNum > 0) {
if (!_vm->_mixer->isSoundHandleActive(_audioStreamHandle)) {
_vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle,
_vm->_res->getSound(soundNum)->getAudioStream(_vm->_soundRate, loop));
_vm->_res->getSound(soundNum)->getAudioStream(_vm->_soundRate, false));
}
}
return 0;
}
@ -535,14 +533,17 @@ int16 ScriptFunctions::sfSoundPlaying(int16 argc, int16 *argv) {
int16 ScriptFunctions::sfStopSound(int16 argc, int16 *argv) {
_vm->_mixer->stopHandle(_audioStreamHandle);
_vm->_autoStopSound = false;
return 0;
}
int16 ScriptFunctions::sfPlayVoice(int16 argc, int16 *argv) {
if (argv[0] > 0) {
int16 soundNum = argv[0];
_vm->_mixer->stopHandle(_audioStreamHandle);
if (soundNum > 0) {
_vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle,
_vm->_res->getSound(argv[0])->getAudioStream(_vm->_soundRate, false));
_vm->_res->getSound(soundNum)->getAudioStream(_vm->_soundRate, false));
_vm->_autoStopSound = true;
}
return 0;
}