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

bugfix for input delay (#339)

This commit is contained in:
asimon-1 2022-04-23 10:21:14 -04:00 committed by GitHub
parent 866035ce7f
commit fb6de31aa4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1001,6 +1001,12 @@ macro_rules! set_by_str {
}
}
const fn num_bits<T>() -> usize { std::mem::size_of::<T>() * 8 }
fn log_2(x: u32) -> u32 {
num_bits::<u32>() as u32 - x.leading_zeros() - 1
}
impl TrainingModpackMenu {
pub fn set(&mut self, s: &str, val: u32) {
set_by_str!(
@ -1017,7 +1023,7 @@ impl TrainingModpackMenu {
follow_up = Action::from_bits(val),
full_hop = BoolFlag::from_bits(val),
hitbox_vis = OnOff::from_val(val),
input_delay = Some(val as i32),
input_delay = Some(log_2(val) as i32),
ledge_delay = LongDelay::from_bits(val),
ledge_state = LedgeOption::from_bits(val),
mash_in_neutral = OnOff::from_val(val),