Skip to content

Commit 04cc88f

Browse files
committed
prevent grab --> escape transition when undesired
1 parent 4a6e31f commit 04cc88f

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

fighters/common/src/general_statuses/catch/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod catchattack;
66
#[skyline::hook(replace = L2CFighterCommon_sub_transition_group_check_ground_catch)]
77
unsafe fn sub_transition_group_check_ground_catch(fighter: &mut L2CFighterCommon) -> L2CValue {
88
// prevents c-stick grabs, making c-stick roll feel smooth
9-
if super::shield::misc::check_cstick_escape_oos(fighter).get_bool() || super::shield::misc::check_escape_oos(fighter).get_bool() {
9+
if super::shield::misc::check_cstick_escape_oos(fighter, false).get_bool() || super::shield::misc::check_escape_oos(fighter, false).get_bool() {
1010
return false.into();
1111
}
1212
call_original!(fighter)

fighters/common/src/general_statuses/shield/misc.rs

+21-17
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ pub unsafe fn check_guard_attack_special_hi(
209209
false.into()
210210
}
211211

212-
pub unsafe fn check_cstick_escape_oos(fighter: &mut L2CFighterCommon) -> L2CValue {
212+
pub unsafe fn check_cstick_escape_oos(fighter: &mut L2CFighterCommon, should_transition: bool) -> L2CValue {
213213
let boma = fighter.module_accessor;
214214

215215
let c_stick_override = fighter.is_button_on(Buttons::CStickOverride);
@@ -255,21 +255,23 @@ pub unsafe fn check_cstick_escape_oos(fighter: &mut L2CFighterCommon) -> L2CValu
255255

256256
for (term, condition, status) in escapes.iter() {
257257
if WorkModule::is_enable_transition_term(boma, *term) && *condition {
258-
// NOTE: DO NOT TOUCH
259-
// We must pass `false` to `change_status` so that the game does not clear our buffer/pad flag.
260-
// When it is done via `change_status`, the game will regenerate them the next time `sub_shift_status_main` is called.
261-
fighter.change_status((*status).into(), false.into());
262-
// We then must pass `true` to `clear_command` so that game "forgets" that we cleared our buffer
263-
// and will not regenerate our pad flags
264-
ControlModule::clear_command(fighter.module_accessor, true);
258+
if should_transition {
259+
// NOTE: DO NOT TOUCH
260+
// We must pass `false` to `change_status` so that the game does not clear our buffer/pad flag.
261+
// When it is done via `change_status`, the game will regenerate them the next time `sub_shift_status_main` is called.
262+
fighter.change_status((*status).into(), false.into());
263+
// We then must pass `true` to `clear_command` so that game "forgets" that we cleared our buffer
264+
// and will not regenerate our pad flags
265+
ControlModule::clear_command(fighter.module_accessor, true);
266+
}
265267
return true.into();
266268
}
267269
}
268270

269271
return false.into();
270272
}
271273

272-
pub unsafe fn check_escape_oos(fighter: &mut L2CFighterCommon) -> L2CValue {
274+
pub unsafe fn check_escape_oos(fighter: &mut L2CFighterCommon, should_transition: bool) -> L2CValue {
273275
let boma = fighter.module_accessor;
274276

275277
let escapes = [
@@ -292,13 +294,15 @@ pub unsafe fn check_escape_oos(fighter: &mut L2CFighterCommon) -> L2CValue {
292294

293295
for (term, condition, status) in escapes.iter() {
294296
if WorkModule::is_enable_transition_term(boma, *term) && *condition {
295-
// NOTE: DO NOT TOUCH
296-
// We must pass `false` to `change_status` so that the game does not clear our buffer/pad flag.
297-
// When it is done via `change_status`, the game will regenerate them the next time `sub_shift_status_main` is called.
298-
fighter.change_status((*status).into(), false.into());
299-
// We then must pass `true` to `clear_command` so that game "forgets" that we cleared our buffer
300-
// and will not regenerate our pad flags
301-
ControlModule::clear_command(fighter.module_accessor, true);
297+
if should_transition {
298+
// NOTE: DO NOT TOUCH
299+
// We must pass `false` to `change_status` so that the game does not clear our buffer/pad flag.
300+
// When it is done via `change_status`, the game will regenerate them the next time `sub_shift_status_main` is called.
301+
fighter.change_status((*status).into(), false.into());
302+
// We then must pass `true` to `clear_command` so that game "forgets" that we cleared our buffer
303+
// and will not regenerate our pad flags
304+
ControlModule::clear_command(fighter.module_accessor, true);
305+
}
302306
return true.into();
303307
}
304308
}
@@ -431,7 +435,7 @@ pub unsafe fn sub_guard_cont(fighter: &mut L2CFighterCommon) -> L2CValue {
431435
}
432436

433437
if !guard_hold {
434-
if check_escape_oos(fighter).get_bool() || check_cstick_escape_oos(fighter).get_bool() {
438+
if check_escape_oos(fighter, true).get_bool() || check_cstick_escape_oos(fighter, true).get_bool() {
435439
return true.into();
436440
}
437441
}

0 commit comments

Comments
 (0)