mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-03-10 12:01:43 +00:00
Tweak PF_findradius
This commit is contained in:
parent
6642ad63b7
commit
a1f522701a
1 changed files with 15 additions and 5 deletions
|
@ -970,24 +970,34 @@ static void PF_findradius (void)
|
||||||
edict_t *ent, *chain;
|
edict_t *ent, *chain;
|
||||||
float rad;
|
float rad;
|
||||||
float *org;
|
float *org;
|
||||||
vec3_t eorg;
|
int i;
|
||||||
int i, j;
|
|
||||||
|
|
||||||
chain = (edict_t *)sv.edicts;
|
chain = (edict_t *)sv.edicts;
|
||||||
|
|
||||||
org = G_VECTOR(OFS_PARM0);
|
org = G_VECTOR(OFS_PARM0);
|
||||||
rad = G_FLOAT(OFS_PARM1);
|
rad = G_FLOAT(OFS_PARM1);
|
||||||
|
rad *= rad;
|
||||||
|
|
||||||
ent = NEXT_EDICT(sv.edicts);
|
ent = NEXT_EDICT(sv.edicts);
|
||||||
for (i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT(ent))
|
for (i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT(ent))
|
||||||
{
|
{
|
||||||
|
float d, lensq;
|
||||||
if (ent->free)
|
if (ent->free)
|
||||||
continue;
|
continue;
|
||||||
if (ent->v.solid == SOLID_NOT)
|
if (ent->v.solid == SOLID_NOT)
|
||||||
continue;
|
continue;
|
||||||
for (j = 0; j < 3; j++)
|
|
||||||
eorg[j] = org[j] - (ent->v.origin[j] + (ent->v.mins[j] + ent->v.maxs[j]) * 0.5);
|
d = org[0] - (ent->v.origin[0] + (ent->v.mins[0] + ent->v.maxs[0]) * 0.5);
|
||||||
if (VectorLength(eorg) > rad)
|
lensq = d * d;
|
||||||
|
if (lensq > rad)
|
||||||
|
continue;
|
||||||
|
d = org[1] - (ent->v.origin[1] + (ent->v.mins[1] + ent->v.maxs[1]) * 0.5);
|
||||||
|
lensq += d * d;
|
||||||
|
if (lensq > rad)
|
||||||
|
continue;
|
||||||
|
d = org[2] - (ent->v.origin[2] + (ent->v.mins[2] + ent->v.maxs[2]) * 0.5);
|
||||||
|
lensq += d * d;
|
||||||
|
if (lensq > rad)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ent->v.chain = EDICT_TO_PROG(chain);
|
ent->v.chain = EDICT_TO_PROG(chain);
|
||||||
|
|
Loading…
Reference in a new issue