fix(physics): restore swapped-component tangent driver

Use the binary tangent velocity -(vx*normal_y + vy*normal_x)/length, then combine it with retained spin and the Real48 response coefficient. This single formula matches live outer/inner shooter walls, object 155, bumper 51, and the horizontal special-drain response; update C evidence and keep autoplay coverage on a target-reaching seed.

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
- original Wine traces: /tmp/original-outer-wall.csv /tmp/original-inner-wall.csv /tmp/original-circle155-after.csv /tmp/original-special-respawn.csv
- git diff --check
This commit is contained in:
2026-08-23 19:48:30 +02:00
parent 3dce159965
commit 6f8c55657b
6 changed files with 47 additions and 15 deletions
+18 -2
View File
@@ -191,6 +191,22 @@ static int32_t normal_velocity_checked(
velocity_x, velocity_y, normal_x, normal_y, normal_length);
}
static int32_t tangent_velocity_unchecked(
int32_t velocity_x,
int32_t velocity_y,
BorlandReal48 normal_x,
BorlandReal48 normal_y,
int32_t normal_length)
{
return negate_wrap(borland_real48_round_to_i32(borland_real48_divide(
borland_real48_add(
borland_real48_multiply(
borland_i32_to_real48(velocity_x), normal_y),
borland_real48_multiply(
borland_i32_to_real48(velocity_y), normal_x)),
borland_i32_to_real48(normal_length))));
}
static int32_t speed_milli(int32_t velocity_x, int32_t velocity_y)
{
return distance_milli(velocity_x, velocity_y);
@@ -911,7 +927,7 @@ static void apply_collision_response(
tdkpin_add_score_from_caller_frame(caller_bp, candidate->score);
}
int32_t length = candidate_normal_length(candidate);
int32_t projection = normal_velocity_unchecked(
int32_t projection = tangent_velocity_unchecked(
motion->velocity_x,
motion->velocity_y,
candidate->normal_x,
@@ -944,7 +960,7 @@ static void apply_collision_response(
discarded),
borland_i32_to_real48(motion->speed))),
borland_real48_multiply(
borland_i32_to_real48(candidate->normal_velocity),
borland_i32_to_real48(projection),
candidate->response_tangent)));
motion->spin = borland_real48_add(
borland_real48_multiply(motion->spin, g_real48_point_six),