1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2025-03-14 02:16:10 +00:00

randomize ledge timing

This commit is contained in:
jugeeya 2019-07-08 15:53:06 -07:00
parent 0889da9518
commit 292c4382d8
3 changed files with 40 additions and 45 deletions

View file

@ -13,9 +13,9 @@ namespace app::lua_bind {
u64 change_motion_kind(u64,u64) asm("_ZN3app8lua_bind37MotionModule__change_motion_kind_implEPNS_26BattleObjectModuleAccessorEN3phx6Hash40E") LINKABLE;
u64 clear_joint_srt(u64,u64) asm("_ZN3app8lua_bind34MotionModule__clear_joint_srt_implEPNS_26BattleObjectModuleAccessorEN3phx6Hash40E") LINKABLE;
u64 enable_shift_material_animation(u64,bool) asm("_ZN3app8lua_bind50MotionModule__enable_shift_material_animation_implEPNS_26BattleObjectModuleAccessorEb") LINKABLE;
u64 end_frame(u64) asm("_ZN3app8lua_bind28MotionModule__end_frame_implEPNS_26BattleObjectModuleAccessorE") LINKABLE;
u64 end_frame_from_hash(u64,u64) asm("_ZN3app8lua_bind38MotionModule__end_frame_from_hash_implEPNS_26BattleObjectModuleAccessorEN3phx6Hash40E") LINKABLE;
u64 end_frame_partial(u64,int) asm("_ZN3app8lua_bind36MotionModule__end_frame_partial_implEPNS_26BattleObjectModuleAccessorEi") LINKABLE;
float end_frame(u64) asm("_ZN3app8lua_bind28MotionModule__end_frame_implEPNS_26BattleObjectModuleAccessorE") LINKABLE;
float end_frame_from_hash(u64,u64) asm("_ZN3app8lua_bind38MotionModule__end_frame_from_hash_implEPNS_26BattleObjectModuleAccessorEN3phx6Hash40E") LINKABLE;
float end_frame_partial(u64,int) asm("_ZN3app8lua_bind36MotionModule__end_frame_partial_implEPNS_26BattleObjectModuleAccessorEi") LINKABLE;
float frame(u64) asm("_ZN3app8lua_bind24MotionModule__frame_implEPNS_26BattleObjectModuleAccessorE") LINKABLE;
float frame_2nd(u64) asm("_ZN3app8lua_bind28MotionModule__frame_2nd_implEPNS_26BattleObjectModuleAccessorE") LINKABLE;
float frame_partial(u64,int) asm("_ZN3app8lua_bind32MotionModule__frame_partial_implEPNS_26BattleObjectModuleAccessorEi") LINKABLE;

View file

@ -1,10 +1,16 @@
#include "common.hpp"
namespace Ledge {
void enable_transition_term(u64 module_accessor, int transition_id) {
if (ESCAPE_STATE == ESCAPE_LEDGE && is_training_mode() && is_operation_cpu(module_accessor)) {
if (StatusModule::status_kind(module_accessor) == FIGHTER_STATUS_KIND_CLIFF_WAIT) {
if (transition_id == FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_CLIFF_CLIMB) {
void force_option(u64 module_accessor) {
if (StatusModule::status_kind(module_accessor) == FIGHTER_STATUS_KIND_CLIFF_WAIT) {
if (WorkModule::is_enable_transition_term(module_accessor, FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_CLIFF_CLIMB)) {
int random_getup = app::sv_math::rand(
hash40("fighter"),
WorkModule::get_int(module_accessor, FIGHTER_STATUS_CLIFF_WORK_FLOAT_HIT_NORMAL_FRAME));
if (random_getup == 0) {
int status = 0;
int ledge_case = LEDGE_STATE;
@ -28,29 +34,34 @@ void enable_transition_term(u64 module_accessor, int transition_id) {
}
}
void defensive_option(u64 module_accessor, int category, int& flag) {
int status = StatusModule::status_kind(module_accessor);
if (status == FIGHTER_STATUS_KIND_CLIFF_JUMP3 ||
status == FIGHTER_STATUS_KIND_CLIFF_JUMP2 ||
status == FIGHTER_STATUS_KIND_CLIFF_JUMP1) {
flag |= FIGHTER_PAD_CMD_CAT1_FLAG_AIR_ESCAPE;
}
int prev_status = StatusModule::prev_status_kind(module_accessor, 0);
if (prev_status == FIGHTER_STATUS_KIND_CLIFF_CLIMB ||
prev_status == FIGHTER_STATUS_KIND_CLIFF_ATTACK ||
prev_status == FIGHTER_STATUS_KIND_CLIFF_ESCAPE) {
const int NUM_GROUND_STATUSES = 3;
int random_statuses[NUM_GROUND_STATUSES] = {
FIGHTER_STATUS_KIND_ESCAPE,
FIGHTER_STATUS_KIND_ATTACK,
FIGHTER_STATUS_KIND_GUARD_ON
};
int random_status_index = app::sv_math::rand(hash40("fighter"), NUM_GROUND_STATUSES);
StatusModule::change_status_request_from_script(module_accessor, random_statuses[random_status_index], 1);
}
}
void get_command_flag_cat(u64 module_accessor, int category, int& flag) {
if (ESCAPE_STATE == ESCAPE_LEDGE) {
int status = StatusModule::status_kind(module_accessor);
if (status == FIGHTER_STATUS_KIND_CLIFF_JUMP3 ||
status == FIGHTER_STATUS_KIND_CLIFF_JUMP2 ||
status == FIGHTER_STATUS_KIND_CLIFF_JUMP1) {
flag |= FIGHTER_PAD_CMD_CAT1_FLAG_AIR_ESCAPE;
}
int prev_status = StatusModule::prev_status_kind(module_accessor, 0);
if (prev_status == FIGHTER_STATUS_KIND_CLIFF_CLIMB ||
prev_status == FIGHTER_STATUS_KIND_CLIFF_ATTACK ||
prev_status == FIGHTER_STATUS_KIND_CLIFF_ESCAPE) {
const int NUM_GROUND_STATUSES = 3;
int random_statuses[NUM_GROUND_STATUSES] = {
FIGHTER_STATUS_KIND_ESCAPE,
FIGHTER_STATUS_KIND_ATTACK,
FIGHTER_STATUS_KIND_GUARD_ON
};
int random_status_index = app::sv_math::rand(hash40("fighter"), NUM_GROUND_STATUSES);
StatusModule::change_status_request_from_script(module_accessor, random_statuses[random_status_index], 1);
}
if (ESCAPE_STATE == ESCAPE_LEDGE && is_training_mode() && is_operation_cpu(module_accessor)) {
force_option(module_accessor);
defensive_option(module_accessor, category, flag);
}
}
}

View file

@ -1,9 +1,6 @@
#ifndef TRAINING_MODS_H
#define TRAINING_MODS_H
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include <stdarg.h>
#include "useful/const_value_table.h"
#include "useful/crc32.h"
@ -51,14 +48,6 @@ float get_param_float_replace(u64 module_accessor, u64 param_type, u64 param_has
float (*get_param_float)(u64, u64, u64) = (float (*)(u64, u64, u64)) load_module_impl(work_module, 0x240);
return get_param_float(work_module, param_type, param_hash);
}
void enable_transition_term_replace(u64 module_accessor, int transition_id) {
Ledge::enable_transition_term(module_accessor, transition_id);
u64 work_module = load_module(module_accessor, 0x50);
void (*enable_transition_term)(u64, int) = (void (*) (u64, int)) load_module_impl(work_module, 0x188);
enable_transition_term(work_module, transition_id);
}
} // namespace WorkModule
namespace ControlModule {
@ -156,11 +145,6 @@ void training_mods_main() {
"_ZN3app8lua_bind32WorkModule__get_param_float_implEPNS_26BattleObjectModuleAccessorEmm",
(u64)&WorkModule::get_param_float_replace);
// Ledge options
SaltySD_function_replace_sym(
"_ZN3app8lua_bind39WorkModule__enable_transition_term_implEPNS_26BattleObjectModuleAccessorEi",
(u64)&WorkModule::enable_transition_term_replace);
// Mash attack
SaltySD_function_replace_sym(
"_ZN3app8lua_bind39ControlModule__get_attack_air_kind_implEPNS_26BattleObjectModuleAccessorE",