Add non cheat protected dvars to disable gamepad lockon and slowdown aim assists additionally to the cheat protected ones
This commit is contained in:
parent
7a64545f92
commit
67bfad3ae7
@ -170,6 +170,8 @@ namespace Components
|
|||||||
Dvar::Var Gamepad::gpad_button_rstick_deflect_max;
|
Dvar::Var Gamepad::gpad_button_rstick_deflect_max;
|
||||||
Dvar::Var Gamepad::gpad_button_lstick_deflect_max;
|
Dvar::Var Gamepad::gpad_button_lstick_deflect_max;
|
||||||
Dvar::Var Gamepad::gpad_use_hold_time;
|
Dvar::Var Gamepad::gpad_use_hold_time;
|
||||||
|
Dvar::Var Gamepad::gpad_lockon_enabled;
|
||||||
|
Dvar::Var Gamepad::gpad_slowdown_enabled;
|
||||||
Dvar::Var Gamepad::input_viewSensitivity;
|
Dvar::Var Gamepad::input_viewSensitivity;
|
||||||
Dvar::Var Gamepad::input_invertPitch;
|
Dvar::Var Gamepad::input_invertPitch;
|
||||||
Dvar::Var Gamepad::sv_allowAimAssist;
|
Dvar::Var Gamepad::sv_allowAimAssist;
|
||||||
@ -416,6 +418,23 @@ namespace Components
|
|||||||
return AimAssist_GetBestTarget(aaGlob, range, regionWidth, regionHeight);
|
return AimAssist_GetBestTarget(aaGlob, range, regionWidth, regionHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Gamepad::AimAssist_IsLockonActive(const int gamePadIndex)
|
||||||
|
{
|
||||||
|
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||||
|
auto& aaGlob = Game::aaGlobArray[gamePadIndex];
|
||||||
|
|
||||||
|
if (!aim_lockon_enabled.get<bool>() || !gpad_lockon_enabled.get<bool>())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (AimAssist_IsPlayerUsingOffhand(&aaGlob.ps))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (aaGlob.autoAimActive || aaGlob.autoMeleeState == Game::AIM_MELEE_STATE_UPDATING)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void Gamepad::AimAssist_ApplyLockOn(const Game::AimInput* input, Game::AimOutput* output)
|
void Gamepad::AimAssist_ApplyLockOn(const Game::AimInput* input, Game::AimOutput* output)
|
||||||
{
|
{
|
||||||
#ifdef AIM_ASSIST_ENABLED
|
#ifdef AIM_ASSIST_ENABLED
|
||||||
@ -427,7 +446,7 @@ namespace Components
|
|||||||
const auto prevTargetEnt = aaGlob.lockOnTargetEnt;
|
const auto prevTargetEnt = aaGlob.lockOnTargetEnt;
|
||||||
aaGlob.lockOnTargetEnt = Game::AIM_TARGET_INVALID;
|
aaGlob.lockOnTargetEnt = Game::AIM_TARGET_INVALID;
|
||||||
|
|
||||||
if (!aim_lockon_enabled.get<bool>() || AimAssist_IsPlayerUsingOffhand(&aaGlob.ps) || aaGlob.autoAimActive || aaGlob.autoMeleeState == Game::AIM_MELEE_STATE_UPDATING)
|
if (!AimAssist_IsLockonActive(input->localClientNum))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto* weaponDef = Game::BG_GetWeaponDef(aaGlob.ps.weapIndex);
|
const auto* weaponDef = Game::BG_GetWeaponDef(aaGlob.ps.weapIndex);
|
||||||
@ -510,7 +529,7 @@ namespace Components
|
|||||||
|
|
||||||
bool Gamepad::AimAssist_IsSlowdownActive(const Game::AimAssistPlayerState* ps)
|
bool Gamepad::AimAssist_IsSlowdownActive(const Game::AimAssistPlayerState* ps)
|
||||||
{
|
{
|
||||||
if (!aim_slowdown_enabled.get<bool>())
|
if (!aim_slowdown_enabled.get<bool>() || !gpad_slowdown_enabled.get<bool>())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!ps->weapIndex)
|
if (!ps->weapIndex)
|
||||||
@ -1669,6 +1688,8 @@ namespace Components
|
|||||||
gpad_button_lstick_deflect_max = Dvar::Register<float>("gpad_button_lstick_deflect_max", 1.0f, 0.0f, 1.0f, 0, "Game pad maximum pad stick pressed value");
|
gpad_button_lstick_deflect_max = Dvar::Register<float>("gpad_button_lstick_deflect_max", 1.0f, 0.0f, 1.0f, 0, "Game pad maximum pad stick pressed value");
|
||||||
gpad_button_rstick_deflect_max = Dvar::Register<float>("gpad_button_rstick_deflect_max", 1.0f, 0.0f, 1.0f, 0, "Game pad maximum pad stick pressed value");
|
gpad_button_rstick_deflect_max = Dvar::Register<float>("gpad_button_rstick_deflect_max", 1.0f, 0.0f, 1.0f, 0, "Game pad maximum pad stick pressed value");
|
||||||
gpad_use_hold_time = Dvar::Register<int>("gpad_use_hold_time", 250, 0, INT32_MAX, 0, "Time to hold the 'use' button on gamepads to activate use");
|
gpad_use_hold_time = Dvar::Register<int>("gpad_use_hold_time", 250, 0, INT32_MAX, 0, "Time to hold the 'use' button on gamepads to activate use");
|
||||||
|
gpad_lockon_enabled = Dvar::Register<bool>("gpad_lockon_enabled", true, Game::DVAR_FLAG_SAVED, "Game pad lockon aim assist enabled");
|
||||||
|
gpad_slowdown_enabled = Dvar::Register<bool>("gpad_slowdown_enabled", true, Game::DVAR_FLAG_SAVED, "Game pad slowdown aim assist enabled");
|
||||||
|
|
||||||
input_viewSensitivity = Dvar::Register<float>("input_viewSensitivity", 1.0f, 0.0001f, 5.0f, Game::DVAR_FLAG_SAVED, "View Sensitivity");
|
input_viewSensitivity = Dvar::Register<float>("input_viewSensitivity", 1.0f, 0.0001f, 5.0f, Game::DVAR_FLAG_SAVED, "View Sensitivity");
|
||||||
input_invertPitch = Dvar::Register<bool>("input_invertPitch", false, Game::DVAR_FLAG_SAVED, "Invert gamepad pitch");
|
input_invertPitch = Dvar::Register<bool>("input_invertPitch", false, Game::DVAR_FLAG_SAVED, "Invert gamepad pitch");
|
||||||
|
@ -299,6 +299,8 @@ namespace Components
|
|||||||
static Dvar::Var gpad_button_rstick_deflect_max;
|
static Dvar::Var gpad_button_rstick_deflect_max;
|
||||||
static Dvar::Var gpad_button_lstick_deflect_max;
|
static Dvar::Var gpad_button_lstick_deflect_max;
|
||||||
static Dvar::Var gpad_use_hold_time;
|
static Dvar::Var gpad_use_hold_time;
|
||||||
|
static Dvar::Var gpad_lockon_enabled;
|
||||||
|
static Dvar::Var gpad_slowdown_enabled;
|
||||||
static Dvar::Var input_viewSensitivity;
|
static Dvar::Var input_viewSensitivity;
|
||||||
static Dvar::Var input_invertPitch;
|
static Dvar::Var input_invertPitch;
|
||||||
static Dvar::Var sv_allowAimAssist;
|
static Dvar::Var sv_allowAimAssist;
|
||||||
@ -338,6 +340,7 @@ namespace Components
|
|||||||
static const Game::AimScreenTarget* AimAssist_GetBestTarget(const Game::AimAssistGlobals* aaGlob, float range, float regionWidth, float regionHeight);
|
static const Game::AimScreenTarget* AimAssist_GetBestTarget(const Game::AimAssistGlobals* aaGlob, float range, float regionWidth, float regionHeight);
|
||||||
static const Game::AimScreenTarget* AimAssist_GetTargetFromEntity(const Game::AimAssistGlobals* aaGlob, int entIndex);
|
static const Game::AimScreenTarget* AimAssist_GetTargetFromEntity(const Game::AimAssistGlobals* aaGlob, int entIndex);
|
||||||
static const Game::AimScreenTarget* AimAssist_GetPrevOrBestTarget(const Game::AimAssistGlobals* aaGlob, float range, float regionWidth, float regionHeight, int prevTargetEnt);
|
static const Game::AimScreenTarget* AimAssist_GetPrevOrBestTarget(const Game::AimAssistGlobals* aaGlob, float range, float regionWidth, float regionHeight, int prevTargetEnt);
|
||||||
|
static bool AimAssist_IsLockonActive(int gamePadIndex);
|
||||||
static void AimAssist_ApplyLockOn(const Game::AimInput* input, Game::AimOutput* output);
|
static void AimAssist_ApplyLockOn(const Game::AimInput* input, Game::AimOutput* output);
|
||||||
static void AimAssist_CalcAdjustedAxis(const Game::AimInput* input, float* pitchAxis, float* yawAxis);
|
static void AimAssist_CalcAdjustedAxis(const Game::AimInput* input, float* pitchAxis, float* yawAxis);
|
||||||
static bool AimAssist_IsSlowdownActive(const Game::AimAssistPlayerState* ps);
|
static bool AimAssist_IsSlowdownActive(const Game::AimAssistPlayerState* ps);
|
||||||
|
Loading…
Reference in New Issue
Block a user