fix(input): start games with the plus key
Match the recovered Win16 registration flow: the first plus press creates Player 1 and additional presses add Players 2 through 4 until the initial launch. Down now belongs only to charging and releasing the plunger. Test Plan: - cargo fmt --check - cargo test - cargo clippy --all-targets --all-features -- -D warnings - live: verify Down cannot leave attract mode - live: start with plus, add Player 2, hold Down through partial/full plunger frames, and release onto the table - git diff --check
This commit is contained in:
+16
-17
@@ -28,7 +28,6 @@ pub struct App {
|
||||
screen: Screen,
|
||||
return_screen: Screen,
|
||||
game: Option<Game>,
|
||||
player_count: usize,
|
||||
setting_row: usize,
|
||||
loading_until: f64,
|
||||
last_help_click: f64,
|
||||
@@ -53,7 +52,6 @@ impl App {
|
||||
screen: Screen::Loading,
|
||||
return_screen: Screen::Attract,
|
||||
game: None,
|
||||
player_count: 1,
|
||||
setting_row: 0,
|
||||
loading_until: get_time() + 1.1,
|
||||
last_help_click: -1.0,
|
||||
@@ -131,18 +129,25 @@ impl App {
|
||||
}
|
||||
|
||||
fn update_attract(&mut self) {
|
||||
if is_key_pressed(KeyCode::KpAdd) || is_key_pressed(KeyCode::Equal) {
|
||||
self.player_count = self.player_count % 4 + 1;
|
||||
self.assets.play(2012, self.saved.settings.sounds);
|
||||
}
|
||||
if is_key_pressed(KeyCode::Down) || is_key_pressed(KeyCode::Enter) {
|
||||
self.game = Some(Game::new(self.player_count));
|
||||
if is_key_pressed(KeyCode::KpAdd)
|
||||
|| is_key_pressed(KeyCode::Equal)
|
||||
|| is_key_pressed(KeyCode::Enter)
|
||||
{
|
||||
self.game = Some(Game::new(1));
|
||||
self.screen = Screen::Playing;
|
||||
self.assets.play(2008, self.saved.settings.sounds);
|
||||
}
|
||||
}
|
||||
|
||||
fn update_game(&mut self) {
|
||||
if (is_key_pressed(KeyCode::KpAdd) || is_key_pressed(KeyCode::Equal))
|
||||
&& self
|
||||
.game
|
||||
.as_mut()
|
||||
.is_some_and(Game::add_player_before_launch)
|
||||
{
|
||||
self.assets.play(2012, self.saved.settings.sounds);
|
||||
}
|
||||
let left_flipper = is_key_down(KeyCode::LeftControl)
|
||||
|| is_key_down(KeyCode::A)
|
||||
|| is_key_down(KeyCode::Left);
|
||||
@@ -350,20 +355,14 @@ impl App {
|
||||
draw_panel(342.0, 72.0, 267.0, 144.0);
|
||||
draw_centered_at("TDK PINBALL MACHINE", 475.5, 107.0, 22, BLACK);
|
||||
draw_centered_at(
|
||||
"PRESS DOWN ARROW",
|
||||
"PRESS + TO START",
|
||||
475.5,
|
||||
139.0,
|
||||
22,
|
||||
Color::from_rgba(0, 72, 102, 255),
|
||||
);
|
||||
draw_centered_at("TO START BALL", 475.5, 165.0, 18, BLACK);
|
||||
draw_centered_at(
|
||||
&format!("PLAYERS: {} [+] CHANGE", self.player_count),
|
||||
475.5,
|
||||
196.0,
|
||||
16,
|
||||
BLACK,
|
||||
);
|
||||
draw_centered_at("PRESS + AGAIN TO ADD PLAYERS", 475.5, 165.0, 15, BLACK);
|
||||
draw_centered_at("THEN HOLD DOWN TO LAUNCH", 475.5, 196.0, 16, BLACK);
|
||||
draw_text(
|
||||
"F1 HELP F2 SETTINGS F3 HIGHSCORES F12 SOUND",
|
||||
322.0,
|
||||
|
||||
Reference in New Issue
Block a user