]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
cl_collision: Implement CL_TraceLine_FromViewOrigin
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 24 Jul 2020 16:00:53 +0000 (16:00 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 24 Jul 2020 16:00:53 +0000 (16:00 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12872 d7cf8633-e32d-0410-b094-e92efae38249

cl_collision.c
cl_collision.h
sbar.c

index 924d017cef0c8fbaa8d1540e804f68a78c8e460a..6c9b8c4c1c670aca9a73b9d0dacf792f44a33cb8 100644 (file)
@@ -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
index 20ce9f658eccca49f2d007397196a8030459f334..4f0d32ad10736ba9caa1d03f66906a7ebd60245c 100644 (file)
@@ -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 7c8df4b9db64e4663394d1b97ba7b9529037327a..b6903ba076c64c4abfc52aca4aab6a39b5b42ee0 100644 (file)
--- 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);