config settings for mouse acceleration (#312)

* config settings for mouse acceleration

* fix type

* use percent
This commit is contained in:
Roman Fomin 2021-10-19 15:25:52 +07:00 committed by GitHub
parent bbb9e01293
commit fd8781bad6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View File

@ -746,8 +746,9 @@ void I_GetEvent(void)
// This is to combine all mouse movement for a tic into one mouse // This is to combine all mouse movement for a tic into one mouse
// motion event. // motion event.
static const float mouse_acceleration = 1.0; // 2.0; static float mouse_acceleration = 1.0; // 2.0;
static const int mouse_threshold = 0; // 10; int cfg_mouse_acceleration;
int mouse_threshold; // 10;
static int AccelerateMouse(int val) static int AccelerateMouse(int val)
{ {
@ -1270,6 +1271,8 @@ static void I_InitGraphicsMode(void)
if(firsttime) if(firsttime)
{ {
I_InitKeyboard(); I_InitKeyboard();
// translate config value (as percent) to float
mouse_acceleration = (float)cfg_mouse_acceleration / 100;
firsttime = false; firsttime = false;
if(M_CheckParm("-hires")) if(M_CheckParm("-hires"))

View File

@ -84,6 +84,8 @@ extern int cfg_scalefactor; // haleyjd 05/11/09
extern int cfg_aspectratio; // haleyjd 05/11/09 extern int cfg_aspectratio; // haleyjd 05/11/09
extern int fullscreen; // [FG] save fullscren mode extern int fullscreen; // [FG] save fullscren mode
extern boolean flipcorpses; // [crispy] randomly flip corpse, blood and death animation sprites 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 extern char *chat_macros[], *wad_files[], *deh_files[]; // killough 10/98
@ -374,6 +376,20 @@ default_t defaults[] = {
"adjust vertical (y) mouse sensitivity" "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", "sfx_volume",
(config_t *) &snd_SfxVolume, NULL, (config_t *) &snd_SfxVolume, NULL,