fix(physics): restore binary record scan order

Interleave static ranges, type-three captures, type-four triggers, magnetic records, and dynamic ball records in exact ID order while tracking predicted position separately from mutable motion. Preserve type-three/dynamic broadphase and the raw stack quirk where fixed candidate slot one wins even when a later candidate is nearer; seal that behavior in both C and Rust harnesses.

Test Plan:
- bash original/tools/test_reconstructed_c.sh
- python3 original/tools/audit_reconstruction.py --require-complete
- cargo test --all-targets
- cargo clippy --all-targets --all-features -- -D warnings
- rumdl check original/C_RECONSTRUCTION_FINAL_AUDIT.md original/MECHANICS_PROGRESS.md tdkpin-rs/CHANGELOG.md tdkpin-rs/RECONSTRUCTION.md tdkpin-rs/README.md
- git diff --check
This commit is contained in:
2026-08-23 18:46:44 +02:00
parent 89880e9b45
commit f8dcceda5e
8 changed files with 458 additions and 105 deletions
+4 -1
View File
@@ -74,7 +74,10 @@ the original Borland compiler.
Post-audit evidence correction (2026-08-23): raw `1000:9b69` reads predicted
DGROUP coordinates `1028:07db/07df`, not current `07d3/07d7`. The readable
helper and its harness now reflect that distinction; the complete C test and
ledger gates below still pass.
ledger gates below still pass. Raw `1000:c79c` also confirms that the response
reads fixed candidate slot 1 at `SS:...d8a2`; later nearer candidates are stored
in subsequent 0x34-byte slots but do not replace the applied record. A focused
two-candidate harness now seals that record-order behavior.
## Reproducible gates
+5 -4
View File
@@ -164,10 +164,11 @@ the associated magnetic gate; there is no recovered 1,500-per-target plus
scores and use the same enter-once contact bit, which clears after the ball
leaves their radius.
The collision scan at `1000:c79c` does not resolve the first matching object id.
It retains the smallest path-progress value while traversing all 175 records,
then applies that response from the previous position. The Rust fixed-point
solver now follows that ordering for recovered type-1 and type-2 objects.
Post-audit raw-stack correction: the collision scan at `1000:c79c` stores each
later, nearer candidate in the next 0x34-byte stack slot, but response code
continues to read the first slot at `SS:...d8a2`. The first detected object ID
therefore wins even when a later candidate has smaller surface distance. The
readable C harness and Rust scanner preserve this binary quirk.
`1000:b476` decodes the physical bank flags in `OBJECTS.tsv`. Flags `0x208a`
on records 90-104 deactivate five complete three-line groups; clearing all five
+3
View File
@@ -1081,6 +1081,9 @@ static void integrate_one_ball(
candidates,
&candidate_count);
if (collided) {
/* Raw 1000:c79c stores each later, nearer candidate at the next
* 0x34-byte stack slot but resolves the fixed first slot at
* SS:...d8a2. Record order therefore wins over closest distance. */
apply_collision_response(
caller_bp,
window,
@@ -336,6 +336,22 @@ static void test_circle_and_segment_collisions(void)
win16_far_add_offset(g_window, 0x0baa)) == -1000);
assert(g_event_calls == 1 && g_last_event_flags == 0x0020);
assert(g_score_total == 100);
prepare_fixture();
set_ball(100000, 100000, 0, 1000);
segment = base_record(2);
segment.point1_x_milli = 50000;
segment.point1_y_milli = 101000;
segment.point2_x_milli = 150000;
segment.point2_y_milli = 101000;
write_record(1, &segment);
segment.point1_y_milli = 100500;
segment.point2_y_milli = 100500;
segment.response_normal = borland_i32_to_real48(1);
write_record(2, &segment);
tdkpin_simulate_ball_and_dispatch_collision(0x0300);
assert((int32_t)win16_read_u32(
win16_far_add_offset(g_window, 0x0bae)) == 0);
}
static void test_capture_and_trigger_records(void)