Added option to disable sound when moving cursor by using scrollwheel.

This commit is contained in:
Marcus Minhorst 2025-07-27 06:34:51 -04:00 committed by Ricardo Luís Vaz Silva
commit cbe710b549
2 changed files with 11 additions and 5 deletions

View file

@ -32,10 +32,14 @@
**
*/
#include "c_cvars.h"
#include "v_video.h"
#include "menu.h"
#include "vm.h"
// by request of Nash
CVARD(Bool, silence_menu_scroll, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE, "Silences cursor movement when scrolling");
//=============================================================================
//
@ -65,4 +69,4 @@ DEFINE_ACTION_FUNCTION_NATIVE(_OptionMenuItemOption, SetCVarDescription, SetCVar
PARAM_STRING(label);
SetCVarDescription(cv, &label);
return 0;
}
}

View file

@ -225,9 +225,10 @@ class OptionMenu : Menu
{
if (ev.type == UIEvent.Type_WheelUp)
{
if (MenuScrollViewport(-2, true))
if (MenuScrollViewport(-2, true) )
{
MenuSound ("menu/cursor");
bool silence = Cvar.FindCVar("silence_menu_scroll").getInt();
if (!silence) MenuSound ("menu/cursor");
}
return true;
}
@ -235,7 +236,8 @@ class OptionMenu : Menu
{
if (MenuScrollViewport(2, true))
{
MenuSound ("menu/cursor");
bool silence = Cvar.FindCVar("silence_menu_scroll").getInt();
if (!silence) MenuSound ("menu/cursor");
}
return true;
}
@ -489,7 +491,7 @@ class OptionMenu : Menu
if (!mDesc.mItems[i].Selectable()) continue;
lastSelectable = i;
}
if (lastSelectable != -1 && mDesc.mSelectedItem > lastSelectable)
if (cursor && lastSelectable != -1 && mDesc.mSelectedItem > lastSelectable)
{
mDesc.mSelectedItem = lastSelectable;
}