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

Add Fast Fall Toggle (#97)

* Add Fast Fall Toggle

Spark effect is currently missing

* Change Condition Order

* Fix Spark Effect
This commit is contained in:
sidschingis 2020-06-19 23:54:37 +02:00 committed by GitHub
parent a3ea3e7332
commit 099ae06e89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 100 additions and 4 deletions

@ -1 +1 @@
Subproject commit deb973c588f8c9f285ae11ded7437c8967f23591
Subproject commit 88e4eb92387319ad3ceb398364ecb3ab52425e86

View file

@ -50,7 +50,6 @@ impl From<i32> for Direction {
}
}
//pub static FIGHTER_FACING_LEFT: f32 = 1.0;
pub static FIGHTER_FACING_RIGHT: f32 = -1.0;
pub static ANGLE_NONE: f64 = -69.0;
@ -256,6 +255,13 @@ pub enum MashInNeutral {
On = 1,
}
#[repr(i32)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum FastFall {
Off = 0,
On = 1,
}
#[repr(C)]
pub struct TrainingModpackMenu {
pub hitbox_vis: HitboxVisualization,
@ -268,5 +274,6 @@ pub struct TrainingModpackMenu {
pub shield_state: Shield,
pub defensive_state: Defensive,
pub oos_offset: i32,
pub mash_in_neutral: MashInNeutral
pub mash_in_neutral: MashInNeutral,
pub fast_fall: FastFall,
}

View file

@ -16,7 +16,8 @@ pub static mut MENU_STRUCT: consts::TrainingModpackMenu = consts::TrainingModpac
shield_state: Shield::None,
defensive_state: Defensive::Random,
oos_offset: 0,
mash_in_neutral: MashInNeutral::Off
mash_in_neutral: MashInNeutral::Off,
fast_fall: FastFall::On,
};
pub static mut MENU: &'static mut consts::TrainingModpackMenu = unsafe { &mut MENU_STRUCT };

86
src/training/fast_fall.rs Normal file
View file

@ -0,0 +1,86 @@
use crate::common::consts::FastFall;
use crate::common::*;
use smash::app::{self, lua_bind::*};
use smash::lib::lua_const::*;
use smash::phx::{Hash40, Vector3f};
pub unsafe fn get_command_flag_cat(
module_accessor: &mut app::BattleObjectModuleAccessor,
category: i32,
) {
if !is_training_mode() {
return;
}
// Once per frame
if category != 0 {
return;
}
if MENU.fast_fall != FastFall::On {
return;
}
if !is_operation_cpu(module_accessor) {
return;
}
if !is_airborne(module_accessor) {
return;
}
let y_speed =
KineticModule::get_sum_speed_y(module_accessor, *FIGHTER_KINETIC_ENERGY_ID_GRAVITY);
// Need to be falling
if y_speed >= 0.0 {
return;
}
// Can't fastfall in hitstun
if is_in_hitstun(module_accessor) {
return;
}
// Already in fast fall, nothing to do
if WorkModule::is_flag(module_accessor, *FIGHTER_STATUS_WORK_ID_FLAG_RESERVE_DIVE) {
return;
}
// Set Fast Fall Flag
WorkModule::set_flag(
module_accessor,
true,
*FIGHTER_STATUS_WORK_ID_FLAG_RESERVE_DIVE,
);
add_spark_effect(module_accessor);
}
unsafe fn add_spark_effect(module_accessor: &mut app::BattleObjectModuleAccessor) {
// Mock Spark effect
let pos = Vector3f {
x: PostureModule::pos_x(module_accessor),
y: PostureModule::pos_y(module_accessor),
z: 0.0,
};
let rotation = Vector3f {
x: 0.0,
y: 0.0,
z: 0.0,
};
let size = 2.0;
EffectModule::req(
module_accessor,
Hash40::new("sys_smash_flash_s"),
&pos,
&rotation,
size,
0,
0,
true,
*EFFECT_SUB_ATTRIBUTE_CONCLUDE_STATUS,
);
}

View file

@ -9,6 +9,7 @@ pub mod shield;
pub mod tech;
pub mod combo;
mod fast_fall;
mod ledge;
mod left_stick;
mod mash;
@ -65,6 +66,7 @@ pub unsafe fn handle_get_command_flag_cat(
ledge::get_command_flag_cat(module_accessor, category, &mut flag);
tech::get_command_flag_cat(module_accessor, category, &mut flag);
hitbox_visualizer::get_command_flag_cat(module_accessor, category);
fast_fall::get_command_flag_cat(module_accessor, category);
flag
}