Stick sensitivity modifiers

This commit is contained in:
lilacLunatic 2024-12-30 14:40:57 -03:00
parent 21e55563b4
commit 6e43514b22
2 changed files with 31 additions and 0 deletions

View File

@ -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();

View File

@ -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;