1
0
Fork 0
forked from fte/fteqw

delink particle states on r_particlesystem change, correctly use default trails on models

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3822 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2011-06-18 12:25:36 +00:00
parent 027c09bd6a
commit 9d4586b532
5 changed files with 35 additions and 7 deletions

View file

@ -1590,6 +1590,16 @@ static void CL_UpdateNetFrameLerpState(qboolean force, unsigned int curframe, le
} }
} }
void CL_ClearLerpEntsParticleState(void)
{
int i;
for (i = 0; i < cl.maxlerpents; i++)
{
pe->DelinkTrailstate(&(cl.lerpents[i].trailstate));
pe->DelinkTrailstate(&(cl.lerpents[i].emitstate));
}
}
void CL_LinkStaticEntities(void *pvs) void CL_LinkStaticEntities(void *pvs)
{ {
int i; int i;
@ -2198,11 +2208,9 @@ void CL_LinkPacketEntities (void)
} }
} }
if (model->particletrail >= 0) if (model->particletrail == P_INVALID || pe->ParticleTrail (old_origin, ent->origin, model->particletrail, &(le->trailstate)))
{ if (model->traildefaultindex >= 0)
if (pe->ParticleTrail (old_origin, ent->origin, model->particletrail, &(le->trailstate)))
pe->ParticleTrailIndex(old_origin, ent->origin, model->traildefaultindex, 0, &(le->trailstate)); pe->ParticleTrailIndex(old_origin, ent->origin, model->traildefaultindex, 0, &(le->trailstate));
}
{ {
extern cvar_t gl_part_flame; extern cvar_t gl_part_flame;

View file

@ -346,6 +346,17 @@ void CL_ShutdownTEnts (void)
BZ_Free(ae); BZ_Free(ae);
} }
} }
void CL_ClearTEntParticleState (void)
{
int i;
for (i = 0; i < beams_running; i++)
{
pe->DelinkTrailstate(&(cl_beams[i].trailstate));
pe->DelinkTrailstate(&(cl_beams[i].emitstate));
}
}
void P_LoadedModel(model_t *mod) void P_LoadedModel(model_t *mod)
{ {
struct associatedeffect *ae; struct associatedeffect *ae;

View file

@ -973,6 +973,7 @@ void DropPunchAngle (int pnum);
void CL_RegisterParticles(void); void CL_RegisterParticles(void);
void CL_InitTEnts (void); void CL_InitTEnts (void);
void CL_ClearTEnts (void); void CL_ClearTEnts (void);
void CL_ClearTEntParticleState (void);
void CL_ClearCustomTEnts(void); void CL_ClearCustomTEnts(void);
void CL_ParseCustomTEnt(void); void CL_ParseCustomTEnt(void);
void CL_ParseEffect (qboolean effect2); void CL_ParseEffect (qboolean effect2);
@ -1005,6 +1006,7 @@ void CL_LinkViewModel(void);
void CL_LinkPlayers (void); void CL_LinkPlayers (void);
void CL_LinkPacketEntities (void); void CL_LinkPacketEntities (void);
void CL_LinkProjectiles (void); void CL_LinkProjectiles (void);
void CL_ClearLerpEntsParticleState (void);
qboolean CL_MayLerp(void); qboolean CL_MayLerp(void);
// //

View file

@ -4048,9 +4048,10 @@ void CSQC_EntStateToCSQC(unsigned int flags, float lerptime, entity_state_t *src
if (!(flags & RSES_NOTRAILS)) if (!(flags & RSES_NOTRAILS))
{ {
//use entnum as a test to see if its new (if the old origin isn't usable) //use entnum as a test to see if its new (if the old origin isn't usable)
if (ent->xv->entnum && model->particletrail >= 0) if (ent->xv->entnum)
{ {
if (pe->ParticleTrail (ent->v->origin, src->origin, model->particletrail, &(le->trailstate))) if (model->particletrail == P_INVALID || pe->ParticleTrail (ent->v->origin, src->origin, model->particletrail, &(le->trailstate)))
if (model->traildefaultindex >= 0)
pe->ParticleTrailIndex(ent->v->origin, src->origin, model->traildefaultindex, 0, &(le->trailstate)); pe->ParticleTrailIndex(ent->v->origin, src->origin, model->traildefaultindex, 0, &(le->trailstate));
} }
} }

View file

@ -82,6 +82,9 @@ void R_ParticleSystem_Callback(struct cvar_s *var, char *oldvalue)
int i; int i;
if (pe) if (pe)
{ {
CL_ClearTEntParticleState();
CL_ClearLerpEntsParticleState();
pe->ShutdownParticles(); pe->ShutdownParticles();
} }
@ -444,5 +447,8 @@ void P_DefaultTrail (model_t *model)
model->traildefaultindex = 254; model->traildefaultindex = 254;
} }
else else
{
model->particletrail = P_INVALID; model->particletrail = P_INVALID;
model->traildefaultindex = -1;
}
} }