turn this into sv_gameplayfix_downtracesupportsongroundflag
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 5 Dec 2009 20:18:23 +0000 (20:18 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 5 Dec 2009 20:18:23 +0000 (20:18 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9542 d7cf8633-e32d-0410-b094-e92efae38249

server.h
sv_phys.c

index 6f28145..1c370d4 100644 (file)
--- a/server.h
+++ b/server.h
@@ -434,6 +434,7 @@ extern cvar_t sv_gameplayfix_stepdown;
 extern cvar_t sv_gameplayfix_stepwhilejumping;
 extern cvar_t sv_gameplayfix_swiminbmodels;
 extern cvar_t sv_gameplayfix_upwardvelocityclearsongroundflag;
+extern cvar_t sv_gameplayfix_downtracesupportsongroundflag;
 extern cvar_t sv_gravity;
 extern cvar_t sv_idealpitchscale;
 extern cvar_t sv_jumpstep;
index c8f73b8..7235fac 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -2183,12 +2183,12 @@ void SV_WalkMove (prvm_edict_t *ent)
 
        clip = SV_FlyMove (ent, sv.frametime, applygravity, NULL, hitsupercontentsmask);
 
-       // if the move did not hit the ground at any point, we're not on ground
+       if(sv_gameplayfix_downtracesupportsongroundflag.integer)
        if(!(clip & 1))
+       {
                // only try this if there was no floor in the way in the trace (no,
                // this check seems to be not REALLY necessary, because if clip & 1,
                // our trace will hit that thing too)
-       {
                VectorSet(upmove, ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2] + 1);
                VectorSet(downmove, ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2] - 1);
                if (ent->fields.server->movetype == MOVETYPE_FLYMISSILE)
@@ -2198,10 +2198,14 @@ void SV_WalkMove (prvm_edict_t *ent)
                else
                        type = MOVE_NORMAL;
                trace = SV_TraceBox(upmove, ent->fields.server->mins, ent->fields.server->maxs, downmove, type, ent, SV_GenericHitSuperContentsMask(ent));
-               if(trace.fraction >= 1 || trace.plane.normal[2] <= 0.7)
-                       ent->fields.server->flags = (int)ent->fields.server->flags & ~FL_ONGROUND;
+               if(trace.fraction < 1 && trace.plane.normal[2] > 0.7)
+                       clip |= 1; // but we HAVE found a floor
        }
 
+       // if the move did not hit the ground at any point, we're not on ground
+       if(!(clip & 1))
+               ent->fields.server->flags = (int)ent->fields.server->flags & ~FL_ONGROUND;
+
        SV_CheckVelocity(ent);
        SV_LinkEdict(ent);
        SV_LinkEdict_TouchAreaGrid(ent);