fix(game): correct every claw release velocity
Interpret the claw's 3800-unit release scalar per 10 ms physics substep rather than per 30 ms animation frame. This removes a factor-of-three slowdown from all four random terminals and restores terminal 18 to raw `(0,1000)`. Add exact assertions for positions and raw velocities of terminals 1, 6, 7, and 18, backed by repeated live original captures through release and the first three gravity substeps. Test Plan: - `cargo test --all-targets` -- 48 passed - `cargo clippy --all-targets -- -D warnings` -- passed - `cargo build --profile production` -- passed - all four live original terminal trajectories matched - `git diff --cached --check` -- passed
This commit is contained in:
@@ -117,6 +117,13 @@ then cleared suspension during the same timer callback. The three default
|
||||
physics substeps each added 15 millipixels of vertical velocity, confirming the
|
||||
observed total gravity increment of 45 per timer tick.
|
||||
|
||||
Repeated clean trigger probes subsequently covered terminals 1, 6, and 7 as
|
||||
well. After the three default substeps their live states were respectively
|
||||
`(251160,78090),(-2280,45)`, `(265440,100930),(-1520,2325)`, and
|
||||
`(271466,105070),(-1178,2705)`. Terminal 18 produced
|
||||
`(325000,95090),(0,1045)`. These match the recovered release table followed by
|
||||
three `+15` gravity increments; Rust tests now assert every raw release velocity.
|
||||
|
||||
A one-substep probe against the vertical shooter walls recovered the type-2
|
||||
response arithmetic. For unit tangent `t` from the registered start to end and
|
||||
left normal `n`, an incoming contact with `vn = dot(v,n)` and `vt = dot(v,t)`
|
||||
|
||||
@@ -25,7 +25,7 @@ implementation.
|
||||
| Playfield collision layout | Recovered | All 109 active type-2 line objects and 40 static active type-1 circles are transcribed from the original 175-object registration table. The registration routine converts its sideways inputs with `screen = (y, x - 20)` and accumulates explicitly relative objects. Type-2 records retain every recovered Real48 normal/tangent response pair and registered one-sided orientation. Type-1 records retain their swept-circle radius, radial rebound, tangent coupling, and bumper kick. Each flipper uses its exact two line records plus moving tip circle in both positions. The upward edge transfer matches three live probes and the downstroke matches its live position-preserving `(3519,6302)` transfer; both are mirrored on the right. Object 174 is omitted because the original overwrites it with the live ball every frame. |
|
||||
| Ball launcher | Recovered | The initial 32-bit fixed-point coordinates decode to `(325, 413)` in the right shooter lane. The port reproduces the initial `-375` millipixel Down event, 650 ms repeat delay, 40 ms repeats, release impulse, and randomized clamp below the original `-3800` maximum. This replaces the former guessed 330-430 px/s shot. |
|
||||
| Physics arithmetic | Partly recovered | Production movement uses the original 10 ms millipixel substep, `+15` vertical acceleration, `3800` speed bound, point-path type-2 intersection, one-sided line response, swept type-1 circle response, and swept non-physical sensor contacts. It evaluates all records and applies the earliest contact along the substep. Live probes cover ordinary rails, ordinary circles, a kicked bumper, lock holes, and both flipper directions. Persistent physical-contact bookkeeping remains pending. |
|
||||
| Rules | Partly recovered | Player count, controls, the five three-line bumper-value groups, four three-line TDK-diamond groups, five doubling-value lock holes, wheel-reset target, permanent double scoring, KByte media progression, and media extra balls follow original help/code paths and object flags. Claw contact and all initially active type-4 targets use recovered records. The top three targets score 500 each and independently enable the left, center, or right magnetic field record; each field pulls the ball upward until it exits and then deactivates. Remaining special-target effects still require full rule restoration. The claw state machine and release table are readable and terminal 18 has live differential evidence; terminals 1, 6, and 7 still need equivalent live coverage. |
|
||||
| Rules | Partly recovered | Player count, controls, the five three-line bumper-value groups, four three-line TDK-diamond groups, five doubling-value lock holes, wheel-reset target, permanent double scoring, KByte media progression, and media extra balls follow original help/code paths and object flags. Claw contact and all initially active type-4 targets use recovered records. The top three targets score 500 each and independently enable the left, center, or right magnetic field record; each field pulls the ball upward until it exits and then deactivates. Remaining special-target effects still require full rule restoration. The claw state machine and release table are readable and all four random terminals have live differential trajectory coverage. |
|
||||
| Numeric scoring | Partly inferred | Visible 2000-6000 target values and recovered registration values are preserved. Some bumper, bank-completion, robot, wheel, lock, and media thresholds are best-evidence reconstructions because the decompiler did not recover meaningful names or a clean rule table. |
|
||||
| High scores | Compatible import | The original 276-byte table is decoded as ten `IWIK`-XOR-obfuscated little-endian scores plus ten 22-byte names, sorted, then migrated to portable JSON. |
|
||||
| Configuration | Behaviorally compatible | Sound, language, and five detail levels are retained. Storage moves from a local Win16 INI file to the platform user-data directory. |
|
||||
|
||||
+29
-10
@@ -29,7 +29,7 @@ const CLAW_TRIGGER_RADIUS: f32 = 19.0;
|
||||
// deterministic on modern machines.
|
||||
const CLAW_FRAME_SECONDS: f32 = 0.030;
|
||||
const CLAW_TERMINAL_FRAMES: [u8; 4] = [1, 6, 7, 18];
|
||||
const ORIGINAL_BALL_SPEED_PER_SECOND: f32 = 3.8 / CLAW_FRAME_SECONDS;
|
||||
const ORIGINAL_BALL_SPEED_PER_SECOND: f32 = 380.0;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
pub struct Controls {
|
||||
@@ -925,7 +925,7 @@ fn claw_release(frame: u8) -> (Vec2, Vec2) {
|
||||
7 => (vec2(275.0, 97.0), vec2(-0.31, 0.70)),
|
||||
8 => (vec2(278.0, 98.0), vec2(-0.20, 0.80)),
|
||||
9 => (vec2(282.0, 101.0), vec2(-0.10, 0.90)),
|
||||
18 => return (vec2(325.0, 92.0), vec2(0.0, 1.0 / CLAW_FRAME_SECONDS)),
|
||||
18 => return (vec2(325.0, 92.0), vec2(0.0, 100.0)),
|
||||
_ => unreachable!("the original claw only releases from a terminal frame"),
|
||||
};
|
||||
(position, direction * ORIGINAL_BALL_SPEED_PER_SECOND)
|
||||
@@ -1421,8 +1421,8 @@ mod tests {
|
||||
assert_eq!(game.claw.bank, ClawSpriteBank::Opening);
|
||||
assert!(!game.claw.ball_suspended);
|
||||
assert_eq!(game.ball.position, vec2(270.0, 94.0));
|
||||
assert!((game.ball.velocity.x - -50.666_668).abs() < 0.001);
|
||||
assert!((game.ball.velocity.y - 76.0).abs() < 0.001);
|
||||
assert!((game.ball.velocity.x - -152.0).abs() < 0.001);
|
||||
assert!((game.ball.velocity.y - 228.0).abs() < 0.001);
|
||||
|
||||
for expected_frame in [7, 8, 9, 10] {
|
||||
game.update_claw(CLAW_FRAME_SECONDS, &mut events);
|
||||
@@ -1553,13 +1553,32 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn claw_release_table_decodes_the_original_thousandth_pixel_coordinates() {
|
||||
for (frame, expected) in [
|
||||
(1, vec2(258.0, 78.0)),
|
||||
(6, vec2(270.0, 94.0)),
|
||||
(7, vec2(275.0, 97.0)),
|
||||
(18, vec2(325.0, 92.0)),
|
||||
for (frame, expected_position, expected_velocity) in [
|
||||
(1, vec2(258.0, 78.0), MilliVec { x: -2_280, y: 0 }),
|
||||
(
|
||||
6,
|
||||
vec2(270.0, 94.0),
|
||||
MilliVec {
|
||||
x: -1_520,
|
||||
y: 2_280,
|
||||
},
|
||||
),
|
||||
(
|
||||
7,
|
||||
vec2(275.0, 97.0),
|
||||
MilliVec {
|
||||
x: -1_178,
|
||||
y: 2_660,
|
||||
},
|
||||
),
|
||||
(18, vec2(325.0, 92.0), MilliVec { x: 0, y: 1_000 }),
|
||||
] {
|
||||
assert_eq!(claw_release(frame).0, expected);
|
||||
let (position, velocity) = claw_release(frame);
|
||||
assert_eq!(position, expected_position);
|
||||
assert_eq!(
|
||||
MilliVec::from_velocity_per_second(velocity),
|
||||
expected_velocity
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user