Skip to content

Commit

Permalink
increase ui mouse sensitivity slider range
Browse files Browse the repository at this point in the history
Change minimum selectable sensitivity value from 2.0 to 0.5 for better compatibility with high-sensitivity mice. Also change slider scaling to make selecting low values more accurate.
  • Loading branch information
Chomenor committed Aug 30, 2023
1 parent dde492d commit 89e1d8e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions code/ui/ui_controls2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,9 @@ static void Controls_GetConfig( void )
s_controls.smoothmouse.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "m_filter" ) );
s_controls.alwaysrun.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "cl_run" ) );
s_controls.autoswitch.curvalue = UI_ClampCvar( 0, 2, Controls_GetCvarValue( "cg_autoswitch" ) );
s_controls.sensitivity.curvalue = UI_ClampCvar( 2, 30, Controls_GetCvarValue( "sensitivity" ) );
// adjusted sensitivity scaling in range 0.5-32.5 (original range was 2-30)
s_controls.sensitivity.curvalue = UI_ClampCvar( 0, 32,
sqrt( Controls_GetCvarValue( "sensitivity" ) * 2.0f - 1.0f ) * 4.0f );
s_controls.joyenable.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "in_joystick" ) );
s_controls.joythreshold.curvalue = UI_ClampCvar( 0.05, 0.75, Controls_GetCvarValue( "joy_threshold" ) );
s_controls.freelook.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "cl_freelook" ) );
Expand Down Expand Up @@ -1646,7 +1648,8 @@ static void Controls_SetConfig( void )
trap_Cvar_SetValue( "m_filter", s_controls.smoothmouse.curvalue );
trap_Cvar_SetValue( "cl_run", s_controls.alwaysrun.curvalue );
trap_Cvar_SetValue( "cg_autoswitch", s_controls.autoswitch.curvalue );
trap_Cvar_SetValue( "sensitivity", s_controls.sensitivity.curvalue );
trap_Cvar_SetValue( "sensitivity",
( ( ( s_controls.sensitivity.curvalue * s_controls.sensitivity.curvalue ) / 16.0f ) + 1 ) / 2.0f );
trap_Cvar_SetValue( "joy_threshold", s_controls.joythreshold.curvalue );
if ( controlsEngineConfig.supportFreeLook ) {
trap_Cvar_SetValue( "cl_freelook", s_controls.freelook.curvalue );
Expand Down Expand Up @@ -3642,8 +3645,8 @@ static void ControlsMouseJoyStick_MenuInit( void )
s_controls.sensitivity.generic.flags = QMF_SMALLFONT;
s_controls.sensitivity.generic.id = ID_MOUSESPEED;
s_controls.sensitivity.generic.callback = Controls_MenuEvent;
s_controls.sensitivity.minvalue = 2;
s_controls.sensitivity.maxvalue = 30;
s_controls.sensitivity.minvalue = 0;
s_controls.sensitivity.maxvalue = 32;
s_controls.sensitivity.color = CT_DKPURPLE1;
s_controls.sensitivity.color2 = CT_LTPURPLE1;
s_controls.sensitivity.generic.name = PIC_MONBAR2;
Expand Down

0 comments on commit 89e1d8e

Please sign in to comment.