mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
Rename Length to VectorLength.
This commit is contained in:
parent
b99a72e876
commit
c91f1a2aea
14 changed files with 192 additions and 244 deletions
|
@ -46,7 +46,7 @@ extern const vec3_t vec3_origin;
|
|||
#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}
|
||||
#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}
|
||||
#define VectorMA(a,s,b,c) {(c)[0]=(a)[0]+(s)*(b)[0];(c)[1]=(a)[1]+(s)*(b)[1];(c)[2]=(a)[2]+(s)*(b)[2];}
|
||||
#define Length(a) sqrt(DotProduct(a, a))
|
||||
#define VectorLength(a) sqrt(DotProduct(a, a))
|
||||
|
||||
#define VectorScale(a,b,c) {(c)[0]=(a)[0]*(b);(c)[1]=(a)[1]*(b);(c)[2]=(a)[2]*(b);}
|
||||
#define VectorCompare(x, y) (((x)[0] == (y)[0]) && ((x)[1] == (y)[1]) && ((x)[2] == (y)[2]))
|
||||
|
@ -81,26 +81,24 @@ extern const vec3_t vec3_origin;
|
|||
// fall over
|
||||
#define ROLL 2
|
||||
|
||||
void _VectorMA (const vec3_t veca, float scale, const vec3_t vecb,
|
||||
vec3_t vecc);
|
||||
vec_t _DotProduct (const vec3_t v1, const vec3_t v2);
|
||||
void _VectorSubtract (const vec3_t veca, const vec3_t vecb, vec3_t out);
|
||||
void _VectorAdd (const vec3_t veca, const vec3_t vecb, vec3_t out);
|
||||
void _VectorCopy (const vec3_t in, vec3_t out);
|
||||
|
||||
int _VectorCompare (const vec3_t v1, const vec3_t v2);
|
||||
//vec_t Length (vec3_t v);
|
||||
//vec_t _VectorLength (vec3_t v);
|
||||
void _VectorMA (const vec3_t veca, float scale, const vec3_t vecb,
|
||||
vec3_t vecc);
|
||||
void _VectorScale (const vec3_t in, vec_t scale, vec3_t out);
|
||||
void _VectorSubtract (const vec3_t veca, const vec3_t vecb, vec3_t out);
|
||||
void CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross);
|
||||
float VectorNormalize (vec3_t v); // returns vector length
|
||||
void VectorInverse (vec3_t v);
|
||||
void _VectorScale (const vec3_t in, vec_t scale, vec3_t out);
|
||||
int Q_log2(int val);
|
||||
|
||||
void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]);
|
||||
void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);
|
||||
|
||||
void FloorDivMod (double numer, double denom, int *quotient,
|
||||
int *rem);
|
||||
void FloorDivMod (double numer, double denom, int *quotient, int *rem);
|
||||
fixed16_t Invert24To16(fixed16_t val);
|
||||
fixed16_t Mul16_30(fixed16_t multiplier, fixed16_t multiplicand);
|
||||
int GreatestCommonDivisor (int i1, int i2);
|
||||
|
@ -110,7 +108,7 @@ void AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right,
|
|||
void VectorVectors (const vec3_t forward, vec3_t right, vec3_t up);
|
||||
int BoxOnPlaneSide (const vec3_t emins, const vec3_t emaxs,
|
||||
struct mplane_s *plane);
|
||||
float anglemod (float a);
|
||||
float anglemod (float a);
|
||||
|
||||
void RotatePointAroundVector (vec3_t dst, const vec3_t axis,
|
||||
const vec3_t point, float degrees);
|
||||
|
|
|
@ -390,8 +390,8 @@ Mod_LoadTexinfo (lump_t *l)
|
|||
out->vecs[0][j] = LittleFloat (in->vecs[0][j]);
|
||||
out->vecs[1][j] = LittleFloat (in->vecs[1][j]);
|
||||
}
|
||||
len1 = Length (out->vecs[0]);
|
||||
len2 = Length (out->vecs[1]);
|
||||
len1 = VectorLength (out->vecs[0]);
|
||||
len2 = VectorLength (out->vecs[1]);
|
||||
|
||||
len1 = (len1 + len2) / 2;
|
||||
if (len1 < 0.32)
|
||||
|
|
|
@ -296,5 +296,5 @@ RadiusFromBounds (const vec3_t mins, const vec3_t maxs)
|
|||
|
||||
for (i = 0; i < 3; i++)
|
||||
corner[i] = max (fabs (mins[i]), fabs (maxs[i]));
|
||||
return Length (corner);
|
||||
return VectorLength (corner);
|
||||
}
|
||||
|
|
|
@ -397,7 +397,7 @@ CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross)
|
|||
}
|
||||
|
||||
vec_t
|
||||
_Length (const vec3_t v)
|
||||
_VectorLength (const vec3_t v)
|
||||
{
|
||||
float length;
|
||||
|
||||
|
|
|
@ -82,9 +82,8 @@ R_RenderDlight (dlight_t *light)
|
|||
rad = light->radius * 0.35;
|
||||
|
||||
VectorSubtract (light->origin, r_origin, v);
|
||||
if (Length (v) < rad) { // view is inside the dlight
|
||||
if (VectorLength (v) < rad) // view is inside the dlight
|
||||
return;
|
||||
}
|
||||
|
||||
qfglBegin (GL_TRIANGLE_FAN);
|
||||
|
||||
|
|
|
@ -525,7 +525,7 @@ R_DrawEntitiesOnList (void)
|
|||
if (r_dlights[lnum].die >= r_realtime) {
|
||||
VectorSubtract (currententity->origin,
|
||||
r_dlights[lnum].origin, dist);
|
||||
add = r_dlights[lnum].radius - Length (dist);
|
||||
add = r_dlights[lnum].radius - VectorLength (dist);
|
||||
|
||||
if (add > 0)
|
||||
lighting.ambientlight += add;
|
||||
|
@ -593,7 +593,7 @@ R_DrawViewModel (void)
|
|||
continue;
|
||||
|
||||
VectorSubtract (currententity->origin, dl->origin, dist);
|
||||
add = dl->radius - Length (dist);
|
||||
add = dl->radius - VectorLength (dist);
|
||||
if (add > 0)
|
||||
r_viewlighting.ambientlight += add;
|
||||
}
|
||||
|
|
|
@ -550,7 +550,7 @@ R_DrawEntitiesOnList (void)
|
|||
if (r_dlights[lnum].die >= r_realtime) {
|
||||
VectorSubtract (currententity->origin,
|
||||
r_dlights[lnum].origin, dist);
|
||||
add = r_dlights[lnum].radius - Length (dist);
|
||||
add = r_dlights[lnum].radius - VectorLength (dist);
|
||||
|
||||
if (add > 0)
|
||||
lighting.ambientlight += add;
|
||||
|
@ -585,8 +585,7 @@ R_DrawViewModel (void)
|
|||
float add;
|
||||
dlight_t *dl;
|
||||
|
||||
if (r_inhibit_viewmodel
|
||||
|| !r_drawviewmodel->int_val
|
||||
if (r_inhibit_viewmodel || !r_drawviewmodel->int_val
|
||||
|| !r_drawentities->int_val)
|
||||
return;
|
||||
|
||||
|
@ -618,7 +617,7 @@ R_DrawViewModel (void)
|
|||
continue;
|
||||
|
||||
VectorSubtract (currententity->origin, dl->origin, dist);
|
||||
add = dl->radius - Length (dist);
|
||||
add = dl->radius - VectorLength (dist);
|
||||
if (add > 0)
|
||||
r_viewlighting.ambientlight += add;
|
||||
}
|
||||
|
|
|
@ -41,26 +41,24 @@ static const char rcsid[] =
|
|||
#include "QF/input.h"
|
||||
|
||||
float CL_KeyState (kbutton_t *key);
|
||||
qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f,
|
||||
vec3_t p1, vec3_t p2, trace_t *trace);
|
||||
|
||||
vec3_t camera_origin = {0,0,0};
|
||||
vec3_t camera_angles = {0,0,0};
|
||||
vec3_t player_origin = {0,0,0};
|
||||
vec3_t player_angles = {0,0,0};
|
||||
|
||||
|
||||
qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f,
|
||||
vec3_t p1, vec3_t p2, trace_t *trace);
|
||||
vec3_t chase_angles;
|
||||
vec3_t chase_dest;
|
||||
vec3_t chase_dest_angles;
|
||||
vec3_t chase_pos;
|
||||
|
||||
cvar_t *chase_back;
|
||||
cvar_t *chase_up;
|
||||
cvar_t *chase_right;
|
||||
cvar_t *chase_active;
|
||||
|
||||
vec3_t chase_angles;
|
||||
vec3_t chase_dest;
|
||||
vec3_t chase_dest_angles;
|
||||
vec3_t chase_pos;
|
||||
|
||||
|
||||
void
|
||||
Chase_Init_Cvars (void)
|
||||
|
@ -89,33 +87,28 @@ TraceLine (vec3_t start, vec3_t end, vec3_t impact)
|
|||
VectorCopy (trace.endpos, impact);
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Chase_Update
|
||||
==================
|
||||
*/
|
||||
void
|
||||
Chase_Update (void)
|
||||
{
|
||||
vec3_t forward, up, right, stop, dir;
|
||||
float pitch, yaw, fwd;
|
||||
usercmd_t cmd; // movement direction
|
||||
int i;
|
||||
float pitch, yaw, fwd;
|
||||
int i;
|
||||
usercmd_t cmd; // movement direction
|
||||
vec3_t forward, up, right, stop, dir;
|
||||
|
||||
// lazy camera, look toward player entity
|
||||
|
||||
if (chase_active->int_val == 2 || chase_active->int_val == 3)
|
||||
{
|
||||
if (chase_active->int_val == 2 || chase_active->int_val == 3) {
|
||||
// control camera angles with key/mouse/joy-look
|
||||
|
||||
camera_angles[PITCH] += cl.viewangles[PITCH] - player_angles[PITCH];
|
||||
camera_angles[YAW] += cl.viewangles[YAW] - player_angles[YAW];
|
||||
camera_angles[ROLL] += cl.viewangles[ROLL] - player_angles[ROLL];
|
||||
camera_angles[YAW] += cl.viewangles[YAW] - player_angles[YAW];
|
||||
camera_angles[ROLL] += cl.viewangles[ROLL] - player_angles[ROLL];
|
||||
|
||||
if (chase_active->int_val == 2)
|
||||
{
|
||||
if (camera_angles[PITCH] < -60) camera_angles[PITCH] = -60;
|
||||
if (camera_angles[PITCH] > 60) camera_angles[PITCH] = 60;
|
||||
if (chase_active->int_val == 2) {
|
||||
if (camera_angles[PITCH] < -60)
|
||||
camera_angles[PITCH] = -60;
|
||||
if (camera_angles[PITCH] > 60)
|
||||
camera_angles[PITCH] = 60;
|
||||
}
|
||||
|
||||
// move camera, it's not enough to just change the angles because
|
||||
|
@ -124,12 +117,11 @@ Chase_Update (void)
|
|||
if (chase_active->int_val == 3)
|
||||
VectorCopy (r_refdef.vieworg, player_origin);
|
||||
|
||||
AngleVectors (camera_angles, forward, right, up);
|
||||
VectorScale (forward, chase_back->value, forward);
|
||||
AngleVectors (camera_angles, forward, right, up);
|
||||
VectorScale (forward, chase_back->value, forward);
|
||||
VectorSubtract (player_origin, forward, camera_origin);
|
||||
|
||||
if (chase_active->int_val == 2)
|
||||
{
|
||||
if (chase_active->int_val == 2) {
|
||||
VectorCopy (r_refdef.vieworg, player_origin);
|
||||
|
||||
// don't let camera get too low
|
||||
|
@ -139,48 +131,49 @@ Chase_Update (void)
|
|||
|
||||
// don't let camera get too far from player
|
||||
|
||||
VectorSubtract (camera_origin, player_origin, dir);
|
||||
VectorCopy (dir, forward);
|
||||
VectorSubtract (camera_origin, player_origin, dir);
|
||||
VectorCopy (dir, forward);
|
||||
VectorNormalize (forward);
|
||||
|
||||
if (Length (dir) > chase_back->value)
|
||||
{
|
||||
if (VectorLength (dir) > chase_back->value) {
|
||||
VectorScale (forward, chase_back->value, dir);
|
||||
VectorAdd (player_origin, dir, camera_origin);
|
||||
VectorAdd (player_origin, dir, camera_origin);
|
||||
}
|
||||
|
||||
// check for walls between player and camera
|
||||
|
||||
VectorScale (forward, 8, forward);
|
||||
VectorAdd (camera_origin, forward, camera_origin);
|
||||
TraceLine (player_origin, camera_origin, stop);
|
||||
if (Length (stop) != 0)
|
||||
VectorSubtract (stop, forward, camera_origin);
|
||||
VectorScale (forward, 8, forward);
|
||||
VectorAdd (camera_origin, forward, camera_origin);
|
||||
TraceLine (player_origin, camera_origin, stop);
|
||||
if (VectorLength (stop) != 0)
|
||||
VectorSubtract (stop, forward, camera_origin);
|
||||
|
||||
VectorSubtract (camera_origin, r_refdef.vieworg, dir);
|
||||
VectorCopy (dir, forward);
|
||||
VectorSubtract (camera_origin, r_refdef.vieworg, dir);
|
||||
VectorCopy (dir, forward);
|
||||
VectorNormalize (forward);
|
||||
|
||||
if (chase_active->int_val == 2)
|
||||
{
|
||||
if (dir[1] == 0 && dir[0] == 0)
|
||||
{
|
||||
if (chase_active->int_val == 2) {
|
||||
if (dir[1] == 0 && dir[0] == 0) {
|
||||
// look straight up or down
|
||||
// camera_angles[YAW] = r_refdef.viewangles[YAW];
|
||||
if (dir[2] > 0) camera_angles[PITCH] = 90;
|
||||
else camera_angles[PITCH] = 270;
|
||||
}
|
||||
else
|
||||
{
|
||||
// camera_angles[YAW] = r_refdef.viewangles[YAW];
|
||||
if (dir[2] > 0)
|
||||
camera_angles[PITCH] = 90;
|
||||
else
|
||||
camera_angles[PITCH] = 270;
|
||||
} else {
|
||||
yaw = (atan2 (dir[1], dir[0]) * 180 / M_PI);
|
||||
if (yaw < 0) yaw += 360;
|
||||
if (yaw < 180) yaw += 180;
|
||||
else yaw -= 180;
|
||||
if (yaw < 0)
|
||||
yaw += 360;
|
||||
if (yaw < 180)
|
||||
yaw += 180;
|
||||
else
|
||||
yaw -= 180;
|
||||
camera_angles[YAW] = yaw;
|
||||
|
||||
fwd = sqrt (dir[0] * dir[0] + dir[1] * dir[1]);
|
||||
pitch = (atan2 (dir[2], fwd) * 180 / M_PI);
|
||||
if (pitch < 0) pitch += 360;
|
||||
if (pitch < 0)
|
||||
pitch += 360;
|
||||
camera_angles[PITCH] = pitch;
|
||||
}
|
||||
}
|
||||
|
@ -201,36 +194,39 @@ Chase_Update (void)
|
|||
cmd.sidemove -= cl_sidespeed->value * CL_KeyState (&in_moveleft);
|
||||
|
||||
if (!(in_klook.state & 1)) {
|
||||
cmd.forwardmove += cl_forwardspeed->value * CL_KeyState (&in_forward);
|
||||
cmd.forwardmove -= cl_backspeed->value * CL_KeyState (&in_back);
|
||||
cmd.forwardmove += cl_forwardspeed->value
|
||||
* CL_KeyState (&in_forward);
|
||||
cmd.forwardmove -= cl_backspeed->value * CL_KeyState (&in_back);
|
||||
}
|
||||
if (in_speed.state & 1) {
|
||||
cmd.forwardmove *= cl_movespeedkey->value;
|
||||
cmd.sidemove *= cl_movespeedkey->value;
|
||||
cmd.sidemove *= cl_movespeedkey->value;
|
||||
}
|
||||
|
||||
// mouse and joystick controllers add to movement
|
||||
dir[1] = cl.viewangles[1] - camera_angles[1]; dir[0] = 0; dir[2] = 0;
|
||||
dir[1] = cl.viewangles[1] - camera_angles[1]; dir[0] = 0; dir[2] = 0;
|
||||
AngleVectors (dir, forward, right, up);
|
||||
VectorScale (forward, viewdelta.position[2] * m_forward->value, forward);
|
||||
VectorScale (right, viewdelta.position[0] * m_side->value, right);
|
||||
VectorAdd (forward, right, dir);
|
||||
VectorScale (forward, viewdelta.position[2] * m_forward->value,
|
||||
forward);
|
||||
VectorScale (right, viewdelta.position[0] * m_side->value, right);
|
||||
VectorAdd (forward, right, dir);
|
||||
cmd.forwardmove += dir[0];
|
||||
cmd.sidemove -= dir[1];
|
||||
cmd.sidemove -= dir[1];
|
||||
|
||||
dir[1] = camera_angles[1]; dir[0] = 0; dir[2] = 0;
|
||||
dir[1] = camera_angles[1]; dir[0] = 0; dir[2] = 0;
|
||||
AngleVectors (dir, forward, right, up);
|
||||
|
||||
VectorScale (forward, cmd.forwardmove, forward);
|
||||
VectorScale (right, cmd.sidemove, right);
|
||||
VectorAdd (forward, right, dir);
|
||||
VectorScale (right, cmd.sidemove, right);
|
||||
VectorAdd (forward, right, dir);
|
||||
|
||||
if (dir[1] || dir[0])
|
||||
{
|
||||
if (dir[1] || dir[0]) {
|
||||
cl.viewangles[YAW] = (atan2 (dir[1], dir[0]) * 180 / M_PI);
|
||||
if (cl.viewangles[YAW] < 0) cl.viewangles[YAW] += 360;
|
||||
// if (cl.viewangles[YAW] < 180) cl.viewangles[YAW] += 180;
|
||||
// else cl.viewangles[YAW] -= 180;
|
||||
// if (cl.viewangles[YAW] < 180)
|
||||
// cl.viewangles[YAW] += 180;
|
||||
// else
|
||||
// cl.viewangles[YAW] -= 180;
|
||||
}
|
||||
|
||||
cl.viewangles[PITCH] = 0;
|
||||
|
|
|
@ -39,12 +39,12 @@ static const char rcsid[] =
|
|||
|
||||
#include "QF/cbuf.h"
|
||||
#include "QF/clip_hull.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/va.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "host.h"
|
||||
|
@ -52,10 +52,8 @@ static const char rcsid[] =
|
|||
#include "sv_progs.h"
|
||||
#include "world.h"
|
||||
|
||||
/*
|
||||
BUILT-IN FUNCTIONS
|
||||
*/
|
||||
|
||||
// BUILT-IN FUNCTIONS =========================================================
|
||||
|
||||
/*
|
||||
PF_error
|
||||
|
@ -104,8 +102,6 @@ PF_objerror (progs_t *pr)
|
|||
Host_Error ("Program error");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
PF_makevectors
|
||||
|
||||
|
@ -122,7 +118,11 @@ PF_makevectors (progs_t *pr)
|
|||
/*
|
||||
PF_setorigin
|
||||
|
||||
This is the only valid way to move an object without using the physics of the world (setting velocity and waiting). Directly changing origin will not set internal links correctly, so clipping would be messed up. This should be called when an object is spawned, and then only if it is teleported.
|
||||
This is the only valid way to move an object without using the physics of
|
||||
the world (setting velocity and waiting). Directly changing origin will
|
||||
not set internal links correctly, so clipping would be messed up. This
|
||||
should be called when an object is spawned, and then only if it is
|
||||
teleported.
|
||||
|
||||
setorigin (entity, origin)
|
||||
*/
|
||||
|
@ -138,18 +138,16 @@ PF_setorigin (progs_t *pr)
|
|||
SV_LinkEdict (e, false);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SetMinMaxSize (progs_t *pr, edict_t *e, const vec3_t min, const vec3_t max,
|
||||
qboolean rotate)
|
||||
{
|
||||
float *angles;
|
||||
vec3_t rmin, rmax;
|
||||
float a;
|
||||
float bounds[2][3];
|
||||
float xvector[2], yvector[2];
|
||||
float a;
|
||||
vec3_t base, transformed;
|
||||
float *angles;
|
||||
int i, j, k, l;
|
||||
vec3_t rmin, rmax, base, transformed;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
if (min[i] > max[i])
|
||||
|
@ -229,7 +227,6 @@ PF_setsize (progs_t *pr)
|
|||
SetMinMaxSize (pr, e, min, max, false);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
PF_setmodel
|
||||
|
||||
|
@ -276,7 +273,7 @@ PF_setmodel (progs_t *pr)
|
|||
void
|
||||
PF_bprint (progs_t *pr)
|
||||
{
|
||||
const char *s;
|
||||
const char *s;
|
||||
|
||||
s = PF_VarString (pr, 0);
|
||||
SV_BroadcastPrintf ("%s", s);
|
||||
|
@ -292,7 +289,7 @@ PF_bprint (progs_t *pr)
|
|||
void
|
||||
PF_sprint (progs_t *pr)
|
||||
{
|
||||
const char *s;
|
||||
const char *s;
|
||||
client_t *client;
|
||||
int entnum;
|
||||
|
||||
|
@ -310,7 +307,6 @@ PF_sprint (progs_t *pr)
|
|||
MSG_WriteString (&client->message, s);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
PF_centerprint
|
||||
|
||||
|
@ -339,7 +335,6 @@ PF_centerprint (progs_t *pr)
|
|||
MSG_WriteString (&client->message, s);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
PF_particle
|
||||
|
||||
|
@ -359,10 +354,6 @@ PF_particle (progs_t *pr)
|
|||
SV_StartParticle (org, dir, color, count);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
PF_ambientsound
|
||||
*/
|
||||
void
|
||||
PF_ambientsound (progs_t *pr)
|
||||
{
|
||||
|
@ -411,11 +402,10 @@ PF_ambientsound (progs_t *pr)
|
|||
void
|
||||
PF_sound (progs_t *pr)
|
||||
{
|
||||
const char *sample;
|
||||
int channel;
|
||||
const char *sample;
|
||||
float attenuation;
|
||||
int channel, volume;
|
||||
edict_t *entity;
|
||||
int volume;
|
||||
float attenuation;
|
||||
|
||||
entity = P_EDICT (pr, 0);
|
||||
channel = P_FLOAT (pr, 1);
|
||||
|
@ -425,10 +415,8 @@ PF_sound (progs_t *pr)
|
|||
|
||||
if (volume < 0 || volume > 255)
|
||||
Sys_Error ("SV_StartSound: volume = %i", volume);
|
||||
|
||||
if (attenuation < 0 || attenuation > 4)
|
||||
Sys_Error ("SV_StartSound: attenuation = %f", attenuation);
|
||||
|
||||
if (channel < 0 || channel > 7)
|
||||
Sys_Error ("SV_StartSound: channel = %i", channel);
|
||||
|
||||
|
@ -439,9 +427,9 @@ PF_sound (progs_t *pr)
|
|||
/*
|
||||
PF_traceline
|
||||
|
||||
Used for use tracing and shot targeting
|
||||
Traces are blocked by bbox and exact bsp entityes, and also slide box entities
|
||||
if the tryents flag is set.
|
||||
Used for use tracing and shot targeting.
|
||||
Traces are blocked by bbox and exact bsp entityes, and also slide box
|
||||
entities if the tryents flag is set.
|
||||
|
||||
traceline (vector1, vector2, tryents)
|
||||
*/
|
||||
|
@ -449,9 +437,9 @@ void
|
|||
PF_traceline (progs_t *pr)
|
||||
{
|
||||
float *v1, *v2;
|
||||
trace_t trace;
|
||||
int nomonsters;
|
||||
edict_t *ent;
|
||||
trace_t trace;
|
||||
|
||||
v1 = P_VECTOR (pr, 0);
|
||||
v2 = P_VECTOR (pr, 1);
|
||||
|
@ -468,13 +456,13 @@ PF_traceline (progs_t *pr)
|
|||
VectorCopy (trace.endpos, *sv_globals.trace_endpos);
|
||||
VectorCopy (trace.plane.normal, *sv_globals.trace_plane_normal);
|
||||
*sv_globals.trace_plane_dist = trace.plane.dist;
|
||||
|
||||
if (trace.ent)
|
||||
*sv_globals.trace_ent = EDICT_TO_PROG (pr, trace.ent);
|
||||
else
|
||||
*sv_globals.trace_ent = EDICT_TO_PROG (pr, sv.edicts);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
PF_checkpos
|
||||
|
||||
|
@ -488,7 +476,7 @@ PF_checkpos (progs_t *pr)
|
|||
{
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// ============================================================================
|
||||
|
||||
byte checkpvs[MAX_MAP_LEAFS / 8];
|
||||
|
||||
|
@ -521,14 +509,12 @@ PF_newcheckclient (progs_t *pr, int check)
|
|||
|
||||
if (i == check)
|
||||
break; // didn't find anything else
|
||||
|
||||
if (ent->free)
|
||||
continue;
|
||||
if (SVfloat (ent, health) <= 0)
|
||||
continue;
|
||||
if ((int) SVfloat (ent, flags) & FL_NOTARGET)
|
||||
continue;
|
||||
|
||||
// anything that is a client, or has a client as an enemy
|
||||
break;
|
||||
}
|
||||
|
@ -542,6 +528,9 @@ PF_newcheckclient (progs_t *pr, int check)
|
|||
return i;
|
||||
}
|
||||
|
||||
#define MAX_CHECK 16
|
||||
int c_invis, c_notvis;
|
||||
|
||||
/*
|
||||
PF_checkclient
|
||||
|
||||
|
@ -555,14 +544,12 @@ PF_newcheckclient (progs_t *pr, int check)
|
|||
|
||||
name checkclient ()
|
||||
*/
|
||||
#define MAX_CHECK 16
|
||||
int c_invis, c_notvis;
|
||||
void
|
||||
PF_checkclient (progs_t *pr)
|
||||
{
|
||||
edict_t *ent, *self;
|
||||
mleaf_t *leaf;
|
||||
int l;
|
||||
mleaf_t *leaf;
|
||||
vec3_t view;
|
||||
|
||||
// find a new check if on a new frame
|
||||
|
@ -593,7 +580,6 @@ PF_checkclient (progs_t *pr)
|
|||
|
||||
//============================================================================
|
||||
|
||||
|
||||
/*
|
||||
PF_stuffcmd
|
||||
|
||||
|
@ -604,9 +590,9 @@ PF_checkclient (progs_t *pr)
|
|||
void
|
||||
PF_stuffcmd (progs_t *pr)
|
||||
{
|
||||
int entnum;
|
||||
const char *str;
|
||||
const char *str;
|
||||
client_t *old;
|
||||
int entnum;
|
||||
|
||||
entnum = P_EDICTNUM (pr, 0);
|
||||
if (entnum < 1 || entnum > svs.maxclients)
|
||||
|
@ -648,8 +634,8 @@ PF_findradius (progs_t *pr)
|
|||
edict_t *ent, *chain;
|
||||
float rad;
|
||||
float *org;
|
||||
vec3_t eorg;
|
||||
int i, j;
|
||||
vec3_t eorg;
|
||||
|
||||
chain = (edict_t *) sv.edicts;
|
||||
|
||||
|
@ -663,10 +649,10 @@ PF_findradius (progs_t *pr)
|
|||
if (SVfloat (ent, solid) == SOLID_NOT)
|
||||
continue;
|
||||
for (j = 0; j < 3; j++)
|
||||
eorg[j] =
|
||||
org[j] - (SVvector (ent, origin)[j] +
|
||||
(SVvector (ent, mins)[j] + SVvector (ent, maxs)[j]) * 0.5);
|
||||
if (Length (eorg) > rad)
|
||||
eorg[j] = org[j] - (SVvector (ent, origin)[j]
|
||||
+ (SVvector (ent, mins)[j]
|
||||
+ SVvector (ent, maxs)[j]) * 0.5);
|
||||
if (VectorLength (eorg) > rad)
|
||||
continue;
|
||||
|
||||
SVentity (ent, chain) = EDICT_TO_PROG (pr, chain);
|
||||
|
@ -676,7 +662,6 @@ PF_findradius (progs_t *pr)
|
|||
RETURN_EDICT (pr, chain);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PF_Spawn (progs_t *pr)
|
||||
{
|
||||
|
@ -695,7 +680,6 @@ PF_Remove (progs_t *pr)
|
|||
ED_Free (pr, ed);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PR_CheckEmptyString (progs_t *pr, const char *s)
|
||||
{
|
||||
|
@ -705,22 +689,20 @@ PR_CheckEmptyString (progs_t *pr, const char *s)
|
|||
|
||||
void
|
||||
PF_precache_file (progs_t *pr)
|
||||
{ // precache_file is only used to copy
|
||||
//
|
||||
//
|
||||
// files with qcc, it does nothing
|
||||
{
|
||||
// precache_file is only used to copy files with qcc, it does nothing
|
||||
R_INT (pr) = P_INT (pr, 0);
|
||||
}
|
||||
|
||||
void
|
||||
PF_precache_sound (progs_t *pr)
|
||||
{
|
||||
const char *s;
|
||||
const char *s;
|
||||
int i;
|
||||
|
||||
if (sv.state != ss_loading)
|
||||
PR_RunError
|
||||
(pr, "PF_Precache_*: Precache can only be done in spawn functions");
|
||||
PR_RunError (pr, "PF_Precache_*: Precache can only be done in spawn "
|
||||
"functions");
|
||||
|
||||
s = P_STRING (pr, 0);
|
||||
R_INT (pr) = P_INT (pr, 0);
|
||||
|
@ -740,12 +722,12 @@ PF_precache_sound (progs_t *pr)
|
|||
void
|
||||
PF_precache_model (progs_t *pr)
|
||||
{
|
||||
const char *s;
|
||||
const char *s;
|
||||
int i;
|
||||
|
||||
if (sv.state != ss_loading)
|
||||
PR_RunError
|
||||
(pr, "PF_Precache_*: Precache can only be done in spawn functions");
|
||||
PR_RunError (pr, "PF_Precache_*: Precache can only be done in spawn "
|
||||
"functions");
|
||||
|
||||
s = P_STRING (pr, 0);
|
||||
R_INT (pr) = P_INT (pr, 0);
|
||||
|
@ -763,7 +745,6 @@ PF_precache_model (progs_t *pr)
|
|||
PR_RunError (pr, "PF_precache_model: overflow");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
PF_walkmove
|
||||
|
||||
|
@ -868,9 +849,6 @@ PF_lightstyle (progs_t *pr)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
PF_checkbottom
|
||||
*/
|
||||
void
|
||||
PF_checkbottom (progs_t *pr)
|
||||
{
|
||||
|
@ -881,9 +859,6 @@ PF_checkbottom (progs_t *pr)
|
|||
R_FLOAT (pr) = SV_CheckBottom (ent);
|
||||
}
|
||||
|
||||
/*
|
||||
PF_pointcontents
|
||||
*/
|
||||
void
|
||||
PF_pointcontents (progs_t *pr)
|
||||
{
|
||||
|
@ -894,22 +869,22 @@ PF_pointcontents (progs_t *pr)
|
|||
R_FLOAT (pr) = SV_PointContents (v);
|
||||
}
|
||||
|
||||
cvar_t *sv_aim;
|
||||
|
||||
/*
|
||||
PF_aim
|
||||
|
||||
Pick a vector for the player to shoot along
|
||||
vector aim(entity, missilespeed)
|
||||
*/
|
||||
cvar_t *sv_aim;
|
||||
void
|
||||
PF_aim (progs_t *pr)
|
||||
{
|
||||
edict_t *ent, *check, *bestent;
|
||||
vec3_t start, dir, end, bestdir;
|
||||
float dist, bestdist, speed;
|
||||
int i, j;
|
||||
trace_t tr;
|
||||
float dist, bestdist;
|
||||
float speed;
|
||||
vec3_t start, dir, end, bestdir;
|
||||
|
||||
ent = P_EDICT (pr, 0);
|
||||
speed = P_FLOAT (pr, 1);
|
||||
|
@ -939,11 +914,12 @@ PF_aim (progs_t *pr)
|
|||
if (check == ent)
|
||||
continue;
|
||||
if (teamplay->int_val && SVfloat (ent, team) > 0
|
||||
&& SVfloat (ent, team) == SVfloat (check, team)) continue; // don't aim at
|
||||
// teammate
|
||||
&& SVfloat (ent, team) == SVfloat (check, team))
|
||||
continue; // don't aim at teammate
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
end[j] = SVvector (check, origin)[j]
|
||||
+ 0.5 * (SVvector (check, mins)[j] + SVvector (check, maxs)[j]);
|
||||
end[j] = SVvector (check, origin)[j] + 0.5
|
||||
* (SVvector (check, mins)[j] + SVvector (check, maxs)[j]);
|
||||
VectorSubtract (end, start, dir);
|
||||
VectorNormalize (dir);
|
||||
dist = DotProduct (dir, *sv_globals.v_forward);
|
||||
|
@ -957,7 +933,8 @@ PF_aim (progs_t *pr)
|
|||
}
|
||||
|
||||
if (bestent) {
|
||||
VectorSubtract (SVvector (bestent, origin), SVvector (ent, origin), dir);
|
||||
VectorSubtract (SVvector (bestent, origin), SVvector (ent, origin),
|
||||
dir);
|
||||
dist = DotProduct (dir, *sv_globals.v_forward);
|
||||
VectorScale (*sv_globals.v_forward, dist, end);
|
||||
end[2] = dir[2];
|
||||
|
@ -1005,14 +982,7 @@ PF_changeyaw (progs_t *pr)
|
|||
SVvector (ent, angles)[1] = anglemod (current + move);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
MESSAGE WRITING
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
// MESSAGE WRITING ============================================================
|
||||
|
||||
#define MSG_BROADCAST 0 // unreliable to all
|
||||
#define MSG_ONE 1 // reliable to one (msg_entity)
|
||||
|
@ -1029,24 +999,24 @@ WriteDest (progs_t *pr)
|
|||
dest = P_FLOAT (pr, 0);
|
||||
switch (dest) {
|
||||
case MSG_BROADCAST:
|
||||
return &sv.datagram;
|
||||
return &sv.datagram;
|
||||
|
||||
case MSG_ONE:
|
||||
ent = PROG_TO_EDICT (pr, *sv_globals.msg_entity);
|
||||
entnum = NUM_FOR_EDICT (pr, ent);
|
||||
if (entnum < 1 || entnum > svs.maxclients)
|
||||
PR_RunError (pr, "WriteDest: not a client");
|
||||
return &svs.clients[entnum - 1].message;
|
||||
ent = PROG_TO_EDICT (pr, *sv_globals.msg_entity);
|
||||
entnum = NUM_FOR_EDICT (pr, ent);
|
||||
if (entnum < 1 || entnum > svs.maxclients)
|
||||
PR_RunError (pr, "WriteDest: not a client");
|
||||
return &svs.clients[entnum - 1].message;
|
||||
|
||||
case MSG_ALL:
|
||||
return &sv.reliable_datagram;
|
||||
return &sv.reliable_datagram;
|
||||
|
||||
case MSG_INIT:
|
||||
return &sv.signon;
|
||||
return &sv.signon;
|
||||
|
||||
default:
|
||||
PR_RunError (pr, "WriteDest: bad destination");
|
||||
break;
|
||||
PR_RunError (pr, "WriteDest: bad destination");
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -1094,14 +1064,13 @@ PF_WriteString (progs_t *pr)
|
|||
MSG_WriteString (WriteDest (pr), P_STRING (pr, 1));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PF_WriteEntity (progs_t *pr)
|
||||
{
|
||||
MSG_WriteShort (WriteDest (pr), P_EDICTNUM (pr, 1));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// ============================================================================
|
||||
|
||||
void
|
||||
PF_makestatic (progs_t *pr)
|
||||
|
@ -1130,11 +1099,8 @@ PF_makestatic (progs_t *pr)
|
|||
ED_Free (pr, ent);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// ============================================================================
|
||||
|
||||
/*
|
||||
PF_setspawnparms
|
||||
*/
|
||||
void
|
||||
PF_setspawnparms (progs_t *pr)
|
||||
{
|
||||
|
@ -1154,9 +1120,6 @@ PF_setspawnparms (progs_t *pr)
|
|||
sv_globals.parms[i] = client->spawn_parms[i];
|
||||
}
|
||||
|
||||
/*
|
||||
PF_changelevel
|
||||
*/
|
||||
void
|
||||
PF_changelevel (progs_t *pr)
|
||||
{
|
||||
|
@ -1245,9 +1208,9 @@ PF_freeboxhull (progs_t *pr)
|
|||
static vec_t
|
||||
calc_dist (vec3_t p, vec3_t n, vec3_t *offsets)
|
||||
{
|
||||
int i;
|
||||
vec_t d = DotProduct (p, n);
|
||||
vec3_t s, v;
|
||||
int i;
|
||||
|
||||
VectorScale (n, d, s);
|
||||
for (i = 0; i < 3; i++)
|
||||
|
|
|
@ -120,7 +120,7 @@ SV_CheckVelocity (edict_t *ent)
|
|||
#endif
|
||||
}
|
||||
#if 0
|
||||
wishspeed = Length (SVvector (ent, velocity));
|
||||
wishspeed = VectorLength (SVvector (ent, velocity));
|
||||
if (wishspeed > sv_maxvelocity->value) {
|
||||
VectorScale (SVvector (ent, velocity), sv_maxvelocity->value /
|
||||
wishspeed, SVvector (ent, velocity));
|
||||
|
|
|
@ -268,7 +268,7 @@ SV_WaterMove (void)
|
|||
else
|
||||
wishvel[2] += cmd.upmove;
|
||||
|
||||
wishspeed = Length (wishvel);
|
||||
wishspeed = VectorLength (wishvel);
|
||||
if (wishspeed > sv_maxspeed->value) {
|
||||
VectorScale (wishvel, sv_maxspeed->value / wishspeed, wishvel);
|
||||
wishspeed = sv_maxspeed->value;
|
||||
|
@ -276,7 +276,7 @@ SV_WaterMove (void)
|
|||
wishspeed *= 0.7;
|
||||
|
||||
// water friction
|
||||
speed = Length (velocity);
|
||||
speed = VectorLength (velocity);
|
||||
if (speed) {
|
||||
newspeed = speed - host_frametime * speed * sv_friction->value;
|
||||
if (newspeed < 0)
|
||||
|
|
|
@ -75,24 +75,19 @@ vec3_t camera_angles = {0,0,0};
|
|||
vec3_t player_origin = {0,0,0};
|
||||
vec3_t player_angles = {0,0,0};
|
||||
|
||||
|
||||
cvar_t *chase_back;
|
||||
cvar_t *chase_up;
|
||||
cvar_t *chase_right;
|
||||
cvar_t *chase_active;
|
||||
cvar_t *cl_hightrack; // track high fragger
|
||||
cvar_t *cl_chasecam;
|
||||
cvar_t *cl_camera_maxpitch;
|
||||
cvar_t *cl_camera_maxyaw;
|
||||
|
||||
static vec3_t desired_position; // where the camera wants to be
|
||||
static qboolean locked = false;
|
||||
static int oldbuttons;
|
||||
|
||||
// track high fragger
|
||||
cvar_t *cl_hightrack;
|
||||
|
||||
cvar_t *cl_chasecam;
|
||||
|
||||
cvar_t *cl_camera_maxpitch;
|
||||
cvar_t *cl_camera_maxyaw;
|
||||
|
||||
double cam_lastviewtime;
|
||||
qboolean cam_forceview;
|
||||
vec3_t cam_viewangles;
|
||||
|
@ -251,7 +246,7 @@ Cam_IsVisible (player_state_t * player, vec3_t vec)
|
|||
return false;
|
||||
// check distance, don't let the player get too far away or too close
|
||||
VectorSubtract (player->origin, vec, v);
|
||||
d = Length (v);
|
||||
d = VectorLength (v);
|
||||
|
||||
return (d > 16.0);
|
||||
}
|
||||
|
@ -434,7 +429,7 @@ Cam_Track (usercmd_t *cmd)
|
|||
// Ok, move to our desired position and set our angles to view
|
||||
// the player
|
||||
VectorSubtract (desired_position, self->origin, vec);
|
||||
len = Length (vec);
|
||||
len = VectorLength (vec);
|
||||
cmd->forwardmove = cmd->sidemove = cmd->upmove = 0;
|
||||
if (len > 16) { // close enough?
|
||||
MSG_WriteByte (&cls.netchan.message, clc_tmove);
|
||||
|
@ -557,7 +552,6 @@ Cam_FinishMove (usercmd_t *cmd)
|
|||
|
||||
if (cmd->buttons & BUTTON_ATTACK) {
|
||||
if (!(oldbuttons & BUTTON_ATTACK)) {
|
||||
|
||||
oldbuttons |= BUTTON_ATTACK;
|
||||
autocam++;
|
||||
|
||||
|
@ -653,18 +647,13 @@ TraceLine (vec3_t start, vec3_t end, vec3_t impact)
|
|||
VectorCopy (trace.endpos, impact);
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Chase_Update
|
||||
==================
|
||||
*/
|
||||
void
|
||||
Chase_Update (void)
|
||||
{
|
||||
vec3_t forward, up, right, stop, dir;
|
||||
float pitch, yaw, fwd;
|
||||
usercmd_t cmd; // movement direction
|
||||
int i;
|
||||
float pitch, yaw, fwd;
|
||||
int i;
|
||||
vec3_t forward, up, right, stop, dir;
|
||||
usercmd_t cmd; // movement direction
|
||||
|
||||
// lazy camera, look toward player entity
|
||||
|
||||
|
@ -673,13 +662,13 @@ Chase_Update (void)
|
|||
// control camera angles with key/mouse/joy-look
|
||||
|
||||
camera_angles[PITCH] += cl.viewangles[PITCH] - player_angles[PITCH];
|
||||
camera_angles[YAW] += cl.viewangles[YAW] - player_angles[YAW];
|
||||
camera_angles[ROLL] += cl.viewangles[ROLL] - player_angles[ROLL];
|
||||
camera_angles[YAW] += cl.viewangles[YAW] - player_angles[YAW];
|
||||
camera_angles[ROLL] += cl.viewangles[ROLL] - player_angles[ROLL];
|
||||
|
||||
if (chase_active->int_val == 2)
|
||||
{
|
||||
if (camera_angles[PITCH] < -60) camera_angles[PITCH] = -60;
|
||||
if (camera_angles[PITCH] > 60) camera_angles[PITCH] = 60;
|
||||
if (camera_angles[PITCH] > 60) camera_angles[PITCH] = 60;
|
||||
}
|
||||
|
||||
// move camera, it's not enough to just change the angles because
|
||||
|
@ -688,8 +677,8 @@ Chase_Update (void)
|
|||
if (chase_active->int_val == 3)
|
||||
VectorCopy (r_refdef.vieworg, player_origin);
|
||||
|
||||
AngleVectors (camera_angles, forward, right, up);
|
||||
VectorScale (forward, chase_back->value, forward);
|
||||
AngleVectors (camera_angles, forward, right, up);
|
||||
VectorScale (forward, chase_back->value, forward);
|
||||
VectorSubtract (player_origin, forward, camera_origin);
|
||||
|
||||
if (chase_active->int_val == 2)
|
||||
|
@ -707,22 +696,22 @@ Chase_Update (void)
|
|||
VectorCopy (dir, forward);
|
||||
VectorNormalize (forward);
|
||||
|
||||
if (Length (dir) > chase_back->value)
|
||||
if (VectorLength (dir) > chase_back->value)
|
||||
{
|
||||
VectorScale (forward, chase_back->value, dir);
|
||||
VectorAdd (player_origin, dir, camera_origin);
|
||||
VectorAdd (player_origin, dir, camera_origin);
|
||||
}
|
||||
|
||||
// check for walls between player and camera
|
||||
|
||||
VectorScale (forward, 8, forward);
|
||||
VectorAdd (camera_origin, forward, camera_origin);
|
||||
TraceLine (player_origin, camera_origin, stop);
|
||||
if (Length (stop) != 0)
|
||||
VectorSubtract (stop, forward, camera_origin);
|
||||
VectorScale (forward, 8, forward);
|
||||
VectorAdd (camera_origin, forward, camera_origin);
|
||||
TraceLine (player_origin, camera_origin, stop);
|
||||
if (VectorLength (stop) != 0)
|
||||
VectorSubtract (stop, forward, camera_origin);
|
||||
|
||||
VectorSubtract (camera_origin, r_refdef.vieworg, dir);
|
||||
VectorCopy (dir, forward);
|
||||
VectorCopy (dir, forward);
|
||||
VectorNormalize (forward);
|
||||
|
||||
if (chase_active->int_val == 2)
|
||||
|
@ -730,9 +719,11 @@ Chase_Update (void)
|
|||
if (dir[1] == 0 && dir[0] == 0)
|
||||
{
|
||||
// look straight up or down
|
||||
// camera_angles[YAW] = r_refdef.viewangles[YAW];
|
||||
if (dir[2] > 0) camera_angles[PITCH] = 90;
|
||||
else camera_angles[PITCH] = 270;
|
||||
// camera_angles[YAW] = r_refdef.viewangles[YAW];
|
||||
if (dir[2] > 0)
|
||||
camera_angles[PITCH] = 90;
|
||||
else
|
||||
camera_angles[PITCH] = 270;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -765,8 +756,9 @@ Chase_Update (void)
|
|||
cmd.sidemove -= cl_sidespeed->value * CL_KeyState (&in_moveleft);
|
||||
|
||||
if (!(in_klook.state & 1)) {
|
||||
cmd.forwardmove += cl_forwardspeed->value * CL_KeyState (&in_forward);
|
||||
cmd.forwardmove -= cl_backspeed->value * CL_KeyState (&in_back);
|
||||
cmd.forwardmove += cl_forwardspeed->value
|
||||
* CL_KeyState (&in_forward);
|
||||
cmd.forwardmove -= cl_backspeed->value * CL_KeyState (&in_back);
|
||||
}
|
||||
if (in_speed.state & 1) {
|
||||
cmd.forwardmove *= cl_movespeedkey->value;
|
||||
|
@ -776,8 +768,9 @@ Chase_Update (void)
|
|||
// mouse and joystick controllers add to movement
|
||||
dir[1] = cl.viewangles[1] - camera_angles[1]; dir[0] = 0; dir[2] = 0;
|
||||
AngleVectors (dir, forward, right, up);
|
||||
VectorScale (forward, viewdelta.position[2] * m_forward->value, forward);
|
||||
VectorScale (right, viewdelta.position[0] * m_side->value, right);
|
||||
VectorScale (forward, viewdelta.position[2] * m_forward->value,
|
||||
forward);
|
||||
VectorScale (right, viewdelta.position[0] * m_side->value, right);
|
||||
VectorAdd (forward, right, dir);
|
||||
cmd.forwardmove += dir[0];
|
||||
cmd.sidemove -= dir[1];
|
||||
|
@ -817,7 +810,7 @@ Chase_Update (void)
|
|||
|
||||
// check for walls between player and camera
|
||||
TraceLine (r_refdef.vieworg, camera_origin, stop);
|
||||
if (Length (stop) != 0)
|
||||
if (VectorLength (stop) != 0)
|
||||
for (i = 0; i < 3; i++)
|
||||
camera_origin[i] = stop[i] + forward[i] * 8;
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ SV_CheckVelocity (edict_t *ent)
|
|||
#endif
|
||||
}
|
||||
#if 0
|
||||
wishspeed = Length (SVvector (ent, velocity));
|
||||
wishspeed = VectorLength (SVvector (ent, velocity));
|
||||
if (wishspeed > sv_maxvelocity->value) {
|
||||
VectorScale (SVvector (ent, velocity), sv_maxvelocity->value /
|
||||
wishspeed, SVvector (ent, velocity));
|
||||
|
@ -545,7 +545,7 @@ SV_Physics_Pusher (edict_t *ent)
|
|||
return;
|
||||
VectorSubtract (SVvector (ent, origin), oldorg, move);
|
||||
|
||||
l = Length (move);
|
||||
l = VectorLength (move);
|
||||
if (l > (1.0 / 64.0)) {
|
||||
VectorCopy (oldorg, SVvector (ent, origin));
|
||||
SV_Push (ent, move);
|
||||
|
|
|
@ -373,7 +373,7 @@ SV_Multicast (const vec3_t origin, int to)
|
|||
vec3_t delta;
|
||||
|
||||
VectorSubtract (origin, SVvector (client->edict, origin), delta);
|
||||
if (Length (delta) <= 1024)
|
||||
if (VectorLength (delta) <= 1024)
|
||||
goto inrange;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue