diff options
Diffstat (limited to '')
| -rw-r--r-- | src/vischeck.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/vischeck.cpp b/src/vischeck.cpp index c8c0942..6b531b9 100644 --- a/src/vischeck.cpp +++ b/src/vischeck.cpp | |||
| @@ -232,6 +232,27 @@ void *trace_entity(const Vector &start, const Vector &end, void *ignore) { | |||
| 232 | return tr.ent; | 232 | return tr.ent; |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | // First solid/world hit along a segment, for grenade bounce prediction. | ||
| 236 | // Returns false on a clear path; otherwise fills the impact point and normal. | ||
| 237 | bool trace_solid_segment(const Vector &start, const Vector &end, void *ignore, | ||
| 238 | Vector &out_end, Vector &out_normal) { | ||
| 239 | if (!g_iface.enginetrace) | ||
| 240 | return false; | ||
| 241 | RayCompat ray; | ||
| 242 | make_ray(ray, start, end); | ||
| 243 | GameTraceCompat tr{}; | ||
| 244 | EntityFilter filter(ignore); | ||
| 245 | using TraceRayFn = void (*)(void *, const RayCompat *, unsigned, void *, | ||
| 246 | GameTraceCompat *); | ||
| 247 | vfunc<TraceRayFn>(g_iface.enginetrace, 4)(g_iface.enginetrace, &ray, | ||
| 248 | MASK_PLAYERSOLID, &filter, &tr); | ||
| 249 | if (tr.startsolid || tr.fraction >= 1.0f) | ||
| 250 | return false; | ||
| 251 | out_end = tr.endpos; | ||
| 252 | out_normal = tr.normal; | ||
| 253 | return true; | ||
| 254 | } | ||
| 255 | |||
| 235 | // True when a downward point trace from just above `point` finds a standable | 256 | // 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 | 257 | // surface. Used by edge jump: a ledge has no floor within the probe, slopes and |
| 237 | // stairs do. | 258 | // stairs do. |
