diff --git a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp index a3c85ea3..8304b5da 100644 --- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp @@ -2,6 +2,7 @@ #include "../../Backtrack/Backtrack.h" #include "../../Resolver/Resolver.h" +#include "../../TickHandler/TickHandler.h" #include "../../Visuals/Visuals.h" bool CAimbotHitscan::PlayerBoneInFOV(CTFPlayer* pTarget, Vec3 vLocalPos, Vec3 vLocalAngles, float& flFOVTo, Vec3& vPos, Vec3& vAngleTo) // this won't prevent shooting bones outside of fov @@ -315,9 +316,6 @@ int CAimbotHitscan::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* p return false; Vec3 vEyePos = pLocal->GetShootPos(), vPeekPos = {}; - float flSpread = pWeapon->GetWeaponSpread(); - if (flSpread) - vPeekPos = pLocal->GetShootPos() + pLocal->GetAbsVelocity() * TICKS_TO_TIME(-Vars::Aimbot::General::HitscanPeek.Value); const float flMaxRange = powf(GetMaxRange(pWeapon), 2.f); auto pModel = target.m_pEntity->GetModel(); @@ -353,6 +351,10 @@ int CAimbotHitscan::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* p } } + float flSpread = pWeapon->GetWeaponSpread(); + if (flSpread && Vars::Aimbot::General::HitscanPeek.Value) + vPeekPos = pLocal->GetShootPos() + pLocal->GetAbsVelocity() * TICKS_TO_TIME(-Vars::Aimbot::General::HitscanPeek.Value); + static int iPreferredTick = 0; // if we're doubletapping, we can't change viewangles so have a preferred tick to use if (!I::ClientState->chokedcommands) iPreferredTick = 0; @@ -374,6 +376,8 @@ int CAimbotHitscan::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* p int iReturn = false; for (auto& pTick : vRecords) { + bool bRunPeekCheck = flSpread && (Vars::Aimbot::General::PeekDTOnly.Value ? F::Ticks.GetTicks(pLocal) : true) && Vars::Aimbot::General::HitscanPeek.Value; + if (target.m_TargetType == ETargetType::PLAYER || target.m_TargetType == ETargetType::SENTRY) { auto boneMatrix = (matrix3x4*)(&pTick.BoneMatrix.BoneMatrix); @@ -459,11 +463,14 @@ int CAimbotHitscan::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* p Vec3 vForward = {}; Math::AngleVectors(vAngles, &vForward); - bool bPeekCheck = flSpread ? SDK::VisPos(pLocal, target.m_pEntity, vPeekPos, vTransformed) : true; - if (bPeekCheck) - flSpread = 0.f; // only use with a single hitbox + if (bRunPeekCheck) + { + bRunPeekCheck = false; + if (!SDK::VisPos(pLocal, target.m_pEntity, vPeekPos, vTransformed)) + goto nextTick; // if we can't hit our primary hitbox, don't bother + } - if (SDK::VisPos(pLocal, target.m_pEntity, vEyePos, vTransformed) && bPeekCheck) + if (SDK::VisPos(pLocal, target.m_pEntity, vEyePos, vTransformed)) { target.m_vAngleTo = vAngles; if (RayToOBB(vEyePos, vForward, vCenter, vMins, vMaxs, boneMatrix[pair.first->bone])) // for the time being, no vischecks against other hitboxes @@ -529,11 +536,14 @@ int CAimbotHitscan::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* p Vec3 vForward = {}; Math::AngleVectors(vAngles, &vForward); - bool bPeekCheck = flSpread ? SDK::VisPos(pLocal, target.m_pEntity, vPeekPos, vTransformed) : true; - if (bPeekCheck) - flSpread = 0.f; // only use with a single hitbox + if (bRunPeekCheck) + { + bRunPeekCheck = false; + if (!SDK::VisPos(pLocal, target.m_pEntity, vPeekPos, vTransformed)) + goto nextTick; // if we can't hit our primary hitbox, don't bother + } - if (SDK::VisPos(pLocal, target.m_pEntity, vEyePos, vTransformed) && bPeekCheck) + if (SDK::VisPos(pLocal, target.m_pEntity, vEyePos, vTransformed)) { target.m_vAngleTo = vAngles; if (RayToOBB(vEyePos, vForward, target.m_pEntity->m_vecOrigin(), vMins, vMaxs, transform)) // for the time being, no vischecks against other hitboxes @@ -546,6 +556,9 @@ int CAimbotHitscan::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* p } } } + + nextTick: + continue; } return iReturn; diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.cpp b/Amalgam/src/Features/ImGui/Menu/Menu.cpp index d276755f..8f2e8c10 100644 --- a/Amalgam/src/Features/ImGui/Menu/Menu.cpp +++ b/Amalgam/src/Features/ImGui/Menu/Menu.cpp @@ -152,7 +152,8 @@ void CMenu::MenuAimbot() { if (Section("debug## aimbot")) { - FSlider("hitscan peek", Vars::Aimbot::General::HitscanPeek, 0, 10); + FSlider("hitscan peek", Vars::Aimbot::General::HitscanPeek, 0, 5); + FToggle("hitscan peek", Vars::Aimbot::General::PeekDTOnly); // this should probably stay on if you want to be able to target hitboxes other than the highest priority one FSlider("offset## nospread", Vars::Aimbot::General::NoSpreadOffset, -5.f, 5.f, 1.f, "%.1f", FSlider_Precision); FSlider("average", Vars::Aimbot::General::NoSpreadAverage, 1, 25); } EndSection(); diff --git a/Amalgam/src/Hooks/CNetChan_SendNetMsg.cpp b/Amalgam/src/Hooks/CNetChan_SendNetMsg.cpp index 796829f3..0ce329a7 100644 --- a/Amalgam/src/Hooks/CNetChan_SendNetMsg.cpp +++ b/Amalgam/src/Hooks/CNetChan_SendNetMsg.cpp @@ -81,7 +81,7 @@ MAKE_HOOK(CNetChan_SendNetMsg, S::CNetChan_SendNetMsg(), bool, __fastcall, const int iCmdCount = pMsg->m_nNewCommands + pMsg->m_nBackupCommands - 3; if (iCmdCount > iAllowedNewCommands) { - SDK::Output("clc_Move", std::format("{:d} sent <{:d} | {:d}>, max was {:d}.", iCmdCount, pMsg->m_nNewCommands, pMsg->m_nBackupCommands, iAllowedNewCommands).c_str(), { 0, 222, 255, 255 }, Vars::Debug::Logging.Value); + SDK::Output("clc_Move", std::format("{:d} sent <{:d} | {:d}>, max was {:d}.", iCmdCount + 3, pMsg->m_nNewCommands, pMsg->m_nBackupCommands, iAllowedNewCommands).c_str(), { 255, 0, 0, 255 }); G::ShiftedTicks = G::ShiftedGoal -= iCmdCount - iAllowedNewCommands; F::Ticks.iDeficit = iCmdCount - iAllowedNewCommands; } diff --git a/Amalgam/src/SDK/Vars.h b/Amalgam/src/SDK/Vars.h index b72de297..4c6c6689 100644 --- a/Amalgam/src/SDK/Vars.h +++ b/Amalgam/src/SDK/Vars.h @@ -119,7 +119,8 @@ namespace Vars CVar(FOVCircle, true) CVar(NoSpread, false) - CVar(HitscanPeek, 3, NOSAVE) // debug + CVar(HitscanPeek, 1, NOSAVE) // debug + CVar(PeekDTOnly, true, NOSAVE) // debug CVar(NoSpreadOffset, 0.f, NOSAVE) // debug CVar(NoSpreadAverage, 5, NOSAVE) // debug SUBNAMESPACE_END(Global)