1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-20 08:54:15 +00:00

change DI toggles to set DI with stick position; left vs right dpad

This commit is contained in:
jugeeya 2019-06-24 15:49:35 -07:00
parent 8e51de5cca
commit c7713ab187
3 changed files with 30 additions and 21 deletions

View file

@ -100,12 +100,20 @@ u64 appeal_s_replace(L2CAgent* l2c_agent, void* variadic) {
print_string(acmd.module_accessor,
ATTACK_strings[ATTACK_STATE]);
} else {
DI_STATE = (DI_STATE + 1) % NUM_DI_STATES;
if (ControlModule::check_button_on(acmd.module_accessor, CONTROL_PAD_BUTTON_APPEAL_S_L)) {
DI_STATE = DI_STATE == NONE ? DI_RANDOM_IN_AWAY : NONE;
} else {
DI_STATE = DI_STATE == NONE ? SET_DI : NONE;
}
const char* DI_strings[NUM_DI_STATES] = {
"NONE", "AWAY", "DOWN AWAY", "DOWN", "DOWN IN",
"IN", "UP IN", "UP", "UP AWAY", "RANDOM\nIN AWAY"};
"NONE", "SET_DI", "RANDOM\nIN AWAY"};
print_string(acmd.module_accessor, DI_strings[DI_STATE]);
if (DI_STATE == SET_DI) {
DI_stick_x = ControlModule::get_stick_x(acmd.module_accessor);
DI_stick_y = ControlModule::get_stick_y(acmd.module_accessor);
}
}
}
}

View file

@ -6,15 +6,15 @@
/* Up Taunt */
bool HITBOX_VIS = 1;
/* Side Taunt
0, 0.785398, 1.570796, 2.356194, -3.14159, -2.356194, -1.570796, -0.785398
0, pi/4, pi/2, 3pi/4, pi, 5pi/4, 3pi/2, 7pi/4
*/
/* Side Taunt */
/* DI */
float DI_stick_x = 0;
float DI_stick_y = 0;
int DI_STATE = NONE;
#define DI_RANDOM_IN_AWAY 9
#define NUM_DI_STATES 10
#define SET_DI 1
#define DI_RANDOM_IN_AWAY 2
#define NUM_DI_STATES 3
/* Attack Option */
#define MASH_NAIR 0

View file

@ -59,20 +59,21 @@ float get_float_replace(u64 module_accessor, int var) {
if (is_training_mode() && is_operation_cpu(module_accessor) &&
is_in_hitstun(module_accessor)) {
if (DI_STATE != NONE) {
float angle = (DI_STATE - 1) * M_PI / 4.0;
// Either 0 (right) or PI (left)
if (DI_STATE == DI_RANDOM_IN_AWAY) {
angle = app::sv_math::rand(hash40("fighter"), 2) * M_PI;
float stick_x = 0.0, stick_y = 0.0;
if (DI_STATE == SET_DI) {
stick_x = DI_stick_x;
stick_y = DI_stick_y;
} else if (DI_STATE == DI_RANDOM_IN_AWAY) {
// either 1.0 or -1.0
stick_x = (float) (app::sv_math::rand(hash40("fighter"), 2) * 2.0) - 1;
stick_y = 0.0;
}
// If facing left, reverse angle
if (PostureModule::lr(module_accessor) != -1.0) angle -= M_PI;
if (var == FIGHTER_STATUS_DAMAGE_WORK_FLOAT_VECOR_CORRECT_STICK_X)
return cos(angle);
if (var == FIGHTER_STATUS_DAMAGE_WORK_FLOAT_VECOR_CORRECT_STICK_Y)
return sin(angle);
// If facing left, reverse stick x
if (var == FIGHTER_STATUS_DAMAGE_WORK_FLOAT_VECOR_CORRECT_STICK_X)
return stick_x * PostureModule::lr(module_accessor);
if (var == FIGHTER_STATUS_DAMAGE_WORK_FLOAT_VECOR_CORRECT_STICK_Y)
return stick_y;
}
}
}