diff --git a/source/blood/src/config.cpp b/source/blood/src/config.cpp index d959fe0ee..71ab07e16 100644 --- a/source/blood/src/config.cpp +++ b/source/blood/src/config.cpp @@ -56,7 +56,6 @@ BEGIN_BLD_NS hashtable_t h_gamefuncs = { NUMGAMEFUNCTIONS<<1, NULL }; -int32_t MouseDeadZone, MouseBias; int32_t SmoothInput; int32_t MouseFunctions[MAXMOUSEBUTTONS][2]; int32_t MouseDigitalFunctions[MAXMOUSEAXES][2]; @@ -280,8 +279,6 @@ void CONFIG_SetDefaults(void) //snd_ambience = 1; //ud.config.AutoAim = 1; CheckForUpdates = 1; - MouseBias = 0; - MouseDeadZone = 0; gBrightness = 8; //ud.config.ShowWeapons = 0; SmoothInput = 1; diff --git a/source/blood/src/config.h b/source/blood/src/config.h index 2c01c617b..fe3113a39 100644 --- a/source/blood/src/config.h +++ b/source/blood/src/config.h @@ -38,7 +38,6 @@ BEGIN_BLD_NS #define MAXPLAYERNAME 16 #define MAXMOUSEAXES 2 -extern int32_t MouseDeadZone, MouseBias; extern int32_t SmoothInput; extern int32_t MouseFunctions[MAXMOUSEBUTTONS][2]; extern int32_t MouseDigitalFunctions[MAXMOUSEAXES][2]; diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp index 1280751fc..e8a9c0f04 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -217,25 +217,25 @@ void ctrlGetInput(void) CONTROL_GetInput(&info); - if (MouseDeadZone) + if (in_mousedeadzone) { if (info.mousey > 0) - info.mousey = max(info.mousey - MouseDeadZone, 0); + info.mousey = max(info.mousey - in_mousedeadzone, 0); else if (info.mousey < 0) - info.mousey = min(info.mousey + MouseDeadZone, 0); + info.mousey = min(info.mousey + in_mousedeadzone, 0); if (info.mousex > 0) - info.mousex = max(info.mousex - MouseDeadZone, 0); + info.mousex = max(info.mousex - in_mousedeadzone, 0); else if (info.mousex < 0) - info.mousex = min(info.mousex + MouseDeadZone, 0); + info.mousex = min(info.mousex + in_mousedeadzone, 0); } - if (MouseBias) + if (in_mousebias) { if (klabs(info.mousex) > klabs(info.mousey)) - info.mousey = tabledivide32_noinline(info.mousey, MouseBias); + info.mousey = tabledivide32_noinline(info.mousey, in_mousebias); else - info.mousex = tabledivide32_noinline(info.mousex, MouseBias); + info.mousex = tabledivide32_noinline(info.mousex, in_mousebias); } if (gQuitRequest) diff --git a/source/common/gamecvars.cpp b/source/common/gamecvars.cpp index 3b79dd49e..a174b234d 100644 --- a/source/common/gamecvars.cpp +++ b/source/common/gamecvars.cpp @@ -230,20 +230,27 @@ CUSTOM_CVARD(Bool, in_mouse, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCAL CONTROL_MouseEnabled = (self && CONTROL_MousePresent); } -CVARD(Bool, in_aimmode, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "0:toggle, 1:hold to aim")// (void *)&ud.mouseaiming, CVAR_BOOL, 0, 1 }, +CVARD(Bool, in_aimmode, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "0:toggle, 1:hold to aim") + +CUSTOM_CVARD(Int, in_mousebias, 0, CVAR_INT|CVAR_GLOBALCONFIG|CVAR_ARCHIVE, "emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time") +{ + if (self < 0) self = 0; + else if (self > 32) self = 32; +} + +CUSTOM_CVARD(Int, in_mousedeadzone, 0, CVAR_INT|CVAR_GLOBALCONFIG|CVAR_ARCHIVE, "amount of mouse movement to filter out") +{ + if (self < 0) self = 0; + else if (self > 512) self = 512; +} #if 0 - { "in_aimmode", "0:toggle, 1:hold to aim", (void *)&gMouseAiming, CVAR_BOOL, 0, 1 }, // DN3D static osdcvardata_t cvars_game[] = { - "in_mousebias", "emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time", - (void *)&ud.config.MouseBias, CVAR_INT, 0, 32 - }, - { "in_mousedeadzone", "amount of mouse movement to filter out", (void *)&ud.config.MouseDeadZone, CVAR_INT, 0, 512 }, { "in_mouseflip", "invert vertical mouse movement", (void *)&ud.mouseflip, CVAR_BOOL, 0, 1 }, { "in_mousemode", "toggles vertical mouse view", (void *)&g_myAimMode, CVAR_BOOL, 0, 1 }, { "in_mousesmoothing", "enable/disable mouse input smoothing", (void *)&ud.config.SmoothInput, CVAR_BOOL, 0, 1 }, @@ -289,11 +296,6 @@ CVARD(Bool, in_aimmode, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "0:toggle, 1:hold static osdcvardata_t cvars_game[] = { - { - "in_mousebias", "emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time", - (void *)&ud.config.MouseBias, CVAR_INT, 0, 32 - }, - { "in_mousedeadzone", "amount of mouse movement to filter out", (void *)&ud.config.MouseDeadZone, CVAR_INT, 0, 512 }, { "in_mouseflip", "invert vertical mouse movement", (void *)&ud.mouseflip, CVAR_BOOL, 0, 1 }, { "in_mousemode", "toggles vertical mouse view", (void *)&g_myAimMode, CVAR_BOOL, 0, 1 }, { "in_mousesmoothing", "enable/disable mouse input smoothing", (void *)&ud.config.SmoothInput, CVAR_BOOL, 0, 1 }, @@ -342,11 +344,6 @@ int32_t registerosdcommands(void) char buffer[256]; static osdcvardata_t cvars_game[] = { - { - "in_mousebias", "emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time", - (void *)&MouseBias, CVAR_INT, 0, 32 - }, - { "in_mousedeadzone", "amount of mouse movement to filter out", (void *)&MouseDeadZone, CVAR_INT, 0, 512 }, { "in_mouseflip", "invert vertical mouse movement", (void *)&gMouseAimingFlipped, CVAR_BOOL, 0, 1 }, { "in_mousemode", "toggles vertical mouse view", (void *)&gMouseAim, CVAR_BOOL, 0, 1 }, { "in_mousesmoothing", "enable/disable mouse input smoothing", (void *)&SmoothInput, CVAR_BOOL, 0, 1 }, diff --git a/source/common/gamecvars.h b/source/common/gamecvars.h index 98104d486..9f38c4ac7 100644 --- a/source/common/gamecvars.h +++ b/source/common/gamecvars.h @@ -56,10 +56,13 @@ EXTERN_CVAR(Bool, hud_stats) EXTERN_CVAR(Bool, hud_showmapname) EXTERN_CVAR(Int, r_fov) -EXTERN_CVAR(r_horizcenter) +EXTERN_CVAR(Bool, r_horizcenter) -EXTERN_CVAR(in_joystick) -EXTERN_CVAR(in_mouse) +EXTERN_CVAR(Bool, in_joystick) +EXTERN_CVAR(Bool, in_mouse) +EXTERN_CVAR(Int, in_aimmode) +EXTERN_CVAR(Int, in_mousebias) +EXTERN_CVAR(Int, in_mousedeadzone) extern int hud_statusbarrange; // will be set by the game's configuration setup. bool G_ChangeHudLayout(int direction); diff --git a/source/duke3d/src/config.cpp b/source/duke3d/src/config.cpp index ede62b1ba..8abb0fa3c 100644 --- a/source/duke3d/src/config.cpp +++ b/source/duke3d/src/config.cpp @@ -243,8 +243,6 @@ void CONFIG_SetDefaults(void) ud.camerasprite = -1; ud.color = 0; ud.config.CheckForUpdates = 1; - ud.config.MouseBias = 0; - ud.config.MouseDeadZone = 0; ud.config.ShowWeapons = 0; ud.config.SmoothInput = 1; ud.config.useprecache = 1; diff --git a/source/duke3d/src/game.h b/source/duke3d/src/game.h index cd7082998..462acdb83 100644 --- a/source/duke3d/src/game.h +++ b/source/duke3d/src/game.h @@ -219,7 +219,6 @@ typedef struct { struct { int32_t AutoAim; int32_t ShowWeapons; - int32_t MouseDeadZone,MouseBias; int32_t SmoothInput; // JBF 20031211: Store the input settings because diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index 5d0754c99..5260d7156 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -2923,25 +2923,25 @@ void P_GetInput(int const playerNum) CONTROL_GetInput(&info); - if (ud.config.MouseDeadZone) + if (in_mousedeadzone) { if (info.mousey > 0) - info.mousey = max(info.mousey - ud.config.MouseDeadZone, 0); + info.mousey = max(info.mousey - in_mousedeadzone, 0); else if (info.mousey < 0) - info.mousey = min(info.mousey + ud.config.MouseDeadZone, 0); + info.mousey = min(info.mousey + in_mousedeadzone, 0); if (info.mousex > 0) - info.mousex = max(info.mousex - ud.config.MouseDeadZone, 0); + info.mousex = max(info.mousex - in_mousedeadzone, 0); else if (info.mousex < 0) - info.mousex = min(info.mousex + ud.config.MouseDeadZone, 0); + info.mousex = min(info.mousex + in_mousedeadzone, 0); } - if (ud.config.MouseBias) + if (in_mousebias) { if (klabs(info.mousex) > klabs(info.mousey)) - info.mousey = tabledivide32_noinline(info.mousey, ud.config.MouseBias); + info.mousey = tabledivide32_noinline(info.mousey, in_mousebias); else - info.mousex = tabledivide32_noinline(info.mousex, ud.config.MouseBias); + info.mousex = tabledivide32_noinline(info.mousex, in_mousebias); } // JBF: Run key behaviour is selectable diff --git a/source/rr/src/config.cpp b/source/rr/src/config.cpp index a766fb9c3..f1c89113d 100644 --- a/source/rr/src/config.cpp +++ b/source/rr/src/config.cpp @@ -212,8 +212,7 @@ void CONFIG_SetDefaults(void) ud.setup.bpp = 8; #endif ud.config.useprecache = 1; - ud.config.MouseBias = 0; - ud.config.MouseDeadZone = 0; + in_mousebias = 0; g_myAimMode = g_player[0].ps->aim_mode = 1; ud.config.ShowOpponentWeapons = 0; ud.config.SmoothInput = 1; diff --git a/source/rr/src/game.h b/source/rr/src/game.h index 35af6240d..abd134d45 100644 --- a/source/rr/src/game.h +++ b/source/rr/src/game.h @@ -194,7 +194,6 @@ typedef struct { struct { int32_t AutoAim; int32_t ShowOpponentWeapons; - int32_t MouseDeadZone,MouseBias; int32_t SmoothInput; // JBF 20031211: Store the input settings because diff --git a/source/rr/src/player.cpp b/source/rr/src/player.cpp index 25bcf7b54..4989e8e62 100644 --- a/source/rr/src/player.cpp +++ b/source/rr/src/player.cpp @@ -2773,25 +2773,25 @@ void P_GetInput(int playerNum) CONTROL_GetInput(&info); - if (ud.config.MouseDeadZone) + if (in_mousedeadzone) { if (info.mousey > 0) - info.mousey = max(info.mousey - ud.config.MouseDeadZone, 0); + info.mousey = max(info.mousey - in_mousedeadzone, 0); else if (info.mousey < 0) - info.mousey = min(info.mousey + ud.config.MouseDeadZone, 0); + info.mousey = min(info.mousey + in_mousedeadzone, 0); if (info.mousex > 0) - info.mousex = max(info.mousex - ud.config.MouseDeadZone, 0); + info.mousex = max(info.mousex - in_mousedeadzone, 0); else if (info.mousex < 0) - info.mousex = min(info.mousex + ud.config.MouseDeadZone, 0); + info.mousex = min(info.mousex + in_mousedeadzone, 0); } - if (ud.config.MouseBias) + if (in_mousebias) { if (klabs(info.mousex) > klabs(info.mousey)) - info.mousey = tabledivide32_noinline(info.mousey, ud.config.MouseBias); + info.mousey = tabledivide32_noinline(info.mousey, in_mousebias); else - info.mousex = tabledivide32_noinline(info.mousex, ud.config.MouseBias); + info.mousex = tabledivide32_noinline(info.mousex, in_mousebias); } // JBF: Run key behaviour is selectable @@ -3079,25 +3079,25 @@ void P_GetInputMotorcycle(int playerNum) CONTROL_GetInput(&info); - if (ud.config.MouseDeadZone) + if (in_mousedeadzone) { if (info.mousey > 0) - info.mousey = max(info.mousey - ud.config.MouseDeadZone, 0); + info.mousey = max(info.mousey - in_mousedeadzone, 0); else if (info.mousey < 0) - info.mousey = min(info.mousey + ud.config.MouseDeadZone, 0); + info.mousey = min(info.mousey + in_mousedeadzone, 0); if (info.mousex > 0) - info.mousex = max(info.mousex - ud.config.MouseDeadZone, 0); + info.mousex = max(info.mousex - in_mousedeadzone, 0); else if (info.mousex < 0) - info.mousex = min(info.mousex + ud.config.MouseDeadZone, 0); + info.mousex = min(info.mousex + in_mousedeadzone, 0); } - if (ud.config.MouseBias) + if (in_mousebias) { if (klabs(info.mousex) > klabs(info.mousey)) - info.mousey = tabledivide32_noinline(info.mousey, ud.config.MouseBias); + info.mousey = tabledivide32_noinline(info.mousey, in_mousebias); else - info.mousex = tabledivide32_noinline(info.mousex, ud.config.MouseBias); + info.mousex = tabledivide32_noinline(info.mousex, in_mousebias); } // JBF: Run key behaviour is selectable @@ -3377,25 +3377,25 @@ void P_GetInputBoat(int playerNum) CONTROL_GetInput(&info); - if (ud.config.MouseDeadZone) + if (in_mousedeadzone) { if (info.mousey > 0) - info.mousey = max(info.mousey - ud.config.MouseDeadZone, 0); + info.mousey = max(info.mousey - in_mousedeadzone, 0); else if (info.mousey < 0) - info.mousey = min(info.mousey + ud.config.MouseDeadZone, 0); + info.mousey = min(info.mousey + in_mousedeadzone, 0); if (info.mousex > 0) - info.mousex = max(info.mousex - ud.config.MouseDeadZone, 0); + info.mousex = max(info.mousex - in_mousedeadzone, 0); else if (info.mousex < 0) - info.mousex = min(info.mousex + ud.config.MouseDeadZone, 0); + info.mousex = min(info.mousex + in_mousedeadzone, 0); } - if (ud.config.MouseBias) + if (in_mousebias) { if (klabs(info.mousex) > klabs(info.mousey)) - info.mousey = tabledivide32_noinline(info.mousey, ud.config.MouseBias); + info.mousey = tabledivide32_noinline(info.mousey, in_mousebias); else - info.mousex = tabledivide32_noinline(info.mousex, ud.config.MouseBias); + info.mousex = tabledivide32_noinline(info.mousex, in_mousebias); } // JBF: Run key behaviour is selectable