From 5121bc40dd70e7d8de9cd7d8de91ae84ae0d70a5 Mon Sep 17 00:00:00 2001 From: rei-2 <174158077+rei-2@users.noreply.github.com> Date: Tue, 1 Apr 2025 11:48:06 -0400 Subject: [PATCH] fixes --- Amalgam/src/Features/Aimbot/Aimbot.cpp | 6 +- .../Aimbot/AimbotGlobal/AimbotGlobal.cpp | 2 +- .../Aimbot/AimbotHitscan/AimbotHitscan.cpp | 113 +++++--- .../Aimbot/AimbotMelee/AimbotMelee.cpp | 13 +- .../AimbotProjectile/AimbotProjectile.cpp | 21 +- .../Aimbot/AutoAirblast/AutoAirblast.cpp | 16 +- .../Aimbot/AutoDetonate/AutoDetonate.cpp | 2 +- Amalgam/src/Features/ImGui/Menu/Menu.cpp | 7 +- Amalgam/src/Features/Misc/Misc.cpp | 5 +- .../ProjectileSimulation.cpp | 258 +++++++++++------- .../ProjectileSimulation.h | 4 +- Amalgam/src/Features/Visuals/Chams/Chams.cpp | 2 +- Amalgam/src/Features/Visuals/ESP/ESP.cpp | 18 +- Amalgam/src/Features/Visuals/Glow/Glow.cpp | 2 +- Amalgam/src/Features/Visuals/Visuals.cpp | 13 +- .../Hooks/CClientModeShared_CreateMove.cpp | 1 + .../Hooks/CPhysicsObject_OutputDebugInfo.cpp | 4 +- Amalgam/src/SDK/Definitions/Definitions.h | 15 + .../src/SDK/Definitions/Main/CTFWeaponBase.h | 60 ++-- Amalgam/src/SDK/Helpers/Entities/Entities.cpp | 8 +- Amalgam/src/SDK/SDK.cpp | 3 +- 21 files changed, 365 insertions(+), 208 deletions(-) diff --git a/Amalgam/src/Features/Aimbot/Aimbot.cpp b/Amalgam/src/Features/Aimbot/Aimbot.cpp index 2b9d423d..bd13ab11 100644 --- a/Amalgam/src/Features/Aimbot/Aimbot.cpp +++ b/Amalgam/src/Features/Aimbot/Aimbot.cpp @@ -23,12 +23,8 @@ bool CAimbot::ShouldRun(CTFPlayer* pLocal, CTFWeaponBase* pWeapon) || pLocal->InCond(TF_COND_HALLOWEEN_KART)) return false; - switch (pWeapon->m_iItemDefinitionIndex()) - { - case Soldier_m_RocketJumper: - case Demoman_s_StickyJumper: + if (SDK::AttribHookValue(1, "mult_dmg", pWeapon) == 0) return false; - } if (I::EngineVGui->IsGameUIVisible()) return false; diff --git a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp index ffe91d71..3418ad43 100644 --- a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp @@ -134,7 +134,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() && pWeapon->m_iItemDefinitionIndex() != Heavy_t_TheHolidayPunch + || 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::IgnoreCloakPercentage.Value || 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() diff --git a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp index 4ac3146d..2d4924a6 100644 --- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp @@ -18,7 +18,7 @@ std::vector CAimbotHitscan::GetTargets(CTFPlayer* pLocal, CTFWeaponBas auto eGroupType = EGroupType::GROUP_INVALID; if (Vars::Aimbot::General::Target.Value & Vars::Aimbot::General::TargetEnum::Players) eGroupType = EGroupType::PLAYERS_ENEMIES; - if (pWeapon->m_iItemDefinitionIndex() == Sniper_m_TheSydneySleeper && Vars::Aimbot::Hitscan::Modifiers.Value & Vars::Aimbot::Hitscan::ModifiersEnum::ExtinguishTeam) + if (SDK::AttribHookValue(0, "jarate_duration", pWeapon) > 0 && Vars::Aimbot::Hitscan::Modifiers.Value & Vars::Aimbot::Hitscan::ModifiersEnum::ExtinguishTeam) eGroupType = EGroupType::PLAYERS_ALL; if (pWeapon->GetWeaponID() == TF_WEAPON_MEDIGUN) eGroupType = Vars::Aimbot::Healing::AutoHeal.Value ? EGroupType::PLAYERS_TEAMMATES : EGroupType::GROUP_INVALID; @@ -31,7 +31,7 @@ std::vector CAimbotHitscan::GetTargets(CTFPlayer* pLocal, CTFWeaponBas if (bTeammate) { - if (pWeapon->m_iItemDefinitionIndex() == Sniper_m_TheSydneySleeper) + if (SDK::AttribHookValue(0, "jarate_duration", pWeapon) > 0) { if (!pEntity->As()->InCond(TF_COND_BURNING)) continue; @@ -156,8 +156,7 @@ int CAimbotHitscan::GetHitboxPriority(int nHitbox, CTFPlayer* pLocal, CTFWeaponB { auto pSniperRifle = pWeapon->As(); - if (G::CanHeadshot - || pLocal->InCond(TF_COND_AIMING) && ( + if (G::CanHeadshot || pLocal->InCond(TF_COND_AIMING) && ( pSniperRifle->GetRifleType() == RIFLE_JARATE && SDK::AttribHookValue(0, "jarate_duration", pWeapon) > 0 || Vars::Aimbot::Hitscan::Modifiers.Value & Vars::Aimbot::Hitscan::ModifiersEnum::WaitForHeadshot )) @@ -336,6 +335,55 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* { bool bRunPeekCheck = flSpread && (Vars::Aimbot::General::PeekDTOnly.Value ? F::Ticks.GetTicks(pWeapon) : true) && Vars::Aimbot::General::HitscanPeek.Value; + if (pWeapon->GetWeaponID() == TF_WEAPON_LASER_POINTER) + { + tTarget.m_vPos = tTarget.m_pEntity->m_vecOrigin(); + + // not lag compensated (i assume) so run movesim based on ping + PlayerStorage tStorage; + F::MoveSim.Initialize(tTarget.m_pEntity, tStorage); + if (!tStorage.m_bFailed) + { + for (int i = 1 - TIME_TO_TICKS(F::Backtrack.GetReal()); i <= 0; i++) + tTarget.m_vPos = tStorage.m_vPredictedOrigin; + } + F::MoveSim.Restore(tStorage); + + float flBoneScale = std::max(Vars::Aimbot::Hitscan::BoneSizeMinimumScale.Value, Vars::Aimbot::Hitscan::PointScale.Value / 100.f); + float flBoneSubtract = Vars::Aimbot::Hitscan::BoneSizeSubtract.Value; + + Vec3 vMins = tTarget.m_pEntity->m_vecMins(); + Vec3 vMaxs = tTarget.m_pEntity->m_vecMaxs(); + Vec3 vCheckMins = (vMins + flBoneSubtract) * flBoneScale; + Vec3 vCheckMaxs = (vMaxs - flBoneSubtract) * flBoneScale; + + 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; + if (vEyePos.DistToSqr(tTarget.m_vPos) > flMaxRange) + break; + + if (SDK::VisPos(pLocal, tTarget.m_pEntity, vEyePos, tTarget.m_vPos)) + { + auto vAngles = Aim(G::CurrentUserCmd->viewangles, Math::CalcAngle(pLocal->GetShootPos(), tTarget.m_vPos)); + Vec3 vForward; Math::AngleVectors(vAngles, &vForward); + + if (RayToOBB(vEyePos, vForward, vCheckMins, vCheckMaxs, mTransform)) + { + flPreferredRecord = tRecord.m_flSimTime; + + tTarget.m_vAngleTo = vAngles; + tTarget.m_tRecord = tRecord; + return true; + } + else if (iReturn == 2 ? vAngles.DeltaAngle(G::CurrentUserCmd->viewangles).Length2D() < tTarget.m_vAngleTo.DeltaAngle(G::CurrentUserCmd->viewangles).Length2D() : true) + tTarget.m_vAngleTo = vAngles; + iReturn = 2; + } + + break; + } + if (tTarget.m_iTargetType == TargetEnum::Player) { auto aBones = tRecord.m_BoneMatrix.m_aBones; @@ -359,17 +407,19 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* return std::get<2>(a) < std::get<2>(b); }); + float flModelScale = tTarget.m_pEntity->As()->m_flModelScale(); + float flBoneScale = std::max(Vars::Aimbot::Hitscan::BoneSizeMinimumScale.Value, Vars::Aimbot::Hitscan::PointScale.Value / 100.f); + float flBoneSubtract = Vars::Aimbot::Hitscan::BoneSizeSubtract.Value; + + auto pGameRules = I::TFGameRules(); + auto pViewVectors = pGameRules ? pGameRules->GetViewVectors() : nullptr; + Vec3 vHullMins = (pViewVectors ? pViewVectors->m_vHullMin : Vec3(-24, -24, 0)) * flModelScale; + Vec3 vHullMaxs = (pViewVectors ? pViewVectors->m_vHullMax : Vec3(24, 24, 82)) * flModelScale; + + const matrix3x4 mTransform = { { 1, 0, 0, tRecord.m_vOrigin.x }, { 0, 1, 0, tRecord.m_vOrigin.y }, { 0, 0, 1, tRecord.m_vOrigin.z } }; + for (auto& [pBox, iHitbox, _] : vHitboxes) { - float flModelScale = tTarget.m_pEntity->As()->m_flModelScale(); - float flBoneScale = std::max(Vars::Aimbot::Hitscan::BoneSizeMinimumScale.Value, Vars::Aimbot::Hitscan::PointScale.Value / 100.f); - float flBoneSubtract = Vars::Aimbot::Hitscan::BoneSizeSubtract.Value; - - auto pGameRules = I::TFGameRules(); - auto pViewVectors = pGameRules ? pGameRules->GetViewVectors() : nullptr; - Vec3 vHullMins = (pViewVectors ? pViewVectors->m_vHullMin : Vec3(-24, -24, 0)) * flModelScale; - Vec3 vHullMaxs = (pViewVectors ? pViewVectors->m_vHullMax : Vec3(24, 24, 82)) * flModelScale; - Vec3 vAngle; Math::MatrixAngles(aBones[pBox->bone], vAngle); Vec3 vMins = pBox->bbmin; Vec3 vMaxs = pBox->bbmax; @@ -409,8 +459,6 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* } } - auto pCollideable = tTarget.m_pEntity->GetCollideable(); - const matrix3x4& transform = pCollideable ? pCollideable->CollisionToWorldTransform() : tTarget.m_pEntity->RenderableToWorldTransform(); for (auto& vPoint : vPoints) { Vec3 vOrigin = {}; Math::VectorTransform(vPoint, aBones[pBox->bone], vOrigin); vOrigin += vOffset; @@ -431,7 +479,7 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* Vec3 vForward; Math::AngleVectors(vAngles, &vForward); // not perfect but it will do for now - if (Math::RayToOBB(vEyePos, vForward, vHullMins, vHullMaxs, transform)) + if (Math::RayToOBB(vEyePos, vForward, vHullMins, vHullMaxs, mTransform)) { // for the time being, no vischecks against other hitboxes Vec3 vCheckMins = (vMins + flBoneSubtract / flModelScale) * flBoneScale, vCheckMaxs = (vMaxs - flBoneSubtract / flModelScale) * flBoneScale; @@ -461,6 +509,11 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* Vec3 vMins = tTarget.m_pEntity->m_vecMins(); Vec3 vMaxs = tTarget.m_pEntity->m_vecMaxs(); + Vec3 vCheckMins = (vMins + flBoneSubtract) * flBoneScale; + Vec3 vCheckMaxs = (vMaxs - flBoneSubtract) * flBoneScale; + + auto pCollideable = tTarget.m_pEntity->GetCollideable(); + const matrix3x4& mTransform = pCollideable ? pCollideable->CollisionToWorldTransform() : tTarget.m_pEntity->RenderableToWorldTransform(); std::vector vPoints = { Vec3() }; //if (Vars::Aimbot::Hitscan::PointScale.Value > 0.f) @@ -489,8 +542,6 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* } } - auto pCollideable = tTarget.m_pEntity->GetCollideable(); - const matrix3x4& transform = pCollideable ? pCollideable->CollisionToWorldTransform() : tTarget.m_pEntity->RenderableToWorldTransform(); for (auto& vPoint : vPoints) { Vec3 vOrigin = tTarget.m_pEntity->GetCenter() + vPoint; @@ -510,8 +561,7 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* auto vAngles = Aim(G::CurrentUserCmd->viewangles, Math::CalcAngle(pLocal->GetShootPos(), vOrigin)); Vec3 vForward; Math::AngleVectors(vAngles, &vForward); - Vec3 vCheckMins = (vMins + flBoneSubtract) * flBoneScale, vCheckMaxs = (vMaxs - flBoneSubtract) * flBoneScale; - if (RayToOBB(vEyePos, vForward, vCheckMins, vCheckMaxs, transform)) + if (RayToOBB(vEyePos, vForward, vCheckMins, vCheckMaxs, mTransform)) { tTarget.m_vAngleTo = vAngles; tTarget.m_tRecord = tRecord; @@ -572,7 +622,7 @@ bool CAimbotHitscan::ShouldFire(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser if (!pLocal->InCond(TF_COND_AIMING) || pSniperRifle->m_flChargedDamage() == 150.f) return true; - if (tTarget.m_nAimedHitbox == HITBOX_HEAD && (pWeapon->m_iItemDefinitionIndex() != Sniper_m_TheClassic ? true : pSniperRifle->m_flChargedDamage() == 150.f)) + 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; @@ -706,13 +756,8 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC if (Vars::Aimbot::Hitscan::Modifiers.Value & Vars::Aimbot::Hitscan::ModifiersEnum::ScopedOnly && !bScoped) return; - switch (pWeapon->m_iItemDefinitionIndex()) - { - case Sniper_m_TheMachina: - case Sniper_m_ShootingStar: - if (!bScoped) - return; - } + if (!bScoped && SDK::AttribHookValue(0, "sniper_only_fire_zoomed", pWeapon)) + return; break; } @@ -723,7 +768,7 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC for (auto& tTarget : vTargets) { - if (pWeapon->GetWeaponID() == TF_WEAPON_MEDIGUN && pWeapon->As()->m_hHealingTarget().Get() == tTarget.m_pEntity) + if (nWeaponID == TF_WEAPON_MEDIGUN && pWeapon->As()->m_hHealingTarget().Get() == tTarget.m_pEntity) { if (G::LastUserCmd->buttons & IN_ATTACK) pCmd->buttons |= IN_ATTACK; @@ -746,18 +791,14 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC if (bShouldFire) { - if (pWeapon->GetWeaponID() != TF_WEAPON_MEDIGUN || !(G::LastUserCmd->buttons & IN_ATTACK)) + if (nWeaponID != TF_WEAPON_MEDIGUN || !(G::LastUserCmd->buttons & IN_ATTACK)) pCmd->buttons |= IN_ATTACK; if (nWeaponID == TF_WEAPON_SNIPERRIFLE_CLASSIC && pWeapon->As()->m_flChargedDamage() && pLocal->m_hGroundEntity()) pCmd->buttons &= ~IN_ATTACK; - switch (pWeapon->m_iItemDefinitionIndex()) - { - case Engi_s_TheWrangler: - case Engi_s_FestiveWrangler: + 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) @@ -770,7 +811,7 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC G::Attacking = SDK::IsAttacking(pLocal, pWeapon, pCmd, true); - if (G::Attacking == 1) + if (G::Attacking == 1 && nWeaponID != TF_WEAPON_LASER_POINTER) { if (tTarget.m_pEntity->IsPlayer()) F::Resolver.HitscanRan(pLocal, tTarget.m_pEntity->As(), pWeapon, tTarget.m_nAimedHitbox); diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp index b804938e..fcd06ad7 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp @@ -14,7 +14,7 @@ std::vector CAimbotMelee::GetTargets(CTFPlayer* pLocal, CTFWeaponBase* if (Vars::Aimbot::General::Target.Value & Vars::Aimbot::General::TargetEnum::Players) { - bool bDisciplinary = Vars::Aimbot::Melee::WhipTeam.Value && pWeapon->m_iItemDefinitionIndex() == Soldier_t_TheDisciplinaryAction; + bool bDisciplinary = Vars::Aimbot::Melee::WhipTeam.Value && SDK::AttribHookValue(0, "speed_buff_ally", pWeapon) > 0; for (auto pEntity : H::Entities.GetGroup(bDisciplinary ? EGroupType::PLAYERS_ALL : EGroupType::PLAYERS_ENEMIES)) { bool bTeammate = pEntity->m_iTeamNum() == pLocal->m_iTeamNum(); @@ -32,15 +32,8 @@ std::vector CAimbotMelee::GetTargets(CTFPlayer* pLocal, CTFWeaponBase* if (Vars::Aimbot::General::Target.Value) { - bool bWrench = pWeapon->GetWeaponID() == TF_WEAPON_WRENCH, bDestroySapper = false; - switch (pWeapon->m_iItemDefinitionIndex()) - { - case Pyro_t_Homewrecker: - case Pyro_t_TheMaul: - case Pyro_t_NeonAnnihilator: - case Pyro_t_NeonAnnihilatorG: - bDestroySapper = true; - } + bool bWrench = pWeapon->GetWeaponID() == TF_WEAPON_WRENCH; + bool bDestroySapper = pWeapon->GetWeaponID() == TF_WEAPON_FIREAXE && SDK::AttribHookValue(0, "set_dmg_apply_to_sapper", pWeapon); for (auto pEntity : H::Entities.GetGroup(bWrench || bDestroySapper ? EGroupType::BUILDINGS_ALL : EGroupType::BUILDINGS_ENEMIES)) { diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp index b9f51950..d0d3e2d7 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp @@ -84,12 +84,16 @@ std::vector CAimbotProjectile::GetTargets(CTFPlayer* pLocal, CTFWeapon if (Vars::Aimbot::General::Target.Value & Vars::Aimbot::General::TargetEnum::Stickies) { bool bShouldAim = false; - switch (pWeapon->m_iItemDefinitionIndex()) + switch (pWeapon->GetWeaponID()) { - case Demoman_s_TheQuickiebombLauncher: - case Demoman_s_TheScottishResistance: - case Pyro_s_TheScorchShot: - bShouldAim = true; + case TF_WEAPON_PIPEBOMBLAUNCHER: + if (SDK::AttribHookValue(0, "stickies_detonate_stickies", pWeapon) == 1) + bShouldAim = true; + break; + case TF_WEAPON_FLAREGUN: + case TF_WEAPON_FLAREGUN_REVENGE: + if (pWeapon->As()->GetFlareGunType() == FLAREGUN_SCORCHSHOT) + bShouldAim = true; } if (bShouldAim) @@ -151,9 +155,12 @@ static inline float GetSplashRadius(CTFWeaponBase* pWeapon, CTFPlayer* pLocal = case TF_WEAPON_PARTICLE_CANNON: case TF_WEAPON_PIPEBOMBLAUNCHER: flRadius = 146.f; + break; + case TF_WEAPON_FLAREGUN: + case TF_WEAPON_FLAREGUN_REVENGE: + if (pWeapon->As()->GetFlareGunType() == FLAREGUN_SCORCHSHOT) + flRadius = 110.f; } - if (!flRadius && pWeapon->m_iItemDefinitionIndex() == Pyro_s_TheScorchShot) - flRadius = 110.f; if (!flRadius) return 0.f; diff --git a/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp b/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp index 79e7e393..578a72f5 100644 --- a/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp +++ b/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp @@ -10,18 +10,8 @@ static inline bool ShouldTargetProjectile(CBaseEntity* pProjectile, CTFPlayer* p switch (pProjectile->GetClassID()) { case ETFClassID::CTFGrenadePipebombProjectile: - case ETFClassID::CTFProjectile_Cleaver: - case ETFClassID::CTFStunBall: - { if (pProjectile->As()->m_bTouched()) - return false; // ignore landed vphysics objects - break; - } - case ETFClassID::CTFProjectile_Arrow: - { - if (pProjectile->GetAbsVelocity().IsZero()) - return false; // ignore arrows with no velocity / not moving - } + return false; } return true; @@ -46,7 +36,7 @@ static inline Vec3 PredictOrigin(Vec3& vOrigin, Vec3 vVelocity, float flLatency, bool CAutoAirblast::CanAirblastEntity(CTFPlayer* pLocal, CBaseEntity* pEntity, Vec3& vAngle, Vec3& vPos) { Vec3 vForward; Math::AngleVectors(vAngle, &vForward); - const Vec3 vOrigin = pLocal->GetShootPos() + (vForward * 128.f); + const Vec3 vOrigin = pLocal->GetShootPos() + vForward * 128.f; CBaseEntity* pTarget; for (CEntitySphereQuery sphere(vOrigin, 128.f); @@ -66,7 +56,7 @@ void CAutoAirblast::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCm return; const int iWeaponID = pWeapon->GetWeaponID(); - if (iWeaponID != TF_WEAPON_FLAMETHROWER && iWeaponID != TF_WEAPON_FLAME_BALL || pWeapon->m_iItemDefinitionIndex() == Pyro_m_ThePhlogistinator) + if (iWeaponID != TF_WEAPON_FLAMETHROWER && iWeaponID != TF_WEAPON_FLAME_BALL || !SDK::AttribHookValue(0, "airblast_disabled", pWeapon)) return; const Vec3 vEyePos = pLocal->GetShootPos(); diff --git a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp index cfadbdfe..d31cd0e1 100644 --- a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp +++ b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp @@ -109,7 +109,7 @@ static inline bool CheckEntities(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUse if (!SDK::VisPosProjectile(pProjectile, pEntity, vOrigin, pEntity->IsPlayer() ? pEntity->GetAbsOrigin() + pEntity->As()->GetViewOffset() : pEntity->GetCenter(), MASK_SHOT)) continue; - if (pCmd && pWeapon && pWeapon->m_iItemDefinitionIndex() == Demoman_s_TheScottishResistance) + if (pCmd && pWeapon->GetWeaponID() == TF_WEAPON_PIPEBOMBLAUNCHER && pWeapon->As()->GetDetonateType() == TF_DETONATE_MODE_DOT) { Vec3 vAngleTo = Math::CalcAngle(pLocal->GetShootPos(), vOrigin); SDK::FixMovement(pCmd, vAngleTo); diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.cpp b/Amalgam/src/Features/ImGui/Menu/Menu.cpp index 1561883a..440ebf71 100644 --- a/Amalgam/src/Features/ImGui/Menu/Menu.cpp +++ b/Amalgam/src/Features/ImGui/Menu/Menu.cpp @@ -1982,12 +1982,10 @@ void CMenu::MenuSettings(int iTab) // make sure bind can't be parented to itself or any of its children int _iBind2 = _iBind; Bind_t _tBind2; - while (true) + while (F::Binds.GetBind(_iBind2, &_tBind2)) { if (_iBind2 == iBind) tBind.m_iParent = DEFAULT_BIND; - if (!F::Binds.GetBind(_iBind2, &_tBind2)) - break; _iBind2 = _tBind2.m_iParent; } } @@ -2928,6 +2926,9 @@ void CMenu::MenuSettings(int iTab) case 3: if (BeginTable("MaterialsTable", 2)) { + TableSetupColumn("MaterialsTable1", ImGuiTableColumnFlags_WidthFixed, H::Draw.Scale(288)); + TableSetupColumn("MaterialsTable2", ImGuiTableColumnFlags_WidthFixed, GetWindowWidth()); + static TextEditor TextEditor; static std::string CurrentMaterial; static bool LockedMaterial; diff --git a/Amalgam/src/Features/Misc/Misc.cpp b/Amalgam/src/Features/Misc/Misc.cpp index cd5b36e0..76c070f3 100644 --- a/Amalgam/src/Features/Misc/Misc.cpp +++ b/Amalgam/src/Features/Misc/Misc.cpp @@ -482,9 +482,8 @@ int CMisc::AntiBackstab(CTFPlayer* pLocal, CUserCmd* pCmd, bool bSendPacket) auto pWeapon = pPlayer->m_hActiveWeapon().Get()->As(); if (!pWeapon || pWeapon->GetWeaponID() != TF_WEAPON_KNIFE - && pWeapon->m_iItemDefinitionIndex() != Heavy_t_TheHolidayPunch - && pWeapon->m_iItemDefinitionIndex() != Pyro_m_TheBackburner - && pWeapon->m_iItemDefinitionIndex() != Pyro_m_FestiveBackburner + && !(G::PrimaryWeaponType == EWeaponType::MELEE && SDK::AttribHookValue(0, "crit_from_behind", pWeapon) > 0) + && !(pWeapon->GetWeaponID() == TF_WEAPON_FLAMETHROWER && SDK::AttribHookValue(0, "set_flamethrower_back_crit", pWeapon) == 1) || F::PlayerUtils.IsIgnored(pPlayer->entindex())) continue; diff --git a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp index 33e4659f..7c9a7617 100644 --- a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp +++ b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp @@ -73,7 +73,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap if (Vars::Visuals::Trajectory::Override.Value) { SDK::GetProjectileFireSetup(pPlayer, vAngles, { Vars::Visuals::Trajectory::OffX.Value, Vars::Visuals::Trajectory::OffY.Value, Vars::Visuals::Trajectory::OffZ.Value }, vPos, vAngle, !bTrace ? true : Vars::Visuals::Trajectory::Pipes.Value, bQuick); - tProjInfo = { TF_PROJECTILE_NONE, 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 = { 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 }; return true; } @@ -84,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 = { TF_PROJECTILE_ROCKET, vPos, vAngle, { 0.f, 0.f, 0.f }, flSpeed, 0.f, true }; + tProjInfo = { FNV1A::Hash32Const("models/weapons/w_models/w_rocket.mdl"), vPos, vAngle, { 0.f, 0.f, 0.f }, flSpeed, 0.f, true }; return true; } case TF_WEAPON_PARTICLE_CANNON: @@ -97,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 = { TF_PROJECTILE_ENERGY_RING, vPos, vAngle, bCowMangler ? Vec3() : Vec3(1.f, 1.f, 1.f), flSpeed, 0.f, true }; + 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 }; return true; } case TF_WEAPON_GRENADELAUNCHER: // vphysics projectiles affected by server start gravity @@ -111,29 +111,30 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap float flLifetime = flMortar ? pWeapon->As()->m_flDetonateTime() > 0.f ? pWeapon->As()->m_flDetonateTime() - I::GlobalVars->curtime : flMortar : SDK::AttribHookValue(2.2f, "fuse_mult", pWeapon); - tProjInfo = { bCannon ? TF_PROJECTILE_CANNONBALL : TF_PROJECTILE_PIPEBOMB, vPos, vAngle, { 6.f, 6.f, 6.f }, flSpeed, 1.f, pWeapon->m_iItemDefinitionIndex() == Demoman_m_TheLochnLoad, flLifetime }; + 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 }; return true; } case TF_WEAPON_PIPEBOMBLAUNCHER: { SDK::GetProjectileFireSetup(pPlayer, vAngles, { 16.f, 8.f, -6.f }, vPos, vAngle, true, bQuick); - float flCharge = flAutoCharge > 0.f && pWeapon->m_iItemDefinitionIndex() != Demoman_s_StickyJumper + 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 = { TF_PROJECTILE_PIPEBOMB_REMOTE, vPos, vAngle, { 6.f, 6.f, 6.f }, flSpeed, 1.f, false }; + tProjInfo = { FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb.mdl"), vPos, vAngle, { 6.f, 6.f, 6.f }, flSpeed, 1.f, false }; 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 = { TF_PROJECTILE_FLARE, vPos, vAngle, { 1.f, 1.f, 1.f }, SDK::AttribHookValue(2000.f, "mult_projectile_speed", pWeapon), 0.3f * flGravity, true}; + 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}; 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 = { TF_PROJECTILE_FLARE, vPos, vAngle, { 1.f, 1.f, 1.f }, 3000.f, 0.45f * flGravity, true }; + 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 }; return true; } case TF_WEAPON_COMPOUND_BOW: @@ -142,20 +143,23 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap 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); flGravity = Math::RemapVal(flCharge, 0.f, 1.f, 0.5f, 0.1f) * flGravity; - tProjInfo = { TF_PROJECTILE_ARROW, vPos, vAngle, { 1.f, 1.f, 1.f }, flSpeed, flGravity, true, 10.f /*arrows have some lifetime check for whatever reason*/ }; + 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*/ }; return true; } case TF_WEAPON_CROSSBOW: case TF_WEAPON_SHOTGUN_BUILDING_RESCUE: { + bool bCrossbow = pWeapon->GetWeaponID() == TF_WEAPON_CROSSBOW; + SDK::GetProjectileFireSetup(pPlayer, vAngles, { 23.5f, 8.f, -3.f }, vPos, vAngle, !bTrace ? true : false, bQuick); - tProjInfo = { TF_PROJECTILE_ARROW, 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*/ }; + 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*/ }; return true; } case TF_WEAPON_SYRINGEGUN_MEDIC: { SDK::GetProjectileFireSetup(pPlayer, vAngles, { 16.f, 6.f, -8.f }, vPos, vAngle, !bTrace ? true : false, bQuick); - tProjInfo = { TF_PROJECTILE_SYRINGE, vPos, vAngle, { 1.f, 1.f, 1.f }, 1000.f, 0.3f * flGravity, true }; + 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 }; return true; } case TF_WEAPON_FLAMETHROWER: @@ -165,7 +169,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap bool bFlipped = cl_flipviewmodels ? cl_flipviewmodels->GetBool() : false; SDK::GetProjectileFireSetup(pPlayer, vAngles, { 40.f, bFlipped ? -5.f : 5.f /*doesn't flip*/, 0.f }, vPos, vAngle, true, bQuick); - tProjInfo = { TF_PROJECTILE_FLAME_ROCKET, vPos, vAngle, { flHull, flHull, flHull }, 1000.f, 0.f, true, 0.285f }; + tProjInfo = { FNV1A::Hash32Const("particles/flamethrower.pcf"), vPos, vAngle, { flHull, flHull, flHull }, 1000.f, 0.f, true, 0.285f }; return true; } case TF_WEAPON_FLAME_BALL: @@ -173,13 +177,13 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap bool bFlipped = cl_flipviewmodels ? cl_flipviewmodels->GetBool() : false; SDK::GetProjectileFireSetup(pPlayer, vAngles, { 70.f, bFlipped ? -7.f : 7.f /*doesn't flip*/, -9.f}, vPos, vAngle, !bTrace ? true : false, bQuick); - tProjInfo = { TF_PROJECTILE_BALLOFFIRE, vPos, vAngle, { 1.f, 1.f, 1.f /*damaging hull much bigger, shouldn't matter here*/ }, 3000.f, 0.f, true, 0.2f }; + 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.2f }; return true; } case TF_WEAPON_CLEAVER: { SDK::GetProjectileFireSetup(pPlayer, vAngles, { 16.f, 8.f, -6.f }, vPos, vAngle, true, bQuick); - tProjInfo = { TF_PROJECTILE_CLEAVER, vPos, vAngle, { 1.f, 1.f, 10.f /*weird, probably still inaccurate*/ }, 3000.f, 1.f, !bTrace ? true : false, 2.2f }; + 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 }; return true; } case TF_WEAPON_BAT_WOOD: @@ -192,20 +196,28 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap SDK::GetProjectileFireSetup(pPlayer, vAngles, { 0.f, 0.f, 0.f }, vPos, vAngle, true, bQuick); Vec3 vForward; Math::AngleVectors(vAngle, &vForward); vPos = (bQuick ? pPlayer->GetAbsOrigin() : pPlayer->m_vecOrigin()) + (Vec3(0, 0, 50) + vForward * 32.f) * pPlayer->m_flModelScale(); // why? - tProjInfo = { bWrapAssassin ? TF_PROJECTILE_FESTIVE_ARROW : TF_PROJECTILE_THROWABLE, vPos, vAngle, { 3.f, 3.f, 3.f }, tf_scout_stunball_base_speed ? tf_scout_stunball_base_speed->GetInt() : 3000.f, 1.f, false, bWrapAssassin ? 2.3f : 100.f }; + 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 ? tf_scout_stunball_base_speed->GetInt() : 3000.f, 1.f, false, bWrapAssassin ? 2.3f : 100.f }; return true; } case TF_WEAPON_JAR: case TF_WEAPON_JAR_MILK: { SDK::GetProjectileFireSetup(pPlayer, vAngles, { 16.f, 8.f, -6.f }, vPos, vAngle, true, bQuick); - tProjInfo = { TF_PROJECTILE_JAR, vPos, vAngle, { 3.f, 3.f, 3.f }, 1000.f, 1.f, false, 2.2f }; + uint32_t uType = uType = FNV1A::Hash32Const("models/weapons/c_models/urinejar.mdl"); + switch (pWeapon->m_iItemDefinitionIndex()) + { + case Scout_s_MadMilk: uType = FNV1A::Hash32Const("models/workshop/weapons/c_models/c_madmilk/c_madmilk.mdl"); break; + 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 }; return true; } case TF_WEAPON_JAR_GAS: { SDK::GetProjectileFireSetup(pPlayer, vAngles, { 16.f, 8.f, -6.f }, vPos, vAngle, true, bQuick); - tProjInfo = { TF_PROJECTILE_JAR_GAS, vPos, vAngle, { 3.f, 3.f, 3.f }, 2000.f, 1.f, false, 2.2f }; + 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 }; return true; } case TF_WEAPON_GRAPPLINGHOOK: @@ -224,7 +236,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap } } float flLifetime = (tf_grapplinghook_max_distance ? tf_grapplinghook_max_distance->GetFloat() : 2000.f) / flSpeed; - tProjInfo = { TF_PROJECTILE_GRAPPLINGHOOK, vPos, vAngle, { 1.2f, 1.2f, 1.2f }, flSpeed, 0.f, false, flLifetime }; + 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 }; return true; } } @@ -238,7 +250,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 = { TF_PROJECTILE_BREAD_MONSTER, vPos, vAngle, { 17.f, 17.f, 7.f }, 500.f, 1.f * flGravity, false }; + 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 }; return true; } @@ -314,7 +326,7 @@ bool CProjectileSimulation::GetInfo(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, return !trace.DidHit(); } -bool CProjectileSimulation::Initialize(ProjectileInfo& tProjInfo, bool bSimulate) +bool CProjectileSimulation::Initialize(ProjectileInfo& tProjInfo, bool bSimulate, bool bVelocities) { if (!env) env = I::Physics->CreateEnvironment(); @@ -346,52 +358,72 @@ bool CProjectileSimulation::Initialize(ProjectileInfo& tProjInfo, bool bSimulate Vec3 vDragBasis = {}; Vec3 vAngDragBasis = {}; - // these values were dumped from the server by firing the projectiles with 0 0 0 angles - // they are calculated in CPhysicsObject::RecomputeDragBases - switch (tProjInfo.m_iType) + switch (tProjInfo.m_uType) { - case TF_PROJECTILE_NONE: + case FNV1A::Hash32Const("custom"): flDrag = Vars::Visuals::Trajectory::Drag.Value; vDragBasis = { Vars::Visuals::Trajectory::DragBasisX.Value, Vars::Visuals::Trajectory::DragBasisY.Value, Vars::Visuals::Trajectory::DragBasisZ.Value }; vAngDragBasis = { Vars::Visuals::Trajectory::AngDragBasisX.Value, Vars::Visuals::Trajectory::AngDragBasisY.Value, Vars::Visuals::Trajectory::AngDragBasisZ.Value }; break; - case TF_PROJECTILE_PIPEBOMB: + case FNV1A::Hash32Const("models/weapons/w_models/w_grenade_grenadelauncher.mdl"): + case FNV1A::Hash32Const("models/workshop/weapons/c_models/c_quadball/w_quadball_grenade.mdl"): flDrag = 1.f; vDragBasis = { 0.003902f, 0.009962f, 0.009962f }; vAngDragBasis = { 0.003618f, 0.001514f, 0.001514f }; break; - case TF_PROJECTILE_PIPEBOMB_REMOTE: - case TF_PROJECTILE_PIPEBOMB_PRACTICE: + case FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb.mdl"): + case FNV1A::Hash32Const("models/workshop/weapons/c_models/c_kingmaker_sticky/w_kingmaker_stickybomb.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb_d.mdl"): flDrag = 1.f; vDragBasis = { 0.007491f, 0.007491f, 0.007306f }; vAngDragBasis = { 0.002777f, 0.002842f, 0.002812f }; break; - case TF_PROJECTILE_CANNONBALL: + case FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb2.mdl"): + flDrag = 1.f; + vDragBasis = { 0.007394f, 0.007394f, 0.007100f }; + vAngDragBasis = { 0.002654f, 0.002717f, 0.002708f }; + break; + case FNV1A::Hash32Const("models/weapons/w_models/w_cannonball.mdl"): flDrag = 1.f; vDragBasis = { 0.020971f, 0.019420f, 0.020971f }; vAngDragBasis = { 0.012997f, 0.013496f, 0.013714f }; break; - case TF_PROJECTILE_CLEAVER: + case FNV1A::Hash32Const("models/workshop_partner/weapons/c_models/c_sd_cleaver/c_sd_cleaver.mdl"): flDrag = 1.f; vDragBasis = { 0.022287f, 0.005208f, 0.110697f }; vAngDragBasis = { 0.013982f, 0.043243f, 0.003465f }; break; - case TF_PROJECTILE_THROWABLE: + case FNV1A::Hash32Const("models/weapons/w_models/w_baseball.mdl"): flDrag = 1.f; vDragBasis = { 0.009000f /*0.006645f*/, 0.006581f, 0.006710f}; vAngDragBasis = { 0.002233f, 0.002246f, 0.002206f }; break; - case TF_PROJECTILE_FESTIVE_ARROW: + case FNV1A::Hash32Const("models/weapons/c_models/c_xms_festive_ornament.mdl"): flDrag = 1.f; vDragBasis = { 0.013500f /*0.010867f*/, 0.0108727f, 0.010804f }; vAngDragBasis = { 0.002081f, 0.002162f, 0.002069f }; break; - case TF_PROJECTILE_JAR: // there are different drags for different models, though shouldn't matter too much here + case FNV1A::Hash32Const("models/weapons/c_models/urinejar.mdl"): flDrag = 1.f; vDragBasis = { 0.005127f, 0.002925f, 0.004337f }; vAngDragBasis = { 0.000641f, 0.001350f, 0.000717f }; break; - case TF_PROJECTILE_JAR_GAS: + case FNV1A::Hash32Const("models/workshop/weapons/c_models/c_madmilk/c_madmilk.mdl"): + flDrag = 1.f; + vDragBasis = { 0.005514f, 0.002313f, 0.005558f }; + vAngDragBasis = { 0.000684f, 0.001439f, 0.000680f }; + break; + case FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster.mdl"): + flDrag = 1.f; + vDragBasis = { 0.002208f, 0.001640f, 0.002187f }; + vAngDragBasis = { 0.000799f, 0.001515f, 0.000879f }; + break; + case FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster_milk.mdl"): + flDrag = 1.f; + vDragBasis = { 0.002335f, 0.001960f, 0.001920f }; + vAngDragBasis = { 0.000672f, 0.001064f, 0.000747f }; + break; + case FNV1A::Hash32Const("models/weapons/c_models/c_gascan/c_gascan.mdl"): flDrag = 1.f; vDragBasis = { 0.026360f, 0.021780f, 0.058978f }; vAngDragBasis = { 0.035050f, 0.031199f, 0.022922f }; @@ -405,61 +437,98 @@ bool CProjectileSimulation::Initialize(ProjectileInfo& tProjInfo, bool bSimulate //set position and velocity { - Vec3 vAngleAdd = {}; - if (tProjInfo.m_iType == TF_PROJECTILE_BREAD_MONSTER) - vAngleAdd = Vec3(-10.f, 0.f, 0.f); - - Vec3 vForward, vRight, vUp; Math::AngleVectors(tProjInfo.m_vAng + vAngleAdd, &vForward, &vRight, &vUp); - Vec3 vVelocity = vForward * tProjInfo.m_flVelocity, vAngularVelocity; - - switch (tProjInfo.m_iType) + Vec3 vVelocity, vAngularVelocity; + if (bVelocities) { - case TF_PROJECTILE_NONE: - vVelocity += vUp * Vars::Visuals::Trajectory::UpVelocity.Value; - vAngularVelocity = { Vars::Visuals::Trajectory::AngVelocityX.Value, Vars::Visuals::Trajectory::AngVelocityY.Value, Vars::Visuals::Trajectory::AngVelocityZ.Value }; - break; - case TF_PROJECTILE_PIPEBOMB: - case TF_PROJECTILE_PIPEBOMB_REMOTE: - case TF_PROJECTILE_PIPEBOMB_PRACTICE: - case TF_PROJECTILE_CANNONBALL: - 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 }; - break; - } - vVelocity += vUp * 200.f; - vAngularVelocity = { 600.f, -1200.f, 0.f }; - break; - case TF_PROJECTILE_CLEAVER: - vVelocity = vForward * 10 + vUp; - vVelocity.Normalize(); - vVelocity *= tProjInfo.m_flVelocity; - vAngularVelocity = { 0.f, 500.f, 0.f }; - break; - case TF_PROJECTILE_THROWABLE: - case TF_PROJECTILE_FESTIVE_ARROW: - vVelocity = vForward * 10 + vUp; - vVelocity.Normalize(); - vVelocity *= tProjInfo.m_flVelocity; - vAngularVelocity = { 0.f, 100.f, 0.f }; - break; - case TF_PROJECTILE_JAR: - case TF_PROJECTILE_JAR_GAS: - vVelocity += vUp * 200.f; - vAngularVelocity = { 300.f, 0.f, 0.f }; - break; - case TF_PROJECTILE_FLAME_ROCKET: - if (bSimulate && tProjInfo.m_pOwner) - { - Vec3 vOwnerVelocity = tProjInfo.m_pOwner->m_vecVelocity(); - if (!vOwnerVelocity.IsZero()) - { - float flOwnerVelocity = vOwnerVelocity.Length(); + Vec3 vAngle = tProjInfo.m_vAng; + if (tProjInfo.m_uType == FNV1A::Hash32Const("models/weapons/c_models/c_sandwich/c_sandwich.mdl")) + vAngle -= Vec3(10.f, 0.f, 0.f); - float flDot = vForward.Dot(vOwnerVelocity) / flOwnerVelocity; - vVelocity = vForward * (tProjInfo.m_flVelocity + flOwnerVelocity * flDot); + Vec3 vForward, vRight, vUp; Math::AngleVectors(vAngle, &vForward, &vRight, &vUp); + vVelocity = vForward * tProjInfo.m_flVelocity; + + switch (tProjInfo.m_uType) + { + case FNV1A::Hash32Const("custom"): + vVelocity += vUp * Vars::Visuals::Trajectory::UpVelocity.Value; + vAngularVelocity = { Vars::Visuals::Trajectory::AngVelocityX.Value, Vars::Visuals::Trajectory::AngVelocityY.Value, Vars::Visuals::Trajectory::AngVelocityZ.Value }; + break; + case FNV1A::Hash32Const("models/weapons/w_models/w_grenade_grenadelauncher.mdl"): + case FNV1A::Hash32Const("models/workshop/weapons/c_models/c_quadball/w_quadball_grenade.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb2.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_cannonball.mdl"): + 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 }; + break; } + vVelocity += vUp * 200.f; + vAngularVelocity = { 600.f, -1200.f, 0.f }; + break; + case FNV1A::Hash32Const("models/workshop_partner/weapons/c_models/c_sd_cleaver/c_sd_cleaver.mdl"): + vVelocity = vForward * 10 + vUp; + vVelocity.Normalize(); + vVelocity *= tProjInfo.m_flVelocity; + vAngularVelocity = { 0.f, 500.f, 0.f }; + break; + case FNV1A::Hash32Const("models/weapons/w_models/w_baseball.mdl"): + case FNV1A::Hash32Const("models/weapons/c_models/c_xms_festive_ornament.mdl"): + vVelocity = vForward * 10 + vUp; + vVelocity.Normalize(); + vVelocity *= tProjInfo.m_flVelocity; + vAngularVelocity = { 0.f, 100.f, 0.f }; + break; + case FNV1A::Hash32Const("models/weapons/c_models/urinejar.mdl"): + case FNV1A::Hash32Const("models/workshop/weapons/c_models/c_madmilk/c_madmilk.mdl"): + case FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster.mdl"): + case FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster_milk.mdl"): + case FNV1A::Hash32Const("models/weapons/c_models/c_gascan/c_gascan.mdl"): + vVelocity += vUp * 200.f; + vAngularVelocity = { 300.f, 0.f, 0.f }; + break; + case FNV1A::Hash32Const("particles/flamethrower.pcf"): + if (bSimulate && tProjInfo.m_pOwner) + { + Vec3 vOwnerVelocity = tProjInfo.m_pOwner->m_vecVelocity(); + if (!vOwnerVelocity.IsZero()) + { + float flOwnerVelocity = vOwnerVelocity.Length(); + + float flDot = vForward.Dot(vOwnerVelocity) / flOwnerVelocity; + vVelocity = vForward * (tProjInfo.m_flVelocity + flOwnerVelocity * flDot); + } + } + } + } + else // in the case of adding already existing projectiles + { + vVelocity = tProjInfo.m_vAng; + + switch (tProjInfo.m_uType) + { + case FNV1A::Hash32Const("models/weapons/w_models/w_grenade_grenadelauncher.mdl"): + case FNV1A::Hash32Const("models/workshop/weapons/c_models/c_quadball/w_quadball_grenade.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb2.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_cannonball.mdl"): + vAngularVelocity = { 600.f, -1200.f, 0.f }; + break; + case FNV1A::Hash32Const("models/workshop_partner/weapons/c_models/c_sd_cleaver/c_sd_cleaver.mdl"): + vAngularVelocity = { 0.f, 500.f, 0.f }; + break; + case FNV1A::Hash32Const("models/weapons/w_models/w_baseball.mdl"): + case FNV1A::Hash32Const("models/weapons/c_models/c_xms_festive_ornament.mdl"): + vAngularVelocity = { 0.f, 100.f, 0.f }; + break; + case FNV1A::Hash32Const("models/weapons/c_models/urinejar.mdl"): + case FNV1A::Hash32Const("models/workshop/weapons/c_models/c_madmilk/c_madmilk.mdl"): + case FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster.mdl"): + case FNV1A::Hash32Const("models/weapons/c_models/c_breadmonster/c_breadmonster_milk.mdl"): + case FNV1A::Hash32Const("models/weapons/c_models/c_gascan/c_gascan.mdl"): + vAngularVelocity = { 300.f, 0.f, 0.f }; + break; } } @@ -479,21 +548,22 @@ bool CProjectileSimulation::Initialize(ProjectileInfo& tProjInfo, bool bSimulate float vMaxAngularVelocity = 1000000.f; //only pipes need k_flMaxVelocity and k_flMaxAngularVelocity - switch (tProjInfo.m_iType) + switch (tProjInfo.m_uType) { - case TF_PROJECTILE_NONE: + case FNV1A::Hash32Const("custom"): if (Vars::Visuals::Trajectory::MaxVelocity.Value) flMaxVelocity = Vars::Visuals::Trajectory::MaxVelocity.Value; if (Vars::Visuals::Trajectory::MaxAngularVelocity.Value) vMaxAngularVelocity = Vars::Visuals::Trajectory::MaxAngularVelocity.Value; break; - case TF_PROJECTILE_PIPEBOMB: - case TF_PROJECTILE_PIPEBOMB_REMOTE: - case TF_PROJECTILE_PIPEBOMB_PRACTICE: - case TF_PROJECTILE_CANNONBALL: - case TF_PROJECTILE_CLEAVER: - case TF_PROJECTILE_THROWABLE: - case TF_PROJECTILE_FESTIVE_ARROW: + case FNV1A::Hash32Const("models/weapons/w_models/w_grenade_grenadelauncher.mdl"): + case FNV1A::Hash32Const("models/workshop/weapons/c_models/c_quadball/w_quadball_grenade.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb2.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_cannonball.mdl"): + case FNV1A::Hash32Const("models/workshop_partner/weapons/c_models/c_sd_cleaver/c_sd_cleaver.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_baseball.mdl"): + case FNV1A::Hash32Const("models/weapons/c_models/c_xms_festive_ornament.mdl"): flMaxVelocity = k_flMaxVelocity; vMaxAngularVelocity = k_flMaxAngularVelocity; } diff --git a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h index 04ce63bc..7dad474e 100644 --- a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h +++ b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h @@ -12,7 +12,7 @@ Enum(ProjSim, struct ProjectileInfo { - ProjectileType_t m_iType{}; + uint32_t m_uType = 0; Vec3 m_vPos = {}; Vec3 m_vAng = {}; @@ -51,7 +51,7 @@ class CProjectileSimulation public: bool GetInfo(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, Vec3 vAngles, ProjectileInfo& tProjInfo, int iFlags = ProjSimEnum::Trace | ProjSimEnum::InitCheck, float flAutoCharge = -1.f); - bool Initialize(ProjectileInfo& tProjInfo, bool bSimulate = true); + bool Initialize(ProjectileInfo& tProjInfo, bool bSimulate = true, bool bVelocities = true); void RunTick(ProjectileInfo& tProjInfo, bool bPath = true); Vec3 GetOrigin(); Vec3 GetVelocity(); diff --git a/Amalgam/src/Features/Visuals/Chams/Chams.cpp b/Amalgam/src/Features/Visuals/Chams/Chams.cpp index 79622de1..05bff46b 100644 --- a/Amalgam/src/Features/Visuals/Chams/Chams.cpp +++ b/Amalgam/src/Features/Visuals/Chams/Chams.cpp @@ -307,7 +307,7 @@ void CChams::Store(CTFPlayer* pLocal) if (pWeapon && G::PrimaryWeaponType != EWeaponType::PROJECTILE) { bool bShowFriendly = false, bShowEnemy = true; - if (pWeapon->m_iItemDefinitionIndex() == Soldier_t_TheDisciplinaryAction) + if (G::PrimaryWeaponType == EWeaponType::MELEE && SDK::AttribHookValue(0, "speed_buff_ally", pWeapon) > 0) bShowFriendly = true; if (pWeapon->GetWeaponID() == TF_WEAPON_MEDIGUN) bShowFriendly = true, bShowEnemy = false; diff --git a/Amalgam/src/Features/Visuals/ESP/ESP.cpp b/Amalgam/src/Features/Visuals/ESP/ESP.cpp index 43eb9772..33fa3847 100644 --- a/Amalgam/src/Features/Visuals/ESP/ESP.cpp +++ b/Amalgam/src/Features/Visuals/ESP/ESP.cpp @@ -246,8 +246,8 @@ void CESP::StorePlayers(CTFPlayer* pLocal) if (pPlayer->IsCritBoosted()) pWeapon && pWeapon->GetWeaponID() == TF_WEAPON_PARTICLE_CANNON ? bMiniCrits = true : bCrits = true; if (pPlayer->IsMiniCritBoosted()) - pWeapon && pWeapon->m_iItemDefinitionIndex() == Sniper_t_TheBushwacka ? bCrits = true : bMiniCrits = true; - if (pWeapon && pWeapon->m_iItemDefinitionIndex() == Soldier_t_TheMarketGardener && pPlayer->InCond(TF_COND_BLASTJUMPING)) + pWeapon && SDK::AttribHookValue(0, "minicrits_become_crits", pWeapon) == 1 ? bCrits = true : bMiniCrits = true; + if (pWeapon && SDK::AttribHookValue(0, "crit_while_airborne", pWeapon) && pPlayer->InCond(TF_COND_BLASTJUMPING)) bCrits = true, bMiniCrits = false; if (bCrits) @@ -644,7 +644,7 @@ void CESP::StoreProjectiles(CTFPlayer* pLocal) //case ETFClassID::CTFProjectile_Throwable: //case ETFClassID::CTFProjectile_ThrowableBrick: //case ETFClassID::CTFProjectile_ThrowableRepel: szName = "Throwable"; break; - case ETFClassID::CTFProjectile_Arrow: szName = "Arrow"; 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: @@ -700,12 +700,18 @@ void CESP::StoreProjectiles(CTFPlayer* pLocal) case ETFClassID::CTFProjectile_ThrowableRepel: if (pEntity->As()->m_bCritical()) tCache.m_vText.emplace_back(ESPTextEnum::Right, "Crit", Vars::Colors::IndicatorTextBad.Value, Vars::Menu::Theme::Background.Value); + if (pEntity->As()->m_iDeflected() && (pEntity->GetClassID() != ETFClassID::CTFGrenadePipebombProjectile || !pEntity->GetAbsVelocity().IsZero())) + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Reflected", Vars::Colors::IndicatorTextBad.Value, Vars::Menu::Theme::Background.Value); break; case ETFClassID::CTFProjectile_Arrow: case ETFClassID::CTFProjectile_GrapplingHook: case ETFClassID::CTFProjectile_HealingBolt: if (pEntity->As()->m_bCritical()) tCache.m_vText.emplace_back(ESPTextEnum::Right, "Crit", Vars::Colors::IndicatorTextBad.Value, Vars::Menu::Theme::Background.Value); + if (pEntity->As()->m_iDeflected()) + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Reflected", Vars::Colors::IndicatorTextBad.Value, Vars::Menu::Theme::Background.Value); + if (pEntity->As()->m_bArrowAlight()) + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Alight", Vars::Colors::IndicatorTextBad.Value, Vars::Menu::Theme::Background.Value); break; case ETFClassID::CTFProjectile_Rocket: case ETFClassID::CTFProjectile_BallOfFire: @@ -716,14 +722,20 @@ void CESP::StoreProjectiles(CTFPlayer* pLocal) case ETFClassID::CTFProjectile_SpellKartOrb: if (pEntity->As()->m_bCritical()) tCache.m_vText.emplace_back(ESPTextEnum::Right, "Crit", Vars::Colors::IndicatorTextBad.Value, Vars::Menu::Theme::Background.Value); + if (pEntity->As()->m_iDeflected()) + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Reflected", Vars::Colors::IndicatorTextBad.Value, Vars::Menu::Theme::Background.Value); break; case ETFClassID::CTFProjectile_EnergyBall: if (pEntity->As()->m_bChargedShot()) tCache.m_vText.emplace_back(ESPTextEnum::Right, "Charge", Vars::Colors::IndicatorTextBad.Value, Vars::Menu::Theme::Background.Value); + if (pEntity->As()->m_iDeflected()) + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Reflected", Vars::Colors::IndicatorTextBad.Value, Vars::Menu::Theme::Background.Value); break; case ETFClassID::CTFProjectile_Flare: if (pEntity->As()->m_bCritical()) tCache.m_vText.emplace_back(ESPTextEnum::Right, "Crit", Vars::Colors::IndicatorTextBad.Value, Vars::Menu::Theme::Background.Value); + if (pEntity->As()->m_iDeflected()) + tCache.m_vText.emplace_back(ESPTextEnum::Right, "Reflected", Vars::Colors::IndicatorTextBad.Value, Vars::Menu::Theme::Background.Value); break; } } diff --git a/Amalgam/src/Features/Visuals/Glow/Glow.cpp b/Amalgam/src/Features/Visuals/Glow/Glow.cpp index 163dcac9..eaf889c7 100644 --- a/Amalgam/src/Features/Visuals/Glow/Glow.cpp +++ b/Amalgam/src/Features/Visuals/Glow/Glow.cpp @@ -344,7 +344,7 @@ void CGlow::Store(CTFPlayer* pLocal) if (pWeapon && G::PrimaryWeaponType != EWeaponType::PROJECTILE) { bool bShowFriendly = false, bShowEnemy = true; - if (pWeapon->m_iItemDefinitionIndex() == Soldier_t_TheDisciplinaryAction) + if (G::PrimaryWeaponType == EWeaponType::MELEE && SDK::AttribHookValue(0, "speed_buff_ally", pWeapon) > 0) bShowFriendly = true; if (pWeapon->GetWeaponID() == TF_WEAPON_MEDIGUN) bShowFriendly = true, bShowEnemy = false; diff --git a/Amalgam/src/Features/Visuals/Visuals.cpp b/Amalgam/src/Features/Visuals/Visuals.cpp index b1c2b70e..47168356 100644 --- a/Amalgam/src/Features/Visuals/Visuals.cpp +++ b/Amalgam/src/Features/Visuals/Visuals.cpp @@ -27,6 +27,10 @@ void CVisuals::DrawFOV(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)) return; + auto pWeapon = H::Entities.GetWeapon(); + if (pWeapon && SDK::AttribHookValue(1, "mult_dmg", pWeapon) == 0) + return; + if (Vars::Aimbot::General::AimFOV.Value >= 90.f) return; @@ -217,9 +221,12 @@ void CVisuals::ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const case TF_WEAPON_GRENADELAUNCHER: if (Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::Pipes) flRadius = 146.f; + break; + case TF_WEAPON_FLAREGUN: + case TF_WEAPON_FLAREGUN_REVENGE: + if (Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::ScorchShot && pWeapon->As()->GetFlareGunType() == FLAREGUN_SCORCHSHOT) + flRadius = 110.f; } - if (!flRadius && pWeapon->m_iItemDefinitionIndex() == Pyro_s_TheScorchShot && Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::ScorchShot) - flRadius = 110.f; if (flRadius) { @@ -343,7 +350,7 @@ void CVisuals::SplashRadius(CTFPlayer* pLocal) if (Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::ScorchShot) { pWeapon = pEntity->As()->m_hLauncher().Get()->As(); - bShouldDraw = pWeapon && pWeapon->m_iItemDefinitionIndex() == ETFWeapons::Pyro_s_TheScorchShot; + bShouldDraw = pWeapon && pWeapon->As()->GetFlareGunType() == FLAREGUN_SCORCHSHOT; } } if (!bShouldDraw) diff --git a/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp b/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp index c962f0dc..a38ee668 100644 --- a/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp +++ b/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp @@ -132,6 +132,7 @@ MAKE_HOOK(CClientModeShared_CreateMove, U::Memory.GetVFunc(I::ClientModeShared, break; case TF_WEAPON_MEDIGUN: case TF_WEAPON_BUILDER: + case TF_WEAPON_LASER_POINTER: break; case TF_WEAPON_PARTICLE_CANNON: { diff --git a/Amalgam/src/Hooks/CPhysicsObject_OutputDebugInfo.cpp b/Amalgam/src/Hooks/CPhysicsObject_OutputDebugInfo.cpp index befa2f77..0e34a5ea 100644 --- a/Amalgam/src/Hooks/CPhysicsObject_OutputDebugInfo.cpp +++ b/Amalgam/src/Hooks/CPhysicsObject_OutputDebugInfo.cpp @@ -16,6 +16,6 @@ MAKE_HOOK(CPhysicsObject_OutputDebugInfo, S::CPhysicsObject_OutputDebugInfo(), v SDK::Output("Ang Velocity", std::format("{}, {}, {} ({})", angSpeed.x, angSpeed.y, angSpeed.z, angSpeed.Length()).c_str()); */ - SDK::Output("Linear drag", std::format("{}, {}, {} ({})", *reinterpret_cast(uintptr_t(rcx) + 10i64 * 4), *reinterpret_cast(uintptr_t(rcx) + 11i64 * 4), *reinterpret_cast(uintptr_t(rcx) + 12i64 * 4), *reinterpret_cast(uintptr_t(rcx) + 22i64 * 4)).c_str()); - SDK::Output("Angular drag", std::format("{}, {}, {} ({})", *reinterpret_cast(uintptr_t(rcx) + 13i64 * 4), *reinterpret_cast(uintptr_t(rcx) + 14i64 * 4), *reinterpret_cast(uintptr_t(rcx) + 15i64 * 4), *reinterpret_cast(uintptr_t(rcx) + 23i64 * 4)).c_str()); + SDK::Output("Linear drag", std::format("{:.6f}, {:.6f}, {:.6f} ({})", *reinterpret_cast(uintptr_t(rcx) + 10i64 * 4), *reinterpret_cast(uintptr_t(rcx) + 11i64 * 4), *reinterpret_cast(uintptr_t(rcx) + 12i64 * 4), *reinterpret_cast(uintptr_t(rcx) + 22i64 * 4)).c_str()); + SDK::Output("Angular drag", std::format("{:.6f}, {:.6f}, {:.6f} ({})", *reinterpret_cast(uintptr_t(rcx) + 13i64 * 4), *reinterpret_cast(uintptr_t(rcx) + 14i64 * 4), *reinterpret_cast(uintptr_t(rcx) + 15i64 * 4), *reinterpret_cast(uintptr_t(rcx) + 23i64 * 4)).c_str()); } \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Definitions.h b/Amalgam/src/SDK/Definitions/Definitions.h index 899ed6b3..d5f902ca 100644 --- a/Amalgam/src/SDK/Definitions/Definitions.h +++ b/Amalgam/src/SDK/Definitions/Definitions.h @@ -731,6 +731,21 @@ enum medigun_resist_types_t MEDIGUN_NUM_RESISTS }; +enum DetonateTypes_t +{ + TF_DETONATE_MODE_STANDARD = 0, + TF_DETONATE_MODE_DOT, + TF_DETONATE_MODE_AIR, +}; + +enum FlareGunTypes_t +{ + FLAREGUN_NORMAL = 0, + FLAREGUN_DETONATE, + FLAREGUN_GRORDBORT, + FLAREGUN_SCORCHSHOT +}; + enum PrecipitationType_t { PRECIPITATION_TYPE_RAIN = 0, diff --git a/Amalgam/src/SDK/Definitions/Main/CTFWeaponBase.h b/Amalgam/src/SDK/Definitions/Main/CTFWeaponBase.h index 87cdca7a..a3eb4dff 100644 --- a/Amalgam/src/SDK/Definitions/Main/CTFWeaponBase.h +++ b/Amalgam/src/SDK/Definitions/Main/CTFWeaponBase.h @@ -253,25 +253,6 @@ public: return m_flNextSecondaryAttack() <= flCurTime && pOwner->m_flNextAttack() <= flCurTime; } - inline bool HasPrimaryAmmoForShot() - { - if (IsEnergyWeapon()) - return m_flEnergy() > 0.f; - - int nClip1 = m_iClip1(); - - if (nClip1 == -1) - { - if (auto pOwner = m_hOwnerEntity().Get()) - { - int nAmmoCount = pOwner->As()->GetAmmoCount(m_iPrimaryAmmoType()); - return nAmmoCount > (m_iItemDefinitionIndex() == Engi_m_TheWidowmaker ? 29 : 0); - } - } - - return nClip1 > 0; - } - inline bool IsInReload() { return m_bInReload() || m_iReloadMode() != 0; @@ -310,6 +291,18 @@ public: 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()) @@ -342,6 +335,16 @@ public: 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, 400))(this, pPlayer, vecOffset, vecSrc, angForward, bHitTeammates, flEndDist); @@ -449,6 +452,11 @@ public: NETVAR(m_flChargeBeginTime, float, "CTFPipebombLauncher", "m_flChargeBeginTime"); NETVAR_OFF(m_Pipebombs, CUtlVector>, "CTFPipebombLauncher", "m_flChargeBeginTime", -28); + + inline int GetDetonateType() + { + return SDK::AttribHookValue(0, "set_detonate_mode", this); + } }; class CTFSniperRifle : public CTFWeaponBase @@ -519,6 +527,11 @@ public: NETVAR(m_flDetonateTime, float, "CTFGrenadeLauncher", "m_flDetonateTime"); 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); + } }; class CTFSniperRifleClassic : public CTFSniperRifle @@ -532,4 +545,13 @@ class CTFParticleCannon : public CTFWeaponBase public: NETVAR(m_flChargeBeginTime, float, "CTFParticleCannon", "m_flChargeBeginTime"); NETVAR(m_iChargeEffect, int, "CTFParticleCannon", "m_iChargeEffect"); +}; + +class CTFFlareGun : public CTFWeaponBase +{ +public: + inline int GetFlareGunType() + { + return SDK::AttribHookValue(0, "set_weapon_mode", this); + } }; \ No newline at end of file diff --git a/Amalgam/src/SDK/Helpers/Entities/Entities.cpp b/Amalgam/src/SDK/Helpers/Entities/Entities.cpp index f2fac799..064dac2e 100644 --- a/Amalgam/src/SDK/Helpers/Entities/Entities.cpp +++ b/Amalgam/src/SDK/Helpers/Entities/Entities.cpp @@ -14,7 +14,7 @@ void CEntities::Store() m_pLocal = pLocal->As(); m_pLocalWeapon = m_pLocal->m_hActiveWeapon().Get()->As(); - + for (int n = I::EngineClient->GetMaxClients() + 1; n <= I::ClientEntityList->GetHighestEntityIndex(); n++) { auto pEntity = I::ClientEntityList->GetClientEntity(n)->As(); @@ -92,6 +92,10 @@ void CEntities::Store() case ETFClassID::CTFProjectile_EnergyRing: //case ETFClassID::CTFProjectile_Syringe: { + if ((nClassID == ETFClassID::CTFProjectile_Cleaver || nClassID == ETFClassID::CTFStunBall) && pEntity->As()->m_bTouched() + || (nClassID == ETFClassID::CTFProjectile_Arrow || nClassID == ETFClassID::CTFProjectile_GrapplingHook) && pEntity->GetAbsVelocity().IsZero()) + break; + m_mGroups[EGroupType::WORLD_PROJECTILES].push_back(pEntity); if (nClassID == ETFClassID::CTFGrenadePipebombProjectile) @@ -104,7 +108,7 @@ void CEntities::Store() if (nClassID == ETFClassID::CTFProjectile_Flare) { auto pLauncher = pEntity->As()->m_hLauncher().Get()->As(); - if (pEntity->m_hOwnerEntity().Get() == m_pLocal && pLauncher && pLauncher->m_iItemDefinitionIndex() == ETFWeapons::Pyro_s_TheDetonator) + if (pEntity->m_hOwnerEntity().Get() == m_pLocal && pLauncher && pLauncher->As()->GetFlareGunType() == FLAREGUN_DETONATE) m_mGroups[EGroupType::MISC_LOCAL_FLARES].push_back(pEntity); } diff --git a/Amalgam/src/SDK/SDK.cpp b/Amalgam/src/SDK/SDK.cpp index 8146dc0a..80e00ec2 100644 --- a/Amalgam/src/SDK/SDK.cpp +++ b/Amalgam/src/SDK/SDK.cpp @@ -418,7 +418,6 @@ EWeaponType SDK::GetWeaponType(CTFWeaponBase* pWeapon, EWeaponType* pSecondaryTy case TF_WEAPON_INVIS: case TF_WEAPON_BUFF_ITEM: case TF_WEAPON_GRAPPLINGHOOK: - case TF_WEAPON_LASER_POINTER: case TF_WEAPON_ROCKETPACK: return EWeaponType::UNKNOWN; case TF_WEAPON_CLEAVER: @@ -479,7 +478,7 @@ int SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* switch (pWeapon->GetWeaponID()) { case TF_WEAPON_KNIFE: - return pCmd->buttons & IN_ATTACK && G::CanPrimaryAttack; + return G::CanPrimaryAttack && pCmd->buttons & IN_ATTACK; case TF_WEAPON_BAT_WOOD: case TF_WEAPON_BAT_GIFTWRAP: {