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
+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)