From 2d1f27d647beffa8ab196991343814a781114870 Mon Sep 17 00:00:00 2001 From: Erik Date: Thu, 21 May 2026 18:32:37 +0200 Subject: [PATCH] =?UTF-8?q?feat(physics):=20A6.P1=20=E2=80=94=20add=20LogP?= =?UTF-8?q?ushBackDispatch=20helper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One-line per-call emission helper for the FindCollisions dispatcher instrumentation site. Captures path-selection state (collide flag, insertType, objState) + walk-interp + return state for direct comparison to retail's BSPTREE::find_collisions breakpoint. Output uses the [push-back-disp] tag to disambiguate from [push-back] adjust-sphere events. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../Physics/PhysicsDiagnostics.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/AcDream.Core/Physics/PhysicsDiagnostics.cs b/src/AcDream.Core/Physics/PhysicsDiagnostics.cs index bef8e4d..2cf8224 100644 --- a/src/AcDream.Core/Physics/PhysicsDiagnostics.cs +++ b/src/AcDream.Core/Physics/PhysicsDiagnostics.cs @@ -348,6 +348,44 @@ public static class PhysicsDiagnostics dpPos, dpMove, iDist, applied)); } + /// + /// A6.P1 emission helper for the FindCollisions dispatcher + /// site. One line per call: input sphere center, movement vector, + /// path-selection state flags (collide / insertType / objState), + /// walk-interp at entry, and the return state. Direct paired + /// comparison to retail's cdb breakpoint on + /// BSPTREE::find_collisions. + /// + /// + /// Caller MUST guard with if (!ProbePushBackEnabled) return; + /// before calling. + /// + /// + public static void LogPushBackDispatch( + Vector3 sphereCenter, + Vector3 movement, + bool collide, + int insertType, + int objState, + float walkInterpEntry, + int returnState) + { + // Output format mirrors LogPushBackAdjust: single string.Format + // with CultureInfo.InvariantCulture so the F4 / hex formatting is + // locale-independent and the output is greppable. + var ci = System.Globalization.CultureInfo.InvariantCulture; + Console.WriteLine(string.Format(ci, + "[push-back-disp] site=dispatch " + + "center=({0:F4},{1:F4},{2:F4}) " + + "mvmt=({3:F4},{4:F4},{5:F4}) " + + "collide={6} insertType={7} objState=0x{8:X} " + + "winterp={9:F4} return={10}", + sphereCenter.X, sphereCenter.Y, sphereCenter.Z, + movement.X, movement.Y, movement.Z, + collide, insertType, objState, + walkInterpEntry, returnState)); + } + public static void LogCpBoolWrite(string field, bool oldValue, bool newValue) { var caller = GetCpCallerName();