mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-03-10 04:31:16 +00:00
engine: client: get rid of s_registration_sequence, it was incorrect way to look for unused sounds. We're trying to rely on cl.servercount here
This commit is contained in:
parent
93b2f535e2
commit
7013d447ca
@ -14,6 +14,7 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "client.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
|
||||||
// during registration it is possible to have more sounds
|
// during registration it is possible to have more sounds
|
||||||
@ -28,7 +29,6 @@ static sfx_t s_knownSfx[MAX_SFX];
|
|||||||
static sfx_t *s_sfxHashList[MAX_SFX_HASH];
|
static sfx_t *s_sfxHashList[MAX_SFX_HASH];
|
||||||
static string s_sentenceImmediateName; // keep dummy sentence name
|
static string s_sentenceImmediateName; // keep dummy sentence name
|
||||||
qboolean s_registering = false;
|
qboolean s_registering = false;
|
||||||
int s_registration_sequence = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
@ -199,7 +199,7 @@ sfx_t *S_FindName( const char *pname, int *pfInCache )
|
|||||||
*pfInCache = ( sfx->cache != NULL ) ? true : false;
|
*pfInCache = ( sfx->cache != NULL ) ? true : false;
|
||||||
}
|
}
|
||||||
// prolonge registration
|
// prolonge registration
|
||||||
sfx->servercount = s_registration_sequence;
|
sfx->servercount = cl.servercount;
|
||||||
return sfx;
|
return sfx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,7 +219,7 @@ sfx_t *S_FindName( const char *pname, int *pfInCache )
|
|||||||
memset( sfx, 0, sizeof( *sfx ));
|
memset( sfx, 0, sizeof( *sfx ));
|
||||||
if( pfInCache ) *pfInCache = false;
|
if( pfInCache ) *pfInCache = false;
|
||||||
Q_strncpy( sfx->name, name, MAX_STRING );
|
Q_strncpy( sfx->name, name, MAX_STRING );
|
||||||
sfx->servercount = s_registration_sequence;
|
sfx->servercount = cl.servercount;
|
||||||
sfx->hashValue = COM_HashKey( sfx->name, MAX_SFX_HASH );
|
sfx->hashValue = COM_HashKey( sfx->name, MAX_SFX_HASH );
|
||||||
|
|
||||||
// link it in
|
// link it in
|
||||||
@ -273,7 +273,6 @@ void S_BeginRegistration( void )
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
s_registration_sequence++;
|
|
||||||
snd_ambient = false;
|
snd_ambient = false;
|
||||||
|
|
||||||
// check for automatic ambient sounds
|
// check for automatic ambient sounds
|
||||||
@ -309,7 +308,7 @@ void S_EndRegistration( void )
|
|||||||
if( !sfx->name[0] || !Q_stricmp( sfx->name, "*default" ))
|
if( !sfx->name[0] || !Q_stricmp( sfx->name, "*default" ))
|
||||||
continue; // don't release default sound
|
continue; // don't release default sound
|
||||||
|
|
||||||
if( sfx->servercount != s_registration_sequence )
|
if( sfx->servercount != cl.servercount )
|
||||||
S_FreeSound( sfx ); // don't need this sound
|
S_FreeSound( sfx ); // don't need this sound
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,7 +348,7 @@ sound_t S_RegisterSound( const char *name )
|
|||||||
sfx = S_FindName( name, NULL );
|
sfx = S_FindName( name, NULL );
|
||||||
if( !sfx ) return -1;
|
if( !sfx ) return -1;
|
||||||
|
|
||||||
sfx->servercount = s_registration_sequence;
|
sfx->servercount = cl.servercount;
|
||||||
if( !s_registering ) S_LoadSound( sfx );
|
if( !s_registering ) S_LoadSound( sfx );
|
||||||
|
|
||||||
return sfx - s_knownSfx;
|
return sfx - s_knownSfx;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user