acdream/tools/cdb
Erik fd1548af61 feat(phys): A6.P4 door — cdb-driven NegPolyHit dispatch (incomplete; needs BSP near-miss recording)
cdb attached to retail at a Holtburg cottage door while user walked the
inside-out off-center scenario. Three trace iterations identified that
retail's collision-recording happens via SPHEREPATH::set_neg_poly_hit
(fires hundreds of times during inside-out walk), NOT via the more
obvious-named COLLISIONINFO setters (which fire 0 times). Apparatus
scripts at tools/cdb/door-inside-out-v[1-3].cdb + symbol-probe.cdb.

Our codebase has NegPolyHitDispatch defined but never called. The
downstream TransitionalInsert NegPolyHit handler was a stub. Two-part
fix landed:

1. BSPQuery.FindCollisions Path 5 (Contact branch) restructured —
   distinguishes full hit (hit0 == true → StepSphereUp) from near-miss
   (hit0 == false but hitPoly0 != null → NegPolyHitDispatch). Mirrors
   retail BSPTREE::find_collisions at
   acclient_2013_pseudo_c.txt:0053a630-0053a6fb.

2. Transition.TransitionalInsert NegPolyHit handler — dispatches to
   step_up + step_up_slide (NegStepUp=true) or records collision
   normal + returns Collided (NegStepUp=false). Mirrors retail
   CTransition::transitional_insert at
   acclient_2013_pseudo_c.txt:0050b7af-0050b7e6.

Tests: all 11 fix-relevant + regression tests pass including issue #98.

VISUAL VERIFICATION (user-driven inside-out off-center): still squeezes
through. Diagnostic [neg-poly-dispatch] probe shows ZERO hits in
production. The Path 5 restructuring doesn't surface NegPolyHit
because our SphereIntersectsPolyInternal only sets hitPoly on FULL
hits — retail's sphere_intersects_poly sets var_5c (closest polygon)
even on near-misses via BSP-traversal side effect.

Remaining fix (next session): add near-miss polygon recording to
SphereIntersectsPolyInternal. Once it sets hitPoly on near-miss BSP
traversal, the Path 5 NegPolyHit dispatch (this commit) will fire
and the TransitionalInsert handler (this commit) will block.

Full handoff with cdb trace table + next-step plan:
docs/research/2026-05-25-door-bug-cdb-retail-trace-findings.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 10:36:22 +02:00
..
a6-probe-runner.ps1 fix(cdb): A6.P1 — v1 dry-run lessons + v2 prep tooling 2026-05-21 19:38:31 +02:00
a6-probe.cdb fix(cdb): A6.P1 — a6-probe.cdb v4 hex-bits floats 2026-05-21 19:55:48 +02:00
a6-types-dump-runner.ps1 fix(cdb): A6.P1 — v1 dry-run lessons + v2 prep tooling 2026-05-21 19:38:31 +02:00
a6-types-dump.cdb fix(cdb): A6.P1 — v1 dry-run lessons + v2 prep tooling 2026-05-21 19:38:31 +02:00
a6-types-dump.txt fix(cdb): A6.P1 — a6-probe.cdb v2 with PDB-verified offsets 2026-05-21 19:43:50 +02:00
decode_retail_hex.py feat(cdb): A6.P1 — decode_retail_hex.py hex→float decoder 2026-05-21 20:03:03 +02:00
door-inside-out-v2.cdb feat(phys): A6.P4 door — cdb-driven NegPolyHit dispatch (incomplete; needs BSP near-miss recording) 2026-05-25 10:36:22 +02:00
door-inside-out-v3.cdb feat(phys): A6.P4 door — cdb-driven NegPolyHit dispatch (incomplete; needs BSP near-miss recording) 2026-05-25 10:36:22 +02:00
door-inside-out.cdb feat(phys): A6.P4 door — cdb-driven NegPolyHit dispatch (incomplete; needs BSP near-miss recording) 2026-05-25 10:36:22 +02:00
issue98-cellar-up-find-walkable.cdb tools(cdb): A6.P3 #98 Step 4 — retail find_walkable capture script 2026-05-23 15:29:02 +02:00
issue98-runner.ps1 tools(cdb): A6.P3 #98 Step 4 — retail find_walkable capture script 2026-05-23 15:29:02 +02:00
README-a6-probe.md docs(cdb): A6.P1 — README for the cdb probe + runner 2026-05-21 18:44:42 +02:00
symbol-probe.cdb feat(phys): A6.P4 door — cdb-driven NegPolyHit dispatch (incomplete; needs BSP near-miss recording) 2026-05-25 10:36:22 +02:00