[Scummvm-cvs-logs] SF.net SVN: scummvm: [32568] scummvm/trunk/engines/drascula/drascula.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Fri Jun 6 08:58:37 CEST 2008


Revision: 32568
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32568&view=rev
Author:   eriktorbjorn
Date:     2008-06-05 23:58:37 -0700 (Thu, 05 Jun 2008)

Log Message:
-----------
Only try to play a sound file if the file could be found. (Otherwise, it looks
like it will try to use the most recently opened file, which is probably not a
sound at all.)

Modified Paths:
--------------
    scummvm/trunk/engines/drascula/drascula.cpp

Modified: scummvm/trunk/engines/drascula/drascula.cpp
===================================================================
--- scummvm/trunk/engines/drascula/drascula.cpp	2008-06-06 06:35:25 UTC (rev 32567)
+++ scummvm/trunk/engines/drascula/drascula.cpp	2008-06-06 06:58:37 UTC (rev 32568)
@@ -1796,6 +1796,7 @@
 
 void DrasculaEngine::playSound(int soundNum) {
 	char file[20];
+	printf("playSound(%d)\n", soundNum);
 	sprintf(file, "s%i.als", soundNum);
 
 	playFile(file);
@@ -3346,16 +3347,17 @@
 }
 
 void DrasculaEngine::playFile(const char *fname) {
-	_arj.open(fname);
+	if (_arj.open(fname)) {
+		int soundSize = _arj.size();
+		byte *soundData = (byte *)malloc(soundSize);
+		_arj.seek(32);
+		_arj.read(soundData, soundSize);
+		_arj.close();
 
-	int soundSize = _arj.size();
-	byte *soundData = (byte *)malloc(soundSize);
-	_arj.seek(32);
-	_arj.read(soundData, soundSize);
-	_arj.close();
-
-	_mixer->playRaw(Audio::Mixer::kSFXSoundType, &_soundHandle, soundData, soundSize - 64,
-					11025, Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED);
+		_mixer->playRaw(Audio::Mixer::kSFXSoundType, &_soundHandle, soundData, soundSize - 64,
+						11025, Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED);
+	} else
+		warning("playFile: Could not open %s", fname);
 }
 
 bool DrasculaEngine::soundIsActive() {


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