forked from NaxdyOrg/NaxGCC-FW
implement filter for angled ftilts
This commit is contained in:
parent
a09d21b4fd
commit
d2d8d31101
1 changed files with 31 additions and 0 deletions
|
@ -7,6 +7,10 @@ use crate::{
|
|||
|
||||
/**
|
||||
* Houses functionality for modifying GCC state before it is sent to the console.
|
||||
*
|
||||
* General info for implementing filters on the sticks:
|
||||
* X and Y values of a stick go each from 0 to 255.
|
||||
* 127.5 is the middle value and when both X and Y are 127.5 the stick is in neutral position.
|
||||
*/
|
||||
|
||||
pub trait InputFilter: Sized {
|
||||
|
@ -100,6 +104,33 @@ impl InputFilter for CStickUpTiltFilter {
|
|||
}
|
||||
}
|
||||
|
||||
/// Improves hitting up/down angled forward tilt at the cost
|
||||
/// of making it impossible to hit turnaround up & down tilt
|
||||
/// and making it slightly harder to hit regular forward tilt.
|
||||
pub struct CStickAngledFTiltFilter;
|
||||
|
||||
impl InputFilter for CStickAngledFTiltFilter {
|
||||
fn apply_filter(&mut self, gcc_state: &mut GcReport) {
|
||||
if gcc_state.cstick_y > 147 {
|
||||
if (147..=225).contains(&gcc_state.cstick_x) {
|
||||
gcc_state.cstick_x = 205;
|
||||
gcc_state.cstick_y = 205;
|
||||
} else if (30..=107).contains(&gcc_state.cstick_x) {
|
||||
gcc_state.cstick_x = 50;
|
||||
gcc_state.cstick_y = 205;
|
||||
}
|
||||
} else if gcc_state.cstick_y < 107 {
|
||||
if (147..=225).contains(&gcc_state.cstick_x) {
|
||||
gcc_state.cstick_x = 205;
|
||||
gcc_state.cstick_y = 50;
|
||||
} else if (30..=107).contains(&gcc_state.cstick_x) {
|
||||
gcc_state.cstick_x = 50;
|
||||
gcc_state.cstick_y = 50;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Does nothing.
|
||||
#[derive(Default)]
|
||||
pub struct DummyFilter;
|
||||
|
|
Loading…
Reference in a new issue