From 9a6569a916e10a87d37617a3e12915545ba3b2b5 Mon Sep 17 00:00:00 2001 From: Marcus Minhorst Date: Sun, 27 Jul 2025 15:36:58 -0400 Subject: [PATCH] Added option to disable sound when moving cursor by hovering. --- src/common/menu/optionmenu.cpp | 3 ++- wadsrc/static/zscript/engine/ui/menu/optionmenu.zs | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/common/menu/optionmenu.cpp b/src/common/menu/optionmenu.cpp index 83aba73e6..03ce3c526 100644 --- a/src/common/menu/optionmenu.cpp +++ b/src/common/menu/optionmenu.cpp @@ -38,7 +38,8 @@ #include "vm.h" // by request of Nash -CVARD(Bool, silence_menu_scroll, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE, "Silences cursor movement when scrolling"); +CVARD(Bool, silence_menu_scroll, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE, "Silences cursor movement when using mouse wheel"); +CVARD(Bool, silence_menu_hover, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE, "Silences cursor movement when implicitly selecting with mouse"); //============================================================================= diff --git a/wadsrc/static/zscript/engine/ui/menu/optionmenu.zs b/wadsrc/static/zscript/engine/ui/menu/optionmenu.zs index e555492d1..f39aa8f26 100644 --- a/wadsrc/static/zscript/engine/ui/menu/optionmenu.zs +++ b/wadsrc/static/zscript/engine/ui/menu/optionmenu.zs @@ -223,12 +223,12 @@ class OptionMenu : Menu override bool OnUIEvent(UIEvent ev) { + bool silentScroll = Cvar.FindCVar("silence_menu_scroll").getInt(); if (ev.type == UIEvent.Type_WheelUp) { if (MenuScrollViewport(-2, true) ) { - bool silence = Cvar.FindCVar("silence_menu_scroll").getInt(); - if (!silence) MenuSound ("menu/cursor"); + if (!silentScroll) MenuSound ("menu/cursor"); } return true; } @@ -236,8 +236,7 @@ class OptionMenu : Menu { if (MenuScrollViewport(2, true)) { - bool silence = Cvar.FindCVar("silence_menu_scroll").getInt(); - if (!silence) MenuSound ("menu/cursor"); + if (!silentScroll) MenuSound ("menu/cursor"); } return true; } @@ -604,6 +603,7 @@ class OptionMenu : Menu override bool MouseEvent(int type, int x, int y) { + y = (y / CleanYfac_1) - mDesc.mDrawTop; if (mFocusControl) @@ -639,7 +639,8 @@ class OptionMenu : Menu { if (i != mDesc.mSelectedItem) { - MenuSound ("menu/cursor"); + bool silentHover = Cvar.FindCVar("silence_menu_hover").getInt(); + if (!silentHover) MenuSound ("menu/cursor"); mDesc.mSelectedItem = i; } mDesc.mItems[i].MouseEvent(type, x, y);