]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_phys.c
don't upload a fog texture for explosion shells if r_loadfog is false
[xonotic/darkplaces.git] / sv_phys.c
index 75b7942d64b4b1c56926c4124ba975b295ca8a2d..7235fac729278bed36c7ad98dceefd8b6101edc3 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -398,7 +398,7 @@ trace_t SV_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_
 finished:
 #ifdef COLLISION_STUPID_TRACE_ENDPOS_IN_SOLID_WORKAROUND
        if(!VectorCompare(start, pEnd) && collision_endposnudge.value > 0)
-               Collision_ShortenTrace(&cliptrace, len / (len + 1), pEnd);
+               Collision_ShortenTrace(&cliptrace, len / (len + collision_endposnudge.value), pEnd);
 #endif
        return cliptrace;
 }
@@ -598,7 +598,7 @@ trace_t SV_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co
 finished:
 #ifdef COLLISION_STUPID_TRACE_ENDPOS_IN_SOLID_WORKAROUND
        if(!VectorCompare(start, pEnd) && collision_endposnudge.value > 0)
-               Collision_ShortenTrace(&cliptrace, len / (len + 1), pEnd);
+               Collision_ShortenTrace(&cliptrace, len / (len + collision_endposnudge.value), pEnd);
 #endif
        return cliptrace;
 }
@@ -2157,7 +2157,7 @@ Only used by players
 */
 void SV_WalkMove (prvm_edict_t *ent)
 {
-       int clip, oldonground, originalmove_clip, originalmove_flags, originalmove_groundentity, hitsupercontentsmask;
+       int clip, oldonground, originalmove_clip, originalmove_flags, originalmove_groundentity, hitsupercontentsmask, type;
        vec3_t upmove, downmove, start_origin, start_velocity, stepnormal, originalmove_origin, originalmove_velocity;
        trace_t downtrace, trace;
        qboolean applygravity;
@@ -2183,8 +2183,27 @@ void SV_WalkMove (prvm_edict_t *ent)
 
        clip = SV_FlyMove (ent, sv.frametime, applygravity, NULL, hitsupercontentsmask);
 
+       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)
+                       type = MOVE_MISSILE;
+               else if (ent->fields.server->solid == SOLID_TRIGGER || ent->fields.server->solid == SOLID_NOT)
+                       type = MOVE_NOMONSTERS; // only clip against bmodels
+               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)
+                       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))
+       if(!(clip & 1))
                ent->fields.server->flags = (int)ent->fields.server->flags & ~FL_ONGROUND;
 
        SV_CheckVelocity(ent);