diff options
author | Torbjörn Andersson | 2008-06-06 06:58:37 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2008-06-06 06:58:37 +0000 |
commit | fe8ec2ef105a1bfa05742acd5491580d81bd7fdb (patch) | |
tree | 5eddca8ab25ccc745ab13c09785bdef92cd042ed /engines/drascula | |
parent | 095c1544db440ebd3335cf83228018c86f1fdd54 (diff) | |
download | scummvm-rg350-fe8ec2ef105a1bfa05742acd5491580d81bd7fdb.tar.gz scummvm-rg350-fe8ec2ef105a1bfa05742acd5491580d81bd7fdb.tar.bz2 scummvm-rg350-fe8ec2ef105a1bfa05742acd5491580d81bd7fdb.zip |
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.)
svn-id: r32568
Diffstat (limited to 'engines/drascula')
-rw-r--r-- | engines/drascula/drascula.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index f9ca3b4aa6..223877389f 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -1796,6 +1796,7 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) { 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::MusicFadeout() { } void DrasculaEngine::playFile(const char *fname) { - _arj.open(fname); - - int soundSize = _arj.size(); - byte *soundData = (byte *)malloc(soundSize); - _arj.seek(32); - _arj.read(soundData, soundSize); - _arj.close(); + if (_arj.open(fname)) { + 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() { |