1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-28 12:50:16 +00:00

nit refactor: use OnOff when possible

This commit is contained in:
jugeeya 2020-11-08 19:35:42 -08:00
parent 30e38b1256
commit 2e5097bcd0
4 changed files with 8 additions and 23 deletions

View file

@ -2,21 +2,6 @@ use crate::common::get_random_int;
use core::f64::consts::PI;
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
macro_rules! to_vec_impl {
($e:ty) => {
@ -314,8 +299,8 @@ impl BoolFlag {
#[repr(C)]
pub struct TrainingModpackMenu {
pub hitbox_vis: HitboxVisualization,
pub stage_hazards: StageHazards,
pub hitbox_vis: OnOff,
pub stage_hazards: OnOff,
pub di_state: Direction,
pub sdi_state: Direction,
pub air_dodge_dir: Direction,

View file

@ -6,8 +6,8 @@ use smash::hash40;
use smash::lib::lua_const::*;
pub static mut MENU_STRUCT: consts::TrainingModpackMenu = consts::TrainingModpackMenu {
hitbox_vis: HitboxVisualization::On,
stage_hazards: StageHazards::Off,
hitbox_vis: OnOff::On,
stage_hazards: OnOff::Off,
di_state: Direction::empty(),
sdi_state: Direction::empty(),
air_dodge_dir: Direction::empty(),

View file

@ -93,7 +93,7 @@ fn hazard_intercept(ctx: &skyline::hooks::InlineCtx) {
fn mod_handle_hazards() {
unsafe {
*HAZARD_FLAG_ADDRESS = (MENU.stage_hazards == StageHazards::On) as u8;
*HAZARD_FLAG_ADDRESS = (MENU.stage_hazards == OnOff::On) as u8;
}
}

View file

@ -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
MotionAnimcmdModule::set_sleep_effect(module_accessor, false);
if MENU.hitbox_vis == HitboxVisualization::Off {
if MENU.hitbox_vis == OnOff::Off {
return;
}
@ -230,7 +230,7 @@ unsafe fn mod_handle_attack(lua_state: u64) {
}
// Hitbox Visualization
if MENU.hitbox_vis == HitboxVisualization::On {
if MENU.hitbox_vis == OnOff::On {
// get all necessary grabbox params
let id = l2c_agent.pop_lua_stack(1); // int
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) {
if MENU.hitbox_vis == HitboxVisualization::Off {
if MENU.hitbox_vis == OnOff::Off {
return;
}