mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2024-11-28 04:44:06 +00:00
Move DI selection from const to an enum
This commit is contained in:
parent
78e53c29bd
commit
a1a761889c
3 changed files with 18 additions and 13 deletions
|
@ -1,7 +1,5 @@
|
|||
use smash::lib::lua_const::*;
|
||||
|
||||
pub const NONE: i32 = 0;
|
||||
|
||||
// Side Taunt
|
||||
|
||||
// DI
|
||||
|
@ -10,8 +8,14 @@ pub const NONE: i32 = 0;
|
|||
0, pi/4, pi/2, 3pi/4, pi, 5pi/4, 3pi/2, 7pi/4
|
||||
*/
|
||||
|
||||
/* DI */
|
||||
pub const DI_RANDOM_IN_AWAY: i32 = 9;
|
||||
/// DI
|
||||
#[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
|
||||
#[repr(i32)]
|
||||
|
@ -100,10 +104,10 @@ impl LedgeOption {
|
|||
pub fn into_status(&self) -> Option<i32> {
|
||||
Some(
|
||||
match self {
|
||||
LedgeOption::Neutral => status = *FIGHTER_STATUS_KIND_CLIFF_CLIMB,
|
||||
LedgeOption::Roll => status = *FIGHTER_STATUS_KIND_CLIFF_ESCAPE,
|
||||
LedgeOption::Jump => status = *FIGHTER_STATUS_KIND_CLIFF_JUMP1,
|
||||
LedgeOption::Attack => status = *FIGHTER_STATUS_KIND_CLIFF_ATTACK,
|
||||
LedgeOption::Neutral => *FIGHTER_STATUS_KIND_CLIFF_CLIMB,
|
||||
LedgeOption::Roll => *FIGHTER_STATUS_KIND_CLIFF_ESCAPE,
|
||||
LedgeOption::Jump => *FIGHTER_STATUS_KIND_CLIFF_JUMP1,
|
||||
LedgeOption::Attack => *FIGHTER_STATUS_KIND_CLIFF_ATTACK,
|
||||
_ => return None,
|
||||
}
|
||||
)
|
||||
|
@ -202,7 +206,7 @@ impl From<i32> for Defensive {
|
|||
#[repr(C)]
|
||||
pub struct TrainingModpackMenu {
|
||||
pub hitbox_vis: bool,
|
||||
pub di_state: i32,
|
||||
pub di_state: DirectionalInfluence,
|
||||
pub mash_attack_state: Attack,
|
||||
pub ledge_state: LedgeOption,
|
||||
pub tech_state: TechOption,
|
||||
|
|
|
@ -7,7 +7,7 @@ use smash::hash40;
|
|||
|
||||
pub static mut MENU_STRUCT: consts::TrainingModpackMenu = consts::TrainingModpackMenu {
|
||||
hitbox_vis: true,
|
||||
di_state: NONE,
|
||||
di_state: DirectionalInfluence::None,
|
||||
mash_attack_state: Attack::Nair,
|
||||
ledge_state: LedgeOption::Random,
|
||||
tech_state: TechOption::Random,
|
||||
|
|
|
@ -14,13 +14,14 @@ pub unsafe fn get_float(
|
|||
{
|
||||
if is_training_mode() && is_operation_cpu(module_accessor) && is_in_hitstun(module_accessor)
|
||||
{
|
||||
if MENU.di_state != NONE {
|
||||
let mut angle = (MENU.di_state - 1) as f64 * PI / 4.0;
|
||||
if MENU.di_state != DirectionalInfluence::None {
|
||||
let mut angle = (MENU.di_state as i32 - 1) as f64 * PI / 4.0;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// If facing left, reverse angle
|
||||
if PostureModule::lr(module_accessor) != -1.0 {
|
||||
angle -= PI;
|
||||
|
|
Loading…
Reference in a new issue