diff options
Diffstat (limited to '')
| -rw-r--r-- | src/vischeck.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vischeck.cpp b/src/vischeck.cpp index 97a2c12..c8c0942 100644 --- a/src/vischeck.cpp +++ b/src/vischeck.cpp | |||
| @@ -232,6 +232,26 @@ void *trace_entity(const Vector &start, const Vector &end, void *ignore) { | |||
| 232 | return tr.ent; | 232 | return tr.ent; |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | // True when a downward point trace from just above `point` finds a standable | ||
| 236 | // surface. Used by edge jump: a ledge has no floor within the probe, slopes and | ||
| 237 | // stairs do. | ||
| 238 | bool point_ground(const Vector &point, void *ignore) { | ||
| 239 | if (!g_iface.enginetrace) | ||
| 240 | return false; | ||
| 241 | RayCompat ray; | ||
| 242 | Vector start{point.x, point.y, point.z + 4.0f}; | ||
| 243 | Vector end{point.x, point.y, point.z - 96.0f}; | ||
| 244 | make_ray(ray, start, end); | ||
| 245 | GameTraceCompat tr{}; | ||
| 246 | EntityFilter filter(ignore); | ||
| 247 | using TraceRayFn = void (*)(void *, const RayCompat *, unsigned, void *, | ||
| 248 | GameTraceCompat *); | ||
| 249 | vfunc<TraceRayFn>(g_iface.enginetrace, 4)(g_iface.enginetrace, &ray, | ||
| 250 | MASK_PLAYERSOLID, &filter, &tr); | ||
| 251 | // A start inside geometry means a wall/step there, not a ledge. | ||
| 252 | return tr.startsolid || tr.fraction < 1.0f; | ||
| 253 | } | ||
| 254 | |||
| 235 | // Vertical distance from the standing player hull's feet to the first | 255 | // Vertical distance from the standing player hull's feet to the first |
| 236 | // standable surface below. Matches CategorizePosition's 2-unit probe and its | 256 | // standable surface below. Matches CategorizePosition's 2-unit probe and its |
| 237 | // plane.normal.z >= 0.7 rule, but sweeps much farther so the caller can | 257 | // plane.normal.z >= 0.7 rule, but sweeps much farther so the caller can |
