"DP_EF_BLUE "
"DP_EF_FLAME "
"DP_EF_FULLBRIGHT "
+"DP_EF_NODEPTHTEST "
"DP_EF_NODRAW "
"DP_EF_NOSHADOW "
"DP_EF_RED "
"DP_HALFLIFE_MAP "
"DP_HALFLIFE_MAP_CVAR "
"DP_INPUTBUTTONS "
+"DP_LITSPRITES "
"DP_LITSUPPORT "
"DP_MONSTERWALK "
"DP_MOVETYPEBOUNCEMISSILE "
void PF_findradius (void)
{
edict_t *ent, *chain;
- float radius;
- float radius2;
- float *org;
- float eorg[3];
+ vec_t radius, radius2;
+ vec3_t org, eorg, mins, maxs;
int i;
+ int numtouchedicts;
+ edict_t *touchedicts[MAX_EDICTS];
chain = (edict_t *)sv.edicts;
- org = G_VECTOR(OFS_PARM0);
+ VectorCopy(G_VECTOR(OFS_PARM0), org);
radius = G_FLOAT(OFS_PARM1);
radius2 = radius * radius;
- ent = NEXT_EDICT(sv.edicts);
- for (i=1 ; i<sv.num_edicts ; i++, ent = NEXT_EDICT(ent))
+ mins[0] = org[0] - radius;
+ mins[1] = org[1] - radius;
+ mins[2] = org[2] - radius;
+ maxs[0] = org[0] + radius;
+ maxs[1] = org[1] + radius;
+ maxs[2] = org[2] + radius;
+ numtouchedicts = SV_EntitiesInBox(mins, maxs, MAX_EDICTS, touchedicts);
+ if (numtouchedicts > MAX_EDICTS)
+ {
+ // this never happens
+ Con_Printf("SV_EntitiesInBox returned %i edicts, max was %i\n", numtouchedicts, MAX_EDICTS);
+ numtouchedicts = MAX_EDICTS;
+ }
+ for (i = 0;i < numtouchedicts;i++)
{
+ ent = touchedicts[i];
pr_xfunction->builtinsprofile++;
- if (ent->e->free)
- continue;
- if (ent->v->solid == SOLID_NOT)
- continue;
-
- // LordHavoc: compare against bounding box rather than center,
- // and use DotProduct instead of Length, major speedup
+ // LordHavoc: compare against bounding box rather than center so it
+ // doesn't miss large objects, and use DotProduct instead of Length
+ // for a major speedup
eorg[0] = (org[0] - ent->v->origin[0]) - bound(ent->v->mins[0], (org[0] - ent->v->origin[0]), ent->v->maxs[0]);
eorg[1] = (org[1] - ent->v->origin[1]) - bound(ent->v->mins[1], (org[1] - ent->v->origin[1]), ent->v->maxs[1]);
eorg[2] = (org[2] - ent->v->origin[2]) - bound(ent->v->mins[2], (org[2] - ent->v->origin[2]), ent->v->maxs[2]);
- if (DotProduct(eorg, eorg) > radius2)
- continue;
-
- ent->v->chain = EDICT_TO_PROG(chain);
- chain = ent;
+ if (DotProduct(eorg, eorg) < radius2)
+ {
+ ent->v->chain = EDICT_TO_PROG(chain);
+ chain = ent;
+ }
}
RETURN_EDICT(chain);
float speed;
// assume failure if it returns early
- VectorClear(G_VECTOR(OFS_RETURN));
+ VectorCopy(pr_global_struct->v_forward, G_VECTOR(OFS_RETURN));
+ // if sv_aim is so high it can't possibly accept anything, skip out early
+ if (sv_aim.value >= 1)
+ return;
ent = G_EDICT(OFS_PARM0);
if (ent == sv.edicts)
void PF_WriteAngle (void)
{
- if (sv.protocol == PROTOCOL_DARKPLACES5)
- MSG_WriteAngle16i (WriteDest(), G_FLOAT(OFS_PARM1));
- else
- MSG_WriteAngle8i (WriteDest(), G_FLOAT(OFS_PARM1));
+ MSG_WriteAngle (WriteDest(), G_FLOAT(OFS_PARM1), sv.protocol);
}
void PF_WriteCoord (void)
for (i=0 ; i<3 ; i++)
{
MSG_WriteCoord(&sv.signon, ent->v->origin[i], sv.protocol);
- MSG_WriteAngle8i(&sv.signon, ent->v->angles[i]);
+ MSG_WriteAngle(&sv.signon, ent->v->angles[i], sv.protocol);
}
// throw the entity away now
str = G_STRING(OFS_PARM0);
var = Cvar_FindVar (str);
-
- tmp = PR_GetTempString();
- strcpy(tmp, var->string);
-
+ if (var)
+ {
+ tmp = PR_GetTempString();
+ strcpy(tmp, var->string);
+ }
+ else
+ tmp = "";
G_INT(OFS_RETURN) = PR_SetString(tmp);
}