diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 1fa452e1..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,11 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 -updates: - - package-ecosystem: "nuget" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "weekly" \ No newline at end of file diff --git a/Amalgam/src/Features/Aimbot/Aimbot.cpp b/Amalgam/src/Features/Aimbot/Aimbot.cpp index 5ec5c8c8..8f485594 100644 --- a/Amalgam/src/Features/Aimbot/Aimbot.cpp +++ b/Amalgam/src/Features/Aimbot/Aimbot.cpp @@ -75,10 +75,9 @@ void CAimbot::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) F::AutoAirblast.Run(pLocal, pWeapon, pCmd); F::AutoHeal.Run(pLocal, pWeapon, pCmd); - bool bAttacking1 = G::IsAttacking; RunAimbot(pLocal, pWeapon, pCmd); RunAimbot(pLocal, pWeapon, pCmd, true); - if (Vars::Visuals::Simulation::ShotPath.Value && G::IsAttacking && !bRan) + if (Vars::Visuals::Simulation::ShotPath.Value && G::Attacking == 1 && !bRan) F::Visuals.ProjectileTrace(pLocal, pWeapon, false); } diff --git a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp index cfafc809..70496614 100644 --- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp @@ -292,7 +292,7 @@ int CAimbotHitscan::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* p flPreferredRecord = 0; if (flPreferredRecord) { - auto pivot = std::find_if(vRecords.begin(), vRecords.end(), [](auto& s) -> bool { return s.flSimTime == flPreferredRecord; }); + auto pivot = std::find_if(vRecords.begin(), vRecords.end(), [](auto& s) -> bool { return s.m_flSimTime == flPreferredRecord; }); if (pivot != vRecords.end()) std::rotate(vRecords.begin(), pivot, pivot + 1); } @@ -308,11 +308,11 @@ int CAimbotHitscan::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* p int iReturn = false; for (auto& pTick : vRecords) { - bool bRunPeekCheck = flSpread && (Vars::Aimbot::General::PeekDTOnly.Value ? F::Ticks.GetTicks(pLocal) : true) && Vars::Aimbot::General::HitscanPeek.Value; + bool bRunPeekCheck = flSpread && (Vars::Aimbot::General::PeekDTOnly.Value ? F::Ticks.GetTicks() : true) && Vars::Aimbot::General::HitscanPeek.Value; if (target.m_TargetType == ETargetType::Player || target.m_TargetType == ETargetType::Sentry) { - auto aBones = pTick.BoneMatrix.aBones; + auto aBones = pTick.m_BoneMatrix.m_aBones; if (!aBones) continue; @@ -423,7 +423,7 @@ int CAimbotHitscan::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* p } if (bWillHit) { - flPreferredRecord = pTick.flSimTime; + flPreferredRecord = pTick.m_flSimTime; target.m_Tick = pTick; target.m_vPos = vTransformed; @@ -580,22 +580,6 @@ bool CAimbotHitscan::ShouldFire(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser return true; } -// assume angle calculated outside with other overload -void CAimbotHitscan::Aim(CUserCmd* pCmd, Vec3& vAngle) -{ - if (Vars::Aimbot::General::AimType.Value != Vars::Aimbot::General::AimTypeEnum::Silent) - { - pCmd->viewangles = vAngle; - I::EngineClient->SetViewAngles(pCmd->viewangles); // remove these if uncommenting l124 of createmove - } - else if (G::IsAttacking) - { - SDK::FixMovement(pCmd, vAngle); - pCmd->viewangles = vAngle; - G::SilentAngles = true; - } -} - Vec3 CAimbotHitscan::Aim(Vec3 vCurAngle, Vec3 vToAngle, int iMethod) { Vec3 vReturn = {}; @@ -627,6 +611,23 @@ Vec3 CAimbotHitscan::Aim(Vec3 vCurAngle, Vec3 vToAngle, int iMethod) return vReturn; } +// assume angle calculated outside with other overload +void CAimbotHitscan::Aim(CUserCmd* pCmd, Vec3& vAngle) +{ + bool bDoubleTap = G::DoubleTap || F::Ticks.GetTicks(); + if (Vars::Aimbot::General::AimType.Value != Vars::Aimbot::General::AimTypeEnum::Silent) + { + pCmd->viewangles = vAngle; + I::EngineClient->SetViewAngles(pCmd->viewangles); + } + else if (G::Attacking == 1 || bDoubleTap) + { + SDK::FixMovement(pCmd, vAngle); + pCmd->viewangles = vAngle; + G::SilentAngles = true; + } +} + void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) { const int nWeaponID = pWeapon->GetWeaponID(); @@ -639,13 +640,13 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC switch (nWeaponID) { case TF_WEAPON_SNIPERRIFLE_CLASSIC: - if (!iRealAimType && iLastAimType && G::IsAttacking) + if (!iRealAimType && iLastAimType && G::Attacking) Vars::Aimbot::General::AimType.Value = iLastAimType; } if ((Vars::Aimbot::General::AimHoldsFire.Value == Vars::Aimbot::General::AimHoldsFireEnum::Always || Vars::Aimbot::General::AimHoldsFire.Value == 1 && nWeaponID == TF_WEAPON_MINIGUN) && !G::CanPrimaryAttack && G::LastUserCmd->buttons & IN_ATTACK && Vars::Aimbot::General::AimType.Value && !pWeapon->IsInReload()) pCmd->buttons |= IN_ATTACK; - if (!Vars::Aimbot::General::AimType.Value || !G::CanPrimaryAttack && Vars::Aimbot::General::AimType.Value == 3 && (nWeaponID == TF_WEAPON_MINIGUN ? pWeapon->As()->m_iWeaponState() == AC_STATE_FIRING || pWeapon->As()->m_iWeaponState() == AC_STATE_SPINNING : true)) + if (!Vars::Aimbot::General::AimType.Value || !G::CanPrimaryAttack && !G::Reloading && !G::DoubleTap && Vars::Aimbot::General::AimType.Value == 3 && (nWeaponID == TF_WEAPON_MINIGUN ? pWeapon->As()->m_iWeaponState() == AC_STATE_FIRING || pWeapon->As()->m_iWeaponState() == AC_STATE_SPINNING : true)) return; switch (nWeaponID) @@ -744,17 +745,17 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC } } - G::IsAttacking = SDK::IsAttacking(pLocal, pWeapon, pCmd, true); + G::Attacking = SDK::IsAttacking(pLocal, pWeapon, pCmd, true); - if (G::IsAttacking) + if (G::Attacking == 1) { if (target.m_pEntity->IsPlayer()) F::Resolver.Aimbot(target.m_pEntity->As(), target.m_nAimedHitbox == HITBOX_HEAD); if (target.m_bBacktrack) - pCmd->tick_count = TIME_TO_TICKS(target.m_Tick.flSimTime) + TIME_TO_TICKS(F::Backtrack.flFakeInterp); + pCmd->tick_count = TIME_TO_TICKS(target.m_Tick.m_flSimTime) + TIME_TO_TICKS(F::Backtrack.m_flFakeInterp); - if (!pWeapon->IsInReload()) + if (G::CanPrimaryAttack) { if (Vars::Visuals::Bullet::Enabled.Value) { @@ -764,14 +765,13 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC if (Vars::Visuals::Hitbox::Enabled.Value & Vars::Visuals::Hitbox::EnabledEnum::OnShot) { G::BoxStorage.clear(); - auto vBoxes = F::Visuals.GetHitboxes(target.m_Tick.BoneMatrix.aBones, target.m_pEntity->As(), {}, target.m_nAimedHitbox); + auto vBoxes = F::Visuals.GetHitboxes(target.m_Tick.m_BoneMatrix.m_aBones, target.m_pEntity->As(), {}, target.m_nAimedHitbox); G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end()); } } } - if (!pWeapon->IsInReload()) - Aim(pCmd, target.m_vAngleTo); + Aim(pCmd, target.m_vAngleTo); break; } } \ No newline at end of file diff --git a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.h b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.h index bc2e3461..6a4f4a75 100644 --- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.h +++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.h @@ -13,8 +13,8 @@ class CAimbotHitscan float GetMaxRange(CTFWeaponBase* pWeapon); int CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* pWeapon); - void Aim(CUserCmd* pCmd, Vec3& vAngle); Vec3 Aim(Vec3 vCurAngle, Vec3 vToAngle, int iMethod = Vars::Aimbot::General::AimType.Value); + void Aim(CUserCmd* pCmd, Vec3& vAngle); bool ShouldFire(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, const Target_t& target); public: diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp index cefd3f11..f0a6a34c 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp @@ -315,10 +315,10 @@ int CAimbotMelee::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* pWe for (TickRecord& pTick : newRecords) { vRecords.pop_back(); - vRecords.push_front({ pTick.flSimTime, {}, pTick.vOrigin }); + vRecords.push_front({ pTick.m_flSimTime, {}, pTick.m_vOrigin }); } for (TickRecord& pTick : vRecords) - pTick.flSimTime -= TICKS_TO_TIME(newRecords.size()); + pTick.m_flSimTime -= TICKS_TO_TIME(newRecords.size()); } std::deque validRecords = target.m_TargetType == ETargetType::Player ? F::Backtrack.GetValidRecords(&vRecords, pLocal, true) : vRecords; if (!Vars::Backtrack::Enabled.Value && !validRecords.empty()) @@ -341,9 +341,9 @@ int CAimbotMelee::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* pWe for (auto& pTick : validRecords) { const Vec3 vRestore = target.m_pEntity->GetAbsOrigin(); - target.m_pEntity->SetAbsOrigin(pTick.vOrigin); + target.m_pEntity->SetAbsOrigin(pTick.m_vOrigin); - target.m_vPos = pTick.vOrigin + vDiff; + target.m_vPos = pTick.m_vOrigin + vDiff; target.m_vAngleTo = Aim(G::CurrentUserCmd->viewangles, Math::CalcAngle(vEyePos, target.m_vPos)); Vec3 vForward; Math::AngleVectors(target.m_vAngleTo, &vForward); @@ -397,22 +397,6 @@ int CAimbotMelee::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* pWe -// assume angle calculated outside with other overload -void CAimbotMelee::Aim(CUserCmd* pCmd, Vec3& vAngle) -{ - if (Vars::Aimbot::General::AimType.Value != Vars::Aimbot::General::AimTypeEnum::Silent) - { - pCmd->viewangles = vAngle; - I::EngineClient->SetViewAngles(pCmd->viewangles); - } - else if (G::IsAttacking) - { - SDK::FixMovement(pCmd, vAngle); - pCmd->viewangles = vAngle; - G::PSilentAngles = true; - } -} - Vec3 CAimbotMelee::Aim(Vec3 vCurAngle, Vec3 vToAngle, int iMethod) { Vec3 vReturn = {}; @@ -442,6 +426,23 @@ Vec3 CAimbotMelee::Aim(Vec3 vCurAngle, Vec3 vToAngle, int iMethod) return vReturn; } +// assume angle calculated outside with other overload +void CAimbotMelee::Aim(CUserCmd* pCmd, Vec3& vAngle) +{ + bool bDoubleTap = G::DoubleTap || F::Ticks.GetTicks(); + if (Vars::Aimbot::General::AimType.Value != Vars::Aimbot::General::AimTypeEnum::Silent) + { + pCmd->viewangles = vAngle; + I::EngineClient->SetViewAngles(pCmd->viewangles); + } + else if (G::Attacking == 1 || bDoubleTap) + { + SDK::FixMovement(pCmd, vAngle); + pCmd->viewangles = vAngle; + G::PSilentAngles = true; + } +} + void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) { static int iAimType = 0; @@ -462,7 +463,7 @@ void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd if (targets.empty()) return; - iDoubletapTicks = F::Ticks.GetTicks(pLocal); + iDoubletapTicks = F::Ticks.GetTicks(); const bool bShouldSwing = iDoubletapTicks <= (GetSwingTime(pWeapon) ? 14 : 0) || Vars::CL_Move::Doubletap::AntiWarp.Value && pLocal->m_hGroundEntity(); Vec3 vEyePos = pLocal->GetShootPos(); @@ -493,13 +494,12 @@ void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd G::DoubleTap = true; } - const bool bAttacking = SDK::IsAttacking(pLocal, pWeapon, pCmd, true); - G::IsAttacking = bAttacking || bShouldSwing && G::DoubleTap; // dumb but works + G::Attacking = SDK::IsAttacking(pLocal, pWeapon, pCmd, true); - if (G::IsAttacking) + if (G::Attacking == 1) { if (target.m_bBacktrack) - pCmd->tick_count = TIME_TO_TICKS(target.m_Tick.flSimTime) + TIME_TO_TICKS(F::Backtrack.flFakeInterp); + pCmd->tick_count = TIME_TO_TICKS(target.m_Tick.m_flSimTime) + TIME_TO_TICKS(F::Backtrack.m_flFakeInterp); // bug: fast old records seem to be progressively more unreliable ? if (Vars::Visuals::Bullet::Enabled.Value) @@ -510,7 +510,7 @@ void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd if (Vars::Visuals::Hitbox::Enabled.Value & Vars::Visuals::Hitbox::EnabledEnum::OnShot) { G::BoxStorage.clear(); - auto vBoxes = F::Visuals.GetHitboxes(target.m_Tick.BoneMatrix.aBones, target.m_pEntity->As()); + auto vBoxes = F::Visuals.GetHitboxes(target.m_Tick.m_BoneMatrix.m_aBones, target.m_pEntity->As()); G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end()); } } @@ -534,7 +534,6 @@ void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd } Aim(pCmd, target.m_vAngleTo); - G::IsAttacking = bAttacking; break; } } @@ -614,7 +613,7 @@ bool CAimbotMelee::RunSapper(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd if (pCmd->buttons & IN_ATTACK) { - G::IsAttacking = true; + G::Attacking = true; target.m_vAngleTo = Aim(pCmd->viewangles, Math::CalcAngle(vLocalPos, target.m_vPos)); target.m_vAngleTo.x = pCmd->viewangles.x; // we don't need to care about pitch Aim(pCmd, target.m_vAngleTo); diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h index f0136481..840321fc 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h @@ -16,8 +16,8 @@ class CAimbotMelee bool CanBackstab(CBaseEntity* pTarget, CTFPlayer* pLocal, Vec3 vEyeAngles); int CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Vec3 vEyePos, std::deque newRecords); - void Aim(CUserCmd* pCmd, Vec3& vAngle); Vec3 Aim(Vec3 vCurAngle, Vec3 vToAngle, int iMethod = Vars::Aimbot::General::AimType.Value); + void Aim(CUserCmd* pCmd, Vec3& vAngle); 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 3752bc18..17ba7a99 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp @@ -3,6 +3,7 @@ #include "../Aimbot.h" #include "../../Simulation/MovementSimulation/MovementSimulation.h" #include "../../Simulation/ProjectileSimulation/ProjectileSimulation.h" +#include "../../TickHandler/TickHandler.h" #include "../../Visuals/Visuals.h" std::vector CAimbotProjectile::GetTargets(CTFPlayer* pLocal, CTFWeaponBase* pWeapon) @@ -895,22 +896,6 @@ int CAimbotProjectile::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase -// assume angle calculated outside with other overload -void CAimbotProjectile::Aim(CUserCmd* pCmd, Vec3& vAngle) -{ - if (Vars::Aimbot::General::AimType.Value != Vars::Aimbot::General::AimTypeEnum::Silent) - { - pCmd->viewangles = vAngle; - I::EngineClient->SetViewAngles(pCmd->viewangles); - } - else if (G::IsAttacking) - { - SDK::FixMovement(pCmd, vAngle); - pCmd->viewangles = vAngle; - G::PSilentAngles = true; - } -} - Vec3 CAimbotProjectile::Aim(Vec3 vCurAngle, Vec3 vToAngle, int iMethod) { Vec3 vReturn = {}; @@ -940,6 +925,23 @@ Vec3 CAimbotProjectile::Aim(Vec3 vCurAngle, Vec3 vToAngle, int iMethod) return vReturn; } +// assume angle calculated outside with other overload +void CAimbotProjectile::Aim(CUserCmd* pCmd, Vec3& vAngle) +{ + bool bDoubleTap = G::DoubleTap || F::Ticks.GetTicks(); + if (Vars::Aimbot::General::AimType.Value != Vars::Aimbot::General::AimTypeEnum::Silent) + { + pCmd->viewangles = vAngle; + I::EngineClient->SetViewAngles(pCmd->viewangles); + } + else if (G::Attacking == 1 || bDoubleTap) + { + SDK::FixMovement(pCmd, vAngle); + pCmd->viewangles = vAngle; + G::PSilentAngles = true; + } +} + bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) { const int nWeaponID = pWeapon->GetWeaponID(); @@ -953,18 +955,20 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser case TF_WEAPON_COMPOUND_BOW: case TF_WEAPON_PIPEBOMBLAUNCHER: case TF_WEAPON_CANNON: - if (!Vars::Aimbot::General::AutoShoot.Value && !iRealAimType && iLastAimType && G::IsAttacking) + if (!Vars::Aimbot::General::AutoShoot.Value && !iRealAimType && iLastAimType && G::Attacking) Vars::Aimbot::General::AimType.Value = iLastAimType; } - if (!G::IsThrowing) - m_iAimType = Vars::Aimbot::General::AimType.Value; - else if (m_iAimType) - Vars::Aimbot::General::AimType.Value = m_iAimType; + static int iAimType = 0; + if (!G::Throwing) + iAimType = Vars::Aimbot::General::AimType.Value; + else if (iAimType) + Vars::Aimbot::General::AimType.Value = iAimType; if (Vars::Aimbot::General::AimHoldsFire.Value == Vars::Aimbot::General::AimHoldsFireEnum::Always && !G::CanPrimaryAttack && G::LastUserCmd->buttons & IN_ATTACK && Vars::Aimbot::General::AimType.Value && !pWeapon->IsInReload()) pCmd->buttons |= IN_ATTACK; - if (!Vars::Aimbot::General::AimType.Value || !G::CanPrimaryAttack && Vars::Aimbot::General::AimType.Value == Vars::Aimbot::General::AimTypeEnum::Silent && nWeaponID != TF_WEAPON_PIPEBOMBLAUNCHER && nWeaponID != TF_WEAPON_CANNON) + // the G::DoubleTap condition is not a great fix here and actually properly predicting when shots will be fired should likely be done over this, but it's fine for now + if (!Vars::Aimbot::General::AimType.Value || !G::CanPrimaryAttack && !G::Reloading && !G::DoubleTap && Vars::Aimbot::General::AimType.Value == Vars::Aimbot::General::AimTypeEnum::Silent && nWeaponID != TF_WEAPON_PIPEBOMBLAUNCHER && nWeaponID != TF_WEAPON_CANNON) return true; auto targets = SortTargets(pLocal, pWeapon); @@ -975,7 +979,7 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser && (nWeaponID == TF_WEAPON_COMPOUND_BOW || nWeaponID == TF_WEAPON_PIPEBOMBLAUNCHER || nWeaponID == TF_WEAPON_CANNON)) { pCmd->buttons |= IN_ATTACK; - if (!G::CanPrimaryAttack && Vars::Aimbot::General::AimType.Value == Vars::Aimbot::General::AimTypeEnum::Silent) + if (!G::CanPrimaryAttack && !G::Reloading && Vars::Aimbot::General::AimType.Value == Vars::Aimbot::General::AimTypeEnum::Silent) return true; } @@ -1028,53 +1032,52 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser } } - G::IsAttacking = F::Aimbot.bRan = SDK::IsAttacking(pLocal, pWeapon, pCmd, true); + F::Aimbot.bRan = G::Attacking = SDK::IsAttacking(pLocal, pWeapon, pCmd, true); - if (!pWeapon->IsInReload() /*|| pWeapon->GetWeaponID() == TF_WEAPON_CROSSBOW*/) + if (G::Attacking == 1 || !Vars::Aimbot::General::AutoShoot.Value) { - if (G::IsAttacking || !Vars::Aimbot::General::AutoShoot.Value) + if (Vars::Visuals::Simulation::PlayerPath.Value + || Vars::Visuals::Simulation::ProjectilePath.Value && G::Attacking == 1 + || Vars::Visuals::Hitbox::Enabled.Value & Vars::Visuals::Hitbox::EnabledEnum::OnShot) { - if (Vars::Visuals::Simulation::PlayerPath.Value - || Vars::Visuals::Simulation::ProjectilePath.Value && G::IsAttacking - || Vars::Visuals::Hitbox::Enabled.Value & Vars::Visuals::Hitbox::EnabledEnum::OnShot) - G::LineStorage.clear(); - - if (Vars::Visuals::Simulation::PlayerPath.Value) - { - if (Vars::Colors::PlayerPath.Value.a) - G::PathStorage.push_back({ vPlayerPath, Vars::Visuals::Simulation::Timed.Value ? -int(vPlayerPath.size()) : I::GlobalVars->curtime + 5.f, Vars::Colors::PlayerPath.Value, Vars::Visuals::Simulation::PlayerPath.Value }); - if (Vars::Colors::PlayerPathClipped.Value.a) - G::PathStorage.push_back({ vPlayerPath, Vars::Visuals::Simulation::Timed.Value ? -int(vPlayerPath.size()) : I::GlobalVars->curtime + 5.f, Vars::Colors::PlayerPathClipped.Value, Vars::Visuals::Simulation::PlayerPath.Value, true }); - } - if (Vars::Visuals::Simulation::ProjectilePath.Value && G::IsAttacking) - { - if (Vars::Colors::ProjectilePath.Value.a) - G::PathStorage.push_back({ vProjectilePath, Vars::Visuals::Simulation::Timed.Value ? -int(vProjectilePath.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()) : I::GlobalVars->curtime + 5.f, Vars::Colors::ProjectilePath.Value, Vars::Visuals::Simulation::ProjectilePath.Value }); - if (Vars::Colors::ProjectilePathClipped.Value.a) - G::PathStorage.push_back({ vProjectilePath, Vars::Visuals::Simulation::Timed.Value ? -int(vProjectilePath.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()) : I::GlobalVars->curtime + 5.f, Vars::Colors::ProjectilePathClipped.Value, Vars::Visuals::Simulation::ProjectilePath.Value, true }); - } - if (Vars::Visuals::Hitbox::Enabled.Value & Vars::Visuals::Hitbox::EnabledEnum::OnShot) - { - G::BoxStorage.clear(); - G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end()); - } + G::PathStorage.clear(); + G::LineStorage.clear(); } - if (!pWeapon->IsInReload()) - Aim(pCmd, target.m_vAngleTo); - if (G::PSilentAngles) + if (Vars::Visuals::Simulation::PlayerPath.Value) { - switch (pWeapon->GetWeaponID()) - { - case TF_WEAPON_FLAMETHROWER: // angles show up anyways - case TF_WEAPON_CLEAVER: // can't psilent with these weapons, they use SetContextThink - case TF_WEAPON_JAR: - case TF_WEAPON_JAR_MILK: - case TF_WEAPON_JAR_GAS: - case TF_WEAPON_BAT_WOOD: - case TF_WEAPON_BAT_GIFTWRAP: - G::PSilentAngles = false, G::SilentAngles = true; - } + if (Vars::Colors::PlayerPath.Value.a) + G::PathStorage.push_back({ vPlayerPath, Vars::Visuals::Simulation::Timed.Value ? -int(vPlayerPath.size()) : I::GlobalVars->curtime + 5.f, Vars::Colors::PlayerPath.Value, Vars::Visuals::Simulation::PlayerPath.Value }); + if (Vars::Colors::PlayerPathClipped.Value.a) + G::PathStorage.push_back({ vPlayerPath, Vars::Visuals::Simulation::Timed.Value ? -int(vPlayerPath.size()) : I::GlobalVars->curtime + 5.f, Vars::Colors::PlayerPathClipped.Value, Vars::Visuals::Simulation::PlayerPath.Value, true }); + } + if (Vars::Visuals::Simulation::ProjectilePath.Value && G::Attacking == 1) + { + if (Vars::Colors::ProjectilePath.Value.a) + G::PathStorage.push_back({ vProjectilePath, Vars::Visuals::Simulation::Timed.Value ? -int(vProjectilePath.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()) : I::GlobalVars->curtime + 5.f, Vars::Colors::ProjectilePath.Value, Vars::Visuals::Simulation::ProjectilePath.Value }); + if (Vars::Colors::ProjectilePathClipped.Value.a) + G::PathStorage.push_back({ vProjectilePath, Vars::Visuals::Simulation::Timed.Value ? -int(vProjectilePath.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()) : I::GlobalVars->curtime + 5.f, Vars::Colors::ProjectilePathClipped.Value, Vars::Visuals::Simulation::ProjectilePath.Value, true }); + } + if (Vars::Visuals::Hitbox::Enabled.Value & Vars::Visuals::Hitbox::EnabledEnum::OnShot) + { + G::BoxStorage.clear(); + G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end()); + } + } + + Aim(pCmd, target.m_vAngleTo); + if (G::PSilentAngles) + { + switch (pWeapon->GetWeaponID()) + { + case TF_WEAPON_FLAMETHROWER: // angles show up anyways + case TF_WEAPON_CLEAVER: // can't psilent with these weapons, they use SetContextThink + case TF_WEAPON_JAR: + case TF_WEAPON_JAR_MILK: + case TF_WEAPON_JAR_GAS: + case TF_WEAPON_BAT_WOOD: + case TF_WEAPON_BAT_GIFTWRAP: + G::PSilentAngles = false, G::SilentAngles = true; } } break; diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h index 213e270a..b4cc0535 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h @@ -61,10 +61,9 @@ class CAimbotProjectile int CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, std::deque* pPlayerPath, std::deque* pProjectilePath, std::vector* pBoxes, float* pTimeTo); bool RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); - void Aim(CUserCmd* pCmd, Vec3& vAngle); Vec3 Aim(Vec3 vCurAngle, Vec3 vToAngle, int iMethod = Vars::Aimbot::General::AimType.Value); + void Aim(CUserCmd* pCmd, Vec3& vAngle); - int m_iAimType = 0; bool m_bLastTickHeld = false; public: diff --git a/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp b/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp index 1257c1d4..923cfc04 100644 --- a/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp +++ b/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp @@ -109,7 +109,7 @@ void CAutoAirblast::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCm if (bShouldBlast) { - G::IsAttacking = true; + G::Attacking = true; pCmd->buttons |= IN_ATTACK2; } } \ No newline at end of file diff --git a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp index 410d2547..668c9bac 100644 --- a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp +++ b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp @@ -52,8 +52,7 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p static bool bStaticGrounded = false; bool bLastGrounded = bStaticGrounded, bCurrGrounded = bStaticGrounded = pLocal->m_hGroundEntity(); - const bool bReloading = pWeapon->IsInReload(); - if (iFrame == -1 && (pWeapon->m_iItemDefinitionIndex() == Soldier_m_TheBeggarsBazooka ? G::IsAttacking && !bReloading : G::CanPrimaryAttack)) + if (iFrame == -1 && (pWeapon->m_iItemDefinitionIndex() == Soldier_m_TheBeggarsBazooka ? G::Attacking == 1 : G::CanPrimaryAttack || G::Reloading)) { Vec3 viewAngles = pCmd->viewangles; if (Vars::Misc::Movement::AutoRocketJump.Value) @@ -96,7 +95,7 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p bWillHit = WillHit(pLocal, localStorage.m_MoveData.m_vecAbsOrigin, trace.endpos + trace.plane.normal); iDelay = std::max(n + (n > Vars::Misc::Movement::ApplyAbove.Value ? Vars::Misc::Movement::TimingOffset.Value : 0), 0); - if (bWillHit) + if (bWillHit && G::CanPrimaryAttack) { SDK::Output("Auto jump", std::format("Ticks to hit: {} ({})", iDelay, n).c_str(), { 255, 0, 0, 255 }, Vars::Debug::Logging.Value); if (Vars::Debug::Info.Value) @@ -129,14 +128,14 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p if (pWeapon->m_iItemDefinitionIndex() != Soldier_m_TheBeggarsBazooka) pCmd->buttons |= IN_ATTACK; - if (Vars::Misc::Movement::AutoRocketJump.Value && !bReloading) + if (Vars::Misc::Movement::AutoRocketJump.Value && G::CanPrimaryAttack) { G::SilentAngles = true; pCmd->viewangles = viewAngles; } } - if (iFrame != -1 && bReloading) + if (iFrame != -1 && G::Reloading) { iFrame = -1; bFull = false; diff --git a/Amalgam/src/Features/Backtrack/Backtrack.cpp b/Amalgam/src/Features/Backtrack/Backtrack.cpp index c38fa8ee..6345f185 100644 --- a/Amalgam/src/Features/Backtrack/Backtrack.cpp +++ b/Amalgam/src/Features/Backtrack/Backtrack.cpp @@ -4,9 +4,9 @@ void CBacktrack::Restart() { - mRecords.clear(); - dSequences.clear(); - iLastInSequence = 0; + m_mRecords.clear(); + m_dSequences.clear(); + m_iLastInSequence = 0; } @@ -17,7 +17,7 @@ float CBacktrack::GetLerp() if (!Vars::Backtrack::Enabled.Value) return G::Lerp; - return std::clamp(Vars::Backtrack::Interp.Value / 1000.f, G::Lerp, flMaxUnlag); + return std::clamp(Vars::Backtrack::Interp.Value / 1000.f, G::Lerp, m_flMaxUnlag); } // Returns the wish backtrack latency @@ -26,19 +26,19 @@ float CBacktrack::GetFake() if (!Vars::Backtrack::Enabled.Value) return 0.f; - return std::clamp(Vars::Backtrack::Latency.Value / 1000.f, 0.f, flMaxUnlag); + return std::clamp(Vars::Backtrack::Latency.Value / 1000.f, 0.f, m_flMaxUnlag); } // Returns the current real latency -float CBacktrack::GetReal(int iFlow) +float CBacktrack::GetReal(int iFlow, bool bNoFake) { auto pNetChan = I::EngineClient->GetNetChannelInfo(); if (!pNetChan) return 0.f; if (iFlow != -1) - return pNetChan->GetLatency(iFlow) - (iFlow == FLOW_INCOMING ? flFakeLatency : 0.f); - return pNetChan->GetLatency(FLOW_INCOMING) - flFakeLatency + pNetChan->GetLatency(FLOW_OUTGOING); + return pNetChan->GetLatency(iFlow) - (bNoFake && iFlow == FLOW_INCOMING ? m_flFakeLatency : 0.f); + return pNetChan->GetLatency(FLOW_INCOMING) + pNetChan->GetLatency(FLOW_OUTGOING) - (bNoFake ? m_flFakeLatency : 0.f); } void CBacktrack::SendLerp() @@ -51,10 +51,10 @@ void CBacktrack::SendLerp() if (interpTimer.Run(100)) { float flTarget = GetLerp(); - if (flTarget == flWishInterp) + if (flTarget == m_flWishInterp) return; - NET_SetConVar cl_interp("cl_interp", std::to_string(flWishInterp = flTarget).c_str()); + NET_SetConVar cl_interp("cl_interp", std::to_string(m_flWishInterp = flTarget).c_str()); pNetChan->SendNetMsg(cl_interp); NET_SetConVar cl_interp_ratio("cl_interp_ratio", "1.0"); pNetChan->SendNetMsg(cl_interp_ratio); @@ -67,24 +67,26 @@ void CBacktrack::SendLerp() void CBacktrack::SetLerp(IGameEvent* pEvent) { if (I::EngineClient->GetPlayerForUserID(pEvent->GetInt("userid")) == I::EngineClient->GetLocalPlayer()) - flFakeInterp = flWishInterp; + m_flFakeInterp = m_flWishInterp; } -// Store the last 2048 sequences void CBacktrack::UpdateDatagram() { auto pNetChan = reinterpret_cast(I::EngineClient->GetNetChannelInfo()); if (!pNetChan) return; - if (pNetChan->m_nInSequenceNr > iLastInSequence) + if (auto pLocal = H::Entities.GetLocal()) + m_nOldTickBase = pLocal->m_nTickBase(); + + if (pNetChan->m_nInSequenceNr > m_iLastInSequence) { - iLastInSequence = pNetChan->m_nInSequenceNr; - dSequences.push_front(CIncomingSequence(pNetChan->m_nInReliableState, pNetChan->m_nInSequenceNr, I::GlobalVars->realtime)); + m_iLastInSequence = pNetChan->m_nInSequenceNr; + m_dSequences.push_front(CIncomingSequence(pNetChan->m_nInReliableState, pNetChan->m_nInSequenceNr, I::GlobalVars->realtime)); } - if (dSequences.size() > 2048) - dSequences.pop_back(); + if (m_dSequences.size() > 67) + m_dSequences.pop_back(); } @@ -95,20 +97,20 @@ bool CBacktrack::WithinRewind(const TickRecord& record) if (!pNetChan) return false; - const float flCorrect = std::clamp(pNetChan->GetLatency(FLOW_OUTGOING) + ROUND_TO_TICKS(flFakeInterp) + ROUND_TO_TICKS(flFakeLatency), 0.f, flMaxUnlag) - pNetChan->GetLatency(FLOW_OUTGOING); - const int iServerTick = iTickCount + G::AnticipatedChoke + Vars::Backtrack::Offset.Value; + const float flCorrect = std::clamp(pNetChan->GetLatency(FLOW_OUTGOING) + ROUND_TO_TICKS(m_flFakeInterp) + ROUND_TO_TICKS(m_flFakeLatency), 0.f, m_flMaxUnlag) - pNetChan->GetLatency(FLOW_OUTGOING); + const int iServerTick = m_iTickCount + G::AnticipatedChoke + Vars::Backtrack::Offset.Value; - const float flDelta = flCorrect - TICKS_TO_TIME(iServerTick - TIME_TO_TICKS(record.flSimTime)); + const float flDelta = flCorrect - TICKS_TO_TIME(iServerTick - TIME_TO_TICKS(record.m_flSimTime)); return fabsf(flDelta) < float(Vars::Backtrack::Window.Value) / 1000; } std::deque* CBacktrack::GetRecords(CBaseEntity* pEntity) { - if (mRecords[pEntity].empty()) + if (m_mRecords[pEntity].empty()) return nullptr; - return &mRecords[pEntity]; + return &m_mRecords[pEntity]; } std::deque CBacktrack::GetValidRecords(std::deque* pRecords, CTFPlayer* pLocal, bool bDistance) @@ -131,10 +133,10 @@ std::deque CBacktrack::GetValidRecords(std::deque* pReco if (bDistance) std::sort(validRecords.begin(), validRecords.end(), [&](const TickRecord& a, const TickRecord& b) -> bool { - if (Vars::Backtrack::PreferOnShot.Value && a.bOnShot != b.bOnShot) - return a.bOnShot > b.bOnShot; + if (Vars::Backtrack::PreferOnShot.Value && a.m_bOnShot != b.m_bOnShot) + return a.m_bOnShot > b.m_bOnShot; - return pLocal->m_vecOrigin().DistTo(a.vOrigin) < pLocal->m_vecOrigin().DistTo(b.vOrigin); + return pLocal->m_vecOrigin().DistTo(a.m_vOrigin) < pLocal->m_vecOrigin().DistTo(b.m_vOrigin); }); else { @@ -142,16 +144,16 @@ std::deque CBacktrack::GetValidRecords(std::deque* pReco if (!pNetChan) return validRecords; - const float flCorrect = std::clamp(pNetChan->GetLatency(FLOW_OUTGOING) + ROUND_TO_TICKS(flFakeInterp) + ROUND_TO_TICKS(flFakeLatency), 0.f, flMaxUnlag) - pNetChan->GetLatency(FLOW_OUTGOING); - const int iServerTick = iTickCount + G::AnticipatedChoke + Vars::Backtrack::Offset.Value; + const float flCorrect = std::clamp(pNetChan->GetLatency(FLOW_OUTGOING) + ROUND_TO_TICKS(m_flFakeInterp) + ROUND_TO_TICKS(m_flFakeLatency), 0.f, m_flMaxUnlag) - pNetChan->GetLatency(FLOW_OUTGOING); + const int iServerTick = m_iTickCount + G::AnticipatedChoke + Vars::Backtrack::Offset.Value; std::sort(validRecords.begin(), validRecords.end(), [&](const TickRecord& a, const TickRecord& b) -> bool { - if (Vars::Backtrack::PreferOnShot.Value && a.bOnShot != b.bOnShot) - return a.bOnShot > b.bOnShot; + if (Vars::Backtrack::PreferOnShot.Value && a.m_bOnShot != b.m_bOnShot) + return a.m_bOnShot > b.m_bOnShot; - const float flADelta = flCorrect - TICKS_TO_TIME(iServerTick - TIME_TO_TICKS(a.flSimTime)); - const float flBDelta = flCorrect - TICKS_TO_TIME(iServerTick - TIME_TO_TICKS(b.flSimTime)); + const float flADelta = flCorrect - TICKS_TO_TIME(iServerTick - TIME_TO_TICKS(a.m_flSimTime)); + const float flBDelta = flCorrect - TICKS_TO_TIME(iServerTick - TIME_TO_TICKS(b.m_flSimTime)); return fabsf(flADelta) < fabsf(flBDelta); }); } @@ -173,38 +175,38 @@ void CBacktrack::MakeRecords() pEntity->m_flSimulationTime(), *reinterpret_cast(H::Entities.GetBones(pEntity)), pEntity->m_vecOrigin(), - mDidShoot[pEntity->entindex()] + m_mDidShoot[pEntity->entindex()] }; bool bLagComp = false; - if (!mRecords[pEntity].empty()) // check for lagcomp breaking here + if (!m_mRecords[pEntity].empty()) { - const Vec3 vDelta = curRecord.vOrigin - mRecords[pEntity].front().vOrigin; + const Vec3 vDelta = curRecord.m_vOrigin - m_mRecords[pEntity].front().m_vOrigin; static auto sv_lagcompensation_teleport_dist = U::ConVars.FindVar("sv_lagcompensation_teleport_dist"); const float flDist = powf(sv_lagcompensation_teleport_dist ? sv_lagcompensation_teleport_dist->GetFloat() : 64.f, 2.f); if (vDelta.Length2DSqr() > flDist) { bLagComp = true; - for (auto& pRecord : mRecords[pEntity]) - pRecord.bInvalid = true; + for (auto& pRecord : m_mRecords[pEntity]) + pRecord.m_bInvalid = true; } - for (auto& pRecord : mRecords[pEntity]) + for (auto& pRecord : m_mRecords[pEntity]) { - if (!pRecord.bInvalid) + if (!pRecord.m_bInvalid) continue; - pRecord.BoneMatrix = curRecord.BoneMatrix; - pRecord.vOrigin = curRecord.vOrigin; - pRecord.bOnShot = curRecord.bOnShot; + pRecord.m_BoneMatrix = curRecord.m_BoneMatrix; + pRecord.m_vOrigin = curRecord.m_vOrigin; + pRecord.m_bOnShot = curRecord.m_bOnShot; } } - mRecords[pEntity].push_front(curRecord); + m_mRecords[pEntity].push_front(curRecord); H::Entities.SetLagCompensation(pEntity, bLagComp); - mDidShoot[pEntity->entindex()] = false; + m_mDidShoot[pEntity->entindex()] = false; } } @@ -218,19 +220,19 @@ void CBacktrack::CleanRecords() if (!pEntity->IsPlayer() || pEntity->IsDormant() || !pPlayer->IsAlive() || pPlayer->IsAGhost()) { - mRecords[pEntity].clear(); + m_mRecords[pEntity].clear(); continue; } //const int iOldSize = pRecords.size(); - const int flDeadtime = I::GlobalVars->curtime + GetReal() - flMaxUnlag; // int ??? - while (!mRecords[pEntity].empty()) + const int flDeadtime = I::GlobalVars->curtime + GetReal() - m_flMaxUnlag; // int ??? + while (!m_mRecords[pEntity].empty()) { - if (mRecords[pEntity].back().flSimTime >= flDeadtime) + if (m_mRecords[pEntity].back().m_flSimTime >= flDeadtime) break; - mRecords[pEntity].pop_back(); + m_mRecords[pEntity].pop_back(); } //const int iNewSize = pRecords.size(); @@ -248,7 +250,7 @@ void CBacktrack::FrameStageNotify() return Restart(); static auto sv_maxunlag = U::ConVars.FindVar("sv_maxunlag"); - flMaxUnlag = sv_maxunlag ? sv_maxunlag->GetFloat() : 1.f; + m_flMaxUnlag = sv_maxunlag ? sv_maxunlag->GetFloat() : 1.f; MakeRecords(); CleanRecords(); @@ -268,7 +270,7 @@ void CBacktrack::Run(CUserCmd* pCmd) void CBacktrack::ResolverUpdate(CBaseEntity* pEntity) { - mRecords[pEntity].clear(); // TODO: eventually remake records and rotate them or smthn idk, maybe just rotate them + m_mRecords[pEntity].clear(); // TODO: eventually remake records and rotate them or smthn idk, maybe just rotate them } void CBacktrack::ReportShot(int iIndex) @@ -280,19 +282,57 @@ void CBacktrack::ReportShot(int iIndex) if (!pEntity || SDK::GetWeaponType(pEntity->As()->m_hActiveWeapon().Get()->As()) != EWeaponType::HITSCAN) return; - mDidShoot[pEntity->entindex()] = true; + m_mDidShoot[pEntity->entindex()] = true; } -// Adjusts the fake latency ping void CBacktrack::AdjustPing(CNetChannel* pNetChan) { - for (auto& cSequence : dSequences) - { - if (I::GlobalVars->realtime - cSequence.CurTime >= GetFake()) + m_nInSequenceNr = pNetChan->m_nInSequenceNr, m_nInReliableState = pNetChan->m_nInReliableState; + + auto Set = [&]() { - pNetChan->m_nInReliableState = cSequence.InReliableState; - pNetChan->m_nInSequenceNr = cSequence.SequenceNr; - break; - } + if (!Vars::Backtrack::Enabled.Value || !Vars::Backtrack::Latency.Value) + return 0.f; + + auto pLocal = H::Entities.GetLocal(); + if (!pLocal || !pLocal->m_iClass()) + return 0.f; + + static auto host_timescale = U::ConVars.FindVar("host_timescale"); + float flTimescale = host_timescale ? host_timescale->GetFloat() : 1.f; + + static float flStaticReal = 0.f; + float flFake = GetFake(), flReal = TICKS_TO_TIME(pLocal->m_nTickBase() - m_nOldTickBase); + flStaticReal += (flReal + 5 * TICK_INTERVAL - flStaticReal) * 0.1f; + + int nInReliableState = pNetChan->m_nInReliableState, nInSequenceNr = pNetChan->m_nInSequenceNr; float flLatency = 0.f; + for (auto& cSequence : m_dSequences) + { + nInReliableState = cSequence.m_nInReliableState; + nInSequenceNr = cSequence.m_nSequenceNr; + flLatency = (I::GlobalVars->realtime - cSequence.m_flTime) * flTimescale - TICK_INTERVAL; + + if (flLatency > flFake || m_nOldInSequenceNr >= cSequence.m_nSequenceNr || flLatency > m_flMaxUnlag - flStaticReal) + break; + } + + pNetChan->m_nInReliableState = nInReliableState; + pNetChan->m_nInSequenceNr = nInSequenceNr; + return flLatency; + }; + + auto flLatency = Set(); + m_nOldInSequenceNr = pNetChan->m_nInSequenceNr; + + if (Vars::Backtrack::Enabled.Value && Vars::Backtrack::Latency.Value || m_flFakeLatency) + { + m_flFakeLatency = std::clamp(m_flFakeLatency + (flLatency - m_flFakeLatency) * 0.1f, m_flFakeLatency - TICK_INTERVAL, m_flFakeLatency + TICK_INTERVAL); + if (!flLatency && m_flFakeLatency < TICK_INTERVAL) + m_flFakeLatency = 0.f; } +} + +void CBacktrack::RestorePing(CNetChannel* pNetChan) +{ + pNetChan->m_nInSequenceNr = m_nInSequenceNr, pNetChan->m_nInReliableState = m_nInReliableState; } \ No newline at end of file diff --git a/Amalgam/src/Features/Backtrack/Backtrack.h b/Amalgam/src/Features/Backtrack/Backtrack.h index 78271054..4ef078b5 100644 --- a/Amalgam/src/Features/Backtrack/Backtrack.h +++ b/Amalgam/src/Features/Backtrack/Backtrack.h @@ -6,30 +6,30 @@ class CIncomingSequence { public: - int InReliableState; - int SequenceNr; - float CurTime; + int m_nInReliableState; + int m_nSequenceNr; + float m_flTime; - CIncomingSequence(int inState, int seqNr, float time) + CIncomingSequence(int iState, int iSequence, float flTime) { - InReliableState = inState; - SequenceNr = seqNr; - CurTime = time; + m_nInReliableState = iState; + m_nSequenceNr = iSequence; + m_flTime = flTime; } }; struct BoneMatrix { - matrix3x4 aBones[128]; + matrix3x4 m_aBones[128]; }; struct TickRecord { - float flSimTime = 0.f; - BoneMatrix BoneMatrix = {}; - Vec3 vOrigin = {}; - bool bOnShot = false; - bool bInvalid = false; + float m_flSimTime = 0.f; + BoneMatrix m_BoneMatrix = {}; + Vec3 m_vOrigin = {}; + bool m_bOnShot = false; + bool m_bInvalid = false; }; class CBacktrack @@ -44,18 +44,20 @@ class CBacktrack void CleanRecords(); // data - std::unordered_map mDidShoot; + std::unordered_map m_mDidShoot; // data - fake latency - std::deque dSequences; - int iLastInSequence = 0; - - bool bLastTickHeld = false; + std::deque m_dSequences; + int m_iLastInSequence = 0; + int m_nInSequenceNr = 0; + int m_nInReliableState = 0; + int m_nOldInSequenceNr = 0; + int m_nOldTickBase = 0; public: float GetLerp(); float GetFake(); - float GetReal(int iFlow = -1); + float GetReal(int iFlow = -1, bool bNoFake = true); std::deque* GetRecords(CBaseEntity* pEntity); std::deque GetValidRecords(std::deque* pRecords, CTFPlayer* pLocal = nullptr, bool bDistance = false); @@ -67,15 +69,16 @@ public: void ResolverUpdate(CBaseEntity* pEntity); void ReportShot(int iIndex); void AdjustPing(CNetChannel* netChannel); + void RestorePing(CNetChannel* netChannel); - int iTickCount = 0; - float flMaxUnlag = 1.f; + int m_iTickCount = 0; + float m_flMaxUnlag = 1.f; - float flFakeLatency = 0.f; - float flFakeInterp = 0.015f; - float flWishInterp = 0.015f; + float m_flFakeLatency = 0.f; + float m_flFakeInterp = 0.015f; + float m_flWishInterp = 0.015f; - std::unordered_map> mRecords; + std::unordered_map> m_mRecords; }; ADD_FEATURE(CBacktrack, Backtrack) \ No newline at end of file diff --git a/Amalgam/src/Features/CritHack/CritHack.cpp b/Amalgam/src/Features/CritHack/CritHack.cpp index f2bd7303..bae161ca 100644 --- a/Amalgam/src/Features/CritHack/CritHack.cpp +++ b/Amalgam/src/Features/CritHack/CritHack.cpp @@ -275,7 +275,7 @@ void CCritHack::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) return; ResetWeapons(pLocal); - Fill(pCmd, 15); + Fill(pCmd, 25); GetTotalCrits(pLocal, pWeapon); CanFireCritical(pLocal, pWeapon); if (pLocal->IsCritBoosted() || !WeaponCanCrit(pWeapon)) @@ -284,7 +284,9 @@ void CCritHack::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) if (pWeapon->GetWeaponID() == TF_WEAPON_MINIGUN && pCmd->buttons & IN_ATTACK) pCmd->buttons &= ~IN_ATTACK2; - bool bAttacking = G::IsAttacking = SDK::IsAttacking(pLocal, pWeapon, pCmd, false); + G::Attacking = SDK::IsAttacking(pLocal, pWeapon, pCmd, false); + + bool bAttacking = G::Attacking /*== 1*/ || G::DoubleTap; if (G::PrimaryWeaponType == EWeaponType::MELEE) { bAttacking = G::CanPrimaryAttack && pCmd->buttons & IN_ATTACK; diff --git a/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp b/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp index 13814fdc..27a238f5 100644 --- a/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp +++ b/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp @@ -89,7 +89,7 @@ void CEnginePrediction::Start(CTFPlayer* pLocal, CUserCmd* pCmd) else pLocal->m_fFlags() &= ~FL_ONGROUND; - m_bDoubletap = F::Ticks.GetTicks(pLocal) && Vars::CL_Move::Doubletap::AntiWarp.Value && pLocal->m_hGroundEntity(); // hopefully more accurate eyepos while dting + m_bDoubletap = F::Ticks.GetTicks() && Vars::CL_Move::Doubletap::AntiWarp.Value && pLocal->m_hGroundEntity(); // hopefully more accurate eyepos while dting if (m_bDoubletap) { diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.cpp b/Amalgam/src/Features/ImGui/Menu/Menu.cpp index b7d9c570..c01f2a30 100644 --- a/Amalgam/src/Features/ImGui/Menu/Menu.cpp +++ b/Amalgam/src/Features/ImGui/Menu/Menu.cpp @@ -134,14 +134,14 @@ void CMenu::MenuAimbot() FDropdown("Target", Vars::Aimbot::General::Target, { "Players", "Sentries", "Dispensers", "Teleporters", "Stickies", "NPCs", "Bombs" }, {}, FDropdown_Multi | FDropdown_Left); FDropdown("Ignore", Vars::Aimbot::General::Ignore, { "Invulnerable", "Cloaked", "Dead Ringer", "Vaccinator", "Unsimulated players", "Disguised", "Taunting" }, {}, FDropdown_Multi | FDropdown_Right); FSlider("Aim FOV", Vars::Aimbot::General::AimFOV, 0.f, 180.f, 1.f, "%g", FSlider_Clamp | FSlider_Precision); - PushTransparent(FGet(Vars::Aimbot::General::AimType) != 2); + PushTransparent(FGet(Vars::Aimbot::General::AimType) != Vars::Aimbot::General::AimTypeEnum::Smooth); FSlider("Smoothing## Hitscan", Vars::Aimbot::General::Smoothing, 0.f, 100.f, 1.f, "%g%%", FSlider_Clamp | FSlider_Precision); PopTransparent(); FSlider("Max targets", Vars::Aimbot::General::MaxTargets, 1, 6, 1, "%i", FSlider_Min); - PushTransparent(!(FGet(Vars::Aimbot::General::Ignore) & (1 << 1))); + PushTransparent(!(FGet(Vars::Aimbot::General::Ignore) & Vars::Aimbot::General::IgnoreEnum::Cloaked)); FSlider("Ignore cloak", Vars::Aimbot::General::IgnoreCloakPercentage, 0, 100, 10, "%d%%", FSlider_Clamp); PopTransparent(); - PushTransparent(!(FGet(Vars::Aimbot::General::Ignore) & (1 << 4))); + PushTransparent(!(FGet(Vars::Aimbot::General::Ignore) & Vars::Aimbot::General::IgnoreEnum::Unsimulated)); FSlider("Tick tolerance", Vars::Aimbot::General::TickTolerance, 0, 21, 1, "%i", FSlider_Clamp); PopTransparent(); FColorPicker("Aimbot FOV circle", Vars::Colors::FOVCircle); @@ -168,8 +168,8 @@ void CMenu::MenuAimbot() { FToggle("Enabled", Vars::Backtrack::Enabled); FToggle("Prefer on shot", Vars::Backtrack::PreferOnShot, FToggle_Middle); - FSlider("Fake latency", Vars::Backtrack::Latency, 0, F::Backtrack.flMaxUnlag * 1000, 5, "%i", FSlider_Clamp); // unreliable above 1000 - ping probably - FSlider("Fake interp", Vars::Backtrack::Interp, 0, F::Backtrack.flMaxUnlag * 1000, 5, "%i", FSlider_Clamp | FSlider_Precision); + FSlider("Fake latency", Vars::Backtrack::Latency, 0, F::Backtrack.m_flMaxUnlag * 1000, 5, "%i", FSlider_Clamp); // unreliable above 1000 - ping probably + FSlider("Fake interp", Vars::Backtrack::Interp, 0, F::Backtrack.m_flMaxUnlag * 1000, 5, "%i", FSlider_Clamp | FSlider_Precision); FSlider("Window", Vars::Backtrack::Window, 1, 200, 5, "%i", FSlider_Clamp); } EndSection(); if (Vars::Debug::Info.Value) @@ -193,9 +193,9 @@ void CMenu::MenuAimbot() FDropdown("Hitboxes", Vars::Aimbot::Hitscan::Hitboxes, { "Head", "Body", "Pelvis", "Arms", "Legs" }, { 1 << 0, 1 << 2, 1 << 1, 1 << 3, 1 << 4 }, FDropdown_Multi); FDropdown("Modifiers## Hitscan", Vars::Aimbot::Hitscan::Modifiers, { "Tapfire", "Wait for heatshot", "Wait for charge", "Scoped only", "Auto scope", "Bodyaim if lethal", "Extinguish team" }, {}, FDropdown_Multi); FSlider("Point scale", Vars::Aimbot::Hitscan::PointScale, 0.f, 100.f, 5.f, "%g%%", FSlider_Clamp | FSlider_Precision); - PushTransparent(!(FGet(Vars::Aimbot::Hitscan::Modifiers) & (1 << 0))); + PushTransparent(!(FGet(Vars::Aimbot::Hitscan::Modifiers) & Vars::Aimbot::Hitscan::ModifiersEnum::Tapfire)); FSlider("Tapfire distance", Vars::Aimbot::Hitscan::TapFireDist, 250.f, 1000.f, 50.f, "%g", FSlider_Min | FSlider_Precision); - PopTransparent(); + PopTransparent(); } EndSection(); if (Section("Projectile")) { @@ -220,7 +220,7 @@ void CMenu::MenuAimbot() { FText("\nground"); FSlider("samples##ground", Vars::Aimbot::Projectile::GroundSamples, 3, 66, 1, "%i", FSlider_Left); - FSlider("straight fuzzy value##ground", Vars::Aimbot::Projectile::GroundStraightFuzzyValue, 0.f, 500.f, 25.f, "%g", FSlider_Right | FSlider_Min | FSlider_Precision); + FSlider("straight fuzzy value##ground", Vars::Aimbot::Projectile::GroundStraightFuzzyValue, 0.f, 500.f, 25.f, "%g", FSlider_Right | FSlider_Precision); FSlider("low min samples##ground", Vars::Aimbot::Projectile::GroundLowMinimumSamples, 3, 66, 1, "%i", FSlider_Left); FSlider("high min samples##ground", Vars::Aimbot::Projectile::GroundHighMinimumSamples, 3, 66, 1, "%i", FSlider_Right); FSlider("low min distance##ground", Vars::Aimbot::Projectile::GroundLowMinimumDistance, 0.f, 10000.f, 100.f, "%g", FSlider_Left | FSlider_Min | FSlider_Precision); @@ -228,7 +228,7 @@ void CMenu::MenuAimbot() FText("air"); FSlider("samples##air", Vars::Aimbot::Projectile::AirSamples, 3, 66, 1, "%i", FSlider_Left); - FSlider("straight fuzzy value##air", Vars::Aimbot::Projectile::AirStraightFuzzyValue, 0.f, 500.f, 25.f, "%g", FSlider_Right | FSlider_Min | FSlider_Precision); + FSlider("straight fuzzy value##air", Vars::Aimbot::Projectile::AirStraightFuzzyValue, 0.f, 500.f, 25.f, "%g", FSlider_Right | FSlider_Precision); FSlider("low min samples##air", Vars::Aimbot::Projectile::AirLowMinimumSamples, 3, 66, 1, "%i", FSlider_Left); FSlider("high min samples##air", Vars::Aimbot::Projectile::AirHighMinimumSamples, 3, 66, 1, "%i", FSlider_Right); FSlider("low min distance##air", Vars::Aimbot::Projectile::AirLowMinimumDistance, 0.f, 10000.f, 100.f, "%g", FSlider_Left | FSlider_Min | FSlider_Precision); @@ -293,10 +293,10 @@ void CMenu::MenuAimbot() { FDropdown("Fakelag", Vars::CL_Move::Fakelag::Fakelag, { "Off", "Plain", "Random", "Adaptive" }, {}, FSlider_Left); FDropdown("Options", Vars::CL_Move::Fakelag::Options, { "Only moving", "On unduck", "Not airborne" }, {}, FDropdown_Multi | FSlider_Right); - PushTransparent(FGet(Vars::CL_Move::Fakelag::Fakelag) != 1); + PushTransparent(FGet(Vars::CL_Move::Fakelag::Fakelag) != Vars::CL_Move::Fakelag::FakelagEnum::Plain); FSlider("Plain ticks", Vars::CL_Move::Fakelag::PlainTicks, 1, 22, 1, "%i", FSlider_Clamp | FSlider_Left); PopTransparent(); - PushTransparent(FGet(Vars::CL_Move::Fakelag::Fakelag) != 2); + PushTransparent(FGet(Vars::CL_Move::Fakelag::Fakelag) != Vars::CL_Move::Fakelag::FakelagEnum::Random); FSlider("Random ticks", Vars::CL_Move::Fakelag::RandomTicks, 1, 22, 1, "%i - %i", FSlider_Clamp | FSlider_Right); PopTransparent(); FToggle("Unchoke on attack", Vars::CL_Move::Fakelag::UnchokeOnAttack); @@ -313,13 +313,13 @@ void CMenu::MenuAimbot() FDropdown("Fake offset", Vars::AntiHack::AntiAim::FakeYawMode, { "View", "Target" }, {}, FDropdown_Right); FSlider("Real offset## Offset", Vars::AntiHack::AntiAim::RealYawOffset, -180, 180, 5, "%i", FSlider_Left | FSlider_Clamp | FSlider_Precision); FSlider("Fake offset## Offset", Vars::AntiHack::AntiAim::FakeYawOffset, -180, 180, 5, "%i", FSlider_Right | FSlider_Clamp | FSlider_Precision); - PushTransparent(FGet(Vars::AntiHack::AntiAim::YawReal) != 5); - FSlider("Real jitter", Vars::AntiHack::AntiAim::RealJitter, -90.f, 90.f, 1.f, "%g", FSlider_Left | FSlider_Clamp | FSlider_Precision); + PushTransparent(FGet(Vars::AntiHack::AntiAim::YawReal) != Vars::AntiHack::AntiAim::YawEnum::Edge && FGet(Vars::AntiHack::AntiAim::YawReal) != Vars::AntiHack::AntiAim::YawEnum::Jitter); + FSlider("Real value", Vars::AntiHack::AntiAim::RealYawValue, -180, 180.f, 5.f, "%g", FSlider_Left | FSlider_Clamp | FSlider_Precision); PopTransparent(); - PushTransparent(FGet(Vars::AntiHack::AntiAim::YawFake) != 5); - FSlider("Fake jitter", Vars::AntiHack::AntiAim::FakeJitter, -90.f, 90.f, 1.f, "%g", FSlider_Right | FSlider_Clamp | FSlider_Precision); + PushTransparent(FGet(Vars::AntiHack::AntiAim::YawFake) != Vars::AntiHack::AntiAim::YawEnum::Edge && FGet(Vars::AntiHack::AntiAim::YawFake) != Vars::AntiHack::AntiAim::YawEnum::Jitter); + FSlider("Fake value", Vars::AntiHack::AntiAim::FakeYawValue, -180.f, 180.f, 5.f, "%g", FSlider_Right | FSlider_Clamp | FSlider_Precision); PopTransparent(); - PushTransparent(FGet(Vars::AntiHack::AntiAim::YawFake) != 6 && FGet(Vars::AntiHack::AntiAim::YawReal) != 6); + PushTransparent(FGet(Vars::AntiHack::AntiAim::YawFake) != Vars::AntiHack::AntiAim::YawEnum::Spin && FGet(Vars::AntiHack::AntiAim::YawReal) != Vars::AntiHack::AntiAim::YawEnum::Spin); FSlider("Spin speed", Vars::AntiHack::AntiAim::SpinSpeed, -30.f, 30.f, 1.f, "%g", FSlider_Left | FSlider_Precision); PopTransparent(); SetCursorPos({ GetWindowSize().x / 2 + 4, GetCursorPosY() - 24 }); @@ -354,11 +354,11 @@ void CMenu::MenuAimbot() FDropdown("Detection methods", Vars::CheaterDetection::Methods, { "Invalid pitch", "Packet choking", "Aim flicking", "Duck Speed" }, {}, FDropdown_Multi); FSlider("Detections required", Vars::CheaterDetection::DetectionsRequired, 10, 50, 1); - PushTransparent(!(FGet(Vars::CheaterDetection::Methods) & (1 << 1))); + PushTransparent(!(FGet(Vars::CheaterDetection::Methods) & Vars::CheaterDetection::MethodsEnum::PacketChoking)); FSlider("Minimum choking", Vars::CheaterDetection::MinimumChoking, 4, 22, 1); PopTransparent(); - PushTransparent(!(FGet(Vars::CheaterDetection::Methods) & (1 << 2))); + PushTransparent(!(FGet(Vars::CheaterDetection::Methods) & Vars::CheaterDetection::MethodsEnum::AimFlicking)); FSlider("Minimum flick angle", Vars::CheaterDetection::MinimumFlick, 10.f, 30.f, 1.f, "%.0f", FSlider_Left); FSlider("Maximum noise", Vars::CheaterDetection::MaximumNoise, 1.f, 10.f, 1.f, "%.0f", FSlider_Right); PopTransparent(); @@ -387,16 +387,16 @@ void CMenu::MenuVisuals() if (Section("ESP")) { FDropdown("Draw", Vars::ESP::Draw, { "Players", "Buildings", "Projectiles", "Objective", "NPCs", "Health", "Ammo", "Money", "Powerups", "Bombs", "Spellbook", "Gargoyle" }, {}, FDropdown_Multi); - PushTransparent(!(FGet(Vars::ESP::Draw) & (1 << 0))); + PushTransparent(!(FGet(Vars::ESP::Draw) & Vars::ESP::DrawEnum::Players)); FDropdown("Player", Vars::ESP::Player, { "Enemy", "Team", "Local", "Friends", "Prioritized", "##Divider", "Name", "Box", "Distance", "Bones", "Health bar", "Health text", "Uber bar", "Uber text", "Class icon", "Class text", "Weapon icon", "Weapon text", "Priority", "Labels", "Buffs", "Debuffs", "Misc", "Lag compensation", "Ping", "KDR" }, {}, FDropdown_Multi); PopTransparent(); - PushTransparent(!(FGet(Vars::ESP::Draw) & (1 << 1))); + PushTransparent(!(FGet(Vars::ESP::Draw) & Vars::ESP::DrawEnum::Buildings)); FDropdown("Building", Vars::ESP::Building, { "Enemy", "Team", "Local", "Friends", "Prioritized", "##Divider", "Name", "Box", "Distance", "Health bar", "Health text", "Owner", "Level", "Flags" }, {}, FDropdown_Multi); PopTransparent(); - PushTransparent(!(FGet(Vars::ESP::Draw) & (1 << 2))); + PushTransparent(!(FGet(Vars::ESP::Draw) & Vars::ESP::DrawEnum::Projectiles)); FDropdown("Projectile", Vars::ESP::Projectile, { "Enemy", "Team", "Local", "Friends", "Prioritized", "##Divider", "Name", "Box", "Distance", "Flags" }, {}, FDropdown_Multi); PopTransparent(); - PushTransparent(!(FGet(Vars::ESP::Draw) & (1 << 3))); + PushTransparent(!(FGet(Vars::ESP::Draw) & Vars::ESP::DrawEnum::Objective)); FDropdown("Objective", Vars::ESP::Objective, { "Enemy", "Team", "##Divider", "Name", "Box", "Distance", "Flags", "Intel return time" }, {}, FDropdown_Multi); PopTransparent(); } EndSection(); @@ -789,19 +789,19 @@ void CMenu::MenuVisuals() "sky_harvest_01", "sky_harvest_night_01", "sky_halloween", "sky_halloween_night_01", "sky_halloween_night2014_01", "sky_island_01", "sky_rainbow_01" }; FSDropdown("Skybox changer", Vars::Visuals::World::SkyboxChanger, skyNames, FSDropdown_Custom | FDropdown_Right); - PushTransparent(!(FGet(Vars::Visuals::World::Modulations)& (1 << 0))); + PushTransparent(!(FGet(Vars::Visuals::World::Modulations) & Vars::Visuals::World::ModulationsEnum::World)); FColorPicker("World modulation", Vars::Colors::WorldModulation, 0, FColorPicker_Left); PopTransparent(); - PushTransparent(!(FGet(Vars::Visuals::World::Modulations)& (1 << 1))); + PushTransparent(!(FGet(Vars::Visuals::World::Modulations) & Vars::Visuals::World::ModulationsEnum::Sky)); FColorPicker("Sky modulation", Vars::Colors::SkyModulation, 0, FColorPicker_Middle | FColorPicker_SameLine); PopTransparent(); - PushTransparent(!(FGet(Vars::Visuals::World::Modulations)& (1 << 2))); + PushTransparent(!(FGet(Vars::Visuals::World::Modulations) & Vars::Visuals::World::ModulationsEnum::Prop)); FColorPicker("Prop modulation", Vars::Colors::PropModulation, 0, FColorPicker_Left); PopTransparent(); - PushTransparent(!(FGet(Vars::Visuals::World::Modulations)& (1 << 3))); + PushTransparent(!(FGet(Vars::Visuals::World::Modulations) & Vars::Visuals::World::ModulationsEnum::Particle)); FColorPicker("Particle modulation", Vars::Colors::ParticleModulation, 0, FColorPicker_Middle | FColorPicker_SameLine); PopTransparent(); - PushTransparent(!(FGet(Vars::Visuals::World::Modulations)& (1 << 4))); + PushTransparent(!(FGet(Vars::Visuals::World::Modulations) & Vars::Visuals::World::ModulationsEnum::Fog)); FColorPicker("Fog modulation", Vars::Colors::FogModulation, 0, FColorPicker_Left); PopTransparent(); FToggle("Near prop fade", Vars::Visuals::World::NearPropFade); @@ -911,7 +911,7 @@ void CMenu::MenuMisc() if (Section("Movement")) { FDropdown("Autostrafe", Vars::Misc::Movement::AutoStrafe, { "Off", "Legit", "Directional" }); - PushTransparent(FGet(Vars::Misc::Movement::AutoStrafe) != 2); + PushTransparent(FGet(Vars::Misc::Movement::AutoStrafe) != Vars::Misc::Movement::AutoStrafeEnum::Directional); FSlider("Autostrafe turn scale", Vars::Misc::Movement::AutoStrafeTurnScale, 0.f, 1.f, 0.1f, "%g", FSlider_Clamp | FSlider_Precision); PopTransparent(); FToggle("Bunnyhop", Vars::Misc::Movement::Bunnyhop); @@ -1042,19 +1042,19 @@ void CMenu::MenuLogs() } EndSection(); if (Section("Vote Start")) { - PushTransparent(!(FGet(Vars::Logging::Logs) & (1 << 0))); + PushTransparent(!(FGet(Vars::Logging::Logs) & Vars::Logging::LogsEnum::VoteStart)); FDropdown("Log to", Vars::Logging::VoteStart::LogTo, { "Toasts", "Chat", "Party", "Console" }, { 1 << 0, 1 << 1, 1 << 2, 1 << 3 }, FDropdown_Multi); PopTransparent(); } EndSection(); if (Section("Vote Cast")) { - PushTransparent(!(FGet(Vars::Logging::Logs) & (1 << 1))); + PushTransparent(!(FGet(Vars::Logging::Logs) & Vars::Logging::LogsEnum::VoteCast)); FDropdown("Log to", Vars::Logging::VoteCast::LogTo, { "Toasts", "Chat", "Party", "Console" }, { 1 << 0, 1 << 1, 1 << 2, 1 << 3 }, FDropdown_Multi); PopTransparent(); } EndSection(); if (Section("Class Change")) { - PushTransparent(!(FGet(Vars::Logging::Logs) & (1 << 2))); + PushTransparent(!(FGet(Vars::Logging::Logs) & Vars::Logging::LogsEnum::ClassChanges)); FDropdown("Log to", Vars::Logging::ClassChange::LogTo, { "Toasts", "Chat", "Party", "Console" }, { 1 << 0, 1 << 1, 1 << 2, 1 << 3 }, FDropdown_Multi); PopTransparent(); } EndSection(); @@ -1063,25 +1063,25 @@ void CMenu::MenuLogs() TableNextColumn(); if (Section("Damage")) { - PushTransparent(!(FGet(Vars::Logging::Logs) & (1 << 3))); + PushTransparent(!(FGet(Vars::Logging::Logs) & Vars::Logging::LogsEnum::Damage)); FDropdown("Log to", Vars::Logging::Damage::LogTo, { "Toasts", "Chat", "Party", "Console" }, { 1 << 0, 1 << 1, 1 << 2, 1 << 3 }, FDropdown_Multi); PopTransparent(); } EndSection(); if (Section("Cheat Detection")) { - PushTransparent(!(FGet(Vars::Logging::Logs) & (1 << 4))); + PushTransparent(!(FGet(Vars::Logging::Logs) & Vars::Logging::LogsEnum::CheatDetection)); FDropdown("Log to", Vars::Logging::CheatDetection::LogTo, { "Toasts", "Chat", "Party", "Console" }, { 1 << 0, 1 << 1, 1 << 2, 1 << 3 }, FDropdown_Multi); PopTransparent(); } EndSection(); if (Section("Tags")) { - PushTransparent(!(FGet(Vars::Logging::Logs) & (1 << 5))); + PushTransparent(!(FGet(Vars::Logging::Logs) & Vars::Logging::LogsEnum::Tags)); FDropdown("Log to", Vars::Logging::Tags::LogTo, { "Toasts", "Chat", "Party", "Console" }, { 1 << 0, 1 << 1, 1 << 2, 1 << 3 }, FDropdown_Multi); PopTransparent(); } EndSection(); if (Section("Aliases")) { - PushTransparent(!(FGet(Vars::Logging::Logs) & (1 << 6))); + PushTransparent(!(FGet(Vars::Logging::Logs) & Vars::Logging::LogsEnum::Aliases)); FDropdown("Log to", Vars::Logging::Aliases::LogTo, { "Toasts", "Chat", "Party", "Console" }, { 1 << 0, 1 << 1, 1 << 2, 1 << 3 }, FDropdown_Multi); PopTransparent(); } EndSection(); diff --git a/Amalgam/src/Features/Misc/Misc.cpp b/Amalgam/src/Features/Misc/Misc.cpp index 59255466..f3c18d36 100644 --- a/Amalgam/src/Features/Misc/Misc.cpp +++ b/Amalgam/src/Features/Misc/Misc.cpp @@ -162,7 +162,7 @@ void CMisc::AutoPeek(CTFPlayer* pLocal, CUserCmd* pCmd) } // We've just attacked. Let's return! - if (G::LastUserCmd->buttons & IN_ATTACK || G::IsAttacking) + if (G::LastUserCmd->buttons & IN_ATTACK || G::Attacking) bReturning = true; if (bReturning) @@ -380,7 +380,7 @@ void CMisc::FastMovement(CTFPlayer* pLocal, CUserCmd* pCmd) } case 1: { - if ((pLocal->IsDucking() ? !Vars::Misc::Movement::CrouchSpeed.Value : !Vars::Misc::Movement::FastAccel.Value) || G::IsAttacking || G::DoubleTap || G::Recharge || G::AntiAim || pCmd->command_number % 2) + if ((pLocal->IsDucking() ? !Vars::Misc::Movement::CrouchSpeed.Value : !Vars::Misc::Movement::FastAccel.Value) || G::Attacking == 1 || G::DoubleTap || G::Recharge || G::AntiAim || pCmd->command_number % 2) return; if (!(pCmd->buttons & (IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT))) @@ -406,7 +406,7 @@ void CMisc::AntiWarp(CTFPlayer* pLocal, CUserCmd* pCmd) static Vec3 vVelocity = {}; if (G::AntiWarp) { - const int iDoubletapTicks = F::Ticks.GetTicks(pLocal); + const int iDoubletapTicks = F::Ticks.GetTicks(); Vec3 vAngles; Math::VectorAngles(vVelocity, vAngles); vAngles.y = pCmd->viewangles.y - vAngles.y; @@ -441,7 +441,7 @@ void CMisc::AntiWarp(CTFPlayer* pLocal, CUserCmd* pCmd) return; } - if (!G::IsAttacking && !bSet) + if (G::Attacking != 1 && !bSet) { bSet = true; SDK::StopMovement(pLocal, pCmd); @@ -453,7 +453,7 @@ void CMisc::AntiWarp(CTFPlayer* pLocal, CUserCmd* pCmd) void CMisc::LegJitter(CTFPlayer* pLocal, CUserCmd* pCmd, bool pSendPacket) { - if (!Vars::AntiHack::AntiAim::MinWalk.Value || !F::AntiAim.YawOn() || G::IsAttacking || G::DoubleTap || pSendPacket || !pLocal->m_hGroundEntity() || pLocal->IsInBumperKart()) + if (!Vars::AntiHack::AntiAim::MinWalk.Value || !F::AntiAim.YawOn() || G::Attacking == 1 || G::DoubleTap || pSendPacket || !pLocal->m_hGroundEntity() || pLocal->IsInBumperKart()) return; static bool pos = true; @@ -476,7 +476,7 @@ void CMisc::Event(IGameEvent* pEvent, uint32_t uHash) case FNV1A::Hash32Const("client_beginconnect"): case FNV1A::Hash32Const("game_newmap"): iWishCmdrate = iWishUpdaterate = -1; - F::Backtrack.flWishInterp = 0.f; + F::Backtrack.m_flWishInterp = 0.f; [[fallthrough]]; case FNV1A::Hash32Const("teamplay_round_start"): G::LineStorage.clear(); @@ -485,20 +485,9 @@ void CMisc::Event(IGameEvent* pEvent, uint32_t uHash) } } -void CMisc::DoubletapPacket(CUserCmd* pCmd, bool* pSendPacket) -{ - if (G::DoubleTap /*|| G::Warp*/) - { - *pSendPacket = G::ShiftedGoal == G::ShiftedTicks; - if (I::ClientState->chokedcommands >= 21 // prevent overchoking - || G::ShiftedTicks == G::ShiftedGoal + Vars::CL_Move::Doubletap::TickLimit.Value - 1 && I::ClientState->chokedcommands) // unchoke if we are choking - *pSendPacket = true; - } -} - int CMisc::AntiBackstab(CTFPlayer* pLocal, CUserCmd* pCmd, bool bSendPacket) { - if (!Vars::Misc::Automation::AntiBackstab.Value || !bSendPacket || G::IsAttacking || pLocal->IsInBumperKart()) + if (!Vars::Misc::Automation::AntiBackstab.Value || !bSendPacket || G::Attacking == 1 || pLocal->IsInBumperKart()) return 0; std::vector> vTargets = {}; diff --git a/Amalgam/src/Features/Misc/Misc.h b/Amalgam/src/Features/Misc/Misc.h index 6c4ed531..6a5e6049 100644 --- a/Amalgam/src/Features/Misc/Misc.h +++ b/Amalgam/src/Features/Misc/Misc.h @@ -33,7 +33,6 @@ public: void RunPost(CTFPlayer* pLocal, CUserCmd* pCmd, bool pSendPacket); void Event(IGameEvent* pEvent, uint32_t uNameHash); - void DoubletapPacket(CUserCmd* pCmd, bool* pSendPacket); int AntiBackstab(CTFPlayer* pLocal, CUserCmd* pCmd, bool bSendPacket); void UnlockAchievements(); diff --git a/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp b/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp index 21853e00..f0393f04 100644 --- a/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp +++ b/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp @@ -27,7 +27,7 @@ bool CNoSpreadHitscan::ShouldRun(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, bool if (pWeapon->GetWeaponSpread() <= 0.f) return false; - return bCreateMove ? G::IsAttacking : true; + return bCreateMove ? G::Attacking == 1 : true; } int CNoSpreadHitscan::GetSeed(CUserCmd* pCmd) @@ -155,7 +155,7 @@ void CNoSpreadHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* if (!iBullet) // Check if we'll get a guaranteed perfect shot { bool bDoubletap = false; // if we are doubletapping and firerate fast enough, prioritize later bullets - int iTicks = F::Ticks.GetTicks(pLocal); + int iTicks = F::Ticks.GetTicks(); if (iTicks && pWeaponInfo) { float flDoubletapTime = TICKS_TO_TIME(iTicks); diff --git a/Amalgam/src/Features/NoSpread/NoSpreadProjectile/NoSpreadProjectile.cpp b/Amalgam/src/Features/NoSpread/NoSpreadProjectile/NoSpreadProjectile.cpp index accba179..302bca70 100644 --- a/Amalgam/src/Features/NoSpread/NoSpreadProjectile/NoSpreadProjectile.cpp +++ b/Amalgam/src/Features/NoSpread/NoSpreadProjectile/NoSpreadProjectile.cpp @@ -12,7 +12,7 @@ bool CNoSpreadProjectile::ShouldRun(CTFPlayer* pLocal, CTFWeaponBase* pWeapon) return false; } - return G::IsAttacking; + return G::Attacking == 1; } void CNoSpreadProjectile::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) diff --git a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp index a59da902..03317efb 100644 --- a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp +++ b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp @@ -38,7 +38,7 @@ bool CAntiAim::ShouldRun(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC return false; if (!pLocal->IsAlive() || pLocal->IsAGhost() || pLocal->IsTaunting() || pLocal->IsInBumperKart() - || G::IsAttacking || F::AutoRocketJump.IsRunning() + || G::Attacking == 1 || F::AutoRocketJump.IsRunning() || pWeapon && pWeapon->m_iItemDefinitionIndex() == Soldier_m_TheBeggarsBazooka && pCmd->buttons & IN_ATTACK && !(G::LastUserCmd->buttons & IN_ATTACK)) return false; @@ -49,7 +49,7 @@ bool CAntiAim::ShouldRun(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC void CAntiAim::FakeShotAngles(CUserCmd* pCmd) { - if (!Vars::AntiHack::AntiAim::InvalidShootPitch.Value || !G::IsAttacking || G::PrimaryWeaponType != EWeaponType::HITSCAN) + if (!Vars::AntiHack::AntiAim::InvalidShootPitch.Value || G::Attacking != 1 || G::PrimaryWeaponType != EWeaponType::HITSCAN) return; G::SilentAngles = true; @@ -73,7 +73,7 @@ float CAntiAim::EdgeDistance(CTFPlayer* pEntity, float flEdgeRayYaw, float flOff return (trace.startpos - trace.endpos).Length2D(); } -bool CAntiAim::GetEdge(CTFPlayer* pEntity, const float flEdgeOrigYaw, bool bUpPitch) +int CAntiAim::GetEdge(CTFPlayer* pEntity, const float flEdgeOrigYaw, bool bUpPitch) { // we should probably make this dynamic for different head positions @@ -82,8 +82,8 @@ bool CAntiAim::GetEdge(CTFPlayer* pEntity, const float flEdgeOrigYaw, bool bUpPi float flEdgeRightDist = EdgeDistance(pEntity, flEdgeOrigYaw, flSize); if (flEdgeLeftDist > 299.f && flEdgeRightDist > 299.f) - return bUpPitch; - return bUpPitch ? flEdgeLeftDist > flEdgeRightDist : flEdgeLeftDist < flEdgeRightDist; + return bUpPitch ? 1 : -1; + return (bUpPitch ? flEdgeLeftDist > flEdgeRightDist : flEdgeLeftDist < flEdgeRightDist) ? 1 : -1; } void CAntiAim::RunOverlapping(CTFPlayer* pEntity, CUserCmd* pCmd, float& flRealYaw, bool bFake, float flEpsilon) @@ -97,18 +97,29 @@ void CAntiAim::RunOverlapping(CTFPlayer* pEntity, CUserCmd* pCmd, float& flRealY flRealYaw += flYawDiff > 0 ? flEpsilon : -flEpsilon; } +inline int GetJitter(uint32_t uHash) +{ + static std::unordered_map mJitter = {}; + + if (!I::ClientState->chokedcommands) + mJitter[uHash] = !mJitter[uHash]; + return mJitter[uHash] ? 1 : -1; +} + float CAntiAim::GetYawOffset(CTFPlayer* pEntity, bool bFake) { const int iMode = bFake ? Vars::AntiHack::AntiAim::YawFake.Value : Vars::AntiHack::AntiAim::YawReal.Value; const bool bUpPitch = (bFake ? Vars::AntiHack::AntiAim::PitchFake.Value : Vars::AntiHack::AntiAim::PitchReal.Value) == Vars::AntiHack::AntiAim::PitchRealEnum::Up; + int iJitter = GetJitter(FNV1A::Hash32Const("Yaw")); + switch (iMode) { case Vars::AntiHack::AntiAim::YawEnum::Forward: return 0.f; - case Vars::AntiHack::AntiAim::YawEnum::Left: return 135.f; - case Vars::AntiHack::AntiAim::YawEnum::Right: return -135.f; + case Vars::AntiHack::AntiAim::YawEnum::Left: return 90.f; + case Vars::AntiHack::AntiAim::YawEnum::Right: return -90.f; case Vars::AntiHack::AntiAim::YawEnum::Backwards: return 180.f; - case Vars::AntiHack::AntiAim::YawEnum::Edge: return (GetEdge(pEntity, I::EngineClient->GetViewAngles().y, bUpPitch) ? 1 : -1) * (bFake ? -135 : 135); - case Vars::AntiHack::AntiAim::YawEnum::Jitter: return (bFake ? Vars::AntiHack::AntiAim::FakeJitter.Value : Vars::AntiHack::AntiAim::RealJitter.Value) * (I::GlobalVars->tickcount % 2 ? -1 : 1); + case Vars::AntiHack::AntiAim::YawEnum::Edge: return (bFake ? Vars::AntiHack::AntiAim::FakeYawValue.Value : Vars::AntiHack::AntiAim::RealYawValue.Value) * GetEdge(pEntity, I::EngineClient->GetViewAngles().y, bUpPitch); + case Vars::AntiHack::AntiAim::YawEnum::Jitter: return (bFake ? Vars::AntiHack::AntiAim::FakeYawValue.Value : Vars::AntiHack::AntiAim::RealYawValue.Value) * iJitter; case Vars::AntiHack::AntiAim::YawEnum::Spin: return fmod(I::GlobalVars->tickcount * Vars::AntiHack::AntiAim::SpinSpeed.Value + 180.f, 360.f) - 180.f; } return 0.f; @@ -155,22 +166,23 @@ float CAntiAim::GetYaw(CTFPlayer* pLocal, CUserCmd* pCmd, bool bFake) float CAntiAim::GetPitch(float flCurPitch) { float flRealPitch = 0.f, flFakePitch = 0.f; + int iJitter = GetJitter(FNV1A::Hash32Const("Pitch")); switch (Vars::AntiHack::AntiAim::PitchReal.Value) { case Vars::AntiHack::AntiAim::PitchRealEnum::Up: flRealPitch = -89.f; break; case Vars::AntiHack::AntiAim::PitchRealEnum::Down: flRealPitch = 89.f; break; case Vars::AntiHack::AntiAim::PitchRealEnum::Zero: flRealPitch = 0.f; break; - case Vars::AntiHack::AntiAim::PitchRealEnum::Jitter: flRealPitch = -89.f * (I::GlobalVars->tickcount % 2 ? -1 : 1); break; - case Vars::AntiHack::AntiAim::PitchRealEnum::ReverseJitter: flRealPitch = 89.f * (I::GlobalVars->tickcount % 2 ? -1 : 1); break; + case Vars::AntiHack::AntiAim::PitchRealEnum::Jitter: flRealPitch = -89.f * iJitter; break; + case Vars::AntiHack::AntiAim::PitchRealEnum::ReverseJitter: flRealPitch = 89.f * iJitter; break; } switch (Vars::AntiHack::AntiAim::PitchFake.Value) { case Vars::AntiHack::AntiAim::PitchFakeEnum::Up: flFakePitch = -89.f; break; case Vars::AntiHack::AntiAim::PitchFakeEnum::Down: flFakePitch = 89.f; break; - case Vars::AntiHack::AntiAim::PitchFakeEnum::Jitter: flFakePitch = -89.f * (I::GlobalVars->tickcount % 2 ? -1 : 1); break; - case Vars::AntiHack::AntiAim::PitchFakeEnum::ReverseJitter: flFakePitch = 89.f * (I::GlobalVars->tickcount % 2 ? -1 : 1); break; + case Vars::AntiHack::AntiAim::PitchFakeEnum::Jitter: flFakePitch = -89.f * iJitter; break; + case Vars::AntiHack::AntiAim::PitchFakeEnum::ReverseJitter: flFakePitch = 89.f * iJitter; break; } if (Vars::AntiHack::AntiAim::PitchReal.Value && Vars::AntiHack::AntiAim::PitchFake.Value) diff --git a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h index e4ea7997..c4f09aaa 100644 --- a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h +++ b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h @@ -19,7 +19,7 @@ public: bool YawOn(); bool ShouldRun(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); - bool GetEdge(CTFPlayer* pEntity, float flEdgeOrigYaw, bool bUpPitch); + int GetEdge(CTFPlayer* pEntity, float flEdgeOrigYaw, bool bUpPitch); void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, bool bSendPacket); Vec2 vFakeAngles = {}; diff --git a/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp b/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp index 4befb501..b4c459da 100644 --- a/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp +++ b/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp @@ -15,7 +15,7 @@ bool CFakeLag::IsAllowed(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC return true; } - if (G::IsAttacking && Vars::CL_Move::Fakelag::UnchokeOnAttack.Value || F::AutoRocketJump.IsRunning() + if (G::Attacking == 1 && Vars::CL_Move::Fakelag::UnchokeOnAttack.Value || F::AutoRocketJump.IsRunning() || Vars::CL_Move::Fakelag::Options.Value & Vars::CL_Move::Fakelag::OptionsEnum::WhileAirborne && !pLocal->m_hGroundEntity() || pWeapon && pWeapon->m_iItemDefinitionIndex() == Soldier_m_TheBeggarsBazooka && pCmd->buttons & IN_ATTACK && !(G::LastUserCmd->buttons & IN_ATTACK)) // try to prevent issues return false; diff --git a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp index 9e406cb1..7bc91d34 100644 --- a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp +++ b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp @@ -120,6 +120,15 @@ void CMovementSimulation::Reset(PlayerStorage& playerStorage) } +inline float GetPlayerGravity(CTFPlayer* pEntity) +{ + static auto sv_gravity = U::ConVars.FindVar("sv_gravity"); + + float flGravity = pEntity->m_flGravity() ? pEntity->m_flGravity() : 1.f; + if (auto pGameRules = I::TFGameRules->Get()) + return sv_gravity->GetFloat() * pGameRules->m_flGravityMultiplier() * flGravity; + return sv_gravity->GetFloat() * flGravity; +} /* inline float SolveCubic(float b, float c, float d) @@ -236,7 +245,7 @@ void CMovementSimulation::Store() CGameTrace trace = {}; CTraceFilterWorldAndPropsOnly filter = {}; SDK::TraceHull(pRecord->m_vOrigin, pRecord->m_vOrigin + pRecord->m_vVelocity * TICK_INTERVAL, pPlayer->m_vecMins() + 0.125f, pPlayer->m_vecMaxs() - 0.125f, MASK_PLAYERSOLID, &filter, &trace); - if (trace.DidHit()) + if (trace.DidHit() && trace.plane.normal.z < 0.707f) { pRecord = nullptr; vRecords.clear(); @@ -247,21 +256,21 @@ void CMovementSimulation::Store() { //bool bSet = false; // debug - static auto sv_accelerate = U::ConVars.FindVar("sv_accelerate"); - static auto sv_friction = U::ConVars.FindVar("sv_friction"); - static auto sv_stopspeed = U::ConVars.FindVar("sv_stopspeed"); + //static auto sv_accelerate = U::ConVars.FindVar("sv_accelerate"); + //static auto sv_friction = U::ConVars.FindVar("sv_friction"); + //static auto sv_stopspeed = U::ConVars.FindVar("sv_stopspeed"); - float flAccel = sv_accelerate->GetFloat(); - float flFriction = sv_friction->GetFloat(); - float flStopSpeed = sv_stopspeed->GetFloat(); + //float flAccel = sv_accelerate->GetFloat(); + //float flFriction = sv_friction->GetFloat(); + //float flStopSpeed = sv_stopspeed->GetFloat(); float flMaxSpeed = pPlayer->TeamFortress_CalculateMaxSpeed() / (pPlayer->IsDucking() ? 3 : 1); - float flEntFriction = 1.f; + //float flEntFriction = 1.f; //if (bLocal) { if (tRecord.m_iMode != 0) - tRecord.m_vDirection = Vec3(pPlayer->m_vecVelocity().x, pPlayer->m_vecVelocity().y, 0).GetNorm() * flMaxSpeed; + tRecord.m_vDirection = Vec3(vVelocity.x, vVelocity.y, 0).GetNorm() * flMaxSpeed; } //else { @@ -385,7 +394,6 @@ void CMovementSimulation::Store() //G::LineStorage.push_back({ { tRecord.m_vOrigin, tRecord.m_vOrigin + tRecord.m_vDirection }, I::GlobalVars->curtime + 0.5f, bSet ? Color_t(SDK::RandomInt(200, 255), SDK::RandomInt(200, 255), SDK::RandomInt(200, 255), 255) : Color_t(0, 0, 0, 255) }); } - vRecords.push_front(tRecord); if (vRecords.size() > 66) vRecords.pop_back(); @@ -595,42 +603,50 @@ bool CMovementSimulation::SetupMoveData(PlayerStorage& playerStorage) return true; } -bool CMovementSimulation::GetYawDifference(const std::deque& vRecords, size_t i, float* flYaw, float flStraightFuzzyValue) +bool CMovementSimulation::GetYawDifference(PlayerStorage& playerStorage, size_t i, float* flYaw, float flStraightFuzzyValue) { + const auto& vRecords = mRecords[playerStorage.m_pPlayer->entindex()]; if (vRecords.size() <= i + 2) return false; const auto& pRecord1 = vRecords[i], &pRecord2 = vRecords[i + 1]; const float flYaw1 = Math::VelocityToAngles(pRecord1.m_vDirection).y, flYaw2 = Math::VelocityToAngles(pRecord2.m_vDirection).y; const float flTime1 = pRecord1.m_flSimTime, flTime2 = pRecord2.m_flSimTime; - const int iTicks = std::max(TIME_TO_TICKS(flTime1 - flTime2), 1); - *flYaw = (flYaw1 - flYaw2) / iTicks; + + *flYaw = flYaw1 - flYaw2; *flYaw = fmodf(*flYaw + 180.f, 360.f); *flYaw += *flYaw < 0 ? 180.f : -180.f; + *flYaw /= iTicks; static int iSign = 0; const int iLastSign = iSign; const int iCurSign = iSign = *flYaw > 0 ? 1 : -1; - if (fabsf(*flYaw) * pRecord1.m_vVelocity.Length2D() * iTicks < flStraightFuzzyValue) // dumb way to get straight bool + if (fabsf(*flYaw) * pRecord1.m_vVelocity.Length2D() * iTicks <= flStraightFuzzyValue) // dumb way to get straight bool return false; + /* + if (!playerStorage.m_pPlayer->IsOnGround()) + { + float flPrevVelZ = pRecord1.m_vVelocity.z - GetPlayerGravity(playerStorage.m_pPlayer) * TICK_INTERVAL; + *flYaw /= 0.f < flPrevVelZ && flPrevVelZ <= 250.f ? 0.25f : 1.f; // flEntFriction will be 0.25f if flPrevVelZ is between 0.f and 250.f + } + */ + return !i || iLastSign == iCurSign; } float CMovementSimulation::GetAverageYaw(PlayerStorage& playerStorage, const int iSamples) { - const auto& vRecords = mRecords[playerStorage.m_pPlayer->entindex()]; - bool bGround = playerStorage.m_pPlayer->IsOnGround(); float flStraightFuzzyValue = bGround ? Vars::Aimbot::Projectile::GroundStraightFuzzyValue.Value : Vars::Aimbot::Projectile::AirStraightFuzzyValue.Value; - float flAverageYaw = 0.f; size_t i = 0; - for (; i < iSamples; i++) + float flAverageYaw = 0.f; + size_t i = 0; for (; i < iSamples; i++) { float flYaw; - if (!GetYawDifference(vRecords, i, &flYaw, flStraightFuzzyValue)) + if (!GetYawDifference(playerStorage, i, &flYaw, flStraightFuzzyValue)) break; flAverageYaw += flYaw; } @@ -648,8 +664,10 @@ float CMovementSimulation::GetAverageYaw(PlayerStorage& playerStorage, const int unsigned long long iMinimumStrafes = (flDistance < flLowMinimumDistance) ? flLowMinimumSamples : Math::RemapValClamped(flDistance, flLowMinimumDistance, flHighMinimumDistance, flLowMinimumSamples + 1, flHighMinimumSamples); flAverageYaw /= std::max(i, iMinimumStrafes); + if (fabsf(flAverageYaw) < 0.1f) + return 0.f; - SDK::Output("MovementSimulation", std::format("flAverageYaw calculated to {} from {}", flAverageYaw, i).c_str(), { 100, 255, 150, 255 }, Vars::Debug::Logging.Value); + SDK::Output("MovementSimulation", std::format("flAverageYaw calculated to {} from {} ({})", flAverageYaw, std::max(i, iMinimumStrafes), i).c_str(), { 100, 255, 150, 255 }, Vars::Debug::Logging.Value); return flAverageYaw; } @@ -682,20 +700,32 @@ void CMovementSimulation::RunTick(PlayerStorage& playerStorage, bool bPath) float flCorrection = 0.f; if (playerStorage.m_flAverageYaw) { + float flYaw = playerStorage.m_flAverageYaw; + if (!playerStorage.m_pPlayer->IsOnGround()) + { flCorrection = 90.f * sign(playerStorage.m_flAverageYaw); - playerStorage.m_MoveData.m_vecViewAngles.y += playerStorage.m_flAverageYaw + flCorrection; + float flPrevVelZ = playerStorage.m_MoveData.m_vecVelocity.z + GetPlayerGravity(playerStorage.m_pPlayer) * TICK_INTERVAL; + flYaw *= 0.f < flPrevVelZ && flPrevVelZ <= 250.f ? 0.25f : 1.f; // flEntFriction will be 0.25f if flPrevVelZ is between 0.f and 250.f + } + + playerStorage.m_MoveData.m_vecViewAngles.y += flYaw + flCorrection; + } + else + { + if (!playerStorage.m_pPlayer->IsOnGround()) + playerStorage.m_MoveData.m_flForwardMove = playerStorage.m_MoveData.m_flSideMove = 0.f; + //else + // playerStorage.m_MoveData.m_vecViewAngles.y = Math::VelocityToAngles(playerStorage.m_MoveData.m_vecVelocity).y; } - //else - // playerStorage.m_MoveData.m_vecViewAngles.y = Math::VelocityToAngles(playerStorage.m_MoveData.m_vecVelocity).y; /* { Vec3 vMove = Vec3(playerStorage.m_MoveData.m_flForwardMove, -playerStorage.m_MoveData.m_flSideMove, playerStorage.m_MoveData.m_flUpMove); Vec3 v1 = playerStorage.m_MoveData.m_vecAbsOrigin; - Vec3 v2 = v1 + (vMove.IsZero() ? Vec3(0, 0, 1) : Math::RotatePoint(vMove.GetNorm(), {}, { 0, playerStorage.m_MoveData.m_vecViewAngles.y, 0 })) * Vars::Visuals::Simulation::SeparatorLength.Value; + Vec3 v2 = v1 + (vMove.IsZero() ? Vec3(0, 0, 1) : Math::RotatePoint(vMove.GetNorm() * 12, {}, { 0, playerStorage.m_MoveData.m_vecViewAngles.y, 0 })); G::LineStorage.push_back({ { v1, v2 }, I::GlobalVars->curtime + 5.f, Color_t(SDK::RandomInt(0, 255), SDK::RandomInt(0, 255), SDK::RandomInt(0, 255), 255) }); } @@ -711,7 +741,14 @@ void CMovementSimulation::RunTick(PlayerStorage& playerStorage, bool bPath) playerStorage.m_flPredictedSimTime += playerStorage.m_flPredictedDelta; } - playerStorage.m_MoveData.m_vecViewAngles.y -= flCorrection; + if (playerStorage.m_flAverageYaw) + playerStorage.m_MoveData.m_vecViewAngles.y -= flCorrection; + else if (playerStorage.m_pPlayer->IsOnGround() && !playerStorage.m_MoveData.m_flForwardMove && !playerStorage.m_MoveData.m_flSideMove && !playerStorage.m_MoveData.m_vecVelocity.IsZero()) + { + Vec3 vMove = Math::RotatePoint(playerStorage.m_MoveData.m_vecVelocity * Vec3(1, 1, 0), {}, { 0, -playerStorage.m_MoveData.m_vecViewAngles.y, 0 }); + playerStorage.m_MoveData.m_flForwardMove = vMove.x; + playerStorage.m_MoveData.m_flSideMove = -vMove.y; + } } void CMovementSimulation::Restore(PlayerStorage& playerStorage) diff --git a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h index df94a967..4d46d81b 100644 --- a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h +++ b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h @@ -90,7 +90,7 @@ private: void Reset(PlayerStorage& playerStorage); bool SetupMoveData(PlayerStorage& playerStorage); - bool GetYawDifference(const std::deque& vRecords, size_t i, float* flYaw, float flStraightFuzzyValue = 0.f); + bool GetYawDifference(PlayerStorage& playerStorage, size_t i, float* flYaw, float flStraightFuzzyValue = 0.f); float GetAverageYaw(PlayerStorage& playerStorage, const int iSamples); bool StrafePrediction(PlayerStorage& playerStorage, const int iSamples); diff --git a/Amalgam/src/Features/TickHandler/TickHandler.cpp b/Amalgam/src/Features/TickHandler/TickHandler.cpp index 222458c3..3f5244fe 100644 --- a/Amalgam/src/Features/TickHandler/TickHandler.cpp +++ b/Amalgam/src/Features/TickHandler/TickHandler.cpp @@ -52,9 +52,10 @@ void CTickshiftHandler::Teleport() void CTickshiftHandler::Doubletap(CTFPlayer* pLocal, CUserCmd* pCmd) { + bool bAttacking = G::PrimaryWeaponType == EWeaponType::MELEE ? pCmd->buttons & IN_ATTACK : G::Attacking; if (G::ShiftedTicks < std::min(Vars::CL_Move::Doubletap::TickLimit.Value - 1, G::MaxShift) || G::WaitForShift || G::Warp || G::Recharge || bSpeedhack - || !G::CanPrimaryAttack || (G::PrimaryWeaponType == EWeaponType::MELEE ? !(pCmd->buttons & IN_ATTACK) : !G::IsAttacking) && !G::DoubleTap || F::AutoRocketJump.IsRunning()) + || !G::CanPrimaryAttack && !G::Reloading || !bAttacking && !G::DoubleTap || F::AutoRocketJump.IsRunning()) return; G::DoubleTap = Vars::CL_Move::Doubletap::Doubletap.Value; @@ -64,7 +65,7 @@ void CTickshiftHandler::Doubletap(CTFPlayer* pLocal, CUserCmd* pCmd) G::ShiftedGoal = G::ShiftedTicks - std::min(Vars::CL_Move::Doubletap::TickLimit.Value - 1, G::MaxShift); } -int CTickshiftHandler::GetTicks(CTFPlayer* pLocal) +int CTickshiftHandler::GetTicks() { if (G::DoubleTap && G::ShiftedGoal < G::ShiftedTicks) return G::ShiftedTicks - G::ShiftedGoal; @@ -144,7 +145,7 @@ void CTickshiftHandler::MoveMain(float accumulated_extra_samples, bool bFinalTic { if (!ValidWeapon(pWeapon)) G::WaitForShift = 2; - else if (G::IsAttacking || !G::CanPrimaryAttack) + else if (G::Attacking || !G::CanPrimaryAttack && !G::Reloading) G::WaitForShift = Vars::CL_Move::Doubletap::TickLimit.Value; } } @@ -213,4 +214,15 @@ void CTickshiftHandler::Run(float accumulated_extra_samples, bool bFinalTick, CT MovePre(pLocal); MoveMain(accumulated_extra_samples, bFinalTick); +} + +void CTickshiftHandler::ManagePacket(CUserCmd* pCmd, bool* pSendPacket) +{ + if (!G::DoubleTap /*&& !G::Warp*/) + return; + + *pSendPacket = G::ShiftedGoal == G::ShiftedTicks; + if (I::ClientState->chokedcommands >= 21 // prevent overchoking + || G::ShiftedTicks == G::ShiftedGoal + Vars::CL_Move::Doubletap::TickLimit.Value - 1 && I::ClientState->chokedcommands) // unchoke if we are choking + *pSendPacket = true; } \ No newline at end of file diff --git a/Amalgam/src/Features/TickHandler/TickHandler.h b/Amalgam/src/Features/TickHandler/TickHandler.h index f73c365d..5cc567d6 100644 --- a/Amalgam/src/Features/TickHandler/TickHandler.h +++ b/Amalgam/src/Features/TickHandler/TickHandler.h @@ -20,9 +20,10 @@ class CTickshiftHandler bool bGoalReached = true; public: - int GetTicks(CTFPlayer* pLocal); + int GetTicks(); void Run(float accumulated_extra_samples, bool bFinalTick, CTFPlayer* pLocal); void MovePost(CTFPlayer* pLocal, CUserCmd* pCmd); + void ManagePacket(CUserCmd* pCmd, bool* pSendPacket); void Reset(); int iDeficit = 0; diff --git a/Amalgam/src/Features/Visuals/Chams/Chams.cpp b/Amalgam/src/Features/Visuals/Chams/Chams.cpp index 75e37abf..9f283a77 100644 --- a/Amalgam/src/Features/Visuals/Chams/Chams.cpp +++ b/Amalgam/src/Features/Visuals/Chams/Chams.cpp @@ -402,28 +402,28 @@ void CChams::RenderBacktrack(const DrawModelState_t& pState, const ModelRenderIn case Vars::Chams::Backtrack::DrawEnum::Last: // last { auto vLastRec = vRecords.end() - 1; - if (vLastRec != vRecords.end() && pEntity->GetAbsOrigin().DistTo(vLastRec->vOrigin) > 0.1f) - drawModel(vLastRec->vOrigin, pState, pInfo, vLastRec->BoneMatrix.aBones); + if (vLastRec != vRecords.end() && pEntity->GetAbsOrigin().DistTo(vLastRec->m_vOrigin) > 0.1f) + drawModel(vLastRec->m_vOrigin, pState, pInfo, vLastRec->m_BoneMatrix.m_aBones); break; } case Vars::Chams::Backtrack::DrawEnum::LastFirst: // last + first { auto vFirstRec = vRecords.begin(); - if (vFirstRec != vRecords.end() && pEntity->GetAbsOrigin().DistTo(vFirstRec->vOrigin) > 0.1f) - drawModel(vFirstRec->vOrigin, pState, pInfo, vFirstRec->BoneMatrix.aBones); + if (vFirstRec != vRecords.end() && pEntity->GetAbsOrigin().DistTo(vFirstRec->m_vOrigin) > 0.1f) + drawModel(vFirstRec->m_vOrigin, pState, pInfo, vFirstRec->m_BoneMatrix.m_aBones); auto vLastRec = vRecords.end() - 1; - if (vLastRec != vRecords.end() && pEntity->GetAbsOrigin().DistTo(vLastRec->vOrigin) > 0.1f) - drawModel(vLastRec->vOrigin, pState, pInfo, vLastRec->BoneMatrix.aBones); + if (vLastRec != vRecords.end() && pEntity->GetAbsOrigin().DistTo(vLastRec->m_vOrigin) > 0.1f) + drawModel(vLastRec->m_vOrigin, pState, pInfo, vLastRec->m_BoneMatrix.m_aBones); break; } case Vars::Chams::Backtrack::DrawEnum::All: // all { for (auto& record : vRecords) { - if (pEntity->GetAbsOrigin().DistTo(record.vOrigin) < 0.1f) + if (pEntity->GetAbsOrigin().DistTo(record.m_vOrigin) < 0.1f) continue; - drawModel(record.vOrigin, pState, pInfo, record.BoneMatrix.aBones); + drawModel(record.m_vOrigin, pState, pInfo, record.m_BoneMatrix.m_aBones); } } } diff --git a/Amalgam/src/Features/Visuals/Glow/Glow.cpp b/Amalgam/src/Features/Visuals/Glow/Glow.cpp index 88faedf1..ca091136 100644 --- a/Amalgam/src/Features/Visuals/Glow/Glow.cpp +++ b/Amalgam/src/Features/Visuals/Glow/Glow.cpp @@ -422,28 +422,28 @@ void CGlow::RenderBacktrack(const DrawModelState_t& pState, const ModelRenderInf case Vars::Glow::Backtrack::DrawEnum::Last: // last { auto vLastRec = vRecords.end() - 1; - if (vLastRec != vRecords.end() && pEntity->GetAbsOrigin().DistTo(vLastRec->vOrigin) > 0.1f) - drawModel(vLastRec->vOrigin, pState, pInfo, vLastRec->BoneMatrix.aBones); + if (vLastRec != vRecords.end() && pEntity->GetAbsOrigin().DistTo(vLastRec->m_vOrigin) > 0.1f) + drawModel(vLastRec->m_vOrigin, pState, pInfo, vLastRec->m_BoneMatrix.m_aBones); break; } case Vars::Glow::Backtrack::DrawEnum::LastFirst: // last + first { auto vFirstRec = vRecords.begin(); - if (vFirstRec != vRecords.end() && pEntity->GetAbsOrigin().DistTo(vFirstRec->vOrigin) > 0.1f) - drawModel(vFirstRec->vOrigin, pState, pInfo, vFirstRec->BoneMatrix.aBones); + if (vFirstRec != vRecords.end() && pEntity->GetAbsOrigin().DistTo(vFirstRec->m_vOrigin) > 0.1f) + drawModel(vFirstRec->m_vOrigin, pState, pInfo, vFirstRec->m_BoneMatrix.m_aBones); auto vLastRec = vRecords.end() - 1; - if (vLastRec != vRecords.end() && pEntity->GetAbsOrigin().DistTo(vLastRec->vOrigin) > 0.1f) - drawModel(vLastRec->vOrigin, pState, pInfo, vLastRec->BoneMatrix.aBones); + if (vLastRec != vRecords.end() && pEntity->GetAbsOrigin().DistTo(vLastRec->m_vOrigin) > 0.1f) + drawModel(vLastRec->m_vOrigin, pState, pInfo, vLastRec->m_BoneMatrix.m_aBones); break; } case Vars::Glow::Backtrack::DrawEnum::All: // all { for (auto& record : vRecords) { - if (pEntity->GetAbsOrigin().DistTo(record.vOrigin) < 0.1f) + if (pEntity->GetAbsOrigin().DistTo(record.m_vOrigin) < 0.1f) continue; - drawModel(record.vOrigin, pState, pInfo, record.BoneMatrix.aBones); + drawModel(record.m_vOrigin, pState, pInfo, record.m_BoneMatrix.m_aBones); } } } diff --git a/Amalgam/src/Features/Visuals/Visuals.cpp b/Amalgam/src/Features/Visuals/Visuals.cpp index 641d1a23..46ca1b9a 100644 --- a/Amalgam/src/Features/Visuals/Visuals.cpp +++ b/Amalgam/src/Features/Visuals/Visuals.cpp @@ -72,9 +72,17 @@ void CVisuals::DrawOnScreenPing(CTFPlayer* pLocal) if (!pResource || !pNetChan) return; - const float flFake = std::min(F::Backtrack.flFakeLatency + (F::Backtrack.flFakeInterp > G::Lerp ? F::Backtrack.flFakeInterp : 0.f), F::Backtrack.flMaxUnlag) * 1000.f; - const float flLatency = F::Backtrack.GetReal() * 1000.f; - const int iLatencyScoreboard = pResource->GetPing(pLocal->entindex()); + static float flFakeLatency = 0.f; + { + static Timer updateTimer{}; + if (updateTimer.Run(500)) + flFakeLatency = F::Backtrack.m_flFakeLatency; + } + float flFakeLerp = F::Backtrack.m_flFakeInterp > G::Lerp ? F::Backtrack.m_flFakeInterp : 0.f; + + float flFake = std::min(flFakeLatency + flFakeLerp, F::Backtrack.m_flMaxUnlag) * 1000.f; + float flLatency = std::max(pNetChan->GetLatency(FLOW_INCOMING) + pNetChan->GetLatency(FLOW_OUTGOING) - flFakeLatency, 0.f) * 1000.f; + int iLatencyScoreboard = pResource->GetPing(pLocal->entindex()); int x = Vars::Menu::PingDisplay.Value.x; int y = Vars::Menu::PingDisplay.Value.y + 8; @@ -93,12 +101,7 @@ void CVisuals::DrawOnScreenPing(CTFPlayer* pLocal) } if (flFake || Vars::Backtrack::Interp.Value && Vars::Backtrack::Enabled.Value) - { - if (flLatency > 0.f) - H::Draw.String(fFont, x, y, Vars::Menu::Theme::Active.Value, align, "Real %.0f (+ %.0f) ms", flLatency, flFake); - else - H::Draw.String(fFont, x, y, Vars::Menu::Theme::Active.Value, align, "Syncing"); - } + H::Draw.String(fFont, x, y, Vars::Menu::Theme::Active.Value, align, "Real %.0f (+ %.0f) ms", flLatency, flFake); else H::Draw.String(fFont, x, y, Vars::Menu::Theme::Active.Value, align, "Real %.0f ms", flLatency); H::Draw.String(fFont, x, y += fFont.m_nTall + 1, Vars::Menu::Theme::Active.Value, align, "Scoreboard %d ms", iLatencyScoreboard); @@ -326,7 +329,7 @@ void CVisuals::ProjectileTrace(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const Vec3 vAngles; Math::VectorAngles(*pNormal, vAngles); if (Vars::Colors::ShotPath.Value.a || Vars::Colors::TrajectoryPathClipped.Value.a) - G::BoxStorage.clear(); + G::BoxStorage.clear(); if (Vars::Colors::ShotPath.Value.a) G::BoxStorage.push_back({ trace.endpos, vSize * -1, vSize, vAngles, I::GlobalVars->curtime + TICKS_TO_TIME(projInfo.m_vPath.size()) + F::Backtrack.GetReal(), Vars::Colors::ShotPath.Value, { 0, 0, 0, 0 } }); if (Vars::Colors::ShotPathClipped.Value.a) @@ -339,9 +342,9 @@ void CVisuals::ProjectileTrace(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const G::PathStorage.push_back({ vPoints, I::GlobalVars->curtime + TICKS_TO_TIME(projInfo.m_vPath.size()) + F::Backtrack.GetReal(), Vars::Colors::SplashRadius.Value, Vars::Visuals::Simulation::StyleEnum::Line }); if (Vars::Colors::SplashRadiusClipped.Value.a) G::PathStorage.push_back({ vPoints, I::GlobalVars->curtime + TICKS_TO_TIME(projInfo.m_vPath.size()) + F::Backtrack.GetReal(), Vars::Colors::SplashRadiusClipped.Value, Vars::Visuals::Simulation::StyleEnum::Line, true }); + } } } -} void CVisuals::SplashRadius(CTFPlayer* pLocal) { @@ -474,22 +477,21 @@ void CVisuals::DrawAntiAim(CTFPlayer* pLocal) void CVisuals::DrawDebugInfo(CTFPlayer* pLocal) { - // Debug info if (Vars::Debug::Info.Value) { + auto pWeapon = H::Entities.GetWeapon(); + auto pCmd = G::LastUserCmd; + int x = 10, y = 10; const auto& fFont = H::Fonts.GetFont(FONT_INDICATORS); y -= fFont.m_nTall + 1; - if (auto pCmd = G::LastUserCmd) + if (pCmd) { H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, "View: (%.3f, %.3f, %.3f)", pCmd->viewangles.x, pCmd->viewangles.y, pCmd->viewangles.z); H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, "Move: (%.0f, %.0f, %.0f)", pCmd->forwardmove, pCmd->sidemove, pCmd->upmove); H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, "Buttons: %i", pCmd->buttons); } - H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, std::format("Choke: {}, {}", G::Choking, I::ClientState->chokedcommands).c_str()); - H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, std::format("Ticks: {}, {}", G::ShiftedTicks, G::ShiftedGoal).c_str()); - H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, std::format("Attacking: {} ({}, {})", G::IsAttacking, G::CanPrimaryAttack, G::CanSecondaryAttack).c_str()); { Vec3 vOrigin = pLocal->m_vecOrigin(); H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, "Origin: (%.3f, %.3f, %.3f)", vOrigin.x, vOrigin.y, vOrigin.z); @@ -498,9 +500,25 @@ void CVisuals::DrawDebugInfo(CTFPlayer* pLocal) Vec3 vVelocity = pLocal->m_vecVelocity(); H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, "Velocity: %.3f (%.3f, %.3f, %.3f)", vVelocity.Length(), vVelocity.x, vVelocity.y, vVelocity.z); } + H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, std::format("Choke: {}, {}", G::Choking, I::ClientState->chokedcommands).c_str()); + H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, std::format("Ticks: {}, {}", G::ShiftedTicks, G::ShiftedGoal).c_str()); H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, "Round state: %i", SDK::GetRoundState()); H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, "Tickcount: %i", pLocal->m_nTickBase()); H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, "Entities: %i (%i, %i)", I::ClientEntityList->GetMaxEntities(), I::ClientEntityList->GetHighestEntityIndex(), I::ClientEntityList->NumberOfEntities(false)); + + if (!pWeapon || !pCmd) + return; + + float flTime = TICKS_TO_TIME(pLocal->m_nTickBase()); + float flPrimaryAttack = pWeapon->m_flNextPrimaryAttack(); + float flSecondaryAttack = pWeapon->m_flNextSecondaryAttack(); + float flAttack = pLocal->m_flNextAttack(); + + H::Draw.String(fFont, x, y += (fFont.m_nTall + 1) * 2, {}, ALIGN_TOPLEFT, std::format("Attacking: {} ({})", G::Attacking, bool(pCmd->buttons & IN_ATTACK)).c_str()); + H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, std::format("CanPrimaryAttack: {} ([{:.3f} | {:.3f}] <= {:.3f})", G::CanPrimaryAttack, flPrimaryAttack, flAttack, flTime).c_str()); + H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, std::format("CanSecondaryAttack: {} ([{:.3f} | {:.3f}] <= {:.3f})", G::CanSecondaryAttack, flSecondaryAttack, flAttack, flTime).c_str()); + H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, std::format("Attack: {:.3f}, {:.3f}; {:.3f}", flTime - flPrimaryAttack, flTime - flSecondaryAttack, flTime - flAttack).c_str()); + H::Draw.String(fFont, x, y += fFont.m_nTall + 1, {}, ALIGN_TOPLEFT, std::format("Reload: {} ({} || {} != 0)", G::Reloading, pWeapon->m_bInReload(), pWeapon->m_iReloadMode()).c_str()); } } diff --git a/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp b/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp index 1348c24b..0b3ebf52 100644 --- a/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp +++ b/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp @@ -22,14 +22,14 @@ MAKE_HOOK(CClientModeShared_CreateMove, U::Memory.GetVFunc(I::ClientModeShared, bool* pSendPacket = reinterpret_cast(uintptr_t(_AddressOfReturnAddress()) + 0x128); - G::PSilentAngles = G::SilentAngles = G::IsAttacking = G::IsThrowing = false; + G::PSilentAngles = G::SilentAngles = G::Attacking = G::Throwing = false; G::LastUserCmd = G::CurrentUserCmd ? G::CurrentUserCmd : pCmd; G::CurrentUserCmd = pCmd; I::Prediction->Update(I::ClientState->m_nDeltaTick, I::ClientState->m_nDeltaTick > 0, I::ClientState->last_command_ack, I::ClientState->lastoutgoingcommand + I::ClientState->chokedcommands); // correct tick_count for fakeinterp / nointerp - pCmd->tick_count += TICKS_TO_TIME(F::Backtrack.flFakeInterp) - (Vars::Visuals::Removals::Interpolation.Value ? 0 : TICKS_TO_TIME(G::Lerp)); + pCmd->tick_count += TICKS_TO_TIME(F::Backtrack.m_flFakeInterp) - (Vars::Visuals::Removals::Interpolation.Value ? 0 : TICKS_TO_TIME(G::Lerp)); if (G::Buttons & IN_DUCK) // lol pCmd->buttons |= IN_DUCK; @@ -46,7 +46,7 @@ MAKE_HOOK(CClientModeShared_CreateMove, U::Memory.GetVFunc(I::ClientModeShared, G::WaitForShift = 1; } - G::CanPrimaryAttack = G::CanSecondaryAttack = false; + G::CanPrimaryAttack = G::CanSecondaryAttack = G::Reloading = false; bool bCanAttack = pLocal->CanAttack(); switch (SDK::GetRoundState()) { @@ -71,7 +71,7 @@ MAKE_HOOK(CClientModeShared_CreateMove, U::Memory.GetVFunc(I::ClientModeShared, case TF_WEAPON_MINIGUN: { int iState = pWeapon->As()->m_iWeaponState(); - if (iState != AC_STATE_FIRING && iState != AC_STATE_SPINNING) + if (iState != AC_STATE_FIRING && iState != AC_STATE_SPINNING || !pWeapon->HasPrimaryAmmoForShot()) G::CanPrimaryAttack = false; break; } @@ -88,16 +88,23 @@ MAKE_HOOK(CClientModeShared_CreateMove, U::Memory.GetVFunc(I::ClientModeShared, default: if (pWeapon->GetSlot() != SLOT_MELEE) { + /* if (pWeapon->IsInReload()) G::CanPrimaryAttack = pWeapon->HasPrimaryAmmoForShot(); - else if (pWeapon->m_iItemDefinitionIndex() != Soldier_m_TheBeggarsBazooka && !pWeapon->HasPrimaryAmmoForShot()) - G::CanPrimaryAttack = false; + */ + + bool bAmmo = pWeapon->HasPrimaryAmmoForShot(); + bool bReload = pWeapon->IsInReload(); + if (!bAmmo && pWeapon->m_iItemDefinitionIndex() != Soldier_m_TheBeggarsBazooka) + G::CanPrimaryAttack = G::CanSecondaryAttack = false; + if (bReload && bAmmo && !G::CanPrimaryAttack) + G::Reloading = true; } } } } - G::IsAttacking = SDK::IsAttacking(pLocal, pWeapon, pCmd); + G::Attacking = SDK::IsAttacking(pLocal, pWeapon, pCmd); G::PrimaryWeaponType = SDK::GetWeaponType(pWeapon, &G::SecondaryWeaponType); G::CanHeadshot = pWeapon->CanHeadShot(); } @@ -126,7 +133,7 @@ MAKE_HOOK(CClientModeShared_CreateMove, U::Memory.GetVFunc(I::ClientModeShared, else if (bWasSet || bOverchoking) *pSendPacket = true, bWasSet = false; } - F::Misc.DoubletapPacket(pCmd, pSendPacket); + F::Ticks.ManagePacket(pCmd, pSendPacket); F::AntiAim.Run(pLocal, pWeapon, pCmd, *pSendPacket); G::Choking = !*pSendPacket; if (*pSendPacket) diff --git a/Amalgam/src/Hooks/CL_Move.cpp b/Amalgam/src/Hooks/CL_Move.cpp index 7b91a30c..5cc94317 100644 --- a/Amalgam/src/Hooks/CL_Move.cpp +++ b/Amalgam/src/Hooks/CL_Move.cpp @@ -15,7 +15,7 @@ MAKE_HOOK(CL_Move, S::CL_Move(), void, __fastcall, if (G::Unload) return CALL_ORIGINAL(accumulated_extra_samples, bFinalTick); - F::Backtrack.iTickCount = I::GlobalVars->tickcount + (Vars::Misc::Game::NetworkFix.Value ? 1 : 0); + F::Backtrack.m_iTickCount = I::GlobalVars->tickcount + (Vars::Misc::Game::NetworkFix.Value ? 1 : 0); auto pLocal = H::Entities.GetLocal(); auto pWeapon = H::Entities.GetWeapon(); diff --git a/Amalgam/src/Hooks/CL_ProcessPacketEntities.cpp b/Amalgam/src/Hooks/CL_ProcessPacketEntities.cpp index 540e4baa..64949761 100644 --- a/Amalgam/src/Hooks/CL_ProcessPacketEntities.cpp +++ b/Amalgam/src/Hooks/CL_ProcessPacketEntities.cpp @@ -36,14 +36,14 @@ MAKE_HOOK(CL_ProcessPacketEntities, S::CL_ProcessPacketEntities(), bool, __fastc CTFPlayer* pLocal = I::ClientEntityList->GetClientEntity(I::EngineClient->GetLocalPlayer())->As(); if (!pLocal) { - SDK::Output("ForceFullUpdate", "Failed to restore weapon crit data! (1)", { 255, 100, 100, 255 }, Vars::Debug::Logging.Value); + SDK::Output("ProcessPacketEntities", "Failed to restore weapon crit data! (1)", { 255, 100, 100, 255 }, Vars::Debug::Logging.Value); return CALL_ORIGINAL(entmsg); } auto hWeapons = pLocal->GetMyWeapons(); if (!hWeapons) { - SDK::Output("ForceFullUpdate", "Failed to restore weapon crit data! (2)", { 255, 100, 100, 255 }, Vars::Debug::Logging.Value); + SDK::Output("ProcessPacketEntities", "Failed to restore weapon crit data! (2)", { 255, 100, 100, 255 }, Vars::Debug::Logging.Value); return CALL_ORIGINAL(entmsg); } @@ -60,13 +60,27 @@ MAKE_HOOK(CL_ProcessPacketEntities, S::CL_ProcessPacketEntities(), bool, __fastc mCriticalStorage[iSlot].m_nCritSeedRequests = pWeapon->m_nCritSeedRequests(); if (Vars::Debug::Logging.Value) I::CVar->ConsolePrintf("\n"); - SDK::Output("ForceFullUpdate", std::format("{}: mCriticalStorage[iSlot].m_flCritTokenBucket = {}", iSlot, pWeapon->m_flCritTokenBucket()).c_str(), { 100, 150, 255, 255 }, Vars::Debug::Logging.Value); - SDK::Output("ForceFullUpdate", std::format("{}: mCriticalStorage[iSlot].m_nCritChecks = {}", iSlot, pWeapon->m_nCritChecks()).c_str(), { 100, 150, 255, 255 }, Vars::Debug::Logging.Value); - SDK::Output("ForceFullUpdate", std::format("{}: mCriticalStorage[iSlot].m_nCritSeedRequests = {}", iSlot, pWeapon->m_nCritSeedRequests()).c_str(), { 100, 150, 255, 255 }, Vars::Debug::Logging.Value); + SDK::Output("ProcessPacketEntities", std::format("{} ({:#x}): mCriticalStorage[iSlot].m_flCritTokenBucket = {}", iSlot, uintptr_t(pWeapon), pWeapon->m_flCritTokenBucket()).c_str(), { 100, 150, 255, 255 }, Vars::Debug::Logging.Value); + SDK::Output("ProcessPacketEntities", std::format("{} ({:#x}): mCriticalStorage[iSlot].m_nCritChecks = {}", iSlot, uintptr_t(pWeapon), pWeapon->m_nCritChecks()).c_str(), { 100, 150, 255, 255 }, Vars::Debug::Logging.Value); + SDK::Output("ProcessPacketEntities", std::format("{} ({:#x}): mCriticalStorage[iSlot].m_nCritSeedRequests = {}", iSlot, uintptr_t(pWeapon), pWeapon->m_nCritSeedRequests()).c_str(), { 100, 150, 255, 255 }, Vars::Debug::Logging.Value); } bool bReturn = CALL_ORIGINAL(entmsg); + pLocal = I::ClientEntityList->GetClientEntity(I::EngineClient->GetLocalPlayer())->As(); + if (!pLocal) + { + SDK::Output("ProcessPacketEntities", "Failed to restore weapon crit data! (3)", { 255, 100, 100, 255 }, Vars::Debug::Logging.Value); + return bReturn; + } + + hWeapons = pLocal->GetMyWeapons(); + if (!hWeapons) + { + SDK::Output("ProcessPacketEntities", "Failed to restore weapon crit data! (4)", { 255, 100, 100, 255 }, Vars::Debug::Logging.Value); + return bReturn; + } + for (auto& [iSlot, tStorage] : mCriticalStorage) { auto pWeapon = pLocal->GetWeaponFromSlot(iSlot); @@ -78,9 +92,9 @@ MAKE_HOOK(CL_ProcessPacketEntities, S::CL_ProcessPacketEntities(), bool, __fastc pWeapon->m_nCritSeedRequests() = tStorage.m_nCritSeedRequests; if (Vars::Debug::Logging.Value) I::CVar->ConsolePrintf("\n"); - SDK::Output("ForceFullUpdate", std::format("{}: pWeapon->m_flCritTokenBucket() = {}", iSlot, pWeapon->m_flCritTokenBucket()).c_str(), { 100, 255, 150, 255 }, Vars::Debug::Logging.Value); - SDK::Output("ForceFullUpdate", std::format("{}: pWeapon->m_nCritChecks() = {}", iSlot, pWeapon->m_nCritChecks()).c_str(), { 100, 255, 150, 255 }, Vars::Debug::Logging.Value); - SDK::Output("ForceFullUpdate", std::format("{}: pWeapon->m_nCritSeedRequests() = {}", iSlot, pWeapon->m_nCritSeedRequests()).c_str(), { 100, 255, 150, 255 }, Vars::Debug::Logging.Value); + SDK::Output("ProcessPacketEntities", std::format("{} ({:#x}): pWeapon->m_flCritTokenBucket() = {}", iSlot, uintptr_t(pWeapon), pWeapon->m_flCritTokenBucket()).c_str(), { 100, 255, 150, 255 }, Vars::Debug::Logging.Value); + SDK::Output("ProcessPacketEntities", std::format("{} ({:#x}): pWeapon->m_nCritChecks() = {}", iSlot, uintptr_t(pWeapon), pWeapon->m_nCritChecks()).c_str(), { 100, 255, 150, 255 }, Vars::Debug::Logging.Value); + SDK::Output("ProcessPacketEntities", std::format("{} ({:#x}): pWeapon->m_nCritSeedRequests() = {}", iSlot, uintptr_t(pWeapon), pWeapon->m_nCritSeedRequests()).c_str(), { 100, 255, 150, 255 }, Vars::Debug::Logging.Value); } return bReturn; diff --git a/Amalgam/src/Hooks/CNetChannel_SendDatagram.cpp b/Amalgam/src/Hooks/CNetChannel_SendDatagram.cpp index fb55dda7..713154b2 100644 --- a/Amalgam/src/Hooks/CNetChannel_SendDatagram.cpp +++ b/Amalgam/src/Hooks/CNetChannel_SendDatagram.cpp @@ -10,14 +10,8 @@ MAKE_HOOK(CNetChannel_SendDatagram, S::CNetChannel_SendDatagram(), int, __fastca if (!pNetChan || datagram) return CALL_ORIGINAL(pNetChan, datagram); - F::Backtrack.flFakeLatency = std::min(F::Backtrack.flFakeLatency + TICKS_TO_TIME(1), F::Backtrack.GetFake()); - if (!Vars::Backtrack::Enabled.Value || !Vars::Backtrack::Latency.Value || !H::Entities.GetLocal()) - return CALL_ORIGINAL(pNetChan, datagram); - - const int nInSequenceNr = pNetChan->m_nInSequenceNr, nInReliableState = pNetChan->m_nInReliableState; F::Backtrack.AdjustPing(pNetChan); const int iReturn = CALL_ORIGINAL(pNetChan, datagram); - pNetChan->m_nInSequenceNr = nInSequenceNr, pNetChan->m_nInReliableState = nInReliableState; - + F::Backtrack.RestorePing(pNetChan); return iReturn; } \ No newline at end of file diff --git a/Amalgam/src/Hooks/CNetChannel_SendNetMsg.cpp b/Amalgam/src/Hooks/CNetChannel_SendNetMsg.cpp index 80814dad..bb7cb898 100644 --- a/Amalgam/src/Hooks/CNetChannel_SendNetMsg.cpp +++ b/Amalgam/src/Hooks/CNetChannel_SendNetMsg.cpp @@ -21,7 +21,7 @@ MAKE_HOOK(CNetChan_SendNetMsg, S::CNetChan_SendNetMsg(), bool, __fastcall, // intercept and change any vars we want to control switch (FNV1A::Hash32(localCvar->Name)) { - case FNV1A::Hash32Const("cl_interp"): strncpy_s(localCvar->Value, std::to_string(F::Backtrack.flWishInterp).c_str(), MAX_OSPATH); break; + case FNV1A::Hash32Const("cl_interp"): strncpy_s(localCvar->Value, std::to_string(F::Backtrack.m_flWishInterp).c_str(), MAX_OSPATH); break; case FNV1A::Hash32Const("cl_interp_ratio"): strncpy_s(localCvar->Value, "1.0", MAX_OSPATH); break; case FNV1A::Hash32Const("cl_interpolate"): strncpy_s(localCvar->Value, "1", MAX_OSPATH); break; case FNV1A::Hash32Const("cl_cmdrate"): strncpy_s(localCvar->Value, std::to_string(F::Misc.iWishCmdrate).c_str(), MAX_OSPATH); break; diff --git a/Amalgam/src/Hooks/CTFPlayerPanel_GetTeam.cpp b/Amalgam/src/Hooks/CTFPlayerPanel_GetTeam.cpp index 43011288..1e5910ee 100644 --- a/Amalgam/src/Hooks/CTFPlayerPanel_GetTeam.cpp +++ b/Amalgam/src/Hooks/CTFPlayerPanel_GetTeam.cpp @@ -43,10 +43,9 @@ MAKE_HOOK(vgui_Panel_SetBgColor, S::vgui_Panel_SetBgColor(), void, __fastcall, Color_t tColor = H::Color.GetScoreboardColor(CTFTeamStatusPlayerPanel_Update_PlayerIndex); if (tColor.a) { - tColor = tColor.Lerp({ 0, 0, 0, tColor.a }, 0.2f); auto pResource = H::Entities.GetPR(); if (pResource && !pResource->IsAlive(CTFTeamStatusPlayerPanel_Update_PlayerIndex)) - tColor = tColor.Lerp({ 100, 100, 100, tColor.a }, 0.5f); + tColor = tColor.Lerp({ 127, 127, 127, tColor.a }, 0.5f); color = tColor; } diff --git a/Amalgam/src/Hooks/ISteamNetworkingUtils_GetPingToDataCenter.cpp b/Amalgam/src/Hooks/ISteamNetworkingUtils_GetPingToDataCenter.cpp index eadcb659..66ad8847 100644 --- a/Amalgam/src/Hooks/ISteamNetworkingUtils_GetPingToDataCenter.cpp +++ b/Amalgam/src/Hooks/ISteamNetworkingUtils_GetPingToDataCenter.cpp @@ -56,7 +56,7 @@ MAKE_HOOK(ISteamNetworkingUtils_GetPingToDataCenter, U::Memory.GetVFunc(I::Steam void* rcx, SteamNetworkingPOPID popID, SteamNetworkingPOPID* pViaRelayPoP) { int iReturn = CALL_ORIGINAL(rcx, popID, pViaRelayPoP); - if (!Vars::Misc::Queueing::ForceRegions.Value) + if (!Vars::Misc::Queueing::ForceRegions.Value || iReturn < 0) return iReturn; char popIDName[5]; @@ -70,8 +70,11 @@ MAKE_HOOK(ISteamNetworkingUtils_GetPingToDataCenter, U::Memory.GetVFunc(I::Steam MAKE_HOOK(CTFPartyClient_RequestQueueForMatch, S::CTFPartyClient_RequestQueueForMatch(), void, __fastcall, void* rcx, int eMatchGroup) { - *reinterpret_cast(uintptr_t(I::TFGCClientSystem) + 1116) = true; - S::CTFGCClientSystem_PingThink.As()(I::TFGCClientSystem); + if (Vars::Misc::Queueing::ForceRegions.Value) + { + *reinterpret_cast(uintptr_t(I::TFGCClientSystem) + 1116) = true; + S::CTFGCClientSystem_PingThink.As()(I::TFGCClientSystem); + } - return CALL_ORIGINAL(rcx, eMatchGroup); + CALL_ORIGINAL(rcx, eMatchGroup); } \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Interfaces/CTFGameRules.h b/Amalgam/src/SDK/Definitions/Interfaces/CTFGameRules.h index 702bb5ec..4d9fc08c 100644 --- a/Amalgam/src/SDK/Definitions/Interfaces/CTFGameRules.h +++ b/Amalgam/src/SDK/Definitions/Interfaces/CTFGameRules.h @@ -14,24 +14,25 @@ class CTeamplayRoundBasedRules : public CTeamplayRules { public: NETVAR(m_iRoundState, int, "CTeamplayRoundBasedRulesProxy", "m_iRoundState"); - NETVAR(m_bInWaitingForPlayers, bool, "CTeamplayRoundBasedRulesProxy", "m_bInWaitingForPlayers"); - NETVAR(m_iWinningTeam, int, "CTeamplayRoundBasedRulesProxy", "m_iWinningTeam"); NETVAR(m_bInOvertime, bool, "CTeamplayRoundBasedRulesProxy", "m_bInOvertime"); NETVAR(m_bInSetup, bool, "CTeamplayRoundBasedRulesProxy", "m_bInSetup"); NETVAR(m_bSwitchedTeamsThisRound, bool, "CTeamplayRoundBasedRulesProxy", "m_bSwitchedTeamsThisRound"); + NETVAR(m_iWinningTeam, int, "CTeamplayRoundBasedRulesProxy", "m_iWinningTeam"); + NETVAR(m_iWinReason, int, "CTeamplayRoundBasedRulesProxy", "m_iWinReason"); + NETVAR(m_bInWaitingForPlayers, bool, "CTeamplayRoundBasedRulesProxy", "m_bInWaitingForPlayers"); NETVAR(m_bAwaitingReadyRestart, bool, "CTeamplayRoundBasedRulesProxy", "m_bAwaitingReadyRestart"); NETVAR(m_flRestartRoundTime, float, "CTeamplayRoundBasedRulesProxy", "m_flRestartRoundTime"); NETVAR(m_flMapResetTime, float, "CTeamplayRoundBasedRulesProxy", "m_flMapResetTime"); - NETVAR(m_nRoundsPlayed, int, "CTeamplayRoundBasedRulesProxy", "m_nRoundsPlayed"); NETVAR(m_flNextRespawnWave, void*, "CTeamplayRoundBasedRulesProxy", "m_flNextRespawnWave"); - NETVAR(m_TeamRespawnWaveTimes, void*, "CTeamplayRoundBasedRulesProxy", "m_TeamRespawnWaveTimes"); NETVAR(m_bTeamReady, void*, "CTeamplayRoundBasedRulesProxy", "m_bTeamReady"); NETVAR(m_bStopWatch, bool, "CTeamplayRoundBasedRulesProxy", "m_bStopWatch"); NETVAR(m_bMultipleTrains, bool, "CTeamplayRoundBasedRulesProxy", "m_bMultipleTrains"); NETVAR(m_bPlayerReady, void*, "CTeamplayRoundBasedRulesProxy", "m_bPlayerReady"); NETVAR(m_bCheatsEnabledDuringLevel, bool, "CTeamplayRoundBasedRulesProxy", "m_bCheatsEnabledDuringLevel"); + NETVAR(m_nRoundsPlayed, int, "CTeamplayRoundBasedRulesProxy", "m_nRoundsPlayed"); NETVAR(m_flCountdownTime, float, "CTeamplayRoundBasedRulesProxy", "m_flCountdownTime"); NETVAR(m_flStateTransitionTime, float, "CTeamplayRoundBasedRulesProxy", "m_flStateTransitionTime"); + NETVAR(m_TeamRespawnWaveTimes, void*, "CTeamplayRoundBasedRulesProxy", "m_TeamRespawnWaveTimes"); }; class CTFGameRules : public CTeamplayRoundBasedRules @@ -54,42 +55,36 @@ public: NETVAR(m_pszTeamGoalStringRed, const char*, "CTFGameRulesProxy", "m_pszTeamGoalStringRed"); NETVAR(m_pszTeamGoalStringBlue, const char*, "CTFGameRulesProxy", "m_pszTeamGoalStringBlue"); NETVAR(m_flCapturePointEnableTime, float, "CTFGameRulesProxy", "m_flCapturePointEnableTime"); + NETVAR(m_iGlobalAttributeCacheVersion, int, "CTFGameRulesProxy", "m_iGlobalAttributeCacheVersion"); NETVAR(m_nHudType, int, "CTFGameRulesProxy", "m_nHudType"); NETVAR(m_bIsInTraining, bool, "CTFGameRulesProxy", "m_bIsInTraining"); NETVAR(m_bAllowTrainingAchievements, bool, "CTFGameRulesProxy", "m_bAllowTrainingAchievements"); NETVAR(m_bIsWaitingForTrainingContinue, bool, "CTFGameRulesProxy", "m_bIsWaitingForTrainingContinue"); NETVAR(m_bIsTrainingHUDVisible, bool, "CTFGameRulesProxy", "m_bIsTrainingHUDVisible"); NETVAR(m_bIsInItemTestingMode, bool, "CTFGameRulesProxy", "m_bIsInItemTestingMode"); - NETVAR(m_hBonusLogic, int, "CTFGameRulesProxy", "m_hBonusLogic"); + NETVAR(m_hBonusLogic, int /*EHANDLE CBonusRoundLogic*/, "CTFGameRulesProxy", "m_hBonusLogic"); NETVAR(m_bPlayingKoth, bool, "CTFGameRulesProxy", "m_bPlayingKoth"); + NETVAR(m_bPowerupMode, bool, "CTFGameRulesProxy", "m_bPowerupMode"); + NETVAR(m_bPlayingRobotDestructionMode, bool, "CTFGameRulesProxy", "m_bPlayingRobotDestructionMode"); NETVAR(m_bPlayingMedieval, bool, "CTFGameRulesProxy", "m_bPlayingMedieval"); NETVAR(m_bPlayingHybrid_CTF_CP, bool, "CTFGameRulesProxy", "m_bPlayingHybrid_CTF_CP"); NETVAR(m_bPlayingSpecialDeliveryMode, bool, "CTFGameRulesProxy", "m_bPlayingSpecialDeliveryMode"); - NETVAR(m_bPlayingRobotDestructionMode, bool, "CTFGameRulesProxy", "m_bPlayingRobotDestructionMode"); - NETVAR(m_hRedKothTimer, int, "CTFGameRulesProxy", "m_hRedKothTimer"); - NETVAR(m_hBlueKothTimer, int, "CTFGameRulesProxy", "m_hBlueKothTimer"); - NETVAR(m_nMapHolidayType, int, "CTFGameRulesProxy", "m_nMapHolidayType"); - NETVAR(m_itHandle, int, "CTFGameRulesProxy", "m_itHandle"); NETVAR(m_bPlayingMannVsMachine, bool, "CTFGameRulesProxy", "m_bPlayingMannVsMachine"); - NETVAR(m_hBirthdayPlayer, int, "CTFGameRulesProxy", "m_hBirthdayPlayer"); - NETVAR(m_nBossHealth, int, "CTFGameRulesProxy", "m_nBossHealth"); - NETVAR(m_nMaxBossHealth, int, "CTFGameRulesProxy", "m_nMaxBossHealth"); - NETVAR(m_fBossNormalizedTravelDistance, int, "CTFGameRulesProxy", "m_fBossNormalizedTravelDistance"); NETVAR(m_bMannVsMachineAlarmStatus, bool, "CTFGameRulesProxy", "m_bMannVsMachineAlarmStatus"); NETVAR(m_bHaveMinPlayersToEnableReady, bool, "CTFGameRulesProxy", "m_bHaveMinPlayersToEnableReady"); NETVAR(m_bBountyModeEnabled, bool, "CTFGameRulesProxy", "m_bBountyModeEnabled"); - NETVAR(m_nHalloweenEffect, int, "CTFGameRulesProxy", "m_nHalloweenEffect"); - NETVAR(m_fHalloweenEffectStartTime, float, "CTFGameRulesProxy", "m_fHalloweenEffectStartTime"); - NETVAR(m_fHalloweenEffectDuration, float, "CTFGameRulesProxy", "m_fHalloweenEffectDuration"); - NETVAR(m_halloweenScenario, int, "CTFGameRulesProxy", "m_halloweenScenario"); - NETVAR(m_bHelltowerPlayersInHell, bool, "CTFGameRulesProxy", "m_bHelltowerPlayersInHell"); - NETVAR(m_bIsUsingSpells, bool, "CTFGameRulesProxy", "m_bIsUsingSpells"); NETVAR(m_bCompetitiveMode, bool, "CTFGameRulesProxy", "m_bCompetitiveMode"); + NETVAR(m_flGravityMultiplier, float, "CTFGameRulesProxy", "m_flGravityMultiplier"); NETVAR(m_nMatchGroupType, int, "CTFGameRulesProxy", "m_nMatchGroupType"); NETVAR(m_bMatchEnded, bool, "CTFGameRulesProxy", "m_bMatchEnded"); - NETVAR(m_bPowerupMode, bool, "CTFGameRulesProxy", "m_bPowerupMode"); - NETVAR(m_pszCustomUpgradesFile, const char*, "CTFGameRulesProxy", "m_pszCustomUpgradesFile"); + NETVAR(m_bHelltowerPlayersInHell, bool, "CTFGameRulesProxy", "m_bHelltowerPlayersInHell"); + NETVAR(m_bIsUsingSpells, bool, "CTFGameRulesProxy", "m_bIsUsingSpells"); NETVAR(m_bTruceActive, bool, "CTFGameRulesProxy", "m_bTruceActive"); + NETVAR(m_bTeamsSwitched, bool, "CTFGameRulesProxy", "m_bTeamsSwitched"); + NETVAR(m_hRedKothTimer, int /*EHANDLE*/, "CTFGameRulesProxy", "m_hRedKothTimer"); + NETVAR(m_hBlueKothTimer, int /*EHANDLE*/, "CTFGameRulesProxy", "m_hBlueKothTimer"); + NETVAR(m_nMapHolidayType, int, "CTFGameRulesProxy", "m_nMapHolidayType"); + NETVAR(m_pszCustomUpgradesFile, const char*, "CTFGameRulesProxy", "m_pszCustomUpgradesFile"); NETVAR(m_bShowMatchSummary, bool, "CTFGameRulesProxy", "m_bShowMatchSummary"); NETVAR(m_bMapHasMatchSummaryStage, bool, "CTFGameRulesProxy", "m_bMapHasMatchSummaryStage"); NETVAR(m_bPlayersAreOnMatchSummaryStage, bool, "CTFGameRulesProxy", "m_bPlayersAreOnMatchSummaryStage"); @@ -97,6 +92,15 @@ public: NETVAR(m_ePlayerWantsRematch, void*, "CTFGameRulesProxy", "m_ePlayerWantsRematch"); NETVAR(m_eRematchState, int, "CTFGameRulesProxy", "m_eRematchState"); NETVAR(m_nNextMapVoteOptions, void*, "CTFGameRulesProxy", "m_nNextMapVoteOptions"); + NETVAR(m_nBossHealth, int, "CTFGameRulesProxy", "m_nBossHealth"); + NETVAR(m_nMaxBossHealth, int, "CTFGameRulesProxy", "m_nMaxBossHealth"); + NETVAR(m_fBossNormalizedTravelDistance, int, "CTFGameRulesProxy", "m_fBossNormalizedTravelDistance"); + NETVAR(m_itHandle, int, "CTFGameRulesProxy", "m_itHandle"); + NETVAR(m_hBirthdayPlayer, int, "CTFGameRulesProxy", "m_hBirthdayPlayer"); + NETVAR(m_nHalloweenEffect, int, "CTFGameRulesProxy", "m_nHalloweenEffect"); + NETVAR(m_fHalloweenEffectStartTime, float, "CTFGameRulesProxy", "m_fHalloweenEffectStartTime"); + NETVAR(m_fHalloweenEffectDuration, float, "CTFGameRulesProxy", "m_fHalloweenEffectDuration"); + NETVAR(m_halloweenScenario, int, "CTFGameRulesProxy", "m_halloweenScenario"); NETVAR(m_nForceUpgrades, int, "CTFGameRulesProxy", "m_nForceUpgrades"); NETVAR(m_nForceEscortPushLogic, int, "CTFGameRulesProxy", "m_nForceEscortPushLogic"); NETVAR(m_bRopesHolidayLightsAllowed, bool, "CTFGameRulesProxy", "m_bRopesHolidayLightsAllowed"); diff --git a/Amalgam/src/SDK/Globals.h b/Amalgam/src/SDK/Globals.h index f4b78037..0a90cdc5 100644 --- a/Amalgam/src/SDK/Globals.h +++ b/Amalgam/src/SDK/Globals.h @@ -45,11 +45,12 @@ namespace G { inline bool Unload = false; - inline bool IsAttacking = false; + inline int Attacking = 0; + inline bool Reloading = false; inline bool CanPrimaryAttack = false; inline bool CanSecondaryAttack = false; inline bool CanHeadshot = false; - inline bool IsThrowing = false; + inline bool Throwing = false; inline float Lerp = 0.015f; inline EWeaponType PrimaryWeaponType = {}, SecondaryWeaponType = {}; diff --git a/Amalgam/src/SDK/SDK.cpp b/Amalgam/src/SDK/SDK.cpp index 61499d11..7f4e5649 100644 --- a/Amalgam/src/SDK/SDK.cpp +++ b/Amalgam/src/SDK/SDK.cpp @@ -404,7 +404,7 @@ const char* SDK::GetClassByIndex(const int nClass) return (nClass < 10 && nClass > 0) ? szClasses[nClass] : szClasses[0]; } -bool SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* pCmd, bool bTickBase) +int SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* pCmd, bool bTickBase) { if (pCmd->weaponselect) return false; @@ -417,7 +417,7 @@ bool SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* switch (pWeapon->GetWeaponID()) { case TF_WEAPON_KNIFE: - return ((pCmd->buttons & IN_ATTACK) && G::CanPrimaryAttack); + return pCmd->buttons & IN_ATTACK && G::CanPrimaryAttack; case TF_WEAPON_BAT_WOOD: case TF_WEAPON_BAT_GIFTWRAP: { @@ -425,7 +425,7 @@ bool SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* if (G::CanSecondaryAttack && pWeapon->HasPrimaryAmmoForShot() && pCmd->buttons & IN_ATTACK2 && iThrowTick + 5 < iTickBase) iThrowTick = iTickBase + 11; if (iThrowTick >= iTickBase) - G::CanPrimaryAttack = G::CanSecondaryAttack = G::IsThrowing = true; + G::CanPrimaryAttack = G::CanSecondaryAttack = G::Throwing = true; if (iThrowTick == iTickBase) return true; } @@ -451,7 +451,7 @@ bool SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* { float flMortar = SDK::AttribHookValue(0.f, "grenade_launcher_mortar_mode", pWeapon); if (!flMortar) - return pCmd->buttons & IN_ATTACK && G::CanPrimaryAttack; + return G::CanPrimaryAttack && pCmd->buttons & IN_ATTACK ? 1 : G::Reloading && pCmd->buttons & IN_ATTACK ? 2 : 0; float flCharge = pWeapon->As()->m_flDetonateTime() > 0.f ? flMortar - (pWeapon->As()->m_flDetonateTime() - flTickBase) : 0.f; const float flAmount = Math::RemapValClamped(flCharge, 0.f, SDK::AttribHookValue(0.f, "grenade_launcher_mortar_mode", pWeapon), 0.f, 1.f); @@ -465,7 +465,7 @@ bool SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* if (G::CanPrimaryAttack && pWeapon->HasPrimaryAmmoForShot() && pCmd->buttons & (IN_ATTACK | IN_ATTACK2) && iThrowTick < iTickBase) iThrowTick = iTickBase + 11; if (iThrowTick >= iTickBase) - G::CanPrimaryAttack = G::IsThrowing = true; + G::CanPrimaryAttack = G::Throwing = true; return iThrowTick == iTickBase; } case TF_WEAPON_JAR: @@ -476,7 +476,7 @@ bool SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* if (G::CanPrimaryAttack && pWeapon->HasPrimaryAmmoForShot() && pCmd->buttons & IN_ATTACK && iThrowTick < iTickBase) iThrowTick = iTickBase + 11; if (iThrowTick >= iTickBase) - G::CanPrimaryAttack = G::IsThrowing = true; + G::CanPrimaryAttack = G::Throwing = true; return iThrowTick == iTickBase; } case TF_WEAPON_GRAPPLINGHOOK: @@ -498,31 +498,37 @@ bool SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* return trace.DidHit() && !(trace.surface.flags & 0x0004 /*SURF_SKY*/); } case TF_WEAPON_MINIGUN: - return (pWeapon->As()->m_iWeaponState() == AC_STATE_FIRING || pWeapon->As()->m_iWeaponState() == AC_STATE_SPINNING) && - pCmd->buttons & IN_ATTACK && G::CanPrimaryAttack; + { + int iState = pWeapon->As()->m_iWeaponState(); + if ((iState == AC_STATE_FIRING || iState == AC_STATE_SPINNING) && pWeapon->HasPrimaryAmmoForShot()) + return G::CanPrimaryAttack && pCmd->buttons & IN_ATTACK ? 1 : G::Reloading && pCmd->buttons & IN_ATTACK ? 2 : 0; + + return false; + } } if (pWeapon->m_iItemDefinitionIndex() == Soldier_m_TheBeggarsBazooka) { static bool bLoading = false, bFiring = false; - if (pWeapon->m_iClip1() == 0) + bool bAmmo = pWeapon->HasPrimaryAmmoForShot(); + if (!bAmmo) bLoading = false, bFiring = false; else if (!bFiring) bLoading = true; - if ((bFiring || bLoading && !(pCmd->buttons & IN_ATTACK)) && G::CanPrimaryAttack) + if ((bFiring || bLoading && !(pCmd->buttons & IN_ATTACK)) && bAmmo) { bFiring = true; bLoading = false; - return true; //!pWeapon->IsInReload(); + return G::CanPrimaryAttack ? 1 : G::Reloading ? 2 : 0; } return false; } - return pCmd->buttons & IN_ATTACK && G::CanPrimaryAttack; + return G::CanPrimaryAttack && pCmd->buttons & IN_ATTACK ? 1 : G::Reloading && pCmd->buttons & IN_ATTACK ? 2 : 0; } float SDK::MaxSpeed(CTFPlayer* pPlayer, bool bIncludeCrouch, bool bIgnoreSpecialAbility) @@ -561,7 +567,7 @@ bool SDK::StopMovement(CTFPlayer* pLocal, CUserCmd* pCmd) return false; } - if (!G::IsAttacking) + if (G::Attacking != 1) { const float direction = Math::VelocityToAngles(pLocal->m_vecVelocity() * -1).y; pCmd->viewangles = { 90, direction, 0 }; diff --git a/Amalgam/src/SDK/SDK.h b/Amalgam/src/SDK/SDK.h index 8b51e0da..43f6f7fc 100644 --- a/Amalgam/src/SDK/SDK.h +++ b/Amalgam/src/SDK/SDK.h @@ -101,7 +101,7 @@ namespace SDK EWeaponType GetWeaponType(CTFWeaponBase* pWeapon, EWeaponType* pSecondaryType = nullptr); const char* GetClassByIndex(const int nClass); - bool IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* pCmd, bool bTickBase = false); + int IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* pCmd, bool bTickBase = false); float MaxSpeed(CTFPlayer* pPlayer, bool bIncludeCrouch = false, bool bIgnoreSpecialAbility = false); void FixMovement(CUserCmd* pCmd, const Vec3& vTargetAngle); diff --git a/Amalgam/src/SDK/Vars.h b/Amalgam/src/SDK/Vars.h index f52c179f..ea0911a3 100644 --- a/Amalgam/src/SDK/Vars.h +++ b/Amalgam/src/SDK/Vars.h @@ -156,15 +156,15 @@ namespace Vars CVar(SplashRadius, 90.f) CVar(AutoRelease, 0.f) - CVar(GroundSamples, 15, NOSAVE) // debug + CVar(GroundSamples, 66, NOSAVE) // debug CVar(GroundStraightFuzzyValue, 100.f, NOSAVE) // debug CVar(GroundLowMinimumSamples, 5, NOSAVE) // debug CVar(GroundHighMinimumSamples, 15, NOSAVE) // debug CVar(GroundLowMinimumDistance, 0.f, NOSAVE) // debug CVar(GroundHighMinimumDistance, 2500.f, NOSAVE) // debug - CVar(AirSamples, 15, NOSAVE) // debug - CVar(AirStraightFuzzyValue, 0.f, NOSAVE) // debug + CVar(AirSamples, 66, NOSAVE) // debug + CVar(AirStraightFuzzyValue, 10.f, NOSAVE) // debug CVar(AirLowMinimumSamples, 5, NOSAVE) // debug CVar(AirHighMinimumSamples, 5, NOSAVE) // debug CVar(AirLowMinimumDistance, 100000.f, NOSAVE) // debug @@ -259,8 +259,8 @@ namespace Vars CVar(FakeYawMode, 0) CVar(RealYawOffset, 0) CVar(FakeYawOffset, 0) - CVar(RealJitter, 0) - CVar(FakeJitter, 0) + CVar(RealYawValue, 0) + CVar(FakeYawValue, 0) CVar(SpinSpeed, 15.f) CVar(MinWalk, true) CVar(AntiOverlap, false)