From 41d5e0650dbbdb8762976bab69dfc282bb261dd0 Mon Sep 17 00:00:00 2001 From: jugeeya Date: Fri, 1 Sep 2023 10:32:22 -0700 Subject: [PATCH] Don't use exclusive button combos --- src/common/button_config.rs | 13 +++---------- src/common/menu.rs | 2 +- src/training/input_record.rs | 4 ++-- src/training/save_states.rs | 4 ++-- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/common/button_config.rs b/src/common/button_config.rs index 7a42ef1..790d38b 100644 --- a/src/common/button_config.rs +++ b/src/common/button_config.rs @@ -84,7 +84,7 @@ lazy_static! { static ref START_HOLD_FRAMES: Mutex = Mutex::new(0); } -fn combo_passes(p1_controller: Controller, combo: ButtonCombo) -> bool { +fn _combo_passes(p1_controller: Controller, combo: ButtonCombo) -> bool { unsafe { let combo_keys = get_combo_keys(combo).to_vec(); let mut this_combo_passes = false; @@ -109,14 +109,7 @@ fn combo_passes(p1_controller: Controller, combo: ButtonCombo) -> bool { } } -pub fn _combo_passes_exclusive(p1_controller: Controller, combo: ButtonCombo) -> bool { - let other_combo_passes = ButtonCombo::iter() - .filter(|other_combo| *other_combo != combo) - .any(|other_combo| combo_passes(p1_controller, other_combo)); - combo_passes(p1_controller, combo) && !other_combo_passes -} - -pub fn combo_passes_exclusive(combo: ButtonCombo) -> bool { +pub fn combo_passes(combo: ButtonCombo) -> bool { unsafe { let button_combo_requests = &mut *BUTTON_COMBO_REQUESTS.data_ptr(); let passes = button_combo_requests.get_mut(&combo); @@ -178,7 +171,7 @@ pub fn handle_final_input_mapping(player_idx: i32, controller_struct: &mut SomeC .iter_mut() .for_each(|(combo, is_request)| { if !*is_request { - *is_request = _combo_passes_exclusive(*p1_controller, *combo); + *is_request = _combo_passes(*p1_controller, *combo); if *combo == button_config::ButtonCombo::OpenMenu && start_menu_request { *is_request = true; } diff --git a/src/common/menu.rs b/src/common/menu.rs index 29fa23e..dac7a00 100644 --- a/src/common/menu.rs +++ b/src/common/menu.rs @@ -20,7 +20,7 @@ pub const MENU_CLOSE_WAIT_FRAMES: u32 = 15; pub static mut QUICK_MENU_ACTIVE: bool = false; pub unsafe fn menu_condition() -> bool { - button_config::combo_passes_exclusive(button_config::ButtonCombo::OpenMenu) + button_config::combo_passes(button_config::ButtonCombo::OpenMenu) } pub fn load_from_file() { diff --git a/src/training/input_record.rs b/src/training/input_record.rs index 566d2bb..8c581a4 100644 --- a/src/training/input_record.rs +++ b/src/training/input_record.rs @@ -182,10 +182,10 @@ pub unsafe fn get_command_flag_cat(module_accessor: &mut BattleObjectModuleAcces CURRENT_RECORD_SLOT = MENU.recording_slot.into_idx(); if entry_id_int == 0 && !fighter_is_nana { - if button_config::combo_passes_exclusive(button_config::ButtonCombo::InputPlayback) { + if button_config::combo_passes(button_config::ButtonCombo::InputPlayback) { playback(MENU.playback_button_slots.get_random().into_idx()); } else if MENU.record_trigger.contains(RecordTrigger::COMMAND) - && button_config::combo_passes_exclusive(button_config::ButtonCombo::InputRecord) + && button_config::combo_passes(button_config::ButtonCombo::InputRecord) { lockout_record(); } diff --git a/src/training/save_states.rs b/src/training/save_states.rs index 64e4693..eb3adee 100644 --- a/src/training/save_states.rs +++ b/src/training/save_states.rs @@ -414,7 +414,7 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor) let mut triggered_reset: bool = false; if !is_operation_cpu(module_accessor) && !fighter_is_nana { triggered_reset = - button_config::combo_passes_exclusive(button_config::ButtonCombo::LoadState); + button_config::combo_passes(button_config::ButtonCombo::LoadState); } if (autoload_reset || triggered_reset) && !fighter_is_nana { if save_state.state == NoAction { @@ -638,7 +638,7 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor) } // Save state - if button_config::combo_passes_exclusive(button_config::ButtonCombo::SaveState) { + if button_config::combo_passes(button_config::ButtonCombo::SaveState) { // Don't begin saving state if Nana's delayed input is captured MIRROR_STATE = 1.0; save_state_player(MENU.save_state_slot.as_idx() as usize).state = Save;