2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-12-24 01:35:24 +01:00

engine: client: cleanup tent and efx code, make global variables static, remove unused functions

This commit is contained in:
Alibek Omarov 2024-10-14 18:07:58 +03:00
parent 0224a1b66b
commit fdf82e5270
4 changed files with 38 additions and 55 deletions

View File

@ -25,10 +25,10 @@ static CVAR_DEFINE_AUTO( tracerspeed, "6000", 0, "tracer speed" );
static CVAR_DEFINE_AUTO( tracerlength, "0.8", 0, "tracer length factor" );
static CVAR_DEFINE_AUTO( traceroffset, "30", 0, "tracer starting offset" );
particle_t *cl_active_particles;
particle_t *cl_active_tracers;
particle_t *cl_free_particles;
particle_t *cl_particles = NULL; // particle pool
static particle_t *cl_active_particles;
static particle_t *cl_active_tracers;
static particle_t *cl_free_particles;
static particle_t *cl_particles = NULL; // particle pool
static vec3_t cl_avelocities[NUMVERTEXNORMALS];
static float cl_lasttimewarn = 0.0f;
@ -262,9 +262,9 @@ VIEWBEAMS MANAGEMENT
==============================================================
*/
BEAM *cl_active_beams;
BEAM *cl_free_beams;
BEAM *cl_viewbeams = NULL; // beams pool
static BEAM *cl_active_beams;
static BEAM *cl_free_beams;
static BEAM *cl_viewbeams = NULL; // beams pool
/*
@ -1764,25 +1764,6 @@ void GAME_EXPORT R_StreakSplash( const vec3_t pos, const vec3_t dir, int color,
}
}
/*
===============
R_DebugParticle
just for debug purposes
===============
*/
void R_DebugParticle( const vec3_t pos, byte r, byte g, byte b )
{
particle_t *p;
p = R_AllocParticle( NULL );
if( !p ) return;
VectorCopy( pos, p->org );
p->color = R_LookupColor( r, g, b );
p->die = cl.time + 0.01f;
}
/*
===============
CL_Particle

View File

@ -35,17 +35,17 @@ TEMPENTS MANAGEMENT
#define SHARD_VOLUME 12.0f // on shard ever n^3 units
#define MAX_MUZZLEFLASH 3
TEMPENTITY *cl_active_tents;
TEMPENTITY *cl_free_tents;
TEMPENTITY *cl_tempents = NULL; // entities pool
static TEMPENTITY *cl_active_tents;
static TEMPENTITY *cl_free_tents;
static TEMPENTITY *cl_tempents = NULL; // entities pool
model_t *cl_sprite_muzzleflash[MAX_MUZZLEFLASH]; // muzzle flashes
model_t *cl_sprite_dot = NULL;
model_t *cl_sprite_ricochet = NULL;
model_t *cl_sprite_shell = NULL;
model_t *cl_sprite_glow = NULL;
static model_t *cl_sprite_muzzleflash[MAX_MUZZLEFLASH]; // muzzle flashes
static model_t *cl_sprite_ricochet = NULL;
static model_t *cl_sprite_glow = NULL;
model_t *cl_sprite_dot = NULL;
model_t *cl_sprite_shell = NULL;
const char *cl_default_sprites[] =
static const char *const cl_default_sprites[] =
{
// built-in sprites
"sprites/muzzleflash1.spr",
@ -169,29 +169,13 @@ void CL_AddClientResources( void )
#endif
}
/*
================
CL_InitTempents
================
*/
void CL_InitTempEnts( void )
{
cl_tempents = Mem_Calloc( cls.mempool, sizeof( TEMPENTITY ) * GI->max_tents );
CL_ClearTempEnts();
// load tempent sprites (glowshell, muzzleflashes etc)
CL_LoadClientSprites ();
}
/*
================
CL_ClearTempEnts
================
*/
void CL_ClearTempEnts( void )
static void CL_ClearTempEnts( void )
{
int i;
@ -208,6 +192,21 @@ void CL_ClearTempEnts( void )
cl_active_tents = NULL;
}
/*
================
CL_InitTempents
================
*/
void CL_InitTempEnts( void )
{
cl_tempents = Mem_Calloc( cls.mempool, sizeof( TEMPENTITY ) * GI->max_tents );
CL_ClearTempEnts();
// load tempent sprites (glowshell, muzzleflashes etc)
CL_LoadClientSprites ();
}
/*
================
CL_FreeTempEnts
@ -444,11 +443,16 @@ alloc normal\low priority tempentity
*/
TEMPENTITY *CL_TempEntAlloc( const vec3_t org, model_t *pmodel )
{
static float cl_lasttimewarn;
TEMPENTITY *pTemp;
if( !cl_free_tents )
{
Con_DPrintf( "Overflow %d temporary ents!\n", GI->max_tents );
if( cl_lasttimewarn < host.realtime )
{
Con_DPrintf( "Overflow %d temporary ents!\n", GI->max_tents );
cl_lasttimewarn = host.realtime + 1.0f;
}
return NULL;
}

View File

@ -77,7 +77,6 @@ void R_MultiGunshot( const vec3_t org, const vec3_t dir, const vec3_t noise, int
void R_FireField( float *org, int radius, int modelIndex, int count, int flags, float life );
void R_PlayerSprites( int client, int modelIndex, int count, int size );
void R_Sprite_WallPuff( struct tempent_s *pTemp, float scale );
void R_DebugParticle( const vec3_t pos, byte r, byte g, byte b );
void R_RicochetSound( const vec3_t pos );
struct dlight_s *CL_AllocDlight( int key );
struct dlight_s *CL_AllocElight( int key );

View File

@ -1031,7 +1031,6 @@ void CL_InitParticles( void );
void CL_ClearParticles( void );
void CL_FreeParticles( void );
void CL_InitTempEnts( void );
void CL_ClearTempEnts( void );
void CL_FreeTempEnts( void );
void CL_TempEntUpdate( void );
void CL_InitViewBeams( void );