mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 14:20:59 +00:00
better handling of missing sound files. fixes the seg when the cd track isn't available.
This commit is contained in:
parent
1be73a528a
commit
253795ca7f
2 changed files with 16 additions and 6 deletions
|
@ -219,7 +219,7 @@ static void
|
|||
I_OGGMus_PlayNext (int looping)
|
||||
{
|
||||
const char *track;
|
||||
sfx_t *cd_sfx;
|
||||
sfx_t *cd_sfx, *sfx;
|
||||
wavinfo_t *info = 0;
|
||||
|
||||
if (!play_list)
|
||||
|
@ -243,18 +243,21 @@ I_OGGMus_PlayNext (int looping)
|
|||
if (!(cd_channel = S_AllocChannel ()))
|
||||
return;
|
||||
|
||||
if (!(cd_sfx = S_LoadSound (track)))
|
||||
if (!(cd_sfx = S_LoadSound (track)) || !(sfx = cd_sfx->open (cd_sfx))) {
|
||||
S_ChannelStop (cd_channel);
|
||||
cd_channel = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (cd_sfx->wavinfo)
|
||||
info = cd_sfx->wavinfo (cd_sfx);
|
||||
if (sfx->wavinfo)
|
||||
info = sfx->wavinfo (sfx);
|
||||
if (info) {
|
||||
if (looping == true)
|
||||
info->loopstart = 0;
|
||||
else
|
||||
info->loopstart = -1;
|
||||
}
|
||||
cd_channel->sfx = cd_sfx->open (cd_sfx);
|
||||
cd_channel->sfx = sfx;
|
||||
set_volume ();
|
||||
|
||||
playing = true;
|
||||
|
|
|
@ -81,6 +81,12 @@ snd_open (sfx_t *sfx)
|
|||
return sfx;
|
||||
}
|
||||
|
||||
static sfx_t *
|
||||
snd_open_fail (sfx_t *sfx)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
sfxbuffer_t *
|
||||
SND_CacheTouch (sfx_t *sfx)
|
||||
{
|
||||
|
@ -331,7 +337,7 @@ SND_Load (sfx_t *sfx)
|
|||
sfx->touch = sfx->retain = snd_fail;
|
||||
sfx->release = snd_noop;
|
||||
sfx->close = snd_noop;
|
||||
sfx->open = snd_open;
|
||||
sfx->open = snd_open_fail;
|
||||
|
||||
_QFS_FOpenFile (sfx->name, &file, foundname, 1);
|
||||
if (!file) {
|
||||
|
@ -339,6 +345,7 @@ SND_Load (sfx_t *sfx)
|
|||
dstring_delete (foundname);
|
||||
return;
|
||||
}
|
||||
sfx->open = snd_open;
|
||||
if (!strequal (foundname->str, sfx->name)) {
|
||||
realname = foundname->str;
|
||||
free (foundname);
|
||||
|
|
Loading…
Reference in a new issue