Added option to disable sound when moving cursor by hovering.

This commit is contained in:
Marcus Minhorst 2025-07-27 15:36:58 -04:00 committed by Ricardo Luís Vaz Silva
commit 9a6569a916
2 changed files with 8 additions and 6 deletions

View file

@ -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");
//=============================================================================

View file

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