- workaround for cl_autoaim not being set anymore.

Only for singleplayer for now, the network implementation for this flag leaves a lot to be desired.
This commit is contained in:
Christoph Oelckers 2020-02-16 21:31:29 +01:00
parent 40cbaf969c
commit 57a3f89105
4 changed files with 37 additions and 2 deletions

View file

@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h" #include "compat.h"
#include "baselayer.h" #include "baselayer.h"
#include "mmulti.h"
#include "gamecontrol.h" #include "gamecontrol.h"
#include "common_game.h" #include "common_game.h"
#include "blood.h" #include "blood.h"
@ -85,6 +86,12 @@ void ctrlGetInput(void)
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming); bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
if (!mouseaim) gInput.keyFlags.lookCenter = 1; if (!mouseaim) gInput.keyFlags.lookCenter = 1;
if (numplayers == 1)
{
gProfile[myconnectindex].nAutoAim = cl_autoaim;
gProfile[myconnectindex].nWeaponSwitch = cl_weaponswitch;
}
CONTROL_GetInput(&info); CONTROL_GetInput(&info);
if (gQuitRequest) if (gQuitRequest)

View file

@ -95,7 +95,6 @@ CUSTOM_CVARD(Int, cl_crosshairscale, 50, CVAR_ARCHIVE, "changes the size of the
CUSTOM_CVARD(Int, cl_autoaim, 1, CVAR_ARCHIVE|CVAR_USERINFO, "enable/disable weapon autoaim") CUSTOM_CVARD(Int, cl_autoaim, 1, CVAR_ARCHIVE|CVAR_USERINFO, "enable/disable weapon autoaim")
{ {
if (self < 0 || self > ((g_gameType & GAMEFLAG_BLOOD)? 2 : 3)) self = 1; // The Shadow Warrior backend only has a bool for this. if (self < 0 || self > ((g_gameType & GAMEFLAG_BLOOD)? 2 : 3)) self = 1; // The Shadow Warrior backend only has a bool for this.
//UpdatePlayerFromMenu(); todo: networking (only operational in EDuke32 frontend anyway.)
}; };
CUSTOM_CVARD(Int, cl_weaponswitch, 3, CVAR_ARCHIVE|CVAR_USERINFO, "enable/disable auto weapon switching") CUSTOM_CVARD(Int, cl_weaponswitch, 3, CVAR_ARCHIVE|CVAR_USERINFO, "enable/disable auto weapon switching")
@ -104,7 +103,6 @@ CUSTOM_CVARD(Int, cl_weaponswitch, 3, CVAR_ARCHIVE|CVAR_USERINFO, "enable/disabl
if (self > 1 && (g_gameType & GAMEFLAG_SW)) self = 1; if (self > 1 && (g_gameType & GAMEFLAG_SW)) self = 1;
if (self > 3 && (g_gameType & GAMEFLAG_BLOOD)) self = 3; if (self > 3 && (g_gameType & GAMEFLAG_BLOOD)) self = 3;
if (self > 7) self = 7; if (self > 7) self = 7;
//UpdatePlayerFromMenu(); todo: networking (only operational in EDuke32 frontend anyway.)
} }

View file

@ -2921,6 +2921,14 @@ void P_GetInput(int const playerNum)
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming); bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
if (numplayers == 1)
{
pPlayer->aim_mode = in_mousemode;
pPlayer->auto_aim = cl_autoaim;
pPlayer->weaponswitch = cl_weaponswitch;
}
CONTROL_GetInput(&info); CONTROL_GetInput(&info);
// JBF: Run key behaviour is selectable // JBF: Run key behaviour is selectable

View file

@ -3146,6 +3146,14 @@ void P_GetInput(int playerNum)
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming); bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
if (numplayers == 1)
{
pPlayer->aim_mode = in_mousemode;
pPlayer->auto_aim = cl_autoaim;
pPlayer->weaponswitch = cl_weaponswitch;
}
CONTROL_GetInput(&info); CONTROL_GetInput(&info);
@ -3420,6 +3428,13 @@ void P_GetInputMotorcycle(int playerNum)
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming); bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
if (numplayers == 1)
{
pPlayer->aim_mode = in_mousemode;
pPlayer->auto_aim = cl_autoaim;
pPlayer->weaponswitch = cl_weaponswitch;
}
CONTROL_GetInput(&info); CONTROL_GetInput(&info);
// JBF: Run key behaviour is selectable // JBF: Run key behaviour is selectable
@ -3685,6 +3700,13 @@ void P_GetInputBoat(int playerNum)
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming); bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
if (numplayers == 1)
{
pPlayer->aim_mode = in_mousemode;
pPlayer->auto_aim = cl_autoaim;
pPlayer->weaponswitch = cl_weaponswitch;
}
CONTROL_GetInput(&info); CONTROL_GetInput(&info);
// JBF: Run key behaviour is selectable // JBF: Run key behaviour is selectable