fixes to particle emitting (temp?)

build fixes to SW
parsing fixes


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1299 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2005-09-09 02:01:30 +00:00
parent 347311db8c
commit eb06704511
14 changed files with 46 additions and 20 deletions

View file

@ -1663,7 +1663,7 @@ void CL_LinkPacketEntities (void)
} }
// add automatic particle trails // add automatic particle trails
if (!model || (!(model->flags&~EF_ROTATE) && model->particletrail<0)) if (!model || (!(model->flags&~EF_ROTATE) && model->particletrail<0 && model->particleeffect<0))
continue; continue;
if (!cls.allow_anyparticles && !(model->flags & ~EF_ROTATE)) if (!cls.allow_anyparticles && !(model->flags & ~EF_ROTATE))
@ -1710,6 +1710,15 @@ void CL_LinkPacketEntities (void)
P_ParticleTrail (old_origin, ent->origin, model->particletrail, &cl.lerpents[s1->number].trailstate); P_ParticleTrail (old_origin, ent->origin, model->particletrail, &cl.lerpents[s1->number].trailstate);
} }
{
extern cvar_t gl_part_flame;
if (cls.allow_anyparticles && gl_part_flame.value)
{
P_EmitEffect (ent->origin, model->particleeffect, &(cl.lerpents[s1->number].emitstate));
}
}
//dlights are not so customisable. //dlights are not so customisable.
if (r_rocketlight.value) if (r_rocketlight.value)
{ {

View file

@ -131,9 +131,11 @@ char cl_predictiongroup[] = "Client side prediction";
client_static_t cls; client_static_t cls;
client_state_t cl; client_state_t cl;
// alot of this should probably be dynamically allocated
entity_state_t cl_baselines[MAX_EDICTS]; entity_state_t cl_baselines[MAX_EDICTS];
efrag_t cl_efrags[MAX_EFRAGS]; efrag_t cl_efrags[MAX_EFRAGS];
entity_t cl_static_entities[MAX_STATIC_ENTITIES]; entity_t cl_static_entities[MAX_STATIC_ENTITIES];
trailstate_t *cl_static_emit[MAX_STATIC_ENTITIES];
lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES]; lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
//lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES]; //lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
dlight_t cl_dlights[MAX_DLIGHTS]; dlight_t cl_dlights[MAX_DLIGHTS];

View file

@ -2139,6 +2139,7 @@ void CL_ParseStatic (int version)
if (cl_static_entities[i].keynum == es.number) if (cl_static_entities[i].keynum == es.number)
{ {
R_RemoveEfrags (&cl_static_entities[i]); R_RemoveEfrags (&cl_static_entities[i]);
P_DelinkTrailstate (&cl_static_emit[i]);
break; break;
} }
@ -2154,6 +2155,7 @@ void CL_ParseStatic (int version)
} }
ent = &cl_static_entities[i]; ent = &cl_static_entities[i];
memset(ent, 0, sizeof(*ent)); memset(ent, 0, sizeof(*ent));
cl_static_emit[i] = NULL;
ent->keynum = es.number; ent->keynum = es.number;

View file

@ -401,7 +401,9 @@ void CL_AddBeam (int tent, int ent, vec3_t start, vec3_t end) //fixme: use TE_ n
} }
} }
if (cl_beam_trace.value && etype >= 0 && cls.state == ca_active && P_TypeIsLoaded(etype)) if (etype >= 0 && cls.state == ca_active && P_TypeIsLoaded(etype))
{
if (cl_beam_trace.value)
{ {
VectorSubtract(end, start, normal); VectorSubtract(end, start, normal);
VectorNormalize(normal); VectorNormalize(normal);
@ -409,6 +411,12 @@ void CL_AddBeam (int tent, int ent, vec3_t start, vec3_t end) //fixme: use TE_ n
if (!TraceLineN(start, extra, impact, normal)) if (!TraceLineN(start, extra, impact, normal))
etype = -1; etype = -1;
} }
else
{
VectorCopy(end, impact);
normal[0] = normal[1] = normal[2] = 0;
}
}
b = CL_NewBeam(ent, -1); b = CL_NewBeam(ent, -1);
if (!b) if (!b)

View file

@ -610,6 +610,7 @@ extern client_state_t cl;
extern entity_state_t cl_baselines[MAX_EDICTS]; extern entity_state_t cl_baselines[MAX_EDICTS];
extern efrag_t cl_efrags[MAX_EFRAGS]; extern efrag_t cl_efrags[MAX_EFRAGS];
extern entity_t cl_static_entities[MAX_STATIC_ENTITIES]; extern entity_t cl_static_entities[MAX_STATIC_ENTITIES];
extern trailstate_t *cl_static_emit[MAX_STATIC_ENTITIES];
extern lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES]; extern lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
extern dlight_t cl_dlights[MAX_DLIGHTS]; extern dlight_t cl_dlights[MAX_DLIGHTS];

View file

@ -90,7 +90,7 @@ typedef struct q2centity_s
// float trailcount; // for diminishing grenade trails // float trailcount; // for diminishing grenade trails
vec3_t lerp_origin; // for trails (variable hz) vec3_t lerp_origin; // for trails (variable hz)
int fly_stoptime; // int fly_stoptime;
} q2centity_t; } q2centity_t;

View file

@ -277,6 +277,16 @@ void R_StoreEfrags (efrag_t **ppefrag)
// mark that we've recorded this entity for this frame // mark that we've recorded this entity for this frame
pent->visframe = r_framecount; pent->visframe = r_framecount;
// emit particles for statics (we don't need to cheat check statics)
if (clmodel->particleeffect >= 0)
{
// TODO: this is ugly.. assumes ent is in static entities, and subtracts
// pointer math to get an index to use in cl_static emit
// there needs to be a cleaner method for this
int i = (int)(pent - cl_static_entities);
P_EmitEffect(pent->origin, clmodel->particleeffect, &(cl_static_emit[i]));
}
} }
ppefrag = &pefrag->leafnext; ppefrag = &pefrag->leafnext;

View file

@ -2383,8 +2383,9 @@ int P_RunParticleEffectTypeString (vec3_t org, vec3_t dir, float count, char *na
void P_EmitEffect (vec3_t pos, int type, trailstate_t **tsk) void P_EmitEffect (vec3_t pos, int type, trailstate_t **tsk)
{ {
#ifdef SIDEVIEWS #ifdef SIDEVIEWS
if (r_secondaryview) //this is called when the models are actually drawn. // is this even needed?
return; // if (r_secondaryview==1)
// return;
#endif #endif
if (cl.paused) if (cl.paused)
return; return;

View file

@ -31,7 +31,6 @@ extern cvar_t gl_overbright;
extern cvar_t r_fb_bmodels; extern cvar_t r_fb_bmodels;
extern cvar_t gl_part_flame; extern cvar_t gl_part_flame;
extern cvar_t gl_part_flame;
extern cvar_t gl_maxshadowlights; extern cvar_t gl_maxshadowlights;
extern cvar_t r_shadow_realtime_world; extern cvar_t r_shadow_realtime_world;
extern cvar_t r_shadow_realtime_world_lightmaps; extern cvar_t r_shadow_realtime_world_lightmaps;

View file

@ -918,9 +918,6 @@ void GLR_DrawEntitiesOnList (void)
{ {
if (gl_part_flame.value) if (gl_part_flame.value)
{ {
P_EmitEffect (currententity->origin,
currententity->model->particleeffect,
&(cl.lerpents[currententity->keynum].emitstate));
if (currententity->model->engineflags & MDLF_ENGULPHS) if (currententity->model->engineflags & MDLF_ENGULPHS)
continue; continue;
} }

View file

@ -384,7 +384,7 @@ void D_DrawParticleTrans (particle_t *pparticle, blendmode_t blendmode)
if (pparticle->alpha < TRANS_LOWER_CAP) if (pparticle->alpha < TRANS_LOWER_CAP)
return; return;
if (pparticle->alpha > TRANS_UPPER_CAP && blendmode == BM_MERGE) if (pparticle->alpha > TRANS_UPPER_CAP && blendmode == BM_BLEND)
{ {
D_DrawParticle(pparticle); D_DrawParticle(pparticle);
return; return;

View file

@ -1081,7 +1081,7 @@ void D_DrawSprite (void)
D_SpriteDrawSpans (sprite_spans); D_SpriteDrawSpans (sprite_spans);
else else
{ {
D_SetTransLevel(currententity->alpha, BM_MERGE); D_SetTransLevel(currententity->alpha, BM_BLEND);
D_SpriteDrawSpansTrans (sprite_spans); D_SpriteDrawSpansTrans (sprite_spans);
} }
} }

View file

@ -884,7 +884,7 @@ void R_AliasDrawModel (alight_t *plighting)
} }
else else
{ {
D_SetTransLevel(currententity->alpha, BM_MERGE); D_SetTransLevel(currententity->alpha, BM_BLEND);
transbackfac = 1; transbackfac = 1;
} }
} }

View file

@ -701,9 +701,6 @@ void SWR_DrawEntitiesOnList (void)
{ {
if (gl_part_flame.value) if (gl_part_flame.value)
{ {
P_EmitEffect (currententity->origin,
currententity->model->particleeffect,
&(cl.lerpents[currententity->keynum].emitstate));
if (currententity->model->engineflags & MDLF_ENGULPHS) if (currententity->model->engineflags & MDLF_ENGULPHS)
continue; continue;
} }