From 962f88d31bc4dd792d8c9fc78fa363394b27eb1b Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 8 Oct 2023 01:52:42 +0300 Subject: [PATCH] engine: client: use physents for flashlight tracing, as GoldSrc does --- engine/client/cl_tent.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index 300160aa..fa0a0d79 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -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; @@ -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;