1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-20 00:46:34 +00:00

satisfy clippy rules

This commit is contained in:
jugeeya 2020-09-27 22:24:50 +00:00
parent c6c600aae1
commit 67a03dd38a
21 changed files with 172 additions and 219 deletions

View file

@ -1,7 +1,8 @@
{
"rust-analyzer.checkOnSave.overrideCommand": [
// "RUST_TARGET_PATH=`pwd`",
"xargo",
"check",
"clippy",
"--workspace",
"--message-format=json",
"--all-features"

View file

@ -14,7 +14,6 @@ bitflags = "1.2.1"
parking_lot = { version = "0.11.0", features = ["nightly"] }
lazy_static = "1.4.0"
owo-colors = "1.1.3"
paste = "1.0"
[profile.dev]
panic = "abort"

View file

@ -45,8 +45,8 @@ macro_rules! to_index_impl {
};
}
pub fn random_option<T>(arg: &Vec<T>) -> &T {
return &arg[get_random_int(arg.len() as i32) as usize];
pub fn random_option<T>(arg: &[T]) -> &T {
&arg[get_random_int(arg.len() as i32) as usize]
}
macro_rules! get_random_impl {
@ -91,7 +91,7 @@ bitflags! {
}
impl Direction {
pub fn into_angle(&self) -> f64 {
pub fn into_angle(self) -> f64 {
let index = self.into_index();
if index == 0 {
@ -100,8 +100,8 @@ impl Direction {
(index as i32 - 1) as f64 * PI / 4.0
}
fn into_index(&self) -> i32 {
return match *self {
fn into_index(self) -> i32 {
match self {
Direction::OUT => 1,
Direction::UP_OUT => 2,
Direction::UP => 3,
@ -110,8 +110,8 @@ impl Direction {
Direction::DOWN_IN => 6,
Direction::DOWN => 7,
Direction::DOWN_OUT => 8,
__ => 0,
};
_ => 0,
}
}
to_vec_impl! {Direction}
get_random_impl! {Direction}
@ -131,8 +131,8 @@ bitflags! {
}
impl LedgeOption {
pub fn into_status(&self) -> Option<i32> {
Some(match *self {
pub fn into_status(self) -> Option<i32> {
Some(match self {
LedgeOption::NEUTRAL => *FIGHTER_STATUS_KIND_CLIFF_CLIMB,
LedgeOption::ROLL => *FIGHTER_STATUS_KIND_CLIFF_ESCAPE,
LedgeOption::JUMP => *FIGHTER_STATUS_KIND_CLIFF_JUMP1,
@ -228,18 +228,18 @@ bitflags! {
const D_SMASH = 0x20000;
const JAB = 0x40000;
const F_TILT = 0x80000;
const U_TILT = 0x100000;
const D_TILT = 0x200000;
const GRAB = 0x400000;
const U_TILT = 0x0010_0000;
const D_TILT = 0x0020_0000;
const GRAB = 0x0040_0000;
// TODO: Make work
const DASH = 0x800000;
const DASH_ATTACK = 0x1000000;
const DASH = 0x0080_0000;
const DASH_ATTACK = 0x0100_0000;
}
}
impl Action {
pub fn into_attack_air_kind(&self) -> Option<i32> {
Some(match *self {
pub fn into_attack_air_kind(self) -> Option<i32> {
Some(match self {
Action::NAIR => *FIGHTER_COMMAND_ATTACK_AIR_KIND_N,
Action::FAIR => *FIGHTER_COMMAND_ATTACK_AIR_KIND_F,
Action::BAIR => *FIGHTER_COMMAND_ATTACK_AIR_KIND_B,
@ -274,17 +274,17 @@ bitflags! {
const D17 = 0x20000;
const D18 = 0x40000;
const D19 = 0x80000;
const D20 = 0x100000;
const D21 = 0x200000;
const D22 = 0x400000;
const D23 = 0x800000;
const D24 = 0x1000000;
const D25 = 0x2000000;
const D26 = 0x4000000;
const D27 = 0x8000000;
const D28 = 0x10000000;
const D29 = 0x20000000;
const D30 = 0x40000000;
const D20 = 0x0010_0000;
const D21 = 0x0020_0000;
const D22 = 0x0040_0000;
const D23 = 0x0080_0000;
const D24 = 0x0100_0000;
const D25 = 0x0200_0000;
const D26 = 0x0400_0000;
const D27 = 0x0800_0000;
const D28 = 0x1000_0000;
const D29 = 0x2000_0000;
const D30 = 0x4000_0000;
}
}
@ -305,11 +305,11 @@ impl BoolFlag {
to_vec_impl! {BoolFlag}
get_random_impl! {BoolFlag}
pub fn into_bool(&self) -> bool {
return match *self {
pub fn into_bool(self) -> bool {
match self {
BoolFlag::TRUE => true,
_ => false,
};
}
}
}

View file

@ -31,7 +31,7 @@ pub static mut MENU_STRUCT: consts::TrainingModpackMenu = consts::TrainingModpac
input_delay: 0,
};
pub static mut MENU: &'static mut consts::TrainingModpackMenu = unsafe { &mut MENU_STRUCT };
pub static mut MENU: &consts::TrainingModpackMenu = unsafe { &mut MENU_STRUCT };
pub static mut FIGHTER_MANAGER_ADDR: usize = 0;
pub static mut STAGE_MANAGER_ADDR: usize = 0;
@ -45,7 +45,7 @@ extern "C" {
}
pub fn get_category(module_accessor: &mut app::BattleObjectModuleAccessor) -> i32 {
return (module_accessor.info >> 28) as u8 as i32;
(module_accessor.info >> 28) as u8 as i32
}
pub fn get_module_accessor(fighter_id: FighterId) -> *mut app::BattleObjectModuleAccessor {

View file

@ -54,10 +54,10 @@ fn get_hazard_flag_address() -> usize {
let program_counter = flag_pos & !0xFFF; // Need program counter to mimic ADRP
let adrp = unsafe { adrp_get_imm(*(flag_pos as *mut u32)) as usize };
let add = unsafe { add_get_imm(*((flag_pos + 4) as *mut u32)) as usize };
return program_counter + adrp + add + 0x9;
program_counter + adrp + add + 0x9
}
fn get_hazard_hook_address() -> usize {
fn get_hazard_hook_address() -> isize {
let mut state = HookState::Begin;
let mut flag_pos = 0;
for (pos, instr) in TextIter::new() {
@ -74,12 +74,13 @@ fn get_hazard_hook_address() -> usize {
}
}
}
return flag_pos;
flag_pos as isize
}
// 8.1.0 Defaults
static mut HAZARD_FLAG_ADDRESS: *mut u8 = 0x4ebbf95 as *mut u8;
static mut LOAD_ADDRESS: usize = 0x214bde8;
static mut HAZARD_FLAG_ADDRESS: *mut u8 = 0x04eb_bf95 as *mut u8;
static mut LOAD_ADDRESS: isize = 0x0214_bde8;
#[hook(offset = LOAD_ADDRESS, inline)]
fn hazard_intercept(ctx: &skyline::hooks::InlineCtx) {
@ -103,7 +104,7 @@ unsafe fn validate_hazards_addrs() -> std::result::Result<(), ()> {
let mut error_string: String = String::new();
let mut error_id = 0;
if HAZARD_FLAG_ADDRESS == 0 as *mut u8 {
if HAZARD_FLAG_ADDRESS.is_null() {
error_string += &String::from("The Ultimate Training Modpack was unable to locate stage loading code in your version of the game.\n\n");
error_id += 1000;
}

View file

@ -89,10 +89,11 @@ pub unsafe fn generate_hitbox_effects(
}
for i in 0..n_effects {
let mut t = 0.0;
if n_effects > 1 {
t = (i as f32) / ((n_effects - 1) as f32);
}
let t = if n_effects > 1 {
(i as f32) / ((n_effects - 1) as f32)
} else {
0.0
};
let x_curr = x + x_dist * t;
let y_curr = y + y_dist * t;
let z_curr = z + z_dist * t;
@ -185,14 +186,11 @@ pub unsafe fn get_command_flag_cat(module_accessor: &mut app::BattleObjectModule
let attack_data = *AttackModule::attack_data(module_accessor, i, false);
let is_capsule = attack_data.x2 != 0.0 || attack_data.y2 != 0.0 || attack_data.z2 != 0.0;
let mut x2 = None;
let mut y2 = None;
let mut z2 = None;
if is_capsule {
x2 = Some(attack_data.x2);
y2 = Some(attack_data.y2);
z2 = Some(attack_data.z2);
}
let (x2, y2, z2) = if is_capsule {
(Some(attack_data.x2), Some(attack_data.y2), Some(attack_data.z2))
} else {
(None, None, None)
};
generate_hitbox_effects(
module_accessor,
attack_data.node, // joint
@ -310,7 +308,7 @@ unsafe fn mod_handle_handle_set_rebound(
module_accessor: *mut app::BattleObjectModuleAccessor,
rebound: bool,
) {
if rebound != false {
if rebound {
return;
}

View file

@ -23,8 +23,7 @@ fn nro_main(nro: &NroInfo<'_>) {
return;
}
match nro.name {
"common" => {
if nro.name == "common" {
skyline::install_hooks!(
training::shield::handle_sub_guard_cont,
training::directional_influence::handle_correct_damage_vector_common,
@ -32,8 +31,6 @@ fn nro_main(nro: &NroInfo<'_>) {
training::tech::handle_change_status
);
}
_ => (),
}
}
macro_rules! c_str {
@ -63,7 +60,7 @@ pub fn main() {
"Writing training_modpack.log with {}...",
buffer
);
mkdir(c_str!("sd:/TrainingModpack/"), 0777);
mkdir(c_str!("sd:/TrainingModpack/"), 777);
// Only necessary upon version upgrade.
// log!("[Training Modpack] Removing training_modpack_menu.conf...");

View file

@ -67,5 +67,5 @@ fn is_correct_status(module_accessor: &mut app::BattleObjectModuleAccessor) -> b
return true;
}
return false;
false
}

View file

@ -71,8 +71,7 @@ pub unsafe fn is_enable_transition_term(
PLAYER_ACTIONABLE = true;
// if both are now active
if PLAYER_ACTIONABLE && CPU_ACTIONABLE {
if FRAME_ADVANTAGE_CHECK {
if PLAYER_ACTIONABLE && CPU_ACTIONABLE && FRAME_ADVANTAGE_CHECK {
let cpu_module_accessor = get_module_accessor(FighterId::CPU);
if was_in_hitstun(cpu_module_accessor) || was_in_shieldstun(cpu_module_accessor) {
FRAME_ADVANTAGE = (CPU_ACTIVE_FRAME as i64 - PLAYER_ACTIVE_FRAME as i64) as i32;
@ -83,7 +82,6 @@ pub unsafe fn is_enable_transition_term(
}
}
}
}
pub unsafe fn get_command_flag_cat(
module_accessor: &mut app::BattleObjectModuleAccessor,
@ -126,8 +124,7 @@ pub unsafe fn get_command_flag_cat(
}
// if both are now active
if PLAYER_ACTIONABLE && CPU_ACTIONABLE {
if FRAME_ADVANTAGE_CHECK {
if PLAYER_ACTIONABLE && CPU_ACTIONABLE && FRAME_ADVANTAGE_CHECK {
if was_in_hitstun(cpu_module_accessor) || was_in_shieldstun(cpu_module_accessor) {
FRAME_ADVANTAGE = (CPU_ACTIVE_FRAME as i64 - PLAYER_ACTIVE_FRAME as i64) as i32;
}
@ -136,4 +133,3 @@ pub unsafe fn get_command_flag_cat(
FRAME_ADVANTAGE_CHECK = false;
}
}
}

View file

@ -47,8 +47,8 @@ pub fn should_reverse_angle() -> bool {
let cpu_module_accessor = get_module_accessor(FighterId::CPU);
let player_module_accessor = get_module_accessor(FighterId::Player);
unsafe {
return PostureModule::pos_x(player_module_accessor)
> PostureModule::pos_x(cpu_module_accessor);
PostureModule::pos_x(player_module_accessor)
> PostureModule::pos_x(cpu_module_accessor)
}
}

View file

@ -13,7 +13,7 @@ static mut FAST_FALL: bool = false;
fn should_fast_fall() -> bool {
unsafe {
return FAST_FALL;
FAST_FALL
}
}

View file

@ -57,7 +57,7 @@ pub fn should_delay(delay: u32, index: usize) -> bool {
return false;
}
return true;
true
}
pub fn get_frame_count(index: usize) -> u32 {

View file

@ -7,7 +7,7 @@ static mut FULL_HOP: bool = false;
pub fn should_full_hop() -> bool {
unsafe{
return FULL_HOP;
FULL_HOP
}
}

View file

@ -32,19 +32,13 @@ pub unsafe fn handle_get_npad_state(
let actual_state = *state;
if delayed_states.len() < MENU.input_delay as usize {
(*state).Buttons = 0;
(*state).LStickX = 0;
(*state).LStickY = 0;
(*state).RStickX = 0;
(*state).RStickY = 0;
(*state).Flags = 0;
let update_count = (*state).updateCount;
*state = NpadHandheldState::default();
(*state).updateCount = update_count;
} else if let Some(delayed_state) = delayed_states.back() {
(*state).Buttons = delayed_state.Buttons;
(*state).LStickX = delayed_state.LStickX;
(*state).LStickY = delayed_state.LStickY;
(*state).RStickX = delayed_state.RStickX;
(*state).RStickY = delayed_state.RStickY;
(*state).Flags = delayed_state.Flags;
let update_count = (*state).updateCount;
*state = *delayed_state;
(*state).updateCount = update_count;
}
delayed_states.push_front(actual_state);

View file

@ -1,19 +1,16 @@
use skyline::nn::hid::NpadHandheldState;
use smash::app::{BattleObjectModuleAccessor, lua_bind::*};
use smash::lib::lua_const::*;
use lazy_static::lazy_static;
use parking_lot::Mutex;
use crate::training::input_delay::p1_controller_id;
pub static mut P1_NPAD_STATES: &mut [NpadHandheldState; 90] = &mut [{
NpadHandheldState {
updateCount: 0,
Buttons: 0,
LStickX: 0,
LStickY: 0,
RStickX: 0,
RStickY: 0,
Flags: 0,
lazy_static! {
static ref P1_NPAD_STATES: Mutex<[NpadHandheldState; 90]> =
Mutex::new([{
NpadHandheldState::default()
}; 90]);
}
}; 90];
pub static mut INPUT_RECORD: InputRecordState = InputRecordState::None;
pub static mut INPUT_RECORD_FRAME: usize = 0;
@ -47,7 +44,7 @@ pub unsafe fn get_command_flag_cat(module_accessor: &mut BattleObjectModuleAcces
if INPUT_RECORD == Record || INPUT_RECORD == Playback {
if INPUT_RECORD_FRAME >= P1_NPAD_STATES.len() - 1 {
if INPUT_RECORD_FRAME >= P1_NPAD_STATES.lock().len() - 1 {
if INPUT_RECORD == Record {
INPUT_RECORD = Playback;
}
@ -61,16 +58,8 @@ pub unsafe fn get_command_flag_cat(module_accessor: &mut BattleObjectModuleAcces
pub unsafe fn record() {
INPUT_RECORD = Record;
P1_NPAD_STATES.iter_mut().for_each(|state| {
*state = NpadHandheldState {
updateCount: 0,
Buttons: 0,
LStickX: 0,
LStickY: 0,
RStickX: 0,
RStickY: 0,
Flags: 0,
}
P1_NPAD_STATES.lock().iter_mut().for_each(|state| {
*state = NpadHandheldState::default();
});
INPUT_RECORD_FRAME = 0;
}
@ -86,16 +75,11 @@ pub unsafe fn handle_get_npad_state(
) {
if *controller_id == p1_controller_id() {
if INPUT_RECORD == Record {
P1_NPAD_STATES[INPUT_RECORD_FRAME] = *state;
}
} else {
if INPUT_RECORD == Record || INPUT_RECORD == Playback {
(*state).Buttons = P1_NPAD_STATES[INPUT_RECORD_FRAME].Buttons;
(*state).LStickX = P1_NPAD_STATES[INPUT_RECORD_FRAME].LStickX;
(*state).LStickY = P1_NPAD_STATES[INPUT_RECORD_FRAME].LStickY;
(*state).RStickX = P1_NPAD_STATES[INPUT_RECORD_FRAME].RStickX;
(*state).RStickY = P1_NPAD_STATES[INPUT_RECORD_FRAME].RStickY;
(*state).Flags = P1_NPAD_STATES[INPUT_RECORD_FRAME].Flags;
P1_NPAD_STATES.lock()[INPUT_RECORD_FRAME] = *state;
}
} else if INPUT_RECORD == Record || INPUT_RECORD == Playback {
let update_count = (*state).updateCount;
*state = P1_NPAD_STATES.lock()[INPUT_RECORD_FRAME];
(*state).updateCount = update_count;
}
}

View file

@ -18,7 +18,7 @@ static mut AERIAL_DELAY: u32 = 0;
pub fn buffer_action(action: Action) {
unsafe {
if QUEUE.len() > 0 {
if !QUEUE.is_empty() {
return;
}
}
@ -55,11 +55,11 @@ pub fn buffer_follow_up() {
pub fn get_current_buffer() -> Action {
unsafe {
if QUEUE.len() == 0 {
if !QUEUE.is_empty() {
return Action::empty();
}
return *QUEUE.last().unwrap();
*QUEUE.last().unwrap()
}
}
@ -78,7 +78,7 @@ fn reset() {
pub fn full_reset() {
unsafe {
while QUEUE.len() > 0 {
while !QUEUE.is_empty() {
reset();
}
}
@ -115,11 +115,11 @@ pub unsafe fn get_command_flag_cat(
check_buffer(module_accessor);
return perform_action(module_accessor);
perform_action(module_accessor)
}
unsafe fn check_buffer(module_accessor: &mut app::BattleObjectModuleAccessor) {
if QUEUE.len() > 0 {
if !QUEUE.is_empty() {
return;
}
@ -145,7 +145,7 @@ fn should_buffer(module_accessor: &mut app::BattleObjectModuleAccessor) -> bool
return true;
}
return false;
false
}
// Temp Translation
@ -167,46 +167,42 @@ unsafe fn perform_action(module_accessor: &mut app::BattleObjectModuleAccessor)
match action {
Action::AIR_DODGE => {
let expected_status;
let command_flag;
let (expected_status, command_flag) = if is_grounded(module_accessor) {
// Shield if grounded instead
if is_grounded(module_accessor) {
/*
Doesn't actually cause the shield, but will clear the buffer once shield is possible.
Shield hold is performed through shield::should_hold_shield and request_shield
*/
expected_status = *FIGHTER_STATUS_KIND_GUARD_ON;
command_flag = *FIGHTER_PAD_CMD_CAT1_FLAG_AIR_ESCAPE;
(*FIGHTER_STATUS_KIND_GUARD_ON, *FIGHTER_PAD_CMD_CAT1_FLAG_AIR_ESCAPE)
} else {
expected_status = *FIGHTER_STATUS_KIND_ESCAPE_AIR;
command_flag = *FIGHTER_PAD_CMD_CAT1_FLAG_AIR_ESCAPE;
}
(*FIGHTER_STATUS_KIND_ESCAPE_AIR, *FIGHTER_PAD_CMD_CAT1_FLAG_AIR_ESCAPE)
};
return get_flag(module_accessor, expected_status, command_flag);
get_flag(module_accessor, expected_status, command_flag)
}
Action::JUMP => {
return update_jump_flag(module_accessor);
update_jump_flag(module_accessor)
}
Action::SPOT_DODGE => {
return get_flag(
get_flag(
module_accessor,
*FIGHTER_STATUS_KIND_ESCAPE,
*FIGHTER_PAD_CMD_CAT1_FLAG_ESCAPE,
);
)
}
Action::ROLL_F => {
return get_flag(
get_flag(
module_accessor,
*FIGHTER_STATUS_KIND_ESCAPE_F,
*FIGHTER_PAD_CMD_CAT1_FLAG_ESCAPE_F,
);
)
}
Action::ROLL_B => {
return get_flag(
get_flag(
module_accessor,
*FIGHTER_STATUS_KIND_ESCAPE_B,
*FIGHTER_PAD_CMD_CAT1_FLAG_ESCAPE_B,
);
)
}
Action::SHIELD => {
if !is_grounded(module_accessor) {
@ -216,11 +212,11 @@ unsafe fn perform_action(module_accessor: &mut app::BattleObjectModuleAccessor)
Doesn't actually cause the shield, but will clear the buffer once shield is possible.
Shield hold is performed through shield::should_hold_shield and request_shield
*/
return get_flag(
get_flag(
module_accessor,
*FIGHTER_STATUS_KIND_GUARD_ON,
*FIGHTER_PAD_CMD_CAT1_FLAG_AIR_ESCAPE,
);
)
}
Action::DASH => {
let dash_transition = *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_DASH;
@ -228,20 +224,18 @@ unsafe fn perform_action(module_accessor: &mut app::BattleObjectModuleAccessor)
try_change_status(module_accessor, dash_status, dash_transition);
return get_flag(module_accessor, *FIGHTER_STATUS_KIND_DASH, 0);
get_flag(module_accessor, *FIGHTER_STATUS_KIND_DASH, 0)
}
_ => return get_attack_flag(module_accessor, action),
_ => get_attack_flag(module_accessor, action),
}
}
pub fn request_shield(module_accessor: &mut app::BattleObjectModuleAccessor) -> bool {
match get_current_buffer() {
Action::SHIELD => return true,
Action::AIR_DODGE => return is_grounded(module_accessor),
_ => {}
Action::SHIELD => true,
Action::AIR_DODGE => is_grounded(module_accessor),
_ => false
}
return false;
}
unsafe fn update_jump_flag(module_accessor: &mut app::BattleObjectModuleAccessor) -> i32 {
@ -254,7 +248,7 @@ unsafe fn update_jump_flag(module_accessor: &mut app::BattleObjectModuleAccessor
};
let command_flag = *FIGHTER_PAD_CMD_CAT1_FLAG_JUMP_BUTTON;
return get_flag(module_accessor, check_flag, command_flag);
get_flag(module_accessor, check_flag, command_flag)
}
unsafe fn get_attack_flag(
@ -355,7 +349,7 @@ unsafe fn get_attack_flag(
_ => return 0,
}
return get_flag(module_accessor, status, command_flag);
get_flag(module_accessor, status, command_flag)
}
unsafe fn get_aerial_flag(
@ -402,7 +396,7 @@ unsafe fn get_aerial_flag(
flag |= get_flag(module_accessor, status, command_flag);
return flag;
flag
}
pub fn init() {
@ -437,7 +431,7 @@ fn should_delay_aerial(module_accessor: &mut app::BattleObjectModuleAccessor) ->
return true;
}
return frame_counter::should_delay(AERIAL_DELAY, AERIAL_DELAY_COUNTER);
frame_counter::should_delay(AERIAL_DELAY, AERIAL_DELAY_COUNTER)
}
}
@ -461,7 +455,7 @@ unsafe fn get_flag(
reset();
}
return command_flag;
command_flag
}
fn try_change_status(
@ -482,7 +476,7 @@ fn try_change_status(
StatusModule::change_status_request_from_script(module_accessor, expected_status, true);
}
return true;
true
}
pub unsafe fn perform_defensive_option() {

View file

@ -209,11 +209,11 @@ pub unsafe fn handle_change_motion(
unk5: bool,
unk6: bool,
) -> u64 {
let mut mod_motion_kind = motion_kind;
if is_training_mode() {
mod_motion_kind = tech::change_motion(module_accessor, motion_kind).unwrap_or(motion_kind);
}
let mod_motion_kind = if is_training_mode() {
tech::change_motion(module_accessor, motion_kind).unwrap_or(motion_kind)
} else {
motion_kind
};
original!()(
module_accessor,

View file

@ -35,7 +35,7 @@ fn should_reset(module_accessor: &mut app::BattleObjectModuleAccessor) -> bool {
return false;
}
return true;
true
}
pub fn on_reset() {

View file

@ -68,14 +68,12 @@ pub unsafe fn get_param_int(
pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor) {
let status = StatusModule::status_kind(module_accessor) as i32;
let save_state: &mut SavedState;
if WorkModule::get_int(module_accessor, *FIGHTER_INSTANCE_WORK_ID_INT_ENTRY_ID)
== FighterId::CPU as i32
{
save_state = &mut SAVE_STATE_CPU;
let save_state = if WorkModule::get_int(module_accessor, *FIGHTER_INSTANCE_WORK_ID_INT_ENTRY_ID)
== FighterId::CPU as i32 {
&mut SAVE_STATE_CPU
} else {
save_state = &mut SAVE_STATE_PLAYER;
}
&mut SAVE_STATE_PLAYER
};
// Grab + Dpad up: reset state
if ControlModule::check_button_on(module_accessor, *CONTROL_PAD_BUTTON_CATCH)
@ -95,8 +93,7 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
SoundModule::stop_all_sound(module_accessor);
if status == FIGHTER_STATUS_KIND_REBIRTH {
save_state.state = PosMove;
} else {
if status != FIGHTER_STATUS_KIND_DEAD && status != FIGHTER_STATUS_KIND_STANDBY {
} else if status != FIGHTER_STATUS_KIND_DEAD && status != FIGHTER_STATUS_KIND_STANDBY {
// Try moving off-screen so we don't see effects.
let pos = Vector3f {
x: -300.0,
@ -116,7 +113,6 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
false,
);
}
}
return;
}
@ -192,8 +188,6 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
{
SAVE_STATE_PLAYER.state = Save;
SAVE_STATE_CPU.state = Save;
// crate::training::input_record::record();
}
if save_state.state == Save {

View file

@ -32,8 +32,7 @@ pub unsafe fn process_hit_stop_delay(
if is_training_mode() {
let option = mod_sdi_direction(fighter);
if option.is_some() {
let angle = option.unwrap();
if let Some(angle) = option {
new_x = (angle.cos() as f32).into();
new_y = (angle.sin() as f32).into();
}
@ -64,7 +63,7 @@ fn mod_sdi_direction(fighter: &mut L2CFighterCommon) -> Option<f64> {
angle = PI - angle;
}
return Some(angle);
Some(angle)
}
#[skyline::hook(replace = FighterControlModuleImpl::check_hit_stop_delay_command)]
@ -107,5 +106,5 @@ fn mod_check_hit_stop_delay_command(
}
}
return Some(1);
Some(1)
}

View file

@ -94,7 +94,7 @@ pub fn get_command_flag_cat(module_accessor: &mut app::BattleObjectModuleAccesso
// Reset when not shielding
unsafe {
let status_kind = StatusModule::status_kind(module_accessor);
if !(status_kind == FIGHTER_STATUS_KIND_GUARD) {
if status_kind != FIGHTER_STATUS_KIND_GUARD {
set_shield_decay(false);
}
}
@ -261,21 +261,21 @@ unsafe fn handle_escape_option(
fighter
.fighter_base
.change_status(FIGHTER_STATUS_KIND_ESCAPE.as_lua_int(), LUA_TRUE);
return true;
true
}
Action::ROLL_F => {
fighter
.fighter_base
.change_status(FIGHTER_STATUS_KIND_ESCAPE_F.as_lua_int(), LUA_TRUE);
return true;
true
}
Action::ROLL_B => {
fighter
.fighter_base
.change_status(FIGHTER_STATUS_KIND_ESCAPE_B.as_lua_int(), LUA_TRUE);
return true;
true
}
_ => return false,
_ => false,
}
}
@ -306,12 +306,8 @@ fn needs_oos_handling_drop_shield() -> bool {
pub fn is_aerial(action: Action) -> bool {
match action {
Action::NAIR => return true,
Action::FAIR => return true,
Action::BAIR => return true,
Action::UAIR => return true,
Action::DAIR => return true,
_ => return false,
Action::NAIR | Action::FAIR | Action::BAIR | Action::UAIR | Action::DAIR => true,
_ => false,
}
}