mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2025-03-14 02:16:10 +00:00
update to latest framework, add tech options
This commit is contained in:
parent
d76e05b2f7
commit
6a906d1a47
10 changed files with 142 additions and 66 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 56727022bc471c02595554c129b90390d905906a
|
||||
Subproject commit 7b435a8147524d6a87fc2018126b30f798a6969a
|
BIN
romfs/msg_melee+us_en.xmsbt
Normal file
BIN
romfs/msg_melee+us_en.xmsbt
Normal file
Binary file not shown.
|
@ -138,7 +138,8 @@ void generate_hitbox_effects(L2CAgent *l2c_agent, L2CValue *bone,
|
|||
L2CValue y_curr(y->raw_float + y_dist * t);
|
||||
L2CValue z_curr(z->raw_float + z_dist * t);
|
||||
|
||||
ACMD acmd(l2c_agent);
|
||||
ACMD acmd("", "", "", "", [] (ACMD*) -> void {});
|
||||
acmd.l2c_agent = l2c_agent;
|
||||
acmd.wrap(EFFECT_FOLLOW_NO_SCALE,
|
||||
{shieldEffect, *bone, x_curr, y_curr, z_curr, x_rot, y_rot,
|
||||
z_rot, effect_size, terminate});
|
||||
|
@ -181,7 +182,7 @@ void ATTACK_replace(u64 a1) {
|
|||
for (size_t i = 0; i < 36; i++)
|
||||
l2c_agent.get_lua_stack(i + 1, &hitbox_params[i]);
|
||||
|
||||
l2c_agent.clear_lua_stack();
|
||||
l2c_agent._clear_lua_stack();
|
||||
|
||||
for (size_t i = 0; i < 36; i++) {
|
||||
if (i == 20) {
|
||||
|
|
|
@ -33,22 +33,22 @@ int ATTACK_STATE = MASH_NAIR;
|
|||
#define NUM_ATTACK_STATES 9
|
||||
|
||||
// Ledge Option
|
||||
#define RANDOM_LEDGE 0
|
||||
#define NEUTRAL_LEDGE 1
|
||||
#define ROLL_LEDGE 2
|
||||
#define JUMP_LEDGE 3
|
||||
#define ATTACK_LEDGE 4
|
||||
#define RANDOM_LEDGE 1
|
||||
#define NEUTRAL_LEDGE 2
|
||||
#define ROLL_LEDGE 3
|
||||
#define JUMP_LEDGE 4
|
||||
#define ATTACK_LEDGE 5
|
||||
|
||||
int LEDGE_STATE = RANDOM_LEDGE;
|
||||
#define NUM_LEDGE_STATES 5
|
||||
#define NUM_LEDGE_STATES 6
|
||||
|
||||
// Tech Option
|
||||
#define RANDOM_TECH 0
|
||||
#define TECH_IN_PLACE 1
|
||||
#define TECH_ROLL 2
|
||||
#define RANDOM_TECH 1
|
||||
#define TECH_IN_PLACE 2
|
||||
#define TECH_ROLL 3
|
||||
|
||||
int TECH_STATE = RANDOM_TECH;
|
||||
#define NUM_TECH_STATES 3
|
||||
#define NUM_TECH_STATES 4
|
||||
|
||||
// Down Taunt
|
||||
#define MASH_TOGGLES 0
|
||||
|
|
|
@ -44,6 +44,17 @@ int get_command_flag_cat(u64 module_accessor, int category, int flag, bool& repl
|
|||
else
|
||||
; // Reset color overlay
|
||||
|
||||
if (INPUT_RECORD_STATE == INPUT_PLAYBACK) {
|
||||
if (curr_frame == 0 && StatusModule::status_kind(module_accessor) != FIGHTER_STATUS_KIND_WAIT) {
|
||||
replace = false;
|
||||
return 0;
|
||||
} else {
|
||||
if (category == FIGHTER_PAD_COMMAND_CATEGORY1) {
|
||||
curr_frame = (curr_frame + 1) % NUM_FRAME_INPUTS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
replace = true;
|
||||
int frame = curr_frame > 0 ? curr_frame - 1 : NUM_FRAME_INPUTS - 1;
|
||||
if (category == 0)
|
||||
|
@ -55,7 +66,7 @@ int get_command_flag_cat(u64 module_accessor, int category, int flag, bool& repl
|
|||
else if (category == 3)
|
||||
return frame_inputs[frame].cat4_flag;
|
||||
}
|
||||
} else {
|
||||
} else { // IS PLAYER
|
||||
if (INPUT_RECORD_STATE == NONE) {
|
||||
if (ControlModule::check_button_on(module_accessor, CONTROL_PAD_BUTTON_CATCH) &&
|
||||
ControlModule::check_button_trigger(module_accessor, CONTROL_PAD_BUTTON_APPEAL_S_L)) {
|
||||
|
@ -92,10 +103,6 @@ int get_command_flag_cat(u64 module_accessor, int category, int flag, bool& repl
|
|||
}
|
||||
}
|
||||
} else if (INPUT_RECORD_STATE == INPUT_PLAYBACK) {
|
||||
if (category == FIGHTER_PAD_COMMAND_CATEGORY1) {
|
||||
curr_frame = (curr_frame + 1) % NUM_FRAME_INPUTS;
|
||||
}
|
||||
|
||||
if (ControlModule::check_button_on(module_accessor, CONTROL_PAD_BUTTON_CATCH) &&
|
||||
ControlModule::check_button_trigger(module_accessor, CONTROL_PAD_BUTTON_APPEAL_S_R)) {
|
||||
print_string(module_accessor, "STOP");
|
||||
|
|
|
@ -13,7 +13,7 @@ void force_option(u64 module_accessor) {
|
|||
|
||||
if (frame == random_frame || frame > 30.0) {
|
||||
int status = 0;
|
||||
int ledge_case = LEDGE_STATE;
|
||||
int ledge_case = LEDGE_STATE - 1;
|
||||
|
||||
if (LEDGE_STATE == RANDOM_LEDGE)
|
||||
ledge_case = app::sv_math::rand(hash40("fighter"), 4) + 1;
|
||||
|
@ -60,7 +60,7 @@ void defensive_option(u64 module_accessor, int category, int& flag) {
|
|||
}
|
||||
|
||||
void get_command_flag_cat(u64 module_accessor, int category, int& flag) {
|
||||
if (ESCAPE_STATE == ESCAPE_LEDGE && is_training_mode() && is_operation_cpu(module_accessor)) {
|
||||
if (LEDGE_STATE != NONE && is_training_mode() && is_operation_cpu(module_accessor)) {
|
||||
force_option(module_accessor);
|
||||
defensive_option(module_accessor, category, flag);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ float save_state_lr_cpu = 1.0;
|
|||
int save_state_situation_kind_cpu = 0;
|
||||
|
||||
void save_states(u64 module_accessor) {
|
||||
int status = StatusModule::status_kind(module_accessor);
|
||||
if (is_training_mode()) {
|
||||
float* save_state_x;
|
||||
float* save_state_y;
|
||||
|
@ -71,8 +72,6 @@ void save_states(u64 module_accessor) {
|
|||
|
||||
// move to correct pos
|
||||
if (*save_state == POS_MOVE) {
|
||||
*save_state = DEFAULT;
|
||||
|
||||
Vector3f pos = {.x = *save_state_x, .y = *save_state_y, .z = 0};
|
||||
PostureModule::set_pos(module_accessor, &pos);
|
||||
PostureModule::set_lr(module_accessor, *save_state_lr);
|
||||
|
@ -80,16 +79,18 @@ void save_states(u64 module_accessor) {
|
|||
module_accessor,
|
||||
-1.0 * DamageModule::damage(module_accessor, 0), 0);
|
||||
DamageModule::add_damage(module_accessor, *save_state_percent, 0);
|
||||
|
||||
StatusModule::set_situation_kind(module_accessor, *save_state_situation_kind, 0);
|
||||
|
||||
// Doesn't work, and I don't know why yet.
|
||||
/*if (*save_state_situation_kind == SITUATION_KIND_GROUND)
|
||||
if (*save_state_situation_kind == SITUATION_KIND_GROUND && status != FIGHTER_STATUS_KIND_WAIT)
|
||||
StatusModule::change_status_request(module_accessor, FIGHTER_STATUS_KIND_WAIT, 0);
|
||||
else if (*save_state_situation_kind == SITUATION_KIND_AIR)
|
||||
else if (*save_state_situation_kind == SITUATION_KIND_AIR && status != FIGHTER_STATUS_KIND_FALL)
|
||||
StatusModule::change_status_request(module_accessor, FIGHTER_STATUS_KIND_FALL, 0);
|
||||
else if (*save_state_situation_kind == SITUATION_KIND_CLIFF)
|
||||
else if (*save_state_situation_kind == SITUATION_KIND_CLIFF && status != FIGHTER_STATUS_KIND_CLIFF_CATCH)
|
||||
StatusModule::change_status_request(module_accessor, FIGHTER_STATUS_KIND_CLIFF_CATCH, 0);
|
||||
*/
|
||||
|
||||
*save_state = DEFAULT;
|
||||
}
|
||||
|
||||
// Grab + Dpad down: Save state
|
||||
|
|
|
@ -5,30 +5,38 @@ extern int vsnprintf(char* s, size_t maxlen, const char* format, va_list arg) LI
|
|||
int vsnprintf_intercept(char* s, size_t maxlen, const char* format, va_list arg) {
|
||||
if (strcmp(format, "mel_training_help_shift0") == 0) {
|
||||
TOGGLE_STATE = MASH_TOGGLES;
|
||||
if (MASH_STATE == NONE)
|
||||
format = "mel_shortmsg_1";
|
||||
if (MASH_STATE == MASH_AIRDODGE)
|
||||
format = "mel_shortmsg_2";
|
||||
if (MASH_STATE == MASH_JUMP)
|
||||
format = "mel_shortmsg_3";
|
||||
if (MASH_STATE == MASH_RANDOM)
|
||||
format = "mel_shortmsg_4";
|
||||
if (MASH_STATE == MASH_ATTACK)
|
||||
format = "mel_shortmsg_5";
|
||||
switch (MASH_STATE) {
|
||||
case NONE:
|
||||
format = "mel_shortmsg_1"; break;
|
||||
case MASH_AIRDODGE:
|
||||
format = "mel_shortmsg_2"; break;
|
||||
case MASH_JUMP:
|
||||
format = "mel_shortmsg_3"; break;
|
||||
case MASH_RANDOM:
|
||||
format = "mel_shortmsg_4"; break;
|
||||
case MASH_ATTACK:
|
||||
format = "mel_shortmsg_5"; break;
|
||||
}
|
||||
} else if (strcmp(format, "mel_training_help_shift1") == 0) {
|
||||
TOGGLE_STATE = ESCAPE_TOGGLES;
|
||||
if (ESCAPE_STATE == NONE)
|
||||
format = "mel_shortmsg_6";
|
||||
if (ESCAPE_STATE == ESCAPE_LEDGE)
|
||||
format = "mel_shortmsg_7";
|
||||
switch (ESCAPE_STATE) {
|
||||
case NONE:
|
||||
format = "mel_shortmsg_6"; break;
|
||||
case ESCAPE_LEDGE:
|
||||
format = "mel_shortmsg_7"; break;
|
||||
case ESCAPE_TECH:
|
||||
format = "mel_shortmsg_8"; break;
|
||||
}
|
||||
} else if (strcmp(format, "mel_training_help_shift2") == 0) {
|
||||
TOGGLE_STATE = SHIELD_TOGGLES;
|
||||
if (SHIELD_STATE == NONE)
|
||||
format = "mel_shortmsg_8";
|
||||
if (SHIELD_STATE == SHIELD_INFINITE)
|
||||
format = "mel_shortmsg_9";
|
||||
if (SHIELD_STATE == SHIELD_HOLD)
|
||||
format = "mel_shortmsg_10";
|
||||
switch (SHIELD_STATE) {
|
||||
case NONE:
|
||||
format = "mel_shortmsg_9"; break;
|
||||
case SHIELD_INFINITE:
|
||||
format = "mel_shortmsg_10"; break;
|
||||
case SHIELD_HOLD:
|
||||
format = "mel_shortmsg_11"; break;
|
||||
}
|
||||
}
|
||||
|
||||
// For Shulk
|
||||
|
@ -87,9 +95,16 @@ if (motion_kind == hash40("appeal_lw_l") || motion_kind == hash40("appeal_lw_r")
|
|||
ESCAPE_STATE == ESCAPE_LEDGE) {
|
||||
LEDGE_STATE = (LEDGE_STATE + 1) % NUM_LEDGE_STATES;
|
||||
const char* LEDGE_strings[NUM_LEDGE_STATES] =
|
||||
{"RANDOM", "NORMAL", "ROLL", "JUMP", "ATTACK"};
|
||||
{"NONE", "RANDOM", "NORMAL", "ROLL", "JUMP", "ATTACK"};
|
||||
|
||||
print_string(module_accessor, LEDGE_strings[LEDGE_STATE]);
|
||||
} else if (TOGGLE_STATE == ESCAPE_TOGGLES &&
|
||||
ESCAPE_STATE == ESCAPE_TECH) {
|
||||
TECH_STATE = (TECH_STATE + 1) % NUM_TECH_STATES;
|
||||
const char* TECH_strings[NUM_TECH_STATES] =
|
||||
{"NONE", "RANDOM", "IN PLACE", "ROLL"};
|
||||
|
||||
print_string(module_accessor, TECH_strings[TECH_STATE]);
|
||||
} else if (MASH_STATE == MASH_ATTACK) {
|
||||
ATTACK_STATE = (ATTACK_STATE + 1) % NUM_ATTACK_STATES;
|
||||
const char* ATTACK_strings[NUM_ATTACK_STATES] =
|
||||
|
|
|
@ -2,22 +2,31 @@
|
|||
|
||||
namespace Tech {
|
||||
void init_settings(u64 module_accessor, int status_kind, bool& replace) {
|
||||
if (ESCAPE_STATE == ESCAPE_TECH && is_training_mode() && is_operation_cpu(module_accessor)) {
|
||||
if (is_training_mode() && is_operation_cpu(module_accessor)) {
|
||||
if (status_kind == FIGHTER_STATUS_KIND_DOWN) {
|
||||
const int NUM_TECH_STATUSES = 4;
|
||||
int random_statuses[NUM_TECH_STATUSES] = {
|
||||
FIGHTER_STATUS_KIND_DOWN,
|
||||
FIGHTER_STATUS_KIND_PASSIVE,
|
||||
FIGHTER_STATUS_KIND_PASSIVE_FB,
|
||||
FIGHTER_STATUS_KIND_PASSIVE_FB
|
||||
};
|
||||
if (TECH_STATE == RANDOM_TECH) {
|
||||
const int NUM_TECH_STATUSES = 3;
|
||||
int random_statuses[NUM_TECH_STATUSES] = {
|
||||
FIGHTER_STATUS_KIND_DOWN,
|
||||
FIGHTER_STATUS_KIND_PASSIVE,
|
||||
FIGHTER_STATUS_KIND_PASSIVE_FB
|
||||
};
|
||||
|
||||
int random_status_index = app::sv_math::rand(hash40("fighter"), NUM_TECH_STATUSES);
|
||||
if (random_statuses[random_status_index] != FIGHTER_STATUS_KIND_DOWN) {
|
||||
StatusModule::change_status_request_from_script(module_accessor, random_statuses[random_status_index], 1);
|
||||
int random_status_index = app::sv_math::rand(hash40("fighter"), NUM_TECH_STATUSES);
|
||||
if (random_statuses[random_status_index] != FIGHTER_STATUS_KIND_DOWN) {
|
||||
StatusModule::change_status_request_from_script(module_accessor, random_statuses[random_status_index], 1);
|
||||
replace = true;
|
||||
return;
|
||||
}
|
||||
} else if (TECH_STATE == TECH_IN_PLACE) {
|
||||
StatusModule::change_status_request_from_script(module_accessor, FIGHTER_STATUS_KIND_PASSIVE, 1);
|
||||
replace = true;
|
||||
return;
|
||||
}
|
||||
} else if (TECH_STATE == TECH_ROLL) {
|
||||
StatusModule::change_status_request_from_script(module_accessor, FIGHTER_STATUS_KIND_PASSIVE_FB, 1);
|
||||
replace = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// else if (status_kind == FIGHTER_STATUS_KIND_PASSIVE) {
|
||||
|
@ -36,4 +45,40 @@ void init_settings(u64 module_accessor, int status_kind, bool& replace) {
|
|||
replace = false;
|
||||
return;
|
||||
}
|
||||
|
||||
void get_command_flag_cat(u64 module_accessor, int category, int& flag) {
|
||||
if (TECH_STATE != NONE && is_training_mode() && is_operation_cpu(module_accessor)) {
|
||||
int prev_status = StatusModule::prev_status_kind(module_accessor, 0);
|
||||
int status = StatusModule::status_kind(module_accessor);
|
||||
if ((prev_status == FIGHTER_STATUS_KIND_PASSIVE ||
|
||||
prev_status == FIGHTER_STATUS_KIND_PASSIVE_FB ||
|
||||
status == FIGHTER_STATUS_KIND_DOWN_STAND ||
|
||||
status == FIGHTER_STATUS_KIND_DOWN_STAND_FB ||
|
||||
status == FIGHTER_STATUS_KIND_DOWN_STAND_ATTACK) &&
|
||||
WorkModule::is_enable_transition_term(module_accessor, FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_GUARD_ON)) {
|
||||
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 (WorkModule::is_enable_transition_term(module_accessor, FIGHTER_STATUS_TRANSITION_TERM_ID_DOWN_STAND) &&
|
||||
status != FIGHTER_STATUS_KIND_DOWN_DAMAGE) {
|
||||
const int NUM_GETUP_STATUSES = 3;
|
||||
int random_statuses[NUM_GETUP_STATUSES] = {
|
||||
FIGHTER_STATUS_KIND_DOWN_STAND,
|
||||
FIGHTER_STATUS_KIND_DOWN_STAND_FB,
|
||||
FIGHTER_STATUS_KIND_DOWN_STAND_ATTACK
|
||||
};
|
||||
|
||||
int random_status_index = app::sv_math::rand(hash40("fighter"), NUM_GETUP_STATUSES);
|
||||
StatusModule::change_status_request_from_script(module_accessor, random_statuses[random_status_index], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,6 +28,8 @@ using namespace lib;
|
|||
using namespace app::lua_bind;
|
||||
using namespace app::sv_animcmd;
|
||||
|
||||
u64 prev_get_command_flag_cat = 0;
|
||||
|
||||
namespace app::lua_bind {
|
||||
namespace WorkModule {
|
||||
float get_float_replace(u64 module_accessor, int var) {
|
||||
|
@ -66,6 +68,9 @@ int get_attack_air_kind_replace(u64 module_accessor) {
|
|||
}
|
||||
|
||||
int get_command_flag_cat_replace(u64 module_accessor, int category) {
|
||||
int (*prev_replace)(u64, int) = (int (*)(u64, int)) prev_get_command_flag_cat;
|
||||
if (prev_replace)
|
||||
prev_replace(module_accessor, category);
|
||||
//save_states(module_accessor);
|
||||
|
||||
// Pause Effect AnimCMD if hitbox visualization is active
|
||||
|
@ -79,12 +84,13 @@ int get_command_flag_cat_replace(u64 module_accessor, int category) {
|
|||
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);
|
||||
|
||||
/*bool replace;
|
||||
bool replace;
|
||||
int ret = InputRecorder::get_command_flag_cat(module_accessor, category, flag, replace);
|
||||
if (replace) return ret;*/
|
||||
if (replace) return ret;
|
||||
|
||||
Mash::get_command_flag_cat(module_accessor, category, flag);
|
||||
Ledge::get_command_flag_cat(module_accessor, category, flag);
|
||||
Tech::get_command_flag_cat(module_accessor, category, flag);
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
@ -182,9 +188,10 @@ void training_mods_main() {
|
|||
(u64)&ControlModule::clear_command_replace);
|
||||
|
||||
// Mash airdodge/jump
|
||||
SaltySD_function_replace_sym(
|
||||
SaltySD_function_replace_sym_check_prev(
|
||||
"_ZN3app8lua_bind40ControlModule__get_command_flag_cat_implEPNS_26BattleObjectModuleAccessorEi",
|
||||
(u64)&ControlModule::get_command_flag_cat_replace);
|
||||
(u64)&ControlModule::get_command_flag_cat_replace,
|
||||
prev_get_command_flag_cat);
|
||||
|
||||
// Set DI
|
||||
SaltySD_function_replace_sym(
|
||||
|
@ -216,9 +223,9 @@ void training_mods_main() {
|
|||
(u64)&ControlModule::get_stick_y_replace);
|
||||
|
||||
// Tech options
|
||||
// SaltySD_function_replace_sym(
|
||||
// "_ZN3app8lua_bind32StatusModule__init_settings_implEPNS_26BattleObjectModuleAccessorENS_13SituationKindEijNS_20GroundCliffCheckKindEbiiii",
|
||||
// (u64)&StatusModule::init_settings_replace);
|
||||
SaltySD_function_replace_sym(
|
||||
"_ZN3app8lua_bind32StatusModule__init_settings_implEPNS_26BattleObjectModuleAccessorENS_13SituationKindEijNS_20GroundCliffCheckKindEbiiii",
|
||||
(u64)&StatusModule::init_settings_replace);
|
||||
|
||||
Selection::menu_replace();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue