1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2025-02-26 02:50:23 +00:00

Move DI selection from const to an enum

This commit is contained in:
jam1garner 2020-05-16 02:27:14 -04:00
parent 78e53c29bd
commit a1a761889c
3 changed files with 18 additions and 13 deletions

View file

@ -1,7 +1,5 @@
use smash::lib::lua_const::*; use smash::lib::lua_const::*;
pub const NONE: i32 = 0;
// Side Taunt // Side Taunt
// DI // DI
@ -10,8 +8,14 @@ pub const NONE: i32 = 0;
0, pi/4, pi/2, 3pi/4, pi, 5pi/4, 3pi/2, 7pi/4 0, pi/4, pi/2, 3pi/4, pi, 5pi/4, 3pi/2, 7pi/4
*/ */
/* DI */ /// DI
pub const DI_RANDOM_IN_AWAY: i32 = 9; #[repr(i32)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum DirectionalInfluence {
None = 0,
// lol what goes here jug smh my head
RandomInAway = 9,
}
/// Mash Attack States /// Mash Attack States
#[repr(i32)] #[repr(i32)]
@ -100,10 +104,10 @@ impl LedgeOption {
pub fn into_status(&self) -> Option<i32> { pub fn into_status(&self) -> Option<i32> {
Some( Some(
match self { match self {
LedgeOption::Neutral => status = *FIGHTER_STATUS_KIND_CLIFF_CLIMB, LedgeOption::Neutral => *FIGHTER_STATUS_KIND_CLIFF_CLIMB,
LedgeOption::Roll => status = *FIGHTER_STATUS_KIND_CLIFF_ESCAPE, LedgeOption::Roll => *FIGHTER_STATUS_KIND_CLIFF_ESCAPE,
LedgeOption::Jump => status = *FIGHTER_STATUS_KIND_CLIFF_JUMP1, LedgeOption::Jump => *FIGHTER_STATUS_KIND_CLIFF_JUMP1,
LedgeOption::Attack => status = *FIGHTER_STATUS_KIND_CLIFF_ATTACK, LedgeOption::Attack => *FIGHTER_STATUS_KIND_CLIFF_ATTACK,
_ => return None, _ => return None,
} }
) )
@ -202,7 +206,7 @@ impl From<i32> for Defensive {
#[repr(C)] #[repr(C)]
pub struct TrainingModpackMenu { pub struct TrainingModpackMenu {
pub hitbox_vis: bool, pub hitbox_vis: bool,
pub di_state: i32, pub di_state: DirectionalInfluence,
pub mash_attack_state: Attack, pub mash_attack_state: Attack,
pub ledge_state: LedgeOption, pub ledge_state: LedgeOption,
pub tech_state: TechOption, pub tech_state: TechOption,

View file

@ -7,7 +7,7 @@ use smash::hash40;
pub static mut MENU_STRUCT: consts::TrainingModpackMenu = consts::TrainingModpackMenu { pub static mut MENU_STRUCT: consts::TrainingModpackMenu = consts::TrainingModpackMenu {
hitbox_vis: true, hitbox_vis: true,
di_state: NONE, di_state: DirectionalInfluence::None,
mash_attack_state: Attack::Nair, mash_attack_state: Attack::Nair,
ledge_state: LedgeOption::Random, ledge_state: LedgeOption::Random,
tech_state: TechOption::Random, tech_state: TechOption::Random,

View file

@ -14,13 +14,14 @@ pub unsafe fn get_float(
{ {
if is_training_mode() && is_operation_cpu(module_accessor) && is_in_hitstun(module_accessor) if is_training_mode() && is_operation_cpu(module_accessor) && is_in_hitstun(module_accessor)
{ {
if MENU.di_state != NONE { if MENU.di_state != DirectionalInfluence::None {
let mut angle = (MENU.di_state - 1) as f64 * PI / 4.0; let mut angle = (MENU.di_state as i32 - 1) as f64 * PI / 4.0;
// Either 0 (right) or PI (left) // Either 0 (right) or PI (left)
if MENU.di_state == DI_RANDOM_IN_AWAY { if MENU.di_state == DirectionalInfluence::RandomInAway {
angle = app::sv_math::rand(hash40("fighter"), 2) as f64 * PI; angle = app::sv_math::rand(hash40("fighter"), 2) as f64 * PI;
} }
// If facing left, reverse angle // If facing left, reverse angle
if PostureModule::lr(module_accessor) != -1.0 { if PostureModule::lr(module_accessor) != -1.0 {
angle -= PI; angle -= PI;