diff --git a/TrainingModpackOverlay b/TrainingModpackOverlay index 0361716..ebe52de 160000 --- a/TrainingModpackOverlay +++ b/TrainingModpackOverlay @@ -1 +1 @@ -Subproject commit 036171692ee4c704d6794f7c263509c316f48a9c +Subproject commit ebe52ded3762dc3a45aa07652cbacbc410145ead diff --git a/src/common/consts.rs b/src/common/consts.rs index 937b18c..2c60154 100644 --- a/src/common/consts.rs +++ b/src/common/consts.rs @@ -1,6 +1,12 @@ use smash::lib::lua_const::*; -// Side Taunt +/// Hitbox Visualization +#[repr(i32)] +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum HitboxVisualization { + Off = 0, + On = 1, +} // DI /* @@ -203,9 +209,17 @@ impl From for Defensive { } } +/// Mash in neutral +#[repr(i32)] +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum MashInNeutral { + Off = 0, + On = 1, +} + #[repr(C)] pub struct TrainingModpackMenu { - pub hitbox_vis: bool, + pub hitbox_vis: HitboxVisualization, pub di_state: DirectionalInfluence, pub mash_attack_state: Attack, pub ledge_state: LedgeOption, @@ -213,5 +227,6 @@ pub struct TrainingModpackMenu { pub mash_state: Mash, pub shield_state: Shield, pub defensive_state: Defensive, - pub oos_offset: u8, + pub oos_offset: i32, + pub mash_in_neutral: MashInNeutral } diff --git a/src/common/mod.rs b/src/common/mod.rs index 9f1e192..b980034 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -6,7 +6,7 @@ use smash::hash40; use smash::lib::lua_const::*; pub static mut MENU_STRUCT: consts::TrainingModpackMenu = consts::TrainingModpackMenu { - hitbox_vis: true, + hitbox_vis: HitboxVisualization::On, di_state: DirectionalInfluence::None, mash_attack_state: Attack::Nair, ledge_state: LedgeOption::Random, @@ -15,6 +15,7 @@ pub static mut MENU_STRUCT: consts::TrainingModpackMenu = consts::TrainingModpac shield_state: Shield::None, defensive_state: Defensive::Random, oos_offset: 0, + mash_in_neutral: MashInNeutral::Off, }; pub static MENU: &'static mut consts::TrainingModpackMenu = unsafe { &mut MENU_STRUCT }; @@ -52,6 +53,16 @@ pub unsafe fn is_operation_cpu(module_accessor: &mut app::BattleObjectModuleAcce FighterInformation::is_operation_cpu(fighter_information) } +pub unsafe fn is_grounded(module_accessor: &mut app::BattleObjectModuleAccessor) ->bool{ + let situation_kind = StatusModule::situation_kind(module_accessor) as i32; + situation_kind == SITUATION_KIND_GROUND +} + +pub unsafe fn is_airborne(module_accessor: &mut app::BattleObjectModuleAccessor) ->bool{ + let situation_kind = StatusModule::situation_kind(module_accessor) as i32; + situation_kind == SITUATION_KIND_AIR +} + pub unsafe fn is_idle(module_accessor: &mut app::BattleObjectModuleAccessor) -> bool { let status_kind = StatusModule::status_kind(module_accessor); status_kind == FIGHTER_STATUS_KIND_WAIT diff --git a/src/hitbox_visualizer/mod.rs b/src/hitbox_visualizer/mod.rs index 3a5d52d..2ce94b1 100644 --- a/src/hitbox_visualizer/mod.rs +++ b/src/hitbox_visualizer/mod.rs @@ -170,7 +170,7 @@ pub unsafe fn get_command_flag_cat( // Resume Effect AnimCMD incase we don't display hitboxes MotionAnimcmdModule::set_sleep_effect(module_accessor, false); - if !MENU.hitbox_vis { + if MENU.hitbox_vis == HitboxVisualization::Off { return; } @@ -248,7 +248,7 @@ unsafe fn mod_handle_attack(lua_state: u64) { } // Hitbox Visualization - if MENU.hitbox_vis { + if MENU.hitbox_vis == HitboxVisualization::On { // get all necessary grabbox params let id = l2c_agent.pop_lua_stack(1); // int let joint = l2c_agent.pop_lua_stack(3); // hash40 @@ -291,7 +291,7 @@ unsafe fn mod_handle_catch(lua_state: u64) { return; } - if !MENU.hitbox_vis { + if MENU.hitbox_vis == HitboxVisualization::Off { return; } diff --git a/src/training/mash.rs b/src/training/mash.rs index 56ce92b..3169246 100644 --- a/src/training/mash.rs +++ b/src/training/mash.rs @@ -34,6 +34,7 @@ pub unsafe fn get_command_flag_cat( category: i32, flag: &mut i32, ) { + // Only do once per frame if category != FIGHTER_PAD_COMMAND_CATEGORY1 { return; } @@ -55,6 +56,7 @@ pub unsafe fn get_command_flag_cat( || is_in_landing(module_accessor) || is_in_shieldstun(module_accessor) || is_in_footstool(module_accessor) + || MENU.mash_in_neutral == MashInNeutral::On || StatusModule::status_kind(module_accessor) == FIGHTER_STATUS_KIND_CLIFF_ROBBED) { return; @@ -84,8 +86,8 @@ pub unsafe fn get_command_flag_cat( match MENU.mash_attack_state { Nair | Fair | Bair | UpAir | Dair => { *flag |= *FIGHTER_PAD_CMD_CAT1_FLAG_ATTACK_N; - // If we are performing the attack OOS we also need to jump - if is_in_shieldstun(module_accessor) { + // If we are grounded we also need to jump + if is_grounded(module_accessor) { *flag |= *FIGHTER_PAD_CMD_CAT1_FLAG_JUMP_BUTTON; } } diff --git a/src/training/shield.rs b/src/training/shield.rs index 87afbb7..5003d5e 100644 --- a/src/training/shield.rs +++ b/src/training/shield.rs @@ -9,7 +9,7 @@ use smash::lib::L2CValue; use smash::lua2cpp::L2CFighterCommon; // How many hits to hold shield until picking an Out Of Shield option -static mut MULTI_HIT_OFFSET: u8 = MENU.oos_offset; +static mut MULTI_HIT_OFFSET: i32 = MENU.oos_offset; // Used to only decrease once per shieldstun change static mut WAS_IN_SHIELDSTUN: bool = false;