]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - chase.c
cleaned up nearly all of the externs in .c files (moved to appropriate .h files)
[xonotic/darkplaces.git] / chase.c
diff --git a/chase.c b/chase.c
index a254c74c62ea1dcf51ee4e74b73aeb3084466704..9bab5473dc09a8be7f207cb73b6008f13add33f9 100644 (file)
--- a/chase.c
+++ b/chase.c
@@ -38,34 +38,35 @@ void Chase_Reset (void)
 //     start position 12 units behind head
 }
 
-extern qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, trace_t *trace);
-
-void TraceLine (vec3_t start, vec3_t end, vec3_t impact)
+float TraceLine (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal)
 {
        trace_t trace;
 
        memset (&trace, 0, sizeof(trace));
-       VectorCopy (end, trace.endpos); // fix TraceLine endpoint bug
+       VectorCopy (end, trace.endpos);
+       trace.fraction = 1;
        SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, start, end, &trace);
        VectorCopy (trace.endpos, impact);
+       VectorCopy (trace.plane.normal, normal);
+       return trace.fraction;
 }
 
 void Chase_Update (void)
 {
-       vec3_t  forward, up, right, stop, chase_dest;
+       vec3_t  forward, stop, chase_dest, normal;
        float   dist;
 
        chase_back.value = bound(0, chase_back.value, 128);
        chase_up.value = bound(-64, chase_up.value, 64);
 
-       AngleVectors (cl.viewangles, forward, right, up);
+       AngleVectors (cl.viewangles, forward, NULL, NULL);
 
        dist = -chase_back.value - 8;
        chase_dest[0] = r_refdef.vieworg[0] + forward[0] * dist;
        chase_dest[1] = r_refdef.vieworg[1] + forward[1] * dist;
        chase_dest[2] = r_refdef.vieworg[2] + forward[2] * dist + chase_up.value;
 
-       TraceLine (r_refdef.vieworg, chase_dest, stop);
+       TraceLine (r_refdef.vieworg, chase_dest, stop, normal);
        chase_dest[0] = stop[0] + forward[0] * 8;
        chase_dest[1] = stop[1] + forward[1] * 8;
        chase_dest[2] = stop[2] + forward[2] * 8;