This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
// chase.c -- chase camera code
#include "quakedef.h"
+#include "cl_collision.h"
-cvar_t chase_back = {"chase_back", "48"};
-cvar_t chase_up = {"chase_up", "22"};
-cvar_t chase_active = {"chase_active", "0"};
+cvar_t chase_back = {CVAR_SAVE, "chase_back", "48"};
+cvar_t chase_up = {CVAR_SAVE, "chase_up", "24"};
+cvar_t chase_active = {CVAR_SAVE, "chase_active", "0"};
void Chase_Init (void)
{
// start position 12 units behind head
}
-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);
- 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, stop, chase_dest, normal;
float dist;
chase_back.value = bound(0, chase_back.value, 128);
- chase_up.value = bound(-64, chase_up.value, 64);
+ chase_up.value = bound(-48, chase_up.value, 96);
AngleVectors (cl.viewangles, forward, NULL, NULL);
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, 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;
+ CL_TraceLine (r_refdef.vieworg, chase_dest, stop, normal, 0, true);
+ chase_dest[0] = stop[0] + forward[0] * 8 + normal[0] * 4;
+ chase_dest[1] = stop[1] + forward[1] * 8 + normal[1] * 4;
+ chase_dest[2] = stop[2] + forward[2] * 8 + normal[2] * 4;
VectorCopy (chase_dest, r_refdef.vieworg);
}