From 6e43514b22d07236f6b5462e3cc004608de0b413 Mon Sep 17 00:00:00 2001 From: lilacLunatic <8488221+lilacLunatic@users.noreply.github.com> Date: Mon, 30 Dec 2024 14:40:57 -0300 Subject: [PATCH] Stick sensitivity modifiers --- .../controls/SohInputEditorWindow.cpp | 9 ++++++++ soh/src/code/padmgr.c | 22 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp index 83f1ac412..63334d2b4 100644 --- a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp +++ b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp @@ -1824,6 +1824,15 @@ void SohInputEditorWindow::DrawLinkTab() { CVAR_SETTING("WalkModifier.SwimMapping2"), 0.0f, 5.0f, "", 1.0f, true, true, false, true); Ship::GuiWindow::EndGroupPanel(0); + Ship::GuiWindow::BeginGroupPanel("Sensitivity Modifier", ImGui::GetContentRegionAvail()); + UIWidgets::PaddedEnhancementSliderFloat("Sensitivity Modifier 1: %.0f %%", "##SensitivityMod1", + CVAR_SETTING("WalkModifier.SensitivityMapping1"), 0.0f, 1.0f, "", 1.0f, + true, true, false, true); + UIWidgets::PaddedEnhancementSliderFloat("Sensitivity Modifier 2: %.0f %%", "##SensitivityMod2", + CVAR_SETTING("WalkModifier.SensitivityMapping2"), 0.0f, 1.0f, "", 1.0f, + true, true, false, true); + + Ship::GuiWindow::EndGroupPanel(0); Ship::GuiWindow::EndGroupPanel(0); } ImGui::EndDisabled(); diff --git a/soh/src/code/padmgr.c b/soh/src/code/padmgr.c index 8665fb448..9066d2462 100644 --- a/soh/src/code/padmgr.c +++ b/soh/src/code/padmgr.c @@ -237,6 +237,28 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) { GameInteractor_SetEmulatedButtons(0); } + // #region SOH [Enhancement] + f32 sensitivityMod = 1.0f; + + if (CVarGetInteger(CVAR_SETTING("WalkModifier.Enabled"), 0) == 1) { + if (CVarGetInteger(CVAR_SETTING("WalkModifier.SpeedToggle"), 0) == 1) { + if (gWalkSpeedToggle1) { + sensitivityMod *= CVarGetFloat(CVAR_SETTING("WalkModifier.SensitivityMapping1"), 1.0f); + } else if (gWalkSpeedToggle2) { + sensitivityMod *= CVarGetFloat(CVAR_SETTING("WalkModifier.SensitivityMapping2"), 1.0f); + } + } else { + if (CHECK_BTN_ALL(input->cur.button, BTN_CUSTOM_MODIFIER1)) { + sensitivityMod *= CVarGetFloat(CVAR_SETTING("WalkModifier.SensitivityMapping1"), 1.0f); + } else if (CHECK_BTN_ALL(input->cur.button, BTN_CUSTOM_MODIFIER2)) { + sensitivityMod *= CVarGetFloat(CVAR_SETTING("WalkModifier.SensitivityMapping2"), 1.0f); + } + } + } + input->cur.stick_x *= sensitivityMod; + input->cur.stick_y *= sensitivityMod; + // #endregion + if (GameInteractor_ReverseControlsActive()) { if (input->cur.stick_x == -128) { input->cur.stick_x = 127;