mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2025-02-17 14:40:31 +00:00
Formatting, some clippy
This commit is contained in:
parent
0ab6e64cfa
commit
cd7255fc2c
6 changed files with 12 additions and 13 deletions
|
@ -239,13 +239,13 @@ fn combo_passes(combo: ButtonCombo) -> bool {
|
|||
let p1_controller_state = *P1_CONTROLLER_STATE.data_ptr();
|
||||
let this_combo_passes = hold.iter().all(|hold| {
|
||||
button_mapping(
|
||||
&*hold.to_uppercase(),
|
||||
&hold.to_uppercase(),
|
||||
p1_controller_state.style,
|
||||
p1_controller_state.current_buttons,
|
||||
)
|
||||
}) && press.iter().all(|hold| {
|
||||
button_mapping(
|
||||
&*hold.to_uppercase(),
|
||||
&hold.to_uppercase(),
|
||||
p1_controller_state.style,
|
||||
p1_controller_state.just_down,
|
||||
)
|
||||
|
@ -258,7 +258,7 @@ fn combo_passes(combo: ButtonCombo) -> bool {
|
|||
pub fn combo_passes_exclusive(combo: ButtonCombo) -> bool {
|
||||
let other_combo_passes = ButtonCombo::iter()
|
||||
.filter(|other_combo| *other_combo != combo)
|
||||
.any(|other_combo| combo_passes(other_combo));
|
||||
.any(combo_passes);
|
||||
combo_passes(combo) && !other_combo_passes
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ impl DevConfig {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn handle_final_input_mapping(player_idx: i32, controller_struct: &mut SomeControllerStruct) {
|
||||
pub fn handle_final_input_mapping(player_idx: i32, controller_struct: &SomeControllerStruct) {
|
||||
let current_buttons = controller_struct.controller.current_buttons;
|
||||
if player_idx == 0 && current_buttons.l() && current_buttons.r() && current_buttons.a() {
|
||||
let mut dev_config = DEV_CONFIG.lock();
|
||||
|
|
|
@ -278,8 +278,7 @@ pub struct MappedInputs {
|
|||
}
|
||||
|
||||
impl MappedInputs {
|
||||
// pub needed?
|
||||
pub fn default() -> MappedInputs {
|
||||
pub fn empty() -> MappedInputs {
|
||||
MappedInputs {
|
||||
buttons: Buttons::empty(),
|
||||
lstick_x: 0,
|
||||
|
|
|
@ -90,7 +90,7 @@ lazy_static! {
|
|||
|
||||
pub fn handle_final_input_mapping(
|
||||
player_idx: i32,
|
||||
controller_struct: &mut SomeControllerStruct,
|
||||
controller_struct: &SomeControllerStruct,
|
||||
out: *mut MappedInputs,
|
||||
) {
|
||||
unsafe {
|
||||
|
@ -98,7 +98,7 @@ pub fn handle_final_input_mapping(
|
|||
*P1_CONTROLLER_STATE.lock() = *controller_struct.controller;
|
||||
if QUICK_MENU_ACTIVE {
|
||||
// If we're here, remove all other presses
|
||||
*out = MappedInputs::default();
|
||||
*out = MappedInputs::empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ pub fn handle_final_input_mapping(player_idx: i32, out: *mut MappedInputs) {
|
|||
let actual_mapping = *out;
|
||||
|
||||
if delayed_mappings.len() < MENU.input_delay.into_delay() as usize {
|
||||
*out = MappedInputs::default();
|
||||
*out = MappedInputs::empty();
|
||||
} else if let Some(delayed_mapping) = delayed_mappings.back() {
|
||||
*out = *delayed_mapping;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ pub static mut CURRENT_FRAME_LENGTH: usize = 60;
|
|||
|
||||
lazy_static! {
|
||||
static ref P1_FINAL_MAPPING: Mutex<[[MappedInputs; FINAL_RECORD_MAX]; TOTAL_SLOT_COUNT]> =
|
||||
Mutex::new([[{ MappedInputs::default() }; FINAL_RECORD_MAX]; TOTAL_SLOT_COUNT]);
|
||||
Mutex::new([[{ MappedInputs::empty() }; FINAL_RECORD_MAX]; TOTAL_SLOT_COUNT]);
|
||||
static ref P1_FRAME_LENGTH_MAPPING: Mutex<[usize; TOTAL_SLOT_COUNT]> =
|
||||
Mutex::new([60usize; TOTAL_SLOT_COUNT]);
|
||||
static ref P1_STARTING_STATUSES: Mutex<[StartingStatus; TOTAL_SLOT_COUNT]> =
|
||||
|
@ -275,7 +275,7 @@ pub unsafe fn lockout_record() {
|
|||
P1_FINAL_MAPPING.lock()[CURRENT_RECORD_SLOT]
|
||||
.iter_mut()
|
||||
.for_each(|mapped_input| {
|
||||
*mapped_input = MappedInputs::default();
|
||||
*mapped_input = MappedInputs::empty();
|
||||
});
|
||||
CURRENT_FRAME_LENGTH = MENU.recording_frames.into_frames();
|
||||
P1_FRAME_LENGTH_MAPPING.lock()[CURRENT_RECORD_SLOT] = CURRENT_FRAME_LENGTH;
|
||||
|
@ -388,7 +388,7 @@ pub unsafe fn handle_final_input_mapping(player_idx: i32, out: *mut MappedInputs
|
|||
}
|
||||
|
||||
P1_FINAL_MAPPING.lock()[CURRENT_RECORD_SLOT][INPUT_RECORD_FRAME] = *out;
|
||||
*out = MappedInputs::default(); // don't control player while recording
|
||||
*out = MappedInputs::empty(); // don't control player while recording
|
||||
println!("Stored Player Input! Frame: {}", INPUT_RECORD_FRAME);
|
||||
}
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ unsafe fn set_cpu_controls(p_data: *mut *mut u8) {
|
|||
|
||||
if BUFFER_FRAME <= 3 && BUFFER_FRAME > 0 {
|
||||
// Our option is already buffered, now we need to 0 out inputs to make sure our future controls act like flicks/presses instead of holding the button
|
||||
saved_mapped_inputs = MappedInputs::default();
|
||||
saved_mapped_inputs = MappedInputs::empty();
|
||||
}
|
||||
|
||||
(*controller_data).buttons = saved_mapped_inputs.buttons;
|
||||
|
|
Loading…
Reference in a new issue