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

View File

@ -3084,7 +3084,7 @@ void CL_SetSolidEntities (void)
entity_state_t *state; entity_state_t *state;
pmove.physents[0].model = cl.worldmodel; pmove.physents[0].model = cl.worldmodel;
VectorCopy (vec3_origin, pmove.physents[0].origin); VectorClear (pmove.physents[0].origin);
pmove.physents[0].info = 0; pmove.physents[0].info = 0;
pmove.numphysent = 1; 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[0] = bound(-1, cursor_screen[0], 1);
// cursor_screen[1] = bound(-1, cursor_screen[1], 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[0] = (cursor_screen[0]+1)/2;
temp[1] = (-cursor_screen[1]+1)/2; temp[1] = (-cursor_screen[1]+1)/2;
temp[2] = 1; temp[2] = 1;

View File

@ -4079,7 +4079,7 @@ void CL_ParseServerMessage (void)
cl.simorg[0][i] = MSG_ReadCoord (); cl.simorg[0][i] = MSG_ReadCoord ();
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
cl.simangles[0][i] = MSG_ReadAngle (); 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.simvel[0], cl.simvel[1]);
VectorCopy (cl.simangles[0], cl.simangles[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[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; 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) if (ptype->emittime < 0)
p->state.trailstate = NULL; // init trailstate p->state.trailstate = NULL; // init trailstate
else else

View File

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

View File

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

View File

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

View File

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

View File

@ -366,7 +366,7 @@ static void LightCalcFaceVectors (llightinfo_t *l)
if (distscale < 0) if (distscale < 0)
{ {
distscale = -distscale; distscale = -distscale;
VectorSubtract (vec3_origin, texnormal, texnormal); VectorNegate (texnormal, texnormal);
} }
// distscale is the ratio of the distance along the texture normal to // distscale is the ratio of the distance along the texture normal to
@ -804,7 +804,7 @@ void LightFace (int surfnum)
#endif #endif
if (f->side) if (f->side)
{ {
VectorSubtract (vec3_origin, l.facenormal, l.facenormal); VectorNegate (l.facenormal, l.facenormal);
l.facedist = -l.facedist; 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_tempstringcount = SCVAR("pr_tempstringcount", "16");
cvar_t pr_tempstringsize = SCVAR("pr_tempstringsize", "4096"); 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_honest_tracelines = SCVAR("sv_gameplayfix_honest_tracelines", "1");
cvar_t sv_gameplayfix_blowupfallenzombies = SCVAR("sv_gameplayfix_blowupfallenzombies", "0"); cvar_t sv_gameplayfix_blowupfallenzombies = SCVAR("sv_gameplayfix_blowupfallenzombies", "0");
extern cvar_t sv_gameplayfix_noairborncorpse; extern cvar_t sv_gameplayfix_noairborncorpse;
@ -181,8 +183,8 @@ pbool ED_CanFree (edict_t *ed)
ed->v->colormap = 0; ed->v->colormap = 0;
ed->v->skin = 0; ed->v->skin = 0;
ed->v->frame = 0; ed->v->frame = 0;
VectorCopy (vec3_origin, ed->v->origin); VectorClear (ed->v->origin);
VectorCopy (vec3_origin, ed->v->angles); VectorClear (ed->v->angles);
ed->v->nextthink = 0; ed->v->nextthink = 0;
ed->v->solid = 0; ed->v->solid = 0;
@ -935,6 +937,8 @@ void PR_Init(void)
Cvar_Register (&pr_tempstringcount, cvargroup_progs); Cvar_Register (&pr_tempstringcount, cvargroup_progs);
Cvar_Register (&pr_tempstringsize, cvargroup_progs); Cvar_Register (&pr_tempstringsize, cvargroup_progs);
Cvar_Register (&pr_droptofloorunits, cvargroup_progs);
Cvar_Register (&pr_brokenfloatconvert, cvargroup_progs); Cvar_Register (&pr_brokenfloatconvert, cvargroup_progs);
Cvar_Register (&sv_gameplayfix_honest_tracelines, 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); ent = PROG_TO_EDICT(prinst, pr_global_struct->self);
VectorCopy (ent->v->origin, end); 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); VectorCopy (ent->v->origin, start);
trace = SV_Move (start, ent->v->mins, ent->v->maxs, end, MOVE_NORMAL, ent); 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) if (trace.startsolid)
{ // entity is trapped in another solid { // entity is trapped in another solid
VectorCopy (vec3_origin, ent->v->velocity); VectorClear (ent->v->velocity);
return 3; return 3;
} }
@ -343,7 +343,7 @@ int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
// cliped to another plane // cliped to another plane
if (numplanes >= MAX_CLIP_PLANES) if (numplanes >= MAX_CLIP_PLANES)
{ // this shouldn't really happen { // this shouldn't really happen
VectorCopy (vec3_origin, ent->v->velocity); VectorClear (ent->v->velocity);
if (steptrace) if (steptrace)
*steptrace = trace; // save for player extrafriction *steptrace = trace; // save for player extrafriction
return 3; 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 ("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]); // 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]); // Con_Printf ("%5.1f %5.1f %5.1f\n",ent->v->velocity[0], ent->v->velocity[1], ent->v->velocity[2]);
return 7; 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) if (DotProduct (ent->v->velocity, primal_velocity) <= 0)
{ {
VectorCopy (vec3_origin, ent->v->velocity); VectorClear (ent->v->velocity);
return blocked; 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 // we need this for pushing things later
VectorSubtract (vec3_origin, amove, org); VectorNegate (amove, org);
AngleVectors (org, forward, right, up); AngleVectors (org, forward, right, up);
// save the pusher's original position // 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->flags = (int)ent->v->flags | FL_ONGROUND;
ent->v->groundentity = EDICT_TO_PROG(svprogfuncs, trace.ent); ent->v->groundentity = EDICT_TO_PROG(svprogfuncs, trace.ent);
VectorCopy (vec3_origin, ent->v->velocity); VectorClear (ent->v->velocity);
VectorCopy (vec3_origin, ent->v->avelocity); VectorClear (ent->v->avelocity);
} }
} }
@ -1322,7 +1322,7 @@ int SV_TryUnstick (edict_t *ent, vec3_t oldvel)
trace_t steptrace; trace_t steptrace;
VectorCopy (ent->v->origin, oldorg); VectorCopy (ent->v->origin, oldorg);
VectorCopy (vec3_origin, dir); VectorClear (dir);
for (i=0 ; i<8 ; i++) 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 (oldorg, ent->v->origin);
} }
VectorCopy (vec3_origin, ent->v->velocity); VectorClear (ent->v->velocity);
return 7; // still not moving return 7; // still not moving
} }

View File

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

View File

@ -2240,7 +2240,7 @@ void R_BuildPolygonFromSurface(msurface_t *fa)
if ( fa->flags & SURF_PLANEBACK ) 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 // PGM 09/16/98