Skip to content

Commit 97b9686

Browse files
committed
Allows the FE Swordies to buffer side b in hitlag
1 parent 9311b22 commit 97b9686

File tree

4 files changed

+141
-8
lines changed

4 files changed

+141
-8
lines changed

fighters/chrom/src/opff.rs

+36
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,42 @@ unsafe fn side_special_cancels(fighter: &mut L2CFighterCommon) {
114114
}
115115
}
116116

117+
pub unsafe fn double_edge_dance_during_hitlag(fighter: &mut L2CFighterCommon) {
118+
if !fighter.is_status_one_of(&[*FIGHTER_STATUS_KIND_SPECIAL_S, *FIGHTER_ROY_STATUS_KIND_SPECIAL_S2, *FIGHTER_ROY_STATUS_KIND_SPECIAL_S3]) {
119+
return;
120+
}
121+
if fighter.global_table[globals::SUB_STATUS].get_bool() {
122+
// disables the original substatus - I'd rather not run it twice.
123+
fighter.global_table[globals::SUB_STATUS].assign(&L2CValue::Void());
124+
}
125+
if !WorkModule::is_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_FAILURE) {
126+
if WorkModule::is_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_SUCCESS) {
127+
return;
128+
}
129+
if !ControlModule::check_button_trigger(fighter.module_accessor, *CONTROL_PAD_BUTTON_SPECIAL) {
130+
return;
131+
}
132+
if !WorkModule::is_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_CHECK) {
133+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_FAILURE);
134+
}
135+
else {
136+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_SUCCESS);
137+
let enable_hi_lw = WorkModule::get_param_int(fighter.module_accessor, hash40("param_special_s"), hash40("enable_input_hi_lw"));
138+
if enable_hi_lw == 0 {
139+
return;
140+
}
141+
let stick_y = fighter.global_table[globals::STICK_Y].get_f32();
142+
let squat_stick_y = WorkModule::get_param_float(fighter.module_accessor, hash40("common"), hash40("squat_stick_y"));
143+
if stick_y > -squat_stick_y {
144+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_HI);
145+
}
146+
else if stick_y < squat_stick_y {
147+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_LW);
148+
}
149+
}
150+
}
151+
}
152+
117153
// Soaring Slash Hit
118154
unsafe fn soaring_slash(fighter: &mut L2CFighterCommon) {
119155
if !fighter.is_status_one_of(&[

fighters/lucina/src/status.rs

+31-8
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,7 @@ unsafe fn lucina_specials_main(fighter: &mut L2CFighterCommon) -> L2CValue {
106106
lucina_specials_reset_helper(fighter);
107107
ControlModule::reset_trigger(fighter.module_accessor);
108108
WorkModule::set_int( fighter.module_accessor, *FIGHTER_MARTH_STATUS_KIND_SPECIAL_S2, *FIGHTER_MARTH_STATUS_SPECIAL_S_WORK_INT_CHANGE_STATUS);
109-
if !StopModule::is_stop(fighter.module_accessor) {
110-
lucina_specials_substatus(fighter, false.into());
111-
}
112-
fighter.global_table[SUB_STATUS].assign(&L2CValue::Ptr(lucina_specials_substatus as *const () as _));
109+
113110
WorkModule::set_int64(fighter.module_accessor,
114111
hash40("special_s1") as i64,
115112
*FIGHTER_MARTH_STATUS_SPECIAL_S_WORK_INT_MOTION_KIND
@@ -122,7 +119,37 @@ unsafe fn lucina_specials_main(fighter: &mut L2CFighterCommon) -> L2CValue {
122119
fighter.sub_shift_status_main(L2CValue::Ptr(lucina_specials_main_loop as *const () as _))
123120
}
124121

122+
pub unsafe fn dancing_blade_transition_check(fighter: &mut L2CFighterCommon) {
123+
if !WorkModule::is_flag(fighter.module_accessor, *FIGHTER_MARTH_STATUS_SPECIAL_S_FLAG_INPUT_FAILURE) {
124+
if WorkModule::is_flag(fighter.module_accessor, *FIGHTER_MARTH_STATUS_SPECIAL_S_FLAG_INPUT_SUCCESS) {
125+
return;
126+
}
127+
if !ControlModule::check_button_trigger(fighter.module_accessor, *CONTROL_PAD_BUTTON_SPECIAL) {
128+
return;
129+
}
130+
if !WorkModule::is_flag(fighter.module_accessor, *FIGHTER_MARTH_STATUS_SPECIAL_S_FLAG_INPUT_CHECK) {
131+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_MARTH_STATUS_SPECIAL_S_FLAG_INPUT_FAILURE);
132+
}
133+
else {
134+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_MARTH_STATUS_SPECIAL_S_FLAG_INPUT_SUCCESS);
135+
let enable_hi_lw = WorkModule::get_param_int(fighter.module_accessor, hash40("param_special_s"), hash40("enable_input_hi_lw"));
136+
if enable_hi_lw == 0 {
137+
return;
138+
}
139+
let stick_y = fighter.global_table[STICK_Y].get_f32();
140+
let squat_stick_y = WorkModule::get_param_float(fighter.module_accessor, hash40("common"), hash40("squat_stick_y"));
141+
if stick_y > -squat_stick_y {
142+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_MARTH_STATUS_SPECIAL_S_FLAG_INPUT_HI);
143+
}
144+
else if stick_y < squat_stick_y {
145+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_MARTH_STATUS_SPECIAL_S_FLAG_INPUT_LW);
146+
}
147+
}
148+
}
149+
}
150+
125151
unsafe extern "C" fn lucina_specials_main_loop(fighter: &mut L2CFighterCommon) -> L2CValue {
152+
dancing_blade_transition_check(fighter);
126153
if !StatusModule::is_changing(fighter.module_accessor) {
127154
if StatusModule::is_situation_changed(fighter.module_accessor) {
128155
lucina_specials_mot_helper(fighter);
@@ -151,10 +178,6 @@ unsafe fn lucina_specials2_main(fighter: &mut L2CFighterCommon) -> L2CValue {
151178
*FIGHTER_MARTH_STATUS_KIND_SPECIAL_S3,
152179
*FIGHTER_MARTH_STATUS_SPECIAL_S_WORK_INT_CHANGE_STATUS
153180
);
154-
if !StopModule::is_stop(fighter.module_accessor) {
155-
lucina_specials_substatus(fighter, false.into());
156-
}
157-
fighter.global_table[SUB_STATUS].assign(&L2CValue::Ptr(lucina_specials_substatus as *const () as _));
158181
if WorkModule::is_flag(fighter.module_accessor, *FIGHTER_MARTH_STATUS_SPECIAL_S_FLAG_INPUT_LW) {
159182
WorkModule::set_int64(
160183
fighter.module_accessor,

fighters/marth/src/opff.rs

+37
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,42 @@ pub unsafe fn dancing_blade_vertical_momentum(boma: &mut BattleObjectModuleAcces
1616
}
1717
}
1818

19+
pub unsafe fn dancing_blade_during_hitlag(fighter: &mut L2CFighterCommon) {
20+
if !fighter.is_status_one_of(&[*FIGHTER_STATUS_KIND_SPECIAL_S, *FIGHTER_MARTH_STATUS_KIND_SPECIAL_S2, *FIGHTER_MARTH_STATUS_KIND_SPECIAL_S3]) {
21+
return;
22+
}
23+
if fighter.global_table[SUB_STATUS].get_bool() {
24+
// disables the original substatus - I'd rather not run it twice.
25+
fighter.global_table[SUB_STATUS].assign(&L2CValue::Void());
26+
}
27+
if !WorkModule::is_flag(fighter.module_accessor, *FIGHTER_MARTH_STATUS_SPECIAL_S_FLAG_INPUT_FAILURE) {
28+
if WorkModule::is_flag(fighter.module_accessor, *FIGHTER_MARTH_STATUS_SPECIAL_S_FLAG_INPUT_SUCCESS) {
29+
return;
30+
}
31+
if !ControlModule::check_button_trigger(fighter.module_accessor, *CONTROL_PAD_BUTTON_SPECIAL) {
32+
return;
33+
}
34+
if !WorkModule::is_flag(fighter.module_accessor, *FIGHTER_MARTH_STATUS_SPECIAL_S_FLAG_INPUT_CHECK) {
35+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_MARTH_STATUS_SPECIAL_S_FLAG_INPUT_FAILURE);
36+
}
37+
else {
38+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_MARTH_STATUS_SPECIAL_S_FLAG_INPUT_SUCCESS);
39+
let enable_hi_lw = WorkModule::get_param_int(fighter.module_accessor, hash40("param_special_s"), hash40("enable_input_hi_lw"));
40+
if enable_hi_lw == 0 {
41+
return;
42+
}
43+
let stick_y = fighter.global_table[STICK_Y].get_f32();
44+
let squat_stick_y = WorkModule::get_param_float(fighter.module_accessor, hash40("common"), hash40("squat_stick_y"));
45+
if stick_y > -squat_stick_y {
46+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_MARTH_STATUS_SPECIAL_S_FLAG_INPUT_HI);
47+
}
48+
else if stick_y < squat_stick_y {
49+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_MARTH_STATUS_SPECIAL_S_FLAG_INPUT_LW);
50+
}
51+
}
52+
}
53+
}
54+
1955
// Fixes weird vanilla behavior where touching ground during upB puts you into special fall for 1f before landing
2056
unsafe fn up_special_proper_landing(fighter: &mut L2CFighterCommon) {
2157
if fighter.is_status(*FIGHTER_STATUS_KIND_SPECIAL_HI)
@@ -62,6 +98,7 @@ unsafe fn fastfall_specials(fighter: &mut L2CFighterCommon) {
6298

6399
pub unsafe fn moveset(fighter: &mut L2CFighterCommon, boma: &mut BattleObjectModuleAccessor, id: usize, cat: [i32 ; 4], status_kind: i32, situation_kind: i32, motion_kind: u64, stick_x: f32, stick_y: f32, facing: f32, frame: f32) {
64100
dancing_blade_vertical_momentum(boma);
101+
dancing_blade_during_hitlag(fighter);
65102
up_special_proper_landing(fighter);
66103
fastfall_specials(fighter);
67104
}

fighters/roy/src/opff.rs

+37
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,42 @@ pub unsafe fn double_edge_dance_vertical_momentum(boma: &mut BattleObjectModuleA
1616
}
1717
}
1818

19+
pub unsafe fn double_edge_dance_during_hitlag(fighter: &mut L2CFighterCommon) {
20+
if !fighter.is_status_one_of(&[*FIGHTER_STATUS_KIND_SPECIAL_S, *FIGHTER_ROY_STATUS_KIND_SPECIAL_S2, *FIGHTER_ROY_STATUS_KIND_SPECIAL_S3]) {
21+
return;
22+
}
23+
if fighter.global_table[SUB_STATUS].get_bool() {
24+
// disables the original substatus - I'd rather not run it twice.
25+
fighter.global_table[SUB_STATUS].assign(&L2CValue::Void());
26+
}
27+
if !WorkModule::is_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_FAILURE) {
28+
if WorkModule::is_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_SUCCESS) {
29+
return;
30+
}
31+
if !ControlModule::check_button_trigger(fighter.module_accessor, *CONTROL_PAD_BUTTON_SPECIAL) {
32+
return;
33+
}
34+
if !WorkModule::is_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_CHECK) {
35+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_FAILURE);
36+
}
37+
else {
38+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_SUCCESS);
39+
let enable_hi_lw = WorkModule::get_param_int(fighter.module_accessor, hash40("param_special_s"), hash40("enable_input_hi_lw"));
40+
if enable_hi_lw == 0 {
41+
return;
42+
}
43+
let stick_y = fighter.global_table[STICK_Y].get_f32();
44+
let squat_stick_y = WorkModule::get_param_float(fighter.module_accessor, hash40("common"), hash40("squat_stick_y"));
45+
if stick_y > -squat_stick_y {
46+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_HI);
47+
}
48+
else if stick_y < squat_stick_y {
49+
WorkModule::on_flag(fighter.module_accessor, *FIGHTER_ROY_STATUS_SPECIAL_S_FLAG_INPUT_LW);
50+
}
51+
}
52+
}
53+
}
54+
1955
// Fixes weird vanilla behavior where touching ground during upB puts you into special fall for 1f before landing
2056
unsafe fn up_special_proper_landing(fighter: &mut L2CFighterCommon) {
2157
if fighter.is_status(*FIGHTER_STATUS_KIND_SPECIAL_HI)
@@ -66,6 +102,7 @@ unsafe fn fastfall_specials(fighter: &mut L2CFighterCommon) {
66102

67103
pub unsafe fn moveset(fighter: &mut L2CFighterCommon, boma: &mut BattleObjectModuleAccessor, id: usize, cat: [i32 ; 4], status_kind: i32, situation_kind: i32, motion_kind: u64, stick_x: f32, stick_y: f32, facing: f32, frame: f32) {
68104
double_edge_dance_vertical_momentum(boma);
105+
double_edge_dance_during_hitlag(fighter);
69106
up_special_proper_landing(fighter);
70107
fastfall_specials(fighter);
71108
}

0 commit comments

Comments
 (0)