vec3_t end;
vec_t len = 0;
- if(!VectorCompare(start, pEnd))
+ if(!VectorCompare(start, pEnd) && collision_endposnudge.value > 0)
{
// TRICK: make the trace 1 qu longer!
VectorSubtract(pEnd, start, end);
len = VectorNormalizeLength(end);
- VectorAdd(pEnd, end, end);
+ VectorMA(pEnd, collision_endposnudge.value, end, end);
}
else
VectorCopy(pEnd, end);
finished:
#ifdef COLLISION_STUPID_TRACE_ENDPOS_IN_SOLID_WORKAROUND
- if(!VectorCompare(start, pEnd))
- Collision_ShortenTrace(&cliptrace, len / (len + 1), pEnd);
+ if(!VectorCompare(start, pEnd) && collision_endposnudge.value > 0)
+ Collision_ShortenTrace(&cliptrace, len / (len + collision_endposnudge.value), pEnd);
#endif
return cliptrace;
}
vec3_t end;
vec_t len = 0;
- if(!VectorCompare(start, pEnd))
+ if(!VectorCompare(start, pEnd) && collision_endposnudge.value > 0)
{
// TRICK: make the trace 1 qu longer!
VectorSubtract(pEnd, start, end);
len = VectorNormalizeLength(end);
- VectorAdd(pEnd, end, end);
+ VectorMA(pEnd, collision_endposnudge.value, end, end);
}
else
VectorCopy(pEnd, end);
finished:
#ifdef COLLISION_STUPID_TRACE_ENDPOS_IN_SOLID_WORKAROUND
- if(!VectorCompare(start, pEnd))
- Collision_ShortenTrace(&cliptrace, len / (len + 1), pEnd);
+ if(!VectorCompare(start, pEnd) && collision_endposnudge.value > 0)
+ Collision_ShortenTrace(&cliptrace, len / (len + collision_endposnudge.value), pEnd);
#endif
return cliptrace;
}
*/
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;
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);