diff --git a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp index 995ff881..ec4d03bb 100644 --- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp @@ -260,15 +260,26 @@ int CAimbotHitscan::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* p } if (!pRecords || vRecords.empty()) { - auto aBones = H::Entities.GetBones(target.m_pEntity->entindex()); - if (!aBones) - return false; + if (auto pBones = H::Entities.GetBones(target.m_pEntity->entindex())) + { + vRecords.push_front({ + target.m_pEntity->m_flSimulationTime(), + *reinterpret_cast(pBones), + target.m_pEntity->m_vecOrigin() + }); + } + else + { + matrix3x4 aBones[MAXSTUDIOBONES]; + if (!target.m_pEntity->SetupBones(aBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, target.m_pEntity->m_flSimulationTime())) + return false; - vRecords.push_front({ - target.m_pEntity->m_flSimulationTime(), - *reinterpret_cast(aBones), - target.m_pEntity->m_vecOrigin() - }); + vRecords.push_front({ + target.m_pEntity->m_flSimulationTime(), + *reinterpret_cast(&aBones), + target.m_pEntity->m_vecOrigin() + }); + } } } diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp index e3eb38d3..f19895f0 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp @@ -297,15 +297,26 @@ int CAimbotMelee::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase* pWe } if (!pRecords || vRecords.empty()) { - auto aBones = H::Entities.GetBones(target.m_pEntity->entindex()); - if (!aBones) - return false; + if (auto pBones = H::Entities.GetBones(target.m_pEntity->entindex())) + { + vRecords.push_front({ + target.m_pEntity->m_flSimulationTime(), + *reinterpret_cast(pBones), + target.m_pEntity->m_vecOrigin() + }); + } + else + { + matrix3x4 aBones[MAXSTUDIOBONES]; + if (!target.m_pEntity->SetupBones(aBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, target.m_pEntity->m_flSimulationTime())) + return false; - vRecords.push_front({ - target.m_pEntity->m_flSimulationTime(), - *reinterpret_cast(aBones), - target.m_pEntity->m_vecOrigin() - }); + vRecords.push_front({ + target.m_pEntity->m_flSimulationTime(), + *reinterpret_cast(&aBones), + target.m_pEntity->m_vecOrigin() + }); + } } } if (!newRecords.empty()) diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp index 24083b10..77d28488 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp @@ -872,8 +872,8 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar auto pSet = pHDR->pHitboxSet(target.m_pEntity->As()->m_nHitboxSet()); if (!pSet) break; - auto aBones = H::Entities.GetBones(target.m_pEntity->entindex()); - if (!aBones) + auto pBones = H::Entities.GetBones(target.m_pEntity->entindex()); + if (!pBones) break; Vec3 vForward = vOld - vNew; vForward.Normalize(); @@ -889,7 +889,7 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar if (!pBox) continue; - Vec3 vCenter; Math::VectorTransform((pBox->bbmin + pBox->bbmax) / 2, aBones[pBox->bone], vCenter); + Vec3 vCenter; Math::VectorTransform((pBox->bbmin + pBox->bbmax) / 2, pBones[pBox->bone], vCenter); const float flDist = vPos.DistTo(vCenter); if (closestId != -1 && flDist < closestDist || closestId == -1) @@ -1118,11 +1118,11 @@ int CAimbotProjectile::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase { const Vec3 vOriginOffset = target.m_pEntity->m_vecOrigin() - vPredicted; - auto aBones = H::Entities.GetBones(target.m_pEntity->entindex()); - if (!aBones) + auto pBones = H::Entities.GetBones(target.m_pEntity->entindex()); + if (!pBones) return true; - auto vBoxes = F::Visuals.GetHitboxes(aBones, target.m_pEntity->As(), { HITBOX_HEAD }); + auto vBoxes = F::Visuals.GetHitboxes(pBones, target.m_pEntity->As(), { HITBOX_HEAD }); for (auto& bBox : vBoxes) { bBox.m_vecPos -= vOriginOffset; @@ -1134,11 +1134,11 @@ int CAimbotProjectile::CanHit(Target_t& target, CTFPlayer* pLocal, CTFWeaponBase { const Vec3 vOriginOffset = target.m_pEntity->m_vecOrigin() - vPredicted; - auto aBones = H::Entities.GetBones(target.m_pEntity->entindex()); - if (!aBones) + auto pBones = H::Entities.GetBones(target.m_pEntity->entindex()); + if (!pBones) return true; - auto vBoxes = F::Visuals.GetHitboxes(aBones, target.m_pEntity->As(), { HITBOX_HEAD }); + auto vBoxes = F::Visuals.GetHitboxes(pBones, target.m_pEntity->As(), { HITBOX_HEAD }); for (auto& bBox : vBoxes) { bBox.m_vecPos -= vOriginOffset; diff --git a/Amalgam/src/Features/Visuals/Visuals.cpp b/Amalgam/src/Features/Visuals/Visuals.cpp index 0685322f..4e37e6f6 100644 --- a/Amalgam/src/Features/Visuals/Visuals.cpp +++ b/Amalgam/src/Features/Visuals/Visuals.cpp @@ -842,11 +842,11 @@ void CVisuals::Event(IGameEvent* pEvent, uint32_t uHash) case EWeaponType::HITSCAN: case EWeaponType::MELEE: { - matrix3x4* aBones = H::Entities.GetBones(pEntity->entindex()); - if (!aBones) + auto pBones = H::Entities.GetBones(pEntity->entindex()); + if (!pBones) return; - auto vBoxes = F::Visuals.GetHitboxes(aBones, pEntity); + auto vBoxes = F::Visuals.GetHitboxes(pBones, pEntity); G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end()); return;