1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-10-02 17:24:28 +00:00

Move to button config

This commit is contained in:
jugeeya 2023-08-03 18:34:07 -07:00
parent 8b7a50ec63
commit 9bc5d49fbf
2 changed files with 46 additions and 9 deletions

View file

@ -40,6 +40,14 @@ static mut BUTTON_COMBO_CONFIG: BtnComboConfig = BtnComboConfig {
hold: vec![],
press: vec![],
},
input_record: BtnList {
hold: vec![],
press: vec![],
},
input_playback: BtnList {
hold: vec![],
press: vec![],
},
};
#[derive(Debug, EnumIter, PartialEq)]
@ -47,6 +55,8 @@ pub enum ButtonCombo {
OpenMenu,
SaveState,
LoadState,
InputRecord,
InputPlayback,
}
#[derive(Deserialize, Default)]
@ -60,6 +70,8 @@ struct BtnComboConfig {
open_menu: BtnList,
save_state: BtnList,
load_state: BtnList,
input_record: BtnList,
input_playback: BtnList,
}
#[derive(Deserialize)]
@ -106,6 +118,14 @@ fn save_all_btn_config_from_defaults() {
hold: vec!["SHIELD".to_string()],
press: vec!["UPTAUNT".to_string()],
},
input_record: BtnList {
hold: vec!["ATTACK".to_string()],
press: vec!["LEFTTAUNT".to_string()],
},
input_playback: BtnList {
hold: vec!["ATTACK".to_string()],
press: vec!["RIGHTTAUNT".to_string()],
},
},
};
unsafe {
@ -170,6 +190,14 @@ unsafe fn get_combo_keys(combo: ButtonCombo) -> (&'static Vec<String>, &'static
&BUTTON_COMBO_CONFIG.load_state.hold,
&BUTTON_COMBO_CONFIG.load_state.press,
),
ButtonCombo::InputRecord => (
&BUTTON_COMBO_CONFIG.input_record.hold,
&BUTTON_COMBO_CONFIG.input_record.press,
),
ButtonCombo::InputPlayback => (
&BUTTON_COMBO_CONFIG.input_playback.hold,
&BUTTON_COMBO_CONFIG.input_playback.press,
),
}
}
@ -234,4 +262,12 @@ press=["DOWNTAUNT",]
[button_config.load_state]
hold=["SHIELD",]
press=["UPTAUNT",]
[button_config.input_record]
hold=["ATTACK",]
press=["LEFTTAUNT",]
[button_config.input_playback]
hold=["ATTACK",]
press=["RIGHTTAUNT",]
"#;

View file

@ -1,4 +1,5 @@
use crate::common::consts::{FighterId, HitstunPlayback, RecordTrigger};
use crate::common::button_config;
use crate::common::consts::{FighterId, HitstunPlayback};
use crate::common::{get_module_accessor, is_in_hitstun, is_in_shieldstun, MENU};
use crate::training::input_recording::structures::*;
use crate::training::mash;
@ -177,19 +178,19 @@ 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 {
// Attack + Dpad Right: Playback
if ControlModule::check_button_on(module_accessor, *CONTROL_PAD_BUTTON_ATTACK)
&& ControlModule::check_button_trigger(module_accessor, *CONTROL_PAD_BUTTON_APPEAL_S_R)
{
if button_config::combo_passes_exclusive(
module_accessor,
button_config::ButtonCombo::InputPlayback,
) {
//crate::common::raygun_printer::print_string(&mut *module_accessor, "PLAYBACK");
playback();
println!("Playback Command Received!"); //debug
}
// Attack + Dpad Left: Record
else if ControlModule::check_button_on(module_accessor, *CONTROL_PAD_BUTTON_ATTACK)
&& ControlModule::check_button_trigger(module_accessor, *CONTROL_PAD_BUTTON_APPEAL_S_L)
&& MENU.record_trigger == RecordTrigger::Command
{
else if button_config::combo_passes_exclusive(
module_accessor,
button_config::ButtonCombo::InputRecord,
) {
//crate::common::raygun_printer::print_string(&mut *module_accessor, "RECORDING");
lockout_record();
println!("Record Command Received!"); //debug