From 637633af80e07e693ef166a42186d0a3fc84b213 Mon Sep 17 00:00:00 2001 From: TimeServ Date: Mon, 29 May 2006 04:50:24 +0000 Subject: [PATCH] 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 --- engine/client/cl_cam.c | 6 +++--- engine/client/cl_ents.c | 2 +- engine/client/cl_input.c | 2 +- engine/client/cl_parse.c | 2 +- engine/client/r_part.c | 2 +- engine/common/q1bsp.c | 2 +- engine/common/q2pmove.c | 10 +++++----- engine/gl/gl_model.h | 1 - engine/gl/gl_warp.c | 2 +- engine/gl/ltface.c | 4 ++-- engine/server/pr_cmds.c | 13 ++++++++++--- engine/server/sv_phys.c | 18 +++++++++--------- engine/server/sv_user.c | 4 ++-- engine/sw/r_draw.c | 2 +- 14 files changed, 38 insertions(+), 32 deletions(-) diff --git a/engine/client/cl_cam.c b/engine/client/cl_cam.c index 68524adae..d1cccd977 100644 --- a/engine/client/cl_cam.c +++ b/engine/client/cl_cam.c @@ -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; diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index 411343d3d..7cb43bb4d 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -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; diff --git a/engine/client/cl_input.c b/engine/client/cl_input.c index 02ae49d95..f6f1656cc 100644 --- a/engine/client/cl_input.c +++ b/engine/client/cl_input.c @@ -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; diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 279ce3396..a96ead7d8 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -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]); diff --git a/engine/client/r_part.c b/engine/client/r_part.c index 033d60870..80e8eb516 100644 --- a/engine/client/r_part.c +++ b/engine/client/r_part.c @@ -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 diff --git a/engine/common/q1bsp.c b/engine/common/q1bsp.c index 63015d212..7e1b8a55d 100644 --- a/engine/common/q1bsp.c +++ b/engine/common/q1bsp.c @@ -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; } diff --git a/engine/common/q2pmove.c b/engine/common/q2pmove.c index e3cde6d42..17580847a 100644 --- a/engine/common/q2pmove.c +++ b/engine/common/q2pmove.c @@ -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 { diff --git a/engine/gl/gl_model.h b/engine/gl/gl_model.h index 398367e1b..f3e84cfff 100644 --- a/engine/gl/gl_model.h +++ b/engine/gl/gl_model.h @@ -430,7 +430,6 @@ typedef struct int maxheight; int numframes; float beamlength; // remove? - void *cachespot; // remove? mspriteframedesc_t frames[1]; } msprite_t; diff --git a/engine/gl/gl_warp.c b/engine/gl/gl_warp.c index d19aa78a5..4f11a4744 100644 --- a/engine/gl/gl_warp.c +++ b/engine/gl/gl_warp.c @@ -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 ; iside) { - VectorSubtract (vec3_origin, l.facenormal, l.facenormal); + VectorNegate (l.facenormal, l.facenormal); l.facedist = -l.facedist; } diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index cc9da8a50..ae6f1a70f 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -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); diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index e659b50ac..db1c8a0ef 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -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 } diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index 9ed0cb9d2..ffde72e30 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -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; diff --git a/engine/sw/r_draw.c b/engine/sw/r_draw.c index eb2bda3a5..192ac35a6 100644 --- a/engine/sw/r_draw.c +++ b/engine/sw/r_draw.c @@ -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