1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-30 22:00:16 +00:00

Add Status Only option for input logger (#653)

* Initial attempt, working but menu crashing

* Assign raw enum values to fix crash

* Merge main into add-status-display

---------

Co-authored-by: asimon-1 <40246417+asimon-1@users.noreply.github.com>
This commit is contained in:
GradualSyrup 2023-12-06 02:27:26 -06:00 committed by GitHub
parent 65f87df1e0
commit 1475fb2509
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 378 additions and 366 deletions

View file

@ -138,6 +138,7 @@ impl InputLog {
match MENU.input_display { match MENU.input_display {
InputDisplay::SMASH => self.is_smash_different(other), InputDisplay::SMASH => self.is_smash_different(other),
InputDisplay::RAW => self.is_raw_different(other), InputDisplay::RAW => self.is_raw_different(other),
InputDisplay::STATUS => self.is_status_different(other),
InputDisplay::NONE => false, InputDisplay::NONE => false,
_ => panic!("Invalid value in is_different: {}", MENU.input_display), _ => panic!("Invalid value in is_different: {}", MENU.input_display),
} }
@ -149,6 +150,7 @@ impl InputLog {
match MENU.input_display { match MENU.input_display {
InputDisplay::SMASH => self.smash_binned_lstick(), InputDisplay::SMASH => self.smash_binned_lstick(),
InputDisplay::RAW => self.raw_binned_lstick(), InputDisplay::RAW => self.raw_binned_lstick(),
InputDisplay::STATUS => (DirectionStrength::None, 0.0),
InputDisplay::NONE => panic!("Invalid input display to log"), InputDisplay::NONE => panic!("Invalid input display to log"),
_ => panic!("Invalid value in binned_lstick: {}", MENU.input_display), _ => panic!("Invalid value in binned_lstick: {}", MENU.input_display),
} }
@ -160,6 +162,7 @@ impl InputLog {
match MENU.input_display { match MENU.input_display {
InputDisplay::SMASH => self.smash_binned_rstick(), InputDisplay::SMASH => self.smash_binned_rstick(),
InputDisplay::RAW => self.raw_binned_rstick(), InputDisplay::RAW => self.raw_binned_rstick(),
InputDisplay::STATUS => (DirectionStrength::None, 0.0),
InputDisplay::NONE => panic!("Invalid input display to log"), InputDisplay::NONE => panic!("Invalid input display to log"),
_ => panic!("Invalid value in binned_rstick: {}", MENU.input_display), _ => panic!("Invalid value in binned_rstick: {}", MENU.input_display),
} }
@ -171,6 +174,7 @@ impl InputLog {
match MENU.input_display { match MENU.input_display {
InputDisplay::SMASH => self.smash_button_icons(), InputDisplay::SMASH => self.smash_button_icons(),
InputDisplay::RAW => self.raw_button_icons(), InputDisplay::RAW => self.raw_button_icons(),
InputDisplay::STATUS => VecDeque::new(),
InputDisplay::NONE => panic!("Invalid input display to log"), InputDisplay::NONE => panic!("Invalid input display to log"),
_ => unreachable!(), _ => unreachable!(),
} }
@ -257,6 +261,13 @@ impl InputLog {
|| (unsafe { MENU.input_display_status.as_bool() } && self.status != other.status) || (unsafe { MENU.input_display_status.as_bool() } && self.status != other.status)
} }
fn is_status_different(&self, other: &InputLog) -> bool {
unsafe {
let input_display_status = MENU.input_display_status.as_bool();
input_display_status && (self.status != other.status)
}
}
fn smash_binned_lstick(&self) -> (DirectionStrength, f32) { fn smash_binned_lstick(&self) -> (DirectionStrength, f32) {
bin_stick_values(self.smash_inputs.lstick_x, self.smash_inputs.lstick_y) bin_stick_values(self.smash_inputs.lstick_x, self.smash_inputs.lstick_y)
} }

View file

@ -1041,5 +1041,6 @@ byteflags! {
pub NONE = "None", pub NONE = "None",
pub SMASH = "Smash Inputs", pub SMASH = "Smash Inputs",
pub RAW = "Raw Inputs", pub RAW = "Raw Inputs",
pub STATUS = "Status Only",
} }
} }