Skip to content

Commit

Permalink
engine: client: use physents for flashlight tracing, as GoldSrc does
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed Oct 7, 2023
1 parent a738b2a commit 962f88d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions engine/client/cl_tent.c
Original file line number Diff line number Diff line change
Expand Up @@ -2629,7 +2629,7 @@ void CL_UpdateFlashlight( cl_entity_t *ent )
vec3_t forward, view_ofs;
vec3_t vecSrc, vecEnd;
float falloff;
pmtrace_t *trace;
pmtrace_t trace;
cl_entity_t *hit;
dlight_t *dl;

Expand Down Expand Up @@ -2660,20 +2660,20 @@ void CL_UpdateFlashlight( cl_entity_t *ent )
VectorAdd( ent->origin, view_ofs, vecSrc );
VectorMA( vecSrc, FLASHLIGHT_DISTANCE, forward, vecEnd );

trace = CL_VisTraceLine( vecSrc, vecEnd, PM_STUDIO_BOX );
trace = CL_TraceLine( vecSrc, vecEnd, PM_STUDIO_BOX );

// update flashlight endpos
dl = CL_AllocDlight( ent->index );
#if 1
hit = CL_GetEntityByIndex( clgame.pmove->visents[trace->ent].info );
hit = CL_GetEntityByIndex( clgame.pmove->visents[trace.ent].info );
if( hit && hit->model && ( hit->model->type == mod_alias || hit->model->type == mod_studio ))
VectorCopy( hit->origin, dl->origin );
else VectorCopy( trace->endpos, dl->origin );
else VectorCopy( trace.endpos, dl->origin );
#else
VectorCopy( trace->endpos, dl->origin );
#endif
// compute falloff
falloff = trace->fraction * FLASHLIGHT_DISTANCE;
falloff = trace.fraction * FLASHLIGHT_DISTANCE;
if( falloff < 500.0f ) falloff = 1.0f;
else falloff = 500.0f / falloff;
falloff *= falloff;
Expand Down

0 comments on commit 962f88d

Please sign in to comment.