From be74d8dc90836af96bd0ccab9a3faf6bfa1bac0e Mon Sep 17 00:00:00 2001 From: rei-2 <174158077+rei-2@users.noreply.github.com> Date: Fri, 10 Apr 2026 23:18:22 -0400 Subject: [PATCH] underpredict lob angle shots by default fixes --- .../Aimbot/AimbotHitscan/AimbotHitscan.cpp | 24 +- .../Aimbot/AimbotHitscan/AimbotHitscan.h | 2 +- .../Aimbot/AimbotMelee/AimbotMelee.cpp | 29 +- .../Features/Aimbot/AimbotMelee/AimbotMelee.h | 2 +- .../AimbotProjectile/AimbotProjectile.cpp | 574 ++++++++++-------- .../AimbotProjectile/AimbotProjectile.h | 40 +- .../Aimbot/AutoAirblast/AutoAirblast.cpp | 8 +- .../Aimbot/AutoDetonate/AutoDetonate.cpp | 36 +- .../Aimbot/AutoDetonate/AutoDetonate.h | 10 +- .../Aimbot/AutoRocketJump/AutoRocketJump.cpp | 15 +- Amalgam/src/Features/ImGui/Menu/Menu.cpp | 18 +- .../NoSpreadProjectile/NoSpreadProjectile.cpp | 18 +- .../MovementSimulation/MovementSimulation.cpp | 34 +- .../ProjectileSimulation.cpp | 25 +- .../ProjectileSimulation.h | 7 +- Amalgam/src/Features/Visuals/Visuals.cpp | 14 +- Amalgam/src/Features/World/World.cpp | 2 +- Amalgam/src/SDK/Definitions/Types.h | 61 +- Amalgam/src/SDK/Globals.h | 1 + Amalgam/src/SDK/Helpers/Entities/Entities.h | 4 +- Amalgam/src/SDK/SDK.cpp | 19 +- Amalgam/src/SDK/SDK.h | 4 +- Amalgam/src/SDK/Vars.h | 11 +- Amalgam/src/Utils/Interfaces/Interfaces.h | 4 +- Amalgam/src/Utils/Math/Math.h | 35 +- 25 files changed, 542 insertions(+), 455 deletions(-) diff --git a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp index f0dfa9ae..f9cb5a87 100644 --- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp @@ -14,19 +14,19 @@ static inline std::vector GetTargets(CTFPlayer* pLocal, CTFWeaponBase* Vec3 vLocalAngles = I::EngineClient->GetViewAngles(); { - auto eGroupType = EntityEnum::Invalid; + auto eGroup = EntityEnum::Invalid; if (Vars::Aimbot::General::Target.Value & Vars::Aimbot::General::TargetEnum::Players) { - eGroupType = !F::AimbotGlobal.FriendlyFire() || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Team ? EntityEnum::PlayerEnemy : EntityEnum::PlayerAll; + eGroup = !F::AimbotGlobal.FriendlyFire() || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Team ? EntityEnum::PlayerEnemy : EntityEnum::PlayerAll; if (Vars::Aimbot::Hitscan::Modifiers.Value & Vars::Aimbot::Hitscan::ModifiersEnum::ExtinguishTeam && !F::AimbotGlobal.FriendlyFire() && SDK::AttribHookValue(0, "jarate_duration", pWeapon) > 0) - eGroupType = EntityEnum::PlayerAll; + eGroup = EntityEnum::PlayerAll; } if (pWeapon->GetWeaponID() == TF_WEAPON_MEDIGUN) - eGroupType = Vars::Aimbot::Healing::AutoHeal.Value ? EntityEnum::PlayerTeam : EntityEnum::Invalid; + eGroup = Vars::Aimbot::Healing::AutoHeal.Value ? EntityEnum::PlayerTeam : EntityEnum::Invalid; bool bHeal = pWeapon->GetWeaponID() == TF_WEAPON_MEDIGUN; - for (auto pEntity : H::Entities.GetGroup(eGroupType)) + for (auto pEntity : H::Entities.GetGroup(eGroup)) { if (F::AimbotGlobal.ShouldIgnore(pEntity, pLocal, pWeapon)) continue; @@ -656,7 +656,7 @@ bool CAimbotHitscan::Aim(Vec3 vCurAngle, Vec3 vToAngle, Vec3& vOut, int iMethod) } // assume angle calculated outside with other overload -void CAimbotHitscan::Aim(CUserCmd* pCmd, Vec3& vAngle, int iMethod) +void CAimbotHitscan::Aim(CUserCmd* pCmd, Vec3& vAngles, int iMethod) { bool bUnsure = F::Ticks.IsTimingUnsure(); switch (iMethod) @@ -667,20 +667,20 @@ void CAimbotHitscan::Aim(CUserCmd* pCmd, Vec3& vAngle, int iMethod) [[fallthrough]]; case Vars::Aimbot::General::AimTypeEnum::Smooth: case Vars::Aimbot::General::AimTypeEnum::Assistive: - pCmd->viewangles = vAngle; - I::EngineClient->SetViewAngles(vAngle); + pCmd->viewangles = vAngles; + I::EngineClient->SetViewAngles(vAngles); break; case Vars::Aimbot::General::AimTypeEnum::Silent: if (G::Attacking == 1 || bUnsure) { - SDK::FixMovement(pCmd, vAngle); - pCmd->viewangles = vAngle; + SDK::FixMovement(pCmd, vAngles); + pCmd->viewangles = vAngles; G::SilentAngles = true; } break; case Vars::Aimbot::General::AimTypeEnum::Locking: - SDK::FixMovement(pCmd, vAngle); - pCmd->viewangles = vAngle; + SDK::FixMovement(pCmd, vAngles); + pCmd->viewangles = vAngles; G::SilentAngles = true; } } diff --git a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.h b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.h index f8d31d9c..b8a13452 100644 --- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.h +++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.h @@ -10,7 +10,7 @@ private: int CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon); bool Aim(Vec3 vCurAngle, Vec3 vToAngle, Vec3& vOut, int iMethod = Vars::Aimbot::General::AimType.Value); - void Aim(CUserCmd* pCmd, Vec3& vAngle, int iMethod = Vars::Aimbot::General::AimType.Value); + void Aim(CUserCmd* pCmd, Vec3& vAngles, int iMethod = Vars::Aimbot::General::AimType.Value); bool ShouldFire(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, const Target_t& tTarget); Vec3 m_vEyePos = {}; diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp index 83e3caaa..148bfcd3 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp @@ -30,12 +30,12 @@ static inline std::vector GetTargets(CTFPlayer* pLocal, CTFWeaponBase* if (Vars::Aimbot::General::Target.Value & Vars::Aimbot::General::TargetEnum::Players) { - auto eGroupType = !F::AimbotGlobal.FriendlyFire() || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Team ? EntityEnum::PlayerEnemy : EntityEnum::PlayerAll; + auto eGroup = !F::AimbotGlobal.FriendlyFire() || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Team ? EntityEnum::PlayerEnemy : EntityEnum::PlayerAll; if (Vars::Aimbot::Melee::WhipTeam.Value && !F::AimbotGlobal.FriendlyFire() && SDK::AttribHookValue(0, "speed_buff_ally", pWeapon) > 0) - eGroupType = EntityEnum::PlayerAll; + eGroup = EntityEnum::PlayerAll; - for (auto pEntity : H::Entities.GetGroup(eGroupType)) + for (auto pEntity : H::Entities.GetGroup(eGroup)) { if (F::AimbotGlobal.ShouldIgnore(pEntity, pLocal, pWeapon)) continue; @@ -54,13 +54,13 @@ static inline std::vector GetTargets(CTFPlayer* pLocal, CTFWeaponBase* } { - auto eGroupType = EntityEnum::Invalid; + auto eGroup = EntityEnum::Invalid; if (Vars::Aimbot::General::Target.Value & Vars::Aimbot::General::TargetEnum::Building) - eGroupType = EntityEnum::BuildingEnemy; + eGroup = EntityEnum::BuildingEnemy; bool bWrench = pWeapon->GetWeaponID() == TF_WEAPON_WRENCH, bSapper = SDK::AttribHookValue(0, "set_dmg_apply_to_sapper", pWeapon); if (Vars::Aimbot::Healing::AutoRepair.Value && (bWrench || bSapper)) - eGroupType = eGroupType != EntityEnum::Invalid ? EntityEnum::BuildingAll : EntityEnum::BuildingTeam; - for (auto pEntity : H::Entities.GetGroup(eGroupType)) + eGroup = eGroup != EntityEnum::Invalid ? EntityEnum::BuildingAll : EntityEnum::BuildingTeam; + for (auto pEntity : H::Entities.GetGroup(eGroup)) { if (F::AimbotGlobal.ShouldIgnore(pEntity, pLocal, pWeapon)) continue; @@ -369,6 +369,7 @@ int CAimbotMelee::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pW tTarget.m_pEntity->m_vecMins() = pRecord->m_vMins + PLAYER_ORIGIN_COMPRESSION; tTarget.m_pEntity->m_vecMaxs() = pRecord->m_vMaxs - PLAYER_ORIGIN_COMPRESSION; + // possibly account melee bounds as well? tTarget.m_vPos = m_vEyePos.Clamp(pRecord->m_vOrigin + tTarget.m_pEntity->m_vecMins(), pRecord->m_vOrigin + tTarget.m_pEntity->m_vecMaxs()); if (Vars::Aimbot::Melee::AutoBackstab.Value && pWeapon->GetWeaponID() == TF_WEAPON_KNIFE) tTarget.m_vPos.x = pRecord->m_vOrigin.x, tTarget.m_vPos.y = pRecord->m_vOrigin.y; @@ -459,7 +460,7 @@ bool CAimbotMelee::Aim(Vec3 vCurAngle, Vec3 vToAngle, Vec3& vOut, int iMethod) } // assume angle calculated outside with other overload -void CAimbotMelee::Aim(CUserCmd* pCmd, Vec3& vAngle, int iMethod) +void CAimbotMelee::Aim(CUserCmd* pCmd, Vec3& vAngles, int iMethod) { bool bUnsure = F::Ticks.IsTimingUnsure(); switch (iMethod) @@ -470,20 +471,20 @@ void CAimbotMelee::Aim(CUserCmd* pCmd, Vec3& vAngle, int iMethod) [[fallthrough]]; case Vars::Aimbot::General::AimTypeEnum::Smooth: case Vars::Aimbot::General::AimTypeEnum::Assistive: - pCmd->viewangles = vAngle; - I::EngineClient->SetViewAngles(vAngle); + pCmd->viewangles = vAngles; + I::EngineClient->SetViewAngles(vAngles); break; case Vars::Aimbot::General::AimTypeEnum::Silent: if (G::Attacking == 1 || bUnsure) { - SDK::FixMovement(pCmd, vAngle); - pCmd->viewangles = vAngle; + SDK::FixMovement(pCmd, vAngles); + pCmd->viewangles = vAngles; G::PSilentAngles = true; } break; case Vars::Aimbot::General::AimTypeEnum::Locking: - SDK::FixMovement(pCmd, vAngle); - pCmd->viewangles = vAngle; + SDK::FixMovement(pCmd, vAngles); + pCmd->viewangles = vAngles; G::SilentAngles = true; } } diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h index d4527db4..d374c076 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h @@ -12,7 +12,7 @@ private: int CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon); bool Aim(Vec3 vCurAngle, Vec3 vToAngle, Vec3& vOut, int iMethod = Vars::Aimbot::General::AimType.Value); - void Aim(CUserCmd* pCmd, Vec3& vAngle, int iMethod = Vars::Aimbot::General::AimType.Value); + void Aim(CUserCmd* pCmd, Vec3& vAngles, int iMethod = Vars::Aimbot::General::AimType.Value); bool FindNearestBuildPoint(CBaseObject* pBuilding, CTFPlayer* pLocal, Vec3& vPoint); bool RunSapper(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp index 8e1b6a07..f95d42ac 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp @@ -25,23 +25,23 @@ static inline std::vector GetTargets(CTFPlayer* pLocal, CTFWeaponBase* const Vec3 vLocalAngles = I::EngineClient->GetViewAngles(); { - auto eGroupType = EntityEnum::Invalid; + auto eGroup = EntityEnum::Invalid; if (Vars::Aimbot::General::Target.Value & Vars::Aimbot::General::TargetEnum::Players) - eGroupType = !F::AimbotGlobal.FriendlyFire() || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Team ? EntityEnum::PlayerEnemy : EntityEnum::PlayerAll; + eGroup = !F::AimbotGlobal.FriendlyFire() || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Team ? EntityEnum::PlayerEnemy : EntityEnum::PlayerAll; switch (pWeapon->GetWeaponID()) { case TF_WEAPON_CROSSBOW: if (Vars::Aimbot::Healing::AutoArrow.Value) - eGroupType = eGroupType != EntityEnum::Invalid ? EntityEnum::PlayerAll : EntityEnum::PlayerTeam; + eGroup = eGroup != EntityEnum::Invalid ? EntityEnum::PlayerAll : EntityEnum::PlayerTeam; break; case TF_WEAPON_LUNCHBOX: if (Vars::Aimbot::Healing::AutoSandvich.Value) - eGroupType = EntityEnum::PlayerTeam; + eGroup = EntityEnum::PlayerTeam; break; } bool bHeal = pWeapon->GetWeaponID() == TF_WEAPON_CROSSBOW || pWeapon->GetWeaponID() == TF_WEAPON_LUNCHBOX; - for (auto pEntity : H::Entities.GetGroup(eGroupType)) + for (auto pEntity : H::Entities.GetGroup(eGroup)) { if (F::AimbotGlobal.ShouldIgnore(pEntity, pLocal, pWeapon)) continue; @@ -81,12 +81,12 @@ static inline std::vector GetTargets(CTFPlayer* pLocal, CTFWeaponBase* } { - auto eGroupType = EntityEnum::Invalid; + auto eGroup = EntityEnum::Invalid; if (Vars::Aimbot::General::Target.Value & Vars::Aimbot::General::TargetEnum::Building) - eGroupType = EntityEnum::BuildingEnemy; + eGroup = EntityEnum::BuildingEnemy; if (Vars::Aimbot::Healing::AutoRepair.Value && pWeapon->GetWeaponID() == TF_WEAPON_SHOTGUN_BUILDING_RESCUE) - eGroupType = eGroupType != EntityEnum::Invalid ? EntityEnum::BuildingAll : EntityEnum::BuildingTeam; - for (auto pEntity : H::Entities.GetGroup(eGroupType)) + eGroup = eGroup != EntityEnum::Invalid ? EntityEnum::BuildingAll : EntityEnum::BuildingTeam; + for (auto pEntity : H::Entities.GetGroup(eGroup)) { if (F::AimbotGlobal.ShouldIgnore(pEntity, pLocal, pWeapon)) continue; @@ -348,9 +348,9 @@ Directs_t CAimbotProjectile::GetDirects() return mDirects; auto& tTarget = *m_tInfo.m_pTarget; - byte iFlags = PointFlagsEnum::Regular; - if (Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::LobAngles) - iFlags |= PointFlagsEnum::Alternate; + uint8_t iFlags = PointFlagsEnum::Regular; + if (m_tInfo.m_flGravity && Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::LobAngles) + iFlags |= PointFlagsEnum::Lob; const Vec3 vMins = tTarget.m_pEntity->m_vecMins(), vMaxs = tTarget.m_pEntity->m_vecMaxs(); for (int i = 0; i < 3; i++) @@ -418,15 +418,15 @@ Splashes_t CAimbotProjectile::GetSplashes() return vSplashes; vSplashes.push_back(PointFlagsEnum::Regular); - if (Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::LobAngles) - vSplashes.push_back(PointFlagsEnum::Alternate); + if (m_tInfo.m_flGravity && Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::LobAngles) + vSplashes.push_back(PointFlagsEnum::Lob); return vSplashes; } static inline std::vector ComputePoints(float flRadius, int iSamples, bool bSphere) { - std::vector vPoints = { { Vec3(0.f, 0.f, -1.f) * flRadius} }; + std::vector vPoints = { { Vec3(0.f, 0.f, -1.f) * flRadius } }; if (bSphere) { @@ -475,13 +475,17 @@ static inline void HandleTrace(const Vec3& vPoint, std::vector& vPoints if (fCheckPointAir()) return; - if (fCheckPointTrace() && !(i % Vars::Aimbot::Projectile::SplashNormalSkip.Value)) + if (fCheckPointTrace()) +#ifndef SPLASH_DEBUG1 + vPoints.emplace_back(trace.endpos); +#else { vPoints.emplace_back(trace.endpos); -#ifdef SPLASH_DEBUG1 - DrawTrace(!bNormal, Vars::Colors::IndicatorGood.Value, trace); -#endif + DrawTrace(true, Vars::Colors::IndicatorGood.Value, trace); } + else + DrawTrace(false, Vars::Colors::IndicatorGood.Value, trace); +#endif // in if ((tInfo.m_vLocalEye - vTargetEye).Dot(vTargetEye - vPoint) > 0.f) @@ -503,12 +507,16 @@ static inline void HandleTrace(const Vec3& vPoint, std::vector& vPoints #endif if (fCheckPointTrace()) +#ifndef SPLASH_DEBUG1 + vPoints.emplace_back(trace.endpos); +#else { vPoints.emplace_back(trace.endpos); -#ifdef SPLASH_DEBUG1 - DrawTrace(!bNormal, Vars::Colors::IndicatorBad.Value, trace); -#endif + DrawTrace(true, Vars::Colors::IndicatorBad.Value, trace); } + else + DrawTrace(false, Vars::Colors::IndicatorBad.Value, trace); +#endif } static float s_flTotal = 0.f; @@ -516,10 +524,13 @@ static inline void HandleFace(const Face_t& tFace, std::vector& vPoints { float flRadiusSqr = powf(flRadius, 2); float flRadius2Sqr = flRadiusSqr * 4; + int nMask = MASK_SHOT; + if (F::ProjSim.m_pObj->m_dragCoefficient && F::ProjSim.m_pObj->m_angDragBasis) + nMask |= CONTENTS_DISPSOLID; for (int i = 0; ++i < tFace.m_vVertices.size() - 1;) { - const Vec3& vVertex1 = tFace.m_vVertices[0], & vVertex2 = tFace.m_vVertices[i], & vVertex3 = tFace.m_vVertices[i + 1]; + const Vec3& vVertex1 = tFace.m_vVertices[0], &vVertex2 = tFace.m_vVertices[i], &vVertex3 = tFace.m_vVertices[i + 1]; Vec3 vDir21 = vVertex2 - vVertex1, vDir31 = vVertex3 - vVertex1; float flArea = vDir21.Cross(vDir31).Length() / 2; @@ -550,7 +561,7 @@ static inline void HandleFace(const Face_t& tFace, std::vector& vPoints if (tFace.m_iType == FaceTypeEnum::Prop) vPoint += tFace.m_vNormal * DIST_EPSILON; - SDK::Trace(vPoint + tFace.m_vNormal * tInfo.m_flNormalOffset, vTargetEye, MASK_SHOT, &filter, &trace); + SDK::Trace(vPoint + tFace.m_vNormal * tInfo.m_flNormalOffset, vTargetEye, nMask, &filter, &trace); #ifdef SPLASH_DEBUG5 s_mTraceCount[__FUNCTION__": vispos"]++; #endif @@ -565,7 +576,7 @@ static inline void HandleFace(const Face_t& tFace, std::vector& vPoints } } -void CAimbotProjectile::SetupSplashPoints(Vec3& vOrigin, std::vector& vSplashPoints, byte iFlags) +void CAimbotProjectile::SetupSplashPoints(Vec3& vOrigin, std::vector& vSplashPoints, uint8_t iFlags) { vSplashPoints.clear(); @@ -630,7 +641,7 @@ void CAimbotProjectile::SetupSplashPoints(Vec3& vOrigin, std::vector& v else for (float r = 0; r < Vars::Aimbot::Projectile::SplashAirCount.Value; r++) vSplashPoints.emplace_back(vPoints[i] * r / Vars::Aimbot::Projectile::SplashAirCount.Value + vTargetCenter, PointTypeEnum::Air); } - return Vars::Aimbot::Projectile::SplashMode.Value == Vars::Aimbot::Projectile::SplashModeEnum::Face || !trace.DidHit(); + return Vars::Aimbot::Projectile::SplashMode.Value == Vars::Aimbot::Projectile::SplashModeEnum::Face && i || !trace.DidHit(); }; Vec3 vPoint = vPoints[i] + vTargetCenter; @@ -681,6 +692,9 @@ void CAimbotProjectile::SetupSplashPoints(Vec3& vOrigin, std::vector& v //#endif } } + + if (vSplashPoints.size() > 1) + std::shuffle(vSplashPoints.begin() + 1, vSplashPoints.end(), SDK::Random); #ifdef SPLASH_DEBUG3 for (auto& tSetup : vSplashPoints) @@ -688,9 +702,9 @@ void CAimbotProjectile::SetupSplashPoints(Vec3& vOrigin, std::vector& v #endif } -std::vector CAimbotProjectile::GetSplashPoints(Vec3 vOrigin, std::vector& vSplashPoints, int iSimTime, byte iFlags) +std::vector CAimbotProjectile::GetSplashPoints(Vec3 vOrigin, std::vector& vSplashPoints, int iSimTime, uint8_t iFlags, bool bFirst) { - std::vector> vPointDistances = {}; + std::vector vPoints = {}; m_tInfo.m_pTarget->m_vPos = vOrigin; Vec3 vTargetEye = vOrigin + m_tInfo.m_vTargetEye; @@ -705,14 +719,22 @@ std::vector CAimbotProjectile::GetSplashPoints(Vec3 vOrigin, std::vecto float flAirdetRadius = tf_sticky_airdet_radius->GetFloat(); flRadiusAirSqr = powf(m_tInfo.m_flRadius * Math::RemapVal(TICKS_TO_TIME(iSimTime), flLiveTime, flLiveTime + flRampTime, flAirdetRadius, 1.f), 2); } + bool bLob = iFlags & CalculateFlagsEnum::LobAngle; + int iTolerance = m_tInfo.m_bIgnoreTiming && bLob ? std::numeric_limits::max() : !m_tInfo.m_iArmTime ? 0 : -1; + int iLimit = !bFirst ? m_tInfo.m_iSplashRestrict : std::max(m_tInfo.m_iSplashRestrict, Vars::Aimbot::Projectile::SplashRestrictFirst.Value); + bool bSort = !bLob || !m_tInfo.m_bIgnoreTiming; for (auto it = vSplashPoints.begin(); it != vSplashPoints.end();) { Point_t tPoint = { it->m_vPoint, {}, it->m_iType }; - CalculateAngle(m_tInfo.m_vLocalEye, tPoint.m_vPoint, iSimTime, tPoint.m_tSolution, iFlags, !m_tInfo.m_iArmTime ? 0 : -1); + + CalculateAngle(m_tInfo.m_vLocalEye, tPoint.m_vPoint, iSimTime, tPoint.m_tSolution, iFlags, iTolerance); if (tPoint.m_tSolution.m_iCalculated != CalculateResultEnum::Good) { - ++it; + if (tPoint.m_tSolution.m_iCalculated == CalculateResultEnum::Bad) + it = vSplashPoints.erase(it); + else + ++it; continue; } else if (tPoint.m_iType == PointTypeEnum::Air && tPoint.m_tSolution.m_flTime < TICKS_TO_TIME(m_tInfo.m_iArmTime)) @@ -721,22 +743,22 @@ std::vector CAimbotProjectile::GetSplashPoints(Vec3 vOrigin, std::vecto continue; } - vPointDistances.emplace_back(tPoint, tPoint.m_vPoint.DistToSqr(vOrigin)); + vPoints.push_back(tPoint); it = vSplashPoints.erase(it); + if (!bSort && vPoints.size() == iLimit) + break; } + if (vPoints.empty()) + return vPoints; - std::sort(vPointDistances.begin(), vPointDistances.end(), [&](const auto& a, const auto& b) -> bool + if (bSort) { - return a.second < b.second; - }); - - std::vector vPoints = {}; - int iSplashCount = std::min( - m_tInfo.m_iArmTime && iSimTime == m_tInfo.m_iArmTime ? Vars::Aimbot::Projectile::SplashCountDirect.Value : m_tInfo.m_iSplashCount, - int(vPointDistances.size()) - ); - for (int i = 0; i < iSplashCount; i++) - vPoints.push_back(vPointDistances[i].first); + std::sort(vPoints.begin(), vPoints.end(), [&](const auto& a, const auto& b) -> bool + { + return a.m_vPoint.DistToSqr(vOrigin) < b.m_vPoint.DistToSqr(vOrigin); + }); + vPoints.resize(std::min(iLimit, int(vPoints.size()))); + } const Vec3 vOriginal = m_tInfo.m_pTarget->m_pEntity->GetAbsOrigin(); m_tInfo.m_pTarget->m_pEntity->SetAbsOrigin(vOrigin); @@ -791,70 +813,90 @@ static inline Vec3 PullPoint(const Vec3& vPoint, Vec3 vLocalPos, Info_t& tInfo, static inline float GetDrag(float flVelocity, ProjectileInfo* pInfo, int iFlags) { // stupid, would like not to hardcode magic values - if (!(iFlags & CalculateFlagsEnum::AccountDrag) || !F::ProjSim.m_pObj->m_dragCoefficient || !F::ProjSim.m_pObj->m_dragBasis) + if (!(iFlags & CalculateFlagsEnum::AccountDrag)) return 0.f; - if (Vars::Aimbot::Projectile::DragOverride.Value) - return Vars::Aimbot::Projectile::DragOverride.Value; + static float flLastVelocity = 0.f, flRegularDrag = 0.f, flLobDrag = 0.f; + if (flLastVelocity != flVelocity) + { + auto fGetDrag = [&](std::function fGetTypeDrag) + { + if (!F::ProjSim.m_pObj->m_dragCoefficient || !F::ProjSim.m_pObj->m_dragBasis) + return 0.f; - if (!(iFlags & CalculateFlagsEnum::AlternateAngle)) - { - switch (pInfo->m_uType) + if (Vars::Aimbot::Projectile::DragOverride.Value) + return Vars::Aimbot::Projectile::DragOverride.Value; + + return fGetTypeDrag(); + }; + auto fGetRegularDrag = [&]() { - case FNV1A::Hash32Const("models/weapons/w_models/w_grenade_grenadelauncher.mdl"): - if (!SDK::AttribHookValue(0, "grenade_no_spin", pInfo->m_pWeapon)) - return Math::RemapVal(flVelocity, 1217.f, k_flMaxVelocity, 0.120f, 0.200f); // 0.120 normal, 0.200 capped, 0.300 v3000 - else - return Math::RemapVal(flVelocity, 1217.f, k_flMaxVelocity, 0.060f, 0.085f); // 0.060 normal, 0.085 capped, 0.120 v3000 - case FNV1A::Hash32Const("models/weapons/w_models/w_cannonball.mdl"): - return Math::RemapVal(flVelocity, 1454.f, k_flMaxVelocity, 0.385f, 0.530f); // 0.385 normal, 0.530 capped, 0.790 v3000 - case FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb.mdl"): - return Math::RemapVal(flVelocity, 922.f, k_flMaxVelocity, 0.085f, 0.190f); // 0.085 low, 0.190 capped, 0.230 v2400 - case FNV1A::Hash32Const("models/workshop_partner/weapons/c_models/c_sd_cleaver/c_sd_cleaver.mdl"): - return 0.310f; - case FNV1A::Hash32Const("models/weapons/w_models/w_baseball.mdl"): - return 0.180f; - case FNV1A::Hash32Const("models/weapons/c_models/c_xms_festive_ornament.mdl"): - return 0.285f; - case FNV1A::Hash32Const("models/weapons/c_models/urinejar.mdl"): - case FNV1A::Hash32Const("models/workshop/weapons/c_models/c_madmilk/c_madmilk.mdl"): - case FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster.mdl"): - case FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster_milk.mdl"): - return 0.057f; - case FNV1A::Hash32Const("models/weapons/c_models/c_gascan/c_gascan.mdl"): - return 0.530f; - } - } - else - { - switch (pInfo->m_uType) + switch (pInfo->m_uType) + { + case FNV1A::Hash32Const("models/weapons/w_models/w_grenade_grenadelauncher.mdl"): + if (!SDK::AttribHookValue(0, "grenade_no_spin", pInfo->m_pWeapon)) + return Math::RemapVal(flVelocity, 1217.f, k_flMaxVelocity, 0.120f, 0.200f); // 0.120 normal, 0.200 capped, 0.300 v3000 + else + return Math::RemapVal(flVelocity, 1217.f, k_flMaxVelocity, 0.060f, 0.085f); // 0.060 normal, 0.085 capped, 0.120 v3000 + case FNV1A::Hash32Const("models/weapons/w_models/w_cannonball.mdl"): + return Math::RemapVal(flVelocity, 1454.f, k_flMaxVelocity, 0.385f, 0.530f); // 0.385 normal, 0.530 capped, 0.790 v3000 + case FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb.mdl"): + return Math::RemapVal(flVelocity, 922.f, k_flMaxVelocity, 0.090f, 0.190f); // 0.085 low, 0.190 capped, 0.230 v2400 + case FNV1A::Hash32Const("models/workshop_partner/weapons/c_models/c_sd_cleaver/c_sd_cleaver.mdl"): + return 0.310f; + case FNV1A::Hash32Const("models/weapons/w_models/w_baseball.mdl"): + return 0.180f; + case FNV1A::Hash32Const("models/weapons/c_models/c_xms_festive_ornament.mdl"): + return 0.285f; + case FNV1A::Hash32Const("models/weapons/c_models/urinejar.mdl"): + case FNV1A::Hash32Const("models/workshop/weapons/c_models/c_madmilk/c_madmilk.mdl"): + case FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster.mdl"): + case FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster_milk.mdl"): + return 0.057f; + case FNV1A::Hash32Const("models/weapons/c_models/c_gascan/c_gascan.mdl"): + return 0.530f; + } + return 0.f; + }; + auto fGetLobDrag = [&]() { - case FNV1A::Hash32Const("models/weapons/w_models/w_grenade_grenadelauncher.mdl"): - if (!SDK::AttribHookValue(0, "grenade_no_spin", pInfo->m_pWeapon)) - return Math::RemapVal(flVelocity, 1217.f, k_flMaxVelocity, 0.056f, 0.062f); - else - return Math::RemapVal(flVelocity, 1217.f, k_flMaxVelocity, 0.030f, 0.033f); - case FNV1A::Hash32Const("models/weapons/w_models/w_cannonball.mdl"): - return Math::RemapVal(flVelocity, 1454.f, k_flMaxVelocity, 0.099f, 0.092f); - case FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb.mdl"): - return Math::RemapVal(flVelocity, 922.f, k_flMaxVelocity, 0.048f, 0.060f); - case FNV1A::Hash32Const("models/workshop_partner/weapons/c_models/c_sd_cleaver/c_sd_cleaver.mdl"): - return 0.075f; - case FNV1A::Hash32Const("models/weapons/w_models/w_baseball.mdl"): - return 0.057f; - case FNV1A::Hash32Const("models/weapons/c_models/c_xms_festive_ornament.mdl"): - return 0.072f; - case FNV1A::Hash32Const("models/weapons/c_models/urinejar.mdl"): - case FNV1A::Hash32Const("models/workshop/weapons/c_models/c_madmilk/c_madmilk.mdl"): - case FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster.mdl"): - case FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster_milk.mdl"): - return 0.030f; - case FNV1A::Hash32Const("models/weapons/c_models/c_gascan/c_gascan.mdl"): - return 0.089f; - } + if (!(Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::LobAngles)) + return 0.f; + + switch (pInfo->m_uType) + { + case FNV1A::Hash32Const("models/weapons/w_models/w_grenade_grenadelauncher.mdl"): + if (!SDK::AttribHookValue(0, "grenade_no_spin", pInfo->m_pWeapon)) + return Math::RemapVal(flVelocity, 1217.f, k_flMaxVelocity, 0.056f, 0.062f); + else + return Math::RemapVal(flVelocity, 1217.f, k_flMaxVelocity, 0.030f, 0.033f); + case FNV1A::Hash32Const("models/weapons/w_models/w_cannonball.mdl"): + return Math::RemapVal(flVelocity, 1454.f, k_flMaxVelocity, 0.099f, 0.092f); + case FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb.mdl"): + return Math::RemapVal(flVelocity, 922.f, k_flMaxVelocity, 0.048f, 0.060f); + case FNV1A::Hash32Const("models/workshop_partner/weapons/c_models/c_sd_cleaver/c_sd_cleaver.mdl"): + return 0.075f; + case FNV1A::Hash32Const("models/weapons/w_models/w_baseball.mdl"): + return 0.057f; + case FNV1A::Hash32Const("models/weapons/c_models/c_xms_festive_ornament.mdl"): + return 0.072f; + case FNV1A::Hash32Const("models/weapons/c_models/urinejar.mdl"): + case FNV1A::Hash32Const("models/workshop/weapons/c_models/c_madmilk/c_madmilk.mdl"): + case FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster.mdl"): + case FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster_milk.mdl"): + return 0.030f; + case FNV1A::Hash32Const("models/weapons/c_models/c_gascan/c_gascan.mdl"): + return 0.089f; + } + return 0.f; + }; + + flLastVelocity = flVelocity; + flRegularDrag = fGetDrag(fGetRegularDrag); + flLobDrag = fGetDrag(fGetLobDrag); } - return 0.f; + return !(iFlags & CalculateFlagsEnum::LobAngle) ? flRegularDrag : flLobDrag; } static inline bool GetAngle(const Vec3& vLocalPos, const Vec3& vTargetPos, int iFlags, Info_t& tInfo, float& flPitch, float& flYaw, float& flTime) @@ -877,7 +919,7 @@ static inline bool GetAngle(const Vec3& vLocalPos, const Vec3& vTargetPos, int i if (flRoot < 0.f) return false; - if (!(iFlags & CalculateFlagsEnum::AlternateAngle)) + if (!(iFlags & CalculateFlagsEnum::LobAngle)) flPitch = atan((powf(flVelocity, 2) - sqrt(flRoot)) / (flGrav * flDist)); else flPitch = atan((powf(flVelocity, 2) + sqrt(flRoot)) / (flGrav * flDist)); @@ -891,7 +933,7 @@ static inline bool GetAngle(const Vec3& vLocalPos, const Vec3& vTargetPos, int i if (flRoot < 0.f) return false; - if (!(iFlags & CalculateFlagsEnum::AlternateAngle)) + if (!(iFlags & CalculateFlagsEnum::LobAngle)) flPitch = atan((powf(flVelocity, 2) - sqrt(flRoot)) / (flGrav * flDist)); else flPitch = atan((powf(flVelocity, 2) + sqrt(flRoot)) / (flGrav * flDist)); @@ -910,7 +952,7 @@ static inline bool GetAngle(const Vec3& vLocalPos, const Vec3& vTargetPos, int i return true; } -void CAimbotProjectile::CalculateAngle(const Vec3& vLocalPos, const Vec3& vTargetPos, int iSimTime, Solution_t& tOut, byte iFlags, int iTolerance) +void CAimbotProjectile::CalculateAngle(const Vec3& vLocalPos, const Vec3& vTargetPos, int iSimTime, Solution_t& tOut, uint8_t iFlags, int iTolerance) { if (tOut.m_iCalculated != CalculateResultEnum::Pending) return; @@ -949,7 +991,7 @@ void CAimbotProjectile::CalculateAngle(const Vec3& vLocalPos, const Vec3& vTarge { if (Vars::Visuals::Trajectory::Override.Value) { - if (!Vars::Visuals::Trajectory::ForwardRedirect.Value) + if (Vars::Visuals::Trajectory::ForwardRedirect.Value) s_mTraceCount[__FUNCTION__": setup trace"]++; } else @@ -1031,17 +1073,17 @@ void CAimbotProjectile::CalculateAngle(const Vec3& vLocalPos, const Vec3& vTarge -bool CAimbotProjectile::TestAngle(const Vec3& vPoint, const Vec3& vAngles, int iSimTime, byte iType, bool bSecondTest) +bool CAimbotProjectile::TestAngle(const Vec3& vPoint, const Vec3& vAngles, int iSimTime, uint8_t iType, uint8_t iFlags, bool bSecondTest) { auto pLocal = m_tInfo.m_pLocal; auto pWeapon = m_tInfo.m_pWeapon; auto& tTarget = *m_tInfo.m_pTarget; - int iSimFlags = ProjSimEnum::Redirect | ProjSimEnum::InitCheck | ProjSimEnum::NoRandomAngles | ProjSimEnum::PredictCmdNum; + int iSimFlags = ProjSimEnum::Redirect | ProjSimEnum::InitCheck | ProjSimEnum::PredictCmdNum | (Vars::Aimbot::General::NoSpread.Value ? ProjSimEnum::CorrectRandomAngles : ProjSimEnum::NoRandomAngles); #ifdef SPLASH_DEBUG5 if (Vars::Visuals::Trajectory::Override.Value) { - if (!Vars::Visuals::Trajectory::ForwardRedirect.Value) + if (Vars::Visuals::Trajectory::ForwardRedirect.Value) s_mTraceCount[__FUNCTION__": setup trace"]++; } else @@ -1062,7 +1104,7 @@ bool CAimbotProjectile::TestAngle(const Vec3& vPoint, const Vec3& vAngles, int i s_mTraceCount[__FUNCTION__": setup trace"]++; } } - s_mTraceCount[__FUNCTION__": setup clip"]++; + s_mTraceCount[std::format(__FUNCTION__": setup clip ({}, {})", iType, iFlags)]++; #endif m_tProjInfo = {}; if (!F::ProjSim.GetInfo(pLocal, pWeapon, vAngles, m_tProjInfo, iSimFlags) @@ -1112,53 +1154,38 @@ bool CAimbotProjectile::TestAngle(const Vec3& vPoint, const Vec3& vAngles, int i G::BoxStorage.pop_back(); #endif - int iTimingTolerance = TIME_TO_TICKS(m_tInfo.m_flBoundingTime); + bool bDidHit = false; + Vec3 vNew = F::ProjSim.GetOrigin(); + int iTimingTolerance = TIME_TO_TICKS(m_tInfo.m_flBoundsTime); float flRadiusSqr = powf(m_tProjInfo.m_flVelocity * TICK_INTERVAL + m_tProjInfo.m_vHull.z, 2); + uint8_t iTraceInterval = iFlags == PointFlagsEnum::Lob ? Vars::Aimbot::Projectile::LobTraceInterval.Value + : iType != PointTypeEnum::Direct ? Vars::Aimbot::Projectile::SplashTraceInterval.Value + : Vars::Aimbot::Projectile::DirectTraceInterval.Value; - bool bDidHit = false, bArmTime = false; const RestoreInfo_t tOriginal = { tTarget.m_pEntity->GetAbsOrigin(), tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs() }; tTarget.m_pEntity->SetAbsOrigin(tTarget.m_vPos); tTarget.m_pEntity->m_vecMins() = { std::clamp(tTarget.m_pEntity->m_vecMins().x, -24.f, 0.f), std::clamp(tTarget.m_pEntity->m_vecMins().y, -24.f, 0.f), tTarget.m_pEntity->m_vecMins().z }; tTarget.m_pEntity->m_vecMaxs() = { std::clamp(tTarget.m_pEntity->m_vecMaxs().x, 0.f, 24.f), std::clamp(tTarget.m_pEntity->m_vecMaxs().y, 0.f, 24.f), tTarget.m_pEntity->m_vecMaxs().z }; for (int n = 1; n <= iSimTime; n++) { - Vec3 vOld = F::ProjSim.GetOrigin(); F::ProjSim.RunTick(m_tProjInfo); - Vec3 vNew = F::ProjSim.GetOrigin(); if (bDidHit) { - trace.endpos = vNew; + trace.endpos = F::ProjSim.GetOrigin(); continue; } + if (iTraceInterval != 1 && n % iTraceInterval && n != iSimTime) + continue; - if (iType == PointTypeEnum::Direct) - { - SDK::TraceHull(vOld, vNew, -m_tProjInfo.m_vHull, m_tProjInfo.m_vHull, nMask, &filter, &trace); + Vec3 vOld = vNew; vNew = F::ProjSim.GetOrigin(); + SDK::TraceHull(vOld, vNew, -m_tProjInfo.m_vHull, m_tProjInfo.m_vHull, nMask, &filter, &trace); #ifdef SPLASH_DEBUG5 - s_mTraceCount[__FUNCTION__": direct trace"]++; + s_mTraceCount[std::format(__FUNCTION__": trace ({})", iTraceInterval)]++; #endif #ifdef SPLASH_DEBUG4 - G::LineStorage.emplace_back(std::pair(vOld, trace.endpos), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 0)); + G::LineStorage.emplace_back(std::pair(vOld, trace.endpos), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 0)); #endif - } - else - { - static Vec3 vStaticPos = {}; - if (n == 1 || bArmTime) - vStaticPos = vOld; - if (n % Vars::Aimbot::Projectile::SplashTraceInterval.Value && n != iSimTime && !bArmTime) - continue; - - SDK::TraceHull(vStaticPos, vNew, -m_tProjInfo.m_vHull, m_tProjInfo.m_vHull, nMask, &filter, &trace); -#ifdef SPLASH_DEBUG5 - s_mTraceCount[__FUNCTION__": splash trace"]++; -#endif -#ifdef SPLASH_DEBUG4 - G::LineStorage.emplace_back(std::pair(vStaticPos, trace.endpos), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 0)); -#endif - vStaticPos = vNew; - } bool bHit = false; switch (iType) @@ -1218,9 +1245,10 @@ bool CAimbotProjectile::TestAngle(const Vec3& vPoint, const Vec3& vAngles, int i if (bValid) { - if (iType != PointTypeEnum::Direct) + if (iTraceInterval != 1 && iType != PointTypeEnum::Direct) { - int iPopCount = Vars::Aimbot::Projectile::SplashTraceInterval.Value - trace.fraction * Vars::Aimbot::Projectile::SplashTraceInterval.Value; + int iInterval = n % iTraceInterval ? n % iTraceInterval : iTraceInterval; + int iPopCount = ceilf(iInterval - trace.fraction * iInterval); for (int i = 0; i < iPopCount && !m_tProjInfo.m_vPath.empty(); i++) m_tProjInfo.m_vPath.pop_back(); } @@ -1265,12 +1293,15 @@ bool CAimbotProjectile::TestAngle(const Vec3& vPoint, const Vec3& vAngles, int i bDidHit = true; } - else if (iType == PointTypeEnum::Direct && bTarget && pWeapon->GetWeaponID() == TF_WEAPON_PIPEBOMBLAUNCHER) + else if (bTarget && iType == PointTypeEnum::Direct && m_tInfo.m_iArmTime) { // run for more ticks to check for splash - iSimTime = n + iTimingTolerance; + iSimTime = n + iTimingTolerance / 2; iType = PointTypeEnum::Geometry; - bArmTime = true; filter.pSkip = tTarget.m_pEntity; + filter.iPlayer = PLAYER_NONE; + filter.bMisc = false; + flRadiusSqr = std::numeric_limits::max(); + continue; } else break; @@ -1278,7 +1309,7 @@ bool CAimbotProjectile::TestAngle(const Vec3& vPoint, const Vec3& vAngles, int i if (iType == PointTypeEnum::Direct) trace.endpos = vNew; - if (!bTarget || iType != PointTypeEnum::Direct && !bArmTime) + if (!bTarget || iType != PointTypeEnum::Direct) break; } } @@ -1290,16 +1321,25 @@ bool CAimbotProjectile::TestAngle(const Vec3& vPoint, const Vec3& vAngles, int i return bDidHit; } -bool CAimbotProjectile::HandlePoint(const Vec3& vOrigin, int iSimTime, float flPitch, float flYaw, float flTime, const Vec3& vPoint, byte iType) +bool CAimbotProjectile::HandlePoint(const Vec3& vOrigin, int iSimTime, float flPitch, float flYaw, float flTime, const Vec3& vPoint, uint8_t iType, uint8_t iFlags) { bool bReturn = false; Vec3 vAngles; Aim(G::CurrentUserCmd->viewangles, { flPitch, flYaw, 0.f }, vAngles); m_tInfo.m_pTarget->m_vPos = vOrigin; + int iOriginalSimTime = iSimTime; + if (m_tInfo.m_iArmTime || m_tInfo.m_bIgnoreTiming && iFlags == PointFlagsEnum::Lob) + { + if (flTime > m_tProjInfo.m_flLifetime) + return false; + + iSimTime = std::ceil(flTime / I::GlobalVars->interval_per_tick); //TIME_TO_TICKS(flTime); + } + if (!m_tInfo.m_pProjectile - ? TestAngle(vPoint, vAngles, iSimTime, iType) - : TestAngle(m_tInfo.m_pProjectile, vPoint, vAngles, iSimTime, iType)) + ? TestAngle(vPoint, vAngles, iSimTime, iType, iFlags) + : TestAngle(m_tInfo.m_pProjectile, vPoint, vAngles, iSimTime, iType, iFlags)) { bReturn = m_iResult = true; m_flTimeTo = flTime + m_tInfo.m_flLatency; @@ -1324,13 +1364,13 @@ bool CAimbotProjectile::HandlePoint(const Vec3& vOrigin, int iSimTime, float flP if (bReturn && m_bUpdate) { m_vAngleTo = vAngles, m_vTarget = vPoint, m_vPredicted = vOrigin; - m_vPlayerPath.clear(); + m_vPlayerPath.clear(), m_vProjectilePath = m_tProjInfo.m_vPath; if (m_tMoveStorage.m_vPath.empty()) return true; - if (m_tInfo.m_iArmTime && iType == PointTypeEnum::Geometry) + if (m_tInfo.m_iArmTime && iType != PointTypeEnum::Air) { - int iCount = std::min(iSimTime + TIME_TO_TICKS(m_tInfo.m_flLatency) + 1, int(m_tMoveStorage.m_vPath.size())); + int iCount = std::min(iOriginalSimTime + TIME_TO_TICKS(m_tInfo.m_flLatency) + 1, int(m_tMoveStorage.m_vPath.size())); m_vPlayerPath.insert(m_vPlayerPath.end(), m_tMoveStorage.m_vPath.begin(), m_tMoveStorage.m_vPath.begin() + iCount); } else @@ -1339,7 +1379,6 @@ bool CAimbotProjectile::HandlePoint(const Vec3& vOrigin, int iSimTime, float flP m_vPlayerPath.insert(m_vPlayerPath.end(), m_tMoveStorage.m_vPath.begin(), m_tMoveStorage.m_vPath.begin() + iCount); m_vPredicted = m_vPlayerPath.back(); } - m_vProjectilePath = m_tProjInfo.m_vPath; } return bReturn; @@ -1347,51 +1386,59 @@ bool CAimbotProjectile::HandlePoint(const Vec3& vOrigin, int iSimTime, float flP bool CAimbotProjectile::HandleDirect(DirectHistory_t& mDirectHistory) { + bool bReturn = false; if (mDirectHistory.empty()) - return false; + return bReturn; - for (auto& vDirectHistory : mDirectHistory | std::views::values) + auto it = mDirectHistory.begin(); + uint8_t iType = it->first; + auto& vDirectHistory = it->second; + + std::sort(vDirectHistory.begin(), vDirectHistory.end(), [&](const Direct_t& a, const Direct_t& b) -> bool { - std::sort(vDirectHistory.begin(), vDirectHistory.end(), [&](const Direct_t& a, const Direct_t& b) -> bool - { - return a.m_iPriority < b.m_iPriority; - }); - m_flTimeTo = vDirectHistory.front().m_flTime + m_tInfo.m_flLatency; + return a.m_iPriority < b.m_iPriority; + }); + m_flTimeTo = vDirectHistory.front().m_flTime + m_tInfo.m_flLatency; - for (auto& tHistory : vDirectHistory) + for (auto& tHistory : vDirectHistory) + { + if (HandlePoint(tHistory.m_vOrigin, tHistory.m_iSimtime, tHistory.m_flPitch, tHistory.m_flYaw, tHistory.m_flTime, tHistory.m_vPoint, PointTypeEnum::Direct, iType)) { - if (HandlePoint(tHistory.m_vOrigin, tHistory.m_iSimtime, tHistory.m_flPitch, tHistory.m_flYaw, tHistory.m_flTime, tHistory.m_vPoint)) - return true; + bReturn = true; + break; } } - return false; + mDirectHistory.erase(it); + return bReturn; } bool CAimbotProjectile::HandleSplash(SplashHistory_t& mSplashHistory) { + bool bReturn = false; if (mSplashHistory.empty()) - return false; + return bReturn; - for (auto& [iType, vSplashHistory] : mSplashHistory) + auto it = mSplashHistory.begin(); + uint8_t iType = it->first; + auto& vSplashHistory = it->second; + + std::sort(vSplashHistory.begin(), vSplashHistory.end(), [&](const Splash_t& a, const Splash_t& b) -> bool + { + return a.m_flTimeTo < b.m_flTimeTo; + }); + uint8_t iFlags = CalculateFlagsEnum::None; + if (iType == PointFlagsEnum::Lob) + iFlags |= CalculateFlagsEnum::LobAngle; + SetupSplashPoints(vSplashHistory.front().m_vOrigin, m_vSplashPoints, iFlags); + if (!m_vSplashPoints.empty()) { - std::sort(vSplashHistory.begin(), vSplashHistory.end(), [&](const Splash_t& a, const Splash_t& b) -> bool - { - return a.m_flTimeTo < b.m_flTimeTo; - }); - byte iFlags = CalculateFlagsEnum::None; - if (iType == PointFlagsEnum::Alternate) - iFlags |= CalculateFlagsEnum::AlternateAngle; - SetupSplashPoints(vSplashHistory.front().m_vOrigin, m_vSplashPoints, iFlags); - if (m_vSplashPoints.empty()) - return false; - iFlags |= CalculateFlagsEnum::Accuracy; - float flLowestDistance = std::numeric_limits::max(); + float flLowestDistance = std::numeric_limits::max(); bool bFirst = true; for (auto& tHistory : vSplashHistory) { std::vector vSplashPoints = {}; - vSplashPoints = GetSplashPoints(tHistory.m_vOrigin, m_vSplashPoints, tHistory.m_iSimtime, iFlags); + vSplashPoints = GetSplashPoints(tHistory.m_vOrigin, m_vSplashPoints, tHistory.m_iSimtime, iFlags, bFirst); bFirst = false; for (auto& tPoint : vSplashPoints) { @@ -1399,16 +1446,19 @@ bool CAimbotProjectile::HandleSplash(SplashHistory_t& mSplashHistory) if (flDistance > flLowestDistance) continue; - if (HandlePoint(tHistory.m_vOrigin, tHistory.m_iSimtime, tPoint.m_tSolution.m_flPitch, tPoint.m_tSolution.m_flYaw, tPoint.m_tSolution.m_flTime, tPoint.m_vPoint, tPoint.m_iType)) + if (HandlePoint(tHistory.m_vOrigin, tHistory.m_iSimtime, tPoint.m_tSolution.m_flPitch, tPoint.m_tSolution.m_flYaw, tPoint.m_tSolution.m_flTime, tPoint.m_vPoint, tPoint.m_iType, iType)) + { + bReturn = true; flLowestDistance = flDistance; + } } + if (m_tInfo.m_bIgnoreTiming && iType == PointFlagsEnum::Lob) + break; } - - if (flLowestDistance != std::numeric_limits::max()) - return true; } - - return false; + + mSplashHistory.erase(it); + return bReturn; } int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, bool bUpdate) @@ -1440,10 +1490,10 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas m_tInfo.m_flOffsetTime = m_tInfo.m_vOffset.Length() / m_tInfo.m_flVelocity; // silly m_tInfo.m_flGravity = m_tProjInfo.m_flGravity; - m_tInfo.m_iSplashCount = !m_tInfo.m_flGravity ? Vars::Aimbot::Projectile::SplashCountDirect.Value : Vars::Aimbot::Projectile::SplashCountArc.Value; + m_tInfo.m_iSplashRestrict = !m_tInfo.m_flGravity ? Vars::Aimbot::Projectile::SplashRestrictDirect.Value : Vars::Aimbot::Projectile::SplashRestrictArc.Value; m_tInfo.m_flRadius = GetSplashRadius(pWeapon, pLocal, Vars::Aimbot::Projectile::SplashRadius.Value / 100); - m_tInfo.m_flRadiusTime = m_tInfo.m_flRadius / m_tInfo.m_flVelocity; - m_tInfo.m_flBoundingTime = m_tInfo.m_flRadiusTime + tTarget.m_pEntity->GetSize().Length() / m_tInfo.m_flVelocity; + m_tInfo.m_flBoundsTime = tTarget.m_pEntity->GetSize().Length() / m_tInfo.m_flVelocity; + m_tInfo.m_flRadiusTime = m_tInfo.m_flBoundsTime + m_tInfo.m_flRadius / m_tInfo.m_flVelocity; m_tInfo.m_iArmTime = TIME_TO_TICKS(ArmTime(pWeapon)); switch (pWeapon->GetWeaponID()) { @@ -1452,6 +1502,7 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas case TF_WEAPON_PARTICLE_CANNON: m_tInfo.m_flNormalOffset = 1.f; } + m_tInfo.m_bIgnoreTiming = Vars::Aimbot::Projectile::LobAnglesUnderpredict.Value && m_tInfo.m_flRadius; @@ -1474,8 +1525,11 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas for (auto& [iIndex, tOffset] : mDirects) { + if (m_tInfo.m_iArmTime && m_tInfo.m_iArmTime > i && !m_tMoveStorage.m_MoveData.m_vecVelocity.IsZero()) + break; + Vec3& vOffset = tOffset.m_vOffset; - byte iType = tOffset.m_iFlags & -tOffset.m_iFlags; + uint8_t iType = tOffset.m_iFlags & -tOffset.m_iFlags; Vec3 vPoint = tTarget.m_vPos + vOffset; if (Vars::Aimbot::Projectile::HuntsmanPullPoint.Value && tTarget.m_nAimedHitbox == HITBOX_HEAD) @@ -1485,26 +1539,29 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas vPoint.z = tTarget.m_vPos.z + vOffset.z; } - Solution_t tSolution; CalculateAngle(m_tInfo.m_vLocalEye, vPoint, i, tSolution); + uint8_t iFlags = CalculateFlagsEnum::Accuracy; + if (iType == PointFlagsEnum::Lob) + iFlags |= CalculateFlagsEnum::LobAngle; + int iTolerance = m_tInfo.m_bIgnoreTiming && iType == PointFlagsEnum::Lob ? std::numeric_limits::max() : -1; + + Solution_t tSolution; CalculateAngle(m_tInfo.m_vLocalEye, vPoint, i, tSolution, iFlags, iTolerance); switch (tSolution.m_iCalculated) { case CalculateResultEnum::Good: - if (m_tInfo.m_iArmTime && m_tInfo.m_iArmTime > i && !m_tMoveStorage.m_MoveData.m_vecVelocity.IsZero()) - break; mDirectHistory[iType].emplace_back(History_t(tTarget.m_vPos, i), tSolution.m_flPitch, tSolution.m_flYaw, tSolution.m_flTime, vPoint, iIndex); [[fallthrough]]; case CalculateResultEnum::Bad: tOffset.m_iFlags &= ~iType; - if (!(tOffset.m_iFlags /*& (PointFlagsEnum::Regular | PointFlagsEnum::Alternate)*/)) + if (!(tOffset.m_iFlags /*& (PointFlagsEnum::Regular | PointFlagsEnum::Lob)*/)) mDirects.erase(iIndex); } } for (auto it = vSplashes.begin(); it != vSplashes.end();) { - byte iFlags = CalculateFlagsEnum::AccountDrag; - if (*it == PointFlagsEnum::Alternate) - iFlags |= CalculateFlagsEnum::AlternateAngle; + uint8_t iFlags = CalculateFlagsEnum::AccountDrag; + if (!m_tInfo.m_bIgnoreTiming && *it == PointFlagsEnum::Lob) + iFlags |= CalculateFlagsEnum::LobAngle; Solution_t tSolution; CalculateAngle(m_tInfo.m_vLocalEye, tTarget.m_vPos, i, tSolution, iFlags); if (tSolution.m_iCalculated == CalculateResultEnum::Bad && mDirects.empty()) @@ -1514,12 +1571,12 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas } const float flTimeTo = tSolution.m_flTime - TICKS_TO_TIME(i); - if (flTimeTo > m_tInfo.m_flBoundingTime || m_tInfo.m_iArmTime && m_tInfo.m_iArmTime > i) + if (flTimeTo > m_tInfo.m_flRadiusTime || m_tInfo.m_iArmTime && m_tInfo.m_iArmTime > i) { ++it; continue; } - if (flTimeTo < -m_tInfo.m_flBoundingTime && (!m_tInfo.m_iArmTime || m_tInfo.m_iArmTime < i)) + if (flTimeTo < -m_tInfo.m_flRadiusTime && (!m_tInfo.m_iArmTime || m_tInfo.m_iArmTime < i)) { it = vSplashes.erase(it); continue; @@ -1534,21 +1591,14 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas } m_iResult = false, m_bUpdate = bUpdate; - switch (m_tInfo.m_flRadius ? Vars::Aimbot::Projectile::SplashPrediction.Value : Vars::Aimbot::Projectile::SplashPredictionEnum::Off) + if (!m_tInfo.m_flRadius || Vars::Aimbot::Projectile::SplashPrediction.Value < Vars::Aimbot::Projectile::SplashPredictionEnum::Prefer) + goto direct; + else + goto splash; + while (!mDirectHistory.empty() || !mSplashHistory.empty()) { - case Vars::Aimbot::Projectile::SplashPredictionEnum::Off: - HandleDirect(mDirectHistory); - break; - case Vars::Aimbot::Projectile::SplashPredictionEnum::Include: - if (!HandleDirect(mDirectHistory)) - HandleSplash(mSplashHistory); - break; - case Vars::Aimbot::Projectile::SplashPredictionEnum::Prefer: - if (!HandleSplash(mSplashHistory)) - HandleDirect(mDirectHistory); - break; - case Vars::Aimbot::Projectile::SplashPredictionEnum::Only: - HandleSplash(mSplashHistory); + direct: if (HandleDirect(mDirectHistory)) break; + splash: if (HandleSplash(mSplashHistory)) break; } F::MoveSim.Restore(m_tMoveStorage); if (!bUpdate) @@ -1631,7 +1681,7 @@ bool CAimbotProjectile::Aim(const Vec3& vCurAngle, const Vec3& vToAngle, Vec3& v } // assume angle calculated outside with other overload -void CAimbotProjectile::Aim(CUserCmd* pCmd, Vec3& vAngle, int iMethod) +void CAimbotProjectile::Aim(CUserCmd* pCmd, Vec3& vAngles, int iMethod) { bool bUnsure = F::Ticks.IsTimingUnsure(); switch (iMethod) @@ -1642,21 +1692,21 @@ void CAimbotProjectile::Aim(CUserCmd* pCmd, Vec3& vAngle, int iMethod) [[fallthrough]]; case Vars::Aimbot::General::AimTypeEnum::Smooth: case Vars::Aimbot::General::AimTypeEnum::Assistive: - pCmd->viewangles = vAngle; - I::EngineClient->SetViewAngles(vAngle); + pCmd->viewangles = vAngles; + I::EngineClient->SetViewAngles(vAngles); break; case Vars::Aimbot::General::AimTypeEnum::Silent: if (auto pWeapon = H::Entities.GetWeapon(); G::Attacking == 1 || bUnsure || pWeapon && pWeapon->GetWeaponID() == TF_WEAPON_FLAMETHROWER) { - SDK::FixMovement(pCmd, vAngle); - pCmd->viewangles = vAngle; + SDK::FixMovement(pCmd, vAngles); + pCmd->viewangles = vAngles; G::PSilentAngles = true; } break; case Vars::Aimbot::General::AimTypeEnum::Locking: - SDK::FixMovement(pCmd, vAngle); - pCmd->viewangles = vAngle; + SDK::FixMovement(pCmd, vAngles); + pCmd->viewangles = vAngles; G::SilentAngles = true; } } @@ -1959,7 +2009,7 @@ void CAimbotProjectile::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* // TestAngle and CanHit shares a bunch of code, possibly merge somehow -bool CAimbotProjectile::TestAngle(CBaseEntity* pProjectile, const Vec3& vPoint, Vec3& vAngles, int iSimTime, byte iType) +bool CAimbotProjectile::TestAngle(CBaseEntity* pProjectile, const Vec3& vPoint, Vec3& vAngles, int iSimTime, uint8_t iType, uint8_t iFlags) { auto pLocal = m_tInfo.m_pLocal; auto pWeapon = m_tInfo.m_pWeapon; @@ -2009,46 +2059,32 @@ bool CAimbotProjectile::TestAngle(CBaseEntity* pProjectile, const Vec3& vPoint, return false; } - int iTimingTolerance = TIME_TO_TICKS(m_tInfo.m_flBoundingTime); - float flRadiusSqr = powf(m_tProjInfo.m_flVelocity * TICK_INTERVAL + m_tProjInfo.m_vHull.z, 2); - bool bDidHit = false; + Vec3 vNew = F::ProjSim.GetOrigin(); + int iTimingTolerance = TIME_TO_TICKS(m_tInfo.m_flBoundsTime); + float flRadiusSqr = powf(m_tProjInfo.m_flVelocity * TICK_INTERVAL + m_tProjInfo.m_vHull.z, 2); + uint8_t iTraceInterval = iFlags == PointFlagsEnum::Lob ? Vars::Aimbot::Projectile::LobTraceInterval.Value + : iType != PointTypeEnum::Direct ? Vars::Aimbot::Projectile::SplashTraceInterval.Value + : Vars::Aimbot::Projectile::DirectTraceInterval.Value; + const RestoreInfo_t tOriginal = { tTarget.m_pEntity->GetAbsOrigin(), tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs() }; tTarget.m_pEntity->SetAbsOrigin(tTarget.m_vPos); tTarget.m_pEntity->m_vecMins() = { std::clamp(tTarget.m_pEntity->m_vecMins().x, -24.f, 0.f), std::clamp(tTarget.m_pEntity->m_vecMins().y, -24.f, 0.f), tTarget.m_pEntity->m_vecMins().z }; tTarget.m_pEntity->m_vecMaxs() = { std::clamp(tTarget.m_pEntity->m_vecMaxs().x, 0.f, 24.f), std::clamp(tTarget.m_pEntity->m_vecMaxs().y, 0.f, 24.f), tTarget.m_pEntity->m_vecMaxs().z }; for (int n = 1; n <= iSimTime; n++) { - Vec3 vOld = F::ProjSim.GetOrigin(); F::ProjSim.RunTick(m_tProjInfo); - Vec3 vNew = F::ProjSim.GetOrigin(); if (bDidHit) { - trace.endpos = vNew; + trace.endpos = F::ProjSim.GetOrigin(); continue; } + if (iTraceInterval != 1 && n % iTraceInterval && n != iSimTime) + continue; - switch (iType) - { - case PointTypeEnum::Direct: - { - SDK::TraceHull(vOld, vNew, -m_tProjInfo.m_vHull, m_tProjInfo.m_vHull, nMask, &filter, &trace); - break; - } - case PointTypeEnum::Geometry: - case PointTypeEnum::Air: - { - static Vec3 vStaticPos = {}; - if (n == 1) - vStaticPos = vOld; - if (n % Vars::Aimbot::Projectile::SplashTraceInterval.Value && n != iSimTime) - continue; - - SDK::TraceHull(vStaticPos, vNew, -m_tProjInfo.m_vHull, m_tProjInfo.m_vHull, nMask, &filter, &trace); - vStaticPos = vNew; - } - } + Vec3 vOld = vNew; vNew = F::ProjSim.GetOrigin(); + SDK::TraceHull(vOld, vNew, -m_tProjInfo.m_vHull, m_tProjInfo.m_vHull, nMask, &filter, &trace); bool bHit = false; switch (iType) @@ -2098,9 +2134,10 @@ bool CAimbotProjectile::TestAngle(CBaseEntity* pProjectile, const Vec3& vPoint, if (bValid) { - if (iType != PointTypeEnum::Direct) + if (iTraceInterval != 1 && iType != PointTypeEnum::Direct) { - int iPopCount = Vars::Aimbot::Projectile::SplashTraceInterval.Value - trace.fraction * Vars::Aimbot::Projectile::SplashTraceInterval.Value; + int iInterval = n % iTraceInterval ? n % iTraceInterval : iTraceInterval; + int iPopCount = ceilf(iInterval - trace.fraction * iInterval); for (int i = 0; i < iPopCount && !m_tProjInfo.m_vPath.empty(); i++) m_tProjInfo.m_vPath.pop_back(); } @@ -2162,12 +2199,13 @@ bool CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBa m_tInfo.m_flVelocity = m_tProjInfo.m_flVelocity; m_tInfo.m_flGravity = m_tProjInfo.m_flGravity; - m_tInfo.m_iSplashCount = !m_tInfo.m_flGravity ? Vars::Aimbot::Projectile::SplashCountDirect.Value : Vars::Aimbot::Projectile::SplashCountArc.Value; + m_tInfo.m_iSplashRestrict = !m_tInfo.m_flGravity ? Vars::Aimbot::Projectile::SplashRestrictDirect.Value : Vars::Aimbot::Projectile::SplashRestrictArc.Value; float flSize = tTarget.m_pEntity->GetSize().Length(); m_tInfo.m_flRadius = GetSplashRadius(pProjectile, m_tProjInfo.m_pWeapon, m_tProjInfo.m_pOwner, Vars::Aimbot::Projectile::SplashRadius.Value / 100, pWeapon); - m_tInfo.m_flRadiusTime = m_tInfo.m_flRadius / m_tInfo.m_flVelocity; - m_tInfo.m_flBoundingTime = m_tInfo.m_flRadiusTime + flSize / m_tInfo.m_flVelocity; + m_tInfo.m_flBoundsTime = tTarget.m_pEntity->GetSize().Length() / m_tInfo.m_flVelocity; + m_tInfo.m_flRadiusTime = m_tInfo.m_flBoundsTime + m_tInfo.m_flRadius / m_tInfo.m_flVelocity; + m_tInfo.m_bIgnoreTiming = Vars::Aimbot::Projectile::LobAnglesUnderpredict.Value && m_tInfo.m_flRadius; @@ -2191,7 +2229,7 @@ bool CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBa for (auto& [iIndex, tOffset] : mDirects) { Vec3& vOffset = tOffset.m_vOffset; - byte iType = tOffset.m_iFlags & -tOffset.m_iFlags; + uint8_t iType = tOffset.m_iFlags & -tOffset.m_iFlags; Vec3 vPoint = tTarget.m_vPos + vOffset; if (Vars::Aimbot::Projectile::HuntsmanPullPoint.Value && tTarget.m_nAimedHitbox == HITBOX_HEAD) @@ -2201,7 +2239,12 @@ bool CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBa vPoint.z = tTarget.m_vPos.z + vOffset.z; } - Solution_t tSolution; CalculateAngle(m_tInfo.m_vLocalEye, vPoint, i, tSolution); + uint8_t iFlags = CalculateFlagsEnum::Accuracy; + if (iType == PointFlagsEnum::Lob) + iFlags |= CalculateFlagsEnum::LobAngle; + int iTolerance = m_tInfo.m_bIgnoreTiming && iType == PointFlagsEnum::Lob ? std::numeric_limits::max() : -1; + + Solution_t tSolution; CalculateAngle(m_tInfo.m_vLocalEye, vPoint, i, tSolution, iFlags, iTolerance); switch (tSolution.m_iCalculated) { case CalculateResultEnum::Good: @@ -2209,18 +2252,18 @@ bool CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBa [[fallthrough]]; case CalculateResultEnum::Bad: tOffset.m_iFlags &= ~iType; - if (!(tOffset.m_iFlags /*& (PointFlagsEnum::Regular | PointFlagsEnum::Alternate)*/)) + if (!(tOffset.m_iFlags /*& (PointFlagsEnum::Regular | PointFlagsEnum::Lob)*/)) mDirects.erase(iIndex); } } for (auto it = vSplashes.begin(); it != vSplashes.end();) { - byte iFlags = CalculateFlagsEnum::AccountDrag; - if (*it == PointFlagsEnum::Alternate) - iFlags |= CalculateFlagsEnum::AlternateAngle; + uint8_t iFlags = CalculateFlagsEnum::AccountDrag; + if (!m_tInfo.m_bIgnoreTiming && *it == PointFlagsEnum::Lob) + iFlags |= CalculateFlagsEnum::LobAngle; - Solution_t tSolution; CalculateAngle(m_tInfo.m_vLocalEye, tTarget.m_vPos, i, tSolution, CalculateFlagsEnum::None); + Solution_t tSolution; CalculateAngle(m_tInfo.m_vLocalEye, tTarget.m_vPos, i, tSolution, iFlags); if (tSolution.m_iCalculated == CalculateResultEnum::Bad && mDirects.empty()) { it = vSplashes.erase(it); @@ -2228,12 +2271,12 @@ bool CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBa } const float flTimeTo = tSolution.m_flTime - TICKS_TO_TIME(i); - if (flTimeTo > m_tInfo.m_flBoundingTime) + if (flTimeTo > m_tInfo.m_flRadiusTime) { ++it; continue; } - if (flTimeTo < -m_tInfo.m_flBoundingTime) + if (flTimeTo < -m_tInfo.m_flRadiusTime) { it = vSplashes.erase(it); continue; @@ -2248,21 +2291,14 @@ bool CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBa } m_iResult = false, m_bUpdate = true; - switch (m_tInfo.m_flRadius ? Vars::Aimbot::Projectile::SplashPrediction.Value : Vars::Aimbot::Projectile::SplashPredictionEnum::Off) + if (!m_tInfo.m_flRadius || Vars::Aimbot::Projectile::SplashPrediction.Value < Vars::Aimbot::Projectile::SplashPredictionEnum::Prefer) + goto direct; + else + goto splash; + while (!mDirectHistory.empty() || !mSplashHistory.empty()) { - case Vars::Aimbot::Projectile::SplashPredictionEnum::Off: - HandleDirect(mDirectHistory); - break; - case Vars::Aimbot::Projectile::SplashPredictionEnum::Include: - if (!HandleDirect(mDirectHistory)) - HandleSplash(mSplashHistory); - break; - case Vars::Aimbot::Projectile::SplashPredictionEnum::Prefer: - if (!HandleSplash(mSplashHistory)) - HandleDirect(mDirectHistory); - break; - case Vars::Aimbot::Projectile::SplashPredictionEnum::Only: - HandleSplash(mSplashHistory); + direct: if (HandleDirect(mDirectHistory)) break; + splash: if (HandleSplash(mSplashHistory)) break; } F::MoveSim.Restore(m_tMoveStorage); diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h index 825d3e26..33fa522e 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h @@ -5,9 +5,9 @@ #include "../../Simulation/MovementSimulation/MovementSimulation.h" #include "../../Simulation/ProjectileSimulation/ProjectileSimulation.h" -Enum(PointFlags, None = 0, Regular = 1 << 0, Alternate = 1 << 1) +Enum(PointFlags, None = 0, Regular = 1 << 0, Lob = 1 << 1) Enum(PointType, Direct, Geometry, Air) -Enum(CalculateFlags, None = 0, TwoPass = 1 << 0, SetupClip = 1 << 1, AccountDrag = 1 << 2, AlternateAngle = 1 << 3, Accuracy = TwoPass | SetupClip | AccountDrag) +Enum(CalculateFlags, None = 0, TwoPass = 1 << 0, SetupClip = 1 << 1, AccountDrag = 1 << 2, LobAngle = 1 << 3, Accuracy = TwoPass | SetupClip | AccountDrag) Enum(CalculateResult, Pending, Good, Time, Bad) struct Info_t @@ -28,11 +28,12 @@ struct Info_t float m_flGravity = 0.f; float m_flRadius = 0.f; float m_flRadiusTime = 0.f; - float m_flBoundingTime = 0.f; + float m_flBoundsTime = 0.f; float m_flOffsetTime = 0.f; - int m_iSplashCount = 0; + int m_iSplashRestrict = 0; int m_iArmTime = 0; float m_flNormalOffset = 0.f; + bool m_bIgnoreTiming = false; }; #pragma pack(1) @@ -41,30 +42,29 @@ struct Solution_t float m_flPitch = 0.f; float m_flYaw = 0.f; float m_flTime = 0.f; - byte m_iCalculated = CalculateResultEnum::Pending; + uint8_t m_iCalculated = CalculateResultEnum::Pending; }; #pragma pack() struct Setup_t { Vec3 m_vPoint = {}; - byte m_iType = PointTypeEnum::Geometry; + uint8_t m_iType = PointTypeEnum::Geometry; }; struct Point_t { Vec3 m_vPoint = {}; Solution_t m_tSolution = {}; - byte m_iType = PointTypeEnum::Direct; + uint8_t m_iType = PointTypeEnum::Direct; }; struct Offset_t { Vec3 m_vOffset; - byte m_iType; - byte m_iFlags; + uint8_t m_iFlags; }; -using Directs_t = std::unordered_map; -using Splashes_t = std::vector; +using Directs_t = std::unordered_map; +using Splashes_t = std::vector; struct History_t { @@ -83,21 +83,21 @@ struct Splash_t : History_t { float m_flTimeTo; }; -using DirectHistory_t = std::unordered_map>; -using SplashHistory_t = std::unordered_map>; +using DirectHistory_t = std::unordered_map>; +using SplashHistory_t = std::unordered_map>; class CAimbotProjectile { private: Directs_t GetDirects(); Splashes_t GetSplashes(); - void SetupSplashPoints(Vec3& vOrigin, std::vector& vSplashPoints, byte iFlags = CalculateFlagsEnum::None); - std::vector GetSplashPoints(Vec3 vOrigin, std::vector& vSplashPoints, int iSimTime, byte iFlags = CalculateFlagsEnum::Accuracy); + void SetupSplashPoints(Vec3& vOrigin, std::vector& vSplashPoints, uint8_t iFlags = CalculateFlagsEnum::None); + std::vector GetSplashPoints(Vec3 vOrigin, std::vector& vSplashPoints, int iSimTime, uint8_t iFlags = CalculateFlagsEnum::Accuracy, bool bFirst = false); - void CalculateAngle(const Vec3& vLocalPos, const Vec3& vTargetPos, int iSimTime, Solution_t& tOut, byte iFlags = CalculateFlagsEnum::Accuracy, int iTolerance = -1); - bool TestAngle(const Vec3& vPoint, const Vec3& vAngles, int iSimTime, byte iType, bool bSecondTest = false); + void CalculateAngle(const Vec3& vLocalPos, const Vec3& vTargetPos, int iSimTime, Solution_t& tOut, uint8_t iFlags = CalculateFlagsEnum::Accuracy, int iTolerance = -1); + bool TestAngle(const Vec3& vPoint, const Vec3& vAngles, int iSimTime, uint8_t iType, uint8_t iFlags, bool bSecondTest = false); - bool HandlePoint(const Vec3& vOrigin, int iSimTime, float flPitch, float flYaw, float flTime, const Vec3& vPoint, byte iType = PointTypeEnum::Direct); + bool HandlePoint(const Vec3& vOrigin, int iSimTime, float flPitch, float flYaw, float flTime, const Vec3& vPoint, uint8_t iType = PointTypeEnum::Direct, uint8_t iFlags = PointFlagsEnum::Regular); bool HandleDirect(DirectHistory_t& vDirectHistory); bool HandleSplash(SplashHistory_t& vSplashHistory); @@ -105,10 +105,10 @@ private: bool RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); bool CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CBaseEntity* pProjectile); - bool TestAngle(CBaseEntity* pProjectile, const Vec3& vPoint, Vec3& vAngles, int iSimTime, byte iType); + bool TestAngle(CBaseEntity* pProjectile, const Vec3& vPoint, Vec3& vAngles, int iSimTime, uint8_t iType, uint8_t iFlags); bool Aim(const Vec3& vCurAngle, const Vec3& vToAngle, Vec3& vOut, int iMethod = Vars::Aimbot::General::AimType.Value); - void Aim(CUserCmd* pCmd, Vec3& vAngle, int iMethod = Vars::Aimbot::General::AimType.Value); + void Aim(CUserCmd* pCmd, Vec3& vAngles, int iMethod = Vars::Aimbot::General::AimType.Value); Info_t m_tInfo = {}; MoveStorage m_tMoveStorage = {}; diff --git a/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp b/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp index 4f929863..6735becf 100644 --- a/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp +++ b/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp @@ -82,14 +82,14 @@ void CAutoAirblast::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCm pProjectile->SetAbsOrigin(vOrigin); if (Vars::Aimbot::Projectile::AutoAirblast.Value & Vars::Aimbot::Projectile::AutoAirblastEnum::Redirect) { - Vec3 vAngle = Math::CalcAngle(vEyePos, vOrigin); - if (CanAirblastEntity(pLocal, pWeapon, pProjectile, vAngle)) + Vec3 vAngles = Math::CalcAngle(vEyePos, vOrigin); + if (CanAirblastEntity(pLocal, pWeapon, pProjectile, vAngles)) { bShouldBlast = true; if (!F::AimbotProjectile.AutoAirblast(pLocal, pWeapon, pCmd, pProjectile)) { - SDK::FixMovement(pCmd, vAngle); - pCmd->viewangles = vAngle; + SDK::FixMovement(pCmd, vAngles); + pCmd->viewangles = vAngles; G::PSilentAngles = true; } } diff --git a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp index ecba411e..56f0b042 100644 --- a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp +++ b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp @@ -26,9 +26,9 @@ void CAutoDetonate::RestorePlayers() m_mRestore.clear(); } -bool CAutoDetonate::GetRadius(EntityEnum::EntityEnum iGroup, CBaseEntity* pProjectile, float& flRadius, CTFWeaponBase*& pWeapon) +bool CAutoDetonate::GetRadius(EntityEnum::EntityEnum eGroup, CBaseEntity* pProjectile, float& flRadius, CTFWeaponBase*& pWeapon) { - if (iGroup == EntityEnum::LocalStickies) + if (eGroup == EntityEnum::LocalStickies) pWeapon = pProjectile->As()->m_hOriginalLauncher()->As(); else pWeapon = pProjectile->As()->m_hLauncher()->As(); @@ -39,7 +39,7 @@ bool CAutoDetonate::GetRadius(EntityEnum::EntityEnum iGroup, CBaseEntity* pProje return false; } - if (iGroup == EntityEnum::LocalStickies) + if (eGroup == EntityEnum::LocalStickies) { auto pPipebomb = pProjectile->As(); if (!pPipebomb->m_flCreationTime() || I::GlobalVars->curtime < pPipebomb->m_flCreationTime() + SDK::AttribHookValue(0.8f, "sticky_arm_time", pWeapon)) @@ -63,11 +63,11 @@ bool CAutoDetonate::GetRadius(EntityEnum::EntityEnum iGroup, CBaseEntity* pProje return true; } -Vec3 CAutoDetonate::GetOrigin(CBaseEntity* pProjectile, EntityEnum::EntityEnum iGroup, float flLatency) +Vec3 CAutoDetonate::GetOrigin(CBaseEntity* pProjectile, EntityEnum::EntityEnum eGroup, float flLatency) { Vec3 vOrigin = SDK::PredictOrigin(pProjectile->m_vecOrigin(), pProjectile->GetAbsVelocity(), flLatency); - if (iGroup == EntityEnum::LocalStickies) + if (eGroup == EntityEnum::LocalStickies) { // why is this even a thing? CGameTrace trace = {}; CTraceFilterWorldAndPropsOnly filter = {}; @@ -128,9 +128,9 @@ bool CAutoDetonate::CheckEntities(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUs return false; } -bool CAutoDetonate::CheckTargets(CTFPlayer* pLocal, EntityEnum::EntityEnum iGroup, float flRadiusScale, CUserCmd* pCmd) +bool CAutoDetonate::CheckTargets(CTFPlayer* pLocal, EntityEnum::EntityEnum eGroup, float flRadiusScale, CUserCmd* pCmd) { - auto& vProjectiles = H::Entities.GetGroup(iGroup); + auto& vProjectiles = H::Entities.GetGroup(eGroup); if (vProjectiles.empty()) return false; @@ -139,13 +139,13 @@ bool CAutoDetonate::CheckTargets(CTFPlayer* pLocal, EntityEnum::EntityEnum iGrou { float flRadius = flRadiusScale; CTFWeaponBase* pWeapon = nullptr; - if (!GetRadius(iGroup, pProjectile, flRadius, pWeapon)) + if (!GetRadius(eGroup, pProjectile, flRadius, pWeapon)) continue; PredictPlayers(pLocal, flLatency); - bool bCheck = CheckEntities(pLocal, pWeapon, nullptr, pProjectile, flRadius, GetOrigin(pProjectile, iGroup, flLatency)); + bool bCheck = CheckEntities(pLocal, pWeapon, nullptr, pProjectile, flRadius, GetOrigin(pProjectile, eGroup, flLatency)); PredictPlayers(pLocal, 0.f); - bCheck &= CheckEntities(pLocal, pWeapon, pCmd, pProjectile, flRadius, GetOrigin(pProjectile, iGroup)); + bCheck &= CheckEntities(pLocal, pWeapon, pCmd, pProjectile, flRadius, GetOrigin(pProjectile, eGroup)); RestorePlayers(); if (bCheck) return true; @@ -154,12 +154,12 @@ bool CAutoDetonate::CheckTargets(CTFPlayer* pLocal, EntityEnum::EntityEnum iGrou return false; } -bool CAutoDetonate::CheckSelf(CTFPlayer* pLocal, EntityEnum::EntityEnum iGroup) +bool CAutoDetonate::CheckSelf(CTFPlayer* pLocal, EntityEnum::EntityEnum eGroup) { if (!(Vars::Aimbot::Projectile::AutoDetonate.Value & Vars::Aimbot::Projectile::AutoDetonateEnum::PreventSelfDamage) || !pLocal->IsAlive() || pLocal->IsAGhost() || pLocal->IsInvulnerable()) return false; - auto& vProjectiles = H::Entities.GetGroup(iGroup); + auto& vProjectiles = H::Entities.GetGroup(eGroup); if (vProjectiles.empty()) return false; @@ -169,12 +169,12 @@ bool CAutoDetonate::CheckSelf(CTFPlayer* pLocal, EntityEnum::EntityEnum iGroup) { float flRadius = 1.f; CTFWeaponBase* pWeapon = nullptr; - if (!GetRadius(iGroup, pProjectile, flRadius, pWeapon)) + if (!GetRadius(eGroup, pProjectile, flRadius, pWeapon)) continue; PredictPlayers(pLocal, 0.f, true); - bool bCheck = CheckEntity(pLocal, pLocal, pWeapon, nullptr, pProjectile, flRadius, GetOrigin(pProjectile, iGroup, flLatency)) - && CheckEntity(pLocal, pLocal, pWeapon, nullptr, pProjectile, flRadius, GetOrigin(pProjectile, iGroup)); + bool bCheck = CheckEntity(pLocal, pLocal, pWeapon, nullptr, pProjectile, flRadius, GetOrigin(pProjectile, eGroup, flLatency)) + && CheckEntity(pLocal, pLocal, pWeapon, nullptr, pProjectile, flRadius, GetOrigin(pProjectile, eGroup)); RestorePlayers(); if (bCheck) return true; @@ -183,13 +183,13 @@ bool CAutoDetonate::CheckSelf(CTFPlayer* pLocal, EntityEnum::EntityEnum iGroup) return false; } -bool CAutoDetonate::Check(CTFPlayer* pLocal, CUserCmd* pCmd, EntityEnum::EntityEnum iGroup, int iFlag) +bool CAutoDetonate::Check(CTFPlayer* pLocal, CUserCmd* pCmd, EntityEnum::EntityEnum eGroup, int iFlag) { if (!(Vars::Aimbot::Projectile::AutoDetonate.Value & iFlag)) return false; - return CheckTargets(pLocal, iGroup, Vars::Aimbot::Projectile::AutodetRadius.Value / 100, pCmd) - && !CheckSelf(pLocal, iGroup); + return CheckTargets(pLocal, eGroup, Vars::Aimbot::Projectile::AutodetRadius.Value / 100, pCmd) + && !CheckSelf(pLocal, eGroup); } void CAutoDetonate::Run(CTFPlayer* pLocal, CUserCmd* pCmd) diff --git a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.h b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.h index e39d9446..7ef2dbef 100644 --- a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.h +++ b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.h @@ -9,12 +9,12 @@ class CAutoDetonate private: bool CheckEntity(CBaseEntity* pEntity, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, CBaseEntity* pProjectile, float flRadius, Vec3 vOrigin); bool CheckEntities(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, CBaseEntity* pProjectile, float flRadius, Vec3 vOrigin); - bool CheckTargets(CTFPlayer* pLocal, EntityEnum::EntityEnum iGroup, float flRadiusScale, CUserCmd* pCmd); - bool CheckSelf(CTFPlayer* pLocal, EntityEnum::EntityEnum iGroup); - bool Check(CTFPlayer* pLocal, CUserCmd* pCmd, EntityEnum::EntityEnum iGroup, int iFlag); + bool CheckTargets(CTFPlayer* pLocal, EntityEnum::EntityEnum eGroup, float flRadiusScale, CUserCmd* pCmd); + bool CheckSelf(CTFPlayer* pLocal, EntityEnum::EntityEnum eGroup); + bool Check(CTFPlayer* pLocal, CUserCmd* pCmd, EntityEnum::EntityEnum eGroup, int iFlag); - bool GetRadius(EntityEnum::EntityEnum iGroup, CBaseEntity* pProjectile, float& flRadius, CTFWeaponBase*& pWeapon); - Vec3 GetOrigin(CBaseEntity* pProjectile, EntityEnum::EntityEnum iGroup, float flLatency = 0.f); + bool GetRadius(EntityEnum::EntityEnum eGroup, CBaseEntity* pProjectile, float& flRadius, CTFWeaponBase*& pWeapon); + Vec3 GetOrigin(CBaseEntity* pProjectile, EntityEnum::EntityEnum eGroup, float flLatency = 0.f); void PredictPlayers(CTFPlayer* pLocal, float flLatency = 0.f, bool bLocal = false); void RestorePlayers(); diff --git a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp index bd3d8f0c..02be417d 100644 --- a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp +++ b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp @@ -146,22 +146,23 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p bool bMoveSimSetup = F::MoveSim.Initialize(pLocal, tMoveStorage, false); // do move sim after to not mess with proj sim if (bMoveSimSetup && bProjSimSetup) { - Vec3 vOriginal = F::ProjSim.GetOrigin(); int iSkip = bCurrGrounded ? Vars::Misc::Movement::AutoRocketJumpSkipGround.Value : Vars::Misc::Movement::AutoRocketJumpSkipAir.Value; + + CGameTrace trace = {}; + CTraceFilterCollideable filter = {}; + filter.pSkip = pLocal; + + Vec3 vNew = F::ProjSim.GetOrigin(); for (int n = 1; n < 10; n++) { F::MoveSim.RunTick(tMoveStorage); if (n <= iSkip || n == 1 && G::Reloading) continue; - Vec3 Old = F::ProjSim.GetOrigin(); F::ProjSim.RunTick(tProjInfo); - Vec3 New = F::ProjSim.GetOrigin(); - CGameTrace trace = {}; - CTraceFilterCollideable filter = {}; - filter.pSkip = pLocal; - SDK::Trace(Old, New, MASK_SOLID, &filter, &trace); + Vec3 vOld = vNew; vNew = F::ProjSim.GetOrigin(); + SDK::Trace(vOld, vNew, MASK_SOLID, &filter, &trace); if (trace.DidHit()) { if (!pLocal->IsOnGround() || pLocal->IsSwimming()) diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.cpp b/Amalgam/src/Features/ImGui/Menu/Menu.cpp index 81affb15..83ce15e6 100644 --- a/Amalgam/src/Features/ImGui/Menu/Menu.cpp +++ b/Amalgam/src/Features/ImGui/Menu/Menu.cpp @@ -303,9 +303,11 @@ void CMenu::MenuAimbot(int iTab) Divider(); FSlider(Vars::Aimbot::Projectile::VelocityAverageCount, FSliderEnum::Left); FSlider(Vars::Aimbot::Projectile::VerticalShift, FSliderEnum::Right); - FSlider(Vars::Aimbot::Projectile::DragOverride, FSliderEnum::Left); FSlider(Vars::Aimbot::Projectile::TimeOverride, FSliderEnum::Right); + FToggle(Vars::Aimbot::Projectile::LobAnglesUnderpredict); + + Divider(); FSlider(Vars::Aimbot::Projectile::HuntsmanLerp, FSliderEnum::Left); FSlider(Vars::Aimbot::Projectile::HuntsmanLerpLow, FSliderEnum::Right); FSlider(Vars::Aimbot::Projectile::HuntsmanAdd, FSliderEnum::Left); @@ -318,8 +320,6 @@ void CMenu::MenuAimbot(int iTab) FText("Splash"); Divider(H::Draw.Scale(8), H::Draw.Scale(-1)); FDropdown(Vars::Aimbot::Projectile::SplashMode); - FSlider(Vars::Aimbot::Projectile::SplashNormalSkip, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::SplashAirCount, FSliderEnum::Right, !Vars::Aimbot::Projectile::SplashAirCount[DEFAULT_BIND] ? "random" : "%i"); PushTransparent(Vars::Aimbot::Projectile::SplashMode.Value != Vars::Aimbot::Projectile::SplashModeEnum::Trace); { FSlider(Vars::Aimbot::Projectile::SplashPointsDirect, FSliderEnum::Left); @@ -335,9 +335,17 @@ void CMenu::MenuAimbot(int iTab) FSlider(Vars::Aimbot::Projectile::SplashSamplesCutoff); } PopTransparent(); - FSlider(Vars::Aimbot::Projectile::SplashCountDirect, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::SplashCountArc, FSliderEnum::Right); + FSlider(Vars::Aimbot::Projectile::SplashAirCount, FSliderEnum::None, !Vars::Aimbot::Projectile::SplashAirCount[DEFAULT_BIND] ? "random" : "%i"); + + Divider(); + FSlider(Vars::Aimbot::Projectile::SplashRestrictDirect); + FSlider(Vars::Aimbot::Projectile::SplashRestrictArc); + FSlider(Vars::Aimbot::Projectile::SplashRestrictFirst); + + Divider(); + FSlider(Vars::Aimbot::Projectile::DirectTraceInterval); FSlider(Vars::Aimbot::Projectile::SplashTraceInterval); + FSlider(Vars::Aimbot::Projectile::LobTraceInterval); Divider(); FText("Misc"); diff --git a/Amalgam/src/Features/NoSpread/NoSpreadProjectile/NoSpreadProjectile.cpp b/Amalgam/src/Features/NoSpread/NoSpreadProjectile/NoSpreadProjectile.cpp index 2e3a4da3..5697d992 100644 --- a/Amalgam/src/Features/NoSpread/NoSpreadProjectile/NoSpreadProjectile.cpp +++ b/Amalgam/src/Features/NoSpread/NoSpreadProjectile/NoSpreadProjectile.cpp @@ -35,19 +35,19 @@ void CNoSpreadProjectile::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCm for (int i = 0; i < 6; ++i) SDK::RandomFloat(); - Vec3 vAngAdd = pWeapon->GetSpreadAngles() - pLocal->EyeAngles(); + Vec3 vAngAdd = pLocal->EyeAngles() - pWeapon->GetSpreadAngles(); switch (pWeapon->GetWeaponID()) { case TF_WEAPON_COMPOUND_BOW: if (I::GlobalVars->curtime - pWeapon->As()->m_flChargeBeginTime() > TF_ARROW_MAX_CHARGE_TIME) { - vAngAdd.x += float(SDK::RandomInt()) / VALVE_RAND_MAX * 12.f - 6.f; - vAngAdd.y += float(SDK::RandomInt()) / VALVE_RAND_MAX * 12.f - 6.f; + vAngAdd.x -= float(SDK::RandomInt()) / VALVE_RAND_MAX * 12.f - 6.f; + vAngAdd.y -= float(SDK::RandomInt()) / VALVE_RAND_MAX * 12.f - 6.f; } break; case TF_WEAPON_SYRINGEGUN_MEDIC: - vAngAdd.x += SDK::RandomFloat(-1.5f, 1.5f); - vAngAdd.y += SDK::RandomFloat(-1.5f, 1.5f); + vAngAdd.x -= SDK::RandomFloat(-1.5f, 1.5f); + vAngAdd.y -= SDK::RandomFloat(-1.5f, 1.5f); break; case TF_WEAPON_GRENADELAUNCHER: case TF_WEAPON_CANNON: @@ -64,15 +64,17 @@ void CNoSpreadProjectile::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCm Vec3 vForward, vRight, vUp; Math::AngleVectors(pCmd->viewangles, &vForward, &vRight, &vUp); Vec3 vVelocity = vForward * flSpeed + vUp * 200.f; - Vec3 vNewVelocity = vVelocity + vUp * SDK::RandomFloat(-10.f, 10.f) + vRight * SDK::RandomFloat(-10.f, 10.f); + Vec3 vAdjusted = vVelocity + vUp * SDK::RandomFloat(-10.f, 10.f) + vRight * SDK::RandomFloat(-10.f, 10.f); - vAngAdd = Math::VectorAngles(vNewVelocity) - Math::VectorAngles(vVelocity); + vAngAdd -= Math::VectorAngles(vAdjusted) - Math::VectorAngles(vVelocity); } } if (!vAngAdd.IsZero()) { - pCmd->viewangles -= vAngAdd; + Vec3 vAngles = pCmd->viewangles + vAngAdd; + SDK::FixMovement(pCmd, vAngles); + pCmd->viewangles = vAngles; G::PSilentAngles = true; } } diff --git a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp index 8fb3db05..617e6f8e 100644 --- a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp +++ b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp @@ -3,8 +3,6 @@ #include "../../EnginePrediction/EnginePrediction.h" #include -static CUserCmd s_tDummyCmd = {}; - void CMovementSimulation::Store(MoveStorage& tMoveStorage) { auto pMap = tMoveStorage.m_pPlayer->GetPredDescMap(); @@ -65,11 +63,11 @@ static inline void HandleMovement(CTFPlayer* pPlayer, MoveData* pLastRecord, Mov if (pPlayer->InCond(TF_COND_SHIELD_CHARGE)) { - s_tDummyCmd.forwardmove = 450.f; - s_tDummyCmd.sidemove = 0.f; - SDK::FixMovement(&s_tDummyCmd, bLocal ? G::CurrentUserCmd->viewangles : pPlayer->GetEyeAngles(), {}); - tCurRecord.m_vDirection.x = s_tDummyCmd.forwardmove; - tCurRecord.m_vDirection.y = -s_tDummyCmd.sidemove; + G::DummyCmd.forwardmove = 450.f; + G::DummyCmd.sidemove = 0.f; + SDK::FixMovement(&G::DummyCmd, bLocal ? G::CurrentUserCmd->viewangles : pPlayer->GetEyeAngles(), {}); + tCurRecord.m_vDirection.x = G::DummyCmd.forwardmove; + tCurRecord.m_vDirection.y = -G::DummyCmd.sidemove; return; } @@ -204,7 +202,7 @@ bool CMovementSimulation::Initialize(CBaseEntity* pEntity, MoveStorage& tMoveSto // the hacks that make it work I::MoveHelper->SetHost(pPlayer); - pPlayer->m_pCurrentCommand() = &s_tDummyCmd; + pPlayer->m_pCurrentCommand() = &G::DummyCmd; if (auto pAvgVelocity = H::Entities.GetAvgVelocity(pPlayer->entindex())) pPlayer->m_vecVelocity() = *pAvgVelocity; // only use average velocity here @@ -323,13 +321,13 @@ bool CMovementSimulation::SetupMoveData(MoveStorage& tMoveStorage) auto& tRecord = vRecords.front(); if (!tRecord.m_vDirection.IsZero()) { - s_tDummyCmd.forwardmove = tRecord.m_vDirection.x; - s_tDummyCmd.sidemove = -tRecord.m_vDirection.y; - s_tDummyCmd.upmove = tRecord.m_vDirection.z; - SDK::FixMovement(&s_tDummyCmd, {}, tMoveStorage.m_MoveData.m_vecViewAngles); - tMoveStorage.m_MoveData.m_flForwardMove = s_tDummyCmd.forwardmove; - tMoveStorage.m_MoveData.m_flSideMove = s_tDummyCmd.sidemove; - tMoveStorage.m_MoveData.m_flUpMove = s_tDummyCmd.upmove; + G::DummyCmd.forwardmove = tRecord.m_vDirection.x; + G::DummyCmd.sidemove = -tRecord.m_vDirection.y; + G::DummyCmd.upmove = tRecord.m_vDirection.z; + SDK::FixMovement(&G::DummyCmd, {}, tMoveStorage.m_MoveData.m_vecViewAngles); + tMoveStorage.m_MoveData.m_flForwardMove = G::DummyCmd.forwardmove; + tMoveStorage.m_MoveData.m_flSideMove = G::DummyCmd.sidemove; + tMoveStorage.m_MoveData.m_flUpMove = G::DummyCmd.upmove; } } } @@ -670,9 +668,9 @@ void CMovementSimulation::RunTick(MoveStorage& tMoveStorage, bool bPath, RunTick && tMoveStorage.m_MoveData.m_vecVelocity.Length2D() > tMoveStorage.m_MoveData.m_flMaxSpeed * 0.015f) { Vec3 vDirection = tMoveStorage.m_MoveData.m_vecVelocity.Normalized2D() * 450.f; - s_tDummyCmd.forwardmove = vDirection.x, s_tDummyCmd.sidemove = -vDirection.y; - SDK::FixMovement(&s_tDummyCmd, {}, tMoveStorage.m_MoveData.m_vecViewAngles); - tMoveStorage.m_MoveData.m_flForwardMove = s_tDummyCmd.forwardmove, tMoveStorage.m_MoveData.m_flSideMove = s_tDummyCmd.sidemove; + G::DummyCmd.forwardmove = vDirection.x, G::DummyCmd.sidemove = -vDirection.y; + SDK::FixMovement(&G::DummyCmd, {}, tMoveStorage.m_MoveData.m_vecViewAngles); + tMoveStorage.m_MoveData.m_flForwardMove = G::DummyCmd.forwardmove, tMoveStorage.m_MoveData.m_flSideMove = G::DummyCmd.sidemove; } RestoreBounds(tMoveStorage.m_pPlayer); diff --git a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp index 7d50d3c8..36fb3804 100644 --- a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp +++ b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp @@ -1,6 +1,7 @@ #include "ProjectileSimulation.h" #include "../../EnginePrediction/EnginePrediction.h" +#include "../../NoSpread/NoSpreadProjectile/NoSpreadProjectile.h" #include "../../CritHack/CritHack.h" #include "../../Backtrack/Backtrack.h" @@ -18,14 +19,30 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap bool bMaxSpeed = iFlags & ProjSimEnum::MaxSpeed; bool bPredictCmdNum = iFlags & ProjSimEnum::PredictCmdNum; bool bNoRandomAngles = iFlags & ProjSimEnum::NoRandomAngles; + bool bCorrectRandomAngles = iFlags & ProjSimEnum::CorrectRandomAngles; Vec3 vPos, vAngle; + if (bCorrectRandomAngles) + { + int iOriginalAttacking = G::Attacking; + bool bOriginalSilent = G::PSilentAngles; + + G::DummyCmd.viewangles = vAngles; + G::DummyCmd.command_number = bPredictCmdNum ? F::CritHack.PredictCmdNum(pPlayer, pWeapon, G::CurrentUserCmd) : G::CurrentUserCmd->command_number; + G::Attacking = 1; + F::NoSpreadProjectile.Run(pPlayer, pWeapon, &G::DummyCmd); + vAngles = G::DummyCmd.viewangles; + + G::Attacking = iOriginalAttacking; + G::PSilentAngles = bOriginalSilent; + } + if (Vars::Visuals::Trajectory::Override.Value) { SDK::GetProjectileFireSetup(pPlayer, vAngles, { Vars::Visuals::Trajectory::OffsetX.Value, Vars::Visuals::Trajectory::OffsetY.Value, Vars::Visuals::Trajectory::OffsetZ.Value }, vPos, vAngle, bRedirect ? Vars::Visuals::Trajectory::ForwardRedirect.Value : 0.f, Vars::Visuals::Trajectory::ForwardCutoff.Value, bInterp); - auto uType = FNV1A::Hash32(Vars::Visuals::Trajectory::Type.Value.c_str()); + auto uType = FNV1A::Hash32Const("custom"); //FNV1A::Hash32(Vars::Visuals::Trajectory::Type.Value.c_str()); tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { Vars::Visuals::Trajectory::Hull.Value, Vars::Visuals::Trajectory::Hull.Value, Vars::Visuals::Trajectory::Hull.Value }, Vars::Visuals::Trajectory::Speed.Value, Vars::Visuals::Trajectory::Gravity.Value, Vars::Visuals::Trajectory::LifeTime.Value }; return true; } @@ -612,6 +629,9 @@ bool CProjectileSimulation::Initialize(ProjectileInfo& tProjInfo, bool bSimulate m_pEnv->ResetSimulationClock(); } + if (tProjInfo.m_uType == FNV1A::Hash32Const("custom")) + tProjInfo.m_uType = FNV1A::Hash32(Vars::Visuals::Trajectory::Type.Value.c_str()); + RunTick(tProjInfo, false); // simulate an initial time because dumb return true; @@ -619,9 +639,6 @@ bool CProjectileSimulation::Initialize(ProjectileInfo& tProjInfo, bool bSimulate void CProjectileSimulation::RunTick(ProjectileInfo& tProjInfo, bool bPath) // bug: per frame projectile trace can cause inconsistencies? { - if (!m_pEnv) - return; - if (bPath) tProjInfo.m_vPath.push_back(GetOrigin()); diff --git a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h index 42846b17..e06fca8c 100644 --- a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h +++ b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h @@ -6,9 +6,10 @@ Enum(ProjSim, Redirect = 1 << 0, // redirect and possibly trace when doing GetProjectileFireSetup InitCheck = 1 << 1, // validate starting position Interp = 1 << 2, // use interpolation - NoRandomAngles = 1 << 3, // don't do angle stuff for aimbot, nospread will pick that up - PredictCmdNum = 1 << 4, // use crithack to predict command number - MaxSpeed = 1 << 5 // default projectile speeds to their maximum + PredictCmdNum = 1 << 3, // use crithack to predict command number + MaxSpeed = 1 << 4, // default projectile speeds to their maximum + NoRandomAngles = 1 << 5, // don't do angle stuff for aimbot, nospread will pick that up + CorrectRandomAngles = 1 << 6 // or do, position matters ) #define GRENADE_CHECK_INTERVAL 0.195f diff --git a/Amalgam/src/Features/Visuals/Visuals.cpp b/Amalgam/src/Features/Visuals/Visuals.cpp index 423d3265..44660283 100644 --- a/Amalgam/src/Features/Visuals/Visuals.cpp +++ b/Amalgam/src/Features/Visuals/Visuals.cpp @@ -90,13 +90,14 @@ void CVisuals::ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const return; int iTicks = TIME_TO_TICKS(std::min(tProjInfo.m_flLifetime, 10.f)); + + Vec3 vNew = F::ProjSim.GetOrigin(); for (int n = 1; n <= iTicks; n++) { - Vec3 Old = F::ProjSim.GetOrigin(); F::ProjSim.RunTick(tProjInfo); - Vec3 New = F::ProjSim.GetOrigin(); - SDK::TraceHull(Old, New, -tProjInfo.m_vHull, tProjInfo.m_vHull, nMask, &filter, &trace); + Vec3 vOld = vNew; vNew = F::ProjSim.GetOrigin(); + SDK::TraceHull(vOld, vNew, -tProjInfo.m_vHull, tProjInfo.m_vHull, nMask, &filter, &trace); F::ProjSim.SetupTrace(filter, nMask, pWeapon, n, bInterp); if (trace.DidHit()) { @@ -924,13 +925,14 @@ void CVisuals::Store() F::ProjSim.SetupTrace(filter, nMask, pEntity); int iTicks = TIME_TO_TICKS(std::min(tProjInfo.m_flLifetime, 10.f)); + + Vec3 vNew = F::ProjSim.GetOrigin(); for (int n = 1; n <= iTicks; n++) { - Vec3 Old = F::ProjSim.GetOrigin(); F::ProjSim.RunTick(tProjInfo); - Vec3 New = F::ProjSim.GetOrigin(); - SDK::TraceHull(Old, New, -tProjInfo.m_vHull, tProjInfo.m_vHull, nMask, &filter, &trace); + Vec3 vOld = vNew; vNew = F::ProjSim.GetOrigin(); + SDK::TraceHull(vOld, vNew, -tProjInfo.m_vHull, tProjInfo.m_vHull, nMask, &filter, &trace); if (trace.DidHit()) { tProjectile.m_vNormal = trace.plane.normal; diff --git a/Amalgam/src/Features/World/World.cpp b/Amalgam/src/Features/World/World.cpp index 71d1d0d5..c43fedfd 100644 --- a/Amalgam/src/Features/World/World.cpp +++ b/Amalgam/src/Features/World/World.cpp @@ -512,7 +512,7 @@ void CWorld::DrawFace(const Face_t& tFace, int iFlags) const Vec3& vVertex1 = tFace.m_vVertices[i], &vVertex2 = tFace.m_vVertices[(i + 1) % tFace.m_vVertices.size()]; if (iFlags & DrawTypeEnum::Points) - G::BoxStorage.emplace_back(vVertex1, Vec3::Get(1), Vec3::Get(1), Vec3(0, 0, 0), I::GlobalVars->curtime + 60.f, Color_t(255, 0, 0), Color_t(0, 0, 0, 0), true); + G::BoxStorage.emplace_back(vVertex1, Vec3::Get(-1), Vec3::Get(1), Vec3(0, 0, 0), I::GlobalVars->curtime + 60.f, Color_t(255, 0, 0), Color_t(0, 0, 0, 0), true); if (iFlags & DrawTypeEnum::Edges) G::LineStorage.emplace_back(std::pair(vVertex1, vVertex2), I::GlobalVars->curtime + 60.f, Color_t(255, 0, 0), true); } diff --git a/Amalgam/src/SDK/Definitions/Types.h b/Amalgam/src/SDK/Definitions/Types.h index f347fa6f..c0c635f0 100644 --- a/Amalgam/src/SDK/Definitions/Types.h +++ b/Amalgam/src/SDK/Definitions/Types.h @@ -197,6 +197,11 @@ public: x = X; y = Y; } + inline Vec2 Pow(float flPower) const + { + return Vec2(powf(x, flPower), powf(y, flPower)); + } + inline float Min() const { return std::min(x, y); @@ -277,6 +282,23 @@ public: return (x * x + y * y); } + inline float Normalize() + { + float flLength = Length(); + float flLengthNormal = 1.f / (FLT_EPSILON + flLength); + + x *= flLengthNormal; + y *= flLengthNormal; + + return flLength; + } + + inline Vec2 Normalized() const + { + float flLengthNormal = 1.f / (FLT_EPSILON + Length()); + return Vec2(x * flLengthNormal, y * flLengthNormal); + } + inline float DistTo(const Vec2& v) const { return (*this - v).Length(); @@ -502,6 +524,16 @@ public: return { x, y }; } + inline Vec3 Get2D() const + { + return Vec3(x, y, 0); + } + + inline Vec3 Pow(float flPower) const + { + return Vec3(powf(x, flPower), powf(y, flPower), powf(z, flPower)); + } + inline float Min() const { return std::min(x, std::min(y, z)); @@ -582,6 +614,16 @@ public: return (x * x + y * y + z * z); } + inline float Length2D(void) const + { + return sqrtf(x * x + y * y); + } + + inline float Length2DSqr(void) const + { + return (x * x + y * y); + } + inline float Normalize() { float flLength = Length(); @@ -606,33 +648,18 @@ public: return flLength; } - inline Vec3 Normalized() + inline Vec3 Normalized() const { float flLengthNormal = 1.f / (FLT_EPSILON + Length()); return Vec3(x * flLengthNormal, y * flLengthNormal, z * flLengthNormal); } - inline Vec3 Normalized2D() + inline Vec3 Normalized2D() const { float flLengthNormal = 1.f / (FLT_EPSILON + Length2D()); return Vec3(x * flLengthNormal, y * flLengthNormal); } - inline Vec3 Get2D() - { - return Vec3(x, y, 0); - } - - inline float Length2D(void) const - { - return sqrtf(x * x + y * y); - } - - inline float Length2DSqr(void) const - { - return (x * x + y * y); - } - inline float DistTo(const Vec3& v) const { return (*this - v).Length(); diff --git a/Amalgam/src/SDK/Globals.h b/Amalgam/src/SDK/Globals.h index 657d2c7b..e7a710ba 100644 --- a/Amalgam/src/SDK/Globals.h +++ b/Amalgam/src/SDK/Globals.h @@ -98,6 +98,7 @@ namespace G inline CUserCmd* CurrentUserCmd = nullptr; inline CUserCmd* LastUserCmd = nullptr; inline CUserCmd OriginalCmd = {}; + inline CUserCmd DummyCmd = {}; inline AimTarget_t AimTarget = {}; inline AimPoint_t AimPoint = {}; diff --git a/Amalgam/src/SDK/Helpers/Entities/Entities.h b/Amalgam/src/SDK/Helpers/Entities/Entities.h index 4e6fc009..00e2e740 100644 --- a/Amalgam/src/SDK/Helpers/Entities/Entities.h +++ b/Amalgam/src/SDK/Helpers/Entities/Entities.h @@ -3,13 +3,13 @@ #include "../../Definitions/Classes.h" #include "../../Vars.h" -Enum(Entity, Invalid = -1, +Enum(Entity, PlayerAll, PlayerEnemy, PlayerTeam, BuildingAll, BuildingEnemy, BuildingTeam, PickupHealth, PickupAmmo, PickupMoney, PickupPowerup, PickupSpellbook, PickupGargoyle, WorldProjectile, WorldObjective, WorldNPC, WorldBomb, LocalStickies, LocalFlares, SniperDots, - GroupsMax + Invalid, GroupsMax ) struct DormantData diff --git a/Amalgam/src/SDK/SDK.cpp b/Amalgam/src/SDK/SDK.cpp index 7b48192e..87ffe671 100644 --- a/Amalgam/src/SDK/SDK.cpp +++ b/Amalgam/src/SDK/SDK.cpp @@ -3,7 +3,6 @@ #include "../Features/Visuals/Notifications/Notifications.h" #include "../Features/ImGui/Menu/Menu.h" #include "../Features/EnginePrediction/EnginePrediction.h" -#include #pragma warning (disable : 6385) @@ -156,23 +155,15 @@ bool SDK::IsGameWindowInFocus() return hWindow == GetForegroundWindow() || !hWindow; } -double SDK::PlatFloatTime() -{ - static auto Plat_FloatTime = U::Memory.GetModuleExport("tier0.dll", "Plat_FloatTime"); - return Plat_FloatTime(); -} - -static std::random_device s_tRandomDevice; -static std::mt19937 s_tEngine(s_tRandomDevice()); int SDK::StdRandomInt(int iMin, int iMax) { std::uniform_int_distribution iDistribution(iMin, iMax); - return iDistribution(s_tEngine); + return iDistribution(Random); } float SDK::StdRandomFloat(float flMin, float flMax) { std::uniform_real_distribution flDistribution(flMin, flMax); - return flDistribution(s_tEngine); + return flDistribution(Random); } int SDK::SeedFileLineHash(int iSeed, const char* sName, int iAdditionalSeed) @@ -208,6 +199,12 @@ float SDK::RandomFloat(float flMinVal, float flMaxVal) return RandomFloat(flMinVal, flMaxVal); } +double SDK::PlatFloatTime() +{ + static auto Plat_FloatTime = U::Memory.GetModuleExport("tier0.dll", "Plat_FloatTime"); + return Plat_FloatTime(); +} + bool SDK::W2S(const Vec3& vOrigin, Vec3& vScreen, bool bAlways) { const auto& worldToScreen = H::Draw.m_mWorldToProjection.As3x4(); diff --git a/Amalgam/src/SDK/SDK.h b/Amalgam/src/SDK/SDK.h index 59fbc75f..f9236cc7 100644 --- a/Amalgam/src/SDK/SDK.h +++ b/Amalgam/src/SDK/SDK.h @@ -20,6 +20,7 @@ #include "../Utils/Timer/Timer.h" #include "../Utils/Macros/Macros.h" #include +#include #define DEFAULT_COLOR Color_t(175, 150, 255, 255) #define ALTERNATE_COLOR Color_t(175, 150, 255, 127) @@ -86,7 +87,7 @@ namespace SDK HWND GetTeamFortressWindow(); bool IsGameWindowInFocus(); - double PlatFloatTime(); + inline std::default_random_engine Random = {}; int StdRandomInt(int iMin = 0, int iMax = VALVE_RAND_MAX); float StdRandomFloat(float flMin = 0.f, float flMax = 1.f); @@ -95,6 +96,7 @@ namespace SDK void RandomSeed(int iSeed); int RandomInt(int iMinVal = 0, int iMaxVal = VALVE_RAND_MAX); float RandomFloat(float flMinVal = 0.f, float flMaxVal = 1.f); + double PlatFloatTime(); bool W2S(const Vec3& vOrigin, Vec3& vScreen, bool bAlways = false); bool IsOnScreen(CBaseEntity* pEntity, const matrix3x4& mTransform, float* pLeft = nullptr, float* pRight = nullptr, float* pTop = nullptr, float* pBottom = nullptr, bool bAll = false); diff --git a/Amalgam/src/SDK/Vars.h b/Amalgam/src/SDK/Vars.h index 31b0514c..d9b9fb86 100644 --- a/Amalgam/src/SDK/Vars.h +++ b/Amalgam/src/SDK/Vars.h @@ -350,6 +350,7 @@ NAMESPACE_BEGIN(Vars) CVar(VerticalShift, "Vertical shift", 5.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f, 0.5f); CVar(DragOverride, "Drag override", 0.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 1.f, 0.01f); CVar(TimeOverride, "Time override", 0.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 2.f, 0.01f); + CVar(LobAnglesUnderpredict, "Lob angles underpredict", true, NOSAVE | DEBUGVAR); CVar(HuntsmanLerp, "Huntsman lerp", 50.f, NOSAVE | DEBUGVAR | SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 100.f, 1.f, "%g%%"); CVar(HuntsmanLerpLow, "Huntsman lerp low", 100.f, NOSAVE | DEBUGVAR | SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 100.f, 1.f, "%g%%"); CVar(HuntsmanAdd, "Huntsman add", 0.f, NOSAVE | DEBUGVAR | SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 20.f); @@ -361,7 +362,6 @@ NAMESPACE_BEGIN(Vars) CVarEnum(SplashMode, "Splash mode", 0, NOSAVE | DEBUGVAR, nullptr, VA_LIST("Trace", "Face"), Trace, Face); - CVar(SplashNormalSkip, "Splash normal skip", 1, NOSAVE | DEBUGVAR | SLIDER_MIN, 1, 10); CVar(SplashAirCount, "Splash air count", 0, NOSAVE | DEBUGVAR | SLIDER_MIN, 0, 10); CVar(SplashPointsDirect, "Splash points direct", 100, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0, 400, 5); CVar(SplashPointsArc, "Splash points arc", 100, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0, 400, 5); @@ -370,9 +370,12 @@ NAMESPACE_BEGIN(Vars) CVar(SplashDensityDirect, "Splash density direct", 40.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 100.f, 1.f); CVar(SplashDensityArc, "Splash density arc", 40.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 100.f, 1.f); CVar(SplashSamplesCutoff, "Splash samples cutoff", 0.0000001f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 0.000001f, 0.00000001f); - CVar(SplashCountDirect, "Splash count direct", 100, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 1, 400, 5); - CVar(SplashCountArc, "Splash count arc", 5, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 1, 400, 5); - CVar(SplashTraceInterval, "Splash trace interval", 10, NOSAVE | DEBUGVAR, 1, 10); + CVar(SplashRestrictDirect, "Splash restrict direct", 100, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 1, 400, 5); + CVar(SplashRestrictArc, "Splash restrict arc", 5, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 1, 400, 5); + CVar(SplashRestrictFirst, "Splash restrict first", 25, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 1, 400, 5); + CVar(DirectTraceInterval, "Direct trace interval", 1, NOSAVE | DEBUGVAR | SLIDER_MIN, 1, 20); + CVar(SplashTraceInterval, "Splash trace interval", 10, NOSAVE | DEBUGVAR | SLIDER_MIN, 1, 20); + CVar(LobTraceInterval, "Lob trace interval", 20, NOSAVE | DEBUGVAR | SLIDER_MIN, 1, 20); CVar(DeltaCount, "Delta count", 5, NOSAVE | DEBUGVAR, 1, 5); CVarEnum(DeltaMode, "Delta mode", 0, NOSAVE | DEBUGVAR, nullptr, diff --git a/Amalgam/src/Utils/Interfaces/Interfaces.h b/Amalgam/src/Utils/Interfaces/Interfaces.h index 096c90aa..133bf2fd 100644 --- a/Amalgam/src/Utils/Interfaces/Interfaces.h +++ b/Amalgam/src/Utils/Interfaces/Interfaces.h @@ -7,9 +7,9 @@ struct InterfaceInit_t void** m_pPtr; const char* m_sDLL; const char* m_sName; - int8_t m_nType; // 0: find interface, 1: get export, 2: sig scan + uint8_t m_nType; // 0: find interface, 1: get export, 2: sig scan int8_t m_nOffset; - int8_t m_nDereferenceCount; + uint8_t m_nDereferenceCount; bool m_bNullCheck; InterfaceInit_t(void** pPtr, const char* sDLL, const char* sName, int8_t nType, int8_t nOffset = 0, int8_t nDereferenceCount = 0, bool bNullCheck = true); diff --git a/Amalgam/src/Utils/Math/Math.h b/Amalgam/src/Utils/Math/Math.h index 3c74a53f..6ca7ae1c 100644 --- a/Amalgam/src/Utils/Math/Math.h +++ b/Amalgam/src/Utils/Math/Math.h @@ -40,26 +40,16 @@ namespace Math inline void VectorAngles(const Vec3& vForward, Vec3& vAngles) { - float flYaw, flPitch; - - if (vForward.y == 0 && vForward.x == 0) + if (vForward.x || vForward.y) { - flYaw = 0; - flPitch = vForward.z > 0 ? 270 : 90; + vAngles.x = Rad2Deg(atan2f(-vForward.z, vForward.Length2D())); + vAngles.y = Rad2Deg(atan2f(vForward.y, vForward.x)); } else { - flYaw = Rad2Deg(atan2f(vForward.y, vForward.x)); - if (flYaw < 0) - flYaw += 360; - - flPitch = Rad2Deg(atan2f(-vForward.z, vForward.Length2D())); - if (flPitch < 0) - flPitch += 360; + vAngles.x = vForward.z > 0 ? 270 : 90; + vAngles.y = 0; } - - vAngles.x = flPitch; - vAngles.y = flYaw; vAngles.z = 0; } @@ -72,7 +62,7 @@ namespace Math inline void AngleVectors(const Vec3& vAngles, Vec3* pForward = nullptr, Vec3* pRight = nullptr, Vec3* pUp = nullptr) { - float sp, sy, sr, cp, cy, cr; + float sp, sy, cp, cy; SinCos(Deg2Rad(vAngles.x), sp, cp); SinCos(Deg2Rad(vAngles.y), sy, cy); @@ -85,19 +75,20 @@ namespace Math if (pRight || pUp) { + float sr, cr; SinCos(Deg2Rad(vAngles.z), sr, cr); if (pRight) { - pRight->x = (-1 * sr * sp * cy + -1 * cr * -sy); - pRight->y = (-1 * sr * sp * sy + -1 * cr * cy); + pRight->x = -1 * sr * sp * cy + -1 * cr * -sy; + pRight->y = -1 * sr * sp * sy + -1 * cr * cy; pRight->z = -1 * sr * cp; } if (pUp) { - pUp->x = (cr * sp * cy + -sr * -sy); - pUp->y = (cr * sp * sy + -sr * cy); + pUp->x = cr * sp * cy + -sr * -sy; + pUp->y = cr * sp * sy + -sr * cy; pUp->z = cr * cp; } } @@ -106,7 +97,7 @@ namespace Math inline Vec3 CalcAngle(const Vec3& vFrom, const Vec3& vTo, bool bClamp = true) { Vec3 vDelta = vFrom - vTo; - float flHyp = std::sqrtf((vDelta.x * vDelta.x) + (vDelta.y * vDelta.y)); + float flHyp = std::sqrtf(vDelta.x * vDelta.x + vDelta.y * vDelta.y); Vec3 vAngles = { atanf(vDelta.z / flHyp) * RAD, @@ -132,7 +123,7 @@ namespace Math AngleVectors(vToAng, &vToForward); float flResult = Rad2Deg(acos(vFromForward.Dot(vToForward))); - if (!isfinite(flResult) || isinf(flResult) || isnan(flResult)) + if (!isfinite(flResult)) flResult = 0.f; return flResult;