fix(ui): restore exact score and status displays
Render 1008:0996's eight-place 130x40 score fields at x=478 through right edge 606, exact configured-player rows, current/status markers, and all six 5x5 ball-marker slots. Derive 1008:0b9e status images from strict signed score thresholds rather than unrelated media-award state. Test Plan: - cargo test --all-targets - cargo clippy --all-targets --all-features -- -D warnings - rumdl check CHANGELOG.md RECONSTRUCTION.md README.md - cargo run --quiet -- --simulate launcher --step 0 --screenshot /tmp/tdkpin-display.png - git diff --check
This commit is contained in:
@@ -10,6 +10,10 @@ and this project adheres to
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Restore display blits from `1008:0996`/`1008:0b9e`: 130x40 score fields at
|
||||||
|
X=478, eight places ending at X=606, exact 139x31 configured-player rows,
|
||||||
|
11x11 active/status markers, 5x5 remaining-ball markers for every player,
|
||||||
|
and strict signed score-status thresholds independent of media awards.
|
||||||
- Import exact `[Settings]` `Language`, `Speed`, and singular `Sound` values
|
- Import exact `[Settings]` `Language`, `Speed`, and singular `Sound` values
|
||||||
from an adjacent/original TDKPIN.INI before creating portable JSON. Fresh
|
from an adjacent/original TDKPIN.INI before creating portable JSON. Fresh
|
||||||
installs now inherit the distributed German help setting; F12 is again a
|
installs now inherit the distributed German help setting; F12 is again a
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ implementation.
|
|||||||
| Ball launcher and nudge input | Recovered | The initial 32-bit fixed-point coordinates decode to `(325, 413)` in the right shooter lane. Each Down keydown subtracts `15*50 = 750` millipixels, release subtracts another `15*100 = 1500`, and the result follows the recovered randomized `-3800` lower and `-2280` weak upper clamp branches. The ten decoration frames use the same strict 750-millipixel thresholds. Left Shift and keypad 3 apply their directional `(50-Random(20))*15` impulses; Space uses the recovered Real48 horizontal factor and `(60-Random(20))*15` vertical impulse. With two balls, the key path still consumes those active-window draws, then applies its separately recovered fixed/shared random slot impulse to both saved velocities. Each nudge adds 25 to the wrapping 16-bit tilt counter, compares it with `30+Random(10)`, and the detail timer decrements a nonzero counter once per callback. |
|
| Ball launcher and nudge input | Recovered | The initial 32-bit fixed-point coordinates decode to `(325, 413)` in the right shooter lane. Each Down keydown subtracts `15*50 = 750` millipixels, release subtracts another `15*100 = 1500`, and the result follows the recovered randomized `-3800` lower and `-2280` weak upper clamp branches. The ten decoration frames use the same strict 750-millipixel thresholds. Left Shift and keypad 3 apply their directional `(50-Random(20))*15` impulses; Space uses the recovered Real48 horizontal factor and `(60-Random(20))*15` vertical impulse. With two balls, the key path still consumes those active-window draws, then applies its separately recovered fixed/shared random slot impulse to both saved velocities. Each nudge adds 25 to the wrapping 16-bit tilt counter, compares it with `30+Random(10)`, and the detail timer decrements a nonzero counter once per callback. |
|
||||||
| Physics arithmetic | Recovered Real48 core | Production movement uses the original 10 ms millipixel substep, `+15` vertical acceleration, Real48 `3800/speed` clamp, type-2 distance/cross gates, type-1 midpoint normal, first-detected candidate selection, persistent Real48 spin, and the common impulse response. The scan follows record chunks 1-5, 6, 7-88, 89, 90-128, 129-133, 134-139, 140-152, 153-154, 155-173, and dynamic 174/175 while carrying prediction separately from mutable motion. Negative auxiliary thresholds and kick coefficients are retained for bumpers 51-53 and lines 55/74/107, including weak-hit score behavior, unscored-rail WAVE 2019, and tilt suppression. Type-3 reads the pre-movement coordinate for pull/hold, obeys its prediction broadphase, and contributes its recovered radial rim candidate when a nonzero contact is outside the deep zone. Type-4 randomization mutates motion before the selected candidate is resolved and before position publication; only rectangular magnetic records rewrite prediction. Detail callbacks freeze their starting ball count, run all 5/4/3/2/1 substeps for slot 1 before slot 2, stop a slot after its first collision/reset/removal, and apply effect-seven spawn requests after the current batch. Dynamic records 174/175 use their 21-pixel prediction bounds, transfer normal impulse to the other ball, then apply `normal_velocity-1000` to the moving ball; effect seven spawns record/slot 2 from record 148 coordinates `(17000,23000)` with exact `(0,3040)` velocity. Both slots traverse the same type-3/type-4 dispatcher. Capture age is saved per slot, contact words retain ball ownership, a completed multiball capture removes exactly that slot and promotes the survivor when needed, and effect seven's argument-2 guard prevents a third ball. The original Borland seed update, high-word `Random(n)`, and normalized Real48 random register result drive launcher variation, effects, claw terminals, magnetic fields, and trigger response. Type-4 triggers retain a shared transient entry flag; type-3 captures retain per-player 16-bit contact words, deep-inside pull/hold progression to age 300, first-contact sound, and `99`/`2` completion sentinels. Zero-spin C harnesses and retained-spin Wine probes are tested separately rather than conflated. |
|
| Physics arithmetic | Recovered Real48 core | Production movement uses the original 10 ms millipixel substep, `+15` vertical acceleration, Real48 `3800/speed` clamp, type-2 distance/cross gates, type-1 midpoint normal, first-detected candidate selection, persistent Real48 spin, and the common impulse response. The scan follows record chunks 1-5, 6, 7-88, 89, 90-128, 129-133, 134-139, 140-152, 153-154, 155-173, and dynamic 174/175 while carrying prediction separately from mutable motion. Negative auxiliary thresholds and kick coefficients are retained for bumpers 51-53 and lines 55/74/107, including weak-hit score behavior, unscored-rail WAVE 2019, and tilt suppression. Type-3 reads the pre-movement coordinate for pull/hold, obeys its prediction broadphase, and contributes its recovered radial rim candidate when a nonzero contact is outside the deep zone. Type-4 randomization mutates motion before the selected candidate is resolved and before position publication; only rectangular magnetic records rewrite prediction. Detail callbacks freeze their starting ball count, run all 5/4/3/2/1 substeps for slot 1 before slot 2, stop a slot after its first collision/reset/removal, and apply effect-seven spawn requests after the current batch. Dynamic records 174/175 use their 21-pixel prediction bounds, transfer normal impulse to the other ball, then apply `normal_velocity-1000` to the moving ball; effect seven spawns record/slot 2 from record 148 coordinates `(17000,23000)` with exact `(0,3040)` velocity. Both slots traverse the same type-3/type-4 dispatcher. Capture age is saved per slot, contact words retain ball ownership, a completed multiball capture removes exactly that slot and promotes the survivor when needed, and effect seven's argument-2 guard prevents a third ball. The original Borland seed update, high-word `Random(n)`, and normalized Real48 random register result drive launcher variation, effects, claw terminals, magnetic fields, and trigger response. Type-4 triggers retain a shared transient entry flag; type-3 captures retain per-player 16-bit contact words, deep-inside pull/hold progression to age 300, first-contact sound, and `99`/`2` completion sentinels. Zero-spin C harnesses and retained-spin Wine probes are tested separately rather than conflated. |
|
||||||
| Rules | Recovered gameplay paths | Player count, controls, the five three-line bumper-value groups, four three-line TDK-diamond groups, five doubling-value lock holes, wheel-reset target, seven-way effect selector/consumer including multiball, permanent double scoring, and four exact media/extra-ball thresholds follow original help/code paths, globals, and object flags. The ninth diamond pays the original 24,464 completion value; the following completed bank enables double scoring, and later completions add 100,000 to the per-player secondary score. Bumpers 51-53 and targets 140-147/150-152 use the original 5/20/10 active-callback countdowns and exact overlay-A render rectangles. Record 121 runs the six-callback DAT600 target rotation with exact 91x90 frames/target points and rotates the five contact/item values at state 6. Completing all five lock holes suspends physics for the full 281-callback panel animation, clears contact/item state at the recovered boundaries, and uses the exact WAVE 2013/2012/stop sequence. Turn changes mirror the original save/load of all 175 collision record states: wheel/top targets, active/contact slots, selected effect, and multiball readiness remain attached to their player. 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 rectangular field requires the previous position inside, applies its Real48/random pull, and deactivates when raw `1000:9b69` finds the resulting `07db/07df` prediction outside any edge. The claw state machine and release table have live differential coverage for all four random terminals. |
|
| Rules | Recovered gameplay paths | Player count, controls, the five three-line bumper-value groups, four three-line TDK-diamond groups, five doubling-value lock holes, wheel-reset target, seven-way effect selector/consumer including multiball, permanent double scoring, and four exact media/extra-ball thresholds follow original help/code paths, globals, and object flags. The ninth diamond pays the original 24,464 completion value; the following completed bank enables double scoring, and later completions add 100,000 to the per-player secondary score. Bumpers 51-53 and targets 140-147/150-152 use the original 5/20/10 active-callback countdowns and exact overlay-A render rectangles. Record 121 runs the six-callback DAT600 target rotation with exact 91x90 frames/target points and rotates the five contact/item values at state 6. Completing all five lock holes suspends physics for the full 281-callback panel animation, clears contact/item state at the recovered boundaries, and uses the exact WAVE 2013/2012/stop sequence. Turn changes mirror the original save/load of all 175 collision record states: wheel/top targets, active/contact slots, selected effect, and multiball readiness remain attached to their player. 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 rectangular field requires the previous position inside, applies its Real48/random pull, and deactivates when raw `1000:9b69` finds the resulting `07db/07df` prediction outside any edge. The claw state machine and release table have live differential coverage for all four random terminals. |
|
||||||
| Numeric scoring | Recovered gameplay values | Static scores come from the initialized 175-object ledger. Dynamic bumper progression, target-bank completion, diamond awards, 10k-160k lock bonuses, 310k transfer, six effect values, multiball mode, and all four media thresholds are transcribed from `1000:b476`, `1000:c4e1`, `1000:bc36`, and live state probes. The central helper suppresses all mutation during Tilt, applies a 2x active-multiball factor, and then independently applies the permanent 2x factor, allowing the original 4x stack. Lock and effect awards share the original per-player secondary score and display multiplier; the fifth hole transfers and clears it, increments the multiplier, and grants the recovered ball award. Score mutation uses the original 32-bit wrapping behavior, and each add operation can advance at most one media threshold. |
|
| Numeric scoring | Recovered gameplay values | Static scores come from the initialized 175-object ledger. Dynamic bumper progression, target-bank completion, diamond awards, 10k-160k lock bonuses, 310k transfer, six effect values, multiball mode, and all four media thresholds are transcribed from `1000:b476`, `1000:c4e1`, `1000:bc36`, and live state probes. The central helper suppresses all mutation during Tilt, applies a 2x active-multiball factor, and then independently applies the permanent 2x factor, allowing the original 4x stack. Lock and effect awards share the original per-player secondary score and display multiplier; the fifth hole transfers and clears it, increments the multiplier, and grants the recovered ball award. Score mutation uses the original 32-bit wrapping behavior, and each add operation can advance at most one media threshold. Rendering separately follows `1008:0996`'s eight-place 130x40 fields/right edge X=606 and `1008:0b9e`'s strict signed status thresholds; configured-player rows and 5x5 remaining-ball markers retain their exact dimensions and current/noncurrent counts. |
|
||||||
| High scores | Recovered visible flow; portable storage | The original 276-byte table is decoded as ten `IWIK`-XOR-obfuscated little-endian scores plus ten 22-byte names. Each player is checked immediately when their own last ball is lost; qualifying scores use the original signed-high/unsigned-low comparison and a `TDK Pinball Player`-prefilled DIALOG 32514 flow with the exact caption, prompt, 21-character limit, OK/Cancel semantics, and allowance for an empty accepted name. The `HighScore` child uses exact DAT993 at 360x300, heading `(180,27)`, name/rank X=30, right-aligned score X=320, and ten 20-pixel rows before play resumes. Persisted updates use portable JSON rather than rewriting the Win16 file. |
|
| High scores | Recovered visible flow; portable storage | The original 276-byte table is decoded as ten `IWIK`-XOR-obfuscated little-endian scores plus ten 22-byte names. Each player is checked immediately when their own last ball is lost; qualifying scores use the original signed-high/unsigned-low comparison and a `TDK Pinball Player`-prefilled DIALOG 32514 flow with the exact caption, prompt, 21-character limit, OK/Cancel semantics, and allowance for an empty accepted name. The `HighScore` child uses exact DAT993 at 360x300, heading `(180,27)`, name/rank X=30, right-aligned score X=320, and ten 20-pixel rows before play resumes. Persisted updates use portable JSON rather than rewriting the Win16 file. |
|
||||||
| Configuration | Recovered behavior; portable follow-up storage | Before portable JSON exists, Rust reads the original case-insensitive `[Settings]` keys `Language`, `Speed`, and singular `Sound` from the executable-adjacent INI, falling back to the embedded distributed TDKPIN.INI. Values retain the Win16 defaults/clamps; the shipped file therefore selects German, speed 3, and sound-on because its plural `Sounds` line does not override singular `Sound`. F12 toggles only runtime playback without UI or persistence. Later explicit F10 changes use the platform user-data directory. |
|
| Configuration | Recovered behavior; portable follow-up storage | Before portable JSON exists, Rust reads the original case-insensitive `[Settings]` keys `Language`, `Speed`, and singular `Sound` from the executable-adjacent INI, falling back to the embedded distributed TDKPIN.INI. Values retain the Win16 defaults/clamps; the shipped file therefore selects German, speed 3, and sound-on because its plural `Sounds` line does not override singular `Sound`. F12 toggles only runtime playback without UI or persistence. Later explicit F10 changes use the platform user-data directory. |
|
||||||
| Windows UI shell | Original gameplay surface with native host shell | Win16 window ownership and GDI calls are replaced by a fixed native window, but the visible game, help resources, automatic per-player high-score flow, original keys, and 640x460 logical pixels are retained. Idle mode advances on the selected detail callback and reproduces `idle_transition_tick`: target/word-quad/record-strip chases, magnetic flashes, four-point chase, DAT801-809 item progression, and the circular BITMAP500 `WELCOME TO THE MACHINE` marquee composited over exact DAT997 regions. F2/F3 remain unassigned as in normal original operation; optional portable settings and table viewers use F10/F9 and do not replace gameplay input. |
|
| Windows UI shell | Original gameplay surface with native host shell | Win16 window ownership and GDI calls are replaced by a fixed native window, but the visible game, help resources, automatic per-player high-score flow, original keys, and 640x460 logical pixels are retained. Idle mode advances on the selected detail callback and reproduces `idle_transition_tick`: target/word-quad/record-strip chases, magnetic flashes, four-point chase, DAT801-809 item progression, and the circular BITMAP500 `WELCOME TO THE MACHINE` marquee composited over exact DAT997 regions. F2/F3 remain unassigned as in normal original operation; optional portable settings and table viewers use F10/F9 and do not replace gameplay input. |
|
||||||
|
|||||||
+111
-82
@@ -20,6 +20,39 @@ const TARGET_POSITIONS: [[(f32, f32); 5]; 6] = [
|
|||||||
[(8.0, 35.0), (26.0, 8.0), (59.0, 18.0), (59.0, 50.0), (27.0, 61.0)],
|
[(8.0, 35.0), (26.0, 8.0), (59.0, 18.0), (59.0, 50.0), (27.0, 61.0)],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
fn visible_score_digits(mut value: u32) -> Vec<(u8, u8)> {
|
||||||
|
let mut digits = Vec::with_capacity(8);
|
||||||
|
for position in 0..8 {
|
||||||
|
let digit = u8::try_from(value % 10).unwrap_or(0);
|
||||||
|
value /= 10;
|
||||||
|
if digit != 0 || value > 0 || position == 0 {
|
||||||
|
digits.push((7 - position, digit));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
digits
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::cast_possible_wrap)]
|
||||||
|
fn status_level_for_score(score: u32) -> u8 {
|
||||||
|
let score = score as i32;
|
||||||
|
if score > 1_300_000 {
|
||||||
|
4
|
||||||
|
} else if score > 650_000 {
|
||||||
|
3
|
||||||
|
} else if score > 140_000 {
|
||||||
|
2
|
||||||
|
} else {
|
||||||
|
u8::from(score > 2_000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn displayed_player_markers(balls: u8, extra_balls: u8, is_current: bool) -> u8 {
|
||||||
|
balls
|
||||||
|
.saturating_add(extra_balls)
|
||||||
|
.saturating_sub(u8::from(is_current))
|
||||||
|
.min(6)
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
enum Screen {
|
enum Screen {
|
||||||
Loading,
|
Loading,
|
||||||
@@ -633,6 +666,19 @@ impl App {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::cast_precision_loss)]
|
||||||
|
fn draw_inactive_table_region(&self, x: i32, y: i32, width: i32, height: i32) {
|
||||||
|
draw_texture_region(
|
||||||
|
&self.assets.inactive_table,
|
||||||
|
x as f32,
|
||||||
|
y as f32,
|
||||||
|
width as f32,
|
||||||
|
height as f32,
|
||||||
|
x as f32,
|
||||||
|
y as f32,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(clippy::cast_precision_loss, clippy::too_many_lines)]
|
#[allow(clippy::cast_precision_loss, clippy::too_many_lines)]
|
||||||
fn draw_game(&self) {
|
fn draw_game(&self) {
|
||||||
// Resource 998 is the original game's resting playfield. Resource 997
|
// Resource 998 is the original game's resting playfield. Resource 997
|
||||||
@@ -958,104 +1004,62 @@ impl App {
|
|||||||
|
|
||||||
#[allow(clippy::cast_precision_loss)]
|
#[allow(clippy::cast_precision_loss)]
|
||||||
fn draw_displays(&self, game: &Game) {
|
fn draw_displays(&self, game: &Game) {
|
||||||
for region in [
|
self.draw_active_table_region(372, 233, 238, 30);
|
||||||
Rect::new(383.0, 72.0, 140.0, 136.0),
|
self.draw_score_value(game.secondary_score_display(), 233.0);
|
||||||
Rect::new(545.0, 170.0, 9.0, 9.0),
|
|
||||||
Rect::new(372.0, 233.0, 238.0, 29.0),
|
|
||||||
] {
|
|
||||||
draw_texture_ex(
|
|
||||||
&self.assets.active_table,
|
|
||||||
region.x,
|
|
||||||
region.y,
|
|
||||||
WHITE,
|
|
||||||
DrawTextureParams {
|
|
||||||
dest_size: Some(vec2(region.w, region.h)),
|
|
||||||
source: Some(region),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
self.draw_right_aligned_digits(&game.secondary_score_display().to_string(), 605.0, 233.0);
|
|
||||||
|
|
||||||
let media_level = game.player().media_level;
|
let status_level = status_level_for_score(game.player().score);
|
||||||
if media_level > 0 {
|
if status_level == 0 {
|
||||||
let index = usize::from(media_level.saturating_sub(1).min(3));
|
self.draw_active_table_region(380, 69, 146, 142);
|
||||||
draw_texture(&self.assets.media[index], 380.0, 72.0, WHITE);
|
} else {
|
||||||
}
|
draw_texture(
|
||||||
|
&self.assets.media[usize::from(status_level - 1)],
|
||||||
let row_y = 277.0 + game.current_player as f32 * 44.0;
|
380.0,
|
||||||
for region in [
|
69.0,
|
||||||
Rect::new(373.0, row_y + 4.0, 9.0, 9.0),
|
|
||||||
Rect::new(473.0, row_y, 137.0, 29.0),
|
|
||||||
] {
|
|
||||||
draw_texture_ex(
|
|
||||||
&self.assets.active_table,
|
|
||||||
region.x,
|
|
||||||
region.y,
|
|
||||||
WHITE,
|
WHITE,
|
||||||
DrawTextureParams {
|
|
||||||
dest_size: Some(vec2(region.w, region.h)),
|
|
||||||
source: Some(region),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
let displayed_balls = game
|
|
||||||
.player()
|
|
||||||
.balls
|
|
||||||
.saturating_sub(1)
|
|
||||||
.saturating_add(game.player().extra_balls)
|
|
||||||
.min(6);
|
|
||||||
for ball in 0..displayed_balls {
|
|
||||||
let x = 392.0 + f32::from(ball) * 8.0;
|
|
||||||
draw_texture_ex(
|
|
||||||
&self.assets.active_table,
|
|
||||||
x,
|
|
||||||
row_y + 22.0,
|
|
||||||
WHITE,
|
|
||||||
DrawTextureParams {
|
|
||||||
dest_size: Some(vec2(3.0, 3.0)),
|
|
||||||
source: Some(Rect::new(x, row_y + 22.0, 3.0, 3.0)),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
self.draw_active_table_region(544, i32::from(4 - status_level) * 23 + 77, 11, 11);
|
||||||
|
|
||||||
for (index, player) in game.players.iter().enumerate() {
|
for (index, player) in game.players.iter().enumerate() {
|
||||||
self.draw_right_aligned_digits(
|
let y = 276 + i32::try_from(index).unwrap_or(0) * 44;
|
||||||
&player.score.to_string(),
|
self.draw_active_table_region(472, y, 139, 31);
|
||||||
605.0,
|
self.draw_score_value(player.score, (y + 1) as f32);
|
||||||
277.0 + index as f32 * 44.0,
|
let displayed_balls = displayed_player_markers(
|
||||||
|
player.balls,
|
||||||
|
player.extra_balls,
|
||||||
|
index == game.current_player,
|
||||||
);
|
);
|
||||||
}
|
for marker in 0..6 {
|
||||||
}
|
let x = 391 + i32::from(marker) * 8;
|
||||||
|
if marker < displayed_balls {
|
||||||
fn draw_right_aligned_digits(&self, digits: &str, right: f32, y: f32) {
|
self.draw_active_table_region(x, y + 22, 5, 5);
|
||||||
let digit_count = u16::try_from(digits.bytes().filter(u8::is_ascii_digit).count())
|
} else {
|
||||||
.expect("a display value has at most ten digits");
|
self.draw_inactive_table_region(x, y + 22, 5, 5);
|
||||||
let width = f32::from(digit_count) * 16.0;
|
}
|
||||||
self.draw_digits(digits, vec2(right - width, y), vec2(16.0, 28.0));
|
|
||||||
}
|
|
||||||
|
|
||||||
fn draw_digits(&self, digits: &str, position: Vec2, digit_size: Vec2) {
|
|
||||||
let mut x = position.x;
|
|
||||||
for digit in digits.bytes() {
|
|
||||||
if !digit.is_ascii_digit() {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
let source_x = f32::from(digit - b'0') * 16.0;
|
}
|
||||||
|
self.draw_active_table_region(
|
||||||
|
372,
|
||||||
|
280 + i32::try_from(game.current_player).unwrap_or(0) * 44,
|
||||||
|
11,
|
||||||
|
11,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn draw_score_value(&self, value: u32, y: f32) {
|
||||||
|
for (slot, digit) in visible_score_digits(value) {
|
||||||
|
let x = 478.0 + f32::from(slot) * 16.0;
|
||||||
draw_texture_ex(
|
draw_texture_ex(
|
||||||
&self.assets.digits,
|
&self.assets.digits,
|
||||||
x,
|
x,
|
||||||
position.y,
|
y,
|
||||||
BLACK,
|
BLACK,
|
||||||
DrawTextureParams {
|
DrawTextureParams {
|
||||||
dest_size: Some(digit_size),
|
dest_size: Some(vec2(16.0, 28.0)),
|
||||||
source: Some(Rect::new(source_x, 0.0, 16.0, 28.0)),
|
source: Some(Rect::new(f32::from(digit) * 16.0, 0.0, 16.0, 28.0)),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
x += digit_size.x;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1299,6 +1303,31 @@ mod tests {
|
|||||||
assert_eq!(i32::from(App::loading_stage_at(99.0) - 1) * 7, 238);
|
assert_eq!(i32::from(App::loading_stage_at(99.0) - 1) * 7, 238);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn score_renderer_uses_eight_places_and_original_right_edge() {
|
||||||
|
assert_eq!(visible_score_digits(0), [(7, 0)]);
|
||||||
|
assert_eq!(visible_score_digits(123), [(7, 3), (6, 2), (5, 1)]);
|
||||||
|
let digits = visible_score_digits(123_456_789);
|
||||||
|
assert_eq!(digits.len(), 8);
|
||||||
|
assert_eq!(digits[0], (7, 9));
|
||||||
|
assert_eq!(digits[7], (0, 2));
|
||||||
|
assert_eq!(478 + i32::from(digits[0].0) * 16 + 16, 606);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn status_and_ball_markers_follow_original_display_thresholds() {
|
||||||
|
assert_eq!(status_level_for_score(2_000), 0);
|
||||||
|
assert_eq!(status_level_for_score(2_001), 1);
|
||||||
|
assert_eq!(status_level_for_score(140_000), 1);
|
||||||
|
assert_eq!(status_level_for_score(140_001), 2);
|
||||||
|
assert_eq!(status_level_for_score(650_001), 3);
|
||||||
|
assert_eq!(status_level_for_score(1_300_001), 4);
|
||||||
|
assert_eq!(status_level_for_score(u32::MAX), 0);
|
||||||
|
assert_eq!(displayed_player_markers(3, 0, true), 2);
|
||||||
|
assert_eq!(displayed_player_markers(3, 0, false), 3);
|
||||||
|
assert_eq!(displayed_player_markers(3, 4, true), 6);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn attract_phases_follow_the_reconstructed_tick_quotients() {
|
fn attract_phases_follow_the_reconstructed_tick_quotients() {
|
||||||
let at = |tick| AttractAnimation {
|
let at = |tick| AttractAnimation {
|
||||||
|
|||||||
Reference in New Issue
Block a user