From b6037e0c912bd2afe52b3272dd0a62992c8eebde Mon Sep 17 00:00:00 2001 From: Trenten Pettry Date: Mon, 22 Jun 2026 11:48:10 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Added=20(New=20Features)=20?= =?UTF-8?q?=E2=80=A2=20Custom=20Set=20Builder=20Testing=20Mode:=20The=20Cu?= =?UTF-8?q?stom=20Set=20Builder=20tab=20now=20functions=20as=20a=20live=20?= =?UTF-8?q?recoil=20testing=20tool.=20When=20toggled=20ON=20while=20the=20?= =?UTF-8?q?tab=20is=20active,=20the=20custom=20X/Y=20recoil=20values=20are?= =?UTF-8?q?=20applied=20instead=20of=20the=20selected=20operator's=20recoi?= =?UTF-8?q?l,=20allowing=20real-time=20dial-in=20of=20recoil=20sets.=20Swi?= =?UTF-8?q?tching=20to=20any=20other=20tab=20automatically=20restores=20no?= =?UTF-8?q?rmal=20operator=20recoil.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 📂 File-Level Changes Summary • MainWindow.xaml: Named TabControl and added SelectionChanged handler for tab tracking. • MainWindow.xaml.cs: Added UpdateCustomSetState() to sync custom recoil mode with RecoilEngine based on tab focus and toggle state. • RecoilEngine.cs: Added CustomModeActive, CustomRecoilX, CustomRecoilY fields; HandleRecoilTick() checks custom mode first before falling back to mergedSets lookup. --- Lithium/MainWindow.xaml | 2 +- Lithium/MainWindow.xaml.cs | 35 ++++++++++++++++++++++++++++++++++- Lithium/RecoilEngine.cs | 15 +++++++++++++-- 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/Lithium/MainWindow.xaml b/Lithium/MainWindow.xaml index 1932cdb..bdfbac9 100644 --- a/Lithium/MainWindow.xaml +++ b/Lithium/MainWindow.xaml @@ -116,7 +116,7 @@ - + diff --git a/Lithium/MainWindow.xaml.cs b/Lithium/MainWindow.xaml.cs index 5342af6..a4e63cf 100644 --- a/Lithium/MainWindow.xaml.cs +++ b/Lithium/MainWindow.xaml.cs @@ -451,7 +451,40 @@ namespace Lithium private void ToggleCustomSet_Click(object sender, RoutedEventArgs e) { customSetEnabled = !customSetEnabled; - UpdateCustomSetConsole(customSetEnabled ? "Set is ON" : "Set is OFF"); + UpdateCustomSetState(); + } + + private void MainTabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + UpdateCustomSetState(); + } + + private void UpdateCustomSetState() + { + var selectedTab = MainTabControl.SelectedItem as TabItem; + bool onCustomTab = selectedTab != null && + string.Equals(selectedTab.Header?.ToString(), "Custom Set Builder", StringComparison.OrdinalIgnoreCase); + + if (customSetEnabled && onCustomTab) + { + if (double.TryParse(RecoilXTextBox.Text, System.Globalization.NumberStyles.Float, + System.Globalization.CultureInfo.InvariantCulture, out double x) && + double.TryParse(RecoilYTextBox.Text, System.Globalization.NumberStyles.Float, + System.Globalization.CultureInfo.InvariantCulture, out double y)) + { + RecoilEngine.CustomModeActive = true; + RecoilEngine.CustomRecoilX = x; + RecoilEngine.CustomRecoilY = y; + UpdateCustomSetConsole($"Custom Set ACTIVE | X:{x} Y:{y}"); + return; + } + UpdateCustomSetConsole("Error: Invalid recoil values"); + } + else + { + RecoilEngine.CustomModeActive = false; + UpdateCustomSetConsole(customSetEnabled ? "Set is ON (switch to tab to activate)" : "Set is OFF"); + } } // AA0145 diff --git a/Lithium/RecoilEngine.cs b/Lithium/RecoilEngine.cs index 8ae8da8..c575935 100644 --- a/Lithium/RecoilEngine.cs +++ b/Lithium/RecoilEngine.cs @@ -20,6 +20,10 @@ namespace Lua private static double _remainderX, _remainderY; private static double _jitterMultiplierX, _jitterMultiplierY; + public static bool CustomModeActive = false; + public static double CustomRecoilX = 0; + public static double CustomRecoilY = 0; + private static bool IsDown(int key) { return (GetAsyncKeyState(key) & 0x8000) != 0; @@ -61,12 +65,19 @@ namespace Lua { try { + int now = Environment.TickCount; + + if (CustomModeActive) + { + HandleJitter(now); + ApplyRecoil((CustomRecoilX, CustomRecoilY)); + return; + } + string setName = OperatorSets.CurrentSet; if (!OperatorSets.mergedSets.TryGetValue(setName, out var recoil)) return; - int now = Environment.TickCount; - HandleJitter(now); ApplyRecoil(recoil); }