From 76149e1b77f20dd2f08ac16efa2f490294806504 Mon Sep 17 00:00:00 2001 From: rei-2 <174158077+rei-2@users.noreply.github.com> Date: Sat, 10 Jan 2026 00:48:49 -0500 Subject: [PATCH] more consistent interpolated hitboxes --- .../Aimbot/AimbotGlobal/AimbotGlobal.cpp | 35 +++++++++++++------ .../AimbotProjectile/AimbotProjectile.cpp | 1 - .../EnginePrediction/EnginePrediction.h | 10 +++--- Amalgam/src/Features/Visuals/Visuals.h | 2 +- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp index eec08e31..fa415a4b 100644 --- a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp @@ -3,10 +3,11 @@ #include "../Aimbot.h" #include "../../Players/PlayerUtils.h" #include "../../Ticks/Ticks.h" +#include "../../EnginePrediction/EnginePrediction.h" std::vector CAimbotGlobal::ManageTargets(std::vector(*GetTargets)(CTFPlayer* pLocal, CTFWeaponBase* pWeapon), CTFPlayer* pLocal, CTFWeaponBase* pWeapon, int iMethod, int iMaxTargets) - { +{ auto vTargets = GetTargets(pLocal, pWeapon); SortTargetsPre(vTargets, iMethod); vTargets.resize(std::min(size_t(iMaxTargets), vTargets.size())); @@ -16,8 +17,8 @@ std::vector CAimbotGlobal::ManageTargets(std::vector(*GetTar void CAimbotGlobal::SortTargetsPre(std::vector& vTargets, int iMethod) { - switch (iMethod) - { + switch (iMethod) + { case Vars::Aimbot::General::TargetSelectionEnum::FOV: return std::sort(vTargets.begin(), vTargets.end(), [&](const Target_t& a, const Target_t& b) -> bool { @@ -29,7 +30,7 @@ void CAimbotGlobal::SortTargetsPre(std::vector& vTargets, int iMethod) { return a.m_flDistTo < b.m_flDistTo; }); - } + } } void CAimbotGlobal::SortTargetsPost(std::vector& vTargets, int iMethod) @@ -40,11 +41,9 @@ void CAimbotGlobal::SortTargetsPost(std::vector& vTargets, int iMethod return std::sort(vTargets.begin(), vTargets.end(), [&](const Target_t& a, const Target_t& b) -> bool { return a.m_flFOVTo < b.m_flFOVTo; - }); -} + }); + } -void CAimbotGlobal::SortPriority(std::vector& vTargets) -{ // Sort by priority std::sort(vTargets.begin(), vTargets.end(), [&](const Target_t& a, const Target_t& b) -> bool { return a.m_nPriority > b.m_nPriority; @@ -54,8 +53,24 @@ void CAimbotGlobal::SortPriority(std::vector& vTargets) // this won't prevent shooting bones outside of fov bool CAimbotGlobal::PlayerBoneInFOV(CTFPlayer* pTarget, Vec3 vLocalPos, Vec3 vLocalAngles, float& flFOVTo, Vec3& vPos, Vec3& vAngleTo, int iHitboxes) { - matrix3x4 aBones[MAXSTUDIOBONES]; - if (!pTarget->SetupBones(aBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, I::GlobalVars->curtime)) + matrix3x4* aBones = F::Backtrack.GetBones(pTarget); + if (!Vars::Visuals::Removals::Interpolation.Value) + { + std::vector vRecords = {}; + if (F::Backtrack.GetRecords(pTarget, vRecords) && !vRecords.empty()) + { + float flLerp = Vars::Visuals::Removals::Lerp.Value ? 0.f : G::Lerp; + for (auto pRecord : vRecords) + { + if (F::EnginePrediction.m_flOldCurrentTime - pRecord->m_flSimTime > flLerp) + { + aBones = pRecord->m_aBones; + break; + } + } + } + } + if (!aBones) return false; float flMinFOV = 180.f; diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp index e7cf284d..c4066efb 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp @@ -5,7 +5,6 @@ #include "../../Simulation/ProjectileSimulation/ProjectileSimulation.h" #include "../../EnginePrediction/EnginePrediction.h" #include "../../Ticks/Ticks.h" -#include "../../Visuals/Visuals.h" #include "../AutoAirblast/AutoAirblast.h" //#define SPLASH_DEBUG1 // normal splash visualization diff --git a/Amalgam/src/Features/EnginePrediction/EnginePrediction.h b/Amalgam/src/Features/EnginePrediction/EnginePrediction.h index 0e47e2b3..6c78b9b5 100644 --- a/Amalgam/src/Features/EnginePrediction/EnginePrediction.h +++ b/Amalgam/src/Features/EnginePrediction/EnginePrediction.h @@ -20,13 +20,7 @@ private: void Simulate(CTFPlayer* pLocal, CUserCmd* pCmd); CMoveData m_MoveData = {}; - - int m_nOldTickCount = 0; - float m_flOldCurrentTime = 0.f; - float m_flOldFrameTime = 0.f; - DatamapRestore_t m_tLocal = {}; - std::unordered_map m_mRestore = {}; public: @@ -40,6 +34,10 @@ public: bool m_bInPrediction = false; + int m_nOldTickCount = 0; + float m_flOldCurrentTime = 0.f; + float m_flOldFrameTime = 0.f; + // localplayer use in net_update_end Vec3 m_vOrigin = {}; Vec3 m_vVelocity = {}; diff --git a/Amalgam/src/Features/Visuals/Visuals.h b/Amalgam/src/Features/Visuals/Visuals.h index 7fa0e4e8..0fbfcdac 100644 --- a/Amalgam/src/Features/Visuals/Visuals.h +++ b/Amalgam/src/Features/Visuals/Visuals.h @@ -3,7 +3,7 @@ #include -#define DEBUG_TEXT +//#define DEBUG_TEXT struct Projectile_t {