replace all VectorSubtract (vec3_origin, ... and

VectorCopy (vec3_origin, ... with VectorNegate (... and VectorZero (...,
respectively. Should be a small speedup.
This commit is contained in:
Bill Currie 2003-09-03 22:17:04 +00:00
parent 231a1bfb56
commit 0a8867fde9
13 changed files with 47 additions and 47 deletions

View file

@ -108,7 +108,7 @@ R_ReadPointFile_f (void)
p->die = 99999;
p->color = (-c) & 15;
p->type = pt_static;
VectorCopy (vec3_origin, p->vel);
VectorZero (p->vel);
VectorCopy (org, p->org);
}
@ -379,7 +379,7 @@ R_RocketTrail_QF (entity_t *ent)
p->next = active_particles;
active_particles = p;
VectorCopy (vec3_origin, p->vel);
VectorZero (p->vel);
p->die = r_realtime + 2;
p->ramp = (rand () & 3);
@ -416,7 +416,7 @@ R_GrenadeTrail_QF (entity_t *ent)
p->next = active_particles;
active_particles = p;
VectorCopy (vec3_origin, p->vel);
VectorZero (p->vel);
p->die = r_realtime + 2;
p->ramp = (rand () & 3) + 2;
@ -453,7 +453,7 @@ R_BloodTrail_QF (entity_t *ent)
p->next = active_particles;
active_particles = p;
VectorCopy (vec3_origin, p->vel);
VectorZero (p->vel);
p->die = r_realtime + 2;
p->type = pt_slowgrav;
@ -490,7 +490,7 @@ R_SlightBloodTrail_QF (entity_t *ent)
p->next = active_particles;
active_particles = p;
VectorCopy (vec3_origin, p->vel);
VectorZero (p->vel);
p->die = r_realtime + 2;
p->type = pt_slowgrav;
@ -616,7 +616,7 @@ R_VoorTrail_QF (entity_t *ent)
p->next = active_particles;
active_particles = p;
VectorCopy (vec3_origin, p->vel);
VectorZero (p->vel);
p->die = r_realtime + 0.3;
p->type = pt_static;

View file

@ -109,7 +109,7 @@ R_ReadPointFile_f (void)
p->die = 99999;
p->color = (-c) & 15;
p->type = pt_static;
VectorCopy (vec3_origin, p->vel);
VectorZero (p->vel);
VectorCopy (org, p->org);
}
@ -391,7 +391,7 @@ R_RocketTrail_QF (entity_t *ent)
p->next = active_particles;
active_particles = p;
VectorCopy (vec3_origin, p->vel);
VectorZero (p->vel);
p->die = r_realtime + 2;
p->ramp = (rand () & 3);
@ -428,7 +428,7 @@ R_GrenadeTrail_QF (entity_t *ent)
p->next = active_particles;
active_particles = p;
VectorCopy (vec3_origin, p->vel);
VectorZero (p->vel);
p->die = r_realtime + 2;
p->ramp = (rand () & 3) + 2;
@ -465,7 +465,7 @@ R_BloodTrail_QF (entity_t *ent)
p->next = active_particles;
active_particles = p;
VectorCopy (vec3_origin, p->vel);
VectorZero (p->vel);
p->die = r_realtime + 2;
p->type = pt_slowgrav;
@ -502,7 +502,7 @@ R_SlightBloodTrail_QF (entity_t *ent)
p->next = active_particles;
active_particles = p;
VectorCopy (vec3_origin, p->vel);
VectorZero (p->vel);
p->die = r_realtime + 2;
p->type = pt_slowgrav;
@ -628,7 +628,7 @@ R_VoorTrail_QF (entity_t *ent)
p->next = active_particles;
active_particles = p;
VectorCopy (vec3_origin, p->vel);
VectorZero (p->vel);
p->die = r_realtime + 0.3;
p->type = pt_static;

View file

@ -158,7 +158,7 @@ SV_TryUnstick (edict_t *ent, vec3_t oldvel)
trace_t steptrace;
VectorCopy (SVvector (ent, origin), oldorg);
VectorCopy (vec3_origin, dir);
VectorZero (dir);
for (i = 0; i < 8; i++) {
// try pushing a little in an axial direction
@ -214,7 +214,7 @@ SV_TryUnstick (edict_t *ent, vec3_t oldvel)
VectorCopy (oldorg, SVvector (ent, origin));
}
VectorCopy (vec3_origin, SVvector (ent, velocity));
VectorZero (SVvector (ent, velocity));
return 7; // still not moving
}
@ -261,8 +261,8 @@ SV_WalkMove (edict_t *ent)
// try moving up and forward to go up a step
VectorCopy (oldorg, SVvector (ent, origin)); // back to start pos
VectorCopy (vec3_origin, upmove);
VectorCopy (vec3_origin, downmove);
VectorZero (upmove);
VectorZero (downmove);
upmove[2] = STEPSIZE;
downmove[2] = -STEPSIZE + oldvel[2] * sv_frametime;

View file

@ -259,7 +259,7 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
SVvector (ent, maxs), end, false, ent);
if (trace.allsolid) { // entity is trapped in another solid
VectorCopy (vec3_origin, SVvector (ent, velocity));
VectorZero (SVvector (ent, velocity));
return 3;
}
@ -299,7 +299,7 @@ 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, SVvector (ent, velocity));
VectorZero (SVvector (ent, velocity));
return 3;
}
@ -322,7 +322,7 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
VectorCopy (new_velocity, SVvector (ent, velocity));
} else { // go along the crease
if (numplanes != 2) {
VectorCopy (vec3_origin, SVvector (ent, velocity));
VectorZero (SVvector (ent, velocity));
return 7;
}
CrossProduct (planes[0], planes[1], dir);
@ -333,7 +333,7 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
// if original velocity is against the original velocity, stop dead
// to avoid tiny occilations in sloping corners
if (DotProduct (SVvector (ent, velocity), primal_velocity) <= 0) {
VectorCopy (vec3_origin, SVvector (ent, velocity));
VectorZero (SVvector (ent, velocity));
return blocked;
}
}
@ -655,8 +655,8 @@ SV_Physics_Toss (edict_t *ent)
SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_ONGROUND;
SVentity (ent, groundentity) = EDICT_TO_PROG (&sv_pr_state,
trace.ent);
VectorCopy (vec3_origin, SVvector (ent, velocity));
VectorCopy (vec3_origin, SVvector (ent, avelocity));
VectorZero (SVvector (ent, velocity));
VectorZero (SVvector (ent, avelocity));
}
}
// check for in water

View file

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

View file

@ -974,7 +974,7 @@ CL_SetSolidEntities (void)
packet_entities_t *pak;
pmove.physents[0].model = cl.worldmodel;
VectorCopy (vec3_origin, pmove.physents[0].origin);
VectorZero (pmove.physents[0].origin);
pmove.physents[0].info = 0;
pmove.numphysent = 1;

View file

@ -1439,7 +1439,7 @@ CL_ParseServerMessage (void)
for (i = 0; i < 3; i++)
Con_DPrintf ("%f ", cl.simangles[i]);
Con_DPrintf ("\n");
VectorCopy (vec3_origin, cl.simvel);
VectorZero (cl.simvel);
// automatic fraglogging (by elmex)
// XXX: Should this _really_ called here?

View file

@ -262,7 +262,7 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
SVvector (ent, maxs), end, false, ent);
if (trace.allsolid) { // entity is trapped in another solid
VectorCopy (vec3_origin, SVvector (ent, velocity));
VectorZero (SVvector (ent, velocity));
return 3;
}
@ -302,7 +302,7 @@ 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, SVvector (ent, velocity));
VectorZero (SVvector (ent, velocity));
return 3;
}
@ -325,7 +325,7 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
VectorCopy (new_velocity, SVvector (ent, velocity));
} else { // go along the crease
if (numplanes != 2) {
VectorCopy (vec3_origin, SVvector (ent, velocity));
VectorZero (SVvector (ent, velocity));
return 7;
}
CrossProduct (planes[0], planes[1], dir);
@ -336,7 +336,7 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
// if original velocity is against the original velocity, stop dead
// to avoid tiny occilations in sloping corners
if (DotProduct (SVvector (ent, velocity), primal_velocity) <= 0) {
VectorCopy (vec3_origin, SVvector (ent, velocity));
VectorZero (SVvector (ent, velocity));
return blocked;
}
}
@ -675,8 +675,8 @@ SV_Physics_Toss (edict_t *ent)
SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_ONGROUND;
SVentity (ent, groundentity) = EDICT_TO_PROG (&sv_pr_state,
trace.ent);
VectorCopy (vec3_origin, SVvector (ent, velocity));
VectorCopy (vec3_origin, SVvector (ent, avelocity));
VectorZero (SVvector (ent, velocity));
VectorZero (SVvector (ent, avelocity));
}
}
// check for in water

View file

@ -444,8 +444,8 @@ SV_SpawnSpectator (void)
int i;
edict_t *e;
VectorCopy (vec3_origin, SVvector (sv_player, origin));
VectorCopy (vec3_origin, SVvector (sv_player, view_ofs));
VectorZero (SVvector (sv_player, origin));
VectorZero (SVvector (sv_player, view_ofs));
SVvector (sv_player, view_ofs)[2] = 22;
// search for an info_playerstart to spawn the spectator at

View file

@ -166,7 +166,7 @@ CalcFaceVectors (lightinfo_t *l)
fprintf (stderr, "Texture axis perpendicular to face");
if (distscale < 0) {
distscale = -distscale;
VectorSubtract (vec3_origin, texnormal, texnormal);
VectorNegate (texnormal, texnormal);
}
// distscale is the ratio of the distance along the
@ -481,7 +481,7 @@ LightFace (int surfnum)
VectorCopy (bsp->planes[f->planenum].normal, l.facenormal);
l.facedist = bsp->planes[f->planenum].dist;
if (f->side) {
VectorSubtract (vec3_origin, l.facenormal, l.facenormal);
VectorNegate (l.facenormal, l.facenormal);
l.facedist = -l.facedist;
}

View file

@ -122,11 +122,11 @@ ClearModel (void)
scale = 0;
scale_up = 1.0;
VectorCopy (vec3_origin, adjust);
VectorCopy (vec3_origin, mins);
VectorCopy (vec3_origin, maxs);
VectorCopy (vec3_origin, framesmins);
VectorCopy (vec3_origin, framesmaxs);
VectorZero (adjust);
VectorZero (mins);
VectorZero (maxs);
VectorZero (framesmins);
VectorZero (framesmaxs);
degeneratetris = 0;
cdset = false;

View file

@ -146,7 +146,7 @@ ClipToSeparators (winding_t *source, winding_t *pass, winding_t *target,
// flip the normal if the source portal is backwards
if (fliptest) {
VectorSubtract (vec3_origin, plane.normal, plane.normal);
VectorNegate (plane.normal, plane.normal);
plane.dist = -plane.dist;
}
@ -173,7 +173,7 @@ ClipToSeparators (winding_t *source, winding_t *pass, winding_t *target,
// flip the normal if we want the back side
if (flipclip) {
VectorSubtract (vec3_origin, plane.normal, plane.normal);
VectorNegate (plane.normal, plane.normal);
plane.dist = -plane.dist;
}
@ -251,7 +251,7 @@ RecursiveClusterFlow (int clusternum, threaddata_t *thread, pstack_t *prevstack)
// get plane of portal, point normal into the neighbor cluster
stack.portalplane = portal->plane;
VectorSubtract (vec3_origin, portal->plane.normal, backplane.normal);
VectorNegate (portal->plane.normal, backplane.normal);
backplane.dist = -portal->plane.dist;
if (_VectorCompare (prevstack->portalplane.normal, backplane.normal))

View file

@ -554,7 +554,7 @@ FindPassages (winding_t *source, winding_t *pass)
// flip the normal if the source portal is backwards
if (fliptest) {
VectorSubtract (vec3_origin, plane.normal, plane.normal);
VectorNegate (plane.normal, plane.normal);
plane.dist = -plane.dist;
}
@ -731,7 +731,7 @@ LoadPortals (char *name)
cluster->numportals++;
portal->winding = winding;
VectorSubtract (vec3_origin, plane.normal, portal->plane.normal);
VectorNegate (plane.normal, portal->plane.normal);
portal->plane.dist = -plane.dist;
portal->cluster = clusternums[1];
portal++;