added sv_gameplayfix_blowupfallenzombies and sv_gameplayfix_findradiusdistancetobox...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 10 May 2005 18:39:51 +0000 (18:39 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 10 May 2005 18:39:51 +0000 (18:39 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5266 d7cf8633-e32d-0410-b094-e92efae38249

pr_cmds.c
server.h
sv_main.c

index 096cf4b..b1be56e 100644 (file)
--- 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);
index 3fcc597..770be3f 100644 (file)
--- 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;
 
index 39d3f9d..2e2f18a 100644 (file)
--- 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);