1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2025-03-22 06:16:11 +00:00
UltimateTrainingModpack/src/training/shield_tilt.rs
Chris McDonald 5b2e4c7319
Add rustfmt CI checker and format (#518)
* Add rustfmt CI checker

Minimal checker that just runs `cargo fmt --check` on all targets.

* rustfmt
2023-04-11 14:56:14 -07:00

32 lines
773 B
Rust

use smash::app::{self};
use crate::common::consts::*;
use crate::common::*;
static mut STICK_DIRECTION: Direction = Direction::OUT;
pub fn roll_direction() {
unsafe {
STICK_DIRECTION = MENU.shield_tilt.get_random();
}
}
pub unsafe fn mod_get_stick_x(
module_accessor: &mut app::BattleObjectModuleAccessor,
) -> Option<f32> {
get_angle(module_accessor).map(|a| a.cos() as f32)
}
pub unsafe fn mod_get_stick_y(
module_accessor: &mut app::BattleObjectModuleAccessor,
) -> Option<f32> {
get_angle(module_accessor).map(|a| a.sin() as f32)
}
unsafe fn get_angle(module_accessor: &mut app::BattleObjectModuleAccessor) -> Option<f64> {
if !is_operation_cpu(module_accessor) {
return None;
}
STICK_DIRECTION.into_angle()
}