From 4697d247f884b54564ab15189fa4dfb3420708e2 Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 10 May 2005 18:39:51 +0000 Subject: [PATCH] added sv_gameplayfix_blowupfallenzombies and sv_gameplayfix_findradiusdistancetobox cvars (to allow these changes to be disabled) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5266 d7cf8633-e32d-0410-b094-e92efae38249 --- pr_cmds.c | 28 +++++++++++++++++++--------- server.h | 2 ++ sv_main.c | 4 ++++ 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/pr_cmds.c b/pr_cmds.c index 096cf4b5..b1be56e3 100644 --- a/pr_cmds.c +++ b/pr_cmds.c @@ -1039,12 +1039,12 @@ void PF_findradius (void) radius = G_FLOAT(OFS_PARM1); radius2 = radius * radius; - 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; + mins[0] = org[0] - (radius + 1); + mins[1] = org[1] - (radius + 1); + mins[2] = org[2] - (radius + 1); + maxs[0] = org[0] + (radius + 1); + maxs[1] = org[1] + (radius + 1); + maxs[2] = org[2] + (radius + 1); numtouchedicts = SV_EntitiesInBox(mins, maxs, MAX_EDICTS, touchedicts); if (numtouchedicts > MAX_EDICTS) { @@ -1056,12 +1056,22 @@ void PF_findradius (void) { ent = touchedicts[i]; pr_xfunction->builtinsprofile++; + // Quake did not return non-solid entities but darkplaces does + // (note: this is the reason you can't blow up fallen zombies) + if (ent->v->solid == SOLID_NOT && !sv_gameplayfix_blowupfallenzombies.integer) + continue; // 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]); + VectorSubtract(org, ent->v->origin, eorg); + if (sv_gameplayfix_findradiusdistancetobox.integer) + { + eorg[0] -= bound(ent->v->mins[0], eorg[0], ent->v->maxs[0]); + eorg[1] -= bound(ent->v->mins[1], eorg[1], ent->v->maxs[1]); + eorg[2] -= bound(ent->v->mins[2], eorg[2], ent->v->maxs[2]); + } + else + VectorMAMAM(1, eorg, 0.5f, ent->v->mins, 0.5f, ent->v->maxs, eorg); if (DotProduct(eorg, eorg) < radius2) { ent->v->chain = EDICT_TO_PROG(chain); diff --git a/server.h b/server.h index 3fcc597b..770be3f7 100644 --- a/server.h +++ b/server.h @@ -277,6 +277,8 @@ extern cvar_t sv_gameplayfix_stepdown; extern cvar_t sv_gameplayfix_stepwhilejumping; extern cvar_t sv_gameplayfix_swiminbmodels; extern cvar_t sv_gameplayfix_setmodelrealbox; +extern cvar_t sv_gameplayfix_blowupfallenzombies; +extern cvar_t sv_gameplayfix_findradiusdistancetobox; extern mempool_t *sv_mempool; diff --git a/sv_main.c b/sv_main.c index 39d3f9d5..2e2f18a6 100644 --- a/sv_main.c +++ b/sv_main.c @@ -40,6 +40,8 @@ cvar_t sv_gameplayfix_stepdown = {0, "sv_gameplayfix_stepdown", "1"}; cvar_t sv_gameplayfix_stepwhilejumping = {0, "sv_gameplayfix_stepwhilejumping", "1"}; cvar_t sv_gameplayfix_swiminbmodels = {0, "sv_gameplayfix_swiminbmodels", "1"}; cvar_t sv_gameplayfix_setmodelrealbox = {0, "sv_gameplayfix_setmodelrealbox", "1"}; +cvar_t sv_gameplayfix_blowupfallenzombies = {0, "sv_gameplayfix_blowupfallenzombies", "1"}; +cvar_t sv_gameplayfix_findradiusdistancetobox = {0, "sv_gameplayfix_findradiusdistancetobox", "1"}; cvar_t sv_progs = {0, "sv_progs", "progs.dat" }; @@ -83,6 +85,8 @@ void SV_Init (void) Cvar_RegisterVariable (&sv_gameplayfix_stepwhilejumping); Cvar_RegisterVariable (&sv_gameplayfix_swiminbmodels); Cvar_RegisterVariable (&sv_gameplayfix_setmodelrealbox); + Cvar_RegisterVariable (&sv_gameplayfix_blowupfallenzombies); + Cvar_RegisterVariable (&sv_gameplayfix_findradiusdistancetobox); Cvar_RegisterVariable (&sv_protocolname); Cvar_RegisterVariable (&sv_ratelimitlocalplayer); Cvar_RegisterVariable (&sv_maxrate); -- 2.39.2