diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index bcd2f4e13..59cd612f4 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -1663,7 +1663,7 @@ void CL_LinkPacketEntities (void) } // 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; 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); } + { + 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. if (r_rocketlight.value) { diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 9c7a98fc5..ef8c813a8 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -131,9 +131,11 @@ char cl_predictiongroup[] = "Client side prediction"; client_static_t cls; client_state_t cl; +// alot of this should probably be dynamically allocated entity_state_t cl_baselines[MAX_EDICTS]; efrag_t cl_efrags[MAX_EFRAGS]; 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]; dlight_t cl_dlights[MAX_DLIGHTS]; diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 9a3d5157d..a7bebe21e 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -2139,6 +2139,7 @@ void CL_ParseStatic (int version) if (cl_static_entities[i].keynum == es.number) { R_RemoveEfrags (&cl_static_entities[i]); + P_DelinkTrailstate (&cl_static_emit[i]); break; } @@ -2154,6 +2155,7 @@ void CL_ParseStatic (int version) } ent = &cl_static_entities[i]; memset(ent, 0, sizeof(*ent)); + cl_static_emit[i] = NULL; ent->keynum = es.number; diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index 13d390e75..a2aa8d5d3 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -401,13 +401,21 @@ 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)) { - VectorSubtract(end, start, normal); - VectorNormalize(normal); - VectorMA(end, 4, normal, extra); //extend the end-point by four - if (!TraceLineN(start, extra, impact, normal)) - etype = -1; + if (cl_beam_trace.value) + { + VectorSubtract(end, start, normal); + VectorNormalize(normal); + VectorMA(end, 4, normal, extra); //extend the end-point by four + if (!TraceLineN(start, extra, impact, normal)) + etype = -1; + } + else + { + VectorCopy(end, impact); + normal[0] = normal[1] = normal[2] = 0; + } } b = CL_NewBeam(ent, -1); diff --git a/engine/client/client.h b/engine/client/client.h index 113560980..e2ba9301e 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -610,6 +610,7 @@ extern client_state_t cl; extern entity_state_t cl_baselines[MAX_EDICTS]; extern efrag_t cl_efrags[MAX_EFRAGS]; 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 dlight_t cl_dlights[MAX_DLIGHTS]; diff --git a/engine/client/clq2_ents.c b/engine/client/clq2_ents.c index d47ffb2f2..31de89760 100644 --- a/engine/client/clq2_ents.c +++ b/engine/client/clq2_ents.c @@ -90,7 +90,7 @@ typedef struct q2centity_s // float trailcount; // for diminishing grenade trails vec3_t lerp_origin; // for trails (variable hz) - int fly_stoptime; +// int fly_stoptime; } q2centity_t; diff --git a/engine/client/r_efrag.c b/engine/client/r_efrag.c index 2687d89ce..577b7d7a3 100644 --- a/engine/client/r_efrag.c +++ b/engine/client/r_efrag.c @@ -277,6 +277,16 @@ void R_StoreEfrags (efrag_t **ppefrag) // mark that we've recorded this entity for this frame 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; diff --git a/engine/client/r_part.c b/engine/client/r_part.c index 0262a0794..14629bdca 100644 --- a/engine/client/r_part.c +++ b/engine/client/r_part.c @@ -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) { #ifdef SIDEVIEWS - if (r_secondaryview) //this is called when the models are actually drawn. - return; +// is this even needed? +// if (r_secondaryview==1) +// return; #endif if (cl.paused) return; diff --git a/engine/gl/gl_ppl.c b/engine/gl/gl_ppl.c index dc54dc3c5..dccf40811 100644 --- a/engine/gl/gl_ppl.c +++ b/engine/gl/gl_ppl.c @@ -31,7 +31,6 @@ extern cvar_t gl_overbright; extern cvar_t r_fb_bmodels; extern cvar_t gl_part_flame; -extern cvar_t gl_part_flame; extern cvar_t gl_maxshadowlights; extern cvar_t r_shadow_realtime_world; extern cvar_t r_shadow_realtime_world_lightmaps; diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index 2f35a1eb8..03c079835 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -918,9 +918,6 @@ void GLR_DrawEntitiesOnList (void) { if (gl_part_flame.value) { - P_EmitEffect (currententity->origin, - currententity->model->particleeffect, - &(cl.lerpents[currententity->keynum].emitstate)); if (currententity->model->engineflags & MDLF_ENGULPHS) continue; } diff --git a/engine/sw/d_part.c b/engine/sw/d_part.c index fa7313c9a..c386c794c 100644 --- a/engine/sw/d_part.c +++ b/engine/sw/d_part.c @@ -384,7 +384,7 @@ void D_DrawParticleTrans (particle_t *pparticle, blendmode_t blendmode) if (pparticle->alpha < TRANS_LOWER_CAP) return; - if (pparticle->alpha > TRANS_UPPER_CAP && blendmode == BM_MERGE) + if (pparticle->alpha > TRANS_UPPER_CAP && blendmode == BM_BLEND) { D_DrawParticle(pparticle); return; diff --git a/engine/sw/d_sprite.c b/engine/sw/d_sprite.c index 6e13287b5..ddd75c52b 100644 --- a/engine/sw/d_sprite.c +++ b/engine/sw/d_sprite.c @@ -1081,7 +1081,7 @@ void D_DrawSprite (void) D_SpriteDrawSpans (sprite_spans); else { - D_SetTransLevel(currententity->alpha, BM_MERGE); + D_SetTransLevel(currententity->alpha, BM_BLEND); D_SpriteDrawSpansTrans (sprite_spans); } } diff --git a/engine/sw/r_alias.c b/engine/sw/r_alias.c index 828072711..6574aa851 100644 --- a/engine/sw/r_alias.c +++ b/engine/sw/r_alias.c @@ -884,7 +884,7 @@ void R_AliasDrawModel (alight_t *plighting) } else { - D_SetTransLevel(currententity->alpha, BM_MERGE); + D_SetTransLevel(currententity->alpha, BM_BLEND); transbackfac = 1; } } diff --git a/engine/sw/r_main.c b/engine/sw/r_main.c index a4888de31..81f182c14 100644 --- a/engine/sw/r_main.c +++ b/engine/sw/r_main.c @@ -701,9 +701,6 @@ void SWR_DrawEntitiesOnList (void) { if (gl_part_flame.value) { - P_EmitEffect (currententity->origin, - currententity->model->particleeffect, - &(cl.lerpents[currententity->keynum].emitstate)); if (currententity->model->engineflags & MDLF_ENGULPHS) continue; }