[Scummvm-cvs-logs] SF.net SVN: scummvm: [32354] scummvm/trunk/engines/made

john_doe at users.sourceforge.net john_doe at users.sourceforge.net
Thu May 29 00:15:10 CEST 2008


Revision: 32354
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32354&view=rev
Author:   john_doe
Date:     2008-05-28 15:15:10 -0700 (Wed, 28 May 2008)

Log Message:
-----------
Fixed premature stopping of sounds/voices.

Modified Paths:
--------------
    scummvm/trunk/engines/made/made.cpp
    scummvm/trunk/engines/made/made.h
    scummvm/trunk/engines/made/scriptfuncs.cpp

Modified: scummvm/trunk/engines/made/made.cpp
===================================================================
--- scummvm/trunk/engines/made/made.cpp	2008-05-28 21:27:52 UTC (rev 32353)
+++ scummvm/trunk/engines/made/made.cpp	2008-05-28 22:15:10 UTC (rev 32354)
@@ -280,6 +280,7 @@
 	// NOTE: Disabled again since it causes major graphics errors.
 	//_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true);
 
+	_autoStopSound = false;
 	_eventNum = _eventKey = _eventMouseX = _eventMouseY = 0;
 	
 #ifdef DUMP_SCRIPTS

Modified: scummvm/trunk/engines/made/made.h
===================================================================
--- scummvm/trunk/engines/made/made.h	2008-05-28 21:27:52 UTC (rev 32353)
+++ scummvm/trunk/engines/made/made.h	2008-05-28 22:15:10 UTC (rev 32354)
@@ -108,7 +108,10 @@
 	uint16 _eventNum;
 	int _eventMouseX, _eventMouseY;
 	uint16 _eventKey;
+
 	int _soundRate;
+	bool _autoStopSound;
+
 	int _musicVolume;
 	
 	// 2 = LGOP2, Manhole N&E

Modified: scummvm/trunk/engines/made/scriptfuncs.cpp
===================================================================
--- scummvm/trunk/engines/made/scriptfuncs.cpp	2008-05-28 21:27:52 UTC (rev 32353)
+++ scummvm/trunk/engines/made/scriptfuncs.cpp	2008-05-28 22:15:10 UTC (rev 32354)
@@ -183,13 +183,15 @@
 }
 
 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::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::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;
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list