mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2025-03-22 06:16:11 +00:00
nit refactor: use OnOff when possible
This commit is contained in:
parent
30e38b1256
commit
2e5097bcd0
4 changed files with 8 additions and 23 deletions
|
@ -2,21 +2,6 @@ use crate::common::get_random_int;
|
||||||
use core::f64::consts::PI;
|
use core::f64::consts::PI;
|
||||||
use smash::lib::lua_const::*;
|
use smash::lib::lua_const::*;
|
||||||
|
|
||||||
/// Hitbox Visualization
|
|
||||||
#[repr(i32)]
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
|
||||||
pub enum HitboxVisualization {
|
|
||||||
Off = 0,
|
|
||||||
On = 1,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[repr(i32)]
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
|
||||||
pub enum StageHazards {
|
|
||||||
Off = 0,
|
|
||||||
On = 1,
|
|
||||||
}
|
|
||||||
|
|
||||||
// bitflag helper function macro
|
// bitflag helper function macro
|
||||||
macro_rules! to_vec_impl {
|
macro_rules! to_vec_impl {
|
||||||
($e:ty) => {
|
($e:ty) => {
|
||||||
|
@ -314,8 +299,8 @@ impl BoolFlag {
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct TrainingModpackMenu {
|
pub struct TrainingModpackMenu {
|
||||||
pub hitbox_vis: HitboxVisualization,
|
pub hitbox_vis: OnOff,
|
||||||
pub stage_hazards: StageHazards,
|
pub stage_hazards: OnOff,
|
||||||
pub di_state: Direction,
|
pub di_state: Direction,
|
||||||
pub sdi_state: Direction,
|
pub sdi_state: Direction,
|
||||||
pub air_dodge_dir: Direction,
|
pub air_dodge_dir: Direction,
|
||||||
|
|
|
@ -6,8 +6,8 @@ use smash::hash40;
|
||||||
use smash::lib::lua_const::*;
|
use smash::lib::lua_const::*;
|
||||||
|
|
||||||
pub static mut MENU_STRUCT: consts::TrainingModpackMenu = consts::TrainingModpackMenu {
|
pub static mut MENU_STRUCT: consts::TrainingModpackMenu = consts::TrainingModpackMenu {
|
||||||
hitbox_vis: HitboxVisualization::On,
|
hitbox_vis: OnOff::On,
|
||||||
stage_hazards: StageHazards::Off,
|
stage_hazards: OnOff::Off,
|
||||||
di_state: Direction::empty(),
|
di_state: Direction::empty(),
|
||||||
sdi_state: Direction::empty(),
|
sdi_state: Direction::empty(),
|
||||||
air_dodge_dir: Direction::empty(),
|
air_dodge_dir: Direction::empty(),
|
||||||
|
|
|
@ -93,7 +93,7 @@ fn hazard_intercept(ctx: &skyline::hooks::InlineCtx) {
|
||||||
|
|
||||||
fn mod_handle_hazards() {
|
fn mod_handle_hazards() {
|
||||||
unsafe {
|
unsafe {
|
||||||
*HAZARD_FLAG_ADDRESS = (MENU.stage_hazards == StageHazards::On) as u8;
|
*HAZARD_FLAG_ADDRESS = (MENU.stage_hazards == OnOff::On) as u8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ pub unsafe fn get_command_flag_cat(module_accessor: &mut app::BattleObjectModule
|
||||||
// Resume Effect AnimCMD incase we don't display hitboxes
|
// Resume Effect AnimCMD incase we don't display hitboxes
|
||||||
MotionAnimcmdModule::set_sleep_effect(module_accessor, false);
|
MotionAnimcmdModule::set_sleep_effect(module_accessor, false);
|
||||||
|
|
||||||
if MENU.hitbox_vis == HitboxVisualization::Off {
|
if MENU.hitbox_vis == OnOff::Off {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ unsafe fn mod_handle_attack(lua_state: u64) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hitbox Visualization
|
// Hitbox Visualization
|
||||||
if MENU.hitbox_vis == HitboxVisualization::On {
|
if MENU.hitbox_vis == OnOff::On {
|
||||||
// get all necessary grabbox params
|
// get all necessary grabbox params
|
||||||
let id = l2c_agent.pop_lua_stack(1); // int
|
let id = l2c_agent.pop_lua_stack(1); // int
|
||||||
let joint = l2c_agent.pop_lua_stack(3); // hash40
|
let joint = l2c_agent.pop_lua_stack(3); // hash40
|
||||||
|
@ -276,7 +276,7 @@ unsafe fn handle_catch(lua_state: u64) {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn mod_handle_catch(lua_state: u64) {
|
unsafe fn mod_handle_catch(lua_state: u64) {
|
||||||
if MENU.hitbox_vis == HitboxVisualization::Off {
|
if MENU.hitbox_vis == OnOff::Off {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue