From fd8781bad61262e8a7ff92974d27b18d866dcb14 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Tue, 19 Oct 2021 15:25:52 +0700 Subject: [PATCH] config settings for mouse acceleration (#312) * config settings for mouse acceleration * fix type * use percent --- Source/i_video.c | 7 +++++-- Source/m_misc.c | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Source/i_video.c b/Source/i_video.c index a2ca1bd9..ce0064d8 100644 --- a/Source/i_video.c +++ b/Source/i_video.c @@ -746,8 +746,9 @@ void I_GetEvent(void) // This is to combine all mouse movement for a tic into one mouse // motion event. -static const float mouse_acceleration = 1.0; // 2.0; -static const int mouse_threshold = 0; // 10; +static float mouse_acceleration = 1.0; // 2.0; +int cfg_mouse_acceleration; +int mouse_threshold; // 10; static int AccelerateMouse(int val) { @@ -1270,6 +1271,8 @@ static void I_InitGraphicsMode(void) if(firsttime) { I_InitKeyboard(); + // translate config value (as percent) to float + mouse_acceleration = (float)cfg_mouse_acceleration / 100; firsttime = false; if(M_CheckParm("-hires")) diff --git a/Source/m_misc.c b/Source/m_misc.c index 8ef3723b..68e7bb1f 100644 --- a/Source/m_misc.c +++ b/Source/m_misc.c @@ -84,6 +84,8 @@ extern int cfg_scalefactor; // haleyjd 05/11/09 extern int cfg_aspectratio; // haleyjd 05/11/09 extern int fullscreen; // [FG] save fullscren mode extern boolean flipcorpses; // [crispy] randomly flip corpse, blood and death animation sprites +extern int cfg_mouse_acceleration; +extern int mouse_threshold; extern char *chat_macros[], *wad_files[], *deh_files[]; // killough 10/98 @@ -374,6 +376,20 @@ default_t defaults[] = { "adjust vertical (y) mouse sensitivity" }, + { + "cfg_mouse_acceleration", + (config_t *) &cfg_mouse_acceleration, NULL, + {100}, {100,UL}, number, ss_none, wad_no, + "adjust mouse acceleration (100% - no acceleration)" + }, + + { + "mouse_threshold", + (config_t *) &mouse_threshold, NULL, + {0}, {0,UL}, number, ss_none, wad_no, + "adjust mouse acceleration threshold" + }, + { "sfx_volume", (config_t *) &snd_SfxVolume, NULL,