1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2025-06-15 16:00:36 +00:00

Fix unweighted multiselects (#713)

This commit is contained in:
asimon-1 2024-12-19 07:53:33 -05:00 committed by GitHub
parent a175e83edf
commit 470e32e695
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 88 additions and 15 deletions

View file

@ -218,84 +218,98 @@ pub unsafe fn create_app<'a>() -> App<'a> {
"mash_state",
"Action to be performed as soon as possible",
ToggleMultiple,
true,
));
mash_tab_submenus.push(Action::to_submenu(
"Followup Toggles",
"follow_up",
"Actions to be performed after a Mash Option",
ToggleMultiple,
true,
));
mash_tab_submenus.push(MashTrigger::to_submenu(
"Mash Triggers",
"mash_triggers",
"Configure what causes the CPU to perform a Mash Option",
ToggleSingle,
ToggleMultiple,
false,
));
mash_tab_submenus.push(AttackAngle::to_submenu(
"Attack Angle",
"attack_angle",
"For attacks that can be angled, such as some forward tilts",
ToggleMultiple,
true,
));
mash_tab_submenus.push(ThrowOption::to_submenu(
"Throw Options",
"throw_state",
"Throw to be performed when a grab is landed",
ToggleMultiple,
true,
));
mash_tab_submenus.push(MedDelay::to_submenu(
"Throw Delay",
"throw_delay",
"How many frames to delay the throw option",
ToggleMultiple,
true,
));
mash_tab_submenus.push(MedDelay::to_submenu(
"Pummel Delay",
"pummel_delay",
"How many frames after a grab to wait before starting to pummel",
ToggleMultiple,
true,
));
mash_tab_submenus.push(BoolFlag::to_submenu(
"Falling Aerials",
"falling_aerials",
"Should aerials be performed when rising or when falling",
ToggleMultiple,
true,
));
mash_tab_submenus.push(BoolFlag::to_submenu(
"Full Hop",
"full_hop",
"Should the CPU perform a ful hop or a short hop when jumping",
"Should the CPU perform a full hop or a short hop when jumping",
ToggleMultiple,
true,
));
mash_tab_submenus.push(Delay::to_submenu(
"Aerial Delay",
"aerial_delay",
"How long to delay an aerial attack",
ToggleMultiple,
true,
));
mash_tab_submenus.push(BoolFlag::to_submenu(
"Fast Fall",
"fast_fall",
"Should the CPU fastfall during a jump",
ToggleMultiple,
true,
));
mash_tab_submenus.push(Delay::to_submenu(
"Fast Fall Delay",
"fast_fall_delay",
"How many frames the CPU should delay their fastfall",
ToggleMultiple,
true,
));
mash_tab_submenus.push(Delay::to_submenu(
"OoS Offset",
"oos_offset",
"How many times the CPU shield can be hit before performing a Mash option",
ToggleMultiple,
true,
));
mash_tab_submenus.push(Delay::to_submenu(
"Reaction Time",
"reaction_time",
"How many frames to delay before performing a Mash option",
"How many frames to delay before performing a Mash option out of shield",
ToggleMultiple,
true,
));
let mash_tab = Tab {
id: "mash",
@ -311,78 +325,91 @@ pub unsafe fn create_app<'a>() -> App<'a> {
"ledge_neutral_override",
"Mash Actions to be performed after a Neutral Getup from ledge",
ToggleMultiple,
true,
));
override_tab_submenus.push(Action::to_submenu(
"Ledge Roll",
"ledge_roll_override",
"Mash Actions to be performed after a Roll Getup from ledge",
ToggleMultiple,
true,
));
override_tab_submenus.push(Action::to_submenu(
"Ledge Jump",
"ledge_jump_override",
"Mash Actions to be performed after a Jump Get up from ledge",
ToggleMultiple,
true,
));
override_tab_submenus.push(Action::to_submenu(
"Ledge Attack",
"ledge_attack_override",
"Mash Actions to be performed after a Getup Attack from ledge",
ToggleMultiple,
true,
));
override_tab_submenus.push(Action::to_submenu(
"Tech Action",
"tech_action_override",
"Mash Actions to be performed after any tech action",
ToggleMultiple,
true,
));
override_tab_submenus.push(Action::to_submenu(
"Clatter",
"clatter_override",
"Mash Actions to be performed after leaving a clatter situation (grab, bury, etc)",
ToggleMultiple,
true,
));
override_tab_submenus.push(Action::to_submenu(
"Tumble",
"tumble_override",
"Mash Actions to be performed after exiting a tumble state",
ToggleMultiple,
true,
));
override_tab_submenus.push(Action::to_submenu(
"Hitstun",
"hitstun_override",
"Mash Actions to be performed after exiting a hitstun state",
ToggleMultiple,
true,
));
override_tab_submenus.push(Action::to_submenu(
"Parry",
"parry_override",
"Mash Actions to be performed after a parry",
ToggleMultiple,
true,
));
override_tab_submenus.push(Action::to_submenu(
"Shieldstun",
"shieldstun_override",
"Mash Actions to be performed after exiting a shieldstun state",
ToggleMultiple,
true,
));
override_tab_submenus.push(Action::to_submenu(
"Footstool",
"footstool_override",
"Mash Actions to be performed after exiting a footstool state",
ToggleMultiple,
true,
));
override_tab_submenus.push(Action::to_submenu(
"Landing",
"landing_override",
"Mash Actions to be performed after landing on the ground",
ToggleMultiple,
true,
));
override_tab_submenus.push(Action::to_submenu(
"Ledge Trump",
"trump_override",
"Mash Actions to be performed after leaving a ledgetrump state",
ToggleMultiple,
true,
));
let override_tab = Tab {
id: "override",
@ -402,75 +429,87 @@ pub unsafe fn create_app<'a>() -> App<'a> {
"air_dodge_dir",
"Direction to angle airdodges",
ToggleMultiple,
true,
));
defensive_tab_submenus.push(Direction::to_submenu(
"DI Direction",
"di_state",
"Direction to angle the directional influence during hitlag",
ToggleMultiple,
true,
));
defensive_tab_submenus.push(Direction::to_submenu(
"SDI Direction",
"sdi_state",
"Direction to angle the smash directional influence during hitlag",
ToggleMultiple,
true,
));
defensive_tab_submenus.push(SdiFrequency::to_submenu(
"SDI Strength",
"sdi_strength",
"Relative strength of the smash directional influence inputs",
ToggleMultiple,
ToggleSingle,
false,
));
defensive_tab_submenus.push(ClatterFrequency::to_submenu(
"Clatter Strength",
"clatter_strength",
"Configure how rapidly the CPU will mash out of grabs, buries, etc.",
ToggleMultiple,
ToggleSingle,
false,
));
defensive_tab_submenus.push(LedgeOption::to_submenu(
"Ledge Options",
"ledge_state",
"Actions to be taken when on the ledge",
ToggleMultiple,
true,
));
defensive_tab_submenus.push(LongDelay::to_submenu(
"Ledge Delay",
"ledge_delay",
"How many frames to delay the ledge option",
ToggleMultiple,
true,
));
defensive_tab_submenus.push(TechFlags::to_submenu(
"Tech Options",
"tech_state",
"Actions to take when slammed into a hard surface",
ToggleMultiple,
true,
));
defensive_tab_submenus.push(MissTechFlags::to_submenu(
"Mistech Options",
"miss_tech_state",
"Actions to take after missing a tech",
ToggleMultiple,
true,
));
defensive_tab_submenus.push(Shield::to_submenu(
"Shield Toggles",
"shield_state",
"CPU Shield Behavior",
ToggleSingle,
false,
));
defensive_tab_submenus.push(Direction::to_submenu(
"Shield Tilt",
"shield_tilt",
"Direction to tilt the shield",
ToggleSingle,
false,
));
defensive_tab_submenus.push(OnOff::to_submenu(
"Crouch",
"crouch",
"Have the CPU crouch when on the ground",
ToggleSingle,
false,
));
defensive_tab_submenus.push(OnOff::to_submenu("Dodge Staling", "stale_dodges", "Controls whether the CPU's dodges will worsen with repetitive use\n(Note: This can setting can cause combo behavior not possible in the original game)", ToggleSingle));
defensive_tab_submenus.push(OnOff::to_submenu("Hide Tech Animations", "tech_hide", "Hides tech animations and effects after 7 frames to help with reacting to tech animation startup", ToggleSingle));
defensive_tab_submenus.push(OnOff::to_submenu("Dodge Staling", "stale_dodges", "Controls whether the CPU's dodges will worsen with repetitive use\n(Note: This can setting can cause combo behavior not possible in the original game)", ToggleSingle, false));
defensive_tab_submenus.push(OnOff::to_submenu("Hide Tech Animations", "tech_hide", "Hides tech animations and effects after 7 frames to help with reacting to tech animation startup", ToggleSingle, false));
let defensive_tab = Tab {
id: "defensive",
title: "Defensive Settings",
@ -489,54 +528,63 @@ pub unsafe fn create_app<'a>() -> App<'a> {
"recording_slot",
"Choose which slot to record into",
ToggleSingle,
false,
));
input_recording_tab_submenus.push(RecordTrigger::to_submenu(
"Recording Trigger",
"record_trigger",
"Whether to begin recording via button combination or upon loading a Save State",
ToggleSingle,
false,
));
input_recording_tab_submenus.push(RecordingDuration::to_submenu(
"Recording Duration",
"recording_duration",
"How long an input recording should last in frames",
ToggleSingle,
false,
));
input_recording_tab_submenus.push(OnOff::to_submenu(
"Recording Crop",
"recording_crop",
"Remove neutral input frames at the end of your recording",
ToggleSingle,
false,
));
input_recording_tab_submenus.push(PlaybackSlot::to_submenu(
"Playback Button Slots",
"playback_button_slots",
"Choose which slots to playback input recording upon pressing button combination",
ToggleMultiple,
true,
));
input_recording_tab_submenus.push(HitstunPlayback::to_submenu(
"Playback Hitstun Timing",
"hitstun_playback",
"When to begin playing back inputs when a hitstun mash trigger occurs",
ToggleSingle,
false,
));
input_recording_tab_submenus.push(PlaybackSlot::to_submenu(
"Save State Playback",
"save_state_playback",
"Choose which slots to playback input recording upon loading a save state",
ToggleMultiple,
true,
));
input_recording_tab_submenus.push(OnOff::to_submenu(
"Playback Mash Interrupt",
"playback_mash",
"End input playback when a mash trigger occurs",
ToggleSingle,
false,
));
input_recording_tab_submenus.push(OnOff::to_submenu(
"Playback Loop",
"playback_loop",
"Repeat triggered input playbacks indefinitely",
ToggleSingle,
false,
));
let input_tab = Tab {
id: "input",
@ -551,30 +599,34 @@ pub unsafe fn create_app<'a>() -> App<'a> {
// Button Tab
let mut button_tab_submenus: Vec<SubMenu> = Vec::new();
button_tab_submenus.push(OnOff::to_submenu("Menu Open Start Press", "menu_open_start_press", "Hold start or press minus to open the mod menu. To open the original menu, press start.\nThe default menu open option is always available as Hold DPad Up + Press B.", ToggleSingle));
button_tab_submenus.push(OnOff::to_submenu("Menu Open Start Press", "menu_open_start_press", "Hold start or press minus to open the mod menu. To open the original menu, press start.\nThe default menu open option is always available as Hold DPad Up + Press B.", ToggleSingle, false));
button_tab_submenus.push(ButtonConfig::to_submenu(
"Save State Save",
"save_state_save",
"Hold any one button and press the others to trigger",
ToggleSingle,
ToggleMultiple,
false,
));
button_tab_submenus.push(ButtonConfig::to_submenu(
"Save State Load",
"save_state_load",
"Hold any one button and press the others to trigger",
ToggleSingle,
ToggleMultiple,
false,
));
button_tab_submenus.push(ButtonConfig::to_submenu(
"Input Record",
"input_record",
"Hold any one button and press the others to trigger",
ToggleSingle,
ToggleMultiple,
false,
));
button_tab_submenus.push(ButtonConfig::to_submenu(
"Input Playback",
"input_playback",
"Hold any one button and press the others to trigger",
ToggleSingle,
ToggleMultiple,
false,
));
let button_tab = Tab {
id: "button",
@ -594,66 +646,77 @@ pub unsafe fn create_app<'a>() -> App<'a> {
"save_state_mirroring",
"Flips save states in the left-right direction across the stage center",
ToggleSingle,
false,
));
save_state_tab_submenus.push(OnOff::to_submenu(
"Auto Save States",
"save_state_autoload",
"Load save state when any fighter dies",
ToggleSingle,
false,
));
save_state_tab_submenus.push(SaveDamage::to_submenu(
"Save Dmg (CPU)",
"save_damage_cpu",
"Should save states retain CPU damage",
ToggleSingle,
false,
));
save_state_tab_submenus.push(DamagePercent::to_submenu(
"Dmg Range (CPU)",
"save_damage_limits_cpu",
"Limits on Random Damage to apply to the CPU when loading a save state",
Slider,
false,
));
save_state_tab_submenus.push(SaveDamage::to_submenu(
"Save Dmg (Player)",
"save_damage_player",
"Should save states retain player damage",
ToggleSingle,
false,
));
save_state_tab_submenus.push(DamagePercent::to_submenu(
"Dmg Range (Player)",
"save_damage_limits_player",
"Limits on random damage to apply to the player when loading a save state",
Slider,
false,
));
save_state_tab_submenus.push(OnOff::to_submenu(
"Enable Save States",
"save_state_enable",
"Enable save states! Save a state with Shield+Down Taunt, load it with Shield+Up Taunt.",
ToggleSingle,
false,
));
save_state_tab_submenus.push(SaveStateSlot::to_submenu(
"Save State Slot",
"save_state_slot",
"Save and load states from different slots.",
ToggleSingle,
false,
));
save_state_tab_submenus.push(SaveStateSlot::to_submenu(
"Randomize Slots",
"randomize_slots",
"Slots to randomize when loading save state.",
ToggleMultiple,
true,
));
save_state_tab_submenus.push(CharacterItem::to_submenu(
"Character Item",
"character_item",
"The item to give to the player's fighter when loading a save state",
ToggleSingle,
false,
));
save_state_tab_submenus.push(BuffOption::to_submenu(
"Buff Options",
"buff_state",
"Buff(s) to be applied to the respective fighters when loading a save state",
ToggleSingle,
ToggleMultiple,
false,
));
let save_state_tab = Tab {
id: "save_state",
@ -668,54 +731,62 @@ pub unsafe fn create_app<'a>() -> App<'a> {
// Miscellaneous Tab
let mut misc_tab_submenus: Vec<SubMenu> = Vec::new();
misc_tab_submenus.push(OnOff::to_submenu("Frame Advantage", "frame_advantage", "Display the time difference between when the player is actionable and the CPU is actionable\nNote that the CPU must not be mashing any options.", ToggleSingle));
misc_tab_submenus.push(OnOff::to_submenu("Frame Advantage", "frame_advantage", "Display the time difference between when the player is actionable and the CPU is actionable\nNote that the CPU must not be mashing any options.", ToggleSingle, false));
misc_tab_submenus.push(OnOff::to_submenu(
"Hitbox Visualization",
"hitbox_vis",
"Display a visual representation for active hitboxes (hides other visual effects)",
ToggleSingle,
false,
));
misc_tab_submenus.push(InputDisplay::to_submenu(
"Input Display",
"input_display",
"Log inputs in a queue on the left of the screen",
ToggleSingle,
false,
));
misc_tab_submenus.push(OnOff::to_submenu(
"Input Display Status",
"input_display_status",
"Group input logs by status in which they occurred",
ToggleSingle,
false,
));
misc_tab_submenus.push(Delay::to_submenu(
"Input Delay",
"input_delay",
"Frames to delay player inputs by",
ToggleSingle,
false,
));
misc_tab_submenus.push(OnOff::to_submenu(
"Stage Hazards",
"stage_hazards",
"Turn stage hazards on/off",
ToggleSingle,
false,
));
misc_tab_submenus.push(OnOff::to_submenu(
"HUD",
"hud",
"Show/hide elements of the UI",
ToggleSingle,
false,
));
misc_tab_submenus.push(UpdatePolicy::to_submenu(
"Auto-Update",
"update_policy",
"What type of Training Modpack updates to automatically apply. (Console Only!)",
ToggleSingle,
false,
));
misc_tab_submenus.push(OnOff::to_submenu(
"L+R+A Reset",
"lra_reset",
"Reset Training Room when pressing L+R+A",
ToggleSingle,
false,
));
let misc_tab = Tab {
id: "misc",

View file

@ -15,6 +15,7 @@ pub trait SubMenuTrait {
id: &'a str,
help_text: &'a str,
submenu_type: SubMenuType,
allow_weights: bool,
) -> SubMenu<'a>;
}
@ -27,6 +28,7 @@ macro_rules! impl_submenutrait {
id: &'a str,
help_text: &'a str,
submenu_type: SubMenuType,
allow_weights: bool,
) -> SubMenu<'a> {
match submenu_type {
SubMenuType::ToggleSingle => {
@ -51,7 +53,7 @@ macro_rules! impl_submenutrait {
}
SubMenuType::ToggleMultiple => {
let value = 0;
let max = TOGGLE_MAX;
let max = if allow_weights { TOGGLE_MAX } else { 1 };
let toggles_vec: Vec<Toggle> = Self::ALL_NAMES
.iter()
.map(|title| Toggle { title, value, max })