diff options
author | Travis Howell | 2005-05-13 08:45:42 +0000 |
---|---|---|
committer | Travis Howell | 2005-05-13 08:45:42 +0000 |
commit | 739e0640adc9ed9fd0ab2bfaaefc1d6913994278 (patch) | |
tree | 84ed2f6f5c8d45b4f262c3f95d91baad666fa00d /scumm | |
parent | d987a5852962a31816c92487debf00f7bf6b3496 (diff) | |
download | scummvm-rg350-739e0640adc9ed9fd0ab2bfaaefc1d6913994278.tar.gz scummvm-rg350-739e0640adc9ed9fd0ab2bfaaefc1d6913994278.tar.bz2 scummvm-rg350-739e0640adc9ed9fd0ab2bfaaefc1d6913994278.zip |
HE demos sometimes call music tracks that don't exist.
svn-id: r18080
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/resource_v7he.cpp | 5 | ||||
-rw-r--r-- | scumm/sound.cpp | 11 | ||||
-rw-r--r-- | scumm/sound.h | 2 |
3 files changed, 12 insertions, 6 deletions
diff --git a/scumm/resource_v7he.cpp b/scumm/resource_v7he.cpp index 21ee28e4dd..3243117242 100644 --- a/scumm/resource_v7he.cpp +++ b/scumm/resource_v7he.cpp @@ -1760,7 +1760,10 @@ int ScummEngine_v72he::getSoundResourceSize(int id) { int offs, size; if (id > _numSounds) { - _sound->getHEMusicDetails(id, offs, size); + if (!_sound->getHEMusicDetails(id, offs, size)) { + debug(0, "getSoundResourceSize: musicID %d not found", id); + return 0; + } } else { ptr = getResourceAddress(rtSound, id); if (!ptr) diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 1c94cbe2ce..d6059aecc6 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -202,18 +202,18 @@ void Sound::setupHEMusicFile() { musicFile.close(); } -void Sound::getHEMusicDetails(int id, int &musicOffs, int &musicSize) { +bool Sound::getHEMusicDetails(int id, int &musicOffs, int &musicSize) { int i; for (i = 0; i < _heMusicTracks; i++) { if (_heMusic[i].id == id) { musicOffs = _heMusic[i].offset; musicSize = _heMusic[i].size; - return; + return 1; } } - error("getHEMusicDetails: musicID %d not found", id); + return 0; } void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) { @@ -250,8 +250,11 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) { warning("playSound: Can't open music file %s", buf); return; } + if (!getHEMusicDetails(soundID, music_offs, size)) { + debug(0, "playSound: musicID %d not found", soundID); + return; + } - getHEMusicDetails(soundID, music_offs, size); musicFile.seek(music_offs, SEEK_SET); ptr = (byte *)malloc(size); musicFile.read(ptr, size); diff --git a/scumm/sound.h b/scumm/sound.h index c07e9ee990..2110abace6 100644 --- a/scumm/sound.h +++ b/scumm/sound.h @@ -133,7 +133,7 @@ public: int getCurrentCDSound() const { return _currentCDSound; } void setupHEMusicFile(); - void getHEMusicDetails(int id, int &musicOffs, int &musicSize); + bool getHEMusicDetails(int id, int &musicOffs, int &musicSize); // Used by the save/load system: const SaveLoadEntry *getSaveLoadEntries(); |