vector op cleanups, added pr_droptofloorunits, sets how many units droptofloor QuakeC call will drop, defaults to "" which drops up to 256 units (Quake default)

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2304 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-05-29 04:50:24 +00:00
parent e0c705b4a8
commit 637633af80
14 changed files with 38 additions and 32 deletions

View File

@ -160,7 +160,7 @@ trace_t Cam_DoTrace(vec3_t vec1, vec3_t vec2)
memset(&pmove, 0, sizeof(pmove));
pmove.numphysent = 1;
VectorCopy (vec3_origin, pmove.physents[0].origin);
VectorClear (pmove.physents[0].origin);
pmove.physents[0].model = cl.worldmodel;
#endif
@ -294,7 +294,7 @@ static qboolean InitFlyby(int pnum, player_state_t *self, player_state_t *player
VectorCopy(vec2, vec);
}
// invert
VectorSubtract(vec3_origin, forward, vec2);
VectorNegate(forward, vec2);
if ((f = Cam_TryFlyby(self, player, vec2, checkvis)) < max)
{
max = f;
@ -307,7 +307,7 @@ static qboolean InitFlyby(int pnum, player_state_t *self, player_state_t *player
VectorCopy(vec2, vec);
}
// invert
VectorSubtract(vec3_origin, right, vec2);
VectorNegate(right, vec2);
if ((f = Cam_TryFlyby(self, player, vec2, checkvis)) < max)
{
max = f;

View File

@ -3084,7 +3084,7 @@ void CL_SetSolidEntities (void)
entity_state_t *state;
pmove.physents[0].model = cl.worldmodel;
VectorCopy (vec3_origin, pmove.physents[0].origin);
VectorClear (pmove.physents[0].origin);
pmove.physents[0].info = 0;
pmove.numphysent = 1;

View File

@ -666,7 +666,7 @@ void CL_UpdatePrydonCursor(usercmd_t *from, float cursor_screen[2], vec3_t curso
// cursor_screen[0] = bound(-1, cursor_screen[0], 1);
// cursor_screen[1] = bound(-1, cursor_screen[1], 1);
VectorCopy(vec3_origin, cursor_start);
VectorClear(cursor_start);
temp[0] = (cursor_screen[0]+1)/2;
temp[1] = (-cursor_screen[1]+1)/2;
temp[2] = 1;

View File

@ -4079,7 +4079,7 @@ void CL_ParseServerMessage (void)
cl.simorg[0][i] = MSG_ReadCoord ();
for (i=0 ; i<3 ; i++)
cl.simangles[0][i] = MSG_ReadAngle ();
VectorCopy (vec3_origin, cl.simvel[0]);
VectorClear (cl.simvel[0]);
VectorCopy (cl.simvel[0], cl.simvel[1]);
VectorCopy (cl.simangles[0], cl.simangles[1]);

View File

@ -2984,7 +2984,7 @@ static void P_ParticleTrailDraw (vec3_t startpos, vec3_t end, part_type_t *ptype
p->rgb[1] += p->org[1]*ptype->rgbrand[1] + ptype->rgbchange[1]*p->die;
p->rgb[2] += p->org[2]*ptype->rgbrand[2] + ptype->rgbchange[2]*p->die;
VectorCopy (vec3_origin, p->vel);
VectorClear (p->vel);
if (ptype->emittime < 0)
p->state.trailstate = NULL; // init trailstate
else

View File

@ -155,7 +155,7 @@ qboolean Q1BSP_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f,
}
else
{
VectorSubtract (vec3_origin, plane->normal, trace->plane.normal);
VectorNegate (plane->normal, trace->plane.normal);
trace->plane.dist = -plane->dist;
}

View File

@ -171,7 +171,7 @@ void PMQ2_StepSlideMove_ (void)
// slide along this plane
if (numplanes >= MAX_CLIP_PLANES)
{ // this shouldn't really happen
VectorCopy (vec3_origin, q2pml.velocity);
VectorClear (q2pml.velocity);
break;
}
@ -215,7 +215,7 @@ void PMQ2_StepSlideMove_ (void)
else
{
// Con_Printf ("clip velocity, numplanes == %i\n",numplanes);
VectorCopy (vec3_origin, q2pml.velocity);
VectorClear (q2pml.velocity);
break;
}
@ -244,7 +244,7 @@ void PMQ2_StepSlideMove_ (void)
if (numplanes != 2)
{
// Con_Printf ("clip velocity, numplanes == %i\n",numplanes);
VectorCopy (vec3_origin, q2pml.velocity);
VectorClear (q2pml.velocity);
break;
}
CrossProduct (planes[0], planes[1], dir);
@ -258,7 +258,7 @@ void PMQ2_StepSlideMove_ (void)
//
if (DotProduct (q2pml.velocity, primal_velocity) <= 0)
{
VectorCopy (vec3_origin, q2pml.velocity);
VectorClear (q2pml.velocity);
break;
}
}
@ -905,7 +905,7 @@ void PMQ2_FlyMove (qboolean doclip)
speed = Length (q2pml.velocity);
if (speed < 1)
{
VectorCopy (vec3_origin, q2pml.velocity);
VectorClear (q2pml.velocity);
}
else
{

View File

@ -430,7 +430,6 @@ typedef struct
int maxheight;
int numframes;
float beamlength; // remove?
void *cachespot; // remove?
mspriteframedesc_t frames[1];
} msprite_t;

View File

@ -427,7 +427,7 @@ void DrawSkyPolygon (int nump, vec3_t vecs)
c_sky++;
// decide which face it maps to
VectorCopy (vec3_origin, v);
VectorClear (v);
for (i=0, vp=vecs ; i<nump ; i++, vp+=3)
{
VectorAdd (vp, v, v);

View File

@ -366,7 +366,7 @@ static void LightCalcFaceVectors (llightinfo_t *l)
if (distscale < 0)
{
distscale = -distscale;
VectorSubtract (vec3_origin, texnormal, texnormal);
VectorNegate (texnormal, texnormal);
}
// distscale is the ratio of the distance along the texture normal to
@ -804,7 +804,7 @@ void LightFace (int surfnum)
#endif
if (f->side)
{
VectorSubtract (vec3_origin, l.facenormal, l.facenormal);
VectorNegate (l.facenormal, l.facenormal);
l.facedist = -l.facedist;
}

View File

@ -64,6 +64,8 @@ cvar_t pr_ssqc_coreonerror = SCVAR("pr_coreonerror", "1");
cvar_t pr_tempstringcount = SCVAR("pr_tempstringcount", "16");
cvar_t pr_tempstringsize = SCVAR("pr_tempstringsize", "4096");
cvar_t pr_droptofloorunits = SCVAR("pr_droptofloorunits", "");
cvar_t sv_gameplayfix_honest_tracelines = SCVAR("sv_gameplayfix_honest_tracelines", "1");
cvar_t sv_gameplayfix_blowupfallenzombies = SCVAR("sv_gameplayfix_blowupfallenzombies", "0");
extern cvar_t sv_gameplayfix_noairborncorpse;
@ -181,8 +183,8 @@ pbool ED_CanFree (edict_t *ed)
ed->v->colormap = 0;
ed->v->skin = 0;
ed->v->frame = 0;
VectorCopy (vec3_origin, ed->v->origin);
VectorCopy (vec3_origin, ed->v->angles);
VectorClear (ed->v->origin);
VectorClear (ed->v->angles);
ed->v->nextthink = 0;
ed->v->solid = 0;
@ -935,6 +937,8 @@ void PR_Init(void)
Cvar_Register (&pr_tempstringcount, cvargroup_progs);
Cvar_Register (&pr_tempstringsize, cvargroup_progs);
Cvar_Register (&pr_droptofloorunits, cvargroup_progs);
Cvar_Register (&pr_brokenfloatconvert, cvargroup_progs);
Cvar_Register (&sv_gameplayfix_honest_tracelines, cvargroup_progs);
@ -3885,7 +3889,10 @@ void PF_droptofloor (progfuncs_t *prinst, struct globalvars_s *pr_globals)
ent = PROG_TO_EDICT(prinst, pr_global_struct->self);
VectorCopy (ent->v->origin, end);
end[2] -= 512;
if (pr_droptofloorunits.value > 0)
end[2] -= pr_droptofloorunits.value;
else
end[2] -= 256;
VectorCopy (ent->v->origin, start);
trace = SV_Move (start, ent->v->mins, ent->v->maxs, end, MOVE_NORMAL, ent);

View File

@ -297,7 +297,7 @@ int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
if (trace.startsolid)
{ // entity is trapped in another solid
VectorCopy (vec3_origin, ent->v->velocity);
VectorClear (ent->v->velocity);
return 3;
}
@ -343,7 +343,7 @@ int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
// cliped to another plane
if (numplanes >= MAX_CLIP_PLANES)
{ // this shouldn't really happen
VectorCopy (vec3_origin, ent->v->velocity);
VectorClear (ent->v->velocity);
if (steptrace)
*steptrace = trace; // save for player extrafriction
return 3;
@ -394,7 +394,7 @@ int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
{
// Con_Printf ("clip velocity, numplanes == %i\n",numplanes);
// Con_Printf ("%5.1f %5.1f %5.1f ",ent->v->velocity[0], ent->v->velocity[1], ent->v->velocity[2]);
VectorCopy (vec3_origin, ent->v->velocity);
VectorClear (ent->v->velocity);
// Con_Printf ("%5.1f %5.1f %5.1f\n",ent->v->velocity[0], ent->v->velocity[1], ent->v->velocity[2]);
return 7;
}
@ -413,7 +413,7 @@ int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
//
if (DotProduct (ent->v->velocity, primal_velocity) <= 0)
{
VectorCopy (vec3_origin, ent->v->velocity);
VectorClear (ent->v->velocity);
return blocked;
}
}
@ -516,7 +516,7 @@ qboolean SV_PushAngles (edict_t *pusher, vec3_t move, vec3_t amove)
}
// we need this for pushing things later
VectorSubtract (vec3_origin, amove, org);
VectorNegate (amove, org);
AngleVectors (org, forward, right, up);
// save the pusher's original position
@ -1093,8 +1093,8 @@ void SV_Physics_Toss (edict_t *ent)
{
ent->v->flags = (int)ent->v->flags | FL_ONGROUND;
ent->v->groundentity = EDICT_TO_PROG(svprogfuncs, trace.ent);
VectorCopy (vec3_origin, ent->v->velocity);
VectorCopy (vec3_origin, ent->v->avelocity);
VectorClear (ent->v->velocity);
VectorClear (ent->v->avelocity);
}
}
@ -1322,7 +1322,7 @@ int SV_TryUnstick (edict_t *ent, vec3_t oldvel)
trace_t steptrace;
VectorCopy (ent->v->origin, oldorg);
VectorCopy (vec3_origin, dir);
VectorClear (dir);
for (i=0 ; i<8 ; i++)
{
@ -1358,7 +1358,7 @@ int SV_TryUnstick (edict_t *ent, vec3_t oldvel)
VectorCopy (oldorg, ent->v->origin);
}
VectorCopy (vec3_origin, ent->v->velocity);
VectorClear (ent->v->velocity);
return 7; // still not moving
}

View File

@ -1199,8 +1199,8 @@ void SV_SpawnSpectator (void)
int i;
edict_t *e;
VectorCopy (vec3_origin, sv_player->v->origin);
VectorCopy (vec3_origin, sv_player->v->view_ofs);
VectorClear (sv_player->v->origin);
VectorClear (sv_player->v->view_ofs);
sv_player->v->view_ofs[2] = DEFAULT_VIEWHEIGHT;
sv_player->v->movetype = MOVETYPE_NOCLIP;

View File

@ -2240,7 +2240,7 @@ void R_BuildPolygonFromSurface(msurface_t *fa)
if ( fa->flags & SURF_PLANEBACK )
{
VectorSubtract( vec3_origin, r_q2polydesc.vpn, r_q2polydesc.vpn );
VectorNegate( r_q2polydesc.vpn, r_q2polydesc.vpn );
}
// PGM 09/16/98