diff --git a/soh/soh/Enhancements/controls/Mouse.cpp b/soh/soh/Enhancements/controls/Mouse.cpp index 9cadf0a8c3..043b7f8992 100644 --- a/soh/soh/Enhancements/controls/Mouse.cpp +++ b/soh/soh/Enhancements/controls/Mouse.cpp @@ -34,7 +34,7 @@ void Mouse_UpdateAll() { } void Mouse_HandleThirdPerson(f32* newCamX, f32* newCamY) { - if (MOUSE_ENABLED) { + if (MOUSE_ENABLED && !CVarGetInteger(CVAR_SETTING("DisableThirdPersonMouse"), 0)) { *newCamX -= mouseCoordRel.x * 40.0f; *newCamY -= mouseCoordRel.y * 40.0f; } @@ -84,7 +84,7 @@ static s32 mouseQuickspinY[5] = {}; static u8 quickspinCount = 0; void Mouse_UpdateQuickspinCount() { - if (MOUSE_ENABLED) { + if (MOUSE_ENABLED && !CVarGetInteger(CVAR_SETTING("DisableThirdPersonMouse"), 0)) { quickspinCount = (quickspinCount + 1) % 5; mouseQuickspinX[quickspinCount] = mouseCoord.x; mouseQuickspinY[quickspinCount] = mouseCoord.y; @@ -97,7 +97,7 @@ bool Mouse_HandleQuickspin(bool* should, s8* iter2, s8* sp3C) { s8 temp1; s8 temp2; s32 i; - if (!MOUSE_ENABLED) { + if (!MOUSE_ENABLED || CVarGetInteger(CVAR_SETTING("DisableThirdPersonMouse"), 0)) { return *should = false; } diff --git a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp index c02f310e47..f9a2c25c28 100644 --- a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp +++ b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp @@ -19,6 +19,7 @@ using namespace UIWidgets; static WidgetInfo freeLook; static WidgetInfo mouseControl; static WidgetInfo mouseAutoCapture; +static WidgetInfo mouseDisableThirdPerson; static WidgetInfo rightStickOcarina; static WidgetInfo dpadOcarina; static WidgetInfo dpadPause; @@ -1377,6 +1378,10 @@ void SohInputEditorWindow::DrawCameraControlPanel() { ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5)); SohGui::mSohMenu->MenuDrawItem(mouseAutoCapture, static_cast(ImGui::GetContentRegionAvail().x), THEME_COLOR); + cursor = ImGui::GetCursorPos(); + ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5)); + SohGui::mSohMenu->MenuDrawItem(mouseDisableThirdPerson, static_cast(ImGui::GetContentRegionAvail().x), + THEME_COLOR); Ship::GuiWindow::BeginGroupPanel("Aiming/First-Person Camera", ImGui::GetContentRegionAvail()); CVarCheckbox("Right Stick Aiming", CVAR_SETTING("Controls.RightStickAim"), @@ -1909,6 +1914,19 @@ void RegisterInputEditorWidgets() { "and capture mouse input when closing the menu.")); SohGui::mSohMenu->AddSearchWidget({ mouseAutoCapture, "Settings", "Controls", "Camera Controls" }); + mouseDisableThirdPerson = { .name = "Disable Third-Person Mouse Controls", + .type = WidgetType::WIDGET_CVAR_CHECKBOX }; + mouseDisableThirdPerson.CVar(CVAR_SETTING("DisableThirdPersonMouse")) + .PreFunc([](WidgetInfo& info) { + info.options->disabled = !CVarGetInteger(CVAR_SETTING("EnableMouse"), 0); + info.options->disabledTooltip = "Forced off because Mouse Controls are disabled."; + }) + .Options(CheckboxOptions() + .Color(THEME_COLOR) + .Tooltip("Stops the mouse from moving the third-person camera and from triggering quickspins, " + "while still allowing mouse control for first-person aiming and the shield.")); + SohGui::mSohMenu->AddSearchWidget({ mouseDisableThirdPerson, "Settings", "Controls", "Camera Controls" }); + rightStickOcarina = { .name = "Right Stick Ocarina Playback", .type = WidgetType::WIDGET_CVAR_CHECKBOX }; rightStickOcarina.CVar(CVAR_SETTING("CustomOcarina.RightStick")).Options(CheckboxOptions().Color(THEME_COLOR)); SohGui::mSohMenu->AddSearchWidget({ rightStickOcarina, "Settings", "Controls", "Ocarina Controls" });