aboutsummaryrefslogtreecommitdiff
path: root/engines/made
diff options
context:
space:
mode:
Diffstat (limited to 'engines/made')
-rw-r--r--engines/made/made.cpp1
-rw-r--r--engines/made/made.h3
-rw-r--r--engines/made/scriptfuncs.cpp31
3 files changed, 20 insertions, 15 deletions
diff --git a/engines/made/made.cpp b/engines/made/made.cpp
index da7ab23f5d..09a9a85ec6 100644
--- a/engines/made/made.cpp
+++ b/engines/made/made.cpp
@@ -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
diff --git a/engines/made/made.h b/engines/made/made.h
index 5ee3828557..f7e3354c4d 100644
--- a/engines/made/made.h
+++ b/engines/made/made.h
@@ -108,7 +108,10 @@ public:
uint16 _eventNum;
int _eventMouseX, _eventMouseY;
uint16 _eventKey;
+
int _soundRate;
+ bool _autoStopSound;
+
int _musicVolume;
// 2 = LGOP2, Manhole N&E
diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp
index f67b7c89c6..8276550a48 100644
--- a/engines/made/scriptfuncs.cpp
+++ b/engines/made/scriptfuncs.cpp
@@ -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->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle,
+ _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) {
- _vm->_mixer->stopHandle(_audioStreamHandle);
+ 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;
}