From 850dc477b6ed9243383fec711fe7b2c9431c226a Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Fri, 24 Jul 2020 16:00:53 +0000 Subject: [PATCH] cl_collision: Implement CL_TraceLine_FromViewOrigin git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12872 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_collision.c | 12 ++++++++++++ cl_collision.h | 1 + sbar.c | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cl_collision.c b/cl_collision.c index 924d017c..6c9b8c4c 100644 --- a/cl_collision.c +++ b/cl_collision.c @@ -643,6 +643,18 @@ finished: return cliptrace; } +trace_t CL_TraceLine_FromViewOrigin(int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend, qboolean hitnetworkbrushmodels, qboolean hitnetworkplayers, int *hitnetworkentity, qboolean hitcsqcentities, qboolean hitsurfaces) +{ + vec3_t org, temp, dest; + + Matrix4x4_OriginFromMatrix(&r_refdef.view.matrix, org); + VectorSet(temp, 65536, 0, 0); + Matrix4x4_Transform(&r_refdef.view.matrix, temp, dest); + + return CL_TraceLine(org, dest, type, passedict, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask, extend, hitnetworkbrushmodels, hitnetworkplayers, hitnetworkentity, hitcsqcentities, hitsurfaces); + +} + /* ================== CL_Move diff --git a/cl_collision.h b/cl_collision.h index 20ce9f65..4f0d32ad 100644 --- a/cl_collision.h +++ b/cl_collision.h @@ -12,6 +12,7 @@ void CL_LinkEdict(prvm_edict_t *ent); int CL_GenericHitSuperContentsMask(const prvm_edict_t *edict); trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend, qboolean hitnetworkbrushmodels, qboolean hitnetworkplayers, int *hitnetworkentity, qboolean hitcsqcentities); trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend, qboolean hitnetworkbrushmodels, qboolean hitnetworkplayers, int *hitnetworkentity, qboolean hitcsqcentities, qboolean hitsurfaces); +trace_t CL_TraceLine_FromViewOrigin(int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend, qboolean hitnetworkbrushmodels, qboolean hitnetworkplayers, int *hitnetworkentity, qboolean hitcsqcentities, qboolean hitsurfaces); trace_t CL_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, qboolean hitnetworkbrushmodels, qboolean hitnetworkplayers, int *hitnetworkentity, qboolean hitcsqcentities); trace_t CL_Cache_TraceLineSurfaces(const vec3_t start, const vec3_t end, int type, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask); #define CL_PointSuperContents(point) (CL_TracePoint((point), sv_gameplayfix_swiminbmodels.integer ? MOVE_NOMONSTERS : MOVE_WORLDONLY, NULL, 0, 0, 0, true, false, NULL, false).startsupercontents) diff --git a/sbar.c b/sbar.c index 7c8df4b9..b6903ba0 100644 --- a/sbar.c +++ b/sbar.c @@ -1217,7 +1217,7 @@ void Sbar_ShowFPS(void) vec3_t temp; trace_t svtrace, cltrace; int hitnetentity = -1; - + // TODO: Use CL_TraceLine_FromViewOrigin Matrix4x4_OriginFromMatrix(&r_refdef.view.matrix, org); VectorSet(temp, 65536, 0, 0); Matrix4x4_Transform(&r_refdef.view.matrix, temp, dest); -- 2.39.2