Drop sounds starting with * before allocating sfx slot

Causes handle 0 to be returned by S_RegisterSound.
This commit is contained in:
Zack Middleton 2013-10-09 09:50:28 -05:00
parent e4227d1cd5
commit a836c2db89
3 changed files with 10 additions and 9 deletions

View file

@ -271,6 +271,11 @@ static sfx_t *S_FindName( const char *name ) {
return NULL; 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); hash = S_HashSFXName(name);
sfx = sfxHash[hash]; sfx = sfxHash[hash];

View file

@ -208,11 +208,6 @@ qboolean S_LoadSound( sfx_t *sfx )
snd_info_t info; snd_info_t info;
// int size; // int size;
// player specific sounds are never directly loaded
if ( sfx->soundName[0] == '*') {
return qfalse;
}
// load it in // load it in
data = S_CodecLoad(sfx->soundName, &info); data = S_CodecLoad(sfx->soundName, &info);
if(!data) if(!data)

View file

@ -208,6 +208,11 @@ static sfxHandle_t S_AL_BufferFind(const char *filename)
return 0; 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++) for(i = 0; i < numSfx; i++)
{ {
if(!Q_stricmp(knownSfx[i].filename, filename)) 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') if(curSfx->filename[0] == '\0')
return; return;
// Player SFX
if(curSfx->filename[0] == '*')
return;
// Already done? // Already done?
if((curSfx->inMemory) || (curSfx->isDefault) || (!cache && curSfx->isDefaultChecked)) if((curSfx->inMemory) || (curSfx->isDefault) || (!cache && curSfx->isDefaultChecked))
return; return;