From a836c2db891f7853602eab6bcd387518d638018a Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Wed, 9 Oct 2013 09:50:28 -0500 Subject: [PATCH] Drop sounds starting with * before allocating sfx slot Causes handle 0 to be returned by S_RegisterSound. --- code/client/snd_dma.c | 5 +++++ code/client/snd_mem.c | 5 ----- code/client/snd_openal.c | 9 +++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/code/client/snd_dma.c b/code/client/snd_dma.c index d4ba8906..869c6197 100644 --- a/code/client/snd_dma.c +++ b/code/client/snd_dma.c @@ -271,6 +271,11 @@ static sfx_t *S_FindName( const char *name ) { return NULL; } + if (name[0] == '*') { + Com_Printf( S_COLOR_YELLOW "WARNING: Tried to load player sound directly: %s\n", name ); + return NULL; + } + hash = S_HashSFXName(name); sfx = sfxHash[hash]; diff --git a/code/client/snd_mem.c b/code/client/snd_mem.c index d42084b7..1031f34c 100644 --- a/code/client/snd_mem.c +++ b/code/client/snd_mem.c @@ -208,11 +208,6 @@ qboolean S_LoadSound( sfx_t *sfx ) snd_info_t info; // int size; - // player specific sounds are never directly loaded - if ( sfx->soundName[0] == '*') { - return qfalse; - } - // load it in data = S_CodecLoad(sfx->soundName, &info); if(!data) diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c index 83eb541e..649c748e 100644 --- a/code/client/snd_openal.c +++ b/code/client/snd_openal.c @@ -208,6 +208,11 @@ static sfxHandle_t S_AL_BufferFind(const char *filename) return 0; } + if ( filename[0] == '*' ) { + Com_Printf( S_COLOR_YELLOW "WARNING: Tried to load player sound directly: %s\n", filename ); + return 0; + } + for(i = 0; i < numSfx; i++) { if(!Q_stricmp(knownSfx[i].filename, filename)) @@ -325,10 +330,6 @@ static void S_AL_BufferLoad(sfxHandle_t sfx, qboolean cache) if(curSfx->filename[0] == '\0') return; - // Player SFX - if(curSfx->filename[0] == '*') - return; - // Already done? if((curSfx->inMemory) || (curSfx->isDefault) || (!cache && curSfx->isDefaultChecked)) return;