mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2025-03-16 11:26:11 +00:00
Add Attack Angle (#174)
* Add Attack Angle Added toggle for chosing angled attacks * Add Help Text * Actually Apply Help Text
This commit is contained in:
parent
2e5097bcd0
commit
950407553f
7 changed files with 98 additions and 27 deletions
|
@ -33,7 +33,7 @@ const std::vector<std::string> input_delay_items{"0", "1", "2", "3", "4", "5", "
|
|||
const std::string input_delay_help = R""""(
|
||||
In frames.
|
||||
|
||||
Emulate input delay
|
||||
Emulate input delay
|
||||
to practice in a online
|
||||
environment.)"""";
|
||||
|
||||
|
@ -339,4 +339,11 @@ Frames to delay CPU Aerial.)"""";
|
|||
const std::string full_hop_help = R""""(
|
||||
CPUs will full hop
|
||||
rather than short hop
|
||||
aerials.)"""";
|
||||
aerials.)"""";
|
||||
|
||||
#define ENUM_CLASS_AttackAngleFlag(type,x) \
|
||||
x(type,Neutral,"Neutral") x(type,Up,"Up") x(type,Down,"Down")
|
||||
DEFINE_ENUM_CLASS(AttackAngleFlag);
|
||||
|
||||
const std::string attack_angle_help = R""""(
|
||||
Set angleable tilt and smash attacks.)"""";
|
||||
|
|
|
@ -10,29 +10,30 @@
|
|||
|
||||
static struct TrainingModpackMenu
|
||||
{
|
||||
OnOffFlags HITBOX_VIS = OnOffFlag::On;
|
||||
OnOffFlags STAGE_HAZARDS = OnOffFlags::None;
|
||||
Directions DI_STATE = Directions::None;
|
||||
Directions SDI_STATE = Directions::None;
|
||||
Directions AIR_DODGE_DIR = Directions::None;
|
||||
ActionFlags MASH_STATE = ActionFlags::None;
|
||||
ActionFlags FOLLOW_UP = ActionFlags::None;
|
||||
LedgeFlags LEDGE_STATE = LedgeFlags::All;
|
||||
DelayFlags LEDGE_DELAY = DelayFlags::All;
|
||||
TechFlags TECH_STATE = TechFlags::All;
|
||||
MissTechFlags MISS_TECH_STATE = MissTechFlags::All;
|
||||
int SHIELD_STATE = NONE;
|
||||
DefensiveFlags DEFENSIVE_STATE = DefensiveFlags::All;
|
||||
DelayFlags OOS_OFFSET = DelayFlags::None;
|
||||
DelayFlags REACTION_TIME = DelayFlags::None;
|
||||
Directions SHIELD_TILT = Directions::None;
|
||||
OnOffFlags MASH_IN_NEUTRAL = OnOffFlags::None;
|
||||
BoolFlags FAST_FALL = BoolFlags::None;
|
||||
DelayFlags FAST_FALL_DELAY = DelayFlags::None;
|
||||
BoolFlags FALLING_AERIALS = BoolFlags::None;
|
||||
DelayFlags AERIAL_DELAY = DelayFlags::None;
|
||||
BoolFlags FULL_HOP = BoolFlags::None;
|
||||
int INPUT_DELAY = 0;
|
||||
OnOffFlags HITBOX_VIS = OnOffFlag::On;
|
||||
OnOffFlags STAGE_HAZARDS = OnOffFlags::None;
|
||||
Directions DI_STATE = Directions::None;
|
||||
Directions SDI_STATE = Directions::None;
|
||||
Directions AIR_DODGE_DIR = Directions::None;
|
||||
ActionFlags MASH_STATE = ActionFlags::None;
|
||||
ActionFlags FOLLOW_UP = ActionFlags::None;
|
||||
AttackAngleFlags ATTACK_ANGLE = AttackAngleFlags::None;
|
||||
LedgeFlags LEDGE_STATE = LedgeFlags::All;
|
||||
DelayFlags LEDGE_DELAY = DelayFlags::All;
|
||||
TechFlags TECH_STATE = TechFlags::All;
|
||||
MissTechFlags MISS_TECH_STATE = MissTechFlags::All;
|
||||
int SHIELD_STATE = NONE;
|
||||
DefensiveFlags DEFENSIVE_STATE = DefensiveFlags::All;
|
||||
DelayFlags OOS_OFFSET = DelayFlags::None;
|
||||
DelayFlags REACTION_TIME = DelayFlags::None;
|
||||
Directions SHIELD_TILT = Directions::None;
|
||||
OnOffFlags MASH_IN_NEUTRAL = OnOffFlags::None;
|
||||
BoolFlags FAST_FALL = BoolFlags::None;
|
||||
DelayFlags FAST_FALL_DELAY = DelayFlags::None;
|
||||
BoolFlags FALLING_AERIALS = BoolFlags::None;
|
||||
DelayFlags AERIAL_DELAY = DelayFlags::None;
|
||||
BoolFlags FULL_HOP = BoolFlags::None;
|
||||
int INPUT_DELAY = 0;
|
||||
} menu;
|
||||
|
||||
static struct TrainingModpackMenu defaultMenu = menu;
|
||||
|
@ -329,6 +330,7 @@ tsl::elm::Element* GuiMain::createUI()
|
|||
list->addItem(createBitFlagOption(&menu.FOLLOW_UP, "Followup Toggles", follow_up_help, this));
|
||||
list->addItem(new BitFlagToggleListItem<OnOffFlags::Type>(
|
||||
"Mash In Neutral", OnOffFlag::On, &menu.MASH_IN_NEUTRAL, "Mash In Neutral", mash_neutral_help));
|
||||
list->addItem(createBitFlagOption(&menu.ATTACK_ANGLE, "Attack Angle", attack_angle_help, this));
|
||||
|
||||
list->addItem(new tsl::elm::CategoryHeader("Left Stick", true));
|
||||
|
||||
|
|
|
@ -236,6 +236,20 @@ impl Action {
|
|||
get_random_impl! {Action}
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
pub struct AttackAngle : u32 {
|
||||
const NEUTRAL = 0x1;
|
||||
const UP = 0x2;
|
||||
const DOWN = 0x4;
|
||||
}
|
||||
}
|
||||
|
||||
impl AttackAngle {
|
||||
to_vec_impl! {AttackAngle}
|
||||
get_random_impl! {AttackAngle}
|
||||
}
|
||||
|
||||
|
||||
bitflags! {
|
||||
pub struct Delay : u32 {
|
||||
const D0 = 0x1;
|
||||
|
@ -306,6 +320,7 @@ pub struct TrainingModpackMenu {
|
|||
pub air_dodge_dir: Direction,
|
||||
pub mash_state: Action,
|
||||
pub follow_up: Action,
|
||||
pub attack_angle: AttackAngle,
|
||||
pub ledge_state: LedgeOption,
|
||||
pub ledge_delay: Delay,
|
||||
pub tech_state: TechFlags,
|
||||
|
|
|
@ -13,6 +13,7 @@ pub static mut MENU_STRUCT: consts::TrainingModpackMenu = consts::TrainingModpac
|
|||
air_dodge_dir: Direction::empty(),
|
||||
mash_state: Action::empty(),
|
||||
follow_up: Action::empty(),
|
||||
attack_angle: AttackAngle::empty(),
|
||||
ledge_state: LedgeOption::all(),
|
||||
ledge_delay: Delay::empty(),
|
||||
tech_state: TechFlags::all(),
|
||||
|
|
25
src/training/attack_angle.rs
Normal file
25
src/training/attack_angle.rs
Normal file
|
@ -0,0 +1,25 @@
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use smash::app::{self};
|
||||
|
||||
static mut DIRECTION: AttackAngle = AttackAngle::UP;
|
||||
|
||||
pub fn roll_direction() {
|
||||
unsafe {
|
||||
DIRECTION = MENU.attack_angle.get_random();
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe fn mod_get_stick_dir(
|
||||
module_accessor: &mut app::BattleObjectModuleAccessor,
|
||||
) -> Option<f32> {
|
||||
if !is_operation_cpu(module_accessor) {
|
||||
return None;
|
||||
}
|
||||
|
||||
match DIRECTION {
|
||||
AttackAngle::UP => Some(1.0),
|
||||
AttackAngle::DOWN =>Some(-1.0),
|
||||
_ => None,
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::training::attack_angle;
|
||||
use crate::training::character_specific;
|
||||
use crate::training::fast_fall;
|
||||
use crate::training::frame_counter;
|
||||
|
@ -27,6 +28,8 @@ pub fn buffer_action(action: Action) {
|
|||
return;
|
||||
}
|
||||
|
||||
attack_angle::roll_direction();
|
||||
|
||||
roll_aerial_delay(action);
|
||||
|
||||
unsafe {
|
||||
|
|
|
@ -13,6 +13,7 @@ pub mod shield;
|
|||
pub mod tech;
|
||||
|
||||
mod air_dodge_direction;
|
||||
mod attack_angle;
|
||||
mod character_specific;
|
||||
mod fast_fall;
|
||||
mod frame_counter;
|
||||
|
@ -157,6 +158,21 @@ pub unsafe fn get_stick_x(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
air_dodge_direction::mod_get_stick_x(module_accessor).unwrap_or(ori)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when:
|
||||
* angled ftilt/fsmash
|
||||
*/
|
||||
#[skyline::hook(replace = ControlModule::get_stick_dir)]
|
||||
pub unsafe fn get_stick_dir(module_accessor: &mut app::BattleObjectModuleAccessor) -> f32 {
|
||||
let ori = original!()(module_accessor);
|
||||
if !is_training_mode() {
|
||||
return ori;
|
||||
}
|
||||
|
||||
attack_angle::mod_get_stick_dir(module_accessor).unwrap_or(ori)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -283,7 +299,7 @@ macro_rules! create_nn_hid_hooks {
|
|||
original!()(state, controller_id);
|
||||
if is_training_mode() {
|
||||
input_delay::handle_get_npad_state(state, controller_id);
|
||||
/* TODO:
|
||||
/* TODO:
|
||||
1) make number of frames configurable
|
||||
2) make possible without a second controller plugged in
|
||||
**/
|
||||
|
@ -310,7 +326,7 @@ pub fn training_mods() {
|
|||
handle_get_npad_handheld_state,
|
||||
handle_get_npad_full_key_state,
|
||||
handle_get_npad_gc_state,
|
||||
handle_get_joy_dual_state,
|
||||
handle_get_joy_dual_state,
|
||||
handle_get_joy_left_state,
|
||||
handle_get_joy_right_state);
|
||||
|
||||
|
@ -344,6 +360,8 @@ pub fn training_mods() {
|
|||
handle_set_dead_rumble,
|
||||
// Mash attack
|
||||
handle_get_attack_air_kind,
|
||||
// Attack angle
|
||||
get_stick_dir,
|
||||
// Tech options
|
||||
handle_change_motion,
|
||||
// Directional AirDodge,
|
||||
|
|
Loading…
Add table
Reference in a new issue