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

Toggle to Remove Dodge Staling (#601)

* Working build

* extra options change

* cargo fmt

* Move stale dodges to defensive tab

* implication explanation

* no Option for as_bool
This commit is contained in:
GradualSyrup 2023-08-29 16:59:24 -05:00 committed by GitHub
parent 8d8292ffc2
commit 230943ac70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 1 deletions

View file

@ -1,7 +1,8 @@
use crate::common::button_config;
use crate::common::{
consts::BuffOption, consts::FighterId, consts::MENU, dev_config, get_module_accessor,
is_training_mode, menu, FIGHTER_MANAGER_ADDR, ITEM_MANAGER_ADDR, STAGE_MANAGER_ADDR,
is_operation_cpu, is_training_mode, menu, FIGHTER_MANAGER_ADDR, ITEM_MANAGER_ADDR,
STAGE_MANAGER_ADDR,
};
use crate::hitbox_visualizer;
use crate::input::*;
@ -124,6 +125,15 @@ fn once_per_frame_per_fighter(
menu::spawn_menu();
}
if is_operation_cpu(module_accessor) {
// Handle dodge staling here b/c input recording or mash can cause dodging
WorkModule::set_flag(
module_accessor,
!(MENU.stale_dodges.as_bool()),
*FIGHTER_INSTANCE_WORK_ID_FLAG_DISABLE_ESCAPE_PENALTY,
);
}
input_record::get_command_flag_cat(module_accessor);
combo::get_command_flag_cat(module_accessor);
hitbox_visualizer::get_command_flag_cat(module_accessor);

View file

@ -89,6 +89,7 @@ pub struct TrainingModpackMenu {
pub input_record: ButtonConfig,
pub input_playback: ButtonConfig,
pub recording_crop: OnOff,
pub stale_dodges: OnOff,
pub update_policy: UpdatePolicy,
}
@ -194,6 +195,7 @@ pub static DEFAULTS_MENU: TrainingModpackMenu = TrainingModpackMenu {
input_record: ButtonConfig::ZR.union(ButtonConfig::DPAD_DOWN),
input_playback: ButtonConfig::ZR.union(ButtonConfig::DPAD_UP),
recording_crop: OnOff::On,
stale_dodges: OnOff::On,
update_policy: UpdatePolicy::default(),
};
@ -684,6 +686,14 @@ pub unsafe fn ui_menu(menu: TrainingModpackMenu) -> UiMenu {
true,
&(menu.crouch as u32),
);
defensive_tab.add_submenu_with_toggles::<OnOff>(
"Dodge Staling".to_string(),
"stale_dodges".to_string(),
"Dodge Staling: 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)"
.to_string(),
true,
&(menu.stale_dodges as u32),
);
overall_menu.tabs.push(defensive_tab);
let mut save_state_tab = Tab {

View file

@ -440,6 +440,13 @@ impl OnOff {
_ => None,
}
}
pub fn as_bool(self) -> bool {
match self {
OnOff::Off => false,
OnOff::On => true,
}
}
}
impl fmt::Display for OnOff {