fix(physics): restore upward flipper transfer
Apply flipper movement after the physics substep, matching the original timer order. Replace the weak generic tangent kick with the recovered swept-body position transfer and pre-clamp velocity curve fitted from three live left-edge probes, then mirror that local transform for the right flipper. The x=125 probe now reaches `(138.182,355)` with raw velocity within two units of `(2217,-5889)`. Keep downstroke interaction listed as pending rather than claiming the upward fit is the complete raw routine. Test Plan: - `cargo test --all-targets` -- 43 passed - `cargo clippy --all-targets -- -D warnings` -- passed - `cargo build --profile production` -- passed - three live left-flipper transfer probes matched within documented tolerance - `git diff --cached --check` -- passed
This commit is contained in:
@@ -137,5 +137,9 @@ are line 66 `(98,382)->(131,369)`, circle 67 `(133,377)`, and line 68
|
|||||||
`(137,384)->(116,405)`. The raised right records are line 81
|
`(137,384)->(116,405)`. The raised right records are line 81
|
||||||
`(197,405)->(171,378)`, circle 82 `(181,376)`, and line 83
|
`(197,405)->(171,378)`, circle 82 `(181,376)`, and line 83
|
||||||
`(183,368)->(217,383)`. Resting records retain their registration-table
|
`(183,368)->(217,383)`. Resting records retain their registration-table
|
||||||
coordinates. Edge-time position and velocity transfer remains a separate
|
coordinates. Edge-time position and velocity transfer is tracked separately
|
||||||
arithmetic restoration task.
|
from the record geometry. Three live left-edge probes at `(115,390)`,
|
||||||
|
`(120,390)`, and `(125,390)` produced post-edge positions `(128.718,365)`,
|
||||||
|
`(133.397,360)`, and `(138.182,355)` with raw velocities `(1932,-3523)`,
|
||||||
|
`(2079,-4658)`, and `(2217,-5889)`. The Rust upward stroke fits those states;
|
||||||
|
the full raw calculation and return-stroke transfer remain pending.
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ implementation.
|
|||||||
| Artwork | Exact | All 34 custom DIB images, three standard bitmaps, icon, and palette derivatives are preserved in `assets/original/`. The game uses the original 640x460 table, loading, help, ball, wheel, robot, plunger, media, and diamond frames. |
|
| Artwork | Exact | All 34 custom DIB images, three standard bitmaps, icon, and palette derivatives are preserved in `assets/original/`. The game uses the original 640x460 table, loading, help, ball, wheel, robot, plunger, media, and diamond frames. |
|
||||||
| Audio | Exact samples | All 16 mono PCM WAV resources are embedded unchanged. Their trigger roles were recovered from resource use and gameplay context. |
|
| Audio | Exact samples | All 16 mono PCM WAV resources are embedded unchanged. Their trigger roles were recovered from resource use and gameplay context. |
|
||||||
| Help and languages | Exact | Original resource images 1001-1005 are displayed directly. |
|
| Help and languages | Exact | Original resource images 1001-1005 are displayed directly. |
|
||||||
| 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 now uses its exact two line records plus moving tip circle in both binary positions; the edge-time ball impulse remains pending. Object 174 is omitted because the original overwrites it with the live ball every frame. |
|
| 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 left-flipper probes and is mirrored on the right; the complete return-edge arithmetic remains pending. 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. |
|
| 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, and swept type-1 circle response. Live probes cover ordinary rails, ordinary circles, and a kicked bumper. Type-3/4 triggers, closest-contact selection, persistent contact bookkeeping, and flipper impulses remain pending. |
|
| 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, and swept type-1 circle response. Live probes cover ordinary rails, ordinary circles, a kicked bumper, and upward flipper transfer. Type-3/4 triggers, closest-contact selection, persistent contact bookkeeping, and return-edge flipper transfer remain pending. |
|
||||||
| Rules | Partly recovered | Player count, controls, wheel holes, magnetic saves, four-position ball lock, target banks, increasing bumper value, nine-part TDK diamond, permanent double scoring for a completed diamond, KByte media progression, and media extra balls follow the original help and code paths. 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, wheel holes, magnetic saves, four-position ball lock, target banks, increasing bumper value, nine-part TDK diamond, permanent double scoring for a completed diamond, KByte media progression, and media extra balls follow the original help and code paths. 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. |
|
||||||
| 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. |
|
| 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. |
|
| 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. |
|
||||||
|
|||||||
+24
-17
@@ -9,7 +9,6 @@ use crate::{
|
|||||||
use macroquad::prelude::{Rect, Vec2, vec2};
|
use macroquad::prelude::{Rect, Vec2, vec2};
|
||||||
|
|
||||||
const FLIPPER_CONTACT_RADIUS: f32 = 9.0;
|
const FLIPPER_CONTACT_RADIUS: f32 = 9.0;
|
||||||
const FLIPPER_EDGE_KICK: f32 = 118.0;
|
|
||||||
const LEFT_FLIPPER_PIVOT: Vec2 = Vec2::new(103.0, 397.0);
|
const LEFT_FLIPPER_PIVOT: Vec2 = Vec2::new(103.0, 397.0);
|
||||||
const LEFT_FLIPPER_REST_TIP: Vec2 = Vec2::new(134.0, 419.0);
|
const LEFT_FLIPPER_REST_TIP: Vec2 = Vec2::new(134.0, 419.0);
|
||||||
const LEFT_FLIPPER_RAISED_TIP: Vec2 = Vec2::new(133.0, 377.0);
|
const LEFT_FLIPPER_RAISED_TIP: Vec2 = Vec2::new(133.0, 377.0);
|
||||||
@@ -392,8 +391,6 @@ impl Game {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.apply_flipper_kicks();
|
|
||||||
|
|
||||||
if self.ball.in_launcher {
|
if self.ball.in_launcher {
|
||||||
self.ball.position = LAUNCHER_POSITION;
|
self.ball.position = LAUNCHER_POSITION;
|
||||||
self.ball.velocity = Vec2::ZERO;
|
self.ball.velocity = Vec2::ZERO;
|
||||||
@@ -498,6 +495,8 @@ impl Game {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.apply_flipper_kicks();
|
||||||
|
|
||||||
if self.ball.position.y > 470.0 {
|
if self.ball.position.y > 470.0 {
|
||||||
// Only malformed/out-of-table states reach this guard; the real
|
// Only malformed/out-of-table states reach this guard; the real
|
||||||
// drain is collision object 2 at y=455.
|
// drain is collision object 2 at y=455.
|
||||||
@@ -645,20 +644,20 @@ impl Game {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (should_kick, pivot, rest_tip, raised_tip, clockwise) in [
|
for (should_kick, pivot, rest_tip, raised_tip, horizontal_sign) in [
|
||||||
(
|
(
|
||||||
pending[0],
|
pending[0],
|
||||||
LEFT_FLIPPER_PIVOT,
|
LEFT_FLIPPER_PIVOT,
|
||||||
LEFT_FLIPPER_REST_TIP,
|
LEFT_FLIPPER_REST_TIP,
|
||||||
LEFT_FLIPPER_RAISED_TIP,
|
LEFT_FLIPPER_RAISED_TIP,
|
||||||
true,
|
1.0,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
pending[1],
|
pending[1],
|
||||||
RIGHT_FLIPPER_PIVOT,
|
RIGHT_FLIPPER_PIVOT,
|
||||||
RIGHT_FLIPPER_REST_TIP,
|
RIGHT_FLIPPER_REST_TIP,
|
||||||
RIGHT_FLIPPER_RAISED_TIP,
|
RIGHT_FLIPPER_RAISED_TIP,
|
||||||
false,
|
-1.0,
|
||||||
),
|
),
|
||||||
] {
|
] {
|
||||||
if !should_kick
|
if !should_kick
|
||||||
@@ -666,13 +665,19 @@ impl Game {
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let radial = (self.ball.position - pivot).normalize_or_zero();
|
let local_x = (self.ball.position.x - pivot.x) * horizontal_sign;
|
||||||
let tangent = if clockwise {
|
let local_y = self.ball.position.y - pivot.y;
|
||||||
vec2(radial.y, -radial.x)
|
let horizontal_displacement =
|
||||||
} else {
|
0.002_12 * local_x.powi(2) - 0.125_68 * local_x + 14.921 - (local_y + 7.0);
|
||||||
vec2(-radial.y, radial.x)
|
let vertical_displacement = -(local_x + 13.0);
|
||||||
};
|
let velocity_scale = -0.026 * local_x.powi(2) + 3.614 * local_x + 101.327;
|
||||||
self.ball.velocity += tangent * FLIPPER_EDGE_KICK;
|
let displacement = vec2(
|
||||||
|
horizontal_displacement * horizontal_sign,
|
||||||
|
vertical_displacement,
|
||||||
|
);
|
||||||
|
self.ball.position += displacement;
|
||||||
|
let velocity_milli = MilliVec::from_millipixels(displacement * velocity_scale);
|
||||||
|
self.ball.velocity = velocity_milli.to_velocity_per_second();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1161,17 +1166,19 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn raising_flipper_applies_one_swept_tangential_kick() {
|
fn raising_flipper_matches_the_live_swept_transfer_probe() {
|
||||||
let mut game = Game::new(1);
|
let mut game = Game::new(1);
|
||||||
game.ball.in_launcher = false;
|
game.ball.in_launcher = false;
|
||||||
game.ball.position = (LEFT_FLIPPER_PIVOT + LEFT_FLIPPER_REST_TIP) * 0.5;
|
game.ball.position = vec2(125.0, 390.0);
|
||||||
game.ball.velocity = Vec2::ZERO;
|
game.ball.velocity = Vec2::ZERO;
|
||||||
game.pending_flipper_kicks[0] = true;
|
game.pending_flipper_kicks[0] = true;
|
||||||
|
|
||||||
game.apply_flipper_kicks();
|
game.apply_flipper_kicks();
|
||||||
let velocity_after_edge = game.ball.velocity;
|
let velocity_after_edge = game.ball.velocity;
|
||||||
assert!((velocity_after_edge.length() - FLIPPER_EDGE_KICK).abs() < 0.001);
|
assert!(game.ball.position.distance(vec2(138.182, 355.0)) < 0.002);
|
||||||
assert!(velocity_after_edge.y < 0.0);
|
let raw_velocity = MilliVec::from_velocity_per_second(velocity_after_edge);
|
||||||
|
assert!((raw_velocity.x - 2_217).abs() <= 2);
|
||||||
|
assert!((raw_velocity.y - -5_889).abs() <= 2);
|
||||||
assert_eq!(game.pending_flipper_kicks, [false, false]);
|
assert_eq!(game.pending_flipper_kicks, [false, false]);
|
||||||
|
|
||||||
game.apply_flipper_kicks();
|
game.apply_flipper_kicks();
|
||||||
|
|||||||
@@ -29,6 +29,13 @@ impl MilliVec {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn from_millipixels(value: Vec2) -> Self {
|
||||||
|
Self {
|
||||||
|
x: value.x.round() as i32,
|
||||||
|
y: value.y.round() as i32,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn to_position(self) -> Vec2 {
|
pub fn to_position(self) -> Vec2 {
|
||||||
vec2(self.x as f32 / 1_000.0, self.y as f32 / 1_000.0)
|
vec2(self.x as f32 / 1_000.0, self.y as f32 / 1_000.0)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user