]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
added collision_debug_tracelineasbox cvar to work around problems with
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 25 Feb 2010 23:10:15 +0000 (23:10 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 25 Feb 2010 23:10:15 +0000 (23:10 +0000)
traceline on q3bsp, disabled by default due to performance being worse
but should aid in debugging the traceline problems

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10008 d7cf8633-e32d-0410-b094-e92efae38249

collision.c

index 10e2d70ed612d2f7f9c6386a5098595a1328cce9..56666afdf5532da0131f46c899a4cf3bcbfc2c01 100644 (file)
@@ -18,6 +18,7 @@ cvar_t collision_prefernudgedfraction = {0, "collision_prefernudgedfraction", "1
 #ifdef COLLISION_STUPID_TRACE_ENDPOS_IN_SOLID_WORKAROUND
 cvar_t collision_endposnudge = {0, "collision_endposnudge", "0", "workaround to fix trace_endpos sometimes being returned where it would be inside solid by making that collision hit (recommended: values like 1)"};
 #endif
+cvar_t collision_debug_tracelineasbox = {0, "collision_debug_tracelineasbox", "0", "workaround for any bugs in Collision_TraceLineBrushFloat by using Collision_TraceBrushBrushFloat"};
 
 void Collision_Init (void)
 {
@@ -30,6 +31,7 @@ void Collision_Init (void)
 #ifdef COLLISION_STUPID_TRACE_ENDPOS_IN_SOLID_WORKAROUND
        Cvar_RegisterVariable(&collision_endposnudge);
 #endif
+       Cvar_RegisterVariable(&collision_debug_tracelineasbox);
 }
 
 
@@ -860,6 +862,15 @@ void Collision_TraceLineBrushFloat(trace_t *trace, const vec3_t linestart, const
        vec_t startdepth = 1;
        vec3_t startdepthnormal;
 
+       if (collision_debug_tracelineasbox.integer)
+       {
+               colboxbrushf_t thisbrush_start, thisbrush_end;
+               Collision_BrushForBox(&thisbrush_start, linestart, linestart, 0, 0, NULL);
+               Collision_BrushForBox(&thisbrush_end, lineend, lineend, 0, 0, NULL);
+               Collision_TraceBrushBrushFloat(trace, &thisbrush_start.brush, &thisbrush_end.brush, other_start, other_end);
+               return;
+       }
+
        VectorClear(startdepthnormal);
        Vector4Clear(newimpactplane);