diff --git a/Amalgam/Amalgam.vcxproj b/Amalgam/Amalgam.vcxproj index 88c8f1e1..ddbd6b2a 100644 --- a/Amalgam/Amalgam.vcxproj +++ b/Amalgam/Amalgam.vcxproj @@ -964,7 +964,8 @@ - + + @@ -1058,6 +1059,13 @@ + + + + + + + @@ -1369,7 +1377,6 @@ - @@ -1402,7 +1409,7 @@ - + diff --git a/Amalgam/Amalgam.vcxproj.filters b/Amalgam/Amalgam.vcxproj.filters index 47592168..f9a0d613 100644 --- a/Amalgam/Amalgam.vcxproj.filters +++ b/Amalgam/Amalgam.vcxproj.filters @@ -101,7 +101,7 @@ - + @@ -195,6 +195,14 @@ + + + + + + + + @@ -238,7 +246,6 @@ - @@ -271,7 +278,7 @@ - + diff --git a/Amalgam/cpp.hint b/Amalgam/cpp.hint index 446a7e71..a252d2c6 100644 --- a/Amalgam/cpp.hint +++ b/Amalgam/cpp.hint @@ -63,13 +63,25 @@ namespace MAKE_INTERFACE_SCOPE \ { \ return *reinterpret_cast(uintptr_t(this) + offset); \ } -#define VIRTUAL(name, type, fn, base, index) inline type name() \ -{ \ - return reinterpret_cast(U::Memory.GetVFunc(base, index))(base); \ -} #define CONDGET(name, conditions, cond) inline bool name() \ { \ - return (conditions & cond); \ + return conditions & cond; \ +} +#define VIRTUAL(name, type, index, ...) inline type name() \ +{ \ + return U::Memory.CallVirtual(##__VA_ARGS__); \ +} +#define VIRTUAL_ARGS(name, type, index, args, ...) inline type name##args \ +{ \ + return U::Memory.CallVirtual(##__VA_ARGS__); \ +} +#define SIGNATURE(name, type, sig, ...) inline type name() \ +{ \ + return S::sig##_##name.Call(##__VA_ARGS__); \ +} +#define SIGNATURE_ARGS(name, type, sig, args, ...) inline type name##args \ +{ \ + return S::sig##_##name.Call(##__VA_ARGS__); \ } #define VA_LIST(...) __VA_ARGS__ diff --git a/Amalgam/src/Core/Core.cpp b/Amalgam/src/Core/Core.cpp index b2b9c006..6cb82811 100644 --- a/Amalgam/src/Core/Core.cpp +++ b/Amalgam/src/Core/Core.cpp @@ -73,11 +73,11 @@ void CCore::Load() return; } - float flStart = SDK::PlatFloatTime(); + float flTime = 0.f; while (!U::Memory.FindSignature("client.dll", "48 8B 0D ? ? ? ? 48 8B 10 48 8B 19 48 8B C8 FF 92") || !SDK::GetTeamFortressWindow()) { - Sleep(500); - if (m_bUnload = m_bFailed = SDK::PlatFloatTime() - flStart > 60.f) + Sleep(500), flTime += 0.5f; + if (m_bUnload = m_bFailed = flTime >= 60.f) { AppendFailText("Failed to load"); return; diff --git a/Amalgam/src/Features/Aimbot/Aimbot.cpp b/Amalgam/src/Features/Aimbot/Aimbot.cpp index c1c65f7d..8bea919f 100644 --- a/Amalgam/src/Features/Aimbot/Aimbot.cpp +++ b/Amalgam/src/Features/Aimbot/Aimbot.cpp @@ -12,21 +12,9 @@ bool CAimbot::ShouldRun(CTFPlayer* pLocal, CTFWeaponBase* pWeapon) { - if (!pLocal || !pWeapon - || !pLocal->IsAlive() - || pLocal->IsAGhost() - || pLocal->IsTaunting() - || pLocal->InCond(TF_COND_STUNNED) && pLocal->m_iStunFlags() & (TF_STUN_CONTROLS | TF_STUN_LOSER_STATE) - || pLocal->m_bFeignDeathReady() - || pLocal->InCond(TF_COND_PHASE) - || pLocal->InCond(TF_COND_STEALTHED) - || pLocal->InCond(TF_COND_HALLOWEEN_KART)) - return false; - - if (SDK::AttribHookValue(1, "mult_dmg", pWeapon) == 0) - return false; - - if (I::EngineVGui->IsGameUIVisible()) + if (!pLocal || !pWeapon || !pLocal->CanAttack() + || SDK::AttribHookValue(1, "mult_dmg", pWeapon) == 0 + || I::EngineVGui->IsGameUIVisible()) return false; return true; @@ -90,7 +78,7 @@ void CAimbot::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) void CAimbot::Draw(CTFPlayer* pLocal) { - if (!Vars::Aimbot::General::FOVCircle.Value || !Vars::Colors::FOVCircle.Value.a || !pLocal->IsAlive() || pLocal->IsAGhost() || pLocal->IsTaunting() || pLocal->InCond(TF_COND_STUNNED) && pLocal->m_iStunFlags() & (TF_STUN_CONTROLS | TF_STUN_LOSER_STATE) || pLocal->InCond(TF_COND_HALLOWEEN_KART)) + if (!Vars::Aimbot::General::FOVCircle.Value || !Vars::Colors::FOVCircle.Value.a || !pLocal->CanAttack(false)) return; auto pWeapon = H::Entities.GetWeapon(); diff --git a/Amalgam/src/Features/Aimbot/Aimbot.h b/Amalgam/src/Features/Aimbot/Aimbot.h index 01192591..0148f92e 100644 --- a/Amalgam/src/Features/Aimbot/Aimbot.h +++ b/Amalgam/src/Features/Aimbot/Aimbot.h @@ -16,4 +16,4 @@ public: bool m_bRunningSecondary = false; }; -ADD_FEATURE(CAimbot, Aimbot) \ No newline at end of file +ADD_FEATURE(CAimbot, Aimbot); \ No newline at end of file diff --git a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp index e29330a0..e4c8ea69 100644 --- a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp @@ -142,7 +142,7 @@ bool CAimbotGlobal::ShouldIgnore(CBaseEntity* pEntity, CTFPlayer* pLocal, CTFWea if (Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Friends && H::Entities.IsFriend(pPlayer->entindex()) || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Party && H::Entities.InParty(pPlayer->entindex()) || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Invulnerable && pPlayer->IsInvulnerable() && SDK::AttribHookValue(0, "crit_forces_victim_to_laugh", pWeapon) <= 0 - || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Cloaked && pPlayer->IsInvisible() && pPlayer->GetInvisPercentage() >= Vars::Aimbot::General::IgnoreCloak.Value + || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Cloaked && pPlayer->m_flInvisibility() && pPlayer->m_flInvisibility() >= Vars::Aimbot::General::IgnoreCloak.Value / 100.f || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::DeadRinger && pPlayer->m_bFeignDeathReady() || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Taunting && pPlayer->IsTaunting() || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Disguised && pPlayer->InCond(TF_COND_DISGUISED)) diff --git a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h index 349fff8c..96ad5edb 100644 --- a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h +++ b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h @@ -36,4 +36,4 @@ public: bool ValidBomb(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CBaseEntity* pBomb); }; -ADD_FEATURE(CAimbotGlobal, AimbotGlobal) \ No newline at end of file +ADD_FEATURE(CAimbotGlobal, AimbotGlobal); \ No newline at end of file diff --git a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp index ecfd5f7b..376f97c3 100644 --- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp @@ -348,7 +348,7 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* const matrix3x4 mTransform = { { 1, 0, 0, tTarget.m_vPos.x }, { 0, 1, 0, tTarget.m_vPos.y }, { 0, 0, 1, tTarget.m_vPos.z } }; - tTarget.m_vPos += (tTarget.m_pEntity->m_vecMins() + tTarget.m_pEntity->m_vecMaxs()) / 2; + tTarget.m_vPos += tTarget.m_pEntity->GetOffset() / 2; if (vEyePos.DistToSqr(tTarget.m_vPos) > flMaxRange) break; @@ -607,23 +607,21 @@ bool CAimbotHitscan::ShouldFire(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser auto pSniperRifle = pWeapon->As(); if (!pLocal->InCond(TF_COND_AIMING) || pSniperRifle->m_flChargedDamage() == 150.f) - return true; + break; if (tTarget.m_nAimedHitbox == HITBOX_HEAD && (pWeapon->GetWeaponID() != TF_WEAPON_SNIPERRIFLE_CLASSIC ? true : pSniperRifle->m_flChargedDamage() == 150.f)) { - if (pSniperRifle->GetRifleType() == RIFLE_JARATE) - return true; - int iHeadDamage = std::ceil(std::max(pSniperRifle->m_flChargedDamage(), 50.f) * pSniperRifle->GetHeadshotMult(pPlayer)); if (pPlayer->m_iHealth() <= iHeadDamage && (G::CanHeadshot || pLocal->IsCritBoosted())) - return true; + break; } else { int iBodyDamage = std::ceil(std::max(pSniperRifle->m_flChargedDamage(), 50.f) * pSniperRifle->GetBodyshotMult(pPlayer)); if (pPlayer->m_iHealth() <= iBodyDamage) - return true; + break; } + return false; } } @@ -786,14 +784,22 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC if (bShouldFire) { - if (nWeaponID != TF_WEAPON_MEDIGUN || !(G::LastUserCmd->buttons & IN_ATTACK)) + switch (nWeaponID) + { + case TF_WEAPON_MEDIGUN: + if (!(G::LastUserCmd->buttons & IN_ATTACK)) + pCmd->buttons |= IN_ATTACK; + break; + case TF_WEAPON_SNIPERRIFLE_CLASSIC: + if (pWeapon->As()->m_flChargedDamage() && pLocal->m_hGroundEntity()) + pCmd->buttons &= ~IN_ATTACK; + break; + case TF_WEAPON_LASER_POINTER: + pCmd->buttons |= IN_ATTACK | IN_ATTACK2; + break; + default: pCmd->buttons |= IN_ATTACK; - - if (nWeaponID == TF_WEAPON_SNIPERRIFLE_CLASSIC && pWeapon->As()->m_flChargedDamage() && pLocal->m_hGroundEntity()) - pCmd->buttons &= ~IN_ATTACK; - - if (nWeaponID == TF_WEAPON_LASER_POINTER) - pCmd->buttons |= IN_ATTACK2; + } if (Vars::Aimbot::Hitscan::Modifiers.Value & Vars::Aimbot::Hitscan::ModifiersEnum::Tapfire && pWeapon->GetWeaponSpread() != 0.f && !pLocal->InCond(TF_COND_RUNE_PRECISION) && pLocal->GetShootPos().DistTo(tTarget.m_vPos) > Vars::Aimbot::Hitscan::TapFireDist.Value) @@ -842,6 +848,15 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC } Aim(pCmd, tTarget.m_vAngleTo); + if (G::SilentAngles) + { + switch (nWeaponID) + { + case TF_WEAPON_MEDIGUN: + //case TF_WEAPON_LASER_POINTER: // we can psilent with the wrangler though probably with some hacks + G::SilentAngles = false, G::PSilentAngles = true; + } + } 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 53e51bdd..186b4f73 100644 --- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.h +++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.h @@ -19,4 +19,4 @@ public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); }; -ADD_FEATURE(CAimbotHitscan, AimbotHitscan) \ No newline at end of file +ADD_FEATURE(CAimbotHitscan, AimbotHitscan); \ No newline at end of file diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp index 3178d19b..e30c67c0 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp @@ -592,7 +592,7 @@ bool CAimbotMelee::RunSapper(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd for (auto pEntity : H::Entities.GetGroup(EGroupType::BUILDINGS_ENEMIES)) { auto pBuilding = pEntity->As(); - if (pBuilding->m_bHasSapper() || pBuilding->m_iTeamNum() != TF_TEAM_BLUE && pBuilding->m_iTeamNum() != TF_TEAM_RED) + if (pBuilding->m_bHasSapper() || !pBuilding->IsInValidTeam()) continue; Vec3 vPoint; diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h index 1401243d..38248374 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h @@ -29,4 +29,4 @@ public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); }; -ADD_FEATURE(CAimbotMelee, AimbotMelee) \ No newline at end of file +ADD_FEATURE(CAimbotMelee, AimbotMelee); \ No newline at end of file diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp index 79e583c8..abda5bb0 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp @@ -149,7 +149,7 @@ std::vector CAimbotProjectile::SortTargets(CTFPlayer* pLocal, CTFWeapo -static inline float GetSplashRadius(CTFWeaponBase* pWeapon, CTFPlayer* pLocal = nullptr) +float CAimbotProjectile::GetSplashRadius(CTFWeaponBase* pWeapon, CTFPlayer* pPlayer) { float flRadius = 0.f; switch (pWeapon->GetWeaponID()) @@ -174,7 +174,7 @@ static inline float GetSplashRadius(CTFWeaponBase* pWeapon, CTFPlayer* pLocal = case TF_WEAPON_ROCKETLAUNCHER: case TF_WEAPON_ROCKETLAUNCHER_DIRECTHIT: case TF_WEAPON_PARTICLE_CANNON: - if (pLocal->InCond(TF_COND_BLASTJUMPING) && SDK::AttribHookValue(1.f, "rocketjump_attackrate_bonus", pWeapon) != 1.f) + if (pPlayer->InCond(TF_COND_BLASTJUMPING) && SDK::AttribHookValue(1.f, "rocketjump_attackrate_bonus", pWeapon) != 1.f) flRadius *= 0.8f; } return flRadius * Vars::Aimbot::Projectile::SplashRadius.Value / 100; @@ -1349,7 +1349,7 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas ProjectileInfo tProjInfo = {}; int iMaxTime, iSplash; Info_t tInfo = { pLocal, pWeapon }; - const float flSize = tTarget.m_pEntity->m_vecMins().DistTo(tTarget.m_pEntity->m_vecMaxs()); + const float flSize = tTarget.m_pEntity->GetSize().Length(); { int iFlags = ProjSimEnum::NoRandomAngles | ProjSimEnum::PredictCmdNum; if (!F::ProjSim.GetInfo(pLocal, pWeapon, {}, tProjInfo, iFlags) || !F::ProjSim.Initialize(tProjInfo, false)) @@ -1812,41 +1812,41 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser if (Vars::Aimbot::General::AutoShoot.Value) { - pCmd->buttons |= IN_ATTACK; - - if (pWeapon->m_iItemDefinitionIndex() == Soldier_m_TheBeggarsBazooka) + switch (nWeaponID) { - if (pWeapon->m_iClip1() > 0) + case TF_WEAPON_COMPOUND_BOW: + case TF_WEAPON_PIPEBOMBLAUNCHER: + pCmd->buttons |= IN_ATTACK; + if (pWeapon->As()->m_flChargeBeginTime() > 0.f) pCmd->buttons &= ~IN_ATTACK; - } - else - { - switch (nWeaponID) + break; + case TF_WEAPON_CANNON: + pCmd->buttons |= IN_ATTACK; + if (pWeapon->As()->m_flDetonateTime() > 0.f) { - case TF_WEAPON_COMPOUND_BOW: - case TF_WEAPON_PIPEBOMBLAUNCHER: - if (pWeapon->As()->m_flChargeBeginTime() > 0.f) - pCmd->buttons &= ~IN_ATTACK; - break; - case TF_WEAPON_CANNON: - if (pWeapon->As()->m_flDetonateTime() > 0.f) + if (m_iLastTickCancel) + pCmd->weaponselect = m_iLastTickCancel = 0; + if (Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::ChargeWeapon) { - if (m_iLastTickCancel) - pCmd->weaponselect = m_iLastTickCancel = 0; - if (Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::ChargeWeapon) - { - float flCharge = pWeapon->As()->m_flDetonateTime() - I::GlobalVars->curtime; - if (std::clamp(flCharge, 0.f, 1.f) < flTimeTo) - pCmd->buttons &= ~IN_ATTACK; - } - else + float flCharge = pWeapon->As()->m_flDetonateTime() - I::GlobalVars->curtime; + if (std::clamp(flCharge, 0.f, 1.f) < flTimeTo) pCmd->buttons &= ~IN_ATTACK; } - break; - case TF_WEAPON_BAT_WOOD: - case TF_WEAPON_BAT_GIFTWRAP: - case TF_WEAPON_LUNCHBOX: - pCmd->buttons &= ~IN_ATTACK, pCmd->buttons |= IN_ATTACK2; + else + pCmd->buttons &= ~IN_ATTACK; + } + break; + case TF_WEAPON_BAT_WOOD: + case TF_WEAPON_BAT_GIFTWRAP: + case TF_WEAPON_LUNCHBOX: + pCmd->buttons &= ~IN_ATTACK, pCmd->buttons |= IN_ATTACK2; + break; + default: + pCmd->buttons |= IN_ATTACK; + if (pWeapon->m_iItemDefinitionIndex() == Soldier_m_TheBeggarsBazooka) + { + if (pWeapon->m_iClip1() > 0) + pCmd->buttons &= ~IN_ATTACK; } } } diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h index bd8c4761..c063f948 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h @@ -68,8 +68,9 @@ class CAimbotProjectile public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); + float GetSplashRadius(CTFWeaponBase* pWeapon, CTFPlayer* pPlayer); int m_iLastTickCancel = 0; }; -ADD_FEATURE(CAimbotProjectile, AimbotProjectile) \ No newline at end of file +ADD_FEATURE(CAimbotProjectile, AimbotProjectile); \ No newline at end of file diff --git a/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.h b/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.h index 4c006cba..9a51f468 100644 --- a/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.h +++ b/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.h @@ -9,4 +9,4 @@ public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); }; -ADD_FEATURE(CAutoAirblast, AutoAirblast) \ No newline at end of file +ADD_FEATURE(CAutoAirblast, AutoAirblast); \ No newline at end of file diff --git a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp index 2dfaefb1..fcb27a85 100644 --- a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp +++ b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp @@ -102,7 +102,7 @@ static inline bool CheckEntities(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUse if (Vars::Aimbot::Projectile::AutoDetonate.Value & Vars::Aimbot::Projectile::AutoDetonateEnum::IgnoreCloak && pEntity->IsPlayer()) { auto pPlayer = pEntity->As(); - if (pPlayer->IsInvisible() && pPlayer->GetInvisPercentage() >= Vars::Aimbot::General::IgnoreCloak.Value) + if (pPlayer->m_flInvisibility() && pPlayer->m_flInvisibility() >= Vars::Aimbot::General::IgnoreCloak.Value / 100.f) continue; } diff --git a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.h b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.h index 95474ae5..9f7389ef 100644 --- a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.h +++ b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.h @@ -17,4 +17,4 @@ public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); }; -ADD_FEATURE(CAutoDetonate, AutoDetonate) \ No newline at end of file +ADD_FEATURE(CAutoDetonate, AutoDetonate); \ No newline at end of file diff --git a/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp b/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp index 5330908e..2cf4896d 100644 --- a/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp +++ b/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp @@ -1,27 +1,703 @@ #include "AutoHeal.h" #include "../../Players/PlayerUtils.h" +#include "../../Backtrack/Backtrack.h" +#include "../../CritHack/CritHack.h" +#include "../../Simulation/ProjectileSimulation/ProjectileSimulation.h" +#include "../AimbotProjectile/AimbotProjectile.h" -bool CAutoHeal::ActivateOnVoice(CTFPlayer* pLocal, CWeaponMedigun* pWeapon, CUserCmd* pCmd) +void CAutoHeal::ActivateOnVoice(CTFPlayer* pLocal, CWeaponMedigun* pWeapon, CUserCmd* pCmd) { if (!Vars::Aimbot::Healing::ActivateOnVoice.Value) - return false; + return; auto pTarget = pWeapon->m_hHealingTarget().Get(); if (!pTarget || Vars::Aimbot::Healing::FriendsOnly.Value && !H::Entities.IsFriend(pTarget->entindex()) && !H::Entities.InParty(pTarget->entindex())) - return false; + return; - bool bReturn = m_mMedicCallers.contains(pTarget->entindex()); - if (bReturn) + if (m_mMedicCallers.contains(pTarget->entindex())) pCmd->buttons |= IN_ATTACK2; +} - return bReturn; +static inline Vec3 PredictOrigin(Vec3& vOrigin, Vec3 vVelocity, float flLatency, bool bTrace = true, Vec3 vMins = {}, Vec3 vMaxs = {}, unsigned int nMask = MASK_SOLID, float flNormal = 0.f) +{ + if (vVelocity.IsZero() || !flLatency) + return vOrigin; + + Vec3 vTo = vOrigin + vVelocity * flLatency; + if (!bTrace) + return vTo; + + CGameTrace trace = {}; + CTraceFilterWorldAndPropsOnly filter = {}; + + SDK::TraceHull(vOrigin, vTo, vMins, vMaxs, nMask, &filter, &trace); + //G::SweptStorage.emplace_back(std::pair(trace.startpos, trace.endpos), vMins, vMaxs, Vec3(), I::GlobalVars->curtime + 60.f, Color_t(255, 255, 255, 10), true); + Vec3 vOrigin2 = vOrigin + (vTo - vOrigin) * trace.fraction; + if (trace.DidHit() && flNormal) + vOrigin2 += trace.plane.normal * flNormal; + return vOrigin2; +} + +static inline bool TraceToEntity(CTFPlayer* pPlayer, CBaseEntity* pEntity, Vec3& vPlayerOrigin, Vec3& vEntityOrigin, unsigned int nMask = MASK_SHOT | CONTENTS_GRATE) +{ + CGameTrace trace = {}; + CTraceFilterWorldAndPropsOnly filter = {}; + + if (pEntity->IsPlayer()) + { + Vec3 vMins = pPlayer->m_vecMins() + 1; + Vec3 vMaxs = pPlayer->m_vecMaxs() - 1; + Vec3 vMinsS = (vMins - vMaxs) / 2; + Vec3 vMaxsS = (vMaxs - vMins) / 2; + + std::vector vPoints = { + Vec3(), + Vec3(vMinsS.x, vMinsS.y, vMaxsS.z), + Vec3(vMaxsS.x, vMinsS.y, vMaxsS.z), + Vec3(vMinsS.x, vMaxsS.y, vMaxsS.z), + Vec3(vMaxsS.x, vMaxsS.y, vMaxsS.z), + Vec3(vMinsS.x, vMinsS.y, vMinsS.z), + Vec3(vMaxsS.x, vMinsS.y, vMinsS.z), + Vec3(vMinsS.x, vMaxsS.y, vMinsS.z), + Vec3(vMaxsS.x, vMaxsS.y, vMinsS.z) + }; + for (auto& vPoint : vPoints) + { + SDK::Trace(vPlayerOrigin + vPoint, vEntityOrigin, nMask, &filter, &trace); + //if (trace.fraction == 1.f) + // G::LineStorage.emplace_back(std::pair(trace.startpos, trace.endpos), I::GlobalVars->curtime + 60.f, Color_t(0, 255, 0, 25), true); + if (trace.fraction == 1.f) + return true; + } + } + else + { + SDK::Trace(vPlayerOrigin, vEntityOrigin, nMask, &filter, &trace); + //if (trace.fraction == 1.f) + // G::LineStorage.emplace_back(std::pair(trace.startpos, trace.endpos), I::GlobalVars->curtime + 60.f, Color_t(0, 255, 0, 25), true); + return trace.fraction == 1.f; + } + + return false; +} + +static inline int GetShotsWithinTime(int iWeaponID, float flFireRate, float flTime) +{ + int iTicks = TIME_TO_TICKS(flTime); + + int iDelay = 1; + switch (iWeaponID) + { + case TF_WEAPON_MINIGUN: + case TF_WEAPON_PIPEBOMBLAUNCHER: + case TF_WEAPON_CANNON: + iDelay = 2; + } + + return 1 + (iTicks - iDelay) / std::ceilf(flFireRate / TICK_INTERVAL); +} + +void CAutoHeal::GetDangers(CTFPlayer* pTarget, bool bVaccinator, float& flBulletOut, float& flBlastOut, float& flFireOut) +{ + if (pTarget->IsInvulnerable()) + return; + + float flBulletDanger = 0.f, flBlastDanger = 0.f, flFireDanger = 0.f; + float flBulletResist = pTarget->InCond(TF_COND_BULLET_IMMUNE) ? 1.f : pTarget->InCond(TF_COND_MEDIGUN_UBER_BULLET_RESIST) ? 0.75f : pTarget->InCond(TF_COND_MEDIGUN_SMALL_BULLET_RESIST) ? -0.1f : 0.f; + float flBlastResist = pTarget->InCond(TF_COND_BLAST_IMMUNE) ? 1.f : pTarget->InCond(TF_COND_MEDIGUN_UBER_BLAST_RESIST) ? 0.75f : pTarget->InCond(TF_COND_MEDIGUN_SMALL_BLAST_RESIST) ? -0.1f : 0.f; + float flFireResist = pTarget->InCond(TF_COND_FIRE_IMMUNE) ? 1.f : pTarget->InCond(TF_COND_MEDIGUN_UBER_FIRE_RESIST) ? 0.75f : pTarget->InCond(TF_COND_MEDIGUN_SMALL_FIRE_RESIST) ? -0.1f : 0.f; + + float flLatency = F::Backtrack.GetReal(); + int iPlayerHealth = pTarget->m_iHealth(); + Vec3 vTargetOrigin = PredictOrigin(pTarget->m_vecOrigin(), pTarget->m_vecVelocity(), pTarget->entindex() != I::EngineClient->GetLocalPlayer() ? flLatency : 0.f, true, pTarget->m_vecMins(), pTarget->m_vecMaxs(), pTarget->SolidMask()); + Vec3 vTargetCenter = vTargetOrigin + pTarget->GetOffset() / 2; + Vec3 vTargetEye = vTargetOrigin + pTarget->GetViewOffset(); + + for (auto pEntity : H::Entities.GetGroup(EGroupType::PLAYERS_ENEMIES)) + { + auto pPlayer = pEntity->As(); + int iIndex = pPlayer->entindex(); + if (pPlayer->IsDormant() || !pPlayer->CanAttack(true, false)) + continue; + + auto pWeapon = pPlayer->m_hActiveWeapon().Get()->As(); + int nWeaponID = pWeapon ? pWeapon->GetWeaponID() : 0; + auto eWeaponType = SDK::GetWeaponType(pWeapon); + if (eWeaponType == EWeaponType::UNKNOWN || eWeaponType == EWeaponType::MELEE // if we ever want to port this over to auto uber or something, handle melee + || nWeaponID == TF_WEAPON_DRG_POMSON || nWeaponID == TF_WEAPON_PIPEBOMBLAUNCHER + || nWeaponID == TF_WEAPON_MINIGUN && !pPlayer->InCond(TF_COND_AIMING)) + continue; + + Vec3 vPlayerOrigin = PredictOrigin(pPlayer->m_vecOrigin(), pPlayer->m_vecVelocity(), flLatency, true, pPlayer->m_vecMins(), pPlayer->m_vecMaxs(), pPlayer->SolidMask()); + Vec3 vPlayerEye = vPlayerOrigin + pPlayer->GetViewOffset(); + + bool bCheater = F::PlayerUtils.HasTag(iIndex, F::PlayerUtils.TagToIndex(CHEATER_TAG)); + bool bZoom = pPlayer->InCond(TF_COND_ZOOMED); + float flFOV = Math::CalcFov(H::Entities.GetEyeAngles(iIndex) + H::Entities.GetPingAngles(iIndex), Math::CalcAngle(vPlayerEye, bZoom ? vTargetEye : vTargetCenter)); + bool bFOV = bCheater || flFOV < (bZoom ? 10 : eWeaponType == EWeaponType::HITSCAN ? 30 : 90); + if (!bFOV || !TraceToEntity(pTarget, pPlayer, vTargetCenter, vPlayerEye)) + continue; + + bool bCrits = pPlayer->IsCritBoosted() || F::CritHack.WeaponCanCrit(pWeapon); + bool bMinicrits = pPlayer->IsMiniCritBoosted() || pTarget->IsMarked(); + float flDistance = vPlayerEye.DistTo(vTargetCenter); + float flDamage, flMult = bCrits ? 3.f : bMinicrits ? 1.36f : 1.f; + float flFireRate = std::min(pWeapon->GetFireRate(), 1.f); + int iBulletCount = pWeapon->GetBulletsPerShot(); + int iShotsWithinTime = GetShotsWithinTime(nWeaponID, flFireRate, flLatency + TICKS_TO_TIME(bCheater ? 22 : 0)); + switch (nWeaponID) + { + case TF_WEAPON_SNIPERRIFLE: + case TF_WEAPON_SNIPERRIFLE_DECAP: + case TF_WEAPON_SNIPERRIFLE_CLASSIC: + { + bool bClassic = nWeaponID == TF_WEAPON_SNIPERRIFLE_CLASSIC; + bool bHeadshot = pWeapon->As()->GetRifleType() != RIFLE_JARATE; + bool bPiss = SDK::AttribHookValue(0, "jarate_duration", pWeapon) > 0; + auto GetSniperDot = [](CBaseEntity* pEntity) -> CSniperDot* + { + for (auto pDot : H::Entities.GetGroup(EGroupType::MISC_DOTS)) + { + if (pDot->m_hOwnerEntity().Get() == pEntity) + return pDot->As(); + } + return nullptr; + }; + if (CSniperDot* pPlayerDot = GetSniperDot(pEntity)) + { + float flChargeTime = std::max(SDK::AttribHookValue(3.f, "mult_sniper_charge_per_sec", pWeapon), 1.5f); + flDamage = Math::RemapVal(TICKS_TO_TIME(I::ClientState->m_ClockDriftMgr.m_nServerTick) - pPlayerDot->m_flChargeStartTime() - 0.3f, 0.f, flChargeTime, 50.f, 150.f); + if (bClassic && flDamage != 150.f) + flDamage = SDK::AttribHookValue(flDamage, "bodyshot_damage_modify", pWeapon); + else + flMult = std::max(bHeadshot || bClassic ? 3.f : bPiss ? 1.36f : 1.f, flMult); + break; + } + if (SDK::AttribHookValue(0, "sniper_only_fire_zoomed", pWeapon) && !bZoom) + flDamage = 0.f; + else if (bClassic || !bZoom) + flDamage = SDK::AttribHookValue(50.f, "bodyshot_damage_modify", pWeapon); + else + flDamage = 150.f, flMult = flMult = std::max(bHeadshot || bClassic ? 3.f : bPiss ? 1.36f : 1.f, flMult); + break; + } + case TF_WEAPON_COMPOUND_BOW: + flDamage = 120.f, flMult = 3.f; + break; + case TF_WEAPON_FLAMETHROWER: + flDamage = 80.f * flFireRate; + break; + default: + flDamage = pWeapon->GetDamage(false); + } + + switch (eWeaponType) + { + case EWeaponType::HITSCAN: + { + flMult = flBulletResist > 0.f ? 1.f - flBulletResist : flMult + flBulletResist; + flDamage *= flMult * (pWeapon ? SDK::AttribHookValue(1.f, "mult_dmg", pWeapon) : 1); + + float flSpread = std::clamp(pWeapon->GetWeaponSpread(), 0.001f, 1.f); + float flMappedCount = Math::RemapVal(flDistance, 20 / flSpread, 100 / flSpread, iBulletCount, 1); + float flDamageInLatency = flDamage * flMappedCount * iShotsWithinTime; + float flDamageDanger = flDamageInLatency / iPlayerHealth; + float flDistanceDanger = Math::RemapVal(flDistance, 100, 100 / flSpread, 1.f, 0.001f); + if (bCheater) // may use seed pred +/ crits + flDistanceDanger = std::max(flDistanceDanger, bCrits ? 1.f : 0.34f); + + //SDK::Output("Hitscan", std::format("{}, {}, {}, {}, {}", flDamage, flSpread, flDamageInLatency, flDamageDanger, flDistanceDanger).c_str(), { 255, 200, 200 }, Vars::Debug::Logging.Value); + flBulletDanger += flDamageDanger * flDistanceDanger; + break; + } + case EWeaponType::PROJECTILE: + { + ProjectileInfo tProjInfo = {}; + if (!F::ProjSim.GetInfo(pPlayer, pWeapon, {}, tProjInfo, ProjSimEnum::NoRandomAngles | ProjSimEnum::MaxSpeed)) + continue; + + int iType = MEDIGUN_BLAST_RESIST; + switch (nWeaponID) + { + case TF_WEAPON_COMPOUND_BOW: + case TF_WEAPON_CROSSBOW: + case TF_WEAPON_SHOTGUN_BUILDING_RESCUE: + case TF_WEAPON_SYRINGEGUN_MEDIC: + case TF_WEAPON_RAYGUN: iType = MEDIGUN_BULLET_RESIST; break; + case TF_WEAPON_FLAMETHROWER: // maybe just test full range? + case TF_WEAPON_FLAME_BALL: iType = MEDIGUN_FIRE_RESIST; break; + } + + switch (iType) + { + case MEDIGUN_BULLET_RESIST: flMult = flBulletResist > 0.f ? 1.f - flBulletResist : flMult + flBulletResist; break; + case MEDIGUN_BLAST_RESIST: flMult = flBlastResist > 0.f ? 1.f - flBlastResist : flMult + flBlastResist; break; + case MEDIGUN_FIRE_RESIST: flMult = flFireResist > 0.f ? 1.f - flFireResist : flMult + flFireResist; break; + } + flDamage *= flMult * (pWeapon ? SDK::AttribHookValue(1.f, "mult_dmg", pWeapon) : 1); + + float flRadius = tProjInfo.m_flVelocity * flLatency + F::AimbotProjectile.GetSplashRadius(pWeapon, pPlayer) + pTarget->GetSize().Length() / 2; + float flDamageInLatency = flDamage * iBulletCount * iShotsWithinTime; + float flDamageDanger = flDamageInLatency / iPlayerHealth; + float flDistanceDanger = Math::RemapVal(flDistance, flRadius, flRadius, 1.f, 0.001f); + + //SDK::Output("Projectile", std::format("{}, {}, {}, {}", flDamage, flDamageInLatency, flDamageDanger, flDistanceDanger).c_str(), { 255, 200, 200 }, Vars::Debug::Logging.Value); + switch (iType) + { + case MEDIGUN_BULLET_RESIST: flBulletDanger += flDamageDanger * flDistanceDanger; break; + case MEDIGUN_BLAST_RESIST: flBlastDanger += flDamageDanger * flDistanceDanger; break; + case MEDIGUN_FIRE_RESIST: flFireDanger += flDamageDanger * flDistanceDanger; break; + } + } + } + } + + for (auto pEntity : H::Entities.GetGroup(EGroupType::BUILDINGS_ENEMIES)) + { + auto pSentry = pEntity->As(); + if (pSentry->GetClassID() != ETFClassID::CObjectSentrygun) + continue; + + if (pSentry->m_hEnemy().Get() != pTarget && pSentry->m_hAutoAimTarget().Get() != pTarget || !pSentry->m_iAmmoShells()) + continue; + + float flDistance = pSentry->GetCenter().DistTo(vTargetCenter); + float flDamage = 19.f, flMult = pTarget->IsMarked() ? 1.36f : 1.f; + float flFireRate; + switch (pSentry->m_bMiniBuilding() ? 0 : pSentry->m_iUpgradeLevel()) + { + case 0: + flDamage /= 2; + flFireRate = pSentry->m_bPlayerControlled() ? 0.09f : 0.18f; + break; + case 1: + flFireRate = pSentry->m_bPlayerControlled() ? 0.135f : 0.225f; + break; + default: + flFireRate = pSentry->m_bPlayerControlled() ? 0.09f : 0.135f; + } + int iShotsWithinTime = GetShotsWithinTime(0, flFireRate, 1.f /*flLatency*/); + flMult = flBulletResist > 0.f ? 1.f - flBulletResist : flMult + flBulletResist; + flDamage *= flMult; + + float flDamageInLatency = flDamage * iShotsWithinTime; + float flDamageDanger = flDamageInLatency / iPlayerHealth; + float flDistanceDanger = Math::RemapVal(flDistance, 1100.f, 3200.f, 1.f, 0.001f); + + //SDK::Output("Sentry", std::format("{}, {}, {}, {}", flDamage, flDamageInLatency, flDamageDanger, flDistanceDanger).c_str(), { 255, 200, 200 }, Vars::Debug::Logging.Value); + flBulletDanger += flDamageDanger * flDistanceDanger; + } + + for (auto pEntity : H::Entities.GetGroup(EGroupType::WORLD_PROJECTILES)) + { + CTFPlayer* pOwner = nullptr; + CTFWeaponBase* pWeapon = nullptr; + + switch (pEntity->GetClassID()) + { + case ETFClassID::CTFGrenadePipebombProjectile: + case ETFClassID::CTFWeaponBaseMerasmusGrenade: + case ETFClassID::CTFProjectile_SpellMeteorShower: + pWeapon = pEntity->As()->m_hOriginalLauncher().Get()->As(); + pOwner = pEntity->As()->m_hThrower().Get()->As(); + break; + case ETFClassID::CTFProjectile_Arrow: + case ETFClassID::CTFProjectile_HealingBolt: + case ETFClassID::CTFProjectile_Rocket: + case ETFClassID::CTFProjectile_SentryRocket: + case ETFClassID::CTFProjectile_BallOfFire: + case ETFClassID::CTFProjectile_SpellFireball: + case ETFClassID::CTFProjectile_SpellLightningOrb: + case ETFClassID::CTFProjectile_EnergyBall: + case ETFClassID::CTFProjectile_Flare: + pWeapon = pEntity->As()->m_hLauncher().Get()->As(); + pOwner = pWeapon ? pWeapon->m_hOwner().Get()->As() : nullptr; + break; + case ETFClassID::CTFProjectile_EnergyRing: + pWeapon = pEntity->As()->m_hLauncher().Get()->As(); + pOwner = pWeapon ? pWeapon->m_hOwner().Get()->As() : nullptr; + } + if (!pOwner || pOwner->m_iTeamNum() == pTarget->m_iTeamNum() || pWeapon && !pWeapon->GetDamage()) + continue; + + Vec3 vVelocity = pEntity->GetAbsVelocity(); + float flRadius = 0.f; + switch (pEntity->GetClassID()) + { + case ETFClassID::CTFProjectile_Rocket: + case ETFClassID::CTFProjectile_SentryRocket: + case ETFClassID::CTFProjectile_EnergyBall: + vVelocity = pEntity->As()->m_vInitialVelocity(); + [[fallthrough]]; + case ETFClassID::CTFGrenadePipebombProjectile: + case ETFClassID::CTFWeaponBaseMerasmusGrenade: + flRadius = 146.f; + break; + case ETFClassID::CTFProjectile_Flare: + flRadius = 110.f; + } + if (pOwner && pWeapon && flRadius) + { + flRadius = SDK::AttribHookValue(flRadius, "mult_explosion_radius", pWeapon); + switch (pWeapon->GetWeaponID()) + { + case TF_WEAPON_ROCKETLAUNCHER: + case TF_WEAPON_ROCKETLAUNCHER_DIRECTHIT: + case TF_WEAPON_PARTICLE_CANNON: + if (pOwner->InCond(TF_COND_BLASTJUMPING) && SDK::AttribHookValue(1.f, "rocketjump_attackrate_bonus", pWeapon) != 1.f) + flRadius *= 0.8f; + } + } + + Vec3 vProjectileOrigin = PredictOrigin(pEntity->m_vecOrigin(), vVelocity, flLatency, true, pEntity->m_vecMins(), pEntity->m_vecMaxs()); + if (!TraceToEntity(pTarget, pEntity, vTargetEye, vProjectileOrigin, MASK_SHOT)) + continue; + + int iType = MEDIGUN_BLAST_RESIST; + float flDamage = 100.f, flMult = pTarget->IsMarked() ? 1.36f : 1.f; + switch (pEntity->GetClassID()) + { + case ETFClassID::CTFGrenadePipebombProjectile: + case ETFClassID::CTFWeaponBaseMerasmusGrenade: + case ETFClassID::CTFProjectile_SpellMeteorShower: + if (pEntity->As()->m_bCritical()) + flMult = 3.f; + else if (pEntity->As()->m_iDeflected() && (pEntity->GetClassID() != ETFClassID::CTFGrenadePipebombProjectile || !pEntity->GetAbsVelocity().IsZero())) + flMult = 1.36f; + break; + case ETFClassID::CTFProjectile_Arrow: + if (pEntity->As()->m_iProjectileType() == TF_PROJECTILE_ARROW) + { + flMult = 3.f; + break; + } + [[fallthrough]]; + case ETFClassID::CTFProjectile_HealingBolt: + if (pEntity->As()->m_bCritical()) + flMult = 3.f; + else if (pEntity->As()->m_iDeflected()) + flMult = 1.36f; + break; + case ETFClassID::CTFProjectile_Rocket: + case ETFClassID::CTFProjectile_BallOfFire: + case ETFClassID::CTFProjectile_SentryRocket: + case ETFClassID::CTFProjectile_SpellFireball: + case ETFClassID::CTFProjectile_SpellLightningOrb: + if (pEntity->As()->m_bCritical()) + flMult = 3.f; + else if (pEntity->As()->m_iDeflected()) + flMult = 1.36f; + break; + case ETFClassID::CTFProjectile_EnergyBall: + if (pEntity->As()->m_bChargedShot()) + flMult = 2.f; // whatever + else if (pEntity->As()->m_iDeflected()) + flMult = 1.36f; + break; + case ETFClassID::CTFProjectile_Flare: + if (pEntity->As()->m_bCritical() || pTarget->InCond(TF_COND_BURNING) || pTarget->InCond(TF_COND_BURNING_PYRO)) + flMult = 3.f; + else if (pEntity->As()->m_iDeflected()) + flMult = 1.36f; + } + switch (pEntity->GetClassID()) + { + case ETFClassID::CTFGrenadePipebombProjectile: + flDamage = 100.f; + break; + case ETFClassID::CTFWeaponBaseMerasmusGrenade: + flDamage = 50.f; + break; + case ETFClassID::CTFProjectile_SpellMeteorShower: + flDamage = 100.f; + iType = MEDIGUN_FIRE_RESIST; + break; + case ETFClassID::CTFProjectile_Arrow: + flDamage = pEntity->As()->m_iProjectileType() == TF_PROJECTILE_ARROW + ? Math::RemapVal(pEntity->As()->m_vInitialVelocity().Length(), 1800.f, 2600.f, 50.f, 120.f) + : 40.f; + iType = MEDIGUN_BULLET_RESIST; + break; + case ETFClassID::CTFProjectile_HealingBolt: + flDamage = Math::RemapVal(pOwner->m_vecOrigin().DistTo(vProjectileOrigin), 200.f, 1600.f, 38.f, 75.f); + iType = MEDIGUN_BULLET_RESIST; + break; + case ETFClassID::CTFProjectile_Rocket: + case ETFClassID::CTFProjectile_EnergyBall: + flDamage = flMult ? 90.f : Math::RemapVal(pOwner->m_vecOrigin().DistTo(vProjectileOrigin), 500.f, 920.f, 90.f, 48.f); + break; + case ETFClassID::CTFProjectile_SentryRocket: + flDamage = flMult ? 100.f : Math::RemapVal(pOwner->m_vecOrigin().DistTo(vProjectileOrigin), 100.f, 920.f, 100.f, 50.f); + break; + case ETFClassID::CTFProjectile_BallOfFire: + flDamage = pTarget->InCond(TF_COND_BURNING) || pTarget->InCond(TF_COND_BURNING_PYRO) ? 90.f : 30.f; + iType = MEDIGUN_FIRE_RESIST; + break; + case ETFClassID::CTFProjectile_SpellFireball: + flDamage = 100.f; + iType = MEDIGUN_FIRE_RESIST; + break; + case ETFClassID::CTFProjectile_SpellLightningOrb: + flDamage = 100.f; + iType = MEDIGUN_FIRE_RESIST; + break; + case ETFClassID::CTFProjectile_Flare: + flDamage = 30.f; + iType = MEDIGUN_FIRE_RESIST; + break; + case ETFClassID::CTFProjectile_EnergyRing: + flDamage = 60.f; + iType = MEDIGUN_BULLET_RESIST; + } + switch (iType) + { + case MEDIGUN_BULLET_RESIST: flMult = flBulletResist > 0.f ? 1.f - flBulletResist : flMult + flBulletResist; break; + case MEDIGUN_BLAST_RESIST: flMult = flBlastResist > 0.f ? 1.f - flBlastResist : flMult + flBlastResist; break; + case MEDIGUN_FIRE_RESIST: flMult = flFireResist > 0.f ? 1.f - flFireResist : flMult + flFireResist; break; + } + flDamage *= flMult * (pWeapon ? SDK::AttribHookValue(1.f, "mult_dmg", pWeapon) : 1); + + flRadius += vVelocity.Length() * flLatency + pTarget->GetSize().Length() / 2; + float flDamageDanger = flDamage / iPlayerHealth; + float flDistanceDanger = Math::RemapVal(pTarget->m_vecOrigin().DistTo(vProjectileOrigin), flRadius, flRadius, 1.f, 0.001f); + + //G::SphereStorage.emplace_back(vProjectileOrigin, flRadius, 36, 36, I::GlobalVars->curtime + 60.f, Color_t(255, 255, 255, 1), Color_t(0, 0, 0, 0), true); + //SDK::Output(std::format("Projectile {}", iType).c_str(), std::format("{}, {}, {}", flDamage, flDamageDanger, flDistanceDanger).c_str(), { 255, 200, 200 }, Vars::Debug::Logging.Value); + switch (iType) + { + case MEDIGUN_BULLET_RESIST: + flBulletDanger += flDamageDanger * flDistanceDanger; + break; + case MEDIGUN_BLAST_RESIST: + flBlastDanger += flDamageDanger * flDistanceDanger; + break; + case MEDIGUN_FIRE_RESIST: + flFireDanger += flDamageDanger * flDistanceDanger; + } + } + + if (m_flDamagedTime <= TICK_INTERVAL) + { + if (pTarget->InCond(TF_COND_BURNING) || pTarget->InCond(TF_COND_BURNING_PYRO)) + { + m_flDamagedTime = TICK_INTERVAL * 2; + m_iDamagedType = MEDIGUN_FIRE_RESIST; + m_flDamagedDPS = 8.f; + } + } + if (m_flDamagedTime = std::max(m_flDamagedTime - TICK_INTERVAL, 0.f)) + { + switch (m_iDamagedType) + { + case MEDIGUN_BULLET_RESIST: + flBulletDanger += m_flDamagedDPS / iPlayerHealth; + break; + case MEDIGUN_BLAST_RESIST: + flBlastDanger += m_flDamagedDPS / iPlayerHealth; + break; + case MEDIGUN_FIRE_RESIST: + flFireDanger += m_flDamagedDPS / iPlayerHealth; + } + } + + // ignore resistances we are already charged with, else scale + if (flBulletResist >= (bVaccinator ? 0.75f : 1.f)) + flBulletDanger = 0.f; + else + flBulletDanger *= Vars::Aimbot::Healing::AutoVaccinatorBulletScale.Value / 100.f; + if (flBlastResist >= (bVaccinator ? 0.75f : 1.f)) + flBlastDanger = 0.f; + else + flBlastDanger *= Vars::Aimbot::Healing::AutoVaccinatorBlastScale.Value / 100.f; + if (flFireResist >= (bVaccinator ? 0.75f : 1.f)) + flFireDanger = 0.f; + else + flFireDanger *= Vars::Aimbot::Healing::AutoVaccinatorFireScale.Value / 100.f; + + flBulletOut = std::max(flBulletOut, flBulletDanger); + flBlastOut = std::max(flBlastOut, flBlastDanger); + flFireOut = std::max(flFireOut, flFireDanger); +} + +void CAutoHeal::SwapResistType(CUserCmd* pCmd, int iType) +{ + if (m_iResistType != iType && !(G::LastUserCmd->buttons & IN_RELOAD)) + pCmd->buttons |= IN_RELOAD; +} + +void CAutoHeal::ActivateResistType(CUserCmd* pCmd, int iType) +{ + if (m_flChargeLevel >= 0.25f && m_iResistType == iType) + pCmd->buttons |= IN_ATTACK2; +} + +void CAutoHeal::AutoVaccinator(CTFPlayer* pLocal, CWeaponMedigun* pWeapon, CUserCmd* pCmd) +{ + if (!Vars::Aimbot::Healing::AutoVaccinator.Value || pWeapon->GetMedigunType() != MEDIGUN_RESIST) + return; + + //G::LineStorage.clear(); + //G::SweptStorage.clear(); + //G::SphereStorage.clear(); + if (m_iResistType == -1) + m_iResistType = pWeapon->GetResistType(); + + std::vector> vResistDangers = { + { 0.f, MEDIGUN_BULLET_RESIST }, + { 0.f, MEDIGUN_BLAST_RESIST }, + { 0.f, MEDIGUN_FIRE_RESIST } + }; + + GetDangers(pLocal, true, vResistDangers[MEDIGUN_BULLET_RESIST].first, vResistDangers[MEDIGUN_BLAST_RESIST].first, vResistDangers[MEDIGUN_FIRE_RESIST].first); + auto pTarget = pWeapon->m_hHealingTarget().Get()->As(); + if (pTarget && (!Vars::Aimbot::Healing::FriendsOnly.Value || H::Entities.IsFriend(pTarget->entindex()) || H::Entities.InParty(pTarget->entindex()))) + GetDangers(pTarget, true, vResistDangers[MEDIGUN_BULLET_RESIST].first, vResistDangers[MEDIGUN_BLAST_RESIST].first, vResistDangers[MEDIGUN_FIRE_RESIST].first); + std::sort(vResistDangers.begin(), vResistDangers.end(), [&](const std::pair& a, const std::pair& b) -> bool + { + return a.first > b.first; + }); + + int iTargetResist = vResistDangers.front().second; + float flTargetDanger = vResistDangers.front().first; + if (flTargetDanger) + SwapResistType(pCmd, iTargetResist); + if (flTargetDanger >= 1.f) + ActivateResistType(pCmd, iTargetResist); + + if (m_bPreventResistSwap) + pCmd->buttons &= ~IN_RELOAD; + if (m_bPreventResistCharge) + pCmd->buttons &= ~IN_ATTACK2; + if (pCmd->buttons & IN_RELOAD && !(G::LastUserCmd->buttons & IN_RELOAD)) + { + m_iResistType = (m_iResistType + 1) % 3; + m_flSwapTime = I::GlobalVars->curtime + F::Backtrack.GetReal(MAX_FLOWS, false) * 1.5f + 0.1f; + } + if (m_flSwapTime < I::GlobalVars->curtime) + m_iResistType = pWeapon->GetResistType(); + m_flChargeLevel = pWeapon->m_flChargeLevel(); } void CAutoHeal::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) { - bool bActivated = ActivateOnVoice(pLocal, pWeapon->As(), pCmd); - m_mMedicCallers.clear(); - if (bActivated) + if (pWeapon->GetWeaponID() != TF_WEAPON_MEDIGUN) + { + m_mMedicCallers.clear(); + m_iResistType = -1; return; -} \ No newline at end of file + } + + ActivateOnVoice(pLocal, pWeapon->As(), pCmd); + m_mMedicCallers.clear(); + + AutoVaccinator(pLocal, pWeapon->As(), pCmd); +} + +void CAutoHeal::Event(IGameEvent* pEvent, uint32_t uHash) +{ + switch (uHash) + { + case FNV1A::Hash32Const("player_hurt"): + { + if (!Vars::Aimbot::Healing::AutoVaccinator.Value) + return; + + auto pWeapon = H::Entities.GetWeapon()->As(); + if (!pWeapon + || pWeapon->GetWeaponID() != TF_WEAPON_MEDIGUN || pWeapon->GetMedigunType() != MEDIGUN_RESIST) + return; + + int iVictim = I::EngineClient->GetPlayerForUserID(pEvent->GetInt("userid")); + int iAttacker = I::EngineClient->GetPlayerForUserID(pEvent->GetInt("attacker")); + int iDamage = pEvent->GetInt("damageamount"); + int iWeaponID = pEvent->GetInt("weaponid"); + bool bCrit = pEvent->GetBool("crit"); + bool bMinicrit = pEvent->GetBool("minicrit"); + + int iTarget = pWeapon->m_hHealingTarget().GetIndex(); + if (iVictim == iAttacker || iVictim != I::EngineClient->GetLocalPlayer() && (iVictim != iTarget || Vars::Aimbot::Healing::FriendsOnly.Value && !H::Entities.IsFriend(iTarget) && !H::Entities.InParty(iTarget))) + return; + + auto pEntity = I::ClientEntityList->GetClientEntity(iAttacker)->As(); + if (!pEntity || !pEntity->IsPlayer()) + return; + + auto pWeapon2 = pEntity->m_hActiveWeapon().Get()->As(); + if (!pWeapon2 || pWeapon2->GetWeaponID() != iWeaponID || pWeapon2->GetFireRate() > 1.f) + return; + + float flFireRate = pWeapon2->GetFireRate(); + float flMult = SDK::AttribHookValue(1, "mult_dmg", pWeapon2); + switch (SDK::GetWeaponType(pWeapon2)) + { + case EWeaponType::HITSCAN: + m_iDamagedType = MEDIGUN_BULLET_RESIST; + m_flDamagedDPS = iDamage / flFireRate; + break; + case EWeaponType::PROJECTILE: + switch (iWeaponID) + { + case TF_WEAPON_FLAMETHROWER: + if (!bCrit && !bMinicrit || iDamage / flMult < (bCrit ? 48 : 22)) + { + m_iDamagedType = MEDIGUN_FIRE_RESIST; + float flBurnMult = SDK::AttribHookValue(1, "mult_wpn_burndmg", pWeapon2); + if (!bCrit && !bMinicrit && iDamage <= 4 * flBurnMult) + m_flDamagedDPS = 8.f * flBurnMult; + else + m_flDamagedDPS = 80.f * flMult * (bCrit ? 3.f : bMinicrit ? 1.36f : 1.f); + } + else // better way to assume reflect? + { + m_iDamagedType = MEDIGUN_BLAST_RESIST; + m_flDamagedDPS = iDamage; + } + break; + case TF_WEAPON_COMPOUND_BOW: + case TF_WEAPON_CROSSBOW: + case TF_WEAPON_SHOTGUN_BUILDING_RESCUE: + case TF_WEAPON_SYRINGEGUN_MEDIC: + case TF_WEAPON_RAYGUN: + m_iDamagedType = MEDIGUN_BULLET_RESIST; + m_flDamagedDPS = iDamage / flFireRate; + break; + case TF_WEAPON_FLAME_BALL: + m_iDamagedType = MEDIGUN_FIRE_RESIST; + m_flDamagedDPS = iDamage / flFireRate; + break; + default: + m_iDamagedType = MEDIGUN_BLAST_RESIST; + m_flDamagedDPS = iDamage / flFireRate; + } + break; + case EWeaponType::MELEE: + return; + } + m_flDamagedTime = 1.f; + + //SDK::Output("Hurt", std::format("{}, {}", m_iDamagedType, m_flDamagedDPS).c_str(), { 255, 100, 100 }); + break; + } + case FNV1A::Hash32Const("player_spawn"): + m_flDamagedTime = 0.f; + } +} + +/* +void CAutoHeal::Draw(CTFPlayer* pLocal) +{ + auto pWeapon = H::Entities.GetWeapon()->As(); + if (!pWeapon || pWeapon->GetWeaponID() != TF_WEAPON_MEDIGUN + || !Vars::Aimbot::Healing::AutoVaccinator.Value || pWeapon->GetMedigunType() != MEDIGUN_RESIST) + return; + + int x = H::Draw.m_nScreenW / 2, y = 100; + const auto& fFont = H::Fonts.GetFont(FONT_INDICATORS); + const int nTall = fFont.m_nTall + H::Draw.Scale(1); + y -= nTall; + + for (auto& [flDanger, iResist] : vResistDangers) + H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOP, std::format("{}: {:.3f}", iResist == MEDIGUN_BULLET_RESIST ? "Bullet" : iResist == MEDIGUN_BLAST_RESIST ? "Blast" : "Fire", flDanger).c_str()); +} +*/ \ No newline at end of file diff --git a/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.h b/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.h index 875889f1..c76069c1 100644 --- a/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.h +++ b/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.h @@ -3,12 +3,30 @@ class CAutoHeal { - bool ActivateOnVoice(CTFPlayer* pLocal, CWeaponMedigun* pWeapon, CUserCmd* pCmd); + void ActivateOnVoice(CTFPlayer* pLocal, CWeaponMedigun* pWeapon, CUserCmd* pCmd); + void AutoVaccinator(CTFPlayer* pLocal, CWeaponMedigun* pWeapon, CUserCmd* pCmd); + void GetDangers(CTFPlayer* pTarget, bool bVaccinator, float& flBulletDanger, float& flBlastDanger, float& flFireDanger); + void SwapResistType(CUserCmd* pCmd, int iType); + void ActivateResistType(CUserCmd* pCmd, int iType); + + int m_iResistType = -1; + float m_flChargeLevel = 0.f; + float m_flSwapTime = 0.f; + bool m_bPreventResistSwap = false; + bool m_bPreventResistCharge = false; + + int m_iDamagedType = -1; + float m_flDamagedDPS = -1; + float m_flDamagedTime = 0.f; + + //std::vector> vResistDangers = {}; public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); + void Event(IGameEvent* pEvent, uint32_t uHash); + //void Draw(CTFPlayer* pLocal); std::unordered_map m_mMedicCallers = {}; }; -ADD_FEATURE(CAutoHeal, AutoHeal) \ No newline at end of file +ADD_FEATURE(CAutoHeal, AutoHeal); \ 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 e112f760..e3568422 100644 --- a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp +++ b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp @@ -102,7 +102,7 @@ bool CAutoRocketJump::SetAngles(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) { - if (!pLocal || !pWeapon || !pCmd || !pLocal->IsAlive() || pLocal->IsAGhost() || I::EngineVGui->IsGameUIVisible()) + if (!pLocal || !pWeapon || !pLocal->IsAlive() || pLocal->IsAGhost() || I::EngineVGui->IsGameUIVisible()) { m_iFrame = -1; return; diff --git a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.h b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.h index e4e0d409..06ce8105 100644 --- a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.h +++ b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.h @@ -16,4 +16,4 @@ public: bool IsRunning() { return m_bRunning; } }; -ADD_FEATURE(CAutoRocketJump, AutoRocketJump) \ No newline at end of file +ADD_FEATURE(CAutoRocketJump, AutoRocketJump); \ No newline at end of file diff --git a/Amalgam/src/Features/Backtrack/Backtrack.cpp b/Amalgam/src/Features/Backtrack/Backtrack.cpp index cc7b4d2e..6c0e1adb 100644 --- a/Amalgam/src/Features/Backtrack/Backtrack.cpp +++ b/Amalgam/src/Features/Backtrack/Backtrack.cpp @@ -137,7 +137,7 @@ std::vector CBacktrack::GetValidRecords(std::vector& v float flCorrect = std::clamp(GetReal(MAX_FLOWS, false) + ROUND_TO_TICKS(GetFakeInterp()), 0.f, m_flMaxUnlag); int iServerTick = m_iTickCount + GetAnticipatedChoke() + Vars::Backtrack::Offset.Value + TIME_TO_TICKS(GetReal(FLOW_OUTGOING)); - if (!Vars::Misc::Game::AntiCheatCompatibility.Value) + if (!Vars::Misc::Game::AntiCheatCompatibility.Value && Vars::Backtrack::Window.Value) { for (auto pRecord : vRecords) { @@ -421,5 +421,5 @@ void CBacktrack::Draw(CTFPlayer* pLocal) H::Draw.StringOutlined(fFont, x, y, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, align, std::format("Ping {:.0f} (+ {:.0f}) ms", flLatency, flFake).c_str()); else H::Draw.StringOutlined(fFont, x, y, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, align, std::format("Ping {:.0f} ms", flLatency).c_str()); - H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, align, "Scoreboard %d ms", iLatencyScoreboard); + H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, align, std::format("Scoreboard {} ms", iLatencyScoreboard).c_str()); } \ No newline at end of file diff --git a/Amalgam/src/Features/Backtrack/Backtrack.h b/Amalgam/src/Features/Backtrack/Backtrack.h index 148c1159..04be3f6f 100644 --- a/Amalgam/src/Features/Backtrack/Backtrack.h +++ b/Amalgam/src/Features/Backtrack/Backtrack.h @@ -80,4 +80,4 @@ public: TickRecord m_tRecord = {}; // for temporary use }; -ADD_FEATURE(CBacktrack, Backtrack) \ No newline at end of file +ADD_FEATURE(CBacktrack, Backtrack); \ No newline at end of file diff --git a/Amalgam/src/Features/Binds/Binds.h b/Amalgam/src/Features/Binds/Binds.h index 93b71729..27ee572f 100644 --- a/Amalgam/src/Features/Binds/Binds.h +++ b/Amalgam/src/Features/Binds/Binds.h @@ -45,4 +45,4 @@ public: std::vector m_vBinds = {}; }; -ADD_FEATURE(CBinds, Binds) \ No newline at end of file +ADD_FEATURE(CBinds, Binds); \ No newline at end of file diff --git a/Amalgam/src/Features/CheaterDetection/CheaterDetection.h b/Amalgam/src/Features/CheaterDetection/CheaterDetection.h index f3902b3f..95093fcc 100644 --- a/Amalgam/src/Features/CheaterDetection/CheaterDetection.h +++ b/Amalgam/src/Features/CheaterDetection/CheaterDetection.h @@ -52,4 +52,4 @@ public: void Reset(); }; -ADD_FEATURE(CCheaterDetection, CheaterDetection) \ No newline at end of file +ADD_FEATURE(CCheaterDetection, CheaterDetection); \ No newline at end of file diff --git a/Amalgam/src/Features/Commands/Commands.h b/Amalgam/src/Features/Commands/Commands.h index 288a98d7..3f6ddd80 100644 --- a/Amalgam/src/Features/Commands/Commands.h +++ b/Amalgam/src/Features/Commands/Commands.h @@ -15,4 +15,4 @@ public: void Register(const std::string& sName, CommandCallback fCallback); }; -ADD_FEATURE(CCommands, Commands) \ No newline at end of file +ADD_FEATURE(CCommands, Commands); \ No newline at end of file diff --git a/Amalgam/src/Features/CritHack/CritHack.cpp b/Amalgam/src/Features/CritHack/CritHack.cpp index 9ac36108..33746546 100644 --- a/Amalgam/src/Features/CritHack/CritHack.cpp +++ b/Amalgam/src/Features/CritHack/CritHack.cpp @@ -349,6 +349,22 @@ void CCritHack::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) } else if (pWeapon->GetWeaponID() == TF_WEAPON_MINIGUN && !(G::LastUserCmd->buttons & IN_ATTACK)) bAttacking = false; + else if (!bAttacking) + { + switch (pWeapon->GetWeaponID()) + { + case TF_WEAPON_ROCKETLAUNCHER: + case TF_WEAPON_ROCKETLAUNCHER_DIRECTHIT: + if (pWeapon->IsInReload() && G::CanPrimaryAttack && SDK::AttribHookValue(0, "can_overload", pWeapon)) + { + int iClip1 = pWeapon->m_iClip1(); + if (pWeapon->m_bRemoveable() && iClip1 > 0) + bAttacking = true; + else if (iClip1 >= pWeapon->GetMaxClip1() || iClip1 > 0 && pLocal->GetAmmoCount(pWeapon->m_iPrimaryAmmoType()) == 0) + bAttacking = true; + } + } + } bool bRapidFire = pWeapon->IsRapidFire(); bool bStreamWait = bRapidFire && TICKS_TO_TIME(pLocal->m_nTickBase()) < pWeapon->m_flLastRapidFireCritCheckTime() + 1.f; @@ -419,9 +435,9 @@ int CCritHack::PredictCmdNum(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd return pCmd->command_number; } -bool CCritHack::CalcIsAttackCriticalHandler(CTFPlayer* pLocal, CTFWeaponBase* pWeapon) +bool CCritHack::CalcIsAttackCriticalHandler() { - if (!I::Prediction->m_bFirstTimePredicted || !pLocal || !pWeapon) + if (!I::Prediction->m_bFirstTimePredicted) return false; if (m_iWishRandomSeed) @@ -449,11 +465,6 @@ void CCritHack::Event(IGameEvent* pEvent, uint32_t uHash, CTFPlayer* pLocal) int iHealth = pEvent->GetInt("health"); int iWeaponID = pEvent->GetInt("weaponid"); - int iCustom = pEvent->GetInt("custom"); - bool bShowDisguisedCrit = pEvent->GetBool("showdisguisedcrit"); - bool bAllSeeCrit = pEvent->GetBool("allseecrit"); - byte iBonusEffect = pEvent->GetInt("bonuseffect"); - if (m_mHealthHistory.contains(iVictim)) { auto& tHistory = m_mHealthHistory[iVictim]; @@ -479,7 +490,7 @@ void CCritHack::Event(IGameEvent* pEvent, uint32_t uHash, CTFPlayer* pLocal) if (iHealth) StoreHealthHistory(iVictim, iHealth); - if (iVictim == iAttacker || iAttacker != pLocal->entindex()) + if (iVictim == iAttacker || iAttacker != I::EngineClient->GetLocalPlayer()) break; if (auto pGameRules = I::TFGameRules()) diff --git a/Amalgam/src/Features/CritHack/CritHack.h b/Amalgam/src/Features/CritHack/CritHack.h index 35e9dd9e..1830dcb4 100644 --- a/Amalgam/src/Features/CritHack/CritHack.h +++ b/Amalgam/src/Features/CritHack/CritHack.h @@ -45,7 +45,6 @@ private: void GetTotalCrits(CTFPlayer* pLocal, CTFWeaponBase* pWeapon); void CanFireCritical(CTFPlayer* pLocal, CTFWeaponBase* pWeapon); - bool WeaponCanCrit(CTFWeaponBase* pWeapon, bool bWeaponOnly = false); void ResetWeapons(CTFPlayer* pLocal); void Reset(); @@ -69,13 +68,15 @@ private: public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); - bool CalcIsAttackCriticalHandler(CTFPlayer* pLocal, CTFWeaponBase* pWeapon); + bool CalcIsAttackCriticalHandler(); void Event(IGameEvent* pEvent, uint32_t uHash, CTFPlayer* pLocal); void Store(); void Draw(CTFPlayer* pLocal); + + bool WeaponCanCrit(CTFWeaponBase* pWeapon, bool bWeaponOnly = false); int PredictCmdNum(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); std::unordered_map m_mStorage = {}; }; -ADD_FEATURE(CCritHack, CritHack) \ No newline at end of file +ADD_FEATURE(CCritHack, CritHack); \ No newline at end of file diff --git a/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp b/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp index 93d0a7d7..34883077 100644 --- a/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp +++ b/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp @@ -38,7 +38,7 @@ void CEnginePrediction::Simulate(CTFPlayer* pLocal, CUserCmd* pCmd) const bool bOldInPrediction = I::Prediction->m_bInPrediction; I::MoveHelper->SetHost(pLocal); - pLocal->SetCurrentCmd(pCmd); + pLocal->m_pCurrentCommand() = pCmd; *G::RandomSeed() = MD5_PseudoRandom(pCmd->command_number) & std::numeric_limits::max(); I::Prediction->m_bFirstTimePredicted = false; @@ -72,7 +72,7 @@ void CEnginePrediction::Simulate(CTFPlayer* pLocal, CUserCmd* pCmd) } I::MoveHelper->SetHost(nullptr); - pLocal->SetCurrentCmd(nullptr); + pLocal->m_pCurrentCommand() = nullptr; *G::RandomSeed() = -1; pLocal->m_nTickBase() = nOldTickBase; diff --git a/Amalgam/src/Features/EnginePrediction/EnginePrediction.h b/Amalgam/src/Features/EnginePrediction/EnginePrediction.h index 60e04a1c..60d020fe 100644 --- a/Amalgam/src/Features/EnginePrediction/EnginePrediction.h +++ b/Amalgam/src/Features/EnginePrediction/EnginePrediction.h @@ -41,4 +41,4 @@ public: Vec3 m_vAngles = {}; }; -ADD_FEATURE(CEnginePrediction, EnginePrediction) \ No newline at end of file +ADD_FEATURE(CEnginePrediction, EnginePrediction); \ No newline at end of file diff --git a/Amalgam/src/Features/ImGui/Menu/Components.h b/Amalgam/src/Features/ImGui/Menu/Components.h index 1eebc6ee..7eb2e3e7 100644 --- a/Amalgam/src/Features/ImGui/Menu/Components.h +++ b/Amalgam/src/Features/ImGui/Menu/Components.h @@ -525,13 +525,13 @@ namespace ImGui PopStyleVar(); } - inline bool FInputText(const char* sLabel, std::string& sText, int iFlags = ImGuiInputTextFlags_None, float flWidth = H::Draw.Scale(150)) + inline bool FInputText(const char* sLabel, std::string& sText, float flWidth = H::Draw.Scale(150), int iFlags = ImGuiInputTextFlags_None, ImGuiInputTextCallback fCallback = nullptr) { PushStyleVar(ImGuiStyleVar_FramePadding, { H::Draw.Scale(8), H::Draw.Scale(8) }); PushItemWidth(flWidth); ImVec2 vDrawPos = GetCursorPos() + GetDrawPos(); - bool bReturn = InputText(std::format("##{}", sLabel).c_str(), &sText, iFlags | ImGuiInputTextFlags_NoKeyboardNavigate); + bool bReturn = InputText(std::format("##{}", sLabel).c_str(), &sText, iFlags | ImGuiInputTextFlags_NoKeyboardNavigate, fCallback); ImVec2 vSize = GetItemRectSize(); float flInset = H::Draw.Scale(0.5f) - 0.5f; GetWindowDrawList()->AddRect({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x - flInset + vSize.x, vDrawPos.y - flInset + vSize.y }, F::Render.Background2, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale()); diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.cpp b/Amalgam/src/Features/ImGui/Menu/Menu.cpp index 9fc3d960..76b3eeb1 100644 --- a/Amalgam/src/Features/ImGui/Menu/Menu.cpp +++ b/Amalgam/src/Features/ImGui/Menu/Menu.cpp @@ -91,7 +91,7 @@ void CMenu::DrawMenu() static std::string sSearch = ""; SetCursorPos({ H::Draw.Scale(8), vWindowSize.y - H::Draw.Scale(37) }); - FInputText("Search...", sSearch, ImGuiInputTextFlags_None, H::Draw.Scale(123)); + FInputText("Search...", sSearch, H::Draw.Scale(123), ImGuiInputTextFlags_None); bool bSearch = /*IsItemFocused() ||*/ !sSearch.empty(); if (!bSearch || FCalcTextSize(sSearch.c_str()).x < 86.f) { @@ -200,8 +200,18 @@ void CMenu::MenuAimbot(int iTab) { FToggle(Vars::Aimbot::Healing::AutoHeal, FToggleEnum::Left); FToggle(Vars::Aimbot::Healing::FriendsOnly, FToggleEnum::Right); - FToggle(Vars::Aimbot::Healing::ActivateOnVoice); + FToggle(Vars::Aimbot::Healing::AutoVaccinator, FToggleEnum::Left); + FToggle(Vars::Aimbot::Healing::ActivateOnVoice, FToggleEnum::Right); } EndSection(); + if (Vars::Debug::Options.Value) + { + if (Section("##Debug Healing")) + { + FSlider(Vars::Aimbot::Healing::AutoVaccinatorBulletScale); + FSlider(Vars::Aimbot::Healing::AutoVaccinatorBlastScale); + FSlider(Vars::Aimbot::Healing::AutoVaccinatorFireScale); + } EndSection(); + } } /* Column 2 */ TableNextColumn(); @@ -213,7 +223,8 @@ void CMenu::MenuAimbot(int iTab) FSlider(Vars::Aimbot::Hitscan::PointScale); PushTransparent(!(FGet(Vars::Aimbot::Hitscan::Modifiers) & Vars::Aimbot::Hitscan::ModifiersEnum::Tapfire)); { - FSlider(Vars::Aimbot::Hitscan::TapFireDist); + //FSlider(Vars::Aimbot::Hitscan::TapFireDist); + FSlider("Tapfire distance", &Vars::Aimbot::Hitscan::TapFireDist[DEFAULT_BIND], 0.f, 1000.f); } PopTransparent(); } EndSection(); @@ -555,7 +566,6 @@ void CMenu::MenuAimbot(int iTab) FSlider(Vars::Visuals::Trajectory::Hull); FSlider(Vars::Visuals::Trajectory::Speed); FSlider(Vars::Visuals::Trajectory::Gravity); - FToggle(Vars::Visuals::Trajectory::NoSpin); FSlider(Vars::Visuals::Trajectory::LifeTime); FSlider(Vars::Visuals::Trajectory::UpVelocity); FSlider(Vars::Visuals::Trajectory::AngularVelocityX); @@ -1432,7 +1442,8 @@ void CMenu::MenuMisc(int iTab) FToggle(Vars::Misc::Exploits::CheatsBypass, FToggleEnum::Left); FToggle(Vars::Misc::Exploits::PureBypass, FToggleEnum::Right); FToggle(Vars::Misc::Exploits::EquipRegionUnlock, FToggleEnum::Left); - FToggle(Vars::Misc::Exploits::PingReducer, FToggleEnum::Right); + FToggle(Vars::Misc::Exploits::BackpackExpander, FToggleEnum::Right); + FToggle(Vars::Misc::Exploits::PingReducer); PushTransparent(!FGet(Vars::Misc::Exploits::PingReducer)); { FSlider(Vars::Misc::Exploits::PingTarget); @@ -1446,8 +1457,7 @@ void CMenu::MenuMisc(int iTab) FToggle(Vars::Misc::Automation::AntiAutobalance, FToggleEnum::Right); FToggle(Vars::Misc::Automation::TauntControl, FToggleEnum::Left); FToggle(Vars::Misc::Automation::KartControl, FToggleEnum::Right); - FToggle(Vars::Misc::Automation::BackpackExpander, FToggleEnum::Left); - FToggle(Vars::Misc::Automation::AcceptItemDrops, FToggleEnum::Right); + FToggle(Vars::Misc::Automation::AcceptItemDrops); FToggle(Vars::Misc::Automation::AutoF2Ignored, FToggleEnum::Left); FToggle(Vars::Misc::Automation::AutoF1Priority, FToggleEnum::Right); } EndSection(); @@ -1520,18 +1530,38 @@ void CMenu::MenuLogs(int iTab) std::lock_guard lock(F::PlayerUtils.m_mutex); const auto& vPlayers = F::PlayerUtils.m_vPlayerCache; - auto getTeamColor = [&](int team, bool alive) + std::unordered_map> mParties = {}; + std::unordered_map mHues = {}; // don't just shift based on party id in the case that it will be similar + for (auto& tPlayer : vPlayers) + { + if (tPlayer.m_iParty) + mParties[tPlayer.m_iParty].push_back(&tPlayer); + } + for (auto it = mParties.begin(); it != mParties.end();) + { + if (it->second.size() > 1) + it++; + else + it = mParties.erase(it); + } + { + float flParties = mParties.size() + 1 - mParties.contains(1); + int i = 0; for (auto& [iParty, _] : mParties) + mHues[iParty] = iParty != 1 ? 360 * ++i / flParties : 0; + } + + auto getTeamColor = [&](int iTeam, bool bAlive) { - switch (team) + switch (iTeam) { - case 3: return Color_t(100, 150, 200, alive ? 255 : 127).Lerp(Vars::Menu::Theme::Background.Value, 0.5f, LerpEnum::NoAlpha); - case 2: return Color_t(255, 100, 100, alive ? 255 : 127).Lerp(Vars::Menu::Theme::Background.Value, 0.5f, LerpEnum::NoAlpha); + case 3: return Color_t(100, 150, 200, bAlive ? 255 : 127).Lerp(Vars::Menu::Theme::Background.Value, 0.5f, LerpEnum::NoAlpha); + case 2: return Color_t(255, 100, 100, bAlive ? 255 : 127).Lerp(Vars::Menu::Theme::Background.Value, 0.5f, LerpEnum::NoAlpha); } return Color_t(127, 127, 127, 255).Lerp(Vars::Menu::Theme::Background.Value, 0.5f, LerpEnum::NoAlpha); }; - auto drawPlayer = [&](const ListPlayer& player, int x, int y) + auto drawPlayer = [&](const ListPlayer& tPlayer, int x, int y) { - ImColor tColor = ColorToVec(getTeamColor(player.m_iTeam, player.m_bAlive)); + ImColor tColor = ColorToVec(getTeamColor(tPlayer.m_iTeam, tPlayer.m_bAlive)); ImVec2 vOriginalPos = { !x ? GetStyle().WindowPadding.x : GetWindowWidth() / 2 + GetStyle().WindowPadding.x / 2, H::Draw.Scale(35 + 36 * y) }; @@ -1543,62 +1573,51 @@ void CMenu::MenuLogs(int iTab) // text + icons int lOffset = H::Draw.Scale(10); - if (player.m_bLocal) + if (tPlayer.m_bLocal) { lOffset = H::Draw.Scale(29); SetCursorPos({ vOriginalPos.x + H::Draw.Scale(7), vOriginalPos.y + H::Draw.Scale(6) }); IconImage(ICON_MD_PERSON); } - else if (F::Spectate.m_iIntendedTarget == player.m_iUserID) + else if (F::Spectate.m_iIntendedTarget == tPlayer.m_iUserID) { lOffset = H::Draw.Scale(29); SetCursorPos({ vOriginalPos.x + H::Draw.Scale(7), vOriginalPos.y + H::Draw.Scale(6) }); IconImage(ICON_MD_VISIBILITY); } - else if (player.m_bFriend) + else if (tPlayer.m_bFriend) { lOffset = H::Draw.Scale(29); SetCursorPos({ vOriginalPos.x + H::Draw.Scale(7), vOriginalPos.y + H::Draw.Scale(6) }); IconImage(ICON_MD_GROUP); } - else if (player.m_bParty) + else if (tPlayer.m_bParty) { lOffset = H::Draw.Scale(29); SetCursorPos({ vOriginalPos.x + H::Draw.Scale(7), vOriginalPos.y + H::Draw.Scale(6) }); IconImage(ICON_MD_GROUPS); } SetCursorPos({ vOriginalPos.x + lOffset, vOriginalPos.y + H::Draw.Scale(7) }); - auto sName = TruncateText(player.m_sName, flWidth / 2 - lOffset); + auto sName = TruncateText(tPlayer.m_sName, flWidth / 2 - lOffset); FText(sName.c_str()); lOffset += FCalcTextSize(sName.c_str()).x + H::Draw.Scale(8); // buttons bool bClicked = false; - std::vector vParty = {}; - if (player.m_iParty) - { - for (auto& player2 : vPlayers) - { - //if (player.m_uFriendsID == player2.m_uFriendsID) - // continue; - if (player.m_iParty == player2.m_iParty) - vParty.push_back(&player2); - } - } - if (!player.m_bFake) + if (!tPlayer.m_bFake) { // tag bar SetCursorPos({ vOriginalPos.x + lOffset, vOriginalPos.y }); - if (BeginChild(std::format("TagBar{}", player.m_uFriendsID).c_str(), { flWidth - lOffset - H::Draw.Scale(4), flHeight }, ImGuiWindowFlags_None, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoBackground)) + if (BeginChild(std::format("TagBar{}", tPlayer.m_uFriendsID).c_str(), { flWidth - lOffset - H::Draw.Scale(4), flHeight }, ImGuiWindowFlags_None, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoBackground)) { std::vector vLabels = {}; std::vector> vTags = {}; - if (vParty.size() > 1) - vLabels.emplace_back("Party", F::PlayerUtils.m_vTags[F::PlayerUtils.TagToIndex(PARTY_TAG)].m_tColor.HueShift((player.m_iParty - 1) % 360)); - if (player.m_bF2P) + if (mHues.contains(tPlayer.m_iParty)) + vLabels.emplace_back("Party", F::PlayerUtils.m_vTags[F::PlayerUtils.TagToIndex(PARTY_TAG)].m_tColor.HueShift(mHues[tPlayer.m_iParty])); + if (tPlayer.m_bF2P) vTags.emplace_back(&F::PlayerUtils.m_vTags[F::PlayerUtils.TagToIndex(F2P_TAG)], 0); - for (auto& iID : F::PlayerUtils.m_mPlayerTags[player.m_uFriendsID]) + for (auto& iID : F::PlayerUtils.m_mPlayerTags[tPlayer.m_uFriendsID]) { auto pTag = F::PlayerUtils.GetTag(iID); if (pTag) @@ -1622,7 +1641,7 @@ void CMenu::MenuLogs(int iTab) { SetCursorPos({ vTagPos.x + flTagWidth - H::Draw.Scale(22), vTagPos.y - H::Draw.Scale(2) }); if (IconButton(ICON_MD_CANCEL)) - F::PlayerUtils.RemoveTag(player.m_uFriendsID, iID, true, player.m_sName); + F::PlayerUtils.RemoveTag(tPlayer.m_uFriendsID, iID, true, tPlayer.m_sName); } flTagOffset += flTagWidth + H::Draw.Scale(4); @@ -1638,46 +1657,46 @@ void CMenu::MenuLogs(int iTab) bClicked = IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right); } SetCursorPos(vOriginalPos); - Button(std::format("##{}", player.m_uFriendsID).c_str(), { flWidth, flHeight }); + Button(std::format("##{}", tPlayer.m_uFriendsID).c_str(), { flWidth, flHeight }); bClicked = bClicked || IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right); // popups if (bClicked) - OpenPopup(std::format("Clicked{}", player.m_uFriendsID).c_str()); - if (FBeginPopup(std::format("Clicked{}", player.m_uFriendsID).c_str())) + OpenPopup(std::format("Clicked{}", tPlayer.m_uFriendsID).c_str()); + if (FBeginPopup(std::format("Clicked{}", tPlayer.m_uFriendsID).c_str())) { PushStyleVar(ImGuiStyleVar_ItemSpacing, { H::Draw.Scale(8), H::Draw.Scale(8) }); - if (!player.m_bFake) + if (!tPlayer.m_bFake) { if (FSelectable("Profile")) - I::SteamFriends->ActivateGameOverlayToUser("steamid", CSteamID(player.m_uFriendsID, k_EUniversePublic, k_EAccountTypeIndividual)); + I::SteamFriends->ActivateGameOverlayToUser("steamid", CSteamID(tPlayer.m_uFriendsID, k_EUniversePublic, k_EAccountTypeIndividual)); if (FSelectable("History")) - I::SteamFriends->ActivateGameOverlayToWebPage(std::format("https://steamhistory.net/id/{}", CSteamID(player.m_uFriendsID, k_EUniversePublic, k_EAccountTypeIndividual).ConvertToUint64()).c_str()); + I::SteamFriends->ActivateGameOverlayToWebPage(std::format("https://steamhistory.net/id/{}", CSteamID(tPlayer.m_uFriendsID, k_EUniversePublic, k_EAccountTypeIndividual).ConvertToUint64()).c_str()); } - if (FSelectable(F::Spectate.m_iIntendedTarget == player.m_iUserID ? "Unspectate" : "Spectate")) - F::Spectate.SetTarget(player.m_iUserID); + if (FSelectable(F::Spectate.m_iIntendedTarget == tPlayer.m_iUserID ? "Unspectate" : "Spectate")) + F::Spectate.SetTarget(tPlayer.m_iUserID); if (!I::EngineClient->IsPlayingDemo() && FBeginMenu("Votekick")) { if (FSelectable("No reason")) - I::ClientState->SendStringCmd(std::format("callvote Kick \"{} other\"", player.m_iUserID).c_str()); + I::ClientState->SendStringCmd(std::format("callvote Kick \"{} other\"", tPlayer.m_iUserID).c_str()); if (FSelectable("Cheating")) - I::ClientState->SendStringCmd(std::format("callvote Kick \"{} cheating\"", player.m_iUserID).c_str()); + I::ClientState->SendStringCmd(std::format("callvote Kick \"{} cheating\"", tPlayer.m_iUserID).c_str()); if (FSelectable("Idle")) - I::ClientState->SendStringCmd(std::format("callvote Kick \"{} idle\"", player.m_iUserID).c_str()); + I::ClientState->SendStringCmd(std::format("callvote Kick \"{} idle\"", tPlayer.m_iUserID).c_str()); if (FSelectable("Scamming")) - I::ClientState->SendStringCmd(std::format("callvote Kick \"{} scamming\"", player.m_iUserID).c_str()); + I::ClientState->SendStringCmd(std::format("callvote Kick \"{} scamming\"", tPlayer.m_iUserID).c_str()); ImGui::EndMenu(); } - if (!player.m_bFake) + if (!tPlayer.m_bFake) { if (FBeginMenu("Add tag")) { @@ -1685,14 +1704,14 @@ void CMenu::MenuLogs(int iTab) { int iID = std::distance(F::PlayerUtils.m_vTags.begin(), it); auto& tTag = *it; - if (!tTag.m_bAssignable || F::PlayerUtils.HasTag(player.m_uFriendsID, iID)) + if (!tTag.m_bAssignable || F::PlayerUtils.HasTag(tPlayer.m_uFriendsID, iID)) continue; auto imColor = ColorToVec(tTag.m_tColor); PushStyleColor(ImGuiCol_Text, imColor); imColor.x /= 3; imColor.y /= 3; imColor.z /= 3; if (FSelectable(tTag.m_sName.c_str(), imColor)) - F::PlayerUtils.AddTag(player.m_uFriendsID, iID, true, player.m_sName); + F::PlayerUtils.AddTag(tPlayer.m_uFriendsID, iID, true, tPlayer.m_sName); PopStyleColor(); } @@ -1701,34 +1720,34 @@ void CMenu::MenuLogs(int iTab) if (FBeginMenu("Alias")) { - bool bHasAlias = F::PlayerUtils.m_mPlayerAliases.contains(player.m_uFriendsID); + bool bHasAlias = F::PlayerUtils.m_mPlayerAliases.contains(tPlayer.m_uFriendsID); static std::string sInput = ""; PushStyleVar(ImGuiStyleVar_FramePadding, { H::Draw.Scale(8), H::Draw.Scale(8) }); PushItemWidth(H::Draw.Scale(150)); - bool bEnter = FInputText("Alias...", sInput, ImGuiInputTextFlags_EnterReturnsTrue); + bool bEnter = FInputText("Alias...", sInput, H::Draw.Scale(150), ImGuiInputTextFlags_EnterReturnsTrue); if (!IsItemFocused()) - sInput = bHasAlias ? F::PlayerUtils.m_mPlayerAliases[player.m_uFriendsID] : ""; + sInput = bHasAlias ? F::PlayerUtils.m_mPlayerAliases[tPlayer.m_uFriendsID] : ""; PopItemWidth(); PopStyleVar(); if (bEnter) { - if (sInput.empty() && F::PlayerUtils.m_mPlayerAliases.contains(player.m_uFriendsID)) + if (sInput.empty() && bHasAlias) { - F::Output.AliasChanged(player.m_sName, "Removed", F::PlayerUtils.m_mPlayerAliases[player.m_uFriendsID]); + F::Output.AliasChanged(tPlayer.m_sName, "Removed", F::PlayerUtils.m_mPlayerAliases[tPlayer.m_uFriendsID]); - auto it = F::PlayerUtils.m_mPlayerAliases.find(player.m_uFriendsID); + auto it = F::PlayerUtils.m_mPlayerAliases.find(tPlayer.m_uFriendsID); if (it != F::PlayerUtils.m_mPlayerAliases.end()) F::PlayerUtils.m_mPlayerAliases.erase(it); F::PlayerUtils.m_bSave = true; } - else + else if (!sInput.empty()) { - F::PlayerUtils.m_mPlayerAliases[player.m_uFriendsID] = sInput; + F::PlayerUtils.m_mPlayerAliases[tPlayer.m_uFriendsID] = sInput; F::PlayerUtils.m_bSave = true; - F::Output.AliasChanged(player.m_sName, bHasAlias ? "Changed" : "Added", sInput); + F::Output.AliasChanged(tPlayer.m_sName, bHasAlias ? "Changed" : "Added", sInput); } } @@ -1736,7 +1755,7 @@ void CMenu::MenuLogs(int iTab) } } - if (Vars::Resolver::Enabled.Value && !player.m_bLocal) + if (Vars::Resolver::Enabled.Value && !tPlayer.m_bLocal) { if (FBeginMenu("Set yaw")) { @@ -1754,10 +1773,10 @@ void CMenu::MenuLogs(int iTab) switch (FNV1A::Hash32(sYaw.c_str())) { case FNV1A::Hash32Const("Auto"): - F::Resolver.SetYaw(player.m_iUserID, 0.f, true); + F::Resolver.SetYaw(tPlayer.m_iUserID, 0.f, true); break; default: - F::Resolver.SetYaw(player.m_iUserID, flValue); + F::Resolver.SetYaw(tPlayer.m_iUserID, flValue); } } } @@ -1781,13 +1800,13 @@ void CMenu::MenuLogs(int iTab) switch (FNV1A::Hash32(sPitch.c_str())) { case FNV1A::Hash32Const("Auto"): - F::Resolver.SetPitch(player.m_iUserID, 0.f, false, true); + F::Resolver.SetPitch(tPlayer.m_iUserID, 0.f, false, true); break; case FNV1A::Hash32Const("Inverse"): - F::Resolver.SetPitch(player.m_iUserID, 0.f, true); + F::Resolver.SetPitch(tPlayer.m_iUserID, 0.f, true); break; default: - F::Resolver.SetPitch(player.m_iUserID, flValue); + F::Resolver.SetPitch(tPlayer.m_iUserID, flValue); } } } @@ -1804,7 +1823,7 @@ void CMenu::MenuLogs(int iTab) for (auto& [sPitch, bValue] : vPitches) { if (FSelectable(sPitch.c_str())) - F::Resolver.SetView(player.m_iUserID, bValue); + F::Resolver.SetView(tPlayer.m_iUserID, bValue); } ImGui::EndMenu(); @@ -1819,31 +1838,31 @@ void CMenu::MenuLogs(int iTab) for (auto& [sPitch, bValue] : vPitches) { if (FSelectable(sPitch.c_str())) - F::Resolver.SetMinwalk(player.m_iUserID, bValue); + F::Resolver.SetMinwalk(tPlayer.m_iUserID, bValue); } ImGui::EndMenu(); } } - if (vParty.size() > 1) + if (mParties.contains(tPlayer.m_iParty)) { Divider(H::Draw.Scale(), H::Draw.Scale(1), 0); TextColored(F::Render.Inactive.Value, "Partied:"); - for (auto& pPlayer : vParty) - TextColored(F::Render.Inactive.Value, pPlayer->m_sName.c_str()); + for (auto& pPlayer2 : mParties[tPlayer.m_iParty]) + TextColored(F::Render.Inactive.Value, pPlayer2->m_sName.c_str()); } - if (player.m_iLevel != -2) + if (tPlayer.m_iLevel != -2) { Divider(H::Draw.Scale(), H::Draw.Scale(1), 0); std::string sLevel = "T? L?"; - if (player.m_iLevel != -1) + if (tPlayer.m_iLevel != -1) { - int iTier = std::max(std::ceil(player.m_iLevel / 150.f), 1.f); - int iLevel = ((player.m_iLevel - 1) % 150) + 1; + int iTier = std::max(std::ceil(tPlayer.m_iLevel / 150.f), 1.f); + int iLevel = ((tPlayer.m_iLevel - 1) % 150) + 1; sLevel = std::format("T{} L{}", iTier, iLevel); } TextColored(F::Render.Inactive.Value, sLevel.c_str()); @@ -1856,13 +1875,13 @@ void CMenu::MenuLogs(int iTab) // display players std::vector vBlu, vRed, vOther; - for (auto& player : vPlayers) + for (auto& tPlayer : vPlayers) { - switch (player.m_iTeam) + switch (tPlayer.m_iTeam) { - case 3: vBlu.push_back(player); break; - case 2: vRed.push_back(player); break; - default: vOther.push_back(player); break; + case 3: vBlu.push_back(tPlayer); break; + case 2: vRed.push_back(tPlayer); break; + default: vOther.push_back(tPlayer); break; } } @@ -3376,6 +3395,8 @@ void CMenu::MenuSettings(int iTab) G::LineStorage.clear(); G::PathStorage.clear(); G::BoxStorage.clear(); + G::SphereStorage.clear(); + G::SweptStorage.clear(); } } EndSection(); } @@ -3405,8 +3426,7 @@ void CMenu::MenuSettings(int iTab) #ifdef DEBUG_HOOKS if (Section("Hooks", 8)) { - int i = 0; - for (auto& pVar : G::Vars) + int i = 0; for (auto& pVar : G::Vars) { if (pVar->m_sName.find("Vars::Hooks::") == std::string::npos) continue; diff --git a/Amalgam/src/Features/Misc/Misc.cpp b/Amalgam/src/Features/Misc/Misc.cpp index cfef1e9e..64a7e356 100644 --- a/Amalgam/src/Features/Misc/Misc.cpp +++ b/Amalgam/src/Features/Misc/Misc.cpp @@ -46,6 +46,9 @@ void CMisc::AutoJump(CTFPlayer* pLocal, CUserCmd* pCmd) if (!Vars::Misc::Movement::Bunnyhop.Value) return; + if (auto pWeapon = H::Entities.GetWeapon(); pWeapon && pWeapon->GetWeaponID() == TF_WEAPON_GRAPPLINGHOOK && pWeapon->As()->m_hProjectile()) + return; + static bool bStaticJump = false, bStaticGrounded = false, bLastAttempted = false; const bool bLastJump = bStaticJump, bLastGrounded = bStaticGrounded; const bool bCurJump = bStaticJump = pCmd->buttons & IN_JUMP, bCurGrounded = bStaticGrounded = pLocal->m_hGroundEntity(); @@ -412,14 +415,6 @@ void CMisc::Event(IGameEvent* pEvent, uint32_t uHash) { switch (uHash) { - case FNV1A::Hash32Const("client_disconnect"): - case FNV1A::Hash32Const("client_beginconnect"): - case FNV1A::Hash32Const("game_newmap"): - case FNV1A::Hash32Const("teamplay_round_start"): - G::LineStorage.clear(); - G::BoxStorage.clear(); - G::PathStorage.clear(); - break; case FNV1A::Hash32Const("player_spawn"): m_bPeekPlaced = false; } @@ -558,7 +553,7 @@ void CMisc::PingReducer() void CMisc::UnlockAchievements() { - const auto pAchievementMgr = reinterpret_cast(U::Memory.GetVFunc(I::EngineClient, 114))(); + const auto pAchievementMgr = reinterpret_cast(U::Memory.GetVirtual(I::EngineClient, 114))(); if (pAchievementMgr) { I::SteamUserStats->RequestCurrentStats(); @@ -571,7 +566,7 @@ void CMisc::UnlockAchievements() void CMisc::LockAchievements() { - const auto pAchievementMgr = reinterpret_cast(U::Memory.GetVFunc(I::EngineClient, 114))(); + const auto pAchievementMgr = reinterpret_cast(U::Memory.GetVirtual(I::EngineClient, 114))(); if (pAchievementMgr) { I::SteamUserStats->RequestCurrentStats(); diff --git a/Amalgam/src/Features/Misc/Misc.h b/Amalgam/src/Features/Misc/Misc.h index 5fa4ef34..dc75c50f 100644 --- a/Amalgam/src/Features/Misc/Misc.h +++ b/Amalgam/src/Features/Misc/Misc.h @@ -40,4 +40,4 @@ public: int m_iWishUpdaterate = -1; }; -ADD_FEATURE(CMisc, Misc) +ADD_FEATURE(CMisc, Misc); \ No newline at end of file diff --git a/Amalgam/src/Features/NoSpread/NoSpread.cpp b/Amalgam/src/Features/NoSpread/NoSpread.cpp index d1a3932a..8074c35d 100644 --- a/Amalgam/src/Features/NoSpread/NoSpread.cpp +++ b/Amalgam/src/Features/NoSpread/NoSpread.cpp @@ -5,22 +5,10 @@ bool CNoSpread::ShouldRun(CTFPlayer* pLocal, CTFWeaponBase* pWeapon) { - if (!Vars::Aimbot::General::NoSpread.Value) + if (!Vars::Aimbot::General::NoSpread.Value + || !pLocal || !pWeapon || !pLocal->CanAttack()) return false; - if (!pLocal || !pWeapon - || !pLocal->IsAlive() - || pLocal->IsAGhost() - || pLocal->IsTaunting() - || pLocal->InCond(TF_COND_STUNNED) && pLocal->m_iStunFlags() & (TF_STUN_CONTROLS | TF_STUN_LOSER_STATE) - || pLocal->m_bFeignDeathReady() - || pLocal->InCond(TF_COND_PHASE) - || pLocal->InCond(TF_COND_STEALTHED) - || pLocal->InCond(TF_COND_HALLOWEEN_KART)) - { - return false; - } - return true; } diff --git a/Amalgam/src/Features/NoSpread/NoSpread.h b/Amalgam/src/Features/NoSpread/NoSpread.h index b0af79e1..15613b16 100644 --- a/Amalgam/src/Features/NoSpread/NoSpread.h +++ b/Amalgam/src/Features/NoSpread/NoSpread.h @@ -10,4 +10,4 @@ public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); }; -ADD_FEATURE(CNoSpread, NoSpread) \ No newline at end of file +ADD_FEATURE(CNoSpread, NoSpread); \ No newline at end of file diff --git a/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp b/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp index b3de949f..78186e25 100644 --- a/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp +++ b/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp @@ -21,10 +21,8 @@ void CNoSpreadHitscan::Reset() bool CNoSpreadHitscan::ShouldRun(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, bool bCreateMove) { - if (G::PrimaryWeaponType != EWeaponType::HITSCAN) - return false; - - if ((bCreateMove ? pWeapon->GetWeaponSpread() : S::CTFWeaponBaseGun_GetWeaponSpread.Call(pWeapon)) <= 0.f) + if (G::PrimaryWeaponType != EWeaponType::HITSCAN + || (bCreateMove ? pWeapon->GetWeaponSpread() : S::CTFWeaponBaseGun_GetWeaponSpread.Call(pWeapon)) <= 0.f) return false; return bCreateMove ? G::Attacking == 1 : true; diff --git a/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.h b/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.h index 3607de31..559a08ea 100644 --- a/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.h +++ b/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.h @@ -31,4 +31,4 @@ public: float m_flMantissaStep = 0.f; }; -ADD_FEATURE(CNoSpreadHitscan, NoSpreadHitscan) \ No newline at end of file +ADD_FEATURE(CNoSpreadHitscan, NoSpreadHitscan); \ No newline at end of file diff --git a/Amalgam/src/Features/NoSpread/NoSpreadProjectile/NoSpreadProjectile.h b/Amalgam/src/Features/NoSpread/NoSpreadProjectile/NoSpreadProjectile.h index 0e86b127..002a33ec 100644 --- a/Amalgam/src/Features/NoSpread/NoSpreadProjectile/NoSpreadProjectile.h +++ b/Amalgam/src/Features/NoSpread/NoSpreadProjectile/NoSpreadProjectile.h @@ -10,4 +10,4 @@ public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); }; -ADD_FEATURE(CNoSpreadProjectile, NoSpreadProjectile) \ No newline at end of file +ADD_FEATURE(CNoSpreadProjectile, NoSpreadProjectile); \ No newline at end of file diff --git a/Amalgam/src/Features/Output/Output.cpp b/Amalgam/src/Features/Output/Output.cpp index d0b58102..d07ade0f 100644 --- a/Amalgam/src/Features/Output/Output.cpp +++ b/Amalgam/src/Features/Output/Output.cpp @@ -3,13 +3,11 @@ #include "../Visuals/Notifications/Notifications.h" #include "../Players/PlayerUtils.h" -static std::string white = { '\x7', 'F', 'F', 'F', 'F', 'F', 'F' }; //FFFFFF -static std::string red = { '\x7', 'F', 'F', '3', 'A', '3', 'A' }; //FF3A3A -static std::string green = { '\x7', '3', 'A', 'F', 'F', '4', 'D' }; //3AFF4D -static std::string blue = { '\x7', '0', 'D', '9', '2', 'F', 'F' }; //0D92FF -static std::string yellow = { '\x7', 'C', '8', 'A', '9', '0', '0' }; //C8A900 +static std::string sRed = Color_t(255, 100, 100).ToHex(); +static std::string sGreen = Color_t(100, 255, 100).ToHex(); +static std::string sYellow = Color_t(200, 169, 0).ToHex(); -void COutput::OutputInfo(int flags, std::string sName, std::string sOutput, std::string sChat) +static inline void OutputInfo(int flags, std::string sName, std::string sOutput, std::string sChat) { SDK::Output(sName.c_str(), sOutput.c_str(), Vars::Menu::Theme::Accent.Value, flags & Vars::Logging::LogToEnum::Console, @@ -56,7 +54,7 @@ void COutput::Event(IGameEvent* pEvent, uint32_t uHash, CTFPlayer* pLocal) auto sName = F::PlayerUtils.GetPlayerName(iIndex, pi.name); std::string sOutput = std::format("{}{} voted {}", (bSameTeam ? "" : "[Enemy] "), (sName), (bVotedYes ? "Yes" : "No")); - std::string sChat = std::format("{}{}{}\x1 voted {}{}", (bSameTeam ? "" : "[Enemy] "), (yellow), (sName), (bVotedYes ? green : red), (bVotedYes ? "Yes" : "No")); + std::string sChat = std::format("{}{}{}\x1 voted {}{}", (bSameTeam ? "" : "[Enemy] "), (sYellow), (sName), (bVotedYes ? sGreen : sRed), (bVotedYes ? "Yes" : "No")); OutputInfo(Vars::Logging::VoteCast::LogTo.Value, "Vote Cast", sOutput, sChat); return; @@ -79,7 +77,7 @@ void COutput::Event(IGameEvent* pEvent, uint32_t uHash, CTFPlayer* pLocal) auto sName = F::PlayerUtils.GetPlayerName(iIndex, pi.name); std::string sOutput = std::format("{}{} changed class to {}", (bSameTeam ? "" : "[Enemy] "), (sName), (SDK::GetClassByIndex(pEvent->GetInt("class")))); - std::string sChat = std::format("{}{}{}\x1 changed class to {}{}", (bSameTeam ? "" : "[Enemy] "), (yellow), (sName), (yellow), (SDK::GetClassByIndex(pEvent->GetInt("class")))); + std::string sChat = std::format("{}{}{}\x1 changed class to {}{}", (bSameTeam ? "" : "[Enemy] "), (sYellow), (sName), (sYellow), (SDK::GetClassByIndex(pEvent->GetInt("class")))); OutputInfo(Vars::Logging::ClassChange::LogTo.Value, "Class Change", sOutput, sChat); return; @@ -107,7 +105,7 @@ void COutput::Event(IGameEvent* pEvent, uint32_t uHash, CTFPlayer* pLocal) auto sName = F::PlayerUtils.GetPlayerName(iIndex, pi.name); std::string sOutput = std::format("You hit {} for {} damage{}({} / {})", (sName), (nDamage), (bCrit ? " (crit) " : " "), (nHealth), (iMaxHealth)); - std::string sChat = std::format("You hit {}{}\x1 for {}{} damage{}{}({} / {})", (yellow), (sName), (red), (nDamage), (bCrit ? " (crit) " : " "), (yellow), (nHealth), (iMaxHealth)); + std::string sChat = std::format("You hit {}{}\x1 for {}{} damage{}{}({} / {})", (sYellow), (sName), (sRed), (nDamage), (bCrit ? " (crit) " : " "), (sYellow), (nHealth), (iMaxHealth)); OutputInfo(Vars::Logging::Damage::LogTo.Value, "Damage", sOutput, sChat); return; @@ -187,7 +185,7 @@ void COutput::UserMessage(bf_read& msgData) auto sTargetName = F::PlayerUtils.GetPlayerName(iTarget, piTarget.name); auto sCallerName = F::PlayerUtils.GetPlayerName(iCaller, piCaller.name); std::string sOutput = std::format("{}{} called a vote on {}", (bSameTeam ? "" : "[Enemy] "), (sCallerName), (sTargetName)); - std::string sChat = std::format("{}{}{}\x1 called a vote on {}{}", (bSameTeam ? "" : "[Enemy] "), (yellow), (sCallerName), (yellow), (sTargetName)); + std::string sChat = std::format("{}{}{}\x1 called a vote on {}{}", (bSameTeam ? "" : "[Enemy] "), (sYellow), (sCallerName), (sYellow), (sTargetName)); OutputInfo(Vars::Logging::VoteStart::LogTo.Value, "Vote Start", sOutput, sChat); } @@ -198,7 +196,7 @@ void COutput::CheatDetection(std::string sName, std::string sAction, std::string return; std::string sOutput = std::format("{} {} for {}", (sName), (sAction), (sReason)); - std::string sChat = std::format("{}{}\x1 {} for {}{}", (yellow), (sName), (sAction), (yellow), (sReason)); + std::string sChat = std::format("{}{}\x1 {} for {}{}", (sYellow), (sName), (sAction), (sYellow), (sReason)); OutputInfo(Vars::Logging::CheatDetection::LogTo.Value, "Cheat Detection", sOutput, sChat); } @@ -253,7 +251,7 @@ void COutput::TagsOnJoin(std::string sName, uint32_t uFriendsID) } std::string sOutput = std::format("{} has the {} {}", (sName), (vColorsTags.size() == 1 ? "tag" : "tags"), (sOutputText)); - std::string sChat = std::format("{}{}\x1 has the {} {}", (yellow), (sName), (vColorsTags.size() == 1 ? "tag" : "tags"), (sChatText)); + std::string sChat = std::format("{}{}\x1 has the {} {}", (sYellow), (sName), (vColorsTags.size() == 1 ? "tag" : "tags"), (sChatText)); OutputInfo(Vars::Logging::Tags::LogTo.Value, "Tags", sOutput, sChat); } void COutput::TagsChanged(std::string sName, std::string sAction, std::string sColor, std::string sTag) @@ -263,7 +261,7 @@ void COutput::TagsChanged(std::string sName, std::string sAction, std::string sC auto uHash = FNV1A::Hash32(sAction.c_str()); std::string sOutput = std::format("{} tag {} {} {}", (sAction), (sTag), (uHash == FNV1A::Hash32Const("Added") ? "to" : "from"), (sName)); - std::string sChat = std::format("{} tag {}{}\x1 {} {}{}", (sAction), (sColor), (sTag), (uHash == FNV1A::Hash32Const("Added") ? "to" : "from"), (yellow), (sName)); + std::string sChat = std::format("{} tag {}{}\x1 {} {}{}", (sAction), (sColor), (sTag), (uHash == FNV1A::Hash32Const("Added") ? "to" : "from"), (sYellow), (sName)); OutputInfo(Vars::Logging::Tags::LogTo.Value, "Tags", sOutput, sChat); } @@ -279,7 +277,7 @@ void COutput::AliasOnJoin(std::string sName, uint32_t uFriendsID) auto& sAlias = F::PlayerUtils.m_mPlayerAliases[uFriendsID]; std::string sOutput = std::format("{} has the alias \"{}\"", (sName), (sAlias)); - std::string sChat = std::format("{}{}\x1 has the alias \"{}{}\x1\"", (yellow), (sName), (yellow), (sAlias)); + std::string sChat = std::format("{}{}\x1 has the alias \"{}{}\x1\"", (sYellow), (sName), (sYellow), (sAlias)); OutputInfo(Vars::Logging::Tags::LogTo.Value, "Aliases", sOutput, sChat); } void COutput::AliasChanged(std::string sName, std::string sAction, std::string sAlias) @@ -289,7 +287,7 @@ void COutput::AliasChanged(std::string sName, std::string sAction, std::string s auto uHash = FNV1A::Hash32(sAction.c_str()); std::string sOutput = std::format("{} {}'s alias {} \"{}\"", (sAction), (sName), (uHash == FNV1A::Hash32Const("Changed") ? "to" : "of"), (sAlias)); - std::string sChat = std::format("{} {}{}\x1's alias {} \"{}{}\x1\"", (sAction), (yellow), (sName), (uHash == FNV1A::Hash32Const("Changed") ? "to" : "of"), (yellow), (sAlias)); + std::string sChat = std::format("{} {}{}\x1's alias {} \"{}{}\x1\"", (sAction), (sYellow), (sName), (uHash == FNV1A::Hash32Const("Changed") ? "to" : "of"), (sYellow), (sAlias)); OutputInfo(Vars::Logging::Tags::LogTo.Value, "Aliases", sOutput, sChat); } @@ -312,7 +310,7 @@ void COutput::ReportResolver(int iIndex, std::string sAction, std::string sAxis, auto sName = F::PlayerUtils.GetPlayerName(iIndex, pi.name); std::string sOutput = std::format("{} {} of {} to {}", (sAction), (sAxis), (sName), (sValue)); - std::string sChat = std::format("{} {}{}\x1 of {}{}\x1 to {}{}\x1", (sAction), (yellow), (sAxis), (yellow), (sName), (yellow), (sValue)); + std::string sChat = std::format("{} {}{}\x1 of {}{}\x1 to {}{}\x1", (sAction), (sYellow), (sAxis), (sYellow), (sName), (sYellow), (sValue)); OutputInfo(Vars::Logging::Tags::LogTo.Value, "Resolver", sOutput, sChat); } void COutput::ReportResolver(std::string sMessage) diff --git a/Amalgam/src/Features/Output/Output.h b/Amalgam/src/Features/Output/Output.h index 863853fa..6ddcad1b 100644 --- a/Amalgam/src/Features/Output/Output.h +++ b/Amalgam/src/Features/Output/Output.h @@ -3,8 +3,6 @@ class COutput { - void OutputInfo(int flags, std::string sName, std::string sOutput, std::string sChat); - bool m_bInfoOnJoin = false; public: @@ -24,4 +22,4 @@ public: void AliasOnJoin(std::string sName, uint32_t uFriendsID); }; -ADD_FEATURE(COutput, Output) \ No newline at end of file +ADD_FEATURE(COutput, Output); \ No newline at end of file diff --git a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp index 16932b0f..7c213461 100644 --- a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp +++ b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp @@ -44,11 +44,18 @@ bool CAntiAim::ShouldRun(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC -void CAntiAim::FakeShotAngles(CTFPlayer* pLocal, CUserCmd* pCmd) +void CAntiAim::FakeShotAngles(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) { if (!Vars::AntiAim::InvalidShootPitch.Value || G::Attacking != 1 || G::PrimaryWeaponType != EWeaponType::HITSCAN || !pLocal || pLocal->m_MoveType() != MOVETYPE_WALK) return; + switch (pWeapon ? pWeapon->GetWeaponID() : 0) + { + case TF_WEAPON_MEDIGUN: + case TF_WEAPON_LASER_POINTER: + return; + } + G::SilentAngles = true; pCmd->viewangles.x += 360 * (vFakeAngles.x < 0 ? -1 : 1); @@ -75,7 +82,7 @@ float CAntiAim::EdgeDistance(CTFPlayer* pEntity, float flEdgeRayYaw, float flOff int CAntiAim::GetEdge(CTFPlayer* pEntity, const float flEdgeOrigYaw) { - float flSize = pEntity->m_vecMaxs().y - pEntity->m_vecMins().y; + float flSize = pEntity->GetSize().y; float flEdgeLeftDist = EdgeDistance(pEntity, flEdgeOrigYaw, -flSize); float flEdgeRightDist = EdgeDistance(pEntity, flEdgeOrigYaw, flSize); @@ -217,7 +224,7 @@ void CAntiAim::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, bo int iAntiBackstab = F::Misc.AntiBackstab(pLocal, pCmd, bSendPacket); if (!iAntiBackstab) - FakeShotAngles(pLocal, pCmd); + FakeShotAngles(pLocal, pWeapon, pCmd); if (!G::AntiAim) { diff --git a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h index 727ca460..044309e1 100644 --- a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h +++ b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h @@ -4,7 +4,7 @@ class CAntiAim { private: - void FakeShotAngles(CTFPlayer* pLocal, CUserCmd* pCmd); + void FakeShotAngles(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); float EdgeDistance(CTFPlayer* pEntity, float flEdgeRayYaw, float flOffset); void RunOverlapping(CTFPlayer* pEntity, CUserCmd* pCmd, float& flRealYaw, bool bFake, float flEpsilon = 45.f); @@ -30,4 +30,4 @@ public: std::vector> vEdgeTrace = {}; }; -ADD_FEATURE(CAntiAim, AntiAim) \ No newline at end of file +ADD_FEATURE(CAntiAim, AntiAim); \ No newline at end of file diff --git a/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.h b/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.h index ccc00111..02b5ff48 100644 --- a/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.h +++ b/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.h @@ -18,4 +18,4 @@ public: int m_iGoal = 0; }; -ADD_FEATURE(CFakeLag, FakeLag) +ADD_FEATURE(CFakeLag, FakeLag); \ No newline at end of file diff --git a/Amalgam/src/Features/PacketManip/PacketManip.h b/Amalgam/src/Features/PacketManip/PacketManip.h index a36707ef..d9bd7eda 100644 --- a/Amalgam/src/Features/PacketManip/PacketManip.h +++ b/Amalgam/src/Features/PacketManip/PacketManip.h @@ -9,4 +9,4 @@ public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, bool* pSendPacket); }; -ADD_FEATURE(CPacketManip, PacketManip) \ No newline at end of file +ADD_FEATURE(CPacketManip, PacketManip); \ No newline at end of file diff --git a/Amalgam/src/Features/Players/PlayerCore.h b/Amalgam/src/Features/Players/PlayerCore.h index 5528913e..b81d7fd1 100644 --- a/Amalgam/src/Features/Players/PlayerCore.h +++ b/Amalgam/src/Features/Players/PlayerCore.h @@ -10,4 +10,4 @@ public: void Run(); }; -ADD_FEATURE(CPlayerlistCore, PlayerCore) \ No newline at end of file +ADD_FEATURE(CPlayerlistCore, PlayerCore); \ No newline at end of file diff --git a/Amalgam/src/Features/Players/PlayerUtils.h b/Amalgam/src/Features/Players/PlayerUtils.h index 9b2ebcdd..ab526c9e 100644 --- a/Amalgam/src/Features/Players/PlayerUtils.h +++ b/Amalgam/src/Features/Players/PlayerUtils.h @@ -111,4 +111,4 @@ public: bool m_bSave = false; }; -ADD_FEATURE(CPlayerlistUtils, PlayerUtils) \ No newline at end of file +ADD_FEATURE(CPlayerlistUtils, PlayerUtils); \ No newline at end of file diff --git a/Amalgam/src/Features/Resolver/Resolver.cpp b/Amalgam/src/Features/Resolver/Resolver.cpp index b7a81fac..db6abc2f 100644 --- a/Amalgam/src/Features/Resolver/Resolver.cpp +++ b/Amalgam/src/Features/Resolver/Resolver.cpp @@ -87,7 +87,7 @@ void CResolver::CreateMove(CTFPlayer* pLocal) if (!pLocal) return; - if (m_iWaitingForTarget != -1 && TICKS_TO_TIME(pLocal->m_nTickBase()) > m_flWaitingForDamage) + if (m_iWaitingForTarget != -1 && m_flWaitingForDamage < TICKS_TO_TIME(pLocal->m_nTickBase())) { if (auto pTarget = I::ClientEntityList->GetClientEntity(I::EngineClient->GetPlayerForUserID(m_iWaitingForTarget))->As()) { @@ -289,7 +289,7 @@ void CResolver::HitscanRan(CTFPlayer* pLocal, CTFPlayer* pTarget, CTFWeaponBase* } } -void CResolver::OnPlayerHurt(IGameEvent* pEvent) +void CResolver::PlayerHurt(IGameEvent* pEvent) { if (m_iWaitingForTarget == -1 || I::EngineClient->GetPlayerForUserID(pEvent->GetInt("attacker")) != I::EngineClient->GetLocalPlayer() diff --git a/Amalgam/src/Features/Resolver/Resolver.h b/Amalgam/src/Features/Resolver/Resolver.h index be080c6e..030f3f16 100644 --- a/Amalgam/src/Features/Resolver/Resolver.h +++ b/Amalgam/src/Features/Resolver/Resolver.h @@ -38,7 +38,7 @@ public: void FrameStageNotify(); void CreateMove(CTFPlayer* pLocal); void HitscanRan(CTFPlayer* pLocal, CTFPlayer* pTarget, CTFWeaponBase* pWeapon, int iHitbox = HITBOX_MAX); - void OnPlayerHurt(IGameEvent* pEvent); + void PlayerHurt(IGameEvent* pEvent); void SetYaw(int iUserID, float flValue, bool bAuto = false); void SetPitch(int iUserID, float flValue, bool bInverse = false, bool bAuto = false); void SetMinwalk(int iUserID, bool bValue); @@ -47,4 +47,4 @@ public: void Reset(); }; -ADD_FEATURE(CResolver, Resolver) \ No newline at end of file +ADD_FEATURE(CResolver, Resolver); \ No newline at end of file diff --git a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp index f839f6ef..009b5828 100644 --- a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp +++ b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp @@ -216,7 +216,7 @@ bool CMovementSimulation::Initialize(CBaseEntity* pEntity, PlayerStorage& tStora tStorage.m_pPlayer = pPlayer; I::MoveHelper->SetHost(pPlayer); - pPlayer->SetCurrentCmd(&DummyCmd); + pPlayer->m_pCurrentCommand() = &DummyCmd; // store player restore data Store(tStorage); @@ -710,7 +710,7 @@ void CMovementSimulation::Restore(PlayerStorage& tStorage) return; I::MoveHelper->SetHost(nullptr); - tStorage.m_pPlayer->SetCurrentCmd(nullptr); + tStorage.m_pPlayer->m_pCurrentCommand() = nullptr; Reset(tStorage); diff --git a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h index 513837c5..bb3fb176 100644 --- a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h +++ b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h @@ -117,4 +117,4 @@ public: float GetPredictedDelta(CBaseEntity* pEntity); }; -ADD_FEATURE(CMovementSimulation, MoveSim) \ No newline at end of file +ADD_FEATURE(CMovementSimulation, MoveSim); \ No newline at end of file diff --git a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp index de8edd1f..4b376401 100644 --- a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp +++ b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp @@ -10,6 +10,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap bool bTrace = iFlags & ProjSimEnum::Trace; bool bQuick = iFlags & ProjSimEnum::Quick; + bool bMaxSpeed = iFlags & ProjSimEnum::MaxSpeed; static auto sv_gravity = U::ConVars.FindVar("sv_gravity"); @@ -72,7 +73,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap if (Vars::Visuals::Trajectory::Override.Value) { SDK::GetProjectileFireSetup(pPlayer, vAngles, { Vars::Visuals::Trajectory::OffsetX.Value, Vars::Visuals::Trajectory::OffsetY.Value, Vars::Visuals::Trajectory::OffsetZ.Value }, vPos, vAngle, !bTrace ? true : Vars::Visuals::Trajectory::Pipes.Value, bQuick); - tProjInfo = { FNV1A::Hash32Const("custom"), vPos, vAngle, { Vars::Visuals::Trajectory::Hull.Value, Vars::Visuals::Trajectory::Hull.Value, Vars::Visuals::Trajectory::Hull.Value }, Vars::Visuals::Trajectory::Speed.Value, Vars::Visuals::Trajectory::Gravity.Value, Vars::Visuals::Trajectory::NoSpin.Value, Vars::Visuals::Trajectory::LifeTime.Value }; + tProjInfo = { pWeapon, FNV1A::Hash32Const("custom"), vPos, vAngle, { Vars::Visuals::Trajectory::Hull.Value, Vars::Visuals::Trajectory::Hull.Value, Vars::Visuals::Trajectory::Hull.Value }, Vars::Visuals::Trajectory::Speed.Value, Vars::Visuals::Trajectory::Gravity.Value, Vars::Visuals::Trajectory::LifeTime.Value }; return true; } @@ -83,7 +84,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap { SDK::GetProjectileFireSetup(pPlayer, vAngles, { 23.5f, int(SDK::AttribHookValue(0, "centerfire_projectile", pWeapon)) == 1 ? 0.f : 12.f, bDucking ? 8.f : -3.f }, vPos, vAngle, !bTrace ? true : false, bQuick); float flSpeed = pPlayer->InCond(TF_COND_RUNE_PRECISION) ? 3000.f : SDK::AttribHookValue(1100.f, "mult_projectile_speed", pWeapon); - tProjInfo = { FNV1A::Hash32Const("models/weapons/w_models/w_rocket.mdl"), vPos, vAngle, { 0.f, 0.f, 0.f }, flSpeed, 0.f, true }; + tProjInfo = { pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_rocket.mdl"), vPos, vAngle, { 0.f, 0.f, 0.f }, flSpeed, 0.f }; return true; } case TF_WEAPON_PARTICLE_CANNON: @@ -96,7 +97,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap if (pWeapon->GetWeaponID() == TF_WEAPON_DRG_POMSON) vPos.z -= 13.f; float flSpeed = bCowMangler ? 1100.f : 1200.f; - tProjInfo = { FNV1A::Hash32Const("models/weapons/w_models/w_drg_ball.mdl"), vPos, vAngle, bCowMangler ? Vec3() : Vec3(1.f, 1.f, 1.f), flSpeed, 0.f, true }; + tProjInfo = { pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_drg_ball.mdl"), vPos, vAngle, bCowMangler ? Vec3() : Vec3(1.f, 1.f, 1.f), flSpeed, 0.f }; return true; } case TF_WEAPON_GRENADELAUNCHER: // vphysics projectiles affected by server start gravity @@ -111,7 +112,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap ? pWeapon->As()->m_flDetonateTime() > 0.f ? pWeapon->As()->m_flDetonateTime() - I::GlobalVars->curtime : flMortar : SDK::AttribHookValue(2.2f, "fuse_mult", pWeapon); auto uType = bCannon ? FNV1A::Hash32Const("models/weapons/w_models/w_cannonball.mdl") : FNV1A::Hash32Const("models/weapons/w_models/w_grenade_grenadelauncher.mdl"); - tProjInfo = { uType, vPos, vAngle, { 6.f, 6.f, 6.f }, flSpeed, 1.f, SDK::AttribHookValue(0, "grenade_no_spin", pWeapon) != 0, flLifetime }; + tProjInfo = { pWeapon, uType, vPos, vAngle, { 6.f, 6.f, 6.f }, flSpeed, 1.f, flLifetime }; return true; } case TF_WEAPON_PIPEBOMBLAUNCHER: @@ -120,29 +121,29 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap float flCharge = flAutoCharge > 0.f && SDK::AttribHookValue(1, "mult_dmg", pWeapon) ? SDK::AttribHookValue(4.f, "stickybomb_charge_rate", pWeapon) * flAutoCharge : (pWeapon->As()->m_flChargeBeginTime() > 0.f ? I::GlobalVars->curtime - pWeapon->As()->m_flChargeBeginTime() : 0.f); - float flSpeed = Math::RemapVal(flCharge, 0.f, SDK::AttribHookValue(4.f, "stickybomb_charge_rate", pWeapon), 900.f, 2400.f); - tProjInfo = { FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb.mdl"), vPos, vAngle, { 6.f, 6.f, 6.f }, flSpeed, 1.f, false }; + float flSpeed = bMaxSpeed ? 2400.f : Math::RemapVal(flCharge, 0.f, SDK::AttribHookValue(4.f, "stickybomb_charge_rate", pWeapon), 900.f, 2400.f); + tProjInfo = { pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb.mdl"), vPos, vAngle, { 6.f, 6.f, 6.f }, flSpeed, 1.f }; return true; } case TF_WEAPON_FLAREGUN: { SDK::GetProjectileFireSetup(pPlayer, vAngles, { 23.5f, 12.f, bDucking ? 8.f : -3.f }, vPos, vAngle, !bTrace ? true : false, bQuick); - tProjInfo = { FNV1A::Hash32Const("models/weapons/w_models/w_flaregun_shell.mdl"), vPos, vAngle, { 1.f, 1.f, 1.f }, SDK::AttribHookValue(2000.f, "mult_projectile_speed", pWeapon), 0.3f * flGravity, true}; + tProjInfo = { pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_flaregun_shell.mdl"), vPos, vAngle, { 1.f, 1.f, 1.f }, SDK::AttribHookValue(2000.f, "mult_projectile_speed", pWeapon), 0.3f * flGravity }; return true; } case TF_WEAPON_FLAREGUN_REVENGE: { SDK::GetProjectileFireSetup(pPlayer, vAngles, { 23.5f, 12.f, bDucking ? 8.f : -3.f }, vPos, vAngle, !bTrace ? true : false, bQuick); - tProjInfo = { FNV1A::Hash32Const("models/weapons/w_models/w_flaregun_shell.mdl"), vPos, vAngle, { 1.f, 1.f, 1.f }, 3000.f, 0.45f * flGravity, true }; + tProjInfo = { pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_flaregun_shell.mdl"), vPos, vAngle, { 1.f, 1.f, 1.f }, 3000.f, 0.45f * flGravity }; return true; } case TF_WEAPON_COMPOUND_BOW: { SDK::GetProjectileFireSetup(pPlayer, vAngles, { 23.5f, 8.f, -3.f }, vPos, vAngle, !bTrace ? true : false, bQuick); float flCharge = pWeapon->As()->m_flChargeBeginTime() > 0.f ? I::GlobalVars->curtime - pWeapon->As()->m_flChargeBeginTime() : 0.f; - float flSpeed = Math::RemapVal(flCharge, 0.f, 1.f, 1800.f, 2600.f); + float flSpeed = bMaxSpeed ? 2600.f : Math::RemapVal(flCharge, 0.f, 1.f, 1800.f, 2600.f); flGravity = Math::RemapVal(flCharge, 0.f, 1.f, 0.5f, 0.1f) * flGravity; - tProjInfo = { FNV1A::Hash32Const("models/weapons/w_models/w_arrow.mdl"), vPos, vAngle, { 1.f, 1.f, 1.f }, flSpeed, flGravity, true, 10.f /*arrows have some lifetime check for whatever reason*/ }; + tProjInfo = { pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_arrow.mdl"), vPos, vAngle, { 1.f, 1.f, 1.f }, flSpeed, flGravity, 10.f /*arrows have some lifetime check for whatever reason*/ }; return true; } case TF_WEAPON_CROSSBOW: @@ -152,13 +153,13 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap SDK::GetProjectileFireSetup(pPlayer, vAngles, { 23.5f, 8.f, -3.f }, vPos, vAngle, !bTrace ? true : false, bQuick); auto uType = bCrossbow ? FNV1A::Hash32Const("models/weapons/w_models/w_syringe_proj.mdl") : FNV1A::Hash32Const("models/weapons/w_models/w_repair_claw.mdl"); - tProjInfo = { uType, vPos, vAngle, pWeapon->GetWeaponID() == TF_WEAPON_CROSSBOW ? Vec3(3.f, 3.f, 3.f) : Vec3(1.f, 1.f, 1.f), 2400.f, 0.2f * flGravity, true, 10.f /*arrows have some lifetime check for whatever reason*/ }; + tProjInfo = { pWeapon, uType, vPos, vAngle, pWeapon->GetWeaponID() == TF_WEAPON_CROSSBOW ? Vec3(3.f, 3.f, 3.f) : Vec3(1.f, 1.f, 1.f), 2400.f, 0.2f * flGravity, 10.f /*arrows have some lifetime check for whatever reason*/ }; return true; } case TF_WEAPON_SYRINGEGUN_MEDIC: { SDK::GetProjectileFireSetup(pPlayer, vAngles, { 16.f, 6.f, -8.f }, vPos, vAngle, !bTrace ? true : false, bQuick); - tProjInfo = { FNV1A::Hash32Const("models/weapons/w_models/w_syringe_proj.mdl"), vPos, vAngle, { 1.f, 1.f, 1.f }, 1000.f, 0.3f * flGravity, true }; + tProjInfo = { pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_syringe_proj.mdl"), vPos, vAngle, { 1.f, 1.f, 1.f }, 1000.f, 0.3f * flGravity }; return true; } case TF_WEAPON_FLAMETHROWER: @@ -167,19 +168,19 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap const float flHull = tf_flamethrower_boxsize->GetFloat(); SDK::GetProjectileFireSetup(pPlayer, vAngles, { 40.f, 5.f, 0.f }, vPos, vAngle, true, bQuick, false); - tProjInfo = { FNV1A::Hash32Const("particles/flamethrower.pcf"), vPos, vAngle, { flHull, flHull, flHull }, 1000.f, 0.f, true, 0.285f }; + tProjInfo = { pWeapon, FNV1A::Hash32Const("particles/flamethrower.pcf"), vPos, vAngle, { flHull, flHull, flHull }, 1000.f, 0.f, 0.285f }; return true; } case TF_WEAPON_FLAME_BALL: { SDK::GetProjectileFireSetup(pPlayer, vAngles, { 3.f, 7.f, -9.f }, vPos, vAngle, true, bQuick, false); - tProjInfo = { FNV1A::Hash32Const("models/weapons/c_models/c_flameball/c_flameball.mdl"), vPos, vAngle, { 1.f, 1.f, 1.f /*damaging hull much bigger, shouldn't matter here*/ }, 3000.f, 0.f, true, 0.18f }; + tProjInfo = { pWeapon, FNV1A::Hash32Const("models/weapons/c_models/c_flameball/c_flameball.mdl"), vPos, vAngle, { 1.f, 1.f, 1.f /*damaging hull much bigger, shouldn't matter here*/ }, 3000.f, 0.f, 0.18f }; return true; } case TF_WEAPON_CLEAVER: { SDK::GetProjectileFireSetup(pPlayer, vAngles, { 16.f, 8.f, -6.f }, vPos, vAngle, true, bQuick); - tProjInfo = { FNV1A::Hash32Const("models/workshop_partner/weapons/c_models/c_sd_cleaver/c_sd_cleaver.mdl"), vPos, vAngle, { 1.f, 1.f, 10.f /*weird, probably still inaccurate*/ }, 3000.f, 1.f, !bTrace ? true : false, 2.2f }; + tProjInfo = { pWeapon, FNV1A::Hash32Const("models/workshop_partner/weapons/c_models/c_sd_cleaver/c_sd_cleaver.mdl"), vPos, vAngle, { 1.f, 1.f, 10.f /*weird, probably still inaccurate*/ }, 3000.f, 1.f, 2.2f }; return true; } case TF_WEAPON_BAT_WOOD: @@ -192,7 +193,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap Vec3 vForward; Math::AngleVectors(vAngle, &vForward); vPos = (bQuick ? pPlayer->GetAbsOrigin() : pPlayer->m_vecOrigin()) + (Vec3(0, 0, 50) + vForward * 32.f) * pPlayer->m_flModelScale(); // why? auto uHash = bWrapAssassin ? FNV1A::Hash32Const("models/weapons/c_models/c_xms_festive_ornament.mdl") : FNV1A::Hash32Const("models/weapons/w_models/w_baseball.mdl"); - tProjInfo = { uHash, vPos, vAngle, { 3.f, 3.f, 3.f }, tf_scout_stunball_base_speed->GetFloat(), 1.f, false, bWrapAssassin ? 2.3f : 100.f }; + tProjInfo = { pWeapon, uHash, vPos, vAngle, { 3.f, 3.f, 3.f }, tf_scout_stunball_base_speed->GetFloat(), 1.f, bWrapAssassin ? 2.3f : 100.f }; return true; } case TF_WEAPON_JAR: @@ -206,13 +207,13 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap case Sniper_s_TheSelfAwareBeautyMark: uType = FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster.mdl"); break; case Scout_s_MutatedMilk: uType = FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster_milk.mdl"); break; } - tProjInfo = { uType, vPos, vAngle, { 3.f, 3.f, 3.f }, 1000.f, 1.f, false, 2.2f }; + tProjInfo = { pWeapon, uType, vPos, vAngle, { 3.f, 3.f, 3.f }, 1000.f, 1.f, 2.2f }; return true; } case TF_WEAPON_JAR_GAS: { SDK::GetProjectileFireSetup(pPlayer, vAngles, { 16.f, 8.f, -6.f }, vPos, vAngle, true, bQuick); - tProjInfo = { FNV1A::Hash32Const("models/weapons/c_models/c_gascan/c_gascan.mdl"), vPos, vAngle, { 3.f, 3.f, 3.f }, 2000.f, 1.f, false, 2.2f }; + tProjInfo = { pWeapon, FNV1A::Hash32Const("models/weapons/c_models/c_gascan/c_gascan.mdl"), vPos, vAngle, { 3.f, 3.f, 3.f }, 2000.f, 1.f, 2.2f }; return true; } case TF_WEAPON_GRAPPLINGHOOK: @@ -232,7 +233,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap } } float flLifetime = tf_grapplinghook_max_distance->GetFloat() / flSpeed; - tProjInfo = { FNV1A::Hash32Const("models/weapons/c_models/c_grapple_proj/c_grapple_proj.mdl"), vPos, vAngle, { 1.2f, 1.2f, 1.2f }, flSpeed, 0.f, false, flLifetime }; + tProjInfo = { pWeapon, FNV1A::Hash32Const("models/weapons/c_models/c_grapple_proj/c_grapple_proj.mdl"), vPos, vAngle, { 1.2f, 1.2f, 1.2f }, flSpeed, 0.f, flLifetime }; return true; } } @@ -246,7 +247,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap case Heavy_s_TheDalokohsBar: case Heavy_s_SecondBanana: SDK::GetProjectileFireSetup(pPlayer, vAngles, { 0.f, 0.f, -8.f }, vPos, vAngle, true, bQuick); - tProjInfo = { FNV1A::Hash32Const("models/weapons/c_models/c_sandwich/c_sandwich.mdl"), vPos, vAngle, { 17.f, 17.f, 7.f }, 500.f, 1.f * flGravity, false }; + tProjInfo = { pWeapon, FNV1A::Hash32Const("models/weapons/c_models/c_sandwich/c_sandwich.mdl"), vPos, vAngle, { 17.f, 17.f, 7.f }, 500.f, 1.f * flGravity }; return true; } @@ -457,7 +458,8 @@ bool CProjectileSimulation::Initialize(ProjectileInfo& tProjInfo, bool bSimulate if (!tProjInfo.m_bQuick && G::CurrentUserCmd) { vVelocity += vUp * 200.f + vUp * SDK::RandomFloat(-10.f, 10.f) + vRight * SDK::RandomFloat(-10.f, 10.f); - vAngularVelocity = { 600.f, float(SDK::RandomInt(-1200, 1200)), 0.f }; + if (!tProjInfo.m_pWeapon || !SDK::AttribHookValue(0, "grenade_no_spin", tProjInfo.m_pWeapon)) + vAngularVelocity = { 600.f, float(SDK::RandomInt(-1200, 1200)), 0.f }; break; } vVelocity += vUp * 200.f; @@ -528,9 +530,6 @@ bool CProjectileSimulation::Initialize(ProjectileInfo& tProjInfo, bool bSimulate } } - if (tProjInfo.m_bNoSpin) - vAngularVelocity.Zero(); - if (bSimulate && !F::ProjSim.obj->IsDragEnabled() && obj->m_dragBasis.IsZero()) // don't include vphysics projectiles vVelocity.z += 400.f * tProjInfo.m_flGravity * TICK_INTERVAL; // i don't know why this makes it more accurate but it does diff --git a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h index 86d15dfa..287cb06e 100644 --- a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h +++ b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h @@ -7,11 +7,13 @@ Enum(ProjSim, InitCheck = 1 << 1, Quick = 1 << 2, NoRandomAngles = 1 << 3, - PredictCmdNum = 1 << 4 + PredictCmdNum = 1 << 4, + MaxSpeed = 1 << 5 ) struct ProjectileInfo { + CTFWeaponBase* m_pWeapon = nullptr; uint32_t m_uType = 0; Vec3 m_vPos = {}; @@ -20,7 +22,6 @@ struct ProjectileInfo float m_flVelocity = 0.f; float m_flGravity = 0.f; - bool m_bNoSpin = false; float m_flLifetime = 60.f; CTFPlayer* m_pOwner = nullptr; @@ -60,4 +61,4 @@ public: IPhysicsObject* obj = nullptr; }; -ADD_FEATURE(CProjectileSimulation, ProjSim) \ No newline at end of file +ADD_FEATURE(CProjectileSimulation, ProjSim); \ No newline at end of file diff --git a/Amalgam/src/Features/Spectate/Spectate.h b/Amalgam/src/Features/Spectate/Spectate.h index 1b5e6cd3..23f15d12 100644 --- a/Amalgam/src/Features/Spectate/Spectate.h +++ b/Amalgam/src/Features/Spectate/Spectate.h @@ -19,4 +19,4 @@ public: int m_iTargetMode = OBS_MODE_NONE; }; -ADD_FEATURE(CSpectate, Spectate) \ No newline at end of file +ADD_FEATURE(CSpectate, Spectate); \ No newline at end of file diff --git a/Amalgam/src/Features/Ticks/Ticks.h b/Amalgam/src/Features/Ticks/Ticks.h index d19f7c0e..2ed03cd2 100644 --- a/Amalgam/src/Features/Ticks/Ticks.h +++ b/Amalgam/src/Features/Ticks/Ticks.h @@ -59,4 +59,4 @@ public: int m_iDeficit = 0; }; -ADD_FEATURE(CTickshiftHandler, Ticks) \ No newline at end of file +ADD_FEATURE(CTickshiftHandler, Ticks); \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/CameraWindow/CameraWindow.h b/Amalgam/src/Features/Visuals/CameraWindow/CameraWindow.h index 32187427..f5dc859f 100644 --- a/Amalgam/src/Features/Visuals/CameraWindow/CameraWindow.h +++ b/Amalgam/src/Features/Visuals/CameraWindow/CameraWindow.h @@ -19,4 +19,4 @@ public: bool m_bDrawing = false; }; -ADD_FEATURE(CCameraWindow, CameraWindow) \ No newline at end of file +ADD_FEATURE(CCameraWindow, CameraWindow); \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/Chams/Chams.h b/Amalgam/src/Features/Visuals/Chams/Chams.h index 6b59065c..9e6a4bad 100644 --- a/Amalgam/src/Features/Visuals/Chams/Chams.h +++ b/Amalgam/src/Features/Visuals/Chams/Chams.h @@ -38,4 +38,4 @@ public: std::unordered_map m_mEntities = {}; }; -ADD_FEATURE(CChams, Chams) \ No newline at end of file +ADD_FEATURE(CChams, Chams); \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/ESP/ESP.cpp b/Amalgam/src/Features/Visuals/ESP/ESP.cpp index 36dbeea2..1fcd6950 100644 --- a/Amalgam/src/Features/Visuals/ESP/ESP.cpp +++ b/Amalgam/src/Features/Visuals/ESP/ESP.cpp @@ -164,7 +164,7 @@ void CESP::StorePlayers(CTFPlayer* pLocal) tCache.m_flUber = std::clamp(pMediGun->As()->m_flChargeLevel(), 0.f, 1.f); tCache.m_bUberBar = Vars::ESP::Player.Value & Vars::ESP::PlayerEnum::UberBar; if (Vars::ESP::Player.Value & Vars::ESP::PlayerEnum::UberText) - tCache.m_vText.emplace_back(ESPTextEnum::Uber, std::format("{:.0f}%%", tCache.m_flUber * 100.f), Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + tCache.m_vText.emplace_back(ESPTextEnum::Uber, std::format("{:.0f}%", tCache.m_flUber * 100.f), Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); } } @@ -315,6 +315,65 @@ void CESP::StorePlayers(CTFPlayer* pLocal) if (pPlayer->InCond(TF_COND_POWERUPMODE_DOMINANT)) tCache.m_vText.emplace_back(ESPTextEnum::Right, "Dominant", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + for (int i = 0; i < MAX_WEAPONS; i++) + { + auto pWeapon = pPlayer->GetWeaponFromSlot(i)->As(); + if (!pWeapon || pWeapon->GetWeaponID() != TF_WEAPON_SPELLBOOK || !pWeapon->m_iSpellCharges()) + continue; + + switch (pWeapon->m_iSelectedSpellIndex()) + { + case 0: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Fireball", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + case 1: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Bats", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + case 2: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Heal", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + case 3: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Pumpkins", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + case 4: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Jump", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + case 5: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Stealth", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + case 6: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Teleport", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + case 7: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Lightning", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + case 8: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Minify", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + case 9: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Meteors", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + case 10: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Monoculus", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + case 11: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Skeletons", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + case 12: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Glove", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + case 13: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Parachute", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + case 14: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Heal", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + case 15: + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Bomb", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + break; + } + } + if (pPlayer->InCond(TF_COND_RADIUSHEAL) || pPlayer->InCond(TF_COND_HEALTH_BUFF) || pPlayer->InCond(TF_COND_RADIUSHEAL_ON_DAMAGE) || @@ -358,9 +417,9 @@ void CESP::StorePlayers(CTFPlayer* pLocal) tCache.m_vText.emplace_back(ESPTextEnum::Right, "DR", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); else if (pPlayer->InCond(TF_COND_FEIGN_DEATH)) tCache.m_vText.emplace_back(ESPTextEnum::Right, "Feign", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); - - if (pPlayer->InCond(TF_COND_STEALTHED) || pPlayer->InCond(TF_COND_STEALTHED_BLINK) || pPlayer->InCond(TF_COND_STEALTHED_USER_BUFF) || pPlayer->InCond(TF_COND_STEALTHED_USER_BUFF_FADING)) - tCache.m_vText.emplace_back(ESPTextEnum::Right, std::format("Invis {:.0f}%%", pPlayer->GetInvisPercentage()), Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + + if (pPlayer->m_flInvisibility()) + tCache.m_vText.emplace_back(ESPTextEnum::Right, std::format("Invis {:.0f}%", pPlayer->m_flInvisibility() * 100), Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); if (pPlayer->InCond(TF_COND_DISGUISING) || pPlayer->InCond(TF_COND_DISGUISED)) tCache.m_vText.emplace_back(ESPTextEnum::Right, "Disguise", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); @@ -378,24 +437,24 @@ void CESP::StorePlayers(CTFPlayer* pLocal) { if (bLocal) { - tCache.m_vText.emplace_back(ESPTextEnum::Right, std::format("Charging {:.0f}%%", Math::RemapVal(pWeapon->As()->m_flChargedDamage(), 0.f, 150.f, 0.f, 100.f)), Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + tCache.m_vText.emplace_back(ESPTextEnum::Right, std::format("Charging {:.0f}%", Math::RemapVal(pWeapon->As()->m_flChargedDamage(), 0.f, 150.f, 0.f, 100.f)), Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); break; } else { - CSniperDot* pPlayerDot = nullptr; - for (auto pDot : H::Entities.GetGroup(EGroupType::MISC_DOTS)) - { - if (pDot->m_hOwnerEntity().Get() == pEntity) + auto GetSniperDot = [](CBaseEntity* pEntity) -> CSniperDot* { - pPlayerDot = pDot->As(); - break; - } - } - if (pPlayerDot) + for (auto pDot : H::Entities.GetGroup(EGroupType::MISC_DOTS)) + { + if (pDot->m_hOwnerEntity().Get() == pEntity) + return pDot->As(); + } + return nullptr; + }; + if (CSniperDot* pPlayerDot = GetSniperDot(pEntity)) { float flChargeTime = std::max(SDK::AttribHookValue(3.f, "mult_sniper_charge_per_sec", pWeapon), 1.5f); - tCache.m_vText.emplace_back(ESPTextEnum::Right, std::format("Charging {:.0f}%%", Math::RemapVal(TICKS_TO_TIME(I::ClientState->m_ClockDriftMgr.m_nServerTick) - pPlayerDot->m_flChargeStartTime() - 0.3f, 0.f, flChargeTime, 0.f, 100.f)), Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + tCache.m_vText.emplace_back(ESPTextEnum::Right, std::format("Charging {:.0f}%", Math::RemapVal(TICKS_TO_TIME(I::ClientState->m_ClockDriftMgr.m_nServerTick) - pPlayerDot->m_flChargeStartTime() - 0.3f, 0.f, flChargeTime, 0.f, 100.f)), Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); break; } } @@ -405,7 +464,7 @@ void CESP::StorePlayers(CTFPlayer* pLocal) case TF_WEAPON_COMPOUND_BOW: if (bLocal) { - tCache.m_vText.emplace_back(ESPTextEnum::Right, std::format("Charging {:.0f}%%", Math::RemapVal(TICKS_TO_TIME(I::ClientState->m_ClockDriftMgr.m_nServerTick) - pWeapon->As()->m_flChargeBeginTime(), 0.f, 1.f, 0.f, 100.f)), Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + tCache.m_vText.emplace_back(ESPTextEnum::Right, std::format("Charging {:.0f}%", Math::RemapVal(TICKS_TO_TIME(I::ClientState->m_ClockDriftMgr.m_nServerTick) - pWeapon->As()->m_flChargeBeginTime(), 0.f, 1.f, 0.f, 100.f)), Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); break; } tCache.m_vText.emplace_back(ESPTextEnum::Right, "Charging", Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); @@ -500,7 +559,7 @@ void CESP::StoreBuildings(CTFPlayer* pLocal) { float flConstructed = pBuilding->m_flPercentageConstructed(); if (flConstructed < 1.f) - tCache.m_vText.emplace_back(ESPTextEnum::Right, std::format("{:.0f}%%", flConstructed * 100.f), Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); + tCache.m_vText.emplace_back(ESPTextEnum::Right, std::format("{:.0f}%", flConstructed * 100.f), Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); if (pBuilding->IsSentrygun() && pBuilding->As()->m_bPlayerControlled()) tCache.m_vText.emplace_back(ESPTextEnum::Right, "Wrangled", Vars::Colors::IndicatorTextBad.Value, Vars::Menu::Theme::Background.Value); @@ -625,9 +684,6 @@ void CESP::StoreProjectiles(CTFPlayer* pLocal) const char* szName = "Projectile"; switch (pEntity->GetClassID()) { - //case ETFClassID::CBaseProjectile: - //case ETFClassID::CBaseGrenade: - //case ETFClassID::CTFWeaponBaseGrenadeProj: case ETFClassID::CTFWeaponBaseMerasmusGrenade: szName = "Bomb"; break; case ETFClassID::CTFGrenadePipebombProjectile: szName = pEntity->As()->HasStickyEffects() ? "Sticky" : "Pipe"; break; case ETFClassID::CTFStunBall: szName = "Baseball"; break; @@ -646,14 +702,9 @@ void CESP::StoreProjectiles(CTFPlayer* pLocal) case ETFClassID::CTFProjectile_SpellSpawnHorde: case ETFClassID::CTFProjectile_SpellSpawnZombie: szName = "Skeleton"; break; case ETFClassID::CTFProjectile_SpellTransposeTeleport: szName = "Teleport"; break; - //case ETFClassID::CTFProjectile_Throwable: - //case ETFClassID::CTFProjectile_ThrowableBrick: - //case ETFClassID::CTFProjectile_ThrowableRepel: szName = "Throwable"; break; case ETFClassID::CTFProjectile_Arrow: szName = pEntity->As()->m_iProjectileType() == TF_PROJECTILE_BUILDING_REPAIR_BOLT ? "Repair" : "Arrow"; break; case ETFClassID::CTFProjectile_GrapplingHook: szName = "Grapple"; break; case ETFClassID::CTFProjectile_HealingBolt: szName = "Heal"; break; - //case ETFClassID::CTFBaseRocket: - //case ETFClassID::CTFFlameRocket: case ETFClassID::CTFProjectile_Rocket: case ETFClassID::CTFProjectile_EnergyBall: case ETFClassID::CTFProjectile_SentryRocket: szName = "Rocket"; break; @@ -663,9 +714,7 @@ void CESP::StoreProjectiles(CTFPlayer* pLocal) case ETFClassID::CTFProjectile_SpellLightningOrb: szName = "Lightning"; break; case ETFClassID::CTFProjectile_SpellKartOrb: szName = "Fist"; break; case ETFClassID::CTFProjectile_Flare: szName = "Flare"; break; - //case ETFClassID::CTFBaseProjectile: case ETFClassID::CTFProjectile_EnergyRing: szName = "Energy"; break; - //case ETFClassID::CTFProjectile_Syringe: szName = "Syringe"; } tCache.m_vText.emplace_back(ESPTextEnum::Top, szName, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value); } diff --git a/Amalgam/src/Features/Visuals/ESP/ESP.h b/Amalgam/src/Features/Visuals/ESP/ESP.h index 82f641c9..66c09f9b 100644 --- a/Amalgam/src/Features/Visuals/ESP/ESP.h +++ b/Amalgam/src/Features/Visuals/ESP/ESP.h @@ -65,4 +65,4 @@ public: void Draw(); }; -ADD_FEATURE(CESP, ESP) \ No newline at end of file +ADD_FEATURE(CESP, ESP); \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/FakeAngle/FakeAngle.h b/Amalgam/src/Features/Visuals/FakeAngle/FakeAngle.h index dcac6d8a..1cd95f91 100644 --- a/Amalgam/src/Features/Visuals/FakeAngle/FakeAngle.h +++ b/Amalgam/src/Features/Visuals/FakeAngle/FakeAngle.h @@ -12,4 +12,4 @@ public: bool bDrawChams = false; }; -ADD_FEATURE(CFakeAngle, FakeAngle) \ No newline at end of file +ADD_FEATURE(CFakeAngle, FakeAngle); \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/Glow/Glow.cpp b/Amalgam/src/Features/Visuals/Glow/Glow.cpp index 5dfbd56a..7d76f4cd 100644 --- a/Amalgam/src/Features/Visuals/Glow/Glow.cpp +++ b/Amalgam/src/Features/Visuals/Glow/Glow.cpp @@ -135,7 +135,7 @@ bool CGlow::GetGlow(CTFPlayer* pLocal, CBaseEntity* pEntity, Glow_t* pGlow, Colo case ETFClassID::CTFBaseBoss: case ETFClassID::CTFTankBoss: case ETFClassID::CZombie: - if (pEntity->m_iTeamNum() == TF_TEAM_BLUE || pEntity->m_iTeamNum() == TF_TEAM_RED) + if (pEntity->IsInValidTeam()) { if (auto pOwner = pEntity->m_hOwnerEntity().Get()) return GetPlayerGlow(pOwner, pEntity, pLocal, pGlow, pColor, Vars::Glow::World::NPCs.Value, Vars::Glow::World::NPCs.Value); diff --git a/Amalgam/src/Features/Visuals/Glow/Glow.h b/Amalgam/src/Features/Visuals/Glow/Glow.h index eb65a688..d9a61202 100644 --- a/Amalgam/src/Features/Visuals/Glow/Glow.h +++ b/Amalgam/src/Features/Visuals/Glow/Glow.h @@ -67,4 +67,4 @@ public: bool m_bRendering = false; }; -ADD_FEATURE(CGlow, Glow) \ No newline at end of file +ADD_FEATURE(CGlow, Glow); \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/Groups/Groups.cpp b/Amalgam/src/Features/Visuals/Groups/Groups.cpp index 47d5e02a..fc1f301a 100644 --- a/Amalgam/src/Features/Visuals/Groups/Groups.cpp +++ b/Amalgam/src/Features/Visuals/Groups/Groups.cpp @@ -150,7 +150,7 @@ bool CGroups::ShouldTarget(Group_t& tGroup, CBaseEntity* pEntity, CTFPlayer* pLo case ETFClassID::CTFBaseBoss: case ETFClassID::CTFTankBoss: case ETFClassID::CZombie: - if (pEntity->m_iTeamNum() == TF_TEAM_BLUE || pEntity->m_iTeamNum() == TF_TEAM_RED) + if (pEntity->IsInValidTeam()) { if (auto pOwner = pEntity->m_hOwnerEntity().Get()) return ShouldTargetOwner(tGroup.m_iTargets & TargetsEnum::NPCs, tGroup, pOwner, pEntity, pLocal); diff --git a/Amalgam/src/Features/Visuals/Groups/Groups.h b/Amalgam/src/Features/Visuals/Groups/Groups.h index 766d9fb4..92d362e2 100644 --- a/Amalgam/src/Features/Visuals/Groups/Groups.h +++ b/Amalgam/src/Features/Visuals/Groups/Groups.h @@ -53,4 +53,4 @@ public: std::vector m_vGroups = {}; // loop through this in reverse so back groups have higher priority }; -ADD_FEATURE(CGroups, Groups) \ No newline at end of file +ADD_FEATURE(CGroups, Groups); \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/Materials/Materials.h b/Amalgam/src/Features/Visuals/Materials/Materials.h index ec2f53b5..1284b049 100644 --- a/Amalgam/src/Features/Visuals/Materials/Materials.h +++ b/Amalgam/src/Features/Visuals/Materials/Materials.h @@ -40,4 +40,4 @@ public: bool m_bLoaded = false; }; -ADD_FEATURE(CMaterials, Materials) \ No newline at end of file +ADD_FEATURE(CMaterials, Materials); \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/Notifications/Notifications.h b/Amalgam/src/Features/Visuals/Notifications/Notifications.h index a586d13c..aa06dc48 100644 --- a/Amalgam/src/Features/Visuals/Notifications/Notifications.h +++ b/Amalgam/src/Features/Visuals/Notifications/Notifications.h @@ -23,4 +23,4 @@ public: void Draw(); }; -ADD_FEATURE(CNotifications, Notifications) \ No newline at end of file +ADD_FEATURE(CNotifications, Notifications); \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/PlayerArrows/PlayerArrows.h b/Amalgam/src/Features/Visuals/PlayerArrows/PlayerArrows.h index f3368d0a..1d6e49fe 100644 --- a/Amalgam/src/Features/Visuals/PlayerArrows/PlayerArrows.h +++ b/Amalgam/src/Features/Visuals/PlayerArrows/PlayerArrows.h @@ -10,4 +10,4 @@ public: void Run(CTFPlayer* pLocal); }; -ADD_FEATURE(CPlayerArrows, PlayerArrows) \ No newline at end of file +ADD_FEATURE(CPlayerArrows, PlayerArrows); \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/PlayerConditions/PlayerConditions.cpp b/Amalgam/src/Features/Visuals/PlayerConditions/PlayerConditions.cpp index 95d9b9dd..bc84362a 100644 --- a/Amalgam/src/Features/Visuals/PlayerConditions/PlayerConditions.cpp +++ b/Amalgam/src/Features/Visuals/PlayerConditions/PlayerConditions.cpp @@ -69,18 +69,21 @@ std::vector CPlayerConditions::Get(CTFPlayer* pEntity) if (pEntity->InCond(TF_COND_MEDIGUN_UBER_BULLET_RESIST) || - pEntity->InCond(TF_COND_MEDIGUN_SMALL_BULLET_RESIST) || pEntity->InCond(TF_COND_BULLET_IMMUNE)) + vConditions.emplace_back("Bullet+"); + else if (pEntity->InCond(TF_COND_MEDIGUN_SMALL_BULLET_RESIST)) vConditions.emplace_back("Bullet"); if (pEntity->InCond(TF_COND_MEDIGUN_UBER_BLAST_RESIST) || - pEntity->InCond(TF_COND_MEDIGUN_SMALL_BLAST_RESIST) || pEntity->InCond(TF_COND_BLAST_IMMUNE)) + vConditions.emplace_back("Blast+"); + else if (pEntity->InCond(TF_COND_MEDIGUN_SMALL_BLAST_RESIST)) vConditions.emplace_back("Blast"); if (pEntity->InCond(TF_COND_MEDIGUN_UBER_FIRE_RESIST) || - pEntity->InCond(TF_COND_MEDIGUN_SMALL_FIRE_RESIST) || pEntity->InCond(TF_COND_FIRE_IMMUNE)) + vConditions.emplace_back("Fire+"); + else if (pEntity->InCond(TF_COND_MEDIGUN_SMALL_FIRE_RESIST)) vConditions.emplace_back("Fire"); diff --git a/Amalgam/src/Features/Visuals/PlayerConditions/PlayerConditions.h b/Amalgam/src/Features/Visuals/PlayerConditions/PlayerConditions.h index 02eadfb5..f4f8ed1c 100644 --- a/Amalgam/src/Features/Visuals/PlayerConditions/PlayerConditions.h +++ b/Amalgam/src/Features/Visuals/PlayerConditions/PlayerConditions.h @@ -8,4 +8,4 @@ public: void Draw(CTFPlayer* pLocal); }; -ADD_FEATURE(CPlayerConditions, PlayerConditions) \ No newline at end of file +ADD_FEATURE(CPlayerConditions, PlayerConditions); \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/Radar/Radar.cpp b/Amalgam/src/Features/Visuals/Radar/Radar.cpp index 883e15b6..fa7780e2 100644 --- a/Amalgam/src/Features/Visuals/Radar/Radar.cpp +++ b/Amalgam/src/Features/Visuals/Radar/Radar.cpp @@ -334,9 +334,9 @@ void CRadar::DrawPoints(CTFPlayer* pLocal) [[fallthrough]]; } case Vars::Radar::Player::IconEnum::Portraits: - if (pPlayer->IsInValidTeam()) + if (int iTeam = pPlayer->IsInValidTeam()) { - H::Draw.Texture(x, y, iSize, iSize, pPlayer->m_iClass() + (pPlayer->m_iTeamNum() == TF_TEAM_RED ? 9 : 18) - 1); + H::Draw.Texture(x, y, iSize, iSize, pPlayer->m_iClass() + (iTeam == TF_TEAM_RED ? 9 : 18) - 1); break; } [[fallthrough]]; diff --git a/Amalgam/src/Features/Visuals/Radar/Radar.h b/Amalgam/src/Features/Visuals/Radar/Radar.h index d4b48e06..f3052a5d 100644 --- a/Amalgam/src/Features/Visuals/Radar/Radar.h +++ b/Amalgam/src/Features/Visuals/Radar/Radar.h @@ -11,4 +11,4 @@ public: void Run(CTFPlayer* pLocal); }; -ADD_FEATURE(CRadar, Radar) \ No newline at end of file +ADD_FEATURE(CRadar, Radar); \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/SpectatorList/SpectatorList.h b/Amalgam/src/Features/Visuals/SpectatorList/SpectatorList.h index b7fa5c7b..8fbb9af8 100644 --- a/Amalgam/src/Features/Visuals/SpectatorList/SpectatorList.h +++ b/Amalgam/src/Features/Visuals/SpectatorList/SpectatorList.h @@ -21,4 +21,4 @@ public: void Draw(CTFPlayer* pLocal); }; -ADD_FEATURE(CSpectatorList, SpectatorList) \ No newline at end of file +ADD_FEATURE(CSpectatorList, SpectatorList); \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/Visuals.cpp b/Amalgam/src/Features/Visuals/Visuals.cpp index b7af3ece..a78bbb4d 100644 --- a/Amalgam/src/Features/Visuals/Visuals.cpp +++ b/Amalgam/src/Features/Visuals/Visuals.cpp @@ -222,13 +222,11 @@ void CVisuals::SplashRadius(CTFPlayer* pLocal) switch (pEntity->GetClassID()) { - case ETFClassID::CBaseGrenade: case ETFClassID::CTFWeaponBaseGrenadeProj: case ETFClassID::CTFWeaponBaseMerasmusGrenade: case ETFClassID::CTFGrenadePipebombProjectile: bShouldDraw = Vars::Visuals::Simulation::SplashRadius.Value & (pEntity->As()->HasStickyEffects() ? Vars::Visuals::Simulation::SplashRadiusEnum::Stickies : Vars::Visuals::Simulation::SplashRadiusEnum::Pipes); break; - case ETFClassID::CTFBaseRocket: case ETFClassID::CTFProjectile_Rocket: case ETFClassID::CTFProjectile_SentryRocket: case ETFClassID::CTFProjectile_EnergyBall: @@ -246,13 +244,11 @@ void CVisuals::SplashRadius(CTFPlayer* pLocal) switch (pEntity->GetClassID()) { - case ETFClassID::CBaseGrenade: case ETFClassID::CTFWeaponBaseGrenadeProj: case ETFClassID::CTFWeaponBaseMerasmusGrenade: case ETFClassID::CTFGrenadePipebombProjectile: pOwner = pEntity->As()->m_hThrower().Get()->As(); break; - case ETFClassID::CTFBaseRocket: case ETFClassID::CTFProjectile_Rocket: case ETFClassID::CTFProjectile_SentryRocket: case ETFClassID::CTFProjectile_EnergyBall: @@ -275,13 +271,11 @@ void CVisuals::SplashRadius(CTFPlayer* pLocal) float flRadius = 146.f; switch (pEntity->GetClassID()) { - case ETFClassID::CBaseGrenade: case ETFClassID::CTFWeaponBaseGrenadeProj: case ETFClassID::CTFWeaponBaseMerasmusGrenade: case ETFClassID::CTFGrenadePipebombProjectile: pWeapon = pEntity->As()->m_hOriginalLauncher().Get()->As(); break; - case ETFClassID::CTFBaseRocket: case ETFClassID::CTFProjectile_Rocket: case ETFClassID::CTFProjectile_SentryRocket: case ETFClassID::CTFProjectile_EnergyBall: @@ -335,12 +329,6 @@ void CVisuals::DrawAntiAim(CTFPlayer* pLocal) } } -void CVisuals::DrawSightlines() -{ - for (auto& tSightline : m_vSightLines) - H::Draw.RenderLine(tSightline.m_vStart, tSightline.m_vEnd, tSightline.m_Color, tSightline.m_bZBuffer); -} - void CVisuals::DrawPickupTimers() { if (!Vars::ESP::Other::PickupTimers.Value) @@ -359,9 +347,8 @@ void CVisuals::DrawPickupTimers() Vec3 vScreen; if (SDK::W2S(tPickup.Location, vScreen)) { - auto sText = std::format("{:.1f}s", 10.f - flTime); auto tColor = tPickup.Type ? Vars::Colors::Health.Value : Vars::Colors::Ammo.Value; - H::Draw.StringOutlined(H::Fonts.GetFont(FONT_ESP), vScreen.x, vScreen.y, tColor, Vars::Menu::Theme::Background.Value, ALIGN_CENTER, sText.c_str()); + H::Draw.StringOutlined(H::Fonts.GetFont(FONT_ESP), vScreen.x, vScreen.y, tColor, Vars::Menu::Theme::Background.Value, ALIGN_CENTER, std::format("{:.1f}s", 10.f - flTime).c_str()); } it++; @@ -531,19 +518,15 @@ std::vector CVisuals::GetHitboxes(matrix3x4* aBones, CBaseAnimating* return vBoxes; } -void CVisuals::DrawLines() +void CVisuals::DrawEffects() { for (auto& tLine : G::LineStorage) { if (tLine.m_flTime < I::GlobalVars->curtime) continue; - H::Draw.RenderLine(tLine.m_vPair.first, tLine.m_vPair.second, tLine.m_tColor, tLine.m_bZBuffer); + H::Draw.RenderLine(tLine.m_vOrigin.first, tLine.m_vOrigin.second, tLine.m_tColor, tLine.m_bZBuffer); } -} - -void CVisuals::DrawPaths() -{ for (auto& tPath : G::PathStorage) { if (tPath.m_flTime >= 0.f && tPath.m_flTime < I::GlobalVars->curtime) @@ -551,18 +534,31 @@ void CVisuals::DrawPaths() H::Draw.RenderPath(tPath.m_vPath, tPath.m_tColor, tPath.m_bZBuffer, tPath.m_iStyle, tPath.m_flTime); } -} - -void CVisuals::DrawBoxes() -{ for (auto& tBox : G::BoxStorage) { if (tBox.m_flTime < I::GlobalVars->curtime) continue; - H::Draw.RenderBox(tBox.m_vPos, tBox.m_vMins, tBox.m_vMaxs, tBox.m_vRotation, tBox.m_tColorFace, tBox.m_bZBuffer); - H::Draw.RenderWireframeBox(tBox.m_vPos, tBox.m_vMins, tBox.m_vMaxs, tBox.m_vRotation, tBox.m_tColorEdge, tBox.m_bZBuffer); + H::Draw.RenderBox(tBox.m_vOrigin, tBox.m_vMins, tBox.m_vMaxs, tBox.m_vAngles, tBox.m_tColorFace, tBox.m_bZBuffer); + H::Draw.RenderWireframeBox(tBox.m_vOrigin, tBox.m_vMins, tBox.m_vMaxs, tBox.m_vAngles, tBox.m_tColorEdge, tBox.m_bZBuffer); } + for (auto& tBox : G::SphereStorage) + { + if (tBox.m_flTime < I::GlobalVars->curtime) + continue; + + H::Draw.RenderSphere(tBox.m_vOrigin, tBox.m_flRadius, tBox.m_nTheta, tBox.m_nPhi, tBox.m_tColorFace, tBox.m_bZBuffer); + H::Draw.RenderWireframeSphere(tBox.m_vOrigin, tBox.m_flRadius, tBox.m_nTheta, tBox.m_nPhi, tBox.m_tColorEdge, tBox.m_bZBuffer); + } + for (auto& tBox : G::SweptStorage) + { + if (tBox.m_flTime < I::GlobalVars->curtime) + continue; + + H::Draw.RenderWireframeSweptBox(tBox.m_vOrigin.first, tBox.m_vOrigin.second, tBox.m_vMins, tBox.m_vMaxs, tBox.m_vAngles, tBox.m_tColor, tBox.m_bZBuffer); + } + for (auto& tSightline : m_vSightLines) + H::Draw.RenderLine(tSightline.m_vStart, tSightline.m_vEnd, tSightline.m_Color, tSightline.m_bZBuffer); } void CVisuals::DrawServerHitboxes(CTFPlayer* pLocal) @@ -728,7 +724,18 @@ void CVisuals::Event(IGameEvent* pEvent, uint32_t uHash) m_vPickups.emplace_back(1, I::EngineClient->Time(), pEntity->m_vecOrigin()); else if (std::strstr(sItemName, "ammopack")) m_vPickups.emplace_back(0, I::EngineClient->Time(), pEntity->m_vecOrigin()); + + break; } + case FNV1A::Hash32Const("client_disconnect"): + case FNV1A::Hash32Const("client_beginconnect"): + case FNV1A::Hash32Const("game_newmap"): + case FNV1A::Hash32Const("teamplay_round_start"): + G::LineStorage.clear(); + G::BoxStorage.clear(); + G::PathStorage.clear(); + G::SphereStorage.clear(); + G::SweptStorage.clear(); } } @@ -894,7 +901,18 @@ void CVisuals::RestoreWorldModulation() void CVisuals::CreateMove(CTFPlayer* pLocal, CTFWeaponBase* pWeapon) { if (Vars::Visuals::Simulation::ShotPath.Value && G::Attacking == 1 && !F::Aimbot.m_bRan) - F::Visuals.ProjectileTrace(pLocal, pWeapon, false); + { + switch (pWeapon->GetWeaponID()) + { + case TF_WEAPON_BAT_WOOD: + case TF_WEAPON_BAT_GIFTWRAP: + if (!G::Throwing) + break; + [[fallthrough]]; + default: + F::Visuals.ProjectileTrace(pLocal, pWeapon, false); + } + } if (pLocal && Vars::Visuals::Effects::SpellFootsteps.Value && (F::Ticks.m_bDoubletap || F::Ticks.m_bWarp)) S::CTFPlayer_FireEvent.Call(pLocal, pLocal->GetAbsOrigin(), QAngle(), 7001, nullptr); diff --git a/Amalgam/src/Features/Visuals/Visuals.h b/Amalgam/src/Features/Visuals/Visuals.h index 66104af3..fea95bcd 100644 --- a/Amalgam/src/Features/Visuals/Visuals.h +++ b/Amalgam/src/Features/Visuals/Visuals.h @@ -32,14 +32,11 @@ public: void ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const bool bQuick = true); void SplashRadius(CTFPlayer* pLocal); void DrawAntiAim(CTFPlayer* pLocal); - void DrawSightlines(); void DrawPickupTimers(); void DrawDebugInfo(CTFPlayer* pLocal); std::vector GetHitboxes(matrix3x4* aBones, CBaseAnimating* pEntity, std::vector vHitboxes = {}, int iTarget = -1); - void DrawLines(); - void DrawPaths(); - void DrawBoxes(); + void DrawEffects(); void DrawServerHitboxes(CTFPlayer* pLocal); void FOV(CTFPlayer* pLocal, CViewSetup* pView); @@ -52,4 +49,4 @@ public: void CreateMove(CTFPlayer* pLocal, CTFWeaponBase* pWeapon); }; -ADD_FEATURE(CVisuals, Visuals) \ No newline at end of file +ADD_FEATURE(CVisuals, Visuals); \ No newline at end of file diff --git a/Amalgam/src/Hooks/CBaseEntity_SetAbsVelocity.cpp b/Amalgam/src/Hooks/CBaseEntity_SetAbsVelocity.cpp index 632bf9d6..a20d162c 100644 --- a/Amalgam/src/Hooks/CBaseEntity_SetAbsVelocity.cpp +++ b/Amalgam/src/Hooks/CBaseEntity_SetAbsVelocity.cpp @@ -76,7 +76,7 @@ MAKE_HOOK(CBaseEntity_SetAbsVelocity, S::CBaseEntity_SetAbsVelocity(), void, return CALL_ORIGINAL(rcx, vecAbsVelocity); auto& tOldRecord = pRecords->front(); - auto tNewRecord = VelFixRecord(pPlayer->m_vecOrigin() + Vec3(0, 0, pPlayer->m_vecMaxs().z - pPlayer->m_vecMins().z), pPlayer->m_flSimulationTime()); + auto tNewRecord = VelFixRecord(pPlayer->m_vecOrigin() + Vec3(0, 0, pPlayer->GetSize().z), pPlayer->m_flSimulationTime()); int iDeltaTicks = TIME_TO_TICKS(tNewRecord.m_flSimulationTime - tOldRecord.m_flSimulationTime); float flDeltaTime = TICKS_TO_TIME(iDeltaTicks); diff --git a/Amalgam/src/Hooks/CBasePlayer_CalcViewModelView.cpp b/Amalgam/src/Hooks/CBasePlayer_CalcViewModelView.cpp index d2cd7d28..26afba13 100644 --- a/Amalgam/src/Hooks/CBasePlayer_CalcViewModelView.cpp +++ b/Amalgam/src/Hooks/CBasePlayer_CalcViewModelView.cpp @@ -56,7 +56,7 @@ MAKE_HOOK(CBasePlayer_CalcViewModelView, S::CBasePlayer_CalcViewModelView(), voi CALL_ORIGINAL(rcx, pOwner, vNewEyePosition, vEyeAngles); } -MAKE_HOOK(ClientModeTFNormal_GetViewModelFOV, U::Memory.GetVFunc(I::ClientModeShared, 32), float, +MAKE_HOOK(ClientModeTFNormal_GetViewModelFOV, U::Memory.GetVirtual(I::ClientModeShared, 32), float, /*void* rcx*/) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp b/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp index 0290e609..ca613271 100644 --- a/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp +++ b/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp @@ -30,7 +30,7 @@ struct CmdHistory_t MAKE_SIGNATURE(IHasGenericMeter_GetMeterMultiplier, "client.dll", "F3 0F 10 81 ? ? ? ? C3 CC CC CC CC CC CC CC 48 85 D2", 0x0); -MAKE_HOOK(CClientModeShared_CreateMove, U::Memory.GetVFunc(I::ClientModeShared, 21), bool, +MAKE_HOOK(CClientModeShared_CreateMove, U::Memory.GetVirtual(I::ClientModeShared, 21), bool, CClientModeShared* rcx, float flInputSampleTime, CUserCmd* pCmd) { #ifdef DEBUG_HOOKS @@ -66,34 +66,17 @@ MAKE_HOOK(CClientModeShared_CreateMove, U::Memory.GetVFunc(I::ClientModeShared, auto pWeapon = H::Entities.GetWeapon(); if (pLocal && pWeapon) { // update weapon info + G::CanPrimaryAttack = G::CanSecondaryAttack = G::Reloading = false; + + bool bCanAttack = pLocal->CanAttack(); { static int iStaticItemDefinitionIndex = 0; int iOldItemDefinitionIndex = iStaticItemDefinitionIndex; int iNewItemDefinitionIndex = iStaticItemDefinitionIndex = pWeapon->m_iItemDefinitionIndex(); - if (iNewItemDefinitionIndex != iOldItemDefinitionIndex || !pWeapon->m_iClip1() || !pLocal->IsAlive() || pLocal->IsAGhost() || pLocal->IsTaunting() || pLocal->InCond(TF_COND_PHASE) || pLocal->InCond(TF_COND_HALLOWEEN_KART)) + if (iNewItemDefinitionIndex != iOldItemDefinitionIndex || !bCanAttack || !pWeapon->m_iClip1()) F::Ticks.m_iWait = 1; } - - G::CanPrimaryAttack = G::CanSecondaryAttack = G::Reloading = false; - bool bCanAttack = pLocal->CanAttack(); - switch (SDK::GetRoundState()) - { - case GR_STATE_TEAM_WIN: - if (pLocal->m_iTeamNum() != SDK::GetWinningTeam()) - bCanAttack = false; - break; - case GR_STATE_BETWEEN_RNDS: - if (pLocal->m_fFlags() & FL_FROZEN) - bCanAttack = false; - break; - case GR_STATE_GAME_OVER: - if (pLocal->m_fFlags() & FL_FROZEN || pLocal->m_iTeamNum() != SDK::GetWinningTeam()) - bCanAttack = false; - break; - } - if (pLocal->InCond(TF_COND_STUNNED) && pLocal->m_iStunFlags() & (TF_STUN_CONTROLS | TF_STUN_LOSER_STATE)) - bCanAttack = false; if (bCanAttack) { G::CanPrimaryAttack = pWeapon->CanPrimaryAttack(); diff --git a/Amalgam/src/Hooks/CClientModeShared_DoPostScreenSpaceEffects.cpp b/Amalgam/src/Hooks/CClientModeShared_DoPostScreenSpaceEffects.cpp index be1a9276..df1bf1ce 100644 --- a/Amalgam/src/Hooks/CClientModeShared_DoPostScreenSpaceEffects.cpp +++ b/Amalgam/src/Hooks/CClientModeShared_DoPostScreenSpaceEffects.cpp @@ -6,7 +6,7 @@ #include "../Features/Visuals/Visuals.h" #include "../Features/Visuals/Materials/Materials.h" -MAKE_HOOK(CClientModeShared_DoPostScreenSpaceEffects, U::Memory.GetVFunc(I::ClientModeShared, 39), bool, +MAKE_HOOK(CClientModeShared_DoPostScreenSpaceEffects, U::Memory.GetVirtual(I::ClientModeShared, 39), bool, void* rcx, const CViewSetup* pSetup) { #ifdef DEBUG_HOOKS @@ -29,11 +29,7 @@ MAKE_HOOK(CClientModeShared_DoPostScreenSpaceEffects, U::Memory.GetVFunc(I::Clie if (F::CameraWindow.m_bDrawing) return CALL_ORIGINAL(rcx, pSetup); - F::Visuals.DrawBoxes(); - F::Visuals.DrawPaths(); - F::Visuals.DrawLines(); - F::Visuals.DrawSightlines(); - + F::Visuals.DrawEffects(); F::Chams.m_mEntities.clear(); if (!I::EngineVGui->IsGameUIVisible() && pLocal && F::Materials.m_bLoaded) { diff --git a/Amalgam/src/Hooks/CClientModeShared_OverrideView.cpp b/Amalgam/src/Hooks/CClientModeShared_OverrideView.cpp index d177ccc0..b1d14377 100644 --- a/Amalgam/src/Hooks/CClientModeShared_OverrideView.cpp +++ b/Amalgam/src/Hooks/CClientModeShared_OverrideView.cpp @@ -2,7 +2,7 @@ #include "../Features/Visuals/Visuals.h" -MAKE_HOOK(CClientModeShared_OverrideView, U::Memory.GetVFunc(I::ClientModeShared, 16), void, +MAKE_HOOK(CClientModeShared_OverrideView, U::Memory.GetVirtual(I::ClientModeShared, 16), void, void* rcx, CViewSetup* pView) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/CClientModeShared_ShouldDrawViewModel.cpp b/Amalgam/src/Hooks/CClientModeShared_ShouldDrawViewModel.cpp index 3ba0035f..186866d6 100644 --- a/Amalgam/src/Hooks/CClientModeShared_ShouldDrawViewModel.cpp +++ b/Amalgam/src/Hooks/CClientModeShared_ShouldDrawViewModel.cpp @@ -2,7 +2,7 @@ #include "../Features/Visuals/Visuals.h" -MAKE_HOOK(CClientModeShared_ShouldDrawViewModel, U::Memory.GetVFunc(I::ClientModeShared, 24), bool, +MAKE_HOOK(CClientModeShared_ShouldDrawViewModel, U::Memory.GetVirtual(I::ClientModeShared, 24), bool, void* rcx) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/CHudCrosshair_GetDrawPosition.cpp b/Amalgam/src/Hooks/CHudCrosshair_GetDrawPosition.cpp index 5dbbfea7..c51e752f 100644 --- a/Amalgam/src/Hooks/CHudCrosshair_GetDrawPosition.cpp +++ b/Amalgam/src/Hooks/CHudCrosshair_GetDrawPosition.cpp @@ -38,7 +38,7 @@ MAKE_HOOK(CHudCrosshair_GetDrawPosition, S::CHudCrosshair_GetDrawPosition(), voi Vec3 vForward; Math::AngleVectors(vAngles, &vForward); Vec3 vStartPos = pLocal->GetEyePosition(); - Vec3 vEndPos = (vStartPos + vForward * 8192); + Vec3 vEndPos = vStartPos + vForward * 8192; CGameTrace trace = {}; CTraceFilterHitscan filter = {}; filter.pSkip = pLocal; diff --git a/Amalgam/src/Hooks/CStudioRender_DrawModelStaticProp.cpp b/Amalgam/src/Hooks/CStudioRender_DrawModelStaticProp.cpp index 791fea5e..c1d3b78c 100644 --- a/Amalgam/src/Hooks/CStudioRender_DrawModelStaticProp.cpp +++ b/Amalgam/src/Hooks/CStudioRender_DrawModelStaticProp.cpp @@ -1,6 +1,6 @@ #include "../SDK/SDK.h" -MAKE_HOOK(CStudioRender_DrawModelStaticProp, U::Memory.GetVFunc(I::StudioRender, 30), void, +MAKE_HOOK(CStudioRender_DrawModelStaticProp, U::Memory.GetVirtual(I::StudioRender, 30), void, void* rcx, const DrawModelState_t& pState, const matrix3x4& modelToWorld, int flags) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/CStudioRender_SetAlphaModulation.cpp b/Amalgam/src/Hooks/CStudioRender_SetAlphaModulation.cpp index 8b49182e..b3cc7777 100644 --- a/Amalgam/src/Hooks/CStudioRender_SetAlphaModulation.cpp +++ b/Amalgam/src/Hooks/CStudioRender_SetAlphaModulation.cpp @@ -1,6 +1,6 @@ #include "../SDK/SDK.h" -MAKE_HOOK(CStudioRender_SetAlphaModulation, U::Memory.GetVFunc(I::StudioRender, 28), void, +MAKE_HOOK(CStudioRender_SetAlphaModulation, U::Memory.GetVirtual(I::StudioRender, 28), void, void* rcx, float flAlpha) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/CStudioRender_SetColorModulation.cpp b/Amalgam/src/Hooks/CStudioRender_SetColorModulation.cpp index de2c755b..886a1923 100644 --- a/Amalgam/src/Hooks/CStudioRender_SetColorModulation.cpp +++ b/Amalgam/src/Hooks/CStudioRender_SetColorModulation.cpp @@ -1,6 +1,6 @@ #include "../SDK/SDK.h" -MAKE_HOOK(CStudioRender_SetColorModulation, U::Memory.GetVFunc(I::StudioRender, 27), void, +MAKE_HOOK(CStudioRender_SetColorModulation, U::Memory.GetVirtual(I::StudioRender, 27), void, void* rcx, const float* pColor) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/CTFPlayerInventory_GetMaxItemCount.cpp b/Amalgam/src/Hooks/CTFPlayerInventory_GetMaxItemCount.cpp index 8042cf4b..c3ed0ba7 100644 --- a/Amalgam/src/Hooks/CTFPlayerInventory_GetMaxItemCount.cpp +++ b/Amalgam/src/Hooks/CTFPlayerInventory_GetMaxItemCount.cpp @@ -10,5 +10,5 @@ MAKE_HOOK(CTFPlayerInventory_GetMaxItemCount, S::CTFPlayerInventory_GetMaxItemCo return CALL_ORIGINAL(rcx); #endif - return !Vars::Misc::Automation::BackpackExpander.Value ? CALL_ORIGINAL(rcx) : 4000; + return !Vars::Misc::Exploits::BackpackExpander.Value ? CALL_ORIGINAL(rcx) : 4000; } \ No newline at end of file diff --git a/Amalgam/src/Hooks/CBaseEntity_FireBullets.cpp b/Amalgam/src/Hooks/CTFPlayer_FireBullet.cpp similarity index 84% rename from Amalgam/src/Hooks/CBaseEntity_FireBullets.cpp rename to Amalgam/src/Hooks/CTFPlayer_FireBullet.cpp index 2a6840be..38377a1d 100644 --- a/Amalgam/src/Hooks/CBaseEntity_FireBullets.cpp +++ b/Amalgam/src/Hooks/CTFPlayer_FireBullet.cpp @@ -2,42 +2,39 @@ #include "../Features/Visuals/Visuals.h" -MAKE_SIGNATURE(CBaseEntity_FireBullets, "client.dll", "48 89 74 24 ? 55 57 41 55 41 56 41 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? F3 41 0F 10 58", 0x0); +MAKE_SIGNATURE(CTFPlayer_FireBullet, "client.dll", "48 89 74 24 ? 55 57 41 55 41 56 41 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? F3 41 0F 10 58", 0x0); -MAKE_HOOK(CBaseEntity_FireBullets, S::CBaseEntity_FireBullets(), void, +MAKE_HOOK(CTFPlayer_FireBullet, S::CTFPlayer_FireBullet(), void, void* rcx, CBaseCombatWeapon* pWeapon, const FireBulletsInfo_t& info, bool bDoEffects, int nDamageType, int nCustomDamageType) { #ifdef DEBUG_HOOKS - if (!Vars::Hooks::CBaseEntity_FireBullets[DEFAULT_BIND]) + if (!Vars::Hooks::CTFPlayer_FireBullet[DEFAULT_BIND]) return CALL_ORIGINAL(rcx, pWeapon, info, nDamageType, nDamageType, nCustomDamageType); #endif - auto pLocal = H::Entities.GetLocal(); - auto pPlayer = reinterpret_cast(rcx); - if (!pLocal || pPlayer != pLocal) + auto pLocal = reinterpret_cast(rcx); + if (pLocal != H::Entities.GetLocal() || !pWeapon) return CALL_ORIGINAL(rcx, pWeapon, info, bDoEffects, nDamageType, nCustomDamageType); + auto& sString = nDamageType & DMG_CRITICAL ? Vars::Visuals::Effects::CritTracer.Value : Vars::Visuals::Effects::BulletTracer.Value; + auto uHash = FNV1A::Hash32(sString.c_str()); + if (uHash == FNV1A::Hash32Const("Default")) + return CALL_ORIGINAL(rcx, pWeapon, info, bDoEffects, nDamageType, nCustomDamageType); + else if (uHash == FNV1A::Hash32Const("None")) + return; + const Vec3 vStart = info.m_vecSrc; const Vec3 vEnd = vStart + info.m_vecDirShooting * info.m_flDistance; CGameTrace trace = {}; CTraceFilterHitscan filter = {}; filter.pSkip = pLocal; SDK::Trace(vStart, vEnd, MASK_SHOT | CONTENTS_GRATE, &filter, &trace); + const int iTeam = pLocal->m_iTeamNum(); const int iAttachment = pWeapon->LookupAttachment("muzzle"); pWeapon->GetAttachment(iAttachment, trace.startpos); - const bool bCrit = nDamageType & DMG_CRITICAL || pLocal->IsCritBoosted(); - const int iTeam = pLocal->m_iTeamNum(); - - auto& sString = bCrit ? Vars::Visuals::Effects::CritTracer.Value : Vars::Visuals::Effects::BulletTracer.Value; - auto uHash = FNV1A::Hash32(sString.c_str()); - if (!pLocal->IsInValidTeam() || uHash == FNV1A::Hash32Const("Default")) - return CALL_ORIGINAL(rcx, pWeapon, info, bDoEffects, nDamageType, nCustomDamageType); - switch (uHash) { - case FNV1A::Hash32Const("None"): - return; case FNV1A::Hash32Const("Big nasty"): H::Particles.ParticleTracer(iTeam == TF_TEAM_RED ? "bullet_bignasty_tracer01_blue" : "bullet_bignasty_tracer01_red", trace.startpos, trace.endpos, pLocal->entindex(), iAttachment, true); break; @@ -89,7 +86,7 @@ MAKE_HOOK(CBaseEntity_FireBullets, S::CBaseEntity_FireBullets(), void, { BeamInfo_t beamInfo; beamInfo.m_nType = 0; - beamInfo.m_pszModelName = FNV1A::Hash32(Vars::Visuals::Beams::Model.Value.c_str()) != FNV1A::Hash32Const("") ? Vars::Visuals::Beams::Model.Value.c_str() : "sprites/physbeam.vmt"; + beamInfo.m_pszModelName = !Vars::Visuals::Beams::Model.Value.empty() ? Vars::Visuals::Beams::Model.Value.c_str() : "sprites/physbeam.vmt"; beamInfo.m_nModelIndex = -1; // will be set by CreateBeamPoints if its -1 beamInfo.m_flHaloScale = 0.0f; beamInfo.m_flLife = Vars::Visuals::Beams::Life.Value; diff --git a/Amalgam/src/Hooks/CTFRocketLauncher_CheckReloadMisfire.cpp b/Amalgam/src/Hooks/CTFRocketLauncher_CheckReloadMisfire.cpp new file mode 100644 index 00000000..9d94f8c8 --- /dev/null +++ b/Amalgam/src/Hooks/CTFRocketLauncher_CheckReloadMisfire.cpp @@ -0,0 +1,55 @@ +#include "../SDK/SDK.h" + +MAKE_SIGNATURE(CTFRocketLauncher_CheckReloadMisfire, "client.dll", "48 83 EC ? E8 ? ? ? ? 32 C0", 0x0); +MAKE_SIGNATURE(CTFRocketLauncher_FireProjectile, "client.dll", "48 89 74 24 ? 57 48 81 EC ? ? ? ? 48 8B FA 48 89 9C 24", 0x0); + +MAKE_HOOK(CTFRocketLauncher_CheckReloadMisfire, S::CTFRocketLauncher_CheckReloadMisfire(), bool, + void* rcx) +{ + auto pWeapon = reinterpret_cast(rcx); + if (!SDK::AttribHookValue(0, "can_overload", pWeapon)) + return false; + + auto pPlayer = pWeapon->m_hOwner().Get()->As(); + int iClip1 = pWeapon->m_iClip1(); + if (pWeapon->m_bRemoveable()) // just using this var since it's in the datamap and doesn't seem to be used on the client + { + if (iClip1 > 0) + { + pWeapon->CalcIsAttackCritical(); + return true; + } + else + pWeapon->m_bRemoveable() = false; + } + else if (iClip1 >= pWeapon->GetMaxClip1() || iClip1 > 0 && pPlayer && pPlayer->GetAmmoCount(pWeapon->m_iPrimaryAmmoType()) == 0) + { + pWeapon->CalcIsAttackCritical(); + pWeapon->m_bRemoveable() = true; + return true; + } + + return false; +} + +MAKE_HOOK(CTFRocketLauncher_FireProjectile, S::CTFRocketLauncher_FireProjectile(), CBaseEntity*, + void* rcx, CTFPlayer* pPlayer) +{ + auto pWeapon = reinterpret_cast(rcx); + pWeapon->m_bRemoveable() = false; + return CALL_ORIGINAL(rcx, pPlayer); +} + +// more accurate way to track this? either way doesn't matter too much +/* +MAKE_SIGNATURE(CTFBat_Wood_LaunchBall, "client.dll", "40 53 48 83 EC ? 48 8B D9 E8 ? ? ? ? 48 85 C0 74 ? 48 8B CB 48 83 C4 ? 5B E9 ? ? ? ? 48 83 C4 ? 5B C3 CC CC CC CC CC CC CC CC CC CC 48 89 5C 24", 0x0); + +MAKE_HOOK(CTFBat_Wood_LaunchBall, S::CTFBat_Wood_LaunchBall(), void, + void* rcx) +{ + auto pWeapon = reinterpret_cast(rcx); + pWeapon->CalcIsAttackCritical(); + + return CALL_ORIGINAL(rcx); +} +*/ \ No newline at end of file diff --git a/Amalgam/src/Hooks/CTFWeaponBase_CalcIsAttackCritical.cpp b/Amalgam/src/Hooks/CTFWeaponBase_CalcIsAttackCritical.cpp index 998a9ae1..ffd33a27 100644 --- a/Amalgam/src/Hooks/CTFWeaponBase_CalcIsAttackCritical.cpp +++ b/Amalgam/src/Hooks/CTFWeaponBase_CalcIsAttackCritical.cpp @@ -2,8 +2,6 @@ #include "../Features/CritHack/CritHack.h" -MAKE_SIGNATURE(CTFWeaponBase_CalcIsAttackCritical, "client.dll", "48 89 74 24 ? 57 48 83 EC ? 48 8B F9 E8 ? ? ? ? 48 8B C8 C7 44 24 ? ? ? ? ? 4C 8D 0D ? ? ? ? 33 D2 4C 8D 05 ? ? ? ? E8 ? ? ? ? 48 8B F0 48 85 C0 0F 84 ? ? ? ? 48 8B 10", 0x0); - MAKE_HOOK(CTFWeaponBase_CalcIsAttackCritical, S::CTFWeaponBase_CalcIsAttackCritical(), void, void* rcx) { @@ -12,16 +10,14 @@ MAKE_HOOK(CTFWeaponBase_CalcIsAttackCritical, S::CTFWeaponBase_CalcIsAttackCriti return CALL_ORIGINAL(rcx); #endif - auto pLocal = H::Entities.GetLocal(); auto pWeapon = H::Entities.GetWeapon(); - if (!pLocal || !pWeapon || pWeapon != rcx) + if (pWeapon != rcx) CALL_ORIGINAL(rcx); - - if (!F::CritHack.CalcIsAttackCriticalHandler(pLocal, pWeapon)) - return; - - const auto nPreviousWeaponMode = pWeapon->m_iWeaponMode(); - pWeapon->m_iWeaponMode() = 0; - CALL_ORIGINAL(rcx); - pWeapon->m_iWeaponMode() = nPreviousWeaponMode; + else if (F::CritHack.CalcIsAttackCriticalHandler()) + { + const auto nPreviousWeaponMode = pWeapon->m_iWeaponMode(); + pWeapon->m_iWeaponMode() = TF_WEAPON_PRIMARY_MODE; + CALL_ORIGINAL(rcx); + pWeapon->m_iWeaponMode() = nPreviousWeaponMode; + } } \ No newline at end of file diff --git a/Amalgam/src/Hooks/CViewRender_LevelInit.cpp b/Amalgam/src/Hooks/CViewRender_LevelInit.cpp index b88cddaa..64457253 100644 --- a/Amalgam/src/Hooks/CViewRender_LevelInit.cpp +++ b/Amalgam/src/Hooks/CViewRender_LevelInit.cpp @@ -9,7 +9,7 @@ #include "../Features/Resolver/Resolver.h" #include "../Features/Spectate/Spectate.h" -MAKE_HOOK(CViewRender_LevelInit, U::Memory.GetVFunc(I::ViewRender, 1), void, +MAKE_HOOK(CViewRender_LevelInit, U::Memory.GetVirtual(I::ViewRender, 1), void, void* rcx) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/CViewRender_LevelShutdown.cpp b/Amalgam/src/Hooks/CViewRender_LevelShutdown.cpp index 8c033ea5..16c154c5 100644 --- a/Amalgam/src/Hooks/CViewRender_LevelShutdown.cpp +++ b/Amalgam/src/Hooks/CViewRender_LevelShutdown.cpp @@ -2,7 +2,7 @@ #include "../Features/Spectate/Spectate.h" -MAKE_HOOK(CViewRender_LevelShutdown, U::Memory.GetVFunc(I::ViewRender, 2), void, +MAKE_HOOK(CViewRender_LevelShutdown, U::Memory.GetVirtual(I::ViewRender, 2), void, void* rcx) { F::Spectate.m_iIntendedTarget = -1; diff --git a/Amalgam/src/Hooks/CViewRender_RenderView.cpp b/Amalgam/src/Hooks/CViewRender_RenderView.cpp index 756e56ff..d00c65af 100644 --- a/Amalgam/src/Hooks/CViewRender_RenderView.cpp +++ b/Amalgam/src/Hooks/CViewRender_RenderView.cpp @@ -2,7 +2,7 @@ #include "../Features/Visuals/CameraWindow/CameraWindow.h" -MAKE_HOOK(CViewRender_RenderView, U::Memory.GetVFunc(I::ViewRender, 6), void, +MAKE_HOOK(CViewRender_RenderView, U::Memory.GetVirtual(I::ViewRender, 6), void, void* rcx, const CViewSetup& view, ClearFlags_t nClearFlags, RenderViewInfo_t whatToDraw) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp b/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp index d26b3bb1..56e23be2 100644 --- a/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp +++ b/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp @@ -13,7 +13,7 @@ enum cmd_source_t static std::string sCmdString; -#define PRE_STR "\x07\x07\x07\x07\x07\x07\x07" +#define PRE_STR "\x7\x7\x7\x7\x7\x7\x7" static std::vector> vStatic = { { "\\x1", "\x1" }, { "\\x01", "\x1" }, @@ -43,6 +43,7 @@ static std::vector> vStatic = { { "\\{orange}", PRE_STR"\x7""ff7000" }, { "\\{purple}", PRE_STR"\x7""7f00ff" }, { "\\{brown}", PRE_STR"\x7""583927" }, + { "\\{gold}", PRE_STR"\x7""c8a900" }, { "\\{gray}", PRE_STR"\x7""cccccc" }, { "\\{black}", PRE_STR"\x7""000000" }, { "\\{bluteam}", PRE_STR"\x7""99ccff" }, diff --git a/Amalgam/src/Hooks/Direct3DDevice9.cpp b/Amalgam/src/Hooks/Direct3DDevice9.cpp index e2e88c65..9a3924f0 100644 --- a/Amalgam/src/Hooks/Direct3DDevice9.cpp +++ b/Amalgam/src/Hooks/Direct3DDevice9.cpp @@ -6,7 +6,7 @@ extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); -MAKE_HOOK(Direct3DDevice9_Present, U::Memory.GetVFunc(I::DirectXDevice, 17), HRESULT, +MAKE_HOOK(Direct3DDevice9_Present, U::Memory.GetVirtual(I::DirectXDevice, 17), HRESULT, IDirect3DDevice9* pDevice, const RECT* pSource, const RECT* pDestination, const RGNDATA* pDirtyRegion) { if (!G::Unload) @@ -15,7 +15,7 @@ MAKE_HOOK(Direct3DDevice9_Present, U::Memory.GetVFunc(I::DirectXDevice, 17), HRE return CALL_ORIGINAL(pDevice, pSource, pDestination, pDirtyRegion); } -MAKE_HOOK(Direct3DDevice9_Reset, U::Memory.GetVFunc(I::DirectXDevice, 16), HRESULT, +MAKE_HOOK(Direct3DDevice9_Reset, U::Memory.GetVirtual(I::DirectXDevice, 16), HRESULT, LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters) { ImGui_ImplDX9_InvalidateDeviceObjects(); @@ -43,7 +43,7 @@ LONG __stdcall WndProc::Func(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return CallWindowProc(Original, hWnd, uMsg, wParam, lParam); } -MAKE_HOOK(VGuiSurface_LockCursor, U::Memory.GetVFunc(I::MatSystemSurface, 62), void, +MAKE_HOOK(VGuiSurface_LockCursor, U::Memory.GetVirtual(I::MatSystemSurface, 62), void, void* rcx) { if (F::Menu.m_bIsOpen) @@ -52,7 +52,7 @@ MAKE_HOOK(VGuiSurface_LockCursor, U::Memory.GetVFunc(I::MatSystemSurface, 62), v CALL_ORIGINAL(rcx); } -MAKE_HOOK(VGuiSurface_SetCursor, U::Memory.GetVFunc(I::MatSystemSurface, 51), void, +MAKE_HOOK(VGuiSurface_SetCursor, U::Memory.GetVirtual(I::MatSystemSurface, 51), void, void* rcx, HCursor cursor) { if (F::Menu.m_bIsOpen) diff --git a/Amalgam/src/Hooks/FX_FireBullets.cpp b/Amalgam/src/Hooks/FX_FireBullets.cpp index b1d4b3a0..0c2bca53 100644 --- a/Amalgam/src/Hooks/FX_FireBullets.cpp +++ b/Amalgam/src/Hooks/FX_FireBullets.cpp @@ -8,7 +8,7 @@ MAKE_SIGNATURE(FX_FireBullets, "client.dll", "48 89 5C 24 ? 48 89 74 24 ? 4C 89 MAKE_SIGNATURE(CTFWeaponBaseGun_FireBullet_FireBullets_Call, "client.dll", "0F 28 7C 24 ? 4C 8D 9C 24 ? ? ? ? 49 8B 5B ? 49 8B 6B ? 49 8B 73 ? 41 0F 28 73 ? 49 8B E3", 0x0); MAKE_HOOK(FX_FireBullets, S::FX_FireBullets(), void, - void* pWpn, int iPlayer, const Vec3& vecOrigin, const Vec3& vecAngles, int iWeapon, int iMode, int iSeed, float flSpread, float flDamage, bool bCritical) + CTFWeaponBase* pWpn, int iPlayer, const Vec3& vecOrigin, const Vec3& vecAngles, int iWeapon, int iMode, int iSeed, float flSpread, float flDamage, bool bCritical) { #ifdef DEBUG_HOOKS if (!Vars::Hooks::FX_FireBullets[DEFAULT_BIND]) @@ -30,7 +30,7 @@ MAKE_HOOK(FX_FireBullets, S::FX_FireBullets(), void, MAKE_SIGNATURE(FX_FireBullets_Server, "server.dll", "48 89 5C 24 ? 4C 89 4C 24 ? 55 56 41 54", 0x0); MAKE_HOOK(FX_FireBullets_Server, S::FX_FireBullets_Server(), void, - void* pWpn, int iPlayer, const Vec3& vecOrigin, const Vec3& vecAngles, int iWeapon, int iMode, int iSeed, float flSpread, float flDamage, bool bCritical) + CTFWeaponBase* pWpn, int iPlayer, const Vec3& vecOrigin, const Vec3& vecAngles, int iWeapon, int iMode, int iSeed, float flSpread, float flDamage, bool bCritical) { #ifdef DEBUG_HOOKS if (!Vars::Hooks::FX_FireBullets[DEFAULT_BIND]) diff --git a/Amalgam/src/Hooks/IBaseClientDLL_DispatchUserMessage.cpp b/Amalgam/src/Hooks/IBaseClientDLL_DispatchUserMessage.cpp index 669f33fb..c1f72d05 100644 --- a/Amalgam/src/Hooks/IBaseClientDLL_DispatchUserMessage.cpp +++ b/Amalgam/src/Hooks/IBaseClientDLL_DispatchUserMessage.cpp @@ -5,8 +5,6 @@ #include "../Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.h" #include "../Features/Misc/AutoVote/AutoVote.h" #include "../Features/Aimbot/AutoHeal/AutoHeal.h" -#include -#include //#define DEBUG_VISUALS #ifdef DEBUG_VISUALS @@ -14,7 +12,7 @@ #include #endif -MAKE_HOOK(IBaseClientDLL_DispatchUserMessage, U::Memory.GetVFunc(I::BaseClientDLL, 36), bool, +MAKE_HOOK(IBaseClientDLL_DispatchUserMessage, U::Memory.GetVirtual(I::BaseClientDLL, 36), bool, void* rcx, UserMessageType type, bf_read& msgData) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/IBaseClientDLL_FrameStageNotify.cpp b/Amalgam/src/Hooks/IBaseClientDLL_FrameStageNotify.cpp index 6a97f61a..578f27a1 100644 --- a/Amalgam/src/Hooks/IBaseClientDLL_FrameStageNotify.cpp +++ b/Amalgam/src/Hooks/IBaseClientDLL_FrameStageNotify.cpp @@ -13,7 +13,7 @@ #include "../Features/Spectate/Spectate.h" #include "../Features/Binds/Binds.h" -MAKE_HOOK(IBaseClientDLL_FrameStageNotify, U::Memory.GetVFunc(I::BaseClientDLL, 35), void, +MAKE_HOOK(IBaseClientDLL_FrameStageNotify, U::Memory.GetVirtual(I::BaseClientDLL, 35), void, void* rcx, ClientFrameStage_t curStage) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/IBaseClientDLL_LevelShutdown.cpp b/Amalgam/src/Hooks/IBaseClientDLL_LevelShutdown.cpp index f39bb01b..1141fe6f 100644 --- a/Amalgam/src/Hooks/IBaseClientDLL_LevelShutdown.cpp +++ b/Amalgam/src/Hooks/IBaseClientDLL_LevelShutdown.cpp @@ -2,7 +2,7 @@ #include "../Features/Misc/Misc.h" -MAKE_HOOK(IBaseClientDLL_LevelShutdown, U::Memory.GetVFunc(I::BaseClientDLL, 7), void, +MAKE_HOOK(IBaseClientDLL_LevelShutdown, U::Memory.GetVirtual(I::BaseClientDLL, 7), void, void* rcx) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/IEngineTrace_SetTraceEntity.cpp b/Amalgam/src/Hooks/IEngineTrace_SetTraceEntity.cpp index 4ac8a282..05a9b169 100644 --- a/Amalgam/src/Hooks/IEngineTrace_SetTraceEntity.cpp +++ b/Amalgam/src/Hooks/IEngineTrace_SetTraceEntity.cpp @@ -38,7 +38,7 @@ struct TraceInfo_t static int iOriginalMask = false; static bool bOriginalStartSolid = false; -MAKE_HOOK(IEngineTrace_SetTraceEntity, U::Memory.GetVFunc(I::EngineTrace, 20), void, +MAKE_HOOK(IEngineTrace_SetTraceEntity, U::Memory.GetVirtual(I::EngineTrace, 20), void, void* rcx, ICollideable* pCollideable, trace_t* pTrace) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/IEngineTrace_TraceRay.cpp b/Amalgam/src/Hooks/IEngineTrace_TraceRay.cpp index 9a8776b2..14fa47d4 100644 --- a/Amalgam/src/Hooks/IEngineTrace_TraceRay.cpp +++ b/Amalgam/src/Hooks/IEngineTrace_TraceRay.cpp @@ -1,7 +1,7 @@ #include "../SDK/SDK.h" #ifdef DEBUG_TRACES -MAKE_HOOK(IEngineTrace_TraceRay, U::Memory.GetVFunc(I::EngineTrace, 4), void, +MAKE_HOOK(IEngineTrace_TraceRay, U::Memory.GetVirtual(I::EngineTrace, 4), void, void* rcx, const Ray_t& ray, unsigned int fMask, ITraceFilter* pTraceFilter, trace_t* pTrace) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/IEngineVGui_Paint.cpp b/Amalgam/src/Hooks/IEngineVGui_Paint.cpp index f00d81ff..775bfa9a 100644 --- a/Amalgam/src/Hooks/IEngineVGui_Paint.cpp +++ b/Amalgam/src/Hooks/IEngineVGui_Paint.cpp @@ -13,8 +13,9 @@ #include "../Features/Visuals/ESP/ESP.h" #include "../Features/Visuals/CameraWindow/CameraWindow.h" #include "../Features/Visuals/Notifications/Notifications.h" +//#include "../Features/Aimbot/AutoHeal/AutoHeal.h" -MAKE_HOOK(IEngineVGui_Paint, U::Memory.GetVFunc(I::EngineVGui, 14), void, +MAKE_HOOK(IEngineVGui_Paint, U::Memory.GetVirtual(I::EngineVGui, 14), void, void* rcx, int iMode) { #ifdef DEBUG_HOOKS @@ -42,6 +43,7 @@ MAKE_HOOK(IEngineVGui_Paint, U::Memory.GetVFunc(I::EngineVGui, 14), void, F::Aimbot.Draw(pLocal); F::Radar.Run(pLocal); + //F::AutoHeal.Draw(pLocal); F::NoSpreadHitscan.Draw(pLocal); F::PlayerConditions.Draw(pLocal); F::Backtrack.Draw(pLocal); diff --git a/Amalgam/src/Hooks/IInput_GetUserCmd.cpp b/Amalgam/src/Hooks/IInput_GetUserCmd.cpp index 6a0b9955..96b87181 100644 --- a/Amalgam/src/Hooks/IInput_GetUserCmd.cpp +++ b/Amalgam/src/Hooks/IInput_GetUserCmd.cpp @@ -1,6 +1,6 @@ #include "../SDK/SDK.h" -MAKE_HOOK(IInput_GetUserCmd, U::Memory.GetVFunc(I::Input, 8), CUserCmd*, +MAKE_HOOK(IInput_GetUserCmd, U::Memory.GetVirtual(I::Input, 8), CUserCmd*, void* rcx, int sequence_number) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/IMatSystemSurface_OnScreenSizeChanged.cpp b/Amalgam/src/Hooks/IMatSystemSurface_OnScreenSizeChanged.cpp index 9df2ae19..723eafee 100644 --- a/Amalgam/src/Hooks/IMatSystemSurface_OnScreenSizeChanged.cpp +++ b/Amalgam/src/Hooks/IMatSystemSurface_OnScreenSizeChanged.cpp @@ -2,7 +2,7 @@ #include "../Features/Visuals/Materials/Materials.h" -MAKE_HOOK(IMatSystemSurface_OnScreenSizeChanged, U::Memory.GetVFunc(I::MatSystemSurface, 111), void, +MAKE_HOOK(IMatSystemSurface_OnScreenSizeChanged, U::Memory.GetVirtual(I::MatSystemSurface, 111), void, void* rcx, int nOldWidth, int nOldHeight) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/IPanel_PaintTraverse.cpp b/Amalgam/src/Hooks/IPanel_PaintTraverse.cpp index 61fed7fa..7b5aea96 100644 --- a/Amalgam/src/Hooks/IPanel_PaintTraverse.cpp +++ b/Amalgam/src/Hooks/IPanel_PaintTraverse.cpp @@ -1,6 +1,6 @@ #include "../SDK/SDK.h" -MAKE_HOOK(IPanel_PaintTraverse, U::Memory.GetVFunc(I::Panel, 41), void, +MAKE_HOOK(IPanel_PaintTraverse, U::Memory.GetVirtual(I::Panel, 41), void, void* rcx, VPANEL vguiPanel, bool forceRepaint, bool allowForce) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/ISteamFriends_GetFriendPersonaName.cpp b/Amalgam/src/Hooks/ISteamFriends_GetFriendPersonaName.cpp index 4fb676c2..168f6207 100644 --- a/Amalgam/src/Hooks/ISteamFriends_GetFriendPersonaName.cpp +++ b/Amalgam/src/Hooks/ISteamFriends_GetFriendPersonaName.cpp @@ -4,7 +4,7 @@ MAKE_SIGNATURE(GetPlayerNameForSteamID_GetFriendPersonaName_Call, "client.dll", "41 B9 ? ? ? ? 44 8B C3 48 8B C8", 0x0); -MAKE_HOOK(ISteamFriends_GetFriendPersonaName, U::Memory.GetVFunc(I::SteamFriends, 7), const char*, +MAKE_HOOK(ISteamFriends_GetFriendPersonaName, U::Memory.GetVirtual(I::SteamFriends, 7), const char*, void* rcx, CSteamID steamIDFriend) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/ISteamNetworkingUtils_GetPingToDataCenter.cpp b/Amalgam/src/Hooks/ISteamNetworkingUtils_GetPingToDataCenter.cpp index b554d15c..8490e6cb 100644 --- a/Amalgam/src/Hooks/ISteamNetworkingUtils_GetPingToDataCenter.cpp +++ b/Amalgam/src/Hooks/ISteamNetworkingUtils_GetPingToDataCenter.cpp @@ -50,7 +50,7 @@ unsigned int GetDatacenter(uint32_t uHash) return 0; } -MAKE_HOOK(ISteamNetworkingUtils_GetPingToDataCenter, U::Memory.GetVFunc(I::SteamNetworkingUtils, 8), int, +MAKE_HOOK(ISteamNetworkingUtils_GetPingToDataCenter, U::Memory.GetVirtual(I::SteamNetworkingUtils, 8), int, void* rcx, SteamNetworkingPOPID popID, SteamNetworkingPOPID* pViaRelayPoP) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/IVEngineClient_ClientCmd_Unrestricted.cpp b/Amalgam/src/Hooks/IVEngineClient_ClientCmd_Unrestricted.cpp index c4d36663..6577e5f5 100644 --- a/Amalgam/src/Hooks/IVEngineClient_ClientCmd_Unrestricted.cpp +++ b/Amalgam/src/Hooks/IVEngineClient_ClientCmd_Unrestricted.cpp @@ -21,7 +21,7 @@ private: mutable bool in_q; }; -MAKE_HOOK(IVEngineClient_ClientCmd_Unrestricted, U::Memory.GetVFunc(I::EngineClient, 106), void, +MAKE_HOOK(IVEngineClient_ClientCmd_Unrestricted, U::Memory.GetVirtual(I::EngineClient, 106), void, void* rcx, const char* szCmdString) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/IVModelRender_DrawModelExecute.cpp b/Amalgam/src/Hooks/IVModelRender_DrawModelExecute.cpp index 2a877257..73f94e76 100644 --- a/Amalgam/src/Hooks/IVModelRender_DrawModelExecute.cpp +++ b/Amalgam/src/Hooks/IVModelRender_DrawModelExecute.cpp @@ -9,7 +9,7 @@ MAKE_SIGNATURE(CBaseAnimating_DrawModel, "client.dll", "4C 8B DC 49 89 5B ? 89 5 MAKE_SIGNATURE(CEconEntity_DrawOverriddenViewmodel_DrawModel_Call, "client.dll", "41 8B D5 FF 50 ? 8B 97", 0x6); MAKE_SIGNATURE(CBaseAnimating_InternalDrawModel, "client.dll", "48 8B C4 55 56 48 8D 6C 24 ? 48 81 EC ? ? ? ? 44 8B 81", 0x0); -MAKE_HOOK(IVModelRender_DrawModelExecute, U::Memory.GetVFunc(I::ModelRender, 19), void, +MAKE_HOOK(IVModelRender_DrawModelExecute, U::Memory.GetVirtual(I::ModelRender, 19), void, void* rcx, const DrawModelState_t& pState, const ModelRenderInfo_t& pInfo, matrix3x4* pBoneToWorld) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/Hooks/IVModelRender_ForcedMaterialOverride.cpp b/Amalgam/src/Hooks/IVModelRender_ForcedMaterialOverride.cpp index 14da365e..658d42aa 100644 --- a/Amalgam/src/Hooks/IVModelRender_ForcedMaterialOverride.cpp +++ b/Amalgam/src/Hooks/IVModelRender_ForcedMaterialOverride.cpp @@ -4,7 +4,7 @@ #include "../Features/Visuals/Glow/Glow.h" #include "../Features/Visuals/Materials/Materials.h" -MAKE_HOOK(IVModelRender_ForcedMaterialOverride, U::Memory.GetVFunc(I::ModelRender, 1), void, +MAKE_HOOK(IVModelRender_ForcedMaterialOverride, U::Memory.GetVirtual(I::ModelRender, 1), void, IVModelRender* rcx, IMaterial* mat, OverrideType_t type) { #ifdef DEBUG_HOOKS diff --git a/Amalgam/src/SDK/Definitions/Classes.h b/Amalgam/src/SDK/Definitions/Classes.h index 77ef6651..0b85ac94 100644 --- a/Amalgam/src/SDK/Definitions/Classes.h +++ b/Amalgam/src/SDK/Definitions/Classes.h @@ -14,7 +14,6 @@ #include "Main/CEconEntity.h" #include "Main/CEconWearable.h" #include "Main/CEntitySphereQuery.h" -#include "Main/CHalloweenPickup.h" #include "Main/CMultiPlayerAnimState.h" #include "Main/CSniperDot.h" #include "Main/CTFPlayer.h" diff --git a/Amalgam/src/SDK/Definitions/Interfaces/CClientModeShared.h b/Amalgam/src/SDK/Definitions/Interfaces/CClientModeShared.h index b0a9ee74..d5997c8c 100644 --- a/Amalgam/src/SDK/Definitions/Interfaces/CClientModeShared.h +++ b/Amalgam/src/SDK/Definitions/Interfaces/CClientModeShared.h @@ -1,7 +1,7 @@ #pragma once +#include "Interface.h" #include "../Misc/IClientMode.h" #include "../Misc/CGameEventListener.h" -#include "../../../Utils/Memory/Memory.h" MAKE_SIGNATURE(ClientModeTFNormal_BIsFriendOrPartyMember, "client.dll", "48 89 5C 24 ? 57 48 81 EC ? ? ? ? 48 85 D2 0F 84", 0x0); @@ -12,15 +12,8 @@ class CViewSetup; class CBaseHudChat { public: - void ChatPrintf(int pIndex, const char* fmt, ...) - { - reinterpret_cast(U::Memory.GetVFunc(this, 19))(this, pIndex, 0, fmt); - } - - void StartMessageMode(int iMessageModeType) - { - reinterpret_cast(U::Memory.GetVFunc(this, 20))(this, iMessageModeType); - } + VIRTUAL_ARGS(ChatPrintf, void, 19, (int pIndex, const char* fmt, ...), this, pIndex, 0, fmt); + VIRTUAL_ARGS(StartMessageMode, void, 20, (int iMessageModeType), this, iMessageModeType); }; class CClientModeShared : public IClientMode, public CGameEventListener @@ -83,10 +76,7 @@ public: char szPad[24]; CBaseHudChat* m_pChatElement; - inline bool BIsFriendOrPartyMember(CBaseEntity* pEntity) - { - return S::ClientModeTFNormal_BIsFriendOrPartyMember.Call(this, pEntity); - } + SIGNATURE_ARGS(BIsFriendOrPartyMember, bool, ClientModeTFNormal, (CBaseEntity* pEntity), this, pEntity); }; MAKE_INTERFACE_SIGNATURE(CClientModeShared, ClientModeShared, "client.dll", "48 8B 0D ? ? ? ? 48 8B 10 48 8B 19 48 8B C8 FF 92", 0x0, 1); \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Interfaces/CTFGCClientSystem.h b/Amalgam/src/SDK/Definitions/Interfaces/CTFGCClientSystem.h index 4d212989..508198d2 100644 --- a/Amalgam/src/SDK/Definitions/Interfaces/CTFGCClientSystem.h +++ b/Amalgam/src/SDK/Definitions/Interfaces/CTFGCClientSystem.h @@ -1,6 +1,6 @@ +#pragma once #include "Interface.h" #include "../Steam/SteamClientPublic.h" -#include "../../../Utils/Memory/Memory.h" MAKE_SIGNATURE(CGCClientSharedObjectCache_FindTypeCache, "client.dll", "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 0F B7 59 ? BE", 0x0); @@ -22,10 +22,7 @@ public: class CGCClientSharedObjectCache { public: - inline CGCClientSharedObjectTypeCache* FindTypeCache(int nClassID) - { - return S::CGCClientSharedObjectCache_FindTypeCache.Call(this, nClassID); - } + SIGNATURE_ARGS(FindTypeCache, CGCClientSharedObjectTypeCache*, CGCClientSharedObjectCache, (int nClassID), this, nClassID); }; struct CTFLobbyPlayerProto @@ -79,82 +76,38 @@ class ConstTFLobbyPlayer void* pad1; public: - inline CTFLobbyPlayerProto* Proto() - { - auto ConstTFLobbyPlayer_Proto = reinterpret_cast(U::Memory.GetVFunc(this, 0)); - return ConstTFLobbyPlayer_Proto(this); - } + VIRTUAL(Proto, CTFLobbyPlayerProto*, 0, this); }; class CTFLobbyShared { public: - inline int64 GetNumMembers() - { - auto CTFLobbyShared_GetNumMembers = reinterpret_cast(U::Memory.GetVFunc(this, 2)); - return CTFLobbyShared_GetNumMembers(this); - } - - inline CSteamID* GetMember(CSteamID* pSteamID, int i) - { - auto CTFLobbyShared_GetMember = reinterpret_cast(U::Memory.GetVFunc(this, 3)); - return CTFLobbyShared_GetMember(this, pSteamID, i); - } - - inline int64 GetMemberIndexBySteamID(CSteamID& cSteamID) - { - auto CTFLobbyShared_GetMemberIndexBySteamID = reinterpret_cast(U::Memory.GetVFunc(this, 4)); - return CTFLobbyShared_GetMemberIndexBySteamID(this, cSteamID); - } - - inline ConstTFLobbyPlayer* GetMemberDetails(ConstTFLobbyPlayer* pDetails, int i) - { - auto CTFLobbyShared_GetMemberDetails = reinterpret_cast(U::Memory.GetVFunc(this, 13)); - return CTFLobbyShared_GetMemberDetails(this, pDetails, i); - } + VIRTUAL(GetNumMembers, int, 2, this); + VIRTUAL_ARGS(GetMember, CSteamID*, 3, (CSteamID* pSteamID, int i), this, pSteamID, i); + VIRTUAL_ARGS(GetMemberIndexBySteamID, int, 4, (CSteamID& pSteamID), this, std::ref(pSteamID)); + VIRTUAL_ARGS(GetMemberDetails, ConstTFLobbyPlayer*, 13, (ConstTFLobbyPlayer* pDetails, int i), this, pDetails, i); }; class CTFParty { public: - inline int64 GetNumMembers() - { - auto pParty = reinterpret_cast(uintptr_t(this) + 184); - auto CTFParty_GetNumMembers = reinterpret_cast(U::Memory.GetVFunc(pParty, 2)); - return CTFParty_GetNumMembers(pParty); - } + VIRTUAL(GetNumMembers, int64, 2, uintptr_t(this) + 184); + VIRTUAL_ARGS(GetMember, CSteamID*, 3, (CSteamID* pSteamID, int i), uintptr_t(this) + 184, pSteamID, i); - inline CSteamID* GetMember(CSteamID* pSteamID, int i) - { - auto pParty = reinterpret_cast(uintptr_t(this) + 184); - auto CTFParty_GetMember = reinterpret_cast(U::Memory.GetVFunc(pParty, 3)); - return CTFParty_GetMember(pParty, pSteamID, i); - } - - inline void SpewDebug() - { - S::CTFParty_SpewDebug.Call(this); - } + SIGNATURE(SpewDebug, void, CTFParty, this); }; class CTFGCClientSystem { public: + SIGNATURE(PingThink, void, CTFGCClientSystem, this); + SIGNATURE(GetParty, CTFParty*, CTFGCClientSystem, this); + inline CGCClientSharedObjectCache* m_pSOCache() { return *reinterpret_cast(uintptr_t(this) + 1072); } - inline void PingThink() - { - S::CTFGCClientSystem_PingThink.Call(this); - } - - inline CTFParty* GetParty() - { - return S::CTFGCClientSystem_GetParty.Call(this); - } - inline CTFLobbyShared* GetLobby() { auto pSOCache = m_pSOCache(); diff --git a/Amalgam/src/SDK/Definitions/Interfaces/CTFGameRules.h b/Amalgam/src/SDK/Definitions/Interfaces/CTFGameRules.h index 28e6fb11..b1befc41 100644 --- a/Amalgam/src/SDK/Definitions/Interfaces/CTFGameRules.h +++ b/Amalgam/src/SDK/Definitions/Interfaces/CTFGameRules.h @@ -2,7 +2,6 @@ #include "Interface.h" #include "../Main/CBaseHandle.h" #include "../Misc/IMatchGroupDescription.h" -#include "../../../Utils/NetVars/NetVars.h" MAKE_SIGNATURE(TFGameRules, "client.dll", "48 8B 0D ? ? ? ? 4C 8B C3 48 8B D7 48 8B 01 FF 90 ? ? ? ? 84 C0", 0x0); MAKE_SIGNATURE(CTFGameRules_GetCurrentMatchGroup, "client.dll", "40 53 48 83 EC ? 48 8B D9 E8 ? ? ? ? 48 8B C8 33 D2 E8 ? ? ? ? 84 C0 74 ? 8B 83 ? ? ? ? 48 83 C4", 0x0); @@ -98,10 +97,7 @@ public: NETVAR(m_nForceEscortPushLogic, int, "CTFGameRulesProxy", "m_nForceEscortPushLogic"); NETVAR(m_bRopesHolidayLightsAllowed, bool, "CTFGameRulesProxy", "m_bRopesHolidayLightsAllowed"); - inline CViewVectors* GetViewVectors() - { - return reinterpret_cast(U::Memory.GetVFunc(this, 31))(); - } + VIRTUAL(GetViewVectors, CViewVectors*, 31, this); inline bool IsPlayerReady(int playerIndex) { @@ -116,11 +112,7 @@ public: return ReadyStatus[playerIndex]; } - inline int GetCurrentMatchGroup() - { - return S::CTFGameRules_GetCurrentMatchGroup.Call(this); - } - + SIGNATURE(GetCurrentMatchGroup, int, CTFGameRules, this); inline IMatchGroupDescription* GetMatchGroupDescription() { int iCurrentMatchGroup = GetCurrentMatchGroup(); diff --git a/Amalgam/src/SDK/Definitions/Interfaces/CTFPartyClient.h b/Amalgam/src/SDK/Definitions/Interfaces/CTFPartyClient.h index a844d193..fd1c16f5 100644 --- a/Amalgam/src/SDK/Definitions/Interfaces/CTFPartyClient.h +++ b/Amalgam/src/SDK/Definitions/Interfaces/CTFPartyClient.h @@ -9,25 +9,10 @@ MAKE_SIGNATURE(CTFPartyClient_RequestQueueForMatch, "client.dll", "40 55 56 48 8 class CTFPartyClient { public: - void SendPartyChat(const char* sMessage) - { - return S::CTFPartyClient_SendPartyChat.Call(this, sMessage); - } - - void LoadSavedCasualCriteria() - { - return S::CTFPartyClient_LoadSavedCasualCriteria.Call(this); - } - - bool BInQueueForMatchGroup(int eMatchGroup) - { - return S::CTFPartyClient_BInQueueForMatchGroup.Call(this, eMatchGroup); - } - - void RequestQueueForMatch(int eMatchGroup) - { - return S::CTFPartyClient_RequestQueueForMatch.Call(this, eMatchGroup); - } + SIGNATURE_ARGS(SendPartyChat, void, CTFPartyClient, (const char* sMessage), this, sMessage); + SIGNATURE(LoadSavedCasualCriteria, void, CTFPartyClient, this); + SIGNATURE_ARGS(BInQueueForMatchGroup, bool, CTFPartyClient, (int eMatchGroup), this, eMatchGroup); + SIGNATURE_ARGS(RequestQueueForMatch, void, CTFPartyClient, (int eMatchGroup), this, eMatchGroup); }; MAKE_INTERFACE_NULL(CTFPartyClient, TFPartyClient); \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Interfaces/IInputSystem.h b/Amalgam/src/SDK/Definitions/Interfaces/IInputSystem.h index 50b8b217..dae355b9 100644 --- a/Amalgam/src/SDK/Definitions/Interfaces/IInputSystem.h +++ b/Amalgam/src/SDK/Definitions/Interfaces/IInputSystem.h @@ -1,7 +1,7 @@ #pragma once +#include "../Misc/IAppSystem.h" #include "../Misc/AnalogCode.h" #include "../Misc/ButtonCode.h" -#include "../Misc/IAppSystem.h" #include "../Misc/InputEnums.h" #include "../Steam/ISteamController.h" diff --git a/Amalgam/src/SDK/Definitions/Interfaces/IMatSystemSurface.h b/Amalgam/src/SDK/Definitions/Interfaces/IMatSystemSurface.h index 5c4d7787..ea688dd0 100644 --- a/Amalgam/src/SDK/Definitions/Interfaces/IMatSystemSurface.h +++ b/Amalgam/src/SDK/Definitions/Interfaces/IMatSystemSurface.h @@ -1,4 +1,5 @@ #pragma once +#include "Interface.h" #include "../Misc/ISurface.h" MAKE_SIGNATURE(CMatSystemSurface_StartDrawing, "vguimatsurface.dll", "40 53 56 57 48 83 EC ? 48 8B F9 80 3D", 0x0); @@ -43,15 +44,8 @@ public: virtual void BeginSkinCompositionPainting() = 0; virtual void EndSkinCompositionPainting() = 0; - void StartDrawing() - { - S::CMatSystemSurface_StartDrawing.Call(this); - } - - void FinishDrawing() - { - S::CMatSystemSurface_FinishDrawing.Call(this); - } + SIGNATURE(StartDrawing, void, CMatSystemSurface, this); + SIGNATURE(FinishDrawing, void, CMatSystemSurface, this); }; MAKE_INTERFACE_VERSION(IMatSystemSurface, MatSystemSurface, "vguimatsurface.dll", "VGUI_Surface030"); \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Interfaces/IMaterialSystem.h b/Amalgam/src/SDK/Definitions/Interfaces/IMaterialSystem.h index 2e4182cf..acc507ca 100644 --- a/Amalgam/src/SDK/Definitions/Interfaces/IMaterialSystem.h +++ b/Amalgam/src/SDK/Definitions/Interfaces/IMaterialSystem.h @@ -1,7 +1,6 @@ #pragma once -#include "Interface.h" -#include "../Misc/Deformations.h" #include "../Misc/IAppSystem.h" +#include "../Misc/Deformations.h" #include "../Misc/IColorCorrectionSystem.h" #include "../Misc/ImageFormat.h" #include "../Misc/IMaterialSystemHardwareConfig.h" diff --git a/Amalgam/src/SDK/Definitions/Interfaces/IStudioRender.h b/Amalgam/src/SDK/Definitions/Interfaces/IStudioRender.h index d56e5c9d..1a0debab 100644 --- a/Amalgam/src/SDK/Definitions/Interfaces/IStudioRender.h +++ b/Amalgam/src/SDK/Definitions/Interfaces/IStudioRender.h @@ -1,7 +1,5 @@ #pragma once -#include "Interface.h" #include "IMaterialSystem.h" -#include "../Misc/IAppSystem.h" #include "../Main/IMaterial.h" #include "../Misc/IMDLCache.h" #include "../Misc/Studio.h" diff --git a/Amalgam/src/SDK/Definitions/Interfaces/IVRenderView.h b/Amalgam/src/SDK/Definitions/Interfaces/IVRenderView.h index bcf7f3bc..fbd5f5f7 100644 --- a/Amalgam/src/SDK/Definitions/Interfaces/IVRenderView.h +++ b/Amalgam/src/SDK/Definitions/Interfaces/IVRenderView.h @@ -1,6 +1,5 @@ #pragma once #include "IMaterialSystem.h" -#include "Interface.h" #include "../Misc/BaseTypes.h" #include "../Misc/IRefCounted.h" #include "../Misc/VPlane.h" diff --git a/Amalgam/src/SDK/Definitions/Interfaces/Interface.h b/Amalgam/src/SDK/Definitions/Interfaces/Interface.h index 857c23d0..2486168a 100644 --- a/Amalgam/src/SDK/Definitions/Interfaces/Interface.h +++ b/Amalgam/src/SDK/Definitions/Interfaces/Interface.h @@ -1,8 +1,8 @@ #pragma once #include "../../../Utils/Interfaces/Interfaces.h" +#include "../../../Utils/Memory/Memory.h" #include "../../../Utils/Signatures/Signatures.h" - -MAKE_SIGNATURE(CAttributeManager_AttribHookFloat, "client.dll", "4C 8B DC 49 89 5B ? 49 89 6B ? 56 57 41 54 41 56 41 57 48 83 EC ? 48 8B 3D ? ? ? ? 4C 8D 35", 0x0); +#include "../../../Utils/NetVars/NetVars.h" class IBaseInterface { @@ -10,12 +10,4 @@ public: virtual ~IBaseInterface() {} }; -typedef void* (*CreateInterfaceFn)(const char* pName, int* pReturnCode); - -namespace SDK -{ - inline float AttribHookValue(float value, const char* name, void* econent, void* buffer = 0, bool isGlobalConstString = true) - { - return S::CAttributeManager_AttribHookFloat.Call(value, name, econent, buffer, isGlobalConstString); - } -} \ No newline at end of file +typedef void* (*CreateInterfaceFn)(const char* pName, int* pReturnCode); \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CBaseAnimating.cpp b/Amalgam/src/SDK/Definitions/Main/CBaseAnimating.cpp new file mode 100644 index 00000000..ff0f0720 --- /dev/null +++ b/Amalgam/src/SDK/Definitions/Main/CBaseAnimating.cpp @@ -0,0 +1,83 @@ +#include "CBaseAnimating.h" + +#include "../../SDK.h" + +int CBaseAnimating::GetHitboxGroup(int nHitbox) +{ + auto pModel = GetModel(); + if (!pModel) return -1; + auto pHDR = I::ModelInfoClient->GetStudiomodel(pModel); + if (!pHDR) return -1; + auto pSet = pHDR->pHitboxSet(m_nHitboxSet()); + if (!pSet) return -1; + auto pBox = pSet->pHitbox(nHitbox); + if (!pBox) return -1; + + return pBox->group; +} + +int CBaseAnimating::GetNumOfHitboxes() +{ + auto pModel = GetModel(); + if (!pModel) return 0; + auto pHDR = I::ModelInfoClient->GetStudiomodel(pModel); + if (!pHDR) return 0; + auto pSet = pHDR->pHitboxSet(m_nHitboxSet()); + if (!pSet) return 0; + + return pSet->numhitboxes; +} + +Vec3 CBaseAnimating::GetHitboxOrigin(matrix3x4* aBones, int nHitbox, Vec3 vOffset) +{ + auto pModel = GetModel(); + if (!pModel) return {}; + auto pHDR = I::ModelInfoClient->GetStudiomodel(pModel); + if (!pHDR) return {}; + auto pSet = pHDR->pHitboxSet(m_nHitboxSet()); + if (!pSet) return {}; + auto pBox = pSet->pHitbox(nHitbox); + if (!pBox) return {}; + + Vec3 vOut; Math::VectorTransform(vOffset, aBones[pBox->bone], vOut); + return vOut; +} + +Vec3 CBaseAnimating::GetHitboxCenter(matrix3x4* aBones, int nHitbox, Vec3 vOffset) +{ + auto pModel = GetModel(); + if (!pModel) return {}; + auto pHDR = I::ModelInfoClient->GetStudiomodel(pModel); + if (!pHDR) return {}; + auto pSet = pHDR->pHitboxSet(m_nHitboxSet()); + if (!pSet) return {}; + auto pBox = pSet->pHitbox(nHitbox); + if (!pBox) return {}; + + Vec3 vOut; Math::VectorTransform((pBox->bbmin + pBox->bbmax) / 2 + vOffset, aBones[pBox->bone], vOut); + return vOut; +} + +void CBaseAnimating::GetHitboxInfo(matrix3x4* aBones, int nHitbox, Vec3* pCenter, Vec3* pMins, Vec3* pMaxs, matrix3x4* pMatrix, Vec3 vOffset) +{ + auto pModel = GetModel(); + if (!pModel) return; + auto pHDR = I::ModelInfoClient->GetStudiomodel(pModel); + if (!pHDR) return; + auto pSet = pHDR->pHitboxSet(m_nHitboxSet()); + if (!pSet) return; + auto pBox = pSet->pHitbox(nHitbox); + if (!pBox) return; + + if (pMins) + *pMins = pBox->bbmin; + + if (pMaxs) + *pMaxs = pBox->bbmax; + + if (pCenter) + Math::VectorTransform(vOffset, aBones[pBox->bone], *pCenter); + + if (pMatrix) + memcpy(*pMatrix, aBones[pBox->bone], sizeof(matrix3x4)); +} \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CBaseAnimating.h b/Amalgam/src/SDK/Definitions/Main/CBaseAnimating.h index 45280679..5c751c83 100644 --- a/Amalgam/src/SDK/Definitions/Main/CBaseAnimating.h +++ b/Amalgam/src/SDK/Definitions/Main/CBaseAnimating.h @@ -1,7 +1,6 @@ #pragma once #include "CBaseEntity.h" #include "../Misc/Studio.h" -#include "../../../Utils/Math/Math.h" MAKE_SIGNATURE(CBaseAnimating_FrameAdvance, "client.dll", "48 89 5C 24 ? 48 89 6C 24 ? 57 48 81 EC ? ? ? ? 44 0F 29 54 24", 0x0); MAKE_SIGNATURE(CBaseAnimating_GetBonePosition, "client.dll", "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 8B DA 49 8B F1", 0x0); @@ -31,122 +30,25 @@ public: NETVAR(m_fadeMinDist, float, "CBaseAnimating", "m_fadeMinDist"); NETVAR(m_fadeMaxDist, float, "CBaseAnimating", "m_fadeMaxDist"); NETVAR(m_flFadeScale, float, "CBaseAnimating", "m_flFadeScale"); - - NETVAR_OFF(GetModelPtr, CStudioHdr*, "CBaseAnimating", "m_nMuzzleFlashParity", 16); - NETVAR_OFF(m_bSequenceLoops, bool, "CBaseAnimating", "m_flFadeScale", 13); - - inline int GetHitboxGroup(int nHitbox) - { - auto pModel = GetModel(); - if (!pModel) return -1; - auto pHDR = I::ModelInfoClient->GetStudiomodel(pModel); - if (!pHDR) return -1; - auto pSet = pHDR->pHitboxSet(m_nHitboxSet()); - if (!pSet) return -1; - auto pBox = pSet->pHitbox(nHitbox); - if (!pBox) return -1; - - return pBox->group; - } - - inline int GetNumOfHitboxes() - { - auto pModel = GetModel(); - if (!pModel) return 0; - auto pHDR = I::ModelInfoClient->GetStudiomodel(pModel); - if (!pHDR) return 0; - auto pSet = pHDR->pHitboxSet(m_nHitboxSet()); - if (!pSet) return 0; - - return pSet->numhitboxes; - } - - inline Vec3 GetHitboxOrigin(matrix3x4* aBones, int nHitbox, Vec3 vOffset = {}) - { - auto pModel = GetModel(); - if (!pModel) return {}; - auto pHDR = I::ModelInfoClient->GetStudiomodel(pModel); - if (!pHDR) return {}; - auto pSet = pHDR->pHitboxSet(m_nHitboxSet()); - if (!pSet) return {}; - auto pBox = pSet->pHitbox(nHitbox); - if (!pBox) return {}; - - Vec3 vOut; Math::VectorTransform(vOffset, aBones[pBox->bone], vOut); - return vOut; - } - - inline Vec3 GetHitboxCenter(matrix3x4* aBones, int nHitbox, Vec3 vOffset = {}) - { - auto pModel = GetModel(); - if (!pModel) return {}; - auto pHDR = I::ModelInfoClient->GetStudiomodel(pModel); - if (!pHDR) return {}; - auto pSet = pHDR->pHitboxSet(m_nHitboxSet()); - if (!pSet) return {}; - auto pBox = pSet->pHitbox(nHitbox); - if (!pBox) return {}; - - Vec3 vOut; Math::VectorTransform((pBox->bbmin + pBox->bbmax) / 2 + vOffset, aBones[pBox->bone], vOut); - return vOut; - } - - inline void GetHitboxInfo(matrix3x4* aBones, int nHitbox, Vec3* pCenter = nullptr, Vec3* pMins = nullptr, Vec3* pMaxs = nullptr, matrix3x4* pMatrix = nullptr, Vec3 vOffset = {}) - { - auto pModel = GetModel(); - if (!pModel) return; - auto pHDR = I::ModelInfoClient->GetStudiomodel(pModel); - if (!pHDR) return; - auto pSet = pHDR->pHitboxSet(m_nHitboxSet()); - if (!pSet) return; - auto pBox = pSet->pHitbox(nHitbox); - if (!pBox) return; - - if (pMins) - *pMins = pBox->bbmin; - - if (pMaxs) - *pMaxs = pBox->bbmax; - - if (pCenter) - Math::VectorTransform(vOffset, aBones[pBox->bone], *pCenter); - - if (pMatrix) - memcpy(*pMatrix, aBones[pBox->bone], sizeof(matrix3x4)); - } - inline std::array& m_flPoseParameter() { static int nOffset = U::NetVars.GetNetVar("CBaseAnimating", "m_flPoseParameter"); return *reinterpret_cast*>(uintptr_t(this) + nOffset); } + NETVAR_OFF(GetModelPtr, CStudioHdr*, "CBaseAnimating", "m_nMuzzleFlashParity", 16); + NETVAR_OFF(m_bSequenceLoops, bool, "CBaseAnimating", "m_flFadeScale", 13); inline CUtlVector* GetCachedBoneData() { static int nOffset = U::NetVars.GetNetVar("CBaseAnimating", "m_hLightingOrigin") - 88; return reinterpret_cast*>(uintptr_t(this) + nOffset); } - inline float FrameAdvance(float flInterval) - { - return S::CBaseAnimating_FrameAdvance.Call(this, flInterval); - } - - inline void GetBonePosition(int iBone, Vector& origin, QAngle& angles) - { - S::CBaseAnimating_GetBonePosition.Call(this, iBone, std::ref(origin), std::ref(angles)); - } - - inline bool GetAttachment(int number, Vec3& origin) - { - return reinterpret_cast(U::Memory.GetVFunc(this, 71))(this, number, origin); - } - - inline float SequenceDuration() - { - return S::CBaseAnimating_SequenceDuration.Call(this); - } + VIRTUAL_ARGS(GetAttachment, bool, 71, (int number, Vec3& origin), this, number, std::ref(origin)) + SIGNATURE_ARGS(FrameAdvance, float, CBaseAnimating, (float flInterval), this, flInterval); + SIGNATURE_ARGS(GetBonePosition, float, CBaseAnimating, (int iBone, Vector& origin, QAngle& angles), this, iBone, std::ref(origin), std::ref(angles)); + SIGNATURE(SequenceDuration, float, CBaseAnimating, this); inline float SequenceDuration(int iSequence) { int iOriginalSequence = m_nSequence(); @@ -155,6 +57,12 @@ public: m_nSequence() = iOriginalSequence; return bReturn; } + + int GetHitboxGroup(int nHitbox); + int GetNumOfHitboxes(); + Vec3 GetHitboxOrigin(matrix3x4* aBones, int nHitbox, Vec3 vOffset = {}); + Vec3 GetHitboxCenter(matrix3x4* aBones, int nHitbox, Vec3 vOffset = {}); + void GetHitboxInfo(matrix3x4* aBones, int nHitbox, Vec3* pCenter = nullptr, Vec3* pMins = nullptr, Vec3* pMaxs = nullptr, matrix3x4* pMatrix = nullptr, Vec3 vOffset = {}); }; class CBaseAnimatingOverlay : public CBaseAnimating @@ -167,4 +75,15 @@ class CCurrencyPack : public CBaseAnimating { public: NETVAR(m_bDistributed, bool, "CCurrencyPack", "m_bDistributed"); +}; + +class CHalloweenPickup : public CBaseAnimating +{ +public: +}; + +class CHalloweenGiftPickup : public CHalloweenPickup +{ +public: + NETVAR(m_hTargetPlayer, EHANDLE, "CHalloweenGiftPickup", "m_hTargetPlayer"); }; \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CBaseCombatCharacter.cpp b/Amalgam/src/SDK/Definitions/Main/CBaseCombatCharacter.cpp new file mode 100644 index 00000000..7961521f --- /dev/null +++ b/Amalgam/src/SDK/Definitions/Main/CBaseCombatCharacter.cpp @@ -0,0 +1,16 @@ +#include "CBaseCombatCharacter.h" + +#include "../../SDK.h" + +CHandle(&CBaseCombatCharacter::m_hMyWeapons())[MAX_WEAPONS] +{ + static int nOffset = U::NetVars.GetNetVar("CBaseCombatCharacter", "m_hMyWeapons"); + return *reinterpret_cast(*)[MAX_WEAPONS]>(uintptr_t(this) + nOffset); +} + +CTFWeaponBase* CBaseCombatCharacter::GetWeaponFromSlot(int nSlot) +{ + if (nSlot < 0 || nSlot >= MAX_WEAPONS) + return nullptr; + return m_hMyWeapons()[nSlot].Get(); +} \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CBaseCombatCharacter.h b/Amalgam/src/SDK/Definitions/Main/CBaseCombatCharacter.h index ba3f59ba..3dd01969 100644 --- a/Amalgam/src/SDK/Definitions/Main/CBaseCombatCharacter.h +++ b/Amalgam/src/SDK/Definitions/Main/CBaseCombatCharacter.h @@ -11,16 +11,6 @@ public: //NETVAR(m_hMyWeapons, EHANDLE, "CBaseCombatCharacter", "m_hMyWeapons"); NETVAR(m_bGlowEnabled, bool, "CBaseCombatCharacter", "m_bGlowEnabled"); - inline CHandle(&m_hMyWeapons())[MAX_WEAPONS] - { - static int nOffset = U::NetVars.GetNetVar("CBaseCombatCharacter", "m_hMyWeapons"); - return *reinterpret_cast(*)[MAX_WEAPONS]>(uintptr_t(this) + nOffset); - } - - inline CTFWeaponBase* GetWeaponFromSlot(int nSlot) - { - if (nSlot < 0 || nSlot >= MAX_WEAPONS) - return nullptr; - return m_hMyWeapons()[nSlot].Get(); - } + CHandle(&m_hMyWeapons())[MAX_WEAPONS]; + CTFWeaponBase* GetWeaponFromSlot(int nSlot); }; \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CBaseCombatWeapon.h b/Amalgam/src/SDK/Definitions/Main/CBaseCombatWeapon.h index 1fc19c5f..6c0195bc 100644 --- a/Amalgam/src/SDK/Definitions/Main/CBaseCombatWeapon.h +++ b/Amalgam/src/SDK/Definitions/Main/CBaseCombatWeapon.h @@ -1,8 +1,5 @@ #pragma once #include "CEconEntity.h" -#include "../../../Utils/Signatures/Signatures.h" - -MAKE_SIGNATURE(CBaseCombatWeapon_HasAmmo, "client.dll", "40 53 48 83 EC ? 83 B9 ? ? ? ? ? 48 8B D9 75 ? 83 B9 ? ? ? ? ? 74 ? 48 8B 01", 0x0); class CBaseCombatWeapon : public CEconEntity { @@ -22,12 +19,8 @@ public: NETVAR(m_iState, int, "CBaseCombatWeapon", "m_iState"); NETVAR(m_hOwner, EHANDLE, "CBaseCombatWeapon", "m_hOwner"); - NETVAR_OFF(m_bInReload, bool, "CBaseCombatWeapon", "m_flNextPrimaryAttack", 12); + NETVAR_OFF(m_bInReload, bool, "CBaseCombatWeapon", "m_flTimeWeaponIdle", 4); + NETVAR_OFF(m_bRemoveable, bool, "CBaseCombatWeapon", "m_iState", -12); - VIRTUAL(GetName, const char*, void*, this, 333); - - inline bool HasAmmo() - { - return S::CBaseCombatWeapon_HasAmmo.Call(this); - } + VIRTUAL(GetName, const char*, 333, this); }; \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CBaseEntity.cpp b/Amalgam/src/SDK/Definitions/Main/CBaseEntity.cpp new file mode 100644 index 00000000..cbb4bf75 --- /dev/null +++ b/Amalgam/src/SDK/Definitions/Main/CBaseEntity.cpp @@ -0,0 +1,49 @@ +#include "CBaseEntity.h" + +#include "../../SDK.h" + +Vec3 CBaseEntity::GetSize() +{ + return m_vecMaxs() - m_vecMins(); +} + +Vec3 CBaseEntity::GetOffset() +{ + return m_vecMins() + m_vecMaxs(); +} + +Vec3 CBaseEntity::GetCenter() +{ + return m_vecOrigin() + GetOffset() / 2; +} + +Vec3 CBaseEntity::GetRenderCenter() +{ + Vec3 vMins, vMaxs; GetRenderBounds(vMins, vMaxs); + return GetRenderOrigin() + (vMaxs - vMins) / 2; +} + +int CBaseEntity::IsInValidTeam() +{ + switch (int nTeamNum = m_iTeamNum()) + { + case TF_TEAM_RED: + case TF_TEAM_BLUE: + return nTeamNum; + } + return 0; +} + +int CBaseEntity::SolidMask() +{ + if (IsPlayer()) + { + switch (m_iTeamNum()) + { + case TF_TEAM_RED: return MASK_PLAYERSOLID | CONTENTS_BLUETEAM; + case TF_TEAM_BLUE: return MASK_PLAYERSOLID | CONTENTS_REDTEAM; + } + return MASK_PLAYERSOLID; + } + return MASK_SOLID; +} \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CBaseEntity.h b/Amalgam/src/SDK/Definitions/Main/CBaseEntity.h index c44df46a..515073a3 100644 --- a/Amalgam/src/SDK/Definitions/Main/CBaseEntity.h +++ b/Amalgam/src/SDK/Definitions/Main/CBaseEntity.h @@ -5,9 +5,9 @@ #include "CParticleProperty.h" #include "../Main/UtlVector.h" #include "../Definitions.h" -#include "../../../Utils/NetVars/NetVars.h" -#include "../../../Utils/Signatures/Signatures.h" #include "../../../Utils/Memory/Memory.h" +#include "../../../Utils/Signatures/Signatures.h" +#include "../../../Utils/NetVars/NetVars.h" MAKE_SIGNATURE(CBaseEntity_SetAbsOrigin, "client.dll", "48 89 5C 24 ? 57 48 83 EC ? 48 8B FA 48 8B D9 E8 ? ? ? ? F3 0F 10 83", 0x0); MAKE_SIGNATURE(CBaseEntity_SetAbsAngles, "client.dll", "48 89 5C 24 ? 57 48 81 EC ? ? ? ? 48 8B FA 48 8B D9 E8 ? ? ? ? F3 0F 10 83", 0x0); @@ -91,92 +91,36 @@ public: NETVAR_OFF(m_flOldSimulationTime, float, "CBaseEntity", "m_flSimulationTime", 4); NETVAR_OFF(m_Particles, CParticleProperty*, "CBaseEntity", "m_flElasticity", -56); - - VIRTUAL(UpdateVisibility, void, CBaseEntity*, this, 91); - - inline Vec3 GetCenter() - { - return m_vecOrigin() + (m_vecMins() + m_vecMaxs()) / 2; - } - - inline Vec3 GetRenderCenter() - { - Vec3 vMin, vMax; GetRenderBounds(vMin, vMax); - return GetRenderOrigin() + Vec3(0.f, 0.f, (vMin.z + vMax.z) / 2); - } - - inline bool IsInValidTeam(int* pTeamNumOut = nullptr) - { - int nTeamNum = m_iTeamNum(); - - switch (nTeamNum) - { - case TF_TEAM_RED: - case TF_TEAM_BLUE: - { - if (pTeamNumOut) - *pTeamNumOut = nTeamNum; - - return true; - } - - default: return false; - } - } - inline CBaseEntity* GetMoveParent() { static int nOffset = U::NetVars.GetNetVar("CBaseEntity", "moveparent") - 8; auto m_pMoveParent = reinterpret_cast(uintptr_t(this) + nOffset); - if (!m_pMoveParent) - return nullptr; - - return m_pMoveParent->Get(); + return m_pMoveParent ? m_pMoveParent->Get() : nullptr; } - inline CBaseEntity* NextMovePeer() { static int nOffset = U::NetVars.GetNetVar("CBaseEntity", "moveparent") - 16; auto m_pMovePeer = reinterpret_cast(uintptr_t(this) + nOffset); - if (!m_pMovePeer) - return nullptr; - - return m_pMovePeer->Get(); + return m_pMovePeer ? m_pMovePeer->Get() : nullptr; } - inline CBaseEntity* FirstMoveChild() { static int nOffset = U::NetVars.GetNetVar("CBaseEntity", "moveparent") - 24; auto m_pMoveChild = reinterpret_cast(uintptr_t(this) + nOffset); - if (!m_pMoveChild) - return nullptr; - - return m_pMoveChild->Get(); + return m_pMoveChild ? m_pMoveChild->Get() : nullptr; } - inline void SetAbsOrigin(const Vec3& absOrigin) - { - S::CBaseEntity_SetAbsOrigin.Call(this, std::ref(absOrigin)); - } - - inline void SetAbsAngles(const Vec3& absAngles) - { - S::CBaseEntity_SetAbsAngles.Call(this, std::ref(absAngles)); - } - - inline void SetAbsVelocity(const Vec3& vecAbsVelocity) - { - S::CBaseEntity_SetAbsVelocity.Call(this, std::ref(vecAbsVelocity)); - } - - inline void EstimateAbsVelocity(Vec3& vel) - { - S::CBaseEntity_EstimateAbsVelocity.Call(this, std::ref(vel)); - } + VIRTUAL(UpdateVisibility, void, 91, this); + SIGNATURE_ARGS(SetAbsOrigin, void, CBaseEntity, (const Vec3& vOrigin), this, std::ref(vOrigin)); + SIGNATURE_ARGS(SetAbsAngles, void, CBaseEntity, (const Vec3& vAngles), this, std::ref(vAngles)); + SIGNATURE_ARGS(SetAbsVelocity, void, CBaseEntity, (const Vec3& vVelocity), this, std::ref(vVelocity)); + SIGNATURE_ARGS(EstimateAbsVelocity, void, CBaseEntity, (Vec3& vVelocity), this, std::ref(vVelocity)); + SIGNATURE(InvalidateBoneCache, void, CBaseEntity, this); + SIGNATURE(CreateShadow, void, CBaseEntity, this); inline Vec3 GetAbsVelocity() { Vec3 vOut; @@ -184,27 +128,10 @@ public: return vOut; } - inline void CreateShadow() - { - S::CBaseEntity_CreateShadow.Call(this); - } - - inline void InvalidateBoneCache() - { - S::CBaseEntity_InvalidateBoneCache.Call(this); - } - - inline int SolidMask() - { - if (IsPlayer()) - { - switch (m_iTeamNum()) - { - case TF_TEAM_RED: return MASK_PLAYERSOLID | CONTENTS_BLUETEAM; - case TF_TEAM_BLUE: return MASK_PLAYERSOLID | CONTENTS_REDTEAM; - } - return MASK_PLAYERSOLID; - } - return MASK_SOLID; - } + Vec3 GetSize(); + Vec3 GetOffset(); + Vec3 GetCenter(); + Vec3 GetRenderCenter(); + int IsInValidTeam(); + int SolidMask(); }; \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CBaseHandle.h b/Amalgam/src/SDK/Definitions/Main/CBaseHandle.h index 6f04c765..ff0fcc8b 100644 --- a/Amalgam/src/SDK/Definitions/Main/CBaseHandle.h +++ b/Amalgam/src/SDK/Definitions/Main/CBaseHandle.h @@ -145,6 +145,7 @@ public: T* Get() const; void Set(const T* pVal); + int GetIndex() const; operator T* (); operator T* () const; @@ -194,6 +195,12 @@ T* CHandle::Get() const return reinterpret_cast(CBaseHandle::Get()); } +template +int CHandle::GetIndex() const +{ + return m_Index != -1 ? m_Index & 0xFFF : 0; +} + template CHandle::operator T* () { diff --git a/Amalgam/src/SDK/Definitions/Main/CBaseObject.cpp b/Amalgam/src/SDK/Definitions/Main/CBaseObject.cpp new file mode 100644 index 00000000..85d802cd --- /dev/null +++ b/Amalgam/src/SDK/Definitions/Main/CBaseObject.cpp @@ -0,0 +1,28 @@ +#include "CBaseObject.h" + +#include "../../SDK.h" + +bool CBaseObject::IsDisabled() +{ + return m_bDisabled() || m_bHasSapper(); +} + + + +int CObjectSentrygun::MaxAmmoShells() +{ + if (m_iUpgradeLevel() == 1 || m_bMiniBuilding()) + return 150; + else + return 200; +} + +void CObjectSentrygun::GetAmmoCount(int& iShells, int& iMaxShells, int& iRockets, int& iMaxRockets) +{ + const bool bIsMini = m_bMiniBuilding(); + + iShells = m_iAmmoShells(); + iMaxShells = MaxAmmoShells(); + iRockets = bIsMini ? 0 : m_iAmmoRockets(); + iMaxRockets = (bIsMini || m_iUpgradeLevel() < 3) ? 0 : 20; +} \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CBaseObject.h b/Amalgam/src/SDK/Definitions/Main/CBaseObject.h index e38a9ef8..d7b309df 100644 --- a/Amalgam/src/SDK/Definitions/Main/CBaseObject.h +++ b/Amalgam/src/SDK/Definitions/Main/CBaseObject.h @@ -30,31 +30,17 @@ public: NETVAR(m_bDisposableBuilding, bool, "CBaseObject", "m_bDisposableBuilding"); NETVAR(m_bWasMapPlaced, bool, "CBaseObject", "m_bWasMapPlaced"); NETVAR(m_bPlasmaDisable, bool, "CBaseObject", "m_bPlasmaDisable"); - - VIRTUAL(GetNumBuildPoints, int, void*, IHasBuildPoints(), 0); - - inline void* IHasBuildPoints() + void* IHasBuildPoints() { static int nOffset = U::NetVars.GetNetVar("CBaseObject", "m_iUpgradeLevel") - 340; return reinterpret_cast(uintptr_t(this) + nOffset); - }; - - inline bool GetBuildPoint(int iPoint, Vec3& vecOrigin, Vec3& vecAngles) - { - void* pPoints = IHasBuildPoints(); - return reinterpret_cast(U::Memory.GetVFunc(pPoints, 1))(pPoints, iPoint, vecOrigin, vecAngles); } - inline int GetBuildPointAttachmentIndex(int iPoint) - { - void* pPoints = IHasBuildPoints(); - return reinterpret_cast(U::Memory.GetVFunc(pPoints, 2))(pPoints, iPoint); - } + VIRTUAL(GetNumBuildPoints, int, 0, IHasBuildPoints()); + VIRTUAL_ARGS(GetBuildPoint, bool, 1, (int iPoint, Vec3& vOrigin, Vec3& vAngles), IHasBuildPoints(), iPoint, std::ref(vOrigin), std::ref(vAngles)); + VIRTUAL_ARGS(GetBuildPointAttachmentIndex, int, 2, (int iPoint), IHasBuildPoints(), iPoint); - inline bool IsDisabled() - { - return m_bDisabled() || m_bHasSapper(); - } + bool IsDisabled(); }; class CObjectSentrygun : public CBaseObject @@ -71,23 +57,8 @@ public: NETVAR(m_iKills, int, "CObjectSentrygun", "m_iKills"); NETVAR(m_iAssists, int, "CObjectSentrygun", "m_iAssists"); - inline int MaxAmmoShells() - { - if (m_iUpgradeLevel() == 1 || m_bMiniBuilding()) - return 150; - else - return 200; - } - - inline void GetAmmoCount(int& iShells, int& iMaxShells, int& iRockets, int& iMaxRockets) - { - const bool bIsMini = m_bMiniBuilding(); - - iShells = m_iAmmoShells(); - iMaxShells = MaxAmmoShells(); - iRockets = bIsMini ? 0 : m_iAmmoRockets(); - iMaxRockets = (bIsMini || m_iUpgradeLevel() < 3) ? 0 : 20; - } + int MaxAmmoShells(); + void GetAmmoCount(int& iShells, int& iMaxShells, int& iRockets, int& iMaxRockets); }; class CObjectDispenser : public CBaseObject diff --git a/Amalgam/src/SDK/Definitions/Main/CBasePlayer.cpp b/Amalgam/src/SDK/Definitions/Main/CBasePlayer.cpp new file mode 100644 index 00000000..bc71682e --- /dev/null +++ b/Amalgam/src/SDK/Definitions/Main/CBasePlayer.cpp @@ -0,0 +1,28 @@ +#include "CBasePlayer.h" + +#include "../../SDK.h" + +bool CBasePlayer::IsAlive() +{ + return m_lifeState() == LIFE_ALIVE; +} + +Vec3 CBasePlayer::GetShootPos() +{ + return m_vecOrigin() + m_vecViewOffset(); +} + +Vec3 CBasePlayer::GetEyePosition() +{ + return GetAbsOrigin() + m_vecViewOffset(); +} + +bool CBasePlayer::OnSolid() +{ + return m_hGroundEntity() || IsOnGround(); +} + +bool CBasePlayer::IsSwimming() +{ + return m_nWaterLevel() > 1; +} \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CBasePlayer.h b/Amalgam/src/SDK/Definitions/Main/CBasePlayer.h index fc8e28e8..dd86ab7a 100644 --- a/Amalgam/src/SDK/Definitions/Main/CBasePlayer.h +++ b/Amalgam/src/SDK/Definitions/Main/CBasePlayer.h @@ -2,7 +2,6 @@ #include "CBaseCombatCharacter.h" #include "CEconWearable.h" #include "CUserCmd.h" -#include "../../../Utils/Signatures/Signatures.h" MAKE_SIGNATURE(CBasePlayer_GetAmmoCount, "client.dll", "48 89 5C 24 ? 57 48 83 EC ? 48 63 DA 48 8B F9 83 FB", 0x0); @@ -85,49 +84,17 @@ public: CONDGET(IsInWater, m_fFlags(), FL_INWATER); CONDGET(IsDucking, m_fFlags(), FL_DUCKING); - VIRTUAL(PreThink, void, void*, this, 262); - VIRTUAL(Think, void, void*, this, 122); - VIRTUAL(PostThink, void, void*, this, 263); - VIRTUAL(GetRenderedWeaponModel, CBaseAnimating*, void*, this, 252); - - inline void SelectItem(const char* ptr, int subtype) - { - reinterpret_cast(U::Memory.GetVFunc(this, 272))(this, ptr, subtype); - } + VIRTUAL(PreThink, void, 262, this); + VIRTUAL(Think, void, 122, this); + VIRTUAL(PostThink, void, 263, this); + VIRTUAL(GetRenderedWeaponModel, CBaseAnimating*, 252, this); + VIRTUAL_ARGS(SelectItem, void, 272, (const char* ptr, int subtype), this, ptr, subtype); - inline bool IsAlive() - { - return m_lifeState() == LIFE_ALIVE; - } + SIGNATURE_ARGS(GetAmmoCount, int, CBasePlayer, (int iAmmoType), this, iAmmoType); - inline Vec3 GetShootPos() - { - return m_vecOrigin() + m_vecViewOffset(); - } - - inline Vec3 GetEyePosition() - { - return GetAbsOrigin() + m_vecViewOffset(); - } - - inline bool OnSolid() - { - return m_hGroundEntity() || IsOnGround(); - } - - inline bool IsSwimming() - { - return m_nWaterLevel() > 1; - } - - inline void SetCurrentCmd(CUserCmd* pCmd) - { - static int nOffset = U::NetVars.GetNetVar("CBasePlayer", "m_hConstraintEntity") - 8; - *reinterpret_cast(uintptr_t(this) + nOffset) = pCmd; - } - - inline int GetAmmoCount(int iAmmoType) - { - return S::CBasePlayer_GetAmmoCount.Call(this, iAmmoType); - } + bool IsAlive(); + Vec3 GetShootPos(); + Vec3 GetEyePosition(); + bool OnSolid(); + bool IsSwimming(); }; \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CBaseProjectile.cpp b/Amalgam/src/SDK/Definitions/Main/CBaseProjectile.cpp new file mode 100644 index 00000000..4a44e438 --- /dev/null +++ b/Amalgam/src/SDK/Definitions/Main/CBaseProjectile.cpp @@ -0,0 +1,8 @@ +#include "CBaseProjectile.h" + +#include "../../SDK.h" + +bool CTFGrenadePipebombProjectile::HasStickyEffects() +{ + return m_iType() == TF_GL_MODE_REMOTE_DETONATE || m_iType() == TF_GL_MODE_REMOTE_DETONATE_PRACTICE; +} \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CBaseProjectile.h b/Amalgam/src/SDK/Definitions/Main/CBaseProjectile.h index 55144ec6..ba7ea4c5 100644 --- a/Amalgam/src/SDK/Definitions/Main/CBaseProjectile.h +++ b/Amalgam/src/SDK/Definitions/Main/CBaseProjectile.h @@ -92,8 +92,5 @@ public: NETVAR_OFF(m_flCreationTime, float, "CTFGrenadePipebombProjectile", "m_iType", 4); NETVAR_OFF(m_bPulsed, bool, "CTFGrenadePipebombProjectile", "m_iType", 12); - inline bool HasStickyEffects() - { - return m_iType() == TF_GL_MODE_REMOTE_DETONATE || m_iType() == TF_GL_MODE_REMOTE_DETONATE_PRACTICE; - } + bool HasStickyEffects(); }; \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CCollisionProperty.h b/Amalgam/src/SDK/Definitions/Main/CCollisionProperty.h index 4db39a55..f21a42c9 100644 --- a/Amalgam/src/SDK/Definitions/Main/CCollisionProperty.h +++ b/Amalgam/src/SDK/Definitions/Main/CCollisionProperty.h @@ -36,13 +36,6 @@ public: class CCollisionProperty : public ICollideable { public: - inline void SetCollisionBounds(const Vec3& mins, const Vec3& maxs) - { - S::CCollisionProperty_SetCollisionBounds.Call(this, std::ref(mins), std::ref(maxs)); - } - - inline void CalcNearestPoint(const Vec3& vecWorldPt, Vec3* pVecNearestWorldPt) - { - S::CCollisionProperty_CalcNearestPoint.Call(this, std::ref(vecWorldPt), pVecNearestWorldPt); - } + SIGNATURE_ARGS(SetCollisionBounds, void, CCollisionProperty, (const Vec3& mins, const Vec3& maxs), this, std::ref(mins), std::ref(maxs)); + SIGNATURE_ARGS(CalcNearestPoint, void, CCollisionProperty, (const Vec3& vecWorldPt, Vec3* pVecNearestWorldPt), this, std::ref(vecWorldPt), pVecNearestWorldPt); }; \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CEconEntity.h b/Amalgam/src/SDK/Definitions/Main/CEconEntity.h index f142cd49..9e4aa2d1 100644 --- a/Amalgam/src/SDK/Definitions/Main/CEconEntity.h +++ b/Amalgam/src/SDK/Definitions/Main/CEconEntity.h @@ -6,5 +6,5 @@ class CEconEntity : public CBaseAnimating public: NETVAR(m_iItemDefinitionIndex, int, "CEconEntity", "m_iItemDefinitionIndex"); - VIRTUAL(UpdateAttachmentModels, void, void*, this, 213); + VIRTUAL(UpdateAttachmentModels, void, 213, this); }; \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CEconWearable.h b/Amalgam/src/SDK/Definitions/Main/CEconWearable.h index 503cdae7..0aaedf4a 100644 --- a/Amalgam/src/SDK/Definitions/Main/CEconWearable.h +++ b/Amalgam/src/SDK/Definitions/Main/CEconWearable.h @@ -4,13 +4,6 @@ class CEconWearable : public CEconEntity { public: - inline void Equip(CBasePlayer* pOwner) - { - reinterpret_cast(U::Memory.GetVFunc(this, 230))(this, pOwner); - }; - - inline void UnEquip(CBasePlayer* pOwner) - { - reinterpret_cast(U::Memory.GetVFunc(this, 231))(this, pOwner); - }; + VIRTUAL_ARGS(Equip, void, 230, (CBasePlayer* pOwner), this, pOwner); + VIRTUAL_ARGS(UnEquip, void, 231, (CBasePlayer* pOwner), this, pOwner); }; \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CEntitySphereQuery.h b/Amalgam/src/SDK/Definitions/Main/CEntitySphereQuery.h index 6e087ccc..7eeacee1 100644 --- a/Amalgam/src/SDK/Definitions/Main/CEntitySphereQuery.h +++ b/Amalgam/src/SDK/Definitions/Main/CEntitySphereQuery.h @@ -1,5 +1,4 @@ #pragma once -#include "../../../Utils/Signatures/Signatures.h" #include "../Definitions.h" #include "CBaseEntity.h" diff --git a/Amalgam/src/SDK/Definitions/Main/CHalloweenPickup.h b/Amalgam/src/SDK/Definitions/Main/CHalloweenPickup.h deleted file mode 100644 index 6e5319a4..00000000 --- a/Amalgam/src/SDK/Definitions/Main/CHalloweenPickup.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once -#include "CBaseAnimating.h" - -class CHalloweenPickup : public CBaseAnimating -{ -public: -}; - -class CHalloweenGiftPickup : public CHalloweenPickup -{ -public: - NETVAR(m_hTargetPlayer, EHANDLE, "CHalloweenGiftPickup", "m_hTargetPlayer"); -}; \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Misc/CPlayerResource.h b/Amalgam/src/SDK/Definitions/Main/CPlayerResource.h similarity index 90% rename from Amalgam/src/SDK/Definitions/Misc/CPlayerResource.h rename to Amalgam/src/SDK/Definitions/Main/CPlayerResource.h index 1c9b4953..5ade5302 100644 --- a/Amalgam/src/SDK/Definitions/Misc/CPlayerResource.h +++ b/Amalgam/src/SDK/Definitions/Main/CPlayerResource.h @@ -1,7 +1,7 @@ #pragma once -#include "IGameResources.h" -#include "String.h" -#include "../Main/CBaseEntity.h" +#include "CBaseEntity.h" +#include "../Misc/IGameResources.h" +#include "../Misc/String.h" #define PLAYER_UNCONNECTED_NAME "unconnected" #define PLAYER_ERROR_NAME "ERRORNAME" diff --git a/Amalgam/src/SDK/Definitions/Main/CTFPlayer.cpp b/Amalgam/src/SDK/Definitions/Main/CTFPlayer.cpp new file mode 100644 index 00000000..d8c01593 --- /dev/null +++ b/Amalgam/src/SDK/Definitions/Main/CTFPlayer.cpp @@ -0,0 +1,206 @@ +#include "CTFPlayer.h" + +#include "../../SDK.h" + +Vec3 CTFPlayer::GetEyeAngles() +{ + return { m_angEyeAnglesX(), m_angEyeAnglesY(), 0.f }; +} + +Vec3 CTFPlayer::GetViewOffset() +{ + if (!IsPlayer()) + return GetOffset() / 2; + + auto getMainOffset = [this]() -> Vec3 + { + if (IsDucking()) + return { 0.f, 0.f, 45.f }; + + switch (m_iClass()) + { + case TF_CLASS_SCOUT: return { 0.f, 0.f, 65.f }; + case TF_CLASS_SOLDIER: return { 0.f, 0.f, 68.f }; + case TF_CLASS_PYRO: return { 0.f, 0.f, 68.f }; + case TF_CLASS_DEMOMAN: return { 0.f, 0.f, 68.f }; + case TF_CLASS_HEAVY: return { 0.f, 0.f, 75.f }; + case TF_CLASS_ENGINEER: return { 0.f, 0.f, 68.f }; + case TF_CLASS_MEDIC: return { 0.f, 0.f, 75.f }; + case TF_CLASS_SNIPER: return { 0.f, 0.f, 75.f }; + case TF_CLASS_SPY: return { 0.f, 0.f, 75.f }; + } + + const Vec3 vOffset = m_vecViewOffset(); + if (vOffset.z) + return vOffset; + + return { 0.f, 0.f, 68.f }; + }; + + return getMainOffset() * m_flModelScale(); +} + +bool CTFPlayer::InCond(const ETFCond cond) +{ + const int iCond = static_cast(cond); + switch (iCond / 32) + { + case 0: + { + const int bit = (1 << iCond); + if ((m_nPlayerCond() & bit) == bit || (_condition_bits() & bit) == bit) + return true; + break; + } + case 1: + { + const int bit = 1 << (iCond - 32); + if ((m_nPlayerCondEx() & bit) == bit) + return true; + break; + } + case 2: + { + const int bit = 1 << (iCond - 64); + if ((m_nPlayerCondEx2() & bit) == bit) + return true; + break; + } + case 3: + { + const int bit = 1 << (iCond - 96); + if ((m_nPlayerCondEx3() & bit) == bit) + return true; + break; + } + case 4: + { + const int bit = 1 << (iCond - 128); + if ((m_nPlayerCondEx4() & bit) == bit) + return true; + break; + } + } + + return false; +} + +bool CTFPlayer::IsAGhost() +{ + return InCond(TF_COND_HALLOWEEN_GHOST_MODE); +}; +bool CTFPlayer::IsTaunting() +{ + return InCond(TF_COND_TAUNTING); +}; + +bool CTFPlayer::IsInvisible() +{ + if (InCond(TF_COND_BURNING) + || InCond(TF_COND_BURNING_PYRO) + || InCond(TF_COND_MAD_MILK) + || InCond(TF_COND_URINE)) + return false; + + return m_flInvisibility() >= 1.f; +} + +bool CTFPlayer::IsInvulnerable() +{ + return InCond(TF_COND_INVULNERABLE) + || InCond(TF_COND_INVULNERABLE_CARD_EFFECT) + || InCond(TF_COND_INVULNERABLE_HIDE_UNLESS_DAMAGED) + || InCond(TF_COND_INVULNERABLE_USER_BUFF) + || InCond(TF_COND_PHASE); +} + +bool CTFPlayer::IsUbered() +{ + return InCond(TF_COND_INVULNERABLE) + || InCond(TF_COND_INVULNERABLE_CARD_EFFECT) + || InCond(TF_COND_INVULNERABLE_HIDE_UNLESS_DAMAGED) + || InCond(TF_COND_INVULNERABLE_USER_BUFF); +} + +bool CTFPlayer::IsCritBoosted() +{ + return InCond(TF_COND_CRITBOOSTED) + || InCond(TF_COND_CRITBOOSTED_BONUS_TIME) + || InCond(TF_COND_CRITBOOSTED_CARD_EFFECT) + || InCond(TF_COND_CRITBOOSTED_CTF_CAPTURE) + || InCond(TF_COND_CRITBOOSTED_FIRST_BLOOD) + || InCond(TF_COND_CRITBOOSTED_ON_KILL) + || InCond(TF_COND_CRITBOOSTED_PUMPKIN) + || InCond(TF_COND_CRITBOOSTED_RAGE_BUFF) + || InCond(TF_COND_CRITBOOSTED_RUNE_TEMP) + || InCond(TF_COND_CRITBOOSTED_USER_BUFF); +} + +bool CTFPlayer::IsMiniCritBoosted() +{ + return InCond(TF_COND_OFFENSEBUFF) + || InCond(TF_COND_ENERGY_BUFF) + || InCond(TF_COND_MINICRITBOOSTED_ON_KILL) + || InCond(TF_COND_NOHEALINGDAMAGEBUFF) + /*|| InCond(TF_COND_CRITBOOSTED_DEMO_CHARGE)*/; +} + +bool CTFPlayer::IsMarked() +{ + return InCond(TF_COND_URINE) + || InCond(TF_COND_MARKEDFORDEATH) + || InCond(TF_COND_MARKEDFORDEATH_SILENT) + || InCond(TF_COND_PASSTIME_PENALTY_DEBUFF); +} + +bool CTFPlayer::CanAttack(bool bCloak, bool bLocal) +{ + if (!IsAlive() || IsAGhost() || IsTaunting() || m_bViewingCYOAPDA() + || InCond(TF_COND_PHASE) || InCond(TF_COND_HALLOWEEN_KART) || InCond(TF_COND_STUNNED) && m_iStunFlags() & (TF_STUN_CONTROLS | TF_STUN_LOSER_STATE)) + return false; + + if (bCloak) + { + if (bLocal + ? (m_flStealthNoAttackExpire() > TICKS_TO_TIME(m_nTickBase()) && !InCond(TF_COND_STEALTHED_USER_BUFF)) || InCond(TF_COND_STEALTHED) + : m_flInvisibility() && (InCond(TF_COND_STEALTHED) || !InCond(TF_COND_STEALTHED_USER_BUFF) && !InCond(TF_COND_STEALTHED_USER_BUFF_FADING))) + { + auto pWeapon = m_hActiveWeapon().Get()->As(); + if (!pWeapon || pWeapon->GetWeaponID() != TF_WEAPON_GRAPPLINGHOOK) + return false; + } + + if (m_bFeignDeathReady()) + return false; + } + + auto pGameRules = I::TFGameRules(); + if (pGameRules) + { + switch (pGameRules->m_iRoundState()) + { + case GR_STATE_TEAM_WIN: + if (m_iTeamNum() != pGameRules->m_iWinningTeam()) + return false; + break; + case GR_STATE_BETWEEN_RNDS: + if (m_fFlags() & FL_FROZEN) + return false; + break; + case GR_STATE_GAME_OVER: + if (m_fFlags() & FL_FROZEN || m_iTeamNum() != pGameRules->m_iWinningTeam()) + return false; + break; + } + } + + if (SDK::AttribHookValue(0, "no_attack", this)) + return false; + + return true; +} + +float CTFPlayer::GetCritMult() +{ + return Math::RemapVal(m_iCritMult(), 0.f, 255.f, 1.f, 4.f); +} \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CTFPlayer.h b/Amalgam/src/SDK/Definitions/Main/CTFPlayer.h index 376f3f87..a879072c 100644 --- a/Amalgam/src/SDK/Definitions/Main/CTFPlayer.h +++ b/Amalgam/src/SDK/Definitions/Main/CTFPlayer.h @@ -1,7 +1,6 @@ #pragma once #include "CBasePlayer.h" #include "CMultiPlayerAnimState.h" -#include "../../../Utils/Signatures/Signatures.h" MAKE_SIGNATURE(CTFPlayer_IsPlayerOnSteamFriendsList, "client.dll", "40 57 48 81 EC ? ? ? ? 48 8B FA E8", 0x0); MAKE_SIGNATURE(TeamFortress_CalculateMaxSpeed, "client.dll", "88 54 24 ? 53 55", 0x0); @@ -190,6 +189,7 @@ public: NETVAR_OFF(m_MoveCollide, byte, "CTFPlayer", "m_nWaterLevel", -3); NETVAR_OFF(m_nWaterType, byte, "CTFPlayer", "m_nWaterLevel", 1); NETVAR_OFF(m_flInvisibility, float, "CTFPlayer", "m_flInvisChangeCompleteTime", -8); + NETVAR_OFF(m_flPrevInvisibility, float, "CTFPlayer", "m_flInvisChangeCompleteTime", -4); NETVAR_OFF(m_flTankPressure, float, "CTFPlayer", "m_Shared", 636); NETVAR_OFF(GetAnimState, CTFPlayerAnimState*, "CTFPlayer", "m_hItem", -88); NETVAR_OFF(m_flPrevTauntYaw, float, "CTFPlayer", "m_flTauntYaw", 4); @@ -198,229 +198,27 @@ public: NETVAR_OFF(m_bStunNeedsFadeOut, bool, "CTFPlayer", "m_hItem", -188); NETVAR_OFF(m_bTauntForceMoveForward, bool, "CTFPlayer", "m_bAllowMoveDuringTaunt", 1); - VIRTUAL(GetMaxHealth, int, void*, this, 107); + VIRTUAL(GetMaxHealth, int, 107, this); + VIRTUAL(ThirdPersonSwitch, void, 256, this); - inline Vec3 GetEyeAngles() - { - return { m_angEyeAnglesX(), m_angEyeAnglesY(), 0.f }; - } + SIGNATURE_ARGS(CalculateMaxSpeed, float, TeamFortress, (bool bIgnoreSpecialAbility = false), this, bIgnoreSpecialAbility); + SIGNATURE(IsPlayerOnSteamFriendsList, bool, CTFPlayer, this, this); + SIGNATURE(UpdateClientSideAnimation, void, CTFPlayer, this); + SIGNATURE(UpdateWearables, void, CTFPlayer, this); - inline Vec3 GetViewOffset() // use on nonlocal players - { - if (!IsPlayer()) - return (m_vecMins() + m_vecMaxs()) / 2; - - auto getMainOffset = [this]() -> Vec3 - { - if (IsDucking()) - return { 0.f, 0.f, 45.f }; - - switch (m_iClass()) - { - case TF_CLASS_SCOUT: return { 0.f, 0.f, 65.f }; - case TF_CLASS_SOLDIER: return { 0.f, 0.f, 68.f }; - case TF_CLASS_PYRO: return { 0.f, 0.f, 68.f }; - case TF_CLASS_DEMOMAN: return { 0.f, 0.f, 68.f }; - case TF_CLASS_HEAVY: return { 0.f, 0.f, 75.f }; - case TF_CLASS_ENGINEER: return { 0.f, 0.f, 68.f }; - case TF_CLASS_MEDIC: return { 0.f, 0.f, 75.f }; - case TF_CLASS_SNIPER: return { 0.f, 0.f, 75.f }; - case TF_CLASS_SPY: return { 0.f, 0.f, 75.f }; - } - - const Vec3 vOffset = m_vecViewOffset(); - if (vOffset.z) - return vOffset; - - return { 0.f, 0.f, 68.f }; - }; - - return getMainOffset() * m_flModelScale(); - } - - inline bool IsFriend() - { - return S::CTFPlayer_IsPlayerOnSteamFriendsList.Call(this, this); - } - - inline bool InCond(const ETFCond cond) - { - const int iCond = static_cast(cond); - switch (iCond / 32) - { - case 0: - { - const int bit = (1 << iCond); - if ((m_nPlayerCond() & bit) == bit || (_condition_bits() & bit) == bit) - return true; - break; - } - case 1: - { - const int bit = 1 << (iCond - 32); - if ((m_nPlayerCondEx() & bit) == bit) - return true; - break; - } - case 2: - { - const int bit = 1 << (iCond - 64); - if ((m_nPlayerCondEx2() & bit) == bit) - return true; - break; - } - case 3: - { - const int bit = 1 << (iCond - 96); - if ((m_nPlayerCondEx3() & bit) == bit) - return true; - break; - } - case 4: - { - const int bit = 1 << (iCond - 128); - if ((m_nPlayerCondEx4() & bit) == bit) - return true; - break; - } - } - - return false; - } - - inline bool IsAGhost() - { - return InCond(TF_COND_HALLOWEEN_GHOST_MODE); - }; - inline bool IsTaunting() - { - return InCond(TF_COND_TAUNTING); - }; - - inline bool IsInvisible() - { - if (InCond(TF_COND_BURNING) - || InCond(TF_COND_BURNING_PYRO) - || InCond(TF_COND_MAD_MILK) - || InCond(TF_COND_URINE)) - return false; - - return m_flInvisibility() >= 1.f; - } - - inline float GetInvisPercentage() - { - static auto tf_spy_invis_time = I::CVar->FindVar("tf_spy_invis_time"); - const float flInvisTime = tf_spy_invis_time ? tf_spy_invis_time->GetFloat() : 1.f; - const float GetInvisPercent = Math::RemapVal(m_flInvisChangeCompleteTime() - I::GlobalVars->curtime, flInvisTime, 0.f, 0.f, 100.f); - - return GetInvisPercent; - } - - inline bool IsInvulnerable() - { - return InCond(TF_COND_INVULNERABLE) - || InCond(TF_COND_INVULNERABLE_CARD_EFFECT) - || InCond(TF_COND_INVULNERABLE_HIDE_UNLESS_DAMAGED) - || InCond(TF_COND_INVULNERABLE_USER_BUFF) - || InCond(TF_COND_PHASE); - } - - inline bool IsUbered() - { - return InCond(TF_COND_INVULNERABLE) - || InCond(TF_COND_INVULNERABLE_CARD_EFFECT) - || InCond(TF_COND_INVULNERABLE_HIDE_UNLESS_DAMAGED) - || InCond(TF_COND_INVULNERABLE_USER_BUFF); - } - - inline bool IsCritBoosted() - { - return InCond(TF_COND_CRITBOOSTED) - || InCond(TF_COND_CRITBOOSTED_BONUS_TIME) - || InCond(TF_COND_CRITBOOSTED_CARD_EFFECT) - || InCond(TF_COND_CRITBOOSTED_CTF_CAPTURE) - || InCond(TF_COND_CRITBOOSTED_FIRST_BLOOD) - || InCond(TF_COND_CRITBOOSTED_ON_KILL) - || InCond(TF_COND_CRITBOOSTED_PUMPKIN) - || InCond(TF_COND_CRITBOOSTED_RAGE_BUFF) - || InCond(TF_COND_CRITBOOSTED_RUNE_TEMP) - || InCond(TF_COND_CRITBOOSTED_USER_BUFF); - } - - inline bool IsMiniCritBoosted() - { - return InCond(TF_COND_OFFENSEBUFF) - || InCond(TF_COND_ENERGY_BUFF) - || InCond(TF_COND_MINICRITBOOSTED_ON_KILL) - || InCond(TF_COND_NOHEALINGDAMAGEBUFF) - /*|| InCond(TF_COND_CRITBOOSTED_DEMO_CHARGE)*/; - } - - inline bool IsMarked() - { - return InCond(TF_COND_URINE) - || InCond(TF_COND_MARKEDFORDEATH) - || InCond(TF_COND_MARKEDFORDEATH_SILENT); - } - - inline bool CanAttack() - { - if (!IsAlive() || IsAGhost() || IsTaunting() || InCond(TF_COND_PHASE) || InCond(TF_COND_HALLOWEEN_KART) || m_fFlags() & FL_FROZEN) - return false; - - if (m_iClass() == TF_CLASS_SPY) - { - if (m_bFeignDeathReady() && !InCond(TF_COND_STEALTHED)) - return false; - - //Invis - static float flTimer = 0.f; - if (InCond(TF_COND_STEALTHED)) - { - flTimer = 0.f; - return false; - } - else - { - if (!flTimer) - flTimer = I::GlobalVars->curtime; - - if (flTimer > I::GlobalVars->curtime) - flTimer = 0.f; - - if ((I::GlobalVars->curtime - flTimer) < 2.f) - return false; - } - } - - return true; - } - - inline float TeamFortress_CalculateMaxSpeed(bool bIgnoreSpecialAbility = false) - { - return S::TeamFortress_CalculateMaxSpeed.Call(this, bIgnoreSpecialAbility); - } - - inline void UpdateClientSideAnimation() - { - S::CTFPlayer_UpdateClientSideAnimation.Call(this); - } - - inline float GetCritMult() - { - return Math::RemapVal(static_cast(m_iCritMult()), 0.f, 255.f, 1.f, 4.f); - } - - inline void UpdateWearables() - { - S::CTFPlayer_UpdateWearables.Call(this); - } - - inline void ThirdPersonSwitch(/*bool bThirdperson*/) - { - return reinterpret_cast(U::Memory.GetVFunc(this, 256))(this/*, bThirdperson*/); - }; + Vec3 GetEyeAngles(); + Vec3 GetViewOffset(); // use on nonlocal players + bool InCond(const ETFCond cond); + bool IsAGhost(); + bool IsTaunting(); + bool IsInvisible(); + bool IsInvulnerable(); + bool IsUbered(); + bool IsCritBoosted(); + bool IsMiniCritBoosted(); + bool IsMarked(); + bool CanAttack(bool bCloak = true, bool bLocal = true); + float GetCritMult(); }; class CTFRagdoll : public CBaseFlex diff --git a/Amalgam/src/SDK/Definitions/Main/CTFPlayerResource.h b/Amalgam/src/SDK/Definitions/Main/CTFPlayerResource.h index db230fcd..24e18a0e 100644 --- a/Amalgam/src/SDK/Definitions/Main/CTFPlayerResource.h +++ b/Amalgam/src/SDK/Definitions/Main/CTFPlayerResource.h @@ -1,5 +1,5 @@ #pragma once -#include "../Misc/CPlayerResource.h" +#include "CPlayerResource.h" enum MM_PlayerConnectionState_t { diff --git a/Amalgam/src/SDK/Definitions/Main/CTFWeaponBase.cpp b/Amalgam/src/SDK/Definitions/Main/CTFWeaponBase.cpp index ae2ce1ea..b1c456c0 100644 --- a/Amalgam/src/SDK/Definitions/Main/CTFWeaponBase.cpp +++ b/Amalgam/src/SDK/Definitions/Main/CTFWeaponBase.cpp @@ -1,8 +1,237 @@ #include "CTFWeaponBase.h" -#include "../../Helpers/Draw/Draw.h" + +#include "../../SDK.h" + +bool CTFWeaponBase::HasPrimaryAmmoForShot() +{ + if (IsEnergyWeapon()) + return m_flEnergy() > 0.f; + + int iClip = m_iClip1(); + auto pOwner = m_hOwnerEntity().Get(); + return (iClip == -1 && pOwner ? pOwner->As()->GetAmmoCount(m_iPrimaryAmmoType()) : iClip) >= GetAmmoPerShot(); +} + +bool CTFWeaponBase::CanPrimaryAttack() +{ + auto pOwner = m_hOwnerEntity().Get()->As(); + if (!pOwner) + return false; + + float flCurTime = TICKS_TO_TIME(pOwner->m_nTickBase()); + return m_flNextPrimaryAttack() <= flCurTime && pOwner->m_flNextAttack() <= flCurTime; +} + +bool CTFWeaponBase::CanSecondaryAttack() +{ + auto pOwner = m_hOwnerEntity().Get()->As(); + if (!pOwner) + return false; + + float flCurTime = TICKS_TO_TIME(pOwner->m_nTickBase()); + return m_flNextSecondaryAttack() <= flCurTime && pOwner->m_flNextAttack() <= flCurTime; +} + +bool CTFWeaponBase::CanFireCriticalShot(bool bIsHeadshot) +{ + auto pOwner = m_hOwnerEntity().Get()->As(); + if (!pOwner) + return false; + + int& iFOV = pOwner->m_iFOV(), nFovBackup = iFOV; + iFOV = 70; + bool bReturn = U::Memory.CallVirtual<428, bool>(this, bIsHeadshot, nullptr); + iFOV = nFovBackup; + return bReturn; +} + +bool CTFWeaponBase::CanHeadShot() +{ + return GetDamageType() & DMG_USE_HITLOCATIONS && CanFireCriticalShot(true); +} + +bool CTFWeaponBase::AmbassadorCanHeadshot(float flCurTime) +{ + if (GetClassID() == ETFClassID::CTFRevolver && SDK::AttribHookValue(0, "set_weapon_mode", this) == 1) + return flCurTime - m_flLastFireTime() > 1.f; + return false; +} + +bool CTFWeaponBase::IsInReload() +{ + return m_bInReload() || m_iReloadMode() != 0; +} + +float CTFWeaponBase::GetDamage(bool bAttribHookValue) +{ + if (auto pWeaponInfo = GetWeaponInfo()) + { + if (!bAttribHookValue) + return pWeaponInfo->GetWeaponData(0).m_nDamage; + return SDK::AttribHookValue(pWeaponInfo->GetWeaponData(0).m_nDamage, "mult_dmg", this); + } + return 0.f; +} + +float CTFWeaponBase::GetFireRate(bool bAttribHookValue) +{ + if (auto pWeaponInfo = GetWeaponInfo()) + { + if (!bAttribHookValue) + return pWeaponInfo->GetWeaponData(0).m_flTimeFireDelay; + return SDK::AttribHookValue(pWeaponInfo->GetWeaponData(0).m_flTimeFireDelay, "mult_postfiredelay", this); + } + return 0.315f; +} + +int CTFWeaponBase::GetBulletsPerShot(bool bAttribHookValue) +{ + if (auto pWeaponInfo = GetWeaponInfo()) + { + if (!bAttribHookValue) + return pWeaponInfo->GetWeaponData(0).m_nBulletsPerShot; + return SDK::AttribHookValue(pWeaponInfo->GetWeaponData(0).m_nBulletsPerShot, "mult_bullets_per_shot", this); + } + return 1; +} + +int CTFWeaponBase::GetAmmoPerShot(bool bAttribHookValue) +{ + if (auto pWeaponInfo = GetWeaponInfo()) + { + if (!bAttribHookValue) + return pWeaponInfo->GetWeaponData(0).m_iAmmoPerShot; + int iAmmoPerShot = SDK::AttribHookValue(0, "mod_ammo_per_shot", this); + return iAmmoPerShot > 0 ? iAmmoPerShot : pWeaponInfo->GetWeaponData(0).m_iAmmoPerShot; + } + return 1; +} + +bool CTFWeaponBase::IsRapidFire() +{ + if (auto pWeaponInfo = GetWeaponInfo()) + return pWeaponInfo->GetWeaponData(0).m_bUseRapidFireCrits; + return false; +} + +float CTFWeaponBase::GetRange() +{ + switch (GetWeaponID()) + { + case TF_WEAPON_MEDIGUN: return 450.f; + case TF_WEAPON_MECHANICAL_ARM: return 256.f; + } + + if (auto pWeaponInfo = GetWeaponInfo()) + return pWeaponInfo->GetWeaponData(0).m_flRange; + return 8192.f; +} + + + +int CWeaponMedigun::GetMedigunType() +{ + return SDK::AttribHookValue(0, "set_weapon_mode", this); +} + +MedigunChargeTypes CWeaponMedigun::GetChargeType() +{ + int iTmp = SDK::AttribHookValue(MEDIGUN_CHARGE_INVULN, "set_charge_type", this); + if (GetMedigunType() == MEDIGUN_RESIST) + iTmp += m_nChargeResistType(); + + return MedigunChargeTypes(iTmp); +} + +medigun_resist_types_t CWeaponMedigun::GetResistType() +{ + int nCurrentActiveResist = (GetChargeType() - MEDIGUN_CHARGE_BULLET_RESIST); + nCurrentActiveResist = nCurrentActiveResist % MEDIGUN_NUM_RESISTS; + return medigun_resist_types_t(nCurrentActiveResist); +} + + + +int CTFPipebombLauncher::GetDetonateType() +{ + return SDK::AttribHookValue(0, "set_detonate_mode", this); +} + + + +int CTFSniperRifle::GetRifleType() +{ + return SDK::AttribHookValue(0, "set_weapon_mode", this); +} + +float CTFSniperRifle::GetHeadshotMult(CTFPlayer* pTarget) +{ + auto GetMainMult = [&]() + { + auto pOwner = m_hOwnerEntity().Get()->As(); + if (pOwner && pOwner->IsCritBoosted()) + return 3.f; + + if (GetRifleType() == RIFLE_JARATE) + { + if (SDK::AttribHookValue(0, "jarate_duration", this) > 0) + return 1.36f; + + if (pOwner && pOwner->IsMiniCritBoosted() + || pTarget && (pTarget->InCond(TF_COND_URINE) || pTarget->InCond(TF_COND_MARKEDFORDEATH))) + return 1.36f; + + return 1.f; + } + + return 3.f; + }; + + float flMult = SDK::AttribHookValue(GetMainMult(), "mult_dmg", this); + if (m_flChargedDamage() == 150.f) + flMult = SDK::AttribHookValue(flMult, "sniper_full_charge_damage_bonus", this); + return flMult; +} + +float CTFSniperRifle::GetBodyshotMult(CTFPlayer* pTarget) +{ + auto GetMainMult = [&]() + { + auto pOwner = m_hOwnerEntity().Get()->As(); + if (pOwner && pOwner->IsCritBoosted()) + return 3.f; + + if (pOwner && pOwner->IsMiniCritBoosted() + || pTarget && (pTarget->InCond(TF_COND_URINE) || pTarget->InCond(TF_COND_MARKEDFORDEATH))) + return 1.36f; + + return 1.f; + }; + + float flMult = SDK::AttribHookValue(GetMainMult(), "mult_dmg", this); + flMult = SDK::AttribHookValue(flMult, "bodyshot_damage_modify", this); + if (m_flChargedDamage() == 150.f) + flMult = SDK::AttribHookValue(flMult, "sniper_full_charge_damage_bonus", this); + return flMult; +} + + + +int CTFGrenadeLauncher::GetDetonateType() +{ + return SDK::AttribHookValue(0, "set_detonate_mode", this); +} + + + +int CTFFlareGun::GetFlareGunType() +{ + return SDK::AttribHookValue(0, "set_weapon_mode", this); +} + + #define ReturnTexture(string) { static CHudTexture* pTexture = H::Draw.GetIcon(string); return pTexture; } - CHudTexture* CTFWeaponBase::GetWeaponIcon() // wow this is stupid { switch (m_iItemDefinitionIndex()) diff --git a/Amalgam/src/SDK/Definitions/Main/CTFWeaponBase.h b/Amalgam/src/SDK/Definitions/Main/CTFWeaponBase.h index 5cccaf2c..d75ec384 100644 --- a/Amalgam/src/SDK/Definitions/Main/CTFWeaponBase.h +++ b/Amalgam/src/SDK/Definitions/Main/CTFWeaponBase.h @@ -1,14 +1,17 @@ #pragma once #include "CBaseCombatWeapon.h" -#include "CTFPlayer.h" -#include "CBaseProjectile.h" MAKE_SIGNATURE(CTFWeaponBase_GetSpreadAngles, "client.dll", "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 0F 29 74 24 ? 48 8B DA 48 8B F9 E8 ? ? ? ? 48 8B C8", 0x0); MAKE_SIGNATURE(CTFWeaponBase_UpdateAllViewmodelAddons, "client.dll", "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 48 8B D9 E8 ? ? ? ? 48 8B F8", 0x0); +MAKE_SIGNATURE(CTFWeaponBase_CalcIsAttackCritical, "client.dll", "48 89 74 24 ? 57 48 83 EC ? 48 8B F9 E8 ? ? ? ? 48 8B C8 C7 44 24 ? ? ? ? ? 4C 8D 0D ? ? ? ? 33 D2 4C 8D 05 ? ? ? ? E8 ? ? ? ? 48 8B F0 48 85 C0 0F 84 ? ? ? ? 48 8B 10", 0x0); MAKE_SIGNATURE(CTFWeaponBaseMelee_CalcIsAttackCriticalHelper, "client.dll", "40 57 48 83 EC ? 48 8B 05 ? ? ? ? 48 8B F9 83 78 ? ? 75", 0x0); MAKE_SIGNATURE(CTFWeaponBase_CalcIsAttackCriticalHelper, "client.dll", "48 89 5C 24 ? 55 56 57 48 81 EC ? ? ? ? 0F 29 74 24", 0x0); MAKE_SIGNATURE(CTFWeaponBase_GetAppropriateWorldOrViewModel, "client.dll", "48 89 5C 24 ? 57 48 83 EC ? 48 8B D9 E8 ? ? ? ? 48 8B C8 C7 44 24 ? ? ? ? ? 4C 8D 0D ? ? ? ? 33 D2 4C 8D 05 ? ? ? ? E8 ? ? ? ? 48 8B F8 48 85 C0 74 ? 48 8B CB", 0x0); MAKE_SIGNATURE(CTFWeaponBase_IncrementAmmo, "client.dll", "48 89 5C 24 ? 56 48 83 EC ? 48 8B D9 E8 ? ? ? ? 48 8B C8", 0x0); +MAKE_SIGNATURE(CTFWeaponBase_GetMaxClip1, "client.dll", "40 53 48 83 EC ? 48 8B 01 48 8B D9 FF 90 ? ? ? ? 48 8B CB 84 C0 74", 0x0); + +class CTFPlayer; +class CTFGrenadePipebombProjectile; //credits: KGB (all weapon info stuff below) typedef unsigned short WEAPON_FILE_INFO_HANDLE; @@ -192,6 +195,7 @@ public: NETVAR_OFF(m_flCritTokenBucket, float, "CTFWeaponBase", "m_iReloadMode", -244); NETVAR_OFF(m_nCritChecks, int, "CTFWeaponBase", "m_iReloadMode", -240); NETVAR_OFF(m_nCritSeedRequests, int, "CTFWeaponBase", "m_iReloadMode", -236); + NETVAR_OFF(m_iWeaponMode, int, "CTFWeaponBase", "m_iReloadMode", -4); NETVAR_OFF(m_flCritTime, float, "CTFWeaponBase", "m_flLastCritCheckTime", -4); NETVAR_OFF(m_iCurrentSeed, int, "CTFWeaponBase", "m_flLastCritCheckTime", 8); NETVAR_OFF(m_flLastRapidFireCritCheckTime, float, "CTFWeaponBase", "m_flLastCritCheckTime", 12); @@ -201,200 +205,51 @@ public: return reinterpret_cast(uintptr_t(this) + nOffset); }; - VIRTUAL(GetSlot, int, void*, this, 331); - VIRTUAL(GetWeaponID, int, void*, this, 383); - VIRTUAL(GetDamageType, int, void*, this, 384); - VIRTUAL(IsEnergyWeapon, bool, void*, this, 435); - VIRTUAL(AreRandomCritsEnabled, bool, void*, this, 405); - VIRTUAL(GetWeaponSpread, float, void*, this, 470); - - OFFSET(m_iWeaponMode, int, 996); - - inline float GetSwingRange(CBaseEntity* pLocal) - { - return reinterpret_cast(U::Memory.GetVFunc(this, 458))(pLocal); - } - - inline float GetSwingRange() - { - return GetWeaponID() == TF_WEAPON_SWORD ? 72.f : 48.f; - } - - inline bool CanFireCriticalShot(bool bIsHeadshot = false) - { - auto pOwner = m_hOwnerEntity().Get()->As(); - if (!pOwner) - return false; - - int& iFOV = pOwner->m_iFOV(), nFovBackup = iFOV; - iFOV = 70; - bool bReturn = reinterpret_cast(U::Memory.GetVFunc(this, 428))(this, bIsHeadshot, nullptr); - iFOV = nFovBackup; - return bReturn; - } - - inline bool CanPrimaryAttack() - { - auto pOwner = m_hOwnerEntity().Get()->As(); - if (!pOwner) - return false; - - float flCurTime = TICKS_TO_TIME(pOwner->m_nTickBase()); - return m_flNextPrimaryAttack() <= flCurTime && pOwner->m_flNextAttack() <= flCurTime; - } - - inline bool CanSecondaryAttack() - { - auto pOwner = m_hOwnerEntity().Get()->As(); - if (!pOwner) - return false; - - float flCurTime = TICKS_TO_TIME(pOwner->m_nTickBase()); - return m_flNextSecondaryAttack() <= flCurTime && pOwner->m_flNextAttack() <= flCurTime; - } - - inline bool IsInReload() - { - return m_bInReload() || m_iReloadMode() != 0; - } - - inline float GetDamage(bool bAttribHookValue = true) - { - if (auto pWeaponInfo = GetWeaponInfo()) - { - if (!bAttribHookValue) - return pWeaponInfo->GetWeaponData(0).m_nDamage; - return SDK::AttribHookValue(pWeaponInfo->GetWeaponData(0).m_nDamage, "mult_dmg", this); - } - return 0.f; - } - - inline float GetFireRate(bool bAttribHookValue = true) - { - if (auto pWeaponInfo = GetWeaponInfo()) - { - if (!bAttribHookValue) - return pWeaponInfo->GetWeaponData(0).m_flTimeFireDelay; - return SDK::AttribHookValue(pWeaponInfo->GetWeaponData(0).m_flTimeFireDelay, "mult_postfiredelay", this); - } - return 0.315f; - } - - inline int GetBulletsPerShot(bool bAttribHookValue = true) - { - if (auto pWeaponInfo = GetWeaponInfo()) - { - if (!bAttribHookValue) - return pWeaponInfo->GetWeaponData(0).m_nBulletsPerShot; - return SDK::AttribHookValue(pWeaponInfo->GetWeaponData(0).m_nBulletsPerShot, "mult_bullets_per_shot", this); - } - return 1; - } - - inline int GetAmmoPerShot(bool bAttribHookValue = true) - { - if (auto pWeaponInfo = GetWeaponInfo()) - { - if (!bAttribHookValue) - return pWeaponInfo->GetWeaponData(0).m_iAmmoPerShot; - int iAmmoPerShot = SDK::AttribHookValue(0, "mod_ammo_per_shot", this); - return iAmmoPerShot > 0 ? iAmmoPerShot : pWeaponInfo->GetWeaponData(0).m_iAmmoPerShot; - } - return 1; - } - - inline bool IsRapidFire() - { - if (auto pWeaponInfo = GetWeaponInfo()) - return pWeaponInfo->GetWeaponData(0).m_bUseRapidFireCrits; - return false; - } - - inline float GetRange() - { - switch (GetWeaponID()) - { - case TF_WEAPON_MEDIGUN: return 450.f; - case TF_WEAPON_MECHANICAL_ARM: return 256.f; - } - - if (auto pWeaponInfo = GetWeaponInfo()) - return pWeaponInfo->GetWeaponData(0).m_flRange; - return 8192.f; - } - - inline bool CanHeadShot() - { - return GetDamageType() & DMG_USE_HITLOCATIONS && CanFireCriticalShot(true); - } - - inline bool AmbassadorCanHeadshot(float flCurTime = I::GlobalVars->curtime) - { - if (GetClassID() == ETFClassID::CTFRevolver && SDK::AttribHookValue(0, "set_weapon_mode", this) == 1) - return flCurTime - m_flLastFireTime() > 1.f; - return false; - } - - inline bool HasPrimaryAmmoForShot() - { - if (IsEnergyWeapon()) - return m_flEnergy() > 0.f; - - int iClip = m_iClip1(); - auto pOwner = m_hOwnerEntity().Get(); - return (iClip == -1 && pOwner ? pOwner->As()->GetAmmoCount(m_iPrimaryAmmoType()) : iClip) >= GetAmmoPerShot(); - } - - inline void GetProjectileFireSetup(void* pPlayer, Vector vecOffset, Vector* vecSrc, QAngle* angForward, bool bHitTeammates = true, float flEndDist = 2000.f) - { - reinterpret_cast(U::Memory.GetVFunc(this, 402))(this, pPlayer, vecOffset, vecSrc, angForward, bHitTeammates, flEndDist); - } - - inline void GetSpreadAngles(Vec3& out) - { - S::CTFWeaponBase_GetSpreadAngles.Call(this, std::ref(out)); - } - - inline Vec3 GetSpreadAngles() + VIRTUAL(GetSlot, int, 331, this); + VIRTUAL(GetWeaponID, int, 383, this); + VIRTUAL(GetDamageType, int, 384, this); + VIRTUAL(IsEnergyWeapon, bool, 435, this); + VIRTUAL(AreRandomCritsEnabled, bool, 405, this); + VIRTUAL(GetWeaponSpread, float, 470, this); + VIRTUAL_ARGS(ApplyFireDelay, float, 410, (float flDelay), this, flDelay); + VIRTUAL_ARGS(GetSwingRange, int, 458, (CBaseEntity* pLocal), this, pLocal); + + SIGNATURE(GetMaxClip1, float, CTFWeaponBase, this); + SIGNATURE(IncrementAmmo, void, CTFWeaponBase, this); + SIGNATURE(CalcIsAttackCritical, bool, CTFWeaponBase, this); + SIGNATURE(CalcIsAttackCriticalHelper, bool, CTFWeaponBase, this); + SIGNATURE(UpdateAllViewmodelAddons, bool, CTFWeaponBase, this); + SIGNATURE(GetAppropriateWorldOrViewModel, CBaseAnimating*, CTFWeaponBase, this); + SIGNATURE_ARGS(GetSpreadAngles, void, CTFWeaponBase, (Vec3& out), this, std::ref(out)); + Vec3 GetSpreadAngles() { Vec3 vOut; GetSpreadAngles(vOut); return vOut; } - inline void UpdateAllViewmodelAddons() - { - return S::CTFWeaponBase_UpdateAllViewmodelAddons.Call(this); - } - - inline float ApplyFireDelay(float flDelay) - { - return reinterpret_cast(U::Memory.GetVFunc(this, 410))(this, flDelay); - } - - inline bool CalcIsAttackCriticalHelperMelee() - { - return S::CTFWeaponBaseMelee_CalcIsAttackCriticalHelper.Call(this); - } - - inline bool CalcIsAttackCriticalHelper() - { - return S::CTFWeaponBase_CalcIsAttackCriticalHelper.Call(this); - } - - inline CBaseAnimating* GetAppropriateWorldOrViewModel() - { - return S::CTFWeaponBase_GetAppropriateWorldOrViewModel.Call(this); - } - - inline void IncrementAmmo() - { - return S::CTFWeaponBase_IncrementAmmo.Call(this); - } - + bool HasPrimaryAmmoForShot(); + bool CanPrimaryAttack(); + bool CanSecondaryAttack(); + bool CanFireCriticalShot(bool bIsHeadshot = false); + bool IsInReload(); + bool CanHeadShot(); + bool AmbassadorCanHeadshot(float flCurTime = I::GlobalVars->curtime); + float GetDamage(bool bAttribHookValue = true); + float GetFireRate(bool bAttribHookValue = true); + int GetBulletsPerShot(bool bAttribHookValue = true); + int GetAmmoPerShot(bool bAttribHookValue = true); + bool IsRapidFire(); + float GetRange(); CHudTexture* GetWeaponIcon(); }; +class CTFWeaponBaseMelee : public CTFWeaponBase +{ +public: + SIGNATURE(CalcIsAttackCriticalHelper, bool, CTFWeaponBaseMelee, this); +}; + class CTFKnife : public CTFWeaponBase { public: @@ -423,26 +278,9 @@ public: NETVAR(m_hLastHealingTarget, EHANDLE, "CWeaponMedigun", "m_hLastHealingTarget"); NETVAR(m_flChargeLevel, float, "CWeaponMedigun", "m_flChargeLevel"); - inline int GetMedigunType() - { - return SDK::AttribHookValue(0, "set_weapon_mode", this); - } - - inline MedigunChargeTypes GetChargeType() - { - int iTmp = SDK::AttribHookValue(MEDIGUN_CHARGE_INVULN, "set_charge_type", this); - if (GetMedigunType() == MEDIGUN_RESIST) - iTmp += m_nChargeResistType(); - - return MedigunChargeTypes(iTmp); - } - - inline medigun_resist_types_t GetResistType() - { - int nCurrentActiveResist = (GetChargeType() - MEDIGUN_CHARGE_BULLET_RESIST); - nCurrentActiveResist = nCurrentActiveResist % MEDIGUN_NUM_RESISTS; - return medigun_resist_types_t(nCurrentActiveResist); - } + int GetMedigunType(); + MedigunChargeTypes GetChargeType(); + medigun_resist_types_t GetResistType(); }; class CTFPipebombLauncher : public CTFWeaponBase @@ -453,10 +291,7 @@ public: NETVAR_OFF(m_Pipebombs, CUtlVector>, "CTFPipebombLauncher", "m_flChargeBeginTime", -28); - inline int GetDetonateType() - { - return SDK::AttribHookValue(0, "set_detonate_mode", this); - } + int GetDetonateType(); }; class CTFSniperRifle : public CTFWeaponBase @@ -464,61 +299,9 @@ class CTFSniperRifle : public CTFWeaponBase public: NETVAR(m_flChargedDamage, float, "CTFSniperRifle", "m_flChargedDamage"); - inline int GetRifleType() - { - return SDK::AttribHookValue(0, "set_weapon_mode", this); - } - - inline float GetHeadshotMult(CTFPlayer* pTarget = nullptr) - { - auto GetMainMult = [&]() - { - auto pOwner = m_hOwnerEntity().Get()->As(); - if (pOwner && pOwner->IsCritBoosted()) - return 3.f; - - if (GetRifleType() == RIFLE_JARATE) - { - if (SDK::AttribHookValue(0, "jarate_duration", this) > 0) - return 1.36f; - - if (pOwner && pOwner->IsMiniCritBoosted() - || pTarget && (pTarget->InCond(TF_COND_URINE) || pTarget->InCond(TF_COND_MARKEDFORDEATH))) - return 1.36f; - - return 1.f; - } - - return 3.f; - }; - - float flMult = SDK::AttribHookValue(GetMainMult(), "mult_dmg", this); - if (m_flChargedDamage() == 150.f) - flMult = SDK::AttribHookValue(flMult, "sniper_full_charge_damage_bonus", this); - return flMult; - } - - inline float GetBodyshotMult(CTFPlayer* pTarget = nullptr) - { - auto GetMainMult = [&]() - { - auto pOwner = m_hOwnerEntity().Get()->As(); - if (pOwner && pOwner->IsCritBoosted()) - return 3.f; - - if (pOwner && pOwner->IsMiniCritBoosted() - || pTarget && (pTarget->InCond(TF_COND_URINE) || pTarget->InCond(TF_COND_MARKEDFORDEATH))) - return 1.36f; - - return 1.f; - }; - - float flMult = SDK::AttribHookValue(GetMainMult(), "mult_dmg", this); - flMult = SDK::AttribHookValue(flMult, "bodyshot_damage_modify", this); - if (m_flChargedDamage() == 150.f) - flMult = SDK::AttribHookValue(flMult, "sniper_full_charge_damage_bonus", this); - return flMult; - } + int GetRifleType(); + float GetHeadshotMult(CTFPlayer* pTarget = nullptr); + float GetBodyshotMult(CTFPlayer* pTarget = nullptr); }; class CTFGrenadeLauncher : public CTFWeaponBase @@ -528,10 +311,7 @@ public: NETVAR(m_iCurrentTube, int, "CTFGrenadeLauncher", "m_iCurrentTube"); NETVAR(m_iGoalTube, int, "CTFGrenadeLauncher", "m_iGoalTube"); - inline int GetDetonateType() - { - return SDK::AttribHookValue(0, "set_detonate_mode", this); - } + int GetDetonateType(); }; class CTFSniperRifleClassic : public CTFSniperRifle @@ -550,8 +330,26 @@ public: class CTFFlareGun : public CTFWeaponBase { public: - inline int GetFlareGunType() - { - return SDK::AttribHookValue(0, "set_weapon_mode", this); - } + int GetFlareGunType(); +}; + +class CTFThrowable : public CTFWeaponBase +{ +public: + NETVAR(m_flChargeBeginTime, float, "CTFThrowable", "m_flChargeBeginTime"); +}; + +class CTFGrapplingHook : public CTFWeaponBase +{ +public: + NETVAR(m_hProjectile, EHANDLE, "CTFGrapplingHook", "m_hProjectile"); +}; + +class CTFSpellBook : public CTFThrowable +{ +public: + NETVAR(m_flTimeNextSpell, float, "CTFSpellBook", "m_flTimeNextSpell"); + NETVAR(m_iSelectedSpellIndex, int, "CTFSpellBook", "m_iSelectedSpellIndex"); + NETVAR(m_iSpellCharges, int, "CTFSpellBook", "m_iSpellCharges"); + NETVAR(m_bFiredAttack, bool, "CTFSpellBook", "m_bFiredAttack"); }; \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Misc/IMatchGroupDescription.h b/Amalgam/src/SDK/Definitions/Misc/IMatchGroupDescription.h index fcb24df4..11749afb 100644 --- a/Amalgam/src/SDK/Definitions/Misc/IMatchGroupDescription.h +++ b/Amalgam/src/SDK/Definitions/Misc/IMatchGroupDescription.h @@ -102,10 +102,9 @@ class IProgressionDesc public: inline const LevelInfo_t& GetLevelForRating(unsigned nExperience) const { - auto pProgressionDesc = const_cast(this); - auto IProgressionDesc_GetLevelForRating = reinterpret_cast(U::Memory.GetVFunc(pProgressionDesc, 2)); - return IProgressionDesc_GetLevelForRating(pProgressionDesc, nExperience); + return U::Memory.CallVirtual<2, const LevelInfo_t&>(const_cast(this), nExperience); } + inline const LevelInfo_t& GetLevelByNumber(unsigned nNumber) const { return S::IProgressionDesc_GetLevelByNumber.Call(this, nNumber); diff --git a/Amalgam/src/SDK/Events/Events.cpp b/Amalgam/src/SDK/Events/Events.cpp index 62b41640..9c9fc409 100644 --- a/Amalgam/src/SDK/Events/Events.cpp +++ b/Amalgam/src/SDK/Events/Events.cpp @@ -1,6 +1,7 @@ #include "Events.h" #include "../../Core/Core.h" +#include "../../Features/Aimbot/AutoHeal/AutoHeal.h" #include "../../Features/Backtrack/Backtrack.h" #include "../../Features/CheaterDetection/CheaterDetection.h" #include "../../Features/CritHack/CritHack.h" @@ -48,12 +49,13 @@ void CEventListener::FireGameEvent(IGameEvent* pEvent) return; F::CritHack.Event(pEvent, uHash, pLocal); + F::AutoHeal.Event(pEvent, uHash); F::Misc.Event(pEvent, uHash); F::Visuals.Event(pEvent, uHash); switch (uHash) { case FNV1A::Hash32Const("player_hurt"): - F::Resolver.OnPlayerHurt(pEvent); + F::Resolver.PlayerHurt(pEvent); F::CheaterDetection.ReportDamage(pEvent); break; case FNV1A::Hash32Const("player_spawn"): diff --git a/Amalgam/src/SDK/Globals.h b/Amalgam/src/SDK/Globals.h index a7ec0186..843b8a88 100644 --- a/Amalgam/src/SDK/Globals.h +++ b/Amalgam/src/SDK/Globals.h @@ -8,7 +8,7 @@ MAKE_SIGNATURE(RandomSeed, "client.dll", "0F B6 1D ? ? ? ? 89 9D", 0x0); struct DrawLine_t { - std::pair m_vPair; + std::pair m_vOrigin; float m_flTime; Color_t m_tColor; bool m_bZBuffer = false; @@ -25,16 +25,39 @@ struct DrawPath_t struct DrawBox_t { - Vec3 m_vPos; + Vec3 m_vOrigin; Vec3 m_vMins; Vec3 m_vMaxs; - Vec3 m_vRotation; + Vec3 m_vAngles; float m_flTime; Color_t m_tColorEdge; Color_t m_tColorFace; bool m_bZBuffer = false; }; +struct DrawSphere_t +{ + Vec3 m_vOrigin; + float m_flRadius; + int m_nTheta; + int m_nPhi; + float m_flTime; + Color_t m_tColorEdge; + Color_t m_tColorFace; + bool m_bZBuffer = false; +}; + +struct DrawSwept_t +{ + std::pair m_vOrigin; + Vec3 m_vMins; + Vec3 m_vMaxs; + Vec3 m_vAngles; + float m_flTime; + Color_t m_tColor; + bool m_bZBuffer = false; +}; + struct MoveData_t { Vec3 m_vMove = {}; @@ -90,6 +113,8 @@ namespace G inline std::vector LineStorage = {}; inline std::vector PathStorage = {}; inline std::vector BoxStorage = {}; + inline std::vector SphereStorage = {}; + inline std::vector SweptStorage = {}; inline int* RandomSeed() { diff --git a/Amalgam/src/SDK/Helpers/Color/Color.h b/Amalgam/src/SDK/Helpers/Color/Color.h index ae18fc2c..ab94604f 100644 --- a/Amalgam/src/SDK/Helpers/Color/Color.h +++ b/Amalgam/src/SDK/Helpers/Color/Color.h @@ -10,4 +10,4 @@ public: Color_t GetScoreboardColor(int iIndex); }; -ADD_FEATURE_CUSTOM(CColor, Color, H) \ No newline at end of file +ADD_FEATURE_CUSTOM(CColor, Color, H); \ No newline at end of file diff --git a/Amalgam/src/SDK/Helpers/Draw/Draw.cpp b/Amalgam/src/SDK/Helpers/Draw/Draw.cpp index 0bc96994..157b3dcb 100644 --- a/Amalgam/src/SDK/Helpers/Draw/Draw.cpp +++ b/Amalgam/src/SDK/Helpers/Draw/Draw.cpp @@ -79,21 +79,33 @@ Vec2 CDraw::GetTextSize(const wchar_t* text, const Font_t& tFont) return { float(w), float(h) }; } -void CDraw::String(const Font_t& tFont, int x, int y, const Color_t& tColor, const EAlign& eAlign, const char* str, ...) +static wchar_t wstr[1024] = { '\0' }; +void CDraw::String(const Font_t& tFont, int x, int y, const Color_t& tColor, const EAlign& eAlign, const char* str) { - if (str == nullptr) - return; + wsprintfW(wstr, L"%hs", str); + const auto dwFont = tFont.m_dwFont; - va_list va_alist; - char cbuffer[1024] = { '\0' }; - wchar_t wstr[1024] = { '\0' }; - - va_start(va_alist, str); - vsprintf_s(cbuffer, str, va_alist); - va_end(va_alist); - - wsprintfW(wstr, L"%hs", cbuffer); + Vec2 vSize = GetTextSize(str, tFont); + switch (eAlign) + { + case ALIGN_TOPLEFT: break; + case ALIGN_TOP: x -= vSize.x / 2; break; + case ALIGN_TOPRIGHT: x -= vSize.x; break; + case ALIGN_LEFT: y -= vSize.y / 2; break; + case ALIGN_CENTER: x -= vSize.x / 2; y -= vSize.y / 2; break; + case ALIGN_RIGHT: x -= vSize.x; y -= vSize.y / 2; break; + case ALIGN_BOTTOMLEFT: y -= vSize.y; break; + case ALIGN_BOTTOM: x -= vSize.x / 2; y -= vSize.y; break; + case ALIGN_BOTTOMRIGHT: x -= vSize.x; y -= vSize.y; break; + } + I::MatSystemSurface->DrawSetTextPos(x, y); + I::MatSystemSurface->DrawSetTextFont(dwFont); + I::MatSystemSurface->DrawSetTextColor(tColor.r, tColor.g, tColor.b, tColor.a); + I::MatSystemSurface->DrawPrintText(wstr, int(wcslen(wstr))); +} +void CDraw::String(const Font_t& tFont, int x, int y, const Color_t& tColor, const EAlign& eAlign, const wchar_t* wstr) +{ const auto dwFont = tFont.m_dwFont; Vec2 vSize = GetTextSize(wstr, tFont); @@ -115,55 +127,9 @@ void CDraw::String(const Font_t& tFont, int x, int y, const Color_t& tColor, con I::MatSystemSurface->DrawSetTextColor(tColor.r, tColor.g, tColor.b, tColor.a); I::MatSystemSurface->DrawPrintText(wstr, int(wcslen(wstr))); } -void CDraw::String(const Font_t& tFont, int x, int y, const Color_t& tColor, const EAlign& eAlign, const wchar_t* str, ...) +void CDraw::StringOutlined(const Font_t& tFont, int x, int y, const Color_t& tColor, const Color_t& tColorOut, const EAlign& eAlign, const char* str) { - if (str == nullptr) - return; - - va_list va_alist; - wchar_t wstr[1024] = { '\0' }; - - va_start(va_alist, str); - vswprintf_s(wstr, str, va_alist); - va_end(va_alist); - - const auto dwFont = tFont.m_dwFont; - - Vec2 vSize = GetTextSize(wstr, tFont); - switch (eAlign) - { - case ALIGN_TOPLEFT: break; - case ALIGN_TOP: x -= vSize.x / 2; break; - case ALIGN_TOPRIGHT: x -= vSize.x; break; - case ALIGN_LEFT: y -= vSize.y / 2; break; - case ALIGN_CENTER: x -= vSize.x / 2; y -= vSize.y / 2; break; - case ALIGN_RIGHT: x -= vSize.x; y -= vSize.y / 2; break; - case ALIGN_BOTTOMLEFT: y -= vSize.y; break; - case ALIGN_BOTTOM: x -= vSize.x / 2; y -= vSize.y; break; - case ALIGN_BOTTOMRIGHT: x -= vSize.x; y -= vSize.y; break; - } - - I::MatSystemSurface->DrawSetTextPos(x, y); - I::MatSystemSurface->DrawSetTextFont(dwFont); - I::MatSystemSurface->DrawSetTextColor(tColor.r, tColor.g, tColor.b, tColor.a); - I::MatSystemSurface->DrawPrintText(wstr, int(wcslen(wstr))); -} - -void CDraw::StringOutlined(const Font_t& tFont, int x, int y, const Color_t& tColor, const Color_t& tColorOut, const EAlign& eAlign, const char* str, ...) -{ - if (str == nullptr) - return; - - va_list va_alist; - char cbuffer[1024] = { '\0' }; - wchar_t wstr[1024] = { '\0' }; - - va_start(va_alist, str); - vsprintf_s(cbuffer, str, va_alist); - va_end(va_alist); - - wsprintfW(wstr, L"%hs", cbuffer); - + wsprintfW(wstr, L"%hs", str); const auto dwFont = tFont.m_dwFont; Vec2 vSize = GetTextSize(wstr, tFont); @@ -203,18 +169,8 @@ void CDraw::StringOutlined(const Font_t& tFont, int x, int y, const Color_t& tCo I::MatSystemSurface->DrawSetTextColor(tColor.r, tColor.g, tColor.b, tColor.a); I::MatSystemSurface->DrawPrintText(wstr, int(wcslen(wstr))); } -void CDraw::StringOutlined(const Font_t& tFont, int x, int y, const Color_t& tColor, const Color_t& tColorOut, const EAlign& eAlign, const wchar_t* str, ...) +void CDraw::StringOutlined(const Font_t& tFont, int x, int y, const Color_t& tColor, const Color_t& tColorOut, const EAlign& eAlign, const wchar_t* wstr) { - if (str == nullptr) - return; - - va_list va_alist; - wchar_t wstr[1024] = { '\0' }; - - va_start(va_alist, str); - vswprintf_s(wstr, str, va_alist); - va_end(va_alist); - const auto dwFont = tFont.m_dwFont; Vec2 vSize = GetTextSize(wstr, tFont); diff --git a/Amalgam/src/SDK/Helpers/Draw/Draw.h b/Amalgam/src/SDK/Helpers/Draw/Draw.h index 0343eacd..9e690bb7 100644 --- a/Amalgam/src/SDK/Helpers/Draw/Draw.h +++ b/Amalgam/src/SDK/Helpers/Draw/Draw.h @@ -67,10 +67,10 @@ public: Vec2 GetTextSize(const char* text, const Font_t& tFont); Vec2 GetTextSize(const wchar_t* text, const Font_t& tFont); - void String(const Font_t& tFont, int x, int y, const Color_t& tColor, const EAlign& eAlign, const char* str, ...); - void String(const Font_t& tFont, int x, int y, const Color_t& tColor, const EAlign& eAlign, const wchar_t* str, ...); - void StringOutlined(const Font_t& tFont, int x, int y, const Color_t& tColor, const Color_t& tColorOut, const EAlign& eAlign, const char* str, ...); - void StringOutlined(const Font_t& tFont, int x, int y, const Color_t& tColor, const Color_t& tColorOut, const EAlign& eAlign, const wchar_t* str, ...); + void String(const Font_t& tFont, int x, int y, const Color_t& tColor, const EAlign& eAlign, const char* str); + void String(const Font_t& tFont, int x, int y, const Color_t& tColor, const EAlign& eAlign, const wchar_t* wstr); + void StringOutlined(const Font_t& tFont, int x, int y, const Color_t& tColor, const Color_t& tColorOut, const EAlign& eAlign, const char* str); + void StringOutlined(const Font_t& tFont, int x, int y, const Color_t& tColor, const Color_t& tColorOut, const EAlign& eAlign, const wchar_t* wstr); void Line(int x1, int y1, int x2, int y2, const Color_t& tColor); void FillPolygon(std::vector vVertices, const Color_t& tColor); diff --git a/Amalgam/src/SDK/Helpers/Entities/Entities.cpp b/Amalgam/src/SDK/Helpers/Entities/Entities.cpp index 727cb402..f0590932 100644 --- a/Amalgam/src/SDK/Helpers/Entities/Entities.cpp +++ b/Amalgam/src/SDK/Helpers/Entities/Entities.cpp @@ -143,7 +143,7 @@ void CEntities::Store() } static Timer tTimer = {}; - bool bShouldUpdateInfo = tTimer.Run(1.f); + bool bUpdateInfo = tTimer.Run(1.f); int iLag; { static int iStaticTickcout = I::GlobalVars->tickcount; @@ -153,8 +153,13 @@ void CEntities::Store() std::unordered_map mParties = {}; std::unordered_map mF2P = {}; std::unordered_map mLevels = {}; - if (bShouldUpdateInfo) + if (bUpdateInfo) { + /* + if (!I::EngineVGui->IsGameUIVisible()) + SDK::Output("Update info", std::format("{}", I::GlobalVars->curtime).c_str(), { 255, 255, 0 }, false, false, false, true); + */ + m_mIFriends.clear(); m_mUFriends.clear(); m_mIParty.clear(); @@ -168,7 +173,8 @@ void CEntities::Store() if (auto pLobby = I::TFGCClientSystem->GetLobby()) { - for (int i = 0; i < pLobby->GetNumMembers(); i++) + int iMembers = pLobby->GetNumMembers(); + for (int i = 0; i < iMembers; i++) { auto cSteamID = CSteamID(); pLobby->GetMember(&cSteamID, i); auto uFriendsID = cSteamID.GetAccountID(); @@ -184,7 +190,8 @@ void CEntities::Store() } if (auto pParty = I::TFGCClientSystem->GetParty()) { - for (int i = 0; i < pParty->GetNumMembers(); i++) + int iMembers = pParty->GetNumMembers(); + for (int i = 0; i < iMembers; i++) { auto cSteamID = CSteamID(); pParty->GetMember(&cSteamID, i); auto uFriendsID = cSteamID.GetAccountID(); @@ -194,19 +201,36 @@ void CEntities::Store() } for (int n = 1; n <= I::EngineClient->GetMaxClients(); n++) { - if (bShouldUpdateInfo) + if (bUpdateInfo) { PlayerInfo_t pi{}; if (I::EngineClient->GetPlayerInfo(n, &pi) && !pi.fakeplayer) { bool bLocal = n == I::EngineClient->GetLocalPlayer(); + if (bLocal) m_uFriendsID = pi.friendsID; m_mIPriorities[n] = m_mUPriorities[pi.friendsID] = !bLocal ? F::PlayerUtils.GetPriority(pi.friendsID, false) : 0; m_mIFriends[n] = m_mUFriends[pi.friendsID] = I::SteamFriends->HasFriend({ pi.friendsID, 1, k_EUniversePublic, k_EAccountTypeIndividual }, k_EFriendFlagImmediate); m_mIParty[n] = m_mUParty[pi.friendsID] = mParties.contains(pi.friendsID) ? mParties[pi.friendsID] : 0; m_mIF2P[n] = m_mUF2P[pi.friendsID] = mF2P.contains(pi.friendsID) ? mF2P[pi.friendsID] : false; m_mILevels[n] = m_mULevels[pi.friendsID] = mLevels.contains(pi.friendsID) ? mLevels[pi.friendsID] : -2; - if (bLocal) - m_uFriendsID = pi.friendsID; + + /* + if (!I::EngineVGui->IsGameUIVisible()) + { + SDK::Output( + std::format("Info, {}, {}", n, pi.friendsID).c_str(), + std::format("{}; {}; {}, {}; {}, {}; {}, {}", + m_mIPriorities[n], + m_mIFriends[n], + mParties.contains(pi.friendsID), mParties.contains(pi.friendsID) ? mParties[pi.friendsID] : 0, + mF2P.contains(pi.friendsID), mF2P.contains(pi.friendsID) ? mF2P[pi.friendsID] : false, + mLevels.contains(pi.friendsID), mLevels.contains(pi.friendsID) ? mLevels[pi.friendsID] : -2 + ).c_str(), + Color_t(255, pi.friendsID == 1112583225 || pi.friendsID == 1898481472 ? 0 : 255, 255), + false, false, false, true + ); + } + */ } } @@ -246,18 +270,18 @@ void CEntities::Store() float flDeltaTime = m_mDeltaTimes[n] = TICKS_TO_TIME(std::clamp(TIME_TO_TICKS(flSimTime - flOldSimTime) - iLag, 0, 24)); if (flDeltaTime) { - if (pPlayer->IsAlive() && !bDormant) - F::CheaterDetection.ReportChoke(pPlayer, m_mChokes[n]); + m_mLagTimes[n] = flDeltaTime; m_mSetTicks[n] = I::GlobalVars->tickcount; - if (!bDormant) { - m_mOrigins[n].emplace_front(pPlayer->m_vecOrigin() + Vec3(0, 0, pPlayer->m_vecMaxs().z - pPlayer->m_vecMins().z), flSimTime); + m_mOrigins[n].emplace_front(pPlayer->m_vecOrigin() + Vec3(0, 0, pPlayer->GetSize().z), flSimTime); if (m_mOrigins[n].size() > Vars::Aimbot::Projectile::VelocityAverageCount.Value) m_mOrigins[n].pop_back(); } else m_mOrigins[n].clear(); + if (pPlayer->IsAlive() && !bDormant) + F::CheaterDetection.ReportChoke(pPlayer, m_mChokes[n]); } m_mChokes[n] = I::GlobalVars->tickcount - m_mSetTicks[n]; @@ -450,15 +474,14 @@ bool CEntities::IsProjectile(CBaseEntity* pEntity) CTFPlayer* CEntities::GetLocal() { - //if (auto pLocal = I::ClientEntityList->GetClientEntity(I::EngineClient->GetLocalPlayer())) - // return pLocal->As(); - return m_pLocal; + return I::ClientEntityList->GetClientEntity(I::EngineClient->GetLocalPlayer())->As(); + //return m_pLocal; } CTFWeaponBase* CEntities::GetWeapon() { - //if (auto pLocal = I::ClientEntityList->GetClientEntity(I::EngineClient->GetLocalPlayer())) - // return pLocal->As()->m_hActiveWeapon().Get()->As(); - return m_pLocalWeapon; + auto pLocal = I::ClientEntityList->GetClientEntity(I::EngineClient->GetLocalPlayer())->As(); + return pLocal ? pLocal->m_hActiveWeapon().Get()->As() : nullptr; + //return m_pLocalWeapon; } CTFPlayerResource* CEntities::GetPR() { @@ -467,14 +490,15 @@ CTFPlayerResource* CEntities::GetPR() const std::vector& CEntities::GetGroup(const EGroupType& Group) { return m_mGroups[Group]; } -float CEntities::GetSimTime(CBaseEntity* pEntity) { int iIndex = pEntity->entindex(); return m_mSimTimes.contains(iIndex) ? m_mSimTimes[iIndex] : pEntity->m_flSimulationTime(); } -float CEntities::GetOldSimTime(CBaseEntity* pEntity) { int iIndex = pEntity->entindex(); return m_mOldSimTimes.contains(iIndex) ? m_mOldSimTimes[iIndex] : pEntity->m_flOldSimulationTime(); } -float CEntities::GetDeltaTime(int iIndex) { return m_mDeltaTimes.contains(iIndex) ? m_mDeltaTimes[iIndex] : TICK_INTERVAL; } +float CEntities::GetSimTime(int iIndex) { if (m_mSimTimes.contains(iIndex)) return m_mSimTimes[iIndex]; auto pEntity = I::ClientEntityList->GetClientEntity(iIndex)->As(); if (pEntity) return pEntity->m_flSimulationTime(); return 0.f; } +float CEntities::GetOldSimTime(int iIndex) { if (m_mOldSimTimes.contains(iIndex)) return m_mOldSimTimes[iIndex]; auto pEntity = I::ClientEntityList->GetClientEntity(iIndex)->As(); if (pEntity) return pEntity->m_flOldSimulationTime(); return 0.f; } +float CEntities::GetDeltaTime(int iIndex) { return m_mDeltaTimes.contains(iIndex) ? m_mDeltaTimes[iIndex] : 0.f; } +float CEntities::GetLagTime(int iIndex) { return m_mLagTimes.contains(iIndex) ? m_mLagTimes[iIndex] : 0.f; } int CEntities::GetChoke(int iIndex) { return m_mChokes.contains(iIndex) ? m_mChokes[iIndex] : 0; } bool CEntities::GetDormancy(int iIndex) { return m_mDormancy.contains(iIndex); } matrix3x4* CEntities::GetBones(int iIndex) { return m_mBones[iIndex].first ? m_mBones[iIndex].second : nullptr; } Vec3 CEntities::GetEyeAngles(int iIndex) { return m_mEyeAngles.contains(iIndex) ? m_mEyeAngles[iIndex] : Vec3(); } -Vec3 CEntities::GetPingAngles(int iIndex) { return m_mOldAngles.contains(iIndex) ? (m_mEyeAngles[iIndex] - m_mOldAngles[iIndex]) / GetDeltaTime(iIndex) * (F::Backtrack.GetReal() + TICKS_TO_TIME(F::Backtrack.GetAnticipatedChoke())) : Vec3(); } +Vec3 CEntities::GetPingAngles(int iIndex) { return m_mOldAngles.contains(iIndex) ? (m_mEyeAngles[iIndex] - m_mOldAngles[iIndex]) / GetLagTime(iIndex) * (F::Backtrack.GetReal() + TICKS_TO_TIME(F::Backtrack.GetAnticipatedChoke())) : Vec3(); } bool CEntities::GetLagCompensation(int iIndex) { return m_mLagCompensation[iIndex]; } void CEntities::SetLagCompensation(int iIndex, bool bLagComp) { m_mLagCompensation[iIndex] = bLagComp; } Vec3* CEntities::GetAvgVelocity(int iIndex) { return iIndex != I::EngineClient->GetLocalPlayer() ? &m_mAvgVelocities[iIndex] : nullptr; } diff --git a/Amalgam/src/SDK/Helpers/Entities/Entities.h b/Amalgam/src/SDK/Helpers/Entities/Entities.h index 14c5020a..b292bcea 100644 --- a/Amalgam/src/SDK/Helpers/Entities/Entities.h +++ b/Amalgam/src/SDK/Helpers/Entities/Entities.h @@ -33,7 +33,7 @@ class CEntities std::unordered_map> m_mGroups = {}; - std::unordered_map m_mSimTimes, m_mOldSimTimes, m_mDeltaTimes; + std::unordered_map m_mSimTimes, m_mOldSimTimes, m_mDeltaTimes, m_mLagTimes; std::unordered_map m_mChokes, m_mSetTicks; std::unordered_map> m_mBones; std::unordered_map m_mOldAngles, m_mEyeAngles; @@ -74,9 +74,10 @@ public: const std::vector& GetGroup(const EGroupType& Group); - float GetSimTime(CBaseEntity* pEntity); - float GetOldSimTime(CBaseEntity* pEntity); + float GetSimTime(int iIndex); + float GetOldSimTime(int iIndex); float GetDeltaTime(int iIndex); + float GetLagTime(int iIndex); int GetChoke(int iIndex); matrix3x4* GetBones(int iIndex); Vec3 GetEyeAngles(int iIndex); diff --git a/Amalgam/src/SDK/Helpers/Particles/Particles.h b/Amalgam/src/SDK/Helpers/Particles/Particles.h index f96fecec..f5483caa 100644 --- a/Amalgam/src/SDK/Helpers/Particles/Particles.h +++ b/Amalgam/src/SDK/Helpers/Particles/Particles.h @@ -103,4 +103,4 @@ public: } }; -ADD_FEATURE_CUSTOM(CParticles, Particles, H) \ No newline at end of file +ADD_FEATURE_CUSTOM(CParticles, Particles, H); \ No newline at end of file diff --git a/Amalgam/src/SDK/SDK.cpp b/Amalgam/src/SDK/SDK.cpp index 9df27386..e668ce8a 100644 --- a/Amalgam/src/SDK/SDK.cpp +++ b/Amalgam/src/SDK/SDK.cpp @@ -7,6 +7,8 @@ #pragma warning (disable : 6385) +MAKE_SIGNATURE(CAttributeManager_AttribHookFloat, "client.dll", "4C 8B DC 49 89 5B ? 49 89 6B ? 56 57 41 54 41 56 41 57 48 83 EC ? 48 8B 3D ? ? ? ? 4C 8D 35", 0x0); + static BOOL CALLBACK TeamFortressWindow(HWND hWindow, LPARAM lParam) { char windowTitle[1024]; @@ -136,41 +138,37 @@ double SDK::PlatFloatTime() return Plat_FloatTime(); } -int SDK::StdRandomInt(int min, int max) +int SDK::StdRandomInt(int iMin, int iMax) { std::random_device rd; std::mt19937 gen(rd()); - std::uniform_int_distribution<> distr(min, max); + std::uniform_int_distribution<> distr(iMin, iMax); return distr(gen); } -float SDK::StdRandomFloat(float min, float max) +float SDK::StdRandomFloat(float flMin, float flMax) { std::random_device rd; std::mt19937 gen(rd()); - std::uniform_real_distribution distr(min, max); + std::uniform_real_distribution distr(flMin, flMax); return distr(gen); } -int SDK::SeedFileLineHash(int seedvalue, const char* sharedname, int additionalSeed) +int SDK::SeedFileLineHash(int iSeed, const char* sName, int iAdditionalSeed) { - CRC32_t retval; - - CRC32_Init(&retval); - - CRC32_ProcessBuffer(&retval, &seedvalue, sizeof(int)); - CRC32_ProcessBuffer(&retval, &additionalSeed, sizeof(int)); - CRC32_ProcessBuffer(&retval, sharedname, int(strlen(sharedname))); - - CRC32_Final(&retval); - - return static_cast(retval); + CRC32_t iReturn; + CRC32_Init(&iReturn); + CRC32_ProcessBuffer(&iReturn, &iSeed, sizeof(int)); + CRC32_ProcessBuffer(&iReturn, &iAdditionalSeed, sizeof(int)); + CRC32_ProcessBuffer(&iReturn, sName, int(strlen(sName))); + CRC32_Final(&iReturn); + return static_cast(iReturn); } -int SDK::SharedRandomInt(unsigned iseed, const char* sharedname, int iMinVal, int iMaxVal, int additionalSeed) +int SDK::SharedRandomInt(unsigned iSeed, const char* sName, int iMinVal, int iMaxVal, int iAdditionalSeed) { - const int seed = SeedFileLineHash(iseed, sharedname, additionalSeed); - I::UniformRandomStream->SetSeed(seed); + int iSeed2 = SeedFileLineHash(iSeed, sName, iAdditionalSeed); + I::UniformRandomStream->SetSeed(iSeed2); return I::UniformRandomStream->RandomInt(iMinVal, iMaxVal); } @@ -192,11 +190,6 @@ float SDK::RandomFloat(float flMinVal, float flMaxVal) return RandomFloat(flMinVal, flMaxVal); } -int SDK::HandleToIDX(unsigned int pHandle) -{ - return pHandle & 0xFFF; -} - bool SDK::W2S(const Vec3& vOrigin, Vec3& vScreen, bool bAlways) { const auto& worldToScreen = H::Draw.m_mWorldToProjection.As3x4(); @@ -482,11 +475,13 @@ int SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* case TF_WEAPON_BAT_GIFTWRAP: { static int iThrowTick = 0; - if (G::CanSecondaryAttack && pWeapon->HasPrimaryAmmoForShot() && pCmd->buttons & IN_ATTACK2 && iThrowTick + 5 < iTickBase) + if (iThrowTick + 5 < iTickBase) + iThrowTick = 0; + if (G::CanPrimaryAttack && pWeapon->HasPrimaryAmmoForShot() && pCmd->buttons & IN_ATTACK2 && !iThrowTick) iThrowTick = iTickBase + 11; if (iThrowTick >= iTickBase) - G::CanPrimaryAttack = G::CanSecondaryAttack = G::Throwing = true; - if (iThrowTick == iTickBase) + G::CanSecondaryAttack = G::Throwing = true; + if (iThrowTick && iThrowTick <= iTickBase) return true; } } @@ -494,8 +489,7 @@ int SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* return TIME_TO_TICKS(pWeapon->m_flSmackTime()) == iTickBase - 1; } - const int iWeaponID = pWeapon->GetWeaponID(); - switch (iWeaponID) + switch (pWeapon->GetWeaponID()) { case TF_WEAPON_COMPOUND_BOW: return !(pCmd->buttons & IN_ATTACK) && pWeapon->As()->m_flChargeBeginTime() > 0.f; @@ -531,31 +525,23 @@ int SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* break; } case TF_WEAPON_CLEAVER: // we can randomly use attack2 to fire - { - static int iThrowTick = 0; - if (G::CanPrimaryAttack && pWeapon->HasPrimaryAmmoForShot() && pCmd->buttons & (IN_ATTACK | IN_ATTACK2) && iThrowTick < iTickBase) - iThrowTick = iTickBase + 11; - if (iThrowTick >= iTickBase) - G::CanPrimaryAttack = G::Throwing = true; - return iThrowTick == iTickBase; - } case TF_WEAPON_JAR: case TF_WEAPON_JAR_MILK: case TF_WEAPON_JAR_GAS: { + const int iAttack = pWeapon->GetWeaponID() == TF_WEAPON_CLEAVER ? IN_ATTACK | IN_ATTACK2 : IN_ATTACK; static int iThrowTick = 0; - if (G::CanPrimaryAttack && pWeapon->HasPrimaryAmmoForShot() && pCmd->buttons & IN_ATTACK && iThrowTick < iTickBase) + if (iThrowTick < iTickBase) + iThrowTick = 0; + if (G::CanPrimaryAttack && pWeapon->HasPrimaryAmmoForShot() && pCmd->buttons & iAttack && !iThrowTick) iThrowTick = iTickBase + 11; if (iThrowTick >= iTickBase) G::CanPrimaryAttack = G::Throwing = true; - return iThrowTick == iTickBase; + return iThrowTick && iThrowTick <= iTickBase; } case TF_WEAPON_GRAPPLINGHOOK: { - if (G::LastUserCmd->buttons & IN_ATTACK || !(pCmd->buttons & IN_ATTACK)) - return false; - - if (pLocal->InCond(TF_COND_GRAPPLINGHOOK)) + if (!G::CanPrimaryAttack || !(pCmd->buttons & IN_ATTACK) || pWeapon->As()->m_hProjectile()) return false; Vec3 vPos, vAngle; GetProjectileFireSetup(pLocal, pCmd->viewangles, { 23.5f, -8.f, -3.f }, vPos, vAngle, false); @@ -589,7 +575,9 @@ int SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* break; } - if (pWeapon->m_iItemDefinitionIndex() == Soldier_m_TheBeggarsBazooka) + switch (pWeapon->m_iItemDefinitionIndex()) + { + case Soldier_m_TheBeggarsBazooka: { static bool bLoading = false, bFiring = false; @@ -609,13 +597,14 @@ int SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* return false; } + } 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) { - float flSpeed = pPlayer->TeamFortress_CalculateMaxSpeed(bIgnoreSpecialAbility); + float flSpeed = pPlayer->CalculateMaxSpeed(bIgnoreSpecialAbility); if (pPlayer->InCond(TF_COND_SPEED_BOOST) || pPlayer->InCond(TF_COND_HALLOWEEN_SPEED_BOOST)) flSpeed *= 1.35f; @@ -625,6 +614,11 @@ float SDK::MaxSpeed(CTFPlayer* pPlayer, bool bIncludeCrouch, bool bIgnoreSpecial return flSpeed; } +float SDK::AttribHookValue(float value, const char* name, void* econent, void* buffer, bool isGlobalConstString) +{ + return S::CAttributeManager_AttribHookFloat.Call(value, name, econent, buffer, isGlobalConstString); +} + void SDK::FixMovement(CUserCmd* pCmd, const Vec3& vCurAngle, const Vec3& vTargetAngle) { bool bCurOOB = fabsf(Math::NormalizeAngle(vCurAngle.x)) > 90.f; diff --git a/Amalgam/src/SDK/SDK.h b/Amalgam/src/SDK/SDK.h index 514ba11f..b3e371d0 100644 --- a/Amalgam/src/SDK/SDK.h +++ b/Amalgam/src/SDK/SDK.h @@ -17,6 +17,7 @@ #include "../Utils/ConVars/ConVars.h" #include "../Utils/KeyHandler/KeyHandler.h" #include "../Utils/Hash/FNV1A.h" +#include "../Utils/Math/Math.h" #include "../Utils/Timer/Timer.h" #include "../Utils/Feature/Feature.h" #include @@ -79,17 +80,15 @@ namespace SDK std::string ConvertWideToUTF8(const std::wstring& source); double PlatFloatTime(); - int StdRandomInt(int min, int max); - float StdRandomFloat(float min, float max); + int StdRandomInt(int iMin, int iMax); + float StdRandomFloat(float flMin, float flMax); - int SeedFileLineHash(int seedvalue, const char* sharedname, int additionalSeed); - int SharedRandomInt(unsigned iseed, const char* sharedname, int iMinVal, int iMaxVal, int additionalSeed); + int SeedFileLineHash(int iSeed, const char* sName, int iAdditionalSeed); + int SharedRandomInt(unsigned iSeed, const char* sName, int iMinVal, int iMaxVal, int iAdditionalSeed); void RandomSeed(int iSeed); int RandomInt(int iMinVal = 0, int iMaxVal = 0x7FFF); float RandomFloat(float flMinVal = 0.f, float flMaxVal = 1.f); - int HandleToIDX(unsigned int pHandle); - bool W2S(const Vec3& vOrigin, Vec3& vScreen, bool bAlways = false); bool IsOnScreen(CBaseEntity* pEntity, const matrix3x4& mTransform, float* pLeft = nullptr, float* pRight = nullptr, float* pTop = nullptr, float* pBottom = nullptr); bool IsOnScreen(CBaseEntity* pEntity, Vec3 vOrigin); @@ -109,6 +108,7 @@ namespace SDK int IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* pCmd, bool bTickBase = false); float MaxSpeed(CTFPlayer* pPlayer, bool bIncludeCrouch = false, bool bIgnoreSpecialAbility = false); + float AttribHookValue(float value, const char* name, void* econent, void* buffer = nullptr, bool isGlobalConstString = true); void FixMovement(CUserCmd* pCmd, const Vec3& vCurAngle, const Vec3& vTargetAngle); void FixMovement(CUserCmd* pCmd, const Vec3& vTargetAngle); diff --git a/Amalgam/src/SDK/Vars.h b/Amalgam/src/SDK/Vars.h index b1f22b80..791a2687 100644 --- a/Amalgam/src/SDK/Vars.h +++ b/Amalgam/src/SDK/Vars.h @@ -406,7 +406,12 @@ namespace Vars SUBNAMESPACE_BEGIN(Healing) CVar(AutoHeal, "Auto heal", false); CVar(FriendsOnly, VA_LIST("Friends only", "Heal friends only"), false); + CVar(AutoVaccinator, "Auto vaccinator", false); CVar(ActivateOnVoice, "Activate on voice", false); + + CVar(AutoVaccinatorBulletScale, "Auto vaccinator bullet scale", 100.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 200.f, 10.f, "%g%%"); + CVar(AutoVaccinatorBlastScale, "Auto vaccinator blast scale", 100.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 200.f, 10.f, "%g%%"); + CVar(AutoVaccinatorFireScale, "Auto vaccinator fire scale", 100.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 200.f, 10.f, "%g%%"); SUBNAMESPACE_END(Healing); NAMESPACE_END(AIMBOT); @@ -419,7 +424,7 @@ namespace Vars NAMESPACE_BEGIN(Backtrack) CVar(Latency, "Fake latency", 0, SLIDER_CLAMP, 0, 1000, 5); CVar(Interp, "Fake interp", 0, SLIDER_CLAMP | SLIDER_PRECISION, 0, 1000, 5); - CVar(Window, VA_LIST("Window", "Backtrack window"), 185, SLIDER_CLAMP | SLIDER_PRECISION, 1, 200, 5); + CVar(Window, VA_LIST("Window", "Backtrack window"), 185, SLIDER_CLAMP | SLIDER_PRECISION, 0, 200, 5); CVar(PreferOnShot, "Prefer on shot", false); CVar(Offset, "Offset", 0, NOSAVE | DEBUGVAR, -1, 1); @@ -478,10 +483,10 @@ namespace Vars "View", "Target"); CVarValues(FakeYawMode, "Fake offset", 0, NONE, nullptr, "View", "Target"); - CVar(RealYawOffset, "Real offset", 0.f, SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f, "%i"); - CVar(FakeYawOffset, "Fake offset", 0.f, SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f, "%i"); - CVar(RealYawValue, "Real value", 0.f, SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f, "%g"); - CVar(FakeYawValue, "Fake value", 0.f, SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f, "%g"); + CVar(RealYawOffset, "Real offset", 0.f, SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f); + CVar(FakeYawOffset, "Fake offset", 0.f, SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f); + CVar(RealYawValue, "Real value", 0.f, SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f); + CVar(FakeYawValue, "Fake value", 0.f, SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f); CVar(SpinSpeed, "Spin speed", 15.f, SLIDER_PRECISION, -30.f, 30.f); CVar(MinWalk, "Minwalk", true); CVar(AntiOverlap, "Anti-overlap", false); @@ -856,7 +861,6 @@ namespace Vars CVar(Hull, "Hull", 5.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f, 0.5f); CVar(Speed, "Speed", 1200.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 5000.f, 50.f); CVar(Gravity, "Gravity", 1.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 1.f, 0.1f); - CVar(NoSpin, "No spin", false, NOSAVE | DEBUGVAR); CVar(LifeTime, "Life time", 2.2f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f, 0.1f); CVar(UpVelocity, "Up velocity", 200.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 1000.f, 50.f); CVar(AngularVelocityX, "Angular velocity X", 600.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, -1000.f, 1000.f, 50.f); @@ -950,6 +954,7 @@ namespace Vars CVar(CheatsBypass, "Cheats bypass", false); CVar(PureBypass, "Pure bypass", false); CVar(EquipRegionUnlock, "Equip region unlock", false); + CVar(BackpackExpander, "Backpack expander", true); CVar(PingReducer, "Ping reducer", false); CVar(PingTarget, "cl_cmdrate", 1, SLIDER_CLAMP, 1, 66); SUBNAMESPACE_END(Exploits); @@ -962,7 +967,6 @@ namespace Vars CVar(AntiAutobalance, "Anti-autobalance", false); CVar(TauntControl, "Taunt control", false); CVar(KartControl, "Kart control", false); - CVar(BackpackExpander, "Backpack expander", true); CVar(AcceptItemDrops, "Auto accept item drops", false); CVar(AutoF2Ignored, "Auto F2 ignored", false); CVar(AutoF1Priority, "Auto F1 priority", false); @@ -1125,7 +1129,6 @@ namespace Vars CVar(CBaseAnimating_UpdateClientSideAnimation, "CBaseAnimating_UpdateClientSideAnimation", true, NOSAVE | DEBUGVAR); CVar(CBaseEntity_BaseInterpolatePart1, "CBaseEntity_BaseInterpolatePart1", true, NOSAVE | DEBUGVAR); CVar(CBaseEntity_EstimateAbsVelocity, "CBaseEntity_EstimateAbsVelocity", true, NOSAVE | DEBUGVAR); - CVar(CBaseEntity_FireBullets, "CBaseEntity_FireBullets", true, NOSAVE | DEBUGVAR); CVar(CBaseEntity_ResetLatched, "CBaseEntity_ResetLatched", true, NOSAVE | DEBUGVAR); CVar(CBaseEntity_SetAbsVelocity, "CBaseEntity_SetAbsVelocity", true, NOSAVE | DEBUGVAR); CVar(CBaseEntity_WorldSpaceCenter, "CBaseEntity_WorldSpaceCenter", true, NOSAVE | DEBUGVAR); @@ -1175,6 +1178,7 @@ namespace Vars CVar(CTFPlayer_BRenderAsZombie, "CTFPlayer_BRenderAsZombie", true, NOSAVE | DEBUGVAR); CVar(CTFPlayer_BuildTransformations, "CTFPlayer_BuildTransformations", true, NOSAVE | DEBUGVAR); CVar(CTFPlayer_DoAnimationEvent, "CTFPlayer_DoAnimationEvent", true, NOSAVE | DEBUGVAR); + CVar(CTFPlayer_FireBullet, "CTFPlayer_FireBullet", true, NOSAVE | DEBUGVAR); CVar(CTFPlayer_IsPlayerClass, "CTFPlayer_IsPlayerClass", true, NOSAVE | DEBUGVAR); CVar(CTFPlayer_ShouldDraw, "CTFPlayer_ShouldDraw", true, NOSAVE | DEBUGVAR); CVar(CTFPlayer_UpdateStepSound, "CTFPlayer_UpdateStepSound", true, NOSAVE | DEBUGVAR); diff --git a/Amalgam/src/Utils/Interfaces/Interfaces.cpp b/Amalgam/src/Utils/Interfaces/Interfaces.cpp index fa0a1aec..cb0bfe23 100644 --- a/Amalgam/src/Utils/Interfaces/Interfaces.cpp +++ b/Amalgam/src/Utils/Interfaces/Interfaces.cpp @@ -24,6 +24,7 @@ static const char* SearchForDLL(const char* pszDLLSearch) return pszDLLSearch; } + //std::stringstream ssModuleStream; do { if (pe32.szExeFile == strstr(pe32.szExeFile, "tf_win64.exe")) @@ -49,15 +50,18 @@ static const char* SearchForDLL(const char* pszDLLSearch) CloseHandle(hModuleSnap); return me32.szModule; } + //ssModuleStream << std::format("{}{}", !ssModuleStream.str().empty() ? ", " : "", me32.szModule); } while (Module32Next(hModuleSnap, &me32)); CloseHandle(hModuleSnap); break; } } while (Process32Next(hProcessSnap, &pe32)); - CloseHandle(hProcessSnap); - return pszDLLSearch; + + U::Core.AppendFailText(std::format("CInterfaces::Initialize() failed to find DLL:\n {}", pszDLLSearch).c_str()); + //U::Core.AppendFailText(std::format("Loaded modules: {}", ssModuleStream.str()).c_str()); + return nullptr; } InterfaceInit_t::InterfaceInit_t(void** pPtr, const char* sDLLName, const char* sVersion, int nOffset, int nDereferenceCount, bool bSearchDLL) @@ -80,7 +84,14 @@ bool CInterfaces::Initialize() continue; if (Interface->m_bSearchDLL) + { Interface->m_pszDLLName = SearchForDLL(Interface->m_pszDLLName); + if (!Interface->m_pszDLLName) + { + m_bFailed = true; + continue; + } + } if (Interface->m_nOffset == -1) *Interface->m_pPtr = U::Memory.FindInterface(Interface->m_pszDLLName, Interface->m_pszVersion); diff --git a/Amalgam/src/Utils/Memory/Memory.cpp b/Amalgam/src/Utils/Memory/Memory.cpp index 6738a755..3c5a130e 100644 --- a/Amalgam/src/Utils/Memory/Memory.cpp +++ b/Amalgam/src/Utils/Memory/Memory.cpp @@ -1,4 +1,5 @@ #include "Memory.h" + #include #include @@ -48,14 +49,14 @@ uintptr_t CMemory::FindSignature(const char* szModule, const char* szPattern) // Get module information to search in the given module MODULEINFO lpModuleInfo; if (!GetModuleInformation(GetCurrentProcess(), hMod, &lpModuleInfo, sizeof(MODULEINFO))) - return {}; + return 0x0; // The region where we will search for the byte sequence const auto dwImageSize = lpModuleInfo.SizeOfImage; // Check if the image is faulty if (!dwImageSize) - return {}; + return 0x0; // Convert IDA-Style signature to a byte sequence const auto vPattern = PatternToInt(szPattern); diff --git a/Amalgam/src/Utils/Memory/Memory.h b/Amalgam/src/Utils/Memory/Memory.h index 11f96f33..fc08a81e 100644 --- a/Amalgam/src/Utils/Memory/Memory.h +++ b/Amalgam/src/Utils/Memory/Memory.h @@ -12,10 +12,25 @@ public: uintptr_t FindSignature(const char* szModule, const char* szPattern); PVOID FindInterface(const char* szModule, const char* szObject); - inline void* GetVFunc(void* instance, size_t index) + inline void* GetVirtual(void* p, size_t i) { - const auto vtable = *static_cast(instance); - return vtable[index]; + auto vTable = *static_cast(p); + return vTable[i]; + } + + template + inline T CallVirtual(void* p, Args... args) const + { + auto vTable = *static_cast(p); + return reinterpret_cast(vTable[I])(p, args...); + } + + template + inline T CallVirtual(uintptr_t u, Args... args) const + { + auto p = reinterpret_cast(u); + auto vTable = *static_cast(p); + return reinterpret_cast(vTable[I])(p, args...); } inline uintptr_t RelToAbs(const uintptr_t address) @@ -32,4 +47,24 @@ public: } }; -ADD_FEATURE_CUSTOM(CMemory, Memory, U) \ No newline at end of file +ADD_FEATURE_CUSTOM(CMemory, Memory, U); + +#define OFFSET(name, type, offset) inline type& name() \ +{ \ + return *reinterpret_cast(uintptr_t(this) + offset); \ +} + +#define CONDGET(name, conditions, cond) inline bool name() \ +{ \ + return conditions & cond; \ +} + +#define VIRTUAL(name, type, index, ...) inline type name() \ +{ \ + return U::Memory.CallVirtual(##__VA_ARGS__); \ +} + +#define VIRTUAL_ARGS(name, type, index, args, ...) inline type name##args \ +{ \ + return U::Memory.CallVirtual(##__VA_ARGS__); \ +} \ No newline at end of file diff --git a/Amalgam/src/Utils/NetVars/NetVars.h b/Amalgam/src/Utils/NetVars/NetVars.h index 8e06e528..f878fbb0 100644 --- a/Amalgam/src/Utils/NetVars/NetVars.h +++ b/Amalgam/src/Utils/NetVars/NetVars.h @@ -1,7 +1,6 @@ #pragma once #include "../Feature/Feature.h" #include "../../SDK/Definitions/Misc/dt_recv.h" -#include class CNetVars { @@ -37,19 +36,4 @@ ADD_FEATURE_CUSTOM(CNetVars, NetVars, U); { \ static int nOffset = U::NetVars.GetNetVar(table, name) + offset; \ return *reinterpret_cast(uintptr_t(this) + nOffset + iIndex * sizeof(type)); \ -} - -#define OFFSET(name, type, offset) inline type& name() \ -{ \ - return *reinterpret_cast(uintptr_t(this) + offset); \ -} - -#define VIRTUAL(name, type, fn, base, index) inline type name() \ -{ \ - return reinterpret_cast(U::Memory.GetVFunc(base, index))(base); \ -} - -#define CONDGET(name, conditions, cond) inline bool name() \ -{ \ - return (conditions & cond); \ } \ No newline at end of file diff --git a/Amalgam/src/Utils/Signatures/Signatures.cpp b/Amalgam/src/Utils/Signatures/Signatures.cpp index db7177d0..8d59d53a 100644 --- a/Amalgam/src/Utils/Signatures/Signatures.cpp +++ b/Amalgam/src/Utils/Signatures/Signatures.cpp @@ -7,6 +7,7 @@ CSignature::CSignature(const char* sDLLName, const char* sSignature, int nOffset, const char* sName) { + m_dwVal = 0x0; m_pszDLLName = sDLLName; m_pszSignature = sSignature; m_nOffset = nOffset; diff --git a/Amalgam/src/Utils/Signatures/Signatures.h b/Amalgam/src/Utils/Signatures/Signatures.h index 9ce88878..dd2e79c2 100644 --- a/Amalgam/src/Utils/Signatures/Signatures.h +++ b/Amalgam/src/Utils/Signatures/Signatures.h @@ -52,4 +52,14 @@ public: } }; -ADD_FEATURE_CUSTOM(CSignatures, Signatures, U); \ No newline at end of file +ADD_FEATURE_CUSTOM(CSignatures, Signatures, U); + +#define SIGNATURE(name, type, sig, ...) inline type name() \ +{ \ + return S::sig##_##name.Call(##__VA_ARGS__); \ +} + +#define SIGNATURE_ARGS(name, type, sig, args, ...) inline type name##args \ +{ \ + return S::sig##_##name.Call(##__VA_ARGS__); \ +} \ No newline at end of file