Optional 3rd-Person Mouse Camera Controls (#6891)

Included quick spins in disabled checks
This commit is contained in:
Jake Edvenson
2026-07-10 10:37:24 -07:00
committed by GitHub
parent 417256b42c
commit 49edb25c45
2 changed files with 21 additions and 3 deletions
+3 -3
View File
@@ -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;
}
@@ -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<uint32_t>(ImGui::GetContentRegionAvail().x),
THEME_COLOR);
cursor = ImGui::GetCursorPos();
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
SohGui::mSohMenu->MenuDrawItem(mouseDisableThirdPerson, static_cast<uint32_t>(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" });