mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2024-11-24 10:54:16 +00:00
Switch hold vs press, immediately take input if holding for >= 10 frames
This commit is contained in:
parent
d8ecebfe12
commit
2094a22bea
3 changed files with 20 additions and 18 deletions
|
@ -246,28 +246,30 @@ pub fn handle_final_input_mapping(player_idx: i32, controller_struct: &mut SomeC
|
||||||
p1_controller.current_buttons.set_plus(false);
|
p1_controller.current_buttons.set_plus(false);
|
||||||
p1_controller.just_down.set_plus(false);
|
p1_controller.just_down.set_plus(false);
|
||||||
p1_controller.just_release.set_plus(false);
|
p1_controller.just_release.set_plus(false);
|
||||||
|
if *start_hold_frames >= 10 && unsafe { !VANILLA_MENU_ACTIVE } {
|
||||||
|
// If we've held for more than 10 frames,
|
||||||
|
// let's open the training mod menu
|
||||||
|
start_menu_request = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if *start_hold_frames > 0 && menu_close_wait_frame == 0 {
|
|
||||||
// Here, we just finished holding start
|
// Here, we just finished holding start
|
||||||
if *start_hold_frames < 10
|
if *start_hold_frames > 0
|
||||||
&& unsafe { !VANILLA_MENU_ACTIVE }
|
&& *start_hold_frames < 10
|
||||||
|
&& unsafe { !QUICK_MENU_ACTIVE }
|
||||||
&& menu_close_wait_frame == 0
|
&& menu_close_wait_frame == 0
|
||||||
{
|
{
|
||||||
// If we held for fewer than 10 frames, let's open the training mod menu
|
// If we held for fewer than 10 frames, let's let the game know that
|
||||||
start_menu_request = true;
|
// we had pressed start
|
||||||
} else if unsafe { !QUICK_MENU_ACTIVE } {
|
|
||||||
// Otherwise, let's let the game know that we had pressed start
|
|
||||||
// So long as our menu isn't active
|
|
||||||
p1_controller.current_buttons.set_plus(true);
|
p1_controller.current_buttons.set_plus(true);
|
||||||
p1_controller.just_down.set_plus(true);
|
p1_controller.just_down.set_plus(true);
|
||||||
unsafe {
|
unsafe {
|
||||||
VANILLA_MENU_ACTIVE = true;
|
VANILLA_MENU_ACTIVE = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
*start_hold_frames = 0;
|
*start_hold_frames = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we ever press minus, open the mod menu
|
||||||
if p1_controller.current_buttons.minus() {
|
if p1_controller.current_buttons.minus() {
|
||||||
start_menu_request = true;
|
start_menu_request = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ pub fn main() {
|
||||||
notification(
|
notification(
|
||||||
"Open Menu".to_string(),
|
"Open Menu".to_string(),
|
||||||
if MENU.menu_open_start_press == OnOff::On {
|
if MENU.menu_open_start_press == OnOff::On {
|
||||||
"Start".to_string()
|
"Hold Start".to_string()
|
||||||
} else {
|
} else {
|
||||||
DEFAULT_OPEN_MENU_CONFIG.to_string()
|
DEFAULT_OPEN_MENU_CONFIG.to_string()
|
||||||
},
|
},
|
||||||
|
|
|
@ -355,7 +355,7 @@ pub unsafe fn ui_menu(menu: TrainingModpackMenu) -> UiMenu {
|
||||||
button_tab.add_submenu_with_toggles::<OnOff>(
|
button_tab.add_submenu_with_toggles::<OnOff>(
|
||||||
"Menu Open Start Press".to_string(),
|
"Menu Open Start Press".to_string(),
|
||||||
"menu_open_start_press".to_string(),
|
"menu_open_start_press".to_string(),
|
||||||
"Menu Open Start Press: Press start to open the mod menu. To open the original menu, hold start.\nThe default menu open option is always available as Hold B + Press DPad Up.".to_string(),
|
"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.".to_string(),
|
||||||
true,
|
true,
|
||||||
&(menu.menu_open_start_press as u32),
|
&(menu.menu_open_start_press as u32),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue