mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2025-03-14 02:16:10 +00:00
fix mashing by using button presses instead; add mash shield to airdodge toggle
This commit is contained in:
parent
64bb02f1b6
commit
7e3badefc8
1 changed files with 26 additions and 63 deletions
|
@ -28,7 +28,7 @@ void perform_jump(u64 module_accessor) {
|
|||
int max_jump_count = WorkModule::get_int(module_accessor, FIGHTER_INSTANCE_WORK_ID_INT_JUMP_COUNT_MAX);
|
||||
if (jump_count < max_jump_count) {
|
||||
if (StatusModule::situation_kind(module_accessor) == SITUATION_KIND_AIR) {
|
||||
if (WorkModule::get_param_int(module_accessor, 0xB99CC3FBCLL, 0) == FIGHTER_JUMP_AERIAL_TYPE_NORMAL)
|
||||
if (WorkModule::get_param_int(module_accessor, hash40("aerial_type"), 0) == FIGHTER_JUMP_AERIAL_TYPE_NORMAL)
|
||||
StatusModule::change_status_request_from_script(module_accessor, FIGHTER_STATUS_KIND_JUMP_AERIAL, 1);
|
||||
else
|
||||
StatusModule::change_status_request_from_script(module_accessor, FIGHTER_STATUS_KIND_FLY, 1);
|
||||
|
@ -41,33 +41,6 @@ void perform_jump(u64 module_accessor) {
|
|||
|
||||
namespace app::lua_bind {
|
||||
namespace WorkModule {
|
||||
// Force option out of hitstun
|
||||
u64 enable_transition_term_group_replace(u64 module_accessor, int transition_group) {
|
||||
if (is_training_mode() && is_operation_cpu(module_accessor)) {
|
||||
if (is_in_hitstun(module_accessor)) {
|
||||
if (TOGGLE_STATE == MASH_AIRDODGE) { // airdodge
|
||||
if (transition_group == FIGHTER_STATUS_TRANSITION_GROUP_CHK_AIR_ESCAPE)
|
||||
StatusModule::change_status_request_from_script(
|
||||
module_accessor, FIGHTER_STATUS_KIND_ESCAPE_AIR, 1);
|
||||
} else if (TOGGLE_STATE == MASH_JUMP) { // jump
|
||||
if (transition_group ==
|
||||
FIGHTER_STATUS_TRANSITION_GROUP_CHK_AIR_JUMP_AERIAL)
|
||||
perform_jump(module_accessor);
|
||||
else if (transition_group ==
|
||||
FIGHTER_STATUS_TRANSITION_GROUP_CHK_GROUND_JUMP)
|
||||
perform_jump(module_accessor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// call original WorkModule::enable_transition_term_group_impl
|
||||
u64 work_module = load_module(module_accessor, 0x50);
|
||||
u64 (*enable_transition_term_group)(u64, u64) =
|
||||
(u64(*)(u64, u64))(load_module_impl(work_module, 0x140));
|
||||
|
||||
return enable_transition_term_group(work_module, transition_group);
|
||||
}
|
||||
|
||||
// Force DI
|
||||
float get_float_replace(u64 module_accessor, int var) {
|
||||
if (is_training_mode() && is_operation_cpu(module_accessor)) {
|
||||
|
@ -121,42 +94,35 @@ namespace app::lua_bind {
|
|||
}
|
||||
} // namespace WorkModule
|
||||
|
||||
namespace MotionModule {
|
||||
void change_motion_replace(u64 module_accessor, u64 motion_kind,
|
||||
float start_frame, float frame_speed_mult, bool unk1,
|
||||
float unk2, bool unk3, bool unk4) {
|
||||
u64 curr_motion_kind = MotionModule::motion_kind(module_accessor);
|
||||
if ((curr_motion_kind == hash40("damage_air_1") ||
|
||||
curr_motion_kind == hash40("damage_air_2") ||
|
||||
curr_motion_kind == hash40("damage_air_3")) &&
|
||||
motion_kind == hash40("fall")) {
|
||||
if (is_training_mode() && is_operation_cpu(module_accessor)) {
|
||||
if (TOGGLE_STATE == MASH_AIRDODGE) // airdodge
|
||||
StatusModule::change_status_request_from_script(
|
||||
module_accessor, FIGHTER_STATUS_KIND_ESCAPE_AIR, 1);
|
||||
else if (TOGGLE_STATE == MASH_JUMP) // jump
|
||||
perform_jump(module_accessor);
|
||||
}
|
||||
namespace ControlModule {
|
||||
int get_command_flag_cat_replace(u64 module_accessor, int category) {
|
||||
// call original
|
||||
u64 control_module = load_module(module_accessor, 0x48);
|
||||
int (*get_command_flag_cat)(u64, int) =
|
||||
(int (*)(u64, int))load_module_impl(control_module, 0x350);
|
||||
int flag = get_command_flag_cat(control_module, category);
|
||||
|
||||
if (is_training_mode() && is_operation_cpu(module_accessor) && is_in_hitstun(module_accessor)) {
|
||||
if (TOGGLE_STATE == MASH_AIRDODGE)
|
||||
if (category == FIGHTER_PAD_COMMAND_CATEGORY1)
|
||||
flag |= FIGHTER_PAD_CMD_CAT1_FLAG_AIR_ESCAPE;
|
||||
|
||||
if (TOGGLE_STATE == MASH_JUMP)
|
||||
if (category == FIGHTER_PAD_COMMAND_CATEGORY1)
|
||||
flag |= FIGHTER_PAD_CMD_CAT1_FLAG_JUMP_BUTTON;
|
||||
}
|
||||
|
||||
// call original
|
||||
u64 motion_module = load_module(module_accessor, 0x88);
|
||||
void (*change_motion)(u64, u64, float, float, bool, float, bool, bool) =
|
||||
(void (*)(u64, u64, float, float, bool, float, bool,
|
||||
bool))load_module_impl(motion_module, 0xD8);
|
||||
|
||||
change_motion(motion_module, motion_kind, start_frame, frame_speed_mult, unk1,
|
||||
unk2, unk3, unk4);
|
||||
return flag;
|
||||
}
|
||||
} // namespace MotionModule
|
||||
|
||||
namespace ControlModule {
|
||||
bool check_button_on_replace(u64 module_accessor, int button) {
|
||||
if (button == CONTROL_PAD_BUTTON_GUARD_HOLD ||
|
||||
button == CONTROL_PAD_BUTTON_GUARD) {
|
||||
if (is_training_mode() && is_operation_cpu(module_accessor)) {
|
||||
if (TOGGLE_STATE == HOLD_SHIELD || TOGGLE_STATE == INFINITE_SHIELD)
|
||||
return true;
|
||||
if (TOGGLE_STATE == MASH_AIRDODGE && is_in_hitstun(module_accessor))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,7 +238,7 @@ namespace app::lua_bind {
|
|||
*/
|
||||
}
|
||||
|
||||
// Grab + Dpad up: Save state
|
||||
// Grab + Dpad down: Save state
|
||||
if (ControlModule::check_button_on(module_accessor, CONTROL_PAD_BUTTON_CATCH) &&
|
||||
ControlModule::check_button_trigger(module_accessor, CONTROL_PAD_BUTTON_APPEAL_LW)) {
|
||||
save_state_player_state = SAVE_STATE;
|
||||
|
@ -303,11 +269,8 @@ void training_mods_main() {
|
|||
fighter_manager_addr = SaltySDCore_FindSymbol("_ZN3lib9SingletonIN3app14FighterManagerEE9instance_E");
|
||||
// Mash airdodge/jump
|
||||
SaltySD_function_replace_sym(
|
||||
"_ZN3app8lua_bind45WorkModule__enable_transition_term_group_implEPNS_26BattleObjectModuleAccessorEi",
|
||||
(u64)&WorkModule::enable_transition_term_group_replace);
|
||||
SaltySD_function_replace_sym(
|
||||
"_ZN3app8lua_bind32MotionModule__change_motion_implEPNS_26BattleObjectModuleAccessorEN3phx6Hash40Effbfbb",
|
||||
(u64)&MotionModule::change_motion_replace);
|
||||
"_ZN3app8lua_bind40ControlModule__get_command_flag_cat_implEPNS_26BattleObjectModuleAccessorEi",
|
||||
(u64)&ControlModule::get_command_flag_cat_replace);
|
||||
|
||||
// Set DI
|
||||
SaltySD_function_replace_sym(
|
||||
|
@ -325,8 +288,8 @@ void training_mods_main() {
|
|||
"_ZN3app8lua_bind32WorkModule__get_param_float_implEPNS_26BattleObjectModuleAccessorEmm",
|
||||
(u64)&WorkModule::get_param_float_replace);
|
||||
|
||||
// Save states
|
||||
SaltySD_function_replace_sym(
|
||||
// Save states: in beta
|
||||
/*SaltySD_function_replace_sym(
|
||||
"_ZN3app8lua_bind32ControlModule__get_pad_flag_implEPNS_26BattleObjectModuleAccessorE",
|
||||
(u64)&ControlModule::get_pad_flag_replace);
|
||||
(u64)&ControlModule::get_pad_flag_replace);*/
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue