]> de.git.xonotic.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)
committerRudolf Polzer <rpolzer@grawp.div0.qc.to>
Fri, 26 Feb 2010 11:51:09 +0000 (12:51 +0100)
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
::stable-branch::merge=af7e237a4e6bdaab9a340a61a76ea314dff5624a

collision.c

index 05bd19428cd97b80af02bd1ca645e4059e7b4fb0..8da703f00c0d211216e9e3d50ea68f1cfb81a235 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);
 }
 
 
@@ -856,6 +858,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);