From f8331d7ac75b4883b2cb4443dc4473f6644db570 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Mon, 5 Aug 2024 01:42:24 +0200 Subject: [PATCH] Client: only run ADS per-optic when zoomed in Should only fire this code when zoomed in. --- src/game/client/c_player.cpp | 18 +++++++++--------- src/game/client/c_player.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/game/client/c_player.cpp b/src/game/client/c_player.cpp index 259a0f8f..d841af2c 100644 --- a/src/game/client/c_player.cpp +++ b/src/game/client/c_player.cpp @@ -20,7 +20,7 @@ void C_Player::CurveLook(C_Player* player, CInput::UserInput_t* input, float a3, float v12; // xmm11_4 float v13; // xmm14_4 float v14; // xmm15_4 - bool useActiveWeapon; // si + bool isZoomed; // si C_WeaponX* activeWeapon; // rax float v17; // xmm0_4 float v18; // xmm0_4 @@ -83,11 +83,11 @@ void C_Player::CurveLook(C_Player* player, CInput::UserInput_t* input, float a3, if (player->m_bZooming) { activeWeapon = C_BaseCombatCharacter__GetActiveWeapon(player); - useActiveWeapon = !activeWeapon || activeWeapon->m_modVars[3100]; + isZoomed = !activeWeapon || activeWeapon->m_modVars[3100]; } else { - useActiveWeapon = 0; + isZoomed = false; } v17 = fabs(v13); @@ -123,7 +123,7 @@ void C_Player::CurveLook(C_Player* player, CInput::UserInput_t* input, float a3, || (unsigned int)sub_14066D190(player) || C_Player__IsInTimeShift(player) || v11 > 0.050000001 - || !gamePadCustomEnabled && (unsigned int)C_Player__GetAimSpeed(player, useActiveWeapon) == 7 + || !gamePadCustomEnabled && (unsigned int)C_Player__GetAimSpeed(player, isZoomed) == 7 || (v19 = *(_QWORD*)&player->pl.lastPlayerView_angle.x, v70.z = player->pl.lastPlayerView_angle.z, *(_QWORD*)&v70.x = v19, *(float*)&v19 < -50.0) || sub_1405AD4E0(player) < FLT_EPSILON) { @@ -169,7 +169,7 @@ void C_Player::CurveLook(C_Player* player, CInput::UserInput_t* input, float a3, selectedGamePadLookCurve = 1; v33 = sub_1405B0BC0(player, input, 0); a5 = sub_1405B0BC0(player, input, 1); - customAimSpeed = C_Player__GetAimSpeed(player, useActiveWeapon); + customAimSpeed = C_Player__GetAimSpeed(player, isZoomed); v37 = *(_DWORD*)((unsigned int)(*dword_1423880E0) + *(_QWORD*)&player->gap_21a0[16]); bool v35 = m_bAutoAim_UnknownBool1B1; // r9 @@ -190,21 +190,21 @@ void C_Player::CurveLook(C_Player* player, CInput::UserInput_t* input, float a3, if (gamePadCustomEnabled) { - sub_1405AEA10(nullptr, useActiveWeapon, v37 == 1); + sub_1405AEA10(nullptr, isZoomed, v37 == 1); v38 = dword_16A2A1640; } else { if (v37 == 1) { - if (useActiveWeapon) + if (isZoomed) v39 = (char*)g_lookSensitivity_TitanZoomed; else v39 = (char*)g_lookSensitivity_Titan; } else { - v25 = !useActiveWeapon; + v25 = !isZoomed; v39 = (char*)g_lookSensitivity_Zoomed; if (v25) v39 = (char*)g_lookSensitivity; @@ -300,7 +300,7 @@ void C_Player::CurveLook(C_Player* player, CInput::UserInput_t* input, float a3, float adsScalar = 1.0f; - if (GamePad_UseAdvancedAdsScalarsPerScope() && pWeapon) + if (isZoomed && pWeapon && GamePad_UseAdvancedAdsScalarsPerScope()) { const float interpAmount = pWeapon->HasTargetZoomFOV() ? pWeapon->GetZoomFOVInterpAmount(g_ClientGlobalVariables->exactCurTime) diff --git a/src/game/client/c_player.h b/src/game/client/c_player.h index f9f74619..00ffbe22 100644 --- a/src/game/client/c_player.h +++ b/src/game/client/c_player.h @@ -356,14 +356,14 @@ inline float (*sub_1405AD4E0)(C_Player* player); inline QAngle* (*sub_1406257E0)(QAngle* angle, C_Player* player); inline void (*sub_1405B03A0)(CInput::UserInput_t* input, C_Player* player, QAngle* angle); inline float (*sub_1405B0BC0)(C_Player* player, CInput::UserInput_t* input, int a3); -inline void (*sub_1405AEA10)(void* a1, char a2, char a3); +inline void (*sub_1405AEA10)(void* a1, bool isZoomed, char a3); inline void (*sub_1405AF810)(C_Player* player, CInput::UserInput_t* input, __int64 a3, char a4, char a5, Vector3D* a6, QAngle* a7, QAngle* a8, float a9); inline C_BaseEntity* (*sub_1409DC4E0)(C_Player* player); inline float (*sub_1405D4300)(C_Player* player); inline QAngle* (*sub_1405AF1F0)(CInput::UserInput_t* a1, C_Player* a2, QAngle* a3, QAngle* a4, float a5, float a6, float a7, float a8, QAngle* a9); inline float (*C_Player__GetZoomFrac)(C_Player* thisptr); -inline int (*C_Player__GetAimSpeed)(C_Player* thisptr, bool useActiveWeapon); +inline int (*C_Player__GetAimSpeed)(C_Player* thisptr, bool isZoomed); inline bool (*C_Player__IsInTimeShift)(C_Player* thisptr); inline void (*C_Player__CurveLook)(C_Player* player, CInput::UserInput_t* input, float a3, float a4, float a5, int a6, float inputSampleFrametime, bool runAimAssist, JoyAngle_t* outAngles);