From e91e76862e0f6d7569a669a35d190e585f721e07 Mon Sep 17 00:00:00 2001 From: Avahe Kellenberger Date: Wed, 13 Dec 2023 13:37:15 -0500 Subject: [PATCH] Allow shielding during up b angles. --- src/modes/UltimateR4.cpp | 215 +++++++++++++++++++-------------------- 1 file changed, 107 insertions(+), 108 deletions(-) diff --git a/src/modes/UltimateR4.cpp b/src/modes/UltimateR4.cpp index b5a1487e..3d2d123c 100644 --- a/src/modes/UltimateR4.cpp +++ b/src/modes/UltimateR4.cpp @@ -56,84 +56,84 @@ void UltimateR4::UpdateAnalogOutputs(InputState &inputs, OutputState &outputs) { bool shield_button_pressed = inputs.l || inputs.r; if (inputs.mod_x) { + if (shield_button_pressed) { + // Double shielding for shield tilt + outputs.triggerLDigital = true; + outputs.triggerRDigital = true; + } + // Angled fsmash/ftilt with C-Stick + MX if (directions.cx != 0) { outputs.rightStickX = ANALOG_STICK_NEUTRAL + (directions.cx * 100); outputs.rightStickY = ANALOG_STICK_NEUTRAL + 59; } - if (shield_button_pressed) { - // Double shielding for shield tilt - outputs.triggerLDigital = true; - outputs.triggerRDigital = true; - } else { - if (directions.horizontal) { - // Fastest walking speed before run + if (directions.horizontal) { + // Fastest walking speed before run + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 53); + } else if (directions.vertical) { + // Vertical Shield Tilt and crouch with mod_x = 65 + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 65); + } else if (directions.diagonal) { + // MX + q1/2/3/4 = 53 35 + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 53); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 34); + } + + /* Up B angles */ + if (directions.diagonal) { + // (39.05) = 53 43 + if (inputs.c_down) { outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 53); - } else if (directions.vertical) { - // Vertical Shield Tilt and crouch with mod_x = 65 - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 65); - } else if (directions.diagonal) { - // MX + q1/2/3/4 = 53 35 + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 43); + } + // (36.35) = 53 39 + if (inputs.c_left) { + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 53); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 39); + } + // (30.32) = 56 41 + if (inputs.c_up) { outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 53); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 34); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 31); + } + // (27.85) = 49 42 + if (inputs.c_right) { + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 53); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 28); } - /* Up B angles */ - if (directions.diagonal) { - // (39.05) = 53 43 + /* Extended Up B Angles */ + if (inputs.b) { + // (33.29) = 67 44 + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 67); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 44); + // (39.38) = 67 55 if (inputs.c_down) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 53); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 43); + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 67); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 55); } - // (36.35) = 53 39 + // (36.18) = 67 49 if (inputs.c_left) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 53); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 39); + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 67); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 49); } - // (30.32) = 56 41 + // (30.2) = 67 39 if (inputs.c_up) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 53); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 31); + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 67); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 39); } - // (27.85) = 49 42 + // (27.58) = 67 35 if (inputs.c_right) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 53); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 28); - } - - /* Extended Up B Angles */ - if (inputs.b) { - // (33.29) = 67 44 outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 67); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 44); - // (39.38) = 67 55 - if (inputs.c_down) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 67); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 55); - } - // (36.18) = 67 49 - if (inputs.c_left) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 67); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 49); - } - // (30.2) = 67 39 - if (inputs.c_up) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 67); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 39); - } - // (27.58) = 67 35 - if (inputs.c_right) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 67); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 35); - } + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 35); } + } - // Angled Ftilts - if (inputs.a) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 36); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 26); - } + // Angled Ftilts + if (inputs.a) { + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 36); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 26); } } } @@ -149,70 +149,69 @@ void UltimateR4::UpdateAnalogOutputs(InputState &inputs, OutputState &outputs) { // Double shielding for shield tilt outputs.triggerLDigital = true; outputs.triggerRDigital = true; - } else { - if (directions.horizontal) { - // Allow tink/yink walk shield + } + if (directions.horizontal) { + // Allow tink/yink walk shield + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 28); + } else if (directions.diagonal) { + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 53); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 34); + } + + /* Up B angles */ + if (directions.diagonal) { + // (50.95) = 43 53 + if (inputs.c_down) { + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 43); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 53); + } + // (53.65) = 39 53 + if (inputs.c_left) { + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 49); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 53); + } + // (59.68) = 31 53 + if (inputs.c_up) { + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 31); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 53); + } + // (62.15) = 28 53 + if (inputs.c_right) { outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 28); - } else if (directions.diagonal) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 53); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 34); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 53); } - /* Up B angles */ - if (directions.diagonal) { - // (50.95) = 43 53 + /* Extended Up B Angles */ + if (inputs.b) { + // (56.71) = 44 67 + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 44); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 67); + // (50.62) = 55 67 if (inputs.c_down) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 43); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 53); + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 55); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 67); } - // (53.65) = 39 53 + // (53.82) = 49 67 if (inputs.c_left) { outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 49); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 53); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 67); } - // (59.68) = 31 53 + // (59.8) = 39 67 if (inputs.c_up) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 31); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 53); + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 39); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 67); } - // (62.15) = 28 53 + // (62.42) = 35 67 if (inputs.c_right) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 28); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 53); - } - - /* Extended Up B Angles */ - if (inputs.b) { - // (56.71) = 44 67 - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 44); + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 35); outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 67); - // (50.62) = 55 67 - if (inputs.c_down) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 55); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 67); - } - // (53.82) = 49 67 - if (inputs.c_left) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 49); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 67); - } - // (59.8) = 39 67 - if (inputs.c_up) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 39); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 67); - } - // (62.42) = 35 67 - if (inputs.c_right) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 35); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 67); - } } + } - // MY Pivot Uptilt/Dtilt - if (inputs.a) { - outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 50); - outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 65); - } + // MY Pivot Uptilt/Dtilt + if (inputs.a) { + outputs.leftStickX = ANALOG_STICK_NEUTRAL + (directions.x * 50); + outputs.leftStickY = ANALOG_STICK_NEUTRAL + (directions.y * 65); } } }