1
0
Fork 0
forked from fte/fteqw

add r_particlesdesc callback and removed latch, r_particlesdesc will now reload particle set on change

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2245 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-05-06 06:26:02 +00:00
parent 0f2a193838
commit 9e8aa5ee66
3 changed files with 17 additions and 10 deletions

View file

@ -1486,7 +1486,7 @@ void CL_ParseServerData (void)
}
CL_ClearState ();
P_NewServer();
Cvar_ForceCallback(&r_particlesdesc);
Stats_NewMap();
cl.servercount = svcnt;
@ -1692,7 +1692,7 @@ void CLQ2_ParseServerData (void)
//cl.refresh_prepped = false;
}
P_NewServer();
Cvar_ForceCallback(&r_particlesdesc);
if (R_PreNewMap)
R_PreNewMap();
@ -1712,7 +1712,7 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
Con_TPrintf (TLC_GOTSVDATAPACKET);
CL_ClearState ();
Stats_NewMap();
P_NewServer();
Cvar_ForceCallback(&r_particlesdesc);
protover = MSG_ReadLong ();

View file

@ -121,7 +121,10 @@ extern cvar_t r_part_rain;
extern cvar_t r_bloodstains;
extern cvar_t gl_part_flame;
cvar_t r_particlesdesc = SCVARF("r_particlesdesc", "spikeset", CVAR_LATCH|CVAR_SEMICHEAT);
// callbacks
void R_ParticlesDesc_Callback(struct cvar_s *var, char *oldvalue);
cvar_t r_particlesdesc = SCVARFC("r_particlesdesc", "spikeset", CVAR_SEMICHEAT, R_ParticlesDesc_Callback);
cvar_t r_part_rain_quantity = SCVAR("r_part_rain_quantity", "1");
@ -1483,14 +1486,18 @@ void P_ExportBuiltinSet_f(void)
Con_Printf("Written particles/%s.cfg\n", efname);
}
void P_NewServer(void)
void R_ParticlesDesc_Callback(struct cvar_s *var, char *oldvalue)
{
extern model_t mod_known[];
extern int mod_numknown;
int restrictlevel = Cmd_FromGamecode() ? RESTRICT_SERVER : RESTRICT_LOCAL;
model_t *mod;
int i;
if (cls.state == ca_disconnected)
return; // don't bother parsing while disconnected
for (i = 0; i < numparticletypes; i++)
{
*part_type[i].texname = '\0';
@ -1501,8 +1508,6 @@ void P_NewServer(void)
part_type->ramp = NULL;
}
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
{
mod->particleeffect = -1;
@ -1539,8 +1544,8 @@ void P_NewServer(void)
file = COM_LoadMallocFile(va("%s.cfg", r_particlesdesc.string));
if (file)
{
Cbuf_AddText(file, RESTRICT_LOCAL);
Cbuf_AddText("\n", RESTRICT_LOCAL); //I'm paranoid.
Cbuf_AddText(file, restrictlevel);
Cbuf_AddText("\n", restrictlevel);
BZ_Free(file);
}
else

View file

@ -136,7 +136,6 @@ typedef struct beamseg_s
void P_DrawParticles (void);
void P_InitParticles (void);
void P_ClearParticles (void);
void P_NewServer(void);
//allocate a new effect
int P_ParticleTypeForName(char *name);
@ -182,4 +181,7 @@ void P_DelinkTrailstate(trailstate_t **tsk);
typedef enum { BM_BLEND, BM_BLENDCOLOUR, BM_ADD, BM_SUBTRACT } blendmode_t;
// used for callback
extern cvar_t r_particlesdesc;
#endif