Clean up sv_pr_cmds.c, and sync up nq's copy.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2003-05-29 02:40:34 +00:00
parent 9e57425f4f
commit 1c1e6e17c4
2 changed files with 12 additions and 12 deletions

View File

@ -634,7 +634,7 @@ PF_findradius (progs_t *pr)
{
edict_t *ent, *chain;
float rad;
float *org;
float *eorigin, *emins, *emaxs, *org;
int i, j;
vec3_t eorg;
@ -642,6 +642,7 @@ PF_findradius (progs_t *pr)
org = P_VECTOR (pr, 0);
rad = P_FLOAT (pr, 1);
rad *= rad; // Square early, sqrt never
ent = NEXT_EDICT (pr, sv.edicts);
for (i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT (pr, ent)) {
@ -649,11 +650,12 @@ PF_findradius (progs_t *pr)
continue;
if (SVfloat (ent, solid) == SOLID_NOT)
continue;
eorigin = SVvector (ent, origin);
emins = SVvector (ent, mins);
emaxs = SVvector (ent, maxs);
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 (VectorLength (eorg) > rad)
eorg[j] = org[j] - eorigin[j] - 0.5 * (emins[j] - emaxs[j]);
if (DotProduct (eorg, eorg) > rad)
continue;
SVentity (ent, chain) = EDICT_TO_PROG (pr, chain);

View File

@ -628,16 +628,15 @@ PF_findradius (progs_t *pr)
{
edict_t *ent, *chain;
float rad;
float *eorigin, *emins, *emaxs;
float *eorigin, *emins, *emaxs, *org;
int i, j;
vec3_t eorg, org;
vec3_t eorg;
chain = (edict_t *) sv.edicts;
VectorScale (P_VECTOR (pr, 0), 2, org);
org = P_VECTOR (pr, 0);
rad = P_FLOAT (pr, 1);
// * 4 because the * 0.5 was removed from the emins-emaxs average
rad *= 4 * rad; // Square early, sqrt never
rad *= rad; // Square early, sqrt never
ent = NEXT_EDICT (pr, sv.edicts);
for (i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT (pr, ent)) {
@ -648,9 +647,8 @@ PF_findradius (progs_t *pr)
eorigin = SVvector (ent, origin);
emins = SVvector (ent, mins);
emaxs = SVvector (ent, maxs);
for (j = 0; j < 3; j++)
eorg[j] = org[j] - 2 * eorigin[j] - emins[j] - emaxs[j];
eorg[j] = org[j] - eorigin[j] - 0.5 * (emins[j] - emaxs[j]);
if (DotProduct (eorg, eorg) > rad)
continue;