fix(ui): restore original high-score windows

Replace modern overlays with the reconstructed HighScore child and DIALOG 32514 topology, exact DAT993 background, row coordinates, original strings, unpadded scores, and 21-character edit behavior. Restore OK/Cancel semantics, including Escape preserving the prefilled name and allowing an accepted empty name, with deterministic screenshot scenarios.

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 highscores --step 0 --screenshot /tmp/tdkpin-highscores.png
- cargo run --quiet -- --simulate name-entry --step 0 --screenshot /tmp/tdkpin-name-entry.png
- git diff --check
This commit is contained in:
2026-08-23 19:09:28 +02:00
parent c80f5e2136
commit fae322bb91
8 changed files with 148 additions and 54 deletions
+19 -5
View File
@@ -15,6 +15,8 @@ const MAX_SIMULATION_STEPS: u64 = 72_000;
pub enum Scenario {
Loading,
Attract,
HighScores,
NameEntry,
Autoplay,
Launcher,
Flippers,
@@ -31,6 +33,8 @@ impl Scenario {
match self {
Self::Loading => "loading",
Self::Attract => "attract",
Self::HighScores => "highscores",
Self::NameEntry => "name-entry",
Self::Autoplay => "autoplay",
Self::Launcher => "launcher",
Self::Flippers => "flippers",
@@ -51,6 +55,8 @@ impl Scenario {
Self::Claw18 => Some(18),
Self::Loading
| Self::Attract
| Self::HighScores
| Self::NameEntry
| Self::Autoplay
| Self::Launcher
| Self::Flippers
@@ -67,6 +73,8 @@ impl FromStr for Scenario {
match value {
"loading" => Ok(Self::Loading),
"attract" => Ok(Self::Attract),
"highscores" => Ok(Self::HighScores),
"name-entry" => Ok(Self::NameEntry),
"autoplay" => Ok(Self::Autoplay),
"launcher" => Ok(Self::Launcher),
"flippers" => Ok(Self::Flippers),
@@ -77,7 +85,7 @@ impl FromStr for Scenario {
"claw-7" => Ok(Self::Claw7),
"claw-18" => Ok(Self::Claw18),
_ => Err(format!(
"unknown scenario {value:?}; expected loading, attract, autoplay, launcher, flippers, panel, targets, claw-1, claw-6, claw-7, or claw-18"
"unknown scenario {value:?}; expected loading, attract, highscores, name-entry, autoplay, launcher, flippers, panel, targets, claw-1, claw-6, claw-7, or claw-18"
)),
}
}
@@ -161,7 +169,7 @@ fn seconds_to_step(value: &str) -> Result<u64, String> {
}
pub const fn usage() -> &'static str {
"Usage:\n tdkpin-rs\n tdkpin-rs --simulate SCENARIO [--at SECONDS | --step N] [--screenshot FILE.png] [--trace FILE.json] [--seed N]\n\nScenarios: loading, attract, autoplay, launcher, flippers, panel, targets, claw-1, claw-6, claw-7, claw-18"
"Usage:\n tdkpin-rs\n tdkpin-rs --simulate SCENARIO [--at SECONDS | --step N] [--screenshot FILE.png] [--trace FILE.json] [--seed N]\n\nScenarios: loading, attract, highscores, name-entry, autoplay, launcher, flippers, panel, targets, claw-1, claw-6, claw-7, claw-18"
}
#[derive(Debug, Serialize, PartialEq)]
@@ -242,7 +250,10 @@ impl Simulation {
} else {
controls_for(self.scenario, self.step)
};
let events = if matches!(self.scenario, Scenario::Loading | Scenario::Attract) {
let events = if matches!(
self.scenario,
Scenario::Loading | Scenario::Attract | Scenario::HighScores | Scenario::NameEntry
) {
Vec::new()
} else {
self.game.update(SIMULATION_DT, 3, controls)
@@ -336,7 +347,6 @@ impl Simulation {
fn controls_for(scenario: Scenario, step: u64) -> Controls {
match scenario {
Scenario::Loading | Scenario::Attract => Controls::default(),
Scenario::Autoplay => unreachable!("autoplay controls need mutable simulation state"),
Scenario::Launcher => Controls {
launch_down: step < u64::from(SIMULATION_HZ),
@@ -350,7 +360,11 @@ fn controls_for(scenario: Scenario, step: u64) -> Controls {
..Controls::default()
}
}
Scenario::Panel
Scenario::Loading
| Scenario::Attract
| Scenario::HighScores
| Scenario::NameEntry
| Scenario::Panel
| Scenario::Targets
| Scenario::Claw1
| Scenario::Claw6