summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZack Middleton <zturtleman@gmail.com>2013-10-09 09:50:28 -0500
committerTim Angus <tim@ngus.net>2014-06-17 17:43:34 +0100
commit5c678ec30b0b83c4ed216d06b7b38c77f96e4b77 (patch)
treed9ad36dd3655746dae3cf6e2ff7e7fc335e426fc /src
parent765d551554d18ca685aeaf5a0f99bcb1f1a444de (diff)
Drop sounds starting with * before allocating sfx slot
Causes handle 0 to be returned by S_RegisterSound.
Diffstat (limited to 'src')
-rw-r--r--src/client/snd_dma.c5
-rw-r--r--src/client/snd_mem.c5
-rw-r--r--src/client/snd_openal.c9
3 files changed, 10 insertions, 9 deletions
diff --git a/src/client/snd_dma.c b/src/client/snd_dma.c
index 8aca94ce..369c9388 100644
--- a/src/client/snd_dma.c
+++ b/src/client/snd_dma.c
@@ -272,6 +272,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/src/client/snd_mem.c b/src/client/snd_mem.c
index 00dbcf3a..ecca5292 100644
--- a/src/client/snd_mem.c
+++ b/src/client/snd_mem.c
@@ -209,11 +209,6 @@ qboolean S_LoadSound( sfx_t *sfx )
snd_info_t info;
int size_per_sec;
- // 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/src/client/snd_openal.c b/src/client/snd_openal.c
index 23a6a67d..b7ce3f0f 100644
--- a/src/client/snd_openal.c
+++ b/src/client/snd_openal.c
@@ -211,6 +211,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))
@@ -328,10 +333,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;