From fcc4e94655c609bc97c97cad4c63d51660e86d9d Mon Sep 17 00:00:00 2001 From: smallmodel <15067410+smallmodel@users.noreply.github.com> Date: Sun, 10 Nov 2024 18:34:33 +0100 Subject: [PATCH] Continue traveling if the bullet trace goes backwards --- code/fgame/weaputils.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/code/fgame/weaputils.cpp b/code/fgame/weaputils.cpp index e5d23952..98f00421 100644 --- a/code/fgame/weaputils.cpp +++ b/code/fgame/weaputils.cpp @@ -2207,6 +2207,8 @@ float BulletAttack( oldfrac = -1; while (trace.fraction < 1.0f) { + Vector vDeltaTrace; + trace = G_Trace( vTraceStart, vec_zero, vec_zero, vTraceEnd, newowner, MASK_SHOT_TRIG, false, "BulletAttack", true ); @@ -2452,6 +2454,13 @@ float BulletAttack( } else { trace.fraction = 1; } + + vDeltaTrace = vTmpEnd - vTraceStart; + if (!bBulletDone && DotProduct(vDeltaTrace, vDir) < 0) { + // Fixed in OPM + // This can happen in rare circumstances if the trace is out of the world limit + break; + } } }