diff --git a/Amalgam/Amalgam.vcxproj b/Amalgam/Amalgam.vcxproj index ddbd6b2a..7106a7cd 100644 --- a/Amalgam/Amalgam.vcxproj +++ b/Amalgam/Amalgam.vcxproj @@ -1050,7 +1050,6 @@ - diff --git a/Amalgam/Amalgam.vcxproj.filters b/Amalgam/Amalgam.vcxproj.filters index f9a0d613..22357280 100644 --- a/Amalgam/Amalgam.vcxproj.filters +++ b/Amalgam/Amalgam.vcxproj.filters @@ -180,7 +180,6 @@ - diff --git a/Amalgam/src/BytePatches/BytePatches.cpp b/Amalgam/src/BytePatches/BytePatches.cpp index 069823a5..69e712e5 100644 --- a/Amalgam/src/BytePatches/BytePatches.cpp +++ b/Amalgam/src/BytePatches/BytePatches.cpp @@ -14,11 +14,11 @@ BytePatch::BytePatch(const char* sModule, const char* sSignature, int iOffset, c m_vOriginal.resize(m_iSize); } -void BytePatch::Write(std::vector& bytes) +void BytePatch::Write(std::vector& vBytes) { DWORD flNewProtect, flOldProtect; VirtualProtect(m_pAddress, m_iSize, PAGE_EXECUTE_READWRITE, &flNewProtect); - memcpy(m_pAddress, bytes.data(), m_iSize); + memcpy(m_pAddress, vBytes.data(), m_iSize); VirtualProtect(m_pAddress, m_iSize, flNewProtect, &flOldProtect); } diff --git a/Amalgam/src/BytePatches/BytePatches.h b/Amalgam/src/BytePatches/BytePatches.h index 360316cc..f735f71c 100644 --- a/Amalgam/src/BytePatches/BytePatches.h +++ b/Amalgam/src/BytePatches/BytePatches.h @@ -12,7 +12,7 @@ class BytePatch LPVOID m_pAddress = 0; bool m_bIsPatched = false; - void Write(std::vector& bytes); + void Write(std::vector& vBytes); public: BytePatch(const char* sModule, const char* sSignature, int iOffset, const char* sPatch); diff --git a/Amalgam/src/Features/Aimbot/Aimbot.cpp b/Amalgam/src/Features/Aimbot/Aimbot.cpp index 8bea919f..4c2d0def 100644 --- a/Amalgam/src/Features/Aimbot/Aimbot.cpp +++ b/Amalgam/src/Features/Aimbot/Aimbot.cpp @@ -91,4 +91,45 @@ void CAimbot::Draw(CTFPlayer* pLocal) float flW = H::Draw.m_nScreenW, flH = H::Draw.m_nScreenH; float flRadius = tanf(DEG2RAD(Vars::Aimbot::General::AimFOV.Value)) / tanf(DEG2RAD(pLocal->m_iFOV()) / 2) * flW * (4.f / 6.f) / (16.f / 9.f); H::Draw.LineCircle(H::Draw.m_nScreenW / 2, H::Draw.m_nScreenH / 2, flRadius, 68, Vars::Colors::FOVCircle.Value); +} + +void CAimbot::Store(CBaseEntity* pEntity, size_t iSize) +{ + if (!Vars::Visuals::Simulation::RealPath.Value) + return; + + if (pEntity) + { + auto pResource = H::Entities.GetPR(); + if (pEntity->IsPlayer() && pResource) + { + m_tPath = { { pEntity->m_vecOrigin() }, I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::RealPath.Value, Vars::Visuals::Simulation::RealPath.Value }; + m_iSize = iSize; + m_iPlayer = pResource->m_iUserID(pEntity->entindex()); + } + return; + } + + int iLag; + { + static int iStaticTickcout = I::GlobalVars->tickcount; + iLag = I::GlobalVars->tickcount - iStaticTickcout; + iStaticTickcout = I::GlobalVars->tickcount; + } + + if (!m_tPath.m_flTime) + return; + else if (m_tPath.m_vPath.size() >= m_iSize || m_tPath.m_flTime < I::GlobalVars->curtime) + { + G::PathStorage.push_back(m_tPath); + m_tPath = {}; + return; + } + + auto pPlayer = I::ClientEntityList->GetClientEntity(I::EngineClient->GetPlayerForUserID(m_iPlayer))->As(); + if (!pPlayer) + return; + + for (int i = 0; i < iLag; i++) + m_tPath.m_vPath.push_back(pPlayer->m_vecOrigin()); } \ No newline at end of file diff --git a/Amalgam/src/Features/Aimbot/Aimbot.h b/Amalgam/src/Features/Aimbot/Aimbot.h index 0148f92e..47cf6f0d 100644 --- a/Amalgam/src/Features/Aimbot/Aimbot.h +++ b/Amalgam/src/Features/Aimbot/Aimbot.h @@ -8,12 +8,18 @@ private: void RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); void RunAimbot(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, bool bSecondaryType = false); + size_t m_iSize = 0; + int m_iPlayer = 0; + public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); void Draw(CTFPlayer* pLocal); + void Store(CBaseEntity* pEntity = nullptr, size_t iSize = 0); bool m_bRan = false; bool m_bRunningSecondary = false; + + DrawPath_t m_tPath = {}; }; 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 f0e01bcc..09d96a43 100644 --- a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp @@ -324,7 +324,7 @@ bool CAimbotGlobal::ValidBomb(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CBaseEn if (isPlayer && ShouldIgnore(pEntity->As(), pLocal, pWeapon)) continue; - if (!SDK::VisPosProjectile(pBomb, pEntity, vOrigin, isPlayer ? pEntity->m_vecOrigin() + pEntity->As()->GetViewOffset() : pEntity->GetCenter(), MASK_SHOT)) + if (!SDK::VisPosCollideable(pBomb, pEntity, vOrigin, isPlayer ? pEntity->m_vecOrigin() + pEntity->As()->GetViewOffset() : pEntity->GetCenter(), MASK_SHOT)) continue; return true; diff --git a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp index 3936260c..6f2bae73 100644 --- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp @@ -299,7 +299,7 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* float flSpread = pWeapon->GetWeaponSpread(); if (flSpread && Vars::Aimbot::General::HitscanPeek.Value) - vPeekPos = pLocal->GetShootPos() + pLocal->m_vecVelocity() * TICKS_TO_TIME(-Vars::Aimbot::General::HitscanPeek.Value); + vPeekPos = vEyePos + pLocal->m_vecVelocity() * TICKS_TO_TIME(-Vars::Aimbot::General::HitscanPeek.Value); // if we're doubletapping, we can't change viewangles so work around that static int iTargetBone = 0; @@ -694,6 +694,38 @@ void CAimbotHitscan::Aim(CUserCmd* pCmd, Vec3& vAngle) } } +static inline void DrawVisuals(CTFPlayer* pLocal, Target_t& tTarget, int nWeaponID) +{ + if (G::Attacking == 1 && nWeaponID != TF_WEAPON_LASER_POINTER) + { + bool bLine = Vars::Visuals::Line::Enabled.Value; + bool bBoxes = Vars::Visuals::Hitbox::BonesEnabled.Value & Vars::Visuals::Hitbox::BonesEnabledEnum::OnShot; + if (G::CanPrimaryAttack && (bLine || bBoxes)) + { + G::LineStorage.clear(); + G::BoxStorage.clear(); + G::PathStorage.clear(); + + if (bLine) + { + Vec3 vEyePos = pLocal->GetShootPos(); + float flDist = vEyePos.DistTo(tTarget.m_vPos); + Vec3 vForward; Math::AngleVectors(tTarget.m_vAngleTo + pLocal->m_vecPunchAngle(), &vForward); + + if (Vars::Colors::Line.Value.a) + G::LineStorage.emplace_back(std::pair(vEyePos, vEyePos + vForward * flDist), I::GlobalVars->curtime + Vars::Visuals::Line::DrawDuration.Value, Vars::Colors::Line.Value); + if (Vars::Colors::LineClipped.Value.a) + G::LineStorage.emplace_back(std::pair(vEyePos, vEyePos + vForward * flDist), I::GlobalVars->curtime + Vars::Visuals::Line::DrawDuration.Value, Vars::Colors::LineClipped.Value, true); + } + if (bBoxes) + { + auto vBoxes = F::Visuals.GetHitboxes(tTarget.m_pRecord->m_BoneMatrix.m_aBones, tTarget.m_pEntity->As(), {}, tTarget.m_nAimedHitbox); + G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end()); + } + } + } +} + void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) { const int nWeaponID = pWeapon->GetWeaponID(); @@ -735,20 +767,16 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC case TF_WEAPON_SNIPERRIFLE: case TF_WEAPON_SNIPERRIFLE_DECAP: { - const bool bScoped = pLocal->InCond(TF_COND_ZOOMED); - + bool bScoped = pLocal->InCond(TF_COND_ZOOMED); if (Vars::Aimbot::Hitscan::Modifiers.Value & Vars::Aimbot::Hitscan::ModifiersEnum::AutoScope && !bScoped) { pCmd->buttons |= IN_ATTACK2; return; } - - if (Vars::Aimbot::Hitscan::Modifiers.Value & Vars::Aimbot::Hitscan::ModifiersEnum::ScopedOnly && !bScoped) + else if (Vars::Aimbot::Hitscan::Modifiers.Value & Vars::Aimbot::Hitscan::ModifiersEnum::ScopedOnly && !bScoped) return; - - if (!bScoped && SDK::AttribHookValue(0, "sniper_only_fire_zoomed", pWeapon)) + else if (!bScoped && SDK::AttribHookValue(0, "sniper_only_fire_zoomed", pWeapon)) return; - break; } case TF_WEAPON_SNIPERRIFLE_CLASSIC: @@ -780,9 +808,7 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC G::AimTarget = { tTarget.m_pEntity->entindex(), I::GlobalVars->tickcount }; G::AimPoint = { tTarget.m_vPos, I::GlobalVars->tickcount }; - bool bShouldFire = ShouldFire(pLocal, pWeapon, pCmd, tTarget); - - if (bShouldFire) + if (ShouldFire(pLocal, pWeapon, pCmd, tTarget)) { switch (nWeaponID) { @@ -811,7 +837,6 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC } G::Attacking = SDK::IsAttacking(pLocal, pWeapon, pCmd, true); - if (G::Attacking == 1 && nWeaponID != TF_WEAPON_LASER_POINTER) { if (tTarget.m_pEntity->IsPlayer()) @@ -819,33 +844,8 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC if (tTarget.m_bBacktrack) pCmd->tick_count = TIME_TO_TICKS(tTarget.m_pRecord->m_flSimTime) + TIME_TO_TICKS(F::Backtrack.GetFakeInterp()); - - bool bLine = Vars::Visuals::Line::Enabled.Value; - bool bBoxes = Vars::Visuals::Hitbox::BonesEnabled.Value & Vars::Visuals::Hitbox::BonesEnabledEnum::OnShot; - if (G::CanPrimaryAttack && (bLine || bBoxes)) - { - G::LineStorage.clear(); - G::BoxStorage.clear(); - G::PathStorage.clear(); - - if (bLine) - { - Vec3 vEyePos = pLocal->GetShootPos(); - float flDist = vEyePos.DistTo(tTarget.m_vPos); - Vec3 vForward; Math::AngleVectors(tTarget.m_vAngleTo + pLocal->m_vecPunchAngle(), &vForward); - - if (Vars::Colors::Line.Value.a) - G::LineStorage.emplace_back(std::pair(vEyePos, vEyePos + vForward * flDist), I::GlobalVars->curtime + Vars::Visuals::Line::DrawDuration.Value, Vars::Colors::Line.Value); - if (Vars::Colors::LineClipped.Value.a) - G::LineStorage.emplace_back(std::pair(vEyePos, vEyePos + vForward * flDist), I::GlobalVars->curtime + Vars::Visuals::Line::DrawDuration.Value, Vars::Colors::LineClipped.Value, true); - } - if (bBoxes) - { - auto vBoxes = F::Visuals.GetHitboxes(tTarget.m_pRecord->m_BoneMatrix.m_aBones, tTarget.m_pEntity->As(), {}, tTarget.m_nAimedHitbox); - G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end()); - } - } } + DrawVisuals(pLocal, tTarget, nWeaponID); Aim(pCmd, tTarget.m_vAngleTo); if (G::SilentAngles) diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp index 1bc34360..bc7039b6 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp @@ -109,22 +109,20 @@ int CAimbotMelee::GetSwingTime(CTFWeaponBase* pWeapon) return Vars::Aimbot::Melee::SwingTicks.Value; } -void CAimbotMelee::SimulatePlayers(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, std::vector vTargets, - Vec3& vEyePos, std::unordered_map>& mRecordMap, - std::unordered_map>& mPaths) +void CAimbotMelee::SimulatePlayers(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, std::vector vTargets, Vec3& vEyePos) { // swing prediction / auto warp const int iSwingTicks = GetSwingTime(pWeapon); - int iMax = (iDoubletapTicks && Vars::Doubletap::AntiWarp.Value && pLocal->m_hGroundEntity()) + int iMax = (m_iDoubletapTicks && Vars::Doubletap::AntiWarp.Value && pLocal->m_hGroundEntity()) ? std::max(iSwingTicks - Vars::Doubletap::TickLimit.Value - 1, 0) - : std::max(iSwingTicks, iDoubletapTicks); + : std::max(iSwingTicks, m_iDoubletapTicks); - if ((Vars::Aimbot::Melee::SwingPrediction.Value || iDoubletapTicks) && pWeapon->m_flSmackTime() < 0.f && iMax) + if ((Vars::Aimbot::Melee::SwingPrediction.Value || m_iDoubletapTicks) && pWeapon->m_flSmackTime() < 0.f && iMax) { PlayerStorage tStorage; std::unordered_map mStorage; - F::MoveSim.Initialize(pLocal, tStorage, false, !iDoubletapTicks); + F::MoveSim.Initialize(pLocal, tStorage, false, !m_iDoubletapTicks); for (auto& tTarget : vTargets) F::MoveSim.Initialize(tTarget.m_pEntity, mStorage[tTarget.m_pEntity->entindex()], false); @@ -136,7 +134,7 @@ void CAimbotMelee::SimulatePlayers(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, st tStorage.m_MoveData.m_flMaxSpeed = tStorage.m_MoveData.m_flClientMaxSpeed = SDK::MaxSpeed(pLocal, false, true); F::MoveSim.RunTick(tStorage); } - if (i < iSwingTicks - iDoubletapTicks) + if (i < iSwingTicks - m_iDoubletapTicks) { for (auto& tTarget : vTargets) { @@ -144,7 +142,7 @@ void CAimbotMelee::SimulatePlayers(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, st F::MoveSim.RunTick(tStorage); if (!tStorage.m_bFailed) - mRecordMap[tTarget.m_pEntity->entindex()].emplace_front( + m_mRecordMap[tTarget.m_pEntity->entindex()].emplace_front( !Vars::Aimbot::Melee::SwingPredictLag.Value || tStorage.m_bPredictNetworked ? tTarget.m_pEntity->m_flSimulationTime() + TICKS_TO_TIME(i + 1) : 0.f, Vars::Aimbot::Melee::SwingPredictLag.Value ? tStorage.m_vPredictedOrigin : tStorage.m_MoveData.m_vecAbsOrigin, tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs() @@ -159,9 +157,9 @@ void CAimbotMelee::SimulatePlayers(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, st const bool bAlwaysDraw = !Vars::Aimbot::General::AutoShoot.Value || Vars::Debug::Info.Value; if (!bAlwaysDraw) { - mPaths[pLocal->entindex()] = tStorage.m_vPath; + m_mPaths[pLocal->entindex()] = tStorage.m_vPath; for (auto& tTarget : vTargets) - mPaths[tTarget.m_pEntity->entindex()] = mStorage[tTarget.m_pEntity->entindex()].m_vPath; + m_mPaths[tTarget.m_pEntity->entindex()] = mStorage[tTarget.m_pEntity->entindex()].m_vPath; } else { @@ -253,7 +251,7 @@ bool CAimbotMelee::CanBackstab(CBaseEntity* pTarget, CTFPlayer* pLocal, Vec3 vEy return true; } -int CAimbotMelee::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Vec3 vEyePos, std::deque& vSimRecords) +int CAimbotMelee::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Vec3 vEyePos) { if (Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Unsimulated && H::Entities.GetChoke(tTarget.m_pEntity->entindex()) > Vars::Aimbot::General::TickTolerance.Value) return false; @@ -267,6 +265,7 @@ int CAimbotMelee::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pW } Vec3 vSwingMins = { -flHull, -flHull, -flHull }; Vec3 vSwingMaxs = { flHull, flHull, flHull }; + auto& vSimRecords = m_mRecordMap[tTarget.m_pEntity->entindex()]; std::vector vRecords = {}; if (F::Backtrack.GetRecords(tTarget.m_pEntity, vRecords)) @@ -420,6 +419,57 @@ void CAimbotMelee::Aim(CUserCmd* pCmd, Vec3& vAngle) } } +static inline void DrawVisuals(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, Target_t& tTarget, std::unordered_map>& mPaths) +{ + bool bPath = Vars::Visuals::Simulation::SwingLines.Value && Vars::Visuals::Simulation::PlayerPath.Value && Vars::Aimbot::General::AutoShoot.Value && !Vars::Debug::Info.Value; + bool bLine = Vars::Visuals::Line::Enabled.Value; + bool bBoxes = Vars::Visuals::Hitbox::BonesEnabled.Value & Vars::Visuals::Hitbox::BonesEnabledEnum::OnShot; + if (pCmd->buttons & IN_ATTACK && pWeapon->m_flSmackTime() < 0.f) + { + G::LineStorage.clear(); + G::BoxStorage.clear(); + G::PathStorage.clear(); + + if (bPath) + { + if (Vars::Colors::PlayerPath.Value.a) + { + G::PathStorage.emplace_back(mPaths[pLocal->entindex()], I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPath.Value, Vars::Visuals::Simulation::PlayerPath.Value); + G::PathStorage.emplace_back(mPaths[tTarget.m_pEntity->entindex()], I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPath.Value, Vars::Visuals::Simulation::PlayerPath.Value); + } + if (Vars::Colors::PlayerPathClipped.Value.a) + { + G::PathStorage.emplace_back(mPaths[pLocal->entindex()], I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPathClipped.Value, Vars::Visuals::Simulation::PlayerPath.Value, true); + G::PathStorage.emplace_back(mPaths[tTarget.m_pEntity->entindex()], I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPathClipped.Value, Vars::Visuals::Simulation::PlayerPath.Value, true); + } + } + } + else if (G::Attacking == 1) + { + if (bLine) + { + Vec3 vEyePos = pLocal->GetShootPos(); + float flDist = vEyePos.DistTo(tTarget.m_vPos); + Vec3 vForward; Math::AngleVectors(tTarget.m_vAngleTo + pLocal->m_vecPunchAngle(), &vForward); + + if (Vars::Colors::Line.Value.a) + G::LineStorage.emplace_back(std::pair(vEyePos, vEyePos + vForward * flDist), I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::Line.Value); + if (Vars::Colors::LineClipped.Value.a) + G::LineStorage.emplace_back(std::pair(vEyePos, vEyePos + vForward * flDist), I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::LineClipped.Value, true); + } + if (bBoxes) + { + auto vBoxes = F::Visuals.GetHitboxes(tTarget.m_pRecord->m_BoneMatrix.m_aBones, tTarget.m_pEntity->As()); + G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end()); + + //if (Vars::Colors::BoneHitboxEdge.Value.a || Vars::Colors::BoneHitboxFace.Value.a) + // G::BoxStorage.emplace_back(tTarget.m_pRecord->m_vOrigin, tTarget.m_pRecord->m_vMins, tTarget.m_pRecord->m_vMaxs, Vec3(), I::GlobalVars->curtime + Vars::Visuals::Hitbox::DrawDuration.Value, Vars::Colors::BoneHitboxEdge.Value, Vars::Colors::BoneHitboxFace.Value); + //if (Vars::Colors::BoneHitboxEdgeClipped.Value.a || Vars::Colors::BoneHitboxFaceClipped.Value.a) + // G::BoxStorage.emplace_back(tTarget.m_pRecord->m_vOrigin, tTarget.m_pRecord->m_vMins, tTarget.m_pRecord->m_vMaxs, Vec3(), I::GlobalVars->curtime + Vars::Visuals::Hitbox::DrawDuration.Value, Vars::Colors::BoneHitboxEdgeClipped.Value, Vars::Colors::BoneHitboxFaceClipped.Value, true); + } + } +} + void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) { static int iStaticAimType = Vars::Aimbot::General::AimType.Value; @@ -443,20 +493,19 @@ void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd if (vTargets.empty()) return; - iDoubletapTicks = F::Ticks.GetTicks(pWeapon); - const bool bShouldSwing = iDoubletapTicks <= (GetSwingTime(pWeapon) ? 14 : 0) || Vars::Doubletap::AntiWarp.Value && pLocal->m_hGroundEntity(); - + m_mRecordMap.clear(); m_mPaths.clear(); + m_iDoubletapTicks = F::Ticks.GetTicks(pWeapon); + const bool bShouldSwing = m_iDoubletapTicks <= (GetSwingTime(pWeapon) ? 14 : 0) || Vars::Doubletap::AntiWarp.Value && pLocal->m_hGroundEntity(); Vec3 vEyePos = pLocal->GetShootPos(); - std::unordered_map> mRecordMap; - std::unordered_map> mPaths; - SimulatePlayers(pLocal, pWeapon, vTargets, vEyePos, mRecordMap, mPaths); + + SimulatePlayers(pLocal, pWeapon, vTargets, vEyePos); //if (!G::AimTarget.m_iEntIndex) // G::AimTarget = { vTargets.front().m_pEntity->entindex(), I::GlobalVars->tickcount, 0 }; for (auto& tTarget : vTargets) { - const auto iResult = CanHit(tTarget, pLocal, pWeapon, vEyePos, mRecordMap[tTarget.m_pEntity->entindex()]); + const auto iResult = CanHit(tTarget, pLocal, pWeapon, vEyePos); if (!iResult) continue; if (iResult == 2) { @@ -472,12 +521,11 @@ void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd { if (bShouldSwing) pCmd->buttons |= IN_ATTACK; - if (iDoubletapTicks) + if (m_iDoubletapTicks) F::Ticks.m_bDoubletap = true; } G::Attacking = SDK::IsAttacking(pLocal, pWeapon, pCmd, true); - if (G::Attacking == 1) { if (tTarget.m_bBacktrack) @@ -486,60 +534,10 @@ void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd } else { - Vec3 vEyePos = pLocal->GetShootPos(); + vEyePos = pLocal->GetShootPos(); Aim(G::CurrentUserCmd->viewangles, Math::CalcAngle(vEyePos, tTarget.m_vPos), tTarget.m_vAngleTo); } - - bool bPath = Vars::Visuals::Simulation::SwingLines.Value && Vars::Visuals::Simulation::PlayerPath.Value && Vars::Aimbot::General::AutoShoot.Value && !Vars::Debug::Info.Value; - bool bLine = Vars::Visuals::Line::Enabled.Value; - bool bBoxes = Vars::Visuals::Hitbox::BonesEnabled.Value & Vars::Visuals::Hitbox::BonesEnabledEnum::OnShot; - if (pCmd->buttons & IN_ATTACK && pWeapon->m_flSmackTime() < 0.f && bPath) - { - G::LineStorage.clear(); - G::BoxStorage.clear(); - G::PathStorage.clear(); - - if (bPath) - { - if (Vars::Colors::PlayerPath.Value.a) - { - G::PathStorage.emplace_back(mPaths[pLocal->entindex()], I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPath.Value, Vars::Visuals::Simulation::PlayerPath.Value); - G::PathStorage.emplace_back(mPaths[tTarget.m_pEntity->entindex()], I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPath.Value, Vars::Visuals::Simulation::PlayerPath.Value); - } - if (Vars::Colors::PlayerPathClipped.Value.a) - { - G::PathStorage.emplace_back(mPaths[pLocal->entindex()], I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPathClipped.Value, Vars::Visuals::Simulation::PlayerPath.Value, true); - G::PathStorage.emplace_back(mPaths[tTarget.m_pEntity->entindex()], I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPathClipped.Value, Vars::Visuals::Simulation::PlayerPath.Value, true); - } - } - } - if (G::Attacking == 1 && (bLine || bBoxes)) - { - G::LineStorage.clear(); - G::BoxStorage.clear(); - - if (bLine) - { - Vec3 vEyePos = pLocal->GetShootPos(); - float flDist = vEyePos.DistTo(tTarget.m_vPos); - Vec3 vForward; Math::AngleVectors(tTarget.m_vAngleTo + pLocal->m_vecPunchAngle(), &vForward); - - if (Vars::Colors::Line.Value.a) - G::LineStorage.emplace_back(std::pair(vEyePos, vEyePos + vForward * flDist), I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::Line.Value); - if (Vars::Colors::LineClipped.Value.a) - G::LineStorage.emplace_back(std::pair(vEyePos, vEyePos + vForward * flDist), I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::LineClipped.Value, true); - } - if (bBoxes) - { - auto vBoxes = F::Visuals.GetHitboxes(tTarget.m_pRecord->m_BoneMatrix.m_aBones, tTarget.m_pEntity->As()); - G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end()); - - //if (Vars::Colors::BoneHitboxEdge.Value.a || Vars::Colors::BoneHitboxFace.Value.a) - // G::BoxStorage.emplace_back(tTarget.m_pRecord->m_vOrigin, tTarget.m_pRecord->m_vMins, tTarget.m_pRecord->m_vMaxs, Vec3(), I::GlobalVars->curtime + Vars::Visuals::Hitbox::DrawDuration.Value, Vars::Colors::BoneHitboxEdge.Value, Vars::Colors::BoneHitboxFace.Value); - //if (Vars::Colors::BoneHitboxEdgeClipped.Value.a || Vars::Colors::BoneHitboxFaceClipped.Value.a) - // G::BoxStorage.emplace_back(tTarget.m_pRecord->m_vOrigin, tTarget.m_pRecord->m_vMins, tTarget.m_pRecord->m_vMaxs, Vec3(), I::GlobalVars->curtime + Vars::Visuals::Hitbox::DrawDuration.Value, Vars::Colors::BoneHitboxEdgeClipped.Value, Vars::Colors::BoneHitboxFaceClipped.Value, true); - } - } + DrawVisuals(pLocal, pWeapon, pCmd, tTarget, m_mPaths); Aim(pCmd, tTarget.m_vAngleTo); break; @@ -557,8 +555,10 @@ bool CAimbotMelee::FindNearestBuildPoint(CBaseObject* pBuilding, CTFPlayer* pLoc { bool bFoundPoint = false; + Vec3 vEyePos = pLocal->GetShootPos(); static auto tf_obj_max_attach_dist = U::ConVars.FindVar("tf_obj_max_attach_dist"); float flNearestPoint = tf_obj_max_attach_dist->GetFloat(); + for (int i = 0; i < pBuilding->GetNumBuildPoints(); i++) { int v = GetAttachment(pBuilding, i); @@ -566,10 +566,10 @@ bool CAimbotMelee::FindNearestBuildPoint(CBaseObject* pBuilding, CTFPlayer* pLoc Vec3 vOrigin; if (pBuilding->GetAttachment(v, vOrigin)) // issues using pBuilding->GetBuildPoint i on sentries above level 1 for some reason { - if (!SDK::VisPos(pLocal, pBuilding, pLocal->GetShootPos(), vOrigin)) + if (!SDK::VisPos(pLocal, pBuilding, vEyePos, vOrigin)) continue; - float flDist = (vOrigin - pLocal->GetAbsOrigin()).Length(); + float flDist = (vOrigin - pLocal->m_vecOrigin()).Length(); if (flDist < flNearestPoint) { flNearestPoint = flDist; diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h index 38248374..3b07be1b 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h @@ -10,11 +10,9 @@ class CAimbotMelee std::vector SortTargets(CTFPlayer* pLocal, CTFWeaponBase* pWeapon); int GetSwingTime(CTFWeaponBase* pWeapon); - void SimulatePlayers(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, std::vector vTargets, Vec3& vEyePos, - std::unordered_map>& mRecordMap, - std::unordered_map>& mPaths); + void SimulatePlayers(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, std::vector vTargets, Vec3& vEyePos); bool CanBackstab(CBaseEntity* pTarget, CTFPlayer* pLocal, Vec3 vEyeAngles); - int CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Vec3 vEyePos, std::deque& vSimRecords); + int CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Vec3 vEyePos); bool Aim(Vec3 vCurAngle, Vec3 vToAngle, Vec3& vOut, int iMethod = Vars::Aimbot::General::AimType.Value); void Aim(CUserCmd* pCmd, Vec3& vAngle); @@ -22,8 +20,10 @@ class CAimbotMelee bool FindNearestBuildPoint(CBaseObject* pBuilding, CTFPlayer* pLocal, Vec3& vPoint); bool RunSapper(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); - int iDoubletapTicks = 0; - int iDoubletapMax = 0; + int m_iDoubletapTicks = 0; + + std::unordered_map> m_mRecordMap; + std::unordered_map> m_mPaths; public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp index cbdf3fa6..4a4ce4a3 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp @@ -268,14 +268,14 @@ std::unordered_map CAimbotProjectile::GetDirectPoints(Target_t& tTarg case 0: if (tTarget.m_nAimedHitbox == HITBOX_HEAD) { - auto pBones = H::Entities.GetBones(tTarget.m_pEntity->entindex()); - if (!pBones) + auto aBones = H::Entities.GetBones(tTarget.m_pEntity->entindex()); + if (!aBones) break; - //Vec3 vOff = tTarget.m_pEntity->As()->GetHitboxOrigin(pBones, HITBOX_HEAD) - tTarget.m_pEntity->m_vecOrigin(); + //Vec3 vOff = tTarget.m_pEntity->As()->GetHitboxOrigin(aBones, HITBOX_HEAD) - tTarget.m_pEntity->m_vecOrigin(); // https://www.youtube.com/watch?v=_PSGD-pJUrM, might be better?? - Vec3 vCenter, vBBoxMins, vBBoxMaxs; tTarget.m_pEntity->As()->GetHitboxInfo(pBones, HITBOX_HEAD, &vCenter, &vBBoxMins, &vBBoxMaxs); + Vec3 vCenter, vBBoxMins, vBBoxMaxs; tTarget.m_pEntity->As()->GetHitboxInfo(aBones, HITBOX_HEAD, &vCenter, &vBBoxMins, &vBBoxMaxs); Vec3 vOff = vCenter + (vBBoxMins + vBBoxMaxs) / 2 - tTarget.m_pEntity->m_vecOrigin(); float flLow = 0.f; @@ -1049,41 +1049,6 @@ void CAimbotProjectile::CalculateAngle(const Vec3& vLocalPos, const Vec3& vTarge -class CTraceFilterProjectileNoPlayer : public ITraceFilter -{ -public: - bool ShouldHitEntity(IHandleEntity* pServerEntity, int nContentsMask) override; - TraceType_t GetTraceType() const override; - CBaseEntity* pSkip = nullptr; -}; -bool CTraceFilterProjectileNoPlayer::ShouldHitEntity(IHandleEntity* pServerEntity, int nContentsMask) -{ - if (!pServerEntity || pServerEntity == pSkip) - return false; - - auto pEntity = reinterpret_cast(pServerEntity); - - switch (pEntity->GetClassID()) - { - case ETFClassID::CBaseEntity: - case ETFClassID::CBaseDoor: - case ETFClassID::CDynamicProp: - case ETFClassID::CPhysicsProp: - case ETFClassID::CObjectCartDispenser: - case ETFClassID::CFuncTrackTrain: - case ETFClassID::CFuncConveyor: - case ETFClassID::CObjectSentrygun: - case ETFClassID::CObjectDispenser: - case ETFClassID::CObjectTeleporter: return true; - } - - return false; -} -TraceType_t CTraceFilterProjectileNoPlayer::GetTraceType() const -{ - return TRACE_EVERYTHING; -} - bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Target_t& tTarget, Vec3& vPoint, Vec3& vAngles, int iSimTime, bool bSplash, bool* pHitSolid, std::vector* pProjectilePath) { int iFlags = ProjSimEnum::Trace | ProjSimEnum::InitCheck | ProjSimEnum::NoRandomAngles | ProjSimEnum::PredictCmdNum; @@ -1121,8 +1086,9 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar bool bDidHit = false; CGameTrace trace = {}; - CTraceFilterProjectile filter = {}; filter.pSkip = pLocal; - CTraceFilterProjectileNoPlayer filterSplash = {}; + CTraceFilterCollideable filter = {}; filter.pSkip = bSplash ? tTarget.m_pEntity : pLocal; filter.iPlayer = bSplash ? PLAYER_NONE : PLAYER_DEFAULT; + int nMask = MASK_SOLID; + F::ProjSim.SetupTrace(filter, nMask, pWeapon); #ifdef SPLASH_DEBUG5 G::BoxStorage.emplace_back(vPoint, tProjInfo.m_vHull * -1, tProjInfo.m_vHull, Vec3(), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 0), Color_t(0, 0, 0, 0)); @@ -1130,15 +1096,14 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar if (!tProjInfo.m_flGravity) { - CTraceFilterWorldAndPropsOnly filterWorld = {}; - SDK::TraceHull(tProjInfo.m_vPos, vPoint, tProjInfo.m_vHull * -1, tProjInfo.m_vHull, MASK_SOLID, &filterWorld, &trace); + SDK::TraceHull(tProjInfo.m_vPos, vPoint, tProjInfo.m_vHull * -1, tProjInfo.m_vHull, nMask, &filter, &trace); #ifdef SPLASH_DEBUG6 mTraceCount["Nograv trace"]++; #endif #ifdef SPLASH_DEBUG5 G::LineStorage.emplace_back(std::pair(tProjInfo.m_vPos, vPoint), I::GlobalVars->curtime + 5.f, Color_t(0, 0, 0)); #endif - if (trace.fraction < 0.999f) + if (trace.fraction < 0.999f && trace.m_pEnt != tTarget.m_pEntity) return false; } @@ -1160,7 +1125,7 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar if (!bSplash) { - SDK::TraceHull(vOld, vNew, tProjInfo.m_vHull * -1, tProjInfo.m_vHull, MASK_SOLID, &filter, &trace); + SDK::TraceHull(vOld, vNew, tProjInfo.m_vHull * -1, tProjInfo.m_vHull, nMask, &filter, &trace); #ifdef SPLASH_DEBUG6 mTraceCount["Direct trace"]++; #endif @@ -1177,7 +1142,7 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar if (n % Vars::Aimbot::Projectile::SplashTraceInterval.Value && n != iSimTime && !bPrimeTime) continue; - SDK::TraceHull(vStaticPos, vNew, tProjInfo.m_vHull * -1, tProjInfo.m_vHull, MASK_SOLID, &filterSplash, &trace); + SDK::TraceHull(vStaticPos, vNew, tProjInfo.m_vHull * -1, tProjInfo.m_vHull, nMask, &filter, &trace); #ifdef SPLASH_DEBUG6 mTraceCount["Splash trace"]++; #endif @@ -1198,25 +1163,27 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar bool bValid = bTarget && bTime; if (bValid && bSplash) { - bValid = SDK::VisPosWorld(nullptr, tTarget.m_pEntity, trace.endpos, vPoint, MASK_SOLID); + bValid = SDK::VisPosWorld(nullptr, tTarget.m_pEntity, trace.endpos, vPoint, nMask); #ifdef SPLASH_DEBUG6 mTraceCount["Splash vispos"]++; #endif if (bValid) { + Vec3 vFrom = trace.endpos; switch (pWeapon->GetWeaponID()) { case TF_WEAPON_ROCKETLAUNCHER: case TF_WEAPON_ROCKETLAUNCHER_DIRECTHIT: case TF_WEAPON_PARTICLE_CANNON: - CGameTrace eyeTrace = {}; - CTraceFilterWorldAndPropsOnly filter = {}; - SDK::Trace(trace.endpos + trace.plane.normal, tTarget.m_vPos + tTarget.m_pEntity->As()->GetViewOffset(), MASK_SHOT, &filter, &eyeTrace); - bValid = eyeTrace.fraction == 1.f; -#ifdef SPLASH_DEBUG6 - mTraceCount["Rocket trace"]++; -#endif + vFrom += trace.plane.normal; } + + CGameTrace eyeTrace = {}; + SDK::Trace(vFrom, tTarget.m_vPos + tTarget.m_pEntity->As()->GetViewOffset(), MASK_SHOT, &filter, &eyeTrace); + bValid = eyeTrace.fraction == 1.f; +#ifdef SPLASH_DEBUG6 + mTraceCount["Eye trace"]++; +#endif } } @@ -1279,8 +1246,8 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar auto pSet = pHDR->pHitboxSet(tTarget.m_pEntity->As()->m_nHitboxSet()); if (!pSet) break; - auto pBones = H::Entities.GetBones(tTarget.m_pEntity->entindex()); - if (!pBones) + auto aBones = H::Entities.GetBones(tTarget.m_pEntity->entindex()); + if (!aBones) break; Vec3 vForward = vOld - vNew; vForward.Normalize(); @@ -1296,7 +1263,7 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar if (!pBox) continue; - Vec3 vCenter; Math::VectorTransform((pBox->bbmin + pBox->bbmax) / 2, pBones[pBox->bone], vCenter); + Vec3 vCenter; Math::VectorTransform((pBox->bbmin + pBox->bbmax) / 2, aBones[pBox->bone], vCenter); const float flDist = vPos.DistTo(vCenter); if (closestId != -1 && flDist < closestDist || closestId == -1) @@ -1344,8 +1311,7 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar -int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, - std::vector* pPlayerPath, std::vector* pProjectilePath, std::vector* pBoxes, float* pTimeTo) +int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon) { //if (Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Unsimulated && H::Entities.GetChoke(tTarget.m_pEntity->entindex()) > Vars::Aimbot::General::TickTolerance.Value) // return false; @@ -1501,10 +1467,10 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas { iLowestPriority = iPriority; flLowestDist = flDist; vAngleTo = vAngles, vPredicted = tTarget.m_vPos, vTarget = vOriginalPoint; - *pTimeTo = vPoint.m_Solution.m_flTime + tInfo.m_flLatency; - *pPlayerPath = tStorage.m_vPath; - pPlayerPath->push_back(tStorage.m_MoveData.m_vecAbsOrigin); - *pProjectilePath = vProjLines; + m_flTimeTo = vPoint.m_Solution.m_flTime + tInfo.m_flLatency; + m_vPlayerPath = tStorage.m_vPath; + m_vPlayerPath.push_back(tStorage.m_MoveData.m_vecAbsOrigin); + m_vProjectilePath = vProjLines; } else switch (Vars::Aimbot::General::AimType.Value) { @@ -1523,8 +1489,8 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas { iLowestSmoothPriority = iPriority; flLowestSmoothDist = flDist; vAngleTo = vAngles, vPredicted = tTarget.m_vPos; - *pPlayerPath = tStorage.m_vPath; - pPlayerPath->push_back(tStorage.m_MoveData.m_vecAbsOrigin); + m_vPlayerPath = tStorage.m_vPath; + m_vPlayerPath.push_back(tStorage.m_MoveData.m_vecAbsOrigin); iReturn = 2; } } @@ -1532,7 +1498,7 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas } if (!j && bHitSolid) - *pTimeTo = vPoint.m_Solution.m_flTime + tInfo.m_flLatency; + m_flTimeTo = vPoint.m_Solution.m_flTime + tInfo.m_flLatency; j++; } } @@ -1550,59 +1516,23 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas if (bAny && (Vars::Colors::BoundHitboxEdge.Value.a || Vars::Colors::BoundHitboxFace.Value.a || Vars::Colors::BoundHitboxEdgeClipped.Value.a || Vars::Colors::BoundHitboxFaceClipped.Value.a)) { tInfo.m_vHull = tInfo.m_vHull.Max(1); - float flProjectileTime = TICKS_TO_TIME(pProjectilePath->size()); - float flTargetTime = tStorage.m_bFailed ? flProjectileTime : TICKS_TO_TIME(pPlayerPath->size()); + float flProjectileTime = TICKS_TO_TIME(m_vProjectilePath.size()); + float flTargetTime = tStorage.m_bFailed ? flProjectileTime : TICKS_TO_TIME(m_vPlayerPath.size()); if (Vars::Visuals::Hitbox::BoundsEnabled.Value & Vars::Visuals::Hitbox::BoundsEnabledEnum::OnShot) { if (Vars::Colors::BoundHitboxEdge.Value.a || Vars::Colors::BoundHitboxFace.Value.a) - pBoxes->emplace_back(vPredicted, tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs(), Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flTargetTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdge.Value, Vars::Colors::BoundHitboxFace.Value); + m_vBoxes.emplace_back(vPredicted, tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs(), Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flTargetTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdge.Value, Vars::Colors::BoundHitboxFace.Value); if (Vars::Colors::BoundHitboxEdgeClipped.Value.a || Vars::Colors::BoundHitboxFaceClipped.Value.a) - pBoxes->emplace_back(vPredicted, tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs(), Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flTargetTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdgeClipped.Value, Vars::Colors::BoundHitboxFaceClipped.Value, true); + m_vBoxes.emplace_back(vPredicted, tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs(), Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flTargetTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdgeClipped.Value, Vars::Colors::BoundHitboxFaceClipped.Value, true); } if (bMain && Vars::Visuals::Hitbox::BoundsEnabled.Value & Vars::Visuals::Hitbox::BoundsEnabledEnum::AimPoint) { if (Vars::Colors::BoundHitboxEdge.Value.a || Vars::Colors::BoundHitboxFace.Value.a) - pBoxes->emplace_back(vTarget, tInfo.m_vHull * -1, tInfo.m_vHull, Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flProjectileTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdge.Value, Vars::Colors::BoundHitboxFace.Value); + m_vBoxes.emplace_back(vTarget, tInfo.m_vHull * -1, tInfo.m_vHull, Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flProjectileTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdge.Value, Vars::Colors::BoundHitboxFace.Value); if (Vars::Colors::BoundHitboxEdgeClipped.Value.a || Vars::Colors::BoundHitboxFaceClipped.Value.a) - pBoxes->emplace_back(vTarget, tInfo.m_vHull * -1, tInfo.m_vHull, Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flProjectileTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdgeClipped.Value, Vars::Colors::BoundHitboxFaceClipped.Value, true); - - /* - if (Vars::Debug::Info.Value && tTarget.m_nAimedHitbox == HITBOX_HEAD) // huntsman head - { - const Vec3 vOriginOffset = tTarget.m_pEntity->m_vecOrigin() - vPredicted; - - auto pBones = H::Entities.GetBones(tTarget.m_pEntity->entindex()); - if (!pBones) - return true; - - auto vBoxes = F::Visuals.GetHitboxes(pBones, tTarget.m_pEntity->As(), { HITBOX_HEAD }); - for (auto& bBox : vBoxes) - { - bBox.m_vPos -= vOriginOffset; - bBox.m_flTime = I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flTargetTime : Vars::Visuals::Hitbox::DrawDuration.Value); - pBoxes->push_back(bBox); - } - } - if (Vars::Debug::Info.Value && tTarget.m_nAimedHitbox == HITBOX_HEAD) // huntsman head, broken; removeme once 254 is fixed - { - const Vec3 vOriginOffset = tTarget.m_pEntity->m_vecOrigin() - vPredicted; - - auto pBones = H::Entities.GetBones(tTarget.m_pEntity->entindex()); - if (!pBones) - return true; - - auto vBoxes = F::Visuals.GetHitboxes(pBones, tTarget.m_pEntity->As(), { HITBOX_HEAD }); - for (auto& bBox : vBoxes) - { - bBox.m_vPos -= vOriginOffset; - bBox.m_flTime = I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flTargetTime : Vars::Visuals::Hitbox::DrawDuration.Value); - bBox.m_vRotation = Vec3(); - pBoxes->push_back(bBox); - } - } - */ + m_vBoxes.emplace_back(vTarget, tInfo.m_vHull * -1, tInfo.m_vHull, Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flProjectileTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdgeClipped.Value, Vars::Colors::BoundHitboxFaceClipped.Value, true); } } @@ -1705,6 +1635,42 @@ static inline void CancelShot(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCm } } +static inline void DrawVisuals(int iResult, Target_t& tTarget, std::vector& vPlayerPath, std::vector& vProjectilePath, std::vector& vBoxes) +{ + if (G::Attacking == 1 || !Vars::Aimbot::General::AutoShoot.Value || iResult != 1) + { + bool bPlayerPath = Vars::Visuals::Simulation::PlayerPath.Value; + bool bProjectilePath = Vars::Visuals::Simulation::ProjectilePath.Value && (G::Attacking == 1 || Vars::Debug::Info.Value) && iResult == 1; + bool bBoxes = Vars::Visuals::Hitbox::BoundsEnabled.Value & (Vars::Visuals::Hitbox::BoundsEnabledEnum::OnShot | Vars::Visuals::Hitbox::BoundsEnabledEnum::AimPoint); + bool bRealPath = Vars::Visuals::Simulation::RealPath.Value && iResult == 1; + if (bPlayerPath || bProjectilePath || bBoxes || bRealPath) + { + G::PathStorage.clear(); + G::BoxStorage.clear(); + G::LineStorage.clear(); + + if (bPlayerPath) + { + if (Vars::Colors::PlayerPath.Value.a) + G::PathStorage.emplace_back(vPlayerPath, Vars::Visuals::Simulation::Timed.Value ? -int(vPlayerPath.size()) : I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPath.Value, Vars::Visuals::Simulation::PlayerPath.Value); + if (Vars::Colors::PlayerPathClipped.Value.a) + G::PathStorage.emplace_back(vPlayerPath, Vars::Visuals::Simulation::Timed.Value ? -int(vPlayerPath.size()) : I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPathClipped.Value, Vars::Visuals::Simulation::PlayerPath.Value, true); + } + if (bProjectilePath) + { + if (Vars::Colors::ProjectilePath.Value.a) + G::PathStorage.emplace_back(vProjectilePath, Vars::Visuals::Simulation::Timed.Value ? -int(vProjectilePath.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()) : I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::ProjectilePath.Value, Vars::Visuals::Simulation::ProjectilePath.Value); + if (Vars::Colors::ProjectilePathClipped.Value.a) + G::PathStorage.emplace_back(vProjectilePath, Vars::Visuals::Simulation::Timed.Value ? -int(vProjectilePath.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()) : I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::ProjectilePathClipped.Value, Vars::Visuals::Simulation::ProjectilePath.Value, true); + } + if (bBoxes) + G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end()); + if (bRealPath) + F::Aimbot.Store(tTarget.m_pEntity, vPlayerPath.size()); + } + } +} + bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) { const int nWeaponID = pWeapon->GetWeaponID(); @@ -1756,16 +1722,16 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser #endif for (auto& tTarget : vTargets) { - float flTimeTo = 0.f; std::vector vPlayerPath, vProjectilePath; std::vector vBoxes = {}; - const int iResult = CanHit(tTarget, pLocal, pWeapon, &vPlayerPath, &vProjectilePath, &vBoxes, &flTimeTo); + m_flTimeTo = std::numeric_limits::max(); + m_vPlayerPath.clear(); m_vProjectilePath.clear(); m_vBoxes.clear(); + + const int iResult = CanHit(tTarget, pLocal, pWeapon); if (iResult != 1 && pWeapon->GetWeaponID() == TF_WEAPON_CANNON && Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::ChargeWeapon && !(pCmd->buttons & IN_ATTACK)) { float flCharge = pWeapon->As()->m_flDetonateTime() > 0.f ? std::clamp(pWeapon->As()->m_flDetonateTime() - I::GlobalVars->curtime, 0.f, 1.f) : 1.f; - if (!flTimeTo) - flTimeTo = std::numeric_limits::max(); - if (flCharge < flTimeTo) + if (flCharge < m_flTimeTo) { if (pWeapon->As()->m_flDetonateTime() > 0.f) CancelShot(pLocal, pWeapon, pCmd, m_iLastTickCancel); @@ -1781,26 +1747,7 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser if (iResult == 2) { G::AimTarget = { tTarget.m_pEntity->entindex(), I::GlobalVars->tickcount, 0 }; - - bool bPlayerPath = Vars::Visuals::Simulation::PlayerPath.Value; - bool bBoxes = Vars::Visuals::Hitbox::BoundsEnabled.Value & (Vars::Visuals::Hitbox::BoundsEnabledEnum::OnShot | Vars::Visuals::Hitbox::BoundsEnabledEnum::AimPoint); - if (bPlayerPath || bBoxes) - { - G::PathStorage.clear(); - G::BoxStorage.clear(); - G::LineStorage.clear(); - - if (bPlayerPath) - { - if (Vars::Colors::PlayerPath.Value.a) - G::PathStorage.emplace_back(vPlayerPath, Vars::Visuals::Simulation::Timed.Value ? -int(vPlayerPath.size()) : I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPath.Value, Vars::Visuals::Simulation::PlayerPath.Value); - if (Vars::Colors::PlayerPathClipped.Value.a) - G::PathStorage.emplace_back(vPlayerPath, Vars::Visuals::Simulation::Timed.Value ? -int(vPlayerPath.size()) : I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPathClipped.Value, Vars::Visuals::Simulation::PlayerPath.Value, true); - } - if (bBoxes) - G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end()); - } - + DrawVisuals(iResult, tTarget, m_vPlayerPath, m_vProjectilePath, m_vBoxes); Aim(pCmd, tTarget.m_vAngleTo); break; } @@ -1827,7 +1774,7 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser 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) + if (std::clamp(flCharge, 0.f, 1.f) < m_flTimeTo) pCmd->buttons &= ~IN_ATTACK; } else @@ -1850,36 +1797,7 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser } F::Aimbot.m_bRan = G::Attacking = SDK::IsAttacking(pLocal, pWeapon, pCmd, true); - - if (G::Attacking == 1 || !Vars::Aimbot::General::AutoShoot.Value) - { - bool bPlayerPath = Vars::Visuals::Simulation::PlayerPath.Value; - bool bProjectilePath = Vars::Visuals::Simulation::ProjectilePath.Value && (G::Attacking == 1 || Vars::Debug::Info.Value); - bool bBoxes = Vars::Visuals::Hitbox::BoundsEnabled.Value & (Vars::Visuals::Hitbox::BoundsEnabledEnum::OnShot | Vars::Visuals::Hitbox::BoundsEnabledEnum::AimPoint); - if (bPlayerPath || bProjectilePath || bBoxes) - { - G::PathStorage.clear(); - G::BoxStorage.clear(); - G::LineStorage.clear(); - - if (bPlayerPath) - { - if (Vars::Colors::PlayerPath.Value.a) - G::PathStorage.emplace_back(vPlayerPath, Vars::Visuals::Simulation::Timed.Value ? -int(vPlayerPath.size()) : I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPath.Value, Vars::Visuals::Simulation::PlayerPath.Value); - if (Vars::Colors::PlayerPathClipped.Value.a) - G::PathStorage.emplace_back(vPlayerPath, Vars::Visuals::Simulation::Timed.Value ? -int(vPlayerPath.size()) : I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPathClipped.Value, Vars::Visuals::Simulation::PlayerPath.Value, true); - } - if (bProjectilePath) - { - if (Vars::Colors::ProjectilePath.Value.a) - G::PathStorage.emplace_back(vProjectilePath, Vars::Visuals::Simulation::Timed.Value ? -int(vProjectilePath.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()) : I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::ProjectilePath.Value, Vars::Visuals::Simulation::ProjectilePath.Value); - if (Vars::Colors::ProjectilePathClipped.Value.a) - G::PathStorage.emplace_back(vProjectilePath, Vars::Visuals::Simulation::Timed.Value ? -int(vProjectilePath.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()) : I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::ProjectilePathClipped.Value, Vars::Visuals::Simulation::ProjectilePath.Value, true); - } - if (bBoxes) - G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end()); - } - } + DrawVisuals(iResult, tTarget, m_vPlayerPath, m_vProjectilePath, m_vBoxes); Aim(pCmd, tTarget.m_vAngleTo); if (G::PSilentAngles) diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h index c063f948..15d76c8d 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h @@ -58,7 +58,7 @@ class CAimbotProjectile void CalculateAngle(const Vec3& vLocalPos, const Vec3& vTargetPos, Info_t& tInfo, int iSimTime, Solution_t& out, bool bAccuracy = true); bool TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Target_t& tTarget, Vec3& vPoint, Vec3& vAngles, int iSimTime, bool bSplash, bool* pHitSolid = nullptr, std::vector* pProjectilePath = nullptr); - int CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, std::vector* pPlayerPath, std::vector* pProjectilePath, std::vector* pBoxes, float* pTimeTo); + int CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon); bool RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); bool Aim(Vec3 vCurAngle, Vec3 vToAngle, Vec3& vOut, int iMethod = Vars::Aimbot::General::AimType.Value); @@ -66,6 +66,11 @@ class CAimbotProjectile bool m_bLastTickHeld = false; + float m_flTimeTo = std::numeric_limits::max(); + std::vector m_vPlayerPath = {}; + std::vector m_vProjectilePath = {}; + std::vector m_vBoxes = {}; + public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); float GetSplashRadius(CTFWeaponBase* pWeapon, CTFPlayer* pPlayer); diff --git a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp index fcb27a85..f3cb938f 100644 --- a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp +++ b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp @@ -106,7 +106,7 @@ static inline bool CheckEntities(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUse continue; } - if (!SDK::VisPosProjectile(pProjectile, pEntity, vOrigin, pEntity->IsPlayer() ? pEntity->GetAbsOrigin() + pEntity->As()->GetViewOffset() : pEntity->GetCenter(), MASK_SHOT)) + if (!SDK::VisPosCollideable(pProjectile, pEntity, vOrigin, pEntity->IsPlayer() ? pEntity->GetAbsOrigin() + pEntity->As()->GetViewOffset() : pEntity->GetCenter(), MASK_SHOT)) continue; if (pCmd && pWeapon->GetWeaponID() == TF_WEAPON_PIPEBOMBLAUNCHER && pWeapon->As()->GetDetonateType() == TF_DETONATE_MODE_DOT) diff --git a/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp b/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp index fb31d9e5..ada6f982 100644 --- a/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp +++ b/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp @@ -398,7 +398,8 @@ void CAutoHeal::GetDangers(CTFPlayer* pTarget, bool bVaccinator, float& flBullet case ETFClassID::CTFProjectile_SpellLightningOrb: if (pEntity->As()->m_bCritical()) flMult = 3.f; - else if (pEntity->As()->m_iDeflected()) + else if (pEntity->As()->m_iDeflected() + || pTarget->InCond(TF_COND_BLASTJUMPING) && pWeapon && SDK::AttribHookValue(0, "mini_crit_airborne", pWeapon) == 1) flMult = 1.36f; break; case ETFClassID::CTFProjectile_EnergyBall: @@ -568,9 +569,12 @@ void CAutoHeal::AutoVaccinator(CTFPlayer* pLocal, CWeaponMedigun* pWeapon, CUser { 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()))) + std::vector vTargets = { pLocal }; + if (auto pTarget = pWeapon->m_hHealingTarget().Get()->As(); pTarget && + (!Vars::Aimbot::Healing::FriendsOnly.Value || H::Entities.IsFriend(pTarget->entindex()) || H::Entities.InParty(pTarget->entindex()))) + vTargets.push_back(pTarget); + + for (auto pTarget : vTargets) 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 { diff --git a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp index e3568422..0c712d96 100644 --- a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp +++ b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp @@ -154,7 +154,7 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p Vec3 New = F::ProjSim.GetOrigin(); CGameTrace trace = {}; - CTraceFilterProjectile filter = {}; filter.pSkip = pLocal; + CTraceFilterCollideable filter = {}; filter.pSkip = pLocal; SDK::Trace(Old, New, MASK_SOLID, &filter, &trace); if (trace.DidHit()) { diff --git a/Amalgam/src/Features/Backtrack/Backtrack.cpp b/Amalgam/src/Features/Backtrack/Backtrack.cpp index 6c0e1adb..6cdc7f30 100644 --- a/Amalgam/src/Features/Backtrack/Backtrack.cpp +++ b/Amalgam/src/Features/Backtrack/Backtrack.cpp @@ -200,8 +200,8 @@ void CBacktrack::MakeRecords() || !H::Entities.GetDeltaTime(pPlayer->entindex())) continue; - auto pBones = H::Entities.GetBones(pPlayer->entindex()); - if (!pBones) + auto aBones = H::Entities.GetBones(pPlayer->entindex()); + if (!aBones) continue; auto& vRecords = m_mRecords[pPlayer]; @@ -212,7 +212,7 @@ void CBacktrack::MakeRecords() pPlayer->m_vecOrigin(), pPlayer->m_vecMins(), pPlayer->m_vecMaxs(), - *reinterpret_cast(pBones), + *reinterpret_cast(aBones), m_mDidShoot[pPlayer->entindex()], pPlayer->m_vecOrigin() ); @@ -396,8 +396,8 @@ void CBacktrack::Draw(CTFPlayer* pLocal) } float flFakeLerp = GetFakeInterp() > G::Lerp ? GetFakeInterp() : 0.f; - float flFake = std::min(flFakeLatency + flFakeLerp, m_flMaxUnlag) * 1000.f; - float flLatency = std::max(pNetChan->GetLatency(FLOW_INCOMING) + pNetChan->GetLatency(FLOW_OUTGOING) - flFakeLatency, 0.f) * 1000.f; + float flFake = std::min(flFakeLatency + flFakeLerp, m_flMaxUnlag) * 1000; + float flLatency = std::max(pNetChan->GetLatency(FLOW_INCOMING) + pNetChan->GetLatency(FLOW_OUTGOING) - flFakeLatency, 0.f) * 1000; int iLatencyScoreboard = pResource->m_iPing(pLocal->entindex()); int x = Vars::Menu::PingDisplay.Value.x; @@ -417,7 +417,7 @@ void CBacktrack::Draw(CTFPlayer* pLocal) align = ALIGN_TOPRIGHT; } - if (flFake || Vars::Backtrack::Interp.Value) + if (flFake || Vars::Backtrack::Interp.Value > G::Lerp * 1000) 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()); diff --git a/Amalgam/src/Features/Backtrack/Backtrack.h b/Amalgam/src/Features/Backtrack/Backtrack.h index 04be3f6f..a26f8417 100644 --- a/Amalgam/src/Features/Backtrack/Backtrack.h +++ b/Amalgam/src/Features/Backtrack/Backtrack.h @@ -39,8 +39,8 @@ class CBacktrack void MakeRecords(); void CleanRecords(); - std::unordered_map> m_mRecords; - std::unordered_map m_mDidShoot; + std::unordered_map> m_mRecords = {}; + std::unordered_map m_mDidShoot = {}; std::deque m_dSequences; int m_iLastInSequence = 0; diff --git a/Amalgam/src/Features/CheaterDetection/CheaterDetection.h b/Amalgam/src/Features/CheaterDetection/CheaterDetection.h index 95093fcc..51b27e0c 100644 --- a/Amalgam/src/Features/CheaterDetection/CheaterDetection.h +++ b/Amalgam/src/Features/CheaterDetection/CheaterDetection.h @@ -42,7 +42,7 @@ class CCheaterDetection void Infract(CTFPlayer* pEntity, std::string sReason); - std::unordered_map mData; + std::unordered_map mData = {}; public: void Run(); diff --git a/Amalgam/src/Features/Commands/Commands.h b/Amalgam/src/Features/Commands/Commands.h index 3f6ddd80..630317ae 100644 --- a/Amalgam/src/Features/Commands/Commands.h +++ b/Amalgam/src/Features/Commands/Commands.h @@ -7,7 +7,7 @@ using CommandCallback = std::function)>; class CCommands { private: - std::unordered_map m_mCommands; + std::unordered_map m_mCommands = {}; public: void Initialize(); diff --git a/Amalgam/src/Features/ImGui/Menu/Components.h b/Amalgam/src/Features/ImGui/Menu/Components.h index b5cbcf7f..c9bf2924 100644 --- a/Amalgam/src/Features/ImGui/Menu/Components.h +++ b/Amalgam/src/Features/ImGui/Menu/Components.h @@ -17,7 +17,7 @@ Enum(FToggle, None = 0, Left = 1 << 0, Right = 1 << 1, PlainColor = 1 << 2); Enum(FSlider, None = 0, Left = 1 << 0, Right = 1 << 1, Clamp = 1 << 2, Min = 1 << 3, Max = 1 << 4, Precision = 1 << 5, NoAutoUpdate = 1 << 6); Enum(FDropdown, None = 0, Left = 1 << 0, Right = 1 << 1, Multi = 1 << 2, Modifiable = 1 << 3); Enum(FSDropdown, None = 0, Custom = 1 << 2, AutoUpdate = 1 << 3); -Enum(FColorPicker, None = 0, Left = 1 << 0, Middle = 1 << 1, SameLine = 1 << 2, Dropdown = 1 << 3, Tooltip = 1 << 4); +Enum(FColorPicker, None = 0, Left = 1 << 0, Right = 1 << 1, Full = 1 << 2, SameLine = 1 << 3, Tooltip = 1 << 4, NoTooltip = 1 << 5, RetainPosition = 1 << 6, HoverContents = 1 << 7, RemoveVisuals = 1 << 8); Enum(Widget, Invalid, FToggle, FSlider, FISlider = FSlider, FFSlider, FIRSlider, FFRSlider, FDropdown, FSDropdown, FMDropdown, FColorPicker, FGColorPicker, FKeybind); @@ -50,7 +50,7 @@ static inline ImVec2& operator/=(ImVec2& lhs, const ImVec2& rhs) { lhs.x /= rhs. namespace ImGui { - std::unordered_map mActiveMap; + std::unordered_map mActiveMap = {}; bool Disabled = false, Transparent = false; int CurrentBind = DEFAULT_BIND; @@ -114,7 +114,7 @@ namespace ImGui ImVec2 m_vPos; ImVec2 m_vSize; }; - static std::vector vRowSizes; + static std::vector vRowSizes = {}; inline void AddRowSize(ImVec2 vPos, ImVec2 vSize) { if (GetCurrentWindow()->Flags & ImGuiWindowFlags_Popup) @@ -683,8 +683,8 @@ namespace ImGui return FBeginMenu(sLabel, &tColor, flRounding, bEnabled); } - static std::unordered_map mLastHeights; - static std::vector vStoredLabels; + static std::unordered_map mLastHeights = {}; + static std::vector vStoredLabels = {}; inline bool Section(const char* sLabel, float flPaddingMod = 0.f, float flMinHeight = 28.f, bool bForceHeight = false, uint32_t uHash = 0) { if (!uHash) @@ -1102,9 +1102,7 @@ namespace ImGui if (Transparent || Disabled) PushStyleVar(ImGuiStyleVar_Alpha, 0.5f); - ImVec2 vSize; - - vSize.x = GetWindowWidth(); + ImVec2 vSize = { GetWindowWidth(), 0 }; if (iFlags & (FToggleEnum::Left | FToggleEnum::Right)) vSize.x = vSize.x / 2 - GetStyle().WindowPadding.x * 1.5f; else @@ -1164,7 +1162,7 @@ namespace ImGui ImDrawList* pDrawList = GetWindowDrawList(); float flOriginal1 = *pVar1, flOriginal2 = pVar2 ? *pVar2 : 0.f; - static std::unordered_map> mStaticVars; + static std::unordered_map> mStaticVars = {}; if (!mActiveMap[uHash]) mStaticVars[uHash] = { flOriginal1, flOriginal2 }; float& flSVar1 = mStaticVars[uHash].first, &flSVar2 = mStaticVars[uHash].second; @@ -1847,7 +1845,7 @@ namespace ImGui return bReturn; } - inline bool ColorPicker(const char* sLabel, Color_t* pColor, bool bTooltip = true, int iFlags = FColorPickerEnum::None, ImVec2 vSize = { H::Draw.Scale(12), H::Draw.Scale(12) }) + inline bool ColorPicker(const char* sLabel, Color_t* pColor, bool bTooltip = true, ImVec2 vSize = { H::Draw.Scale(12), H::Draw.Scale(12) }) { ImVec2 vOriginalPos = GetCursorPos(); if (Disabled) @@ -1883,78 +1881,99 @@ namespace ImGui } // if items overlap, use before to have working input, e.g. a middle toggle and a color picker - inline bool FColorPicker(const char* sLabel, Color_t* pColor, int iOffset = 0, int iFlags = FColorPickerEnum::None, bool* pHovered = nullptr) + inline bool FColorPicker(const char* sLabel, Color_t* pColor, int iFlags = FColorPickerEnum::None, ImVec2 vOffset = {}, ImVec2 vSize = { H::Draw.Scale(12), H::Draw.Scale(12) }, ImVec2 vIconOffset = {}, bool* pHovered = nullptr) { if (Transparent || Disabled) PushStyleVar(ImGuiStyleVar_Alpha, 0.5f); - bool bReturn = false; - - ImVec2 vOriginalPos; - ImVec2 vSize = { H::Draw.Scale(12), H::Draw.Scale(12) }; - if (!(iFlags & FColorPickerEnum::Dropdown)) + if (iFlags & FColorPickerEnum::RemoveVisuals) { - if (iFlags & (FColorPickerEnum::Left | FColorPickerEnum::Middle)) - { - vSize.x = GetWindowWidth() / 2 - GetStyle().WindowPadding.x * 1.5f; - if (iFlags & FColorPickerEnum::Middle) - SameLine(vSize.x + GetStyle().WindowPadding.x * 2.f); - SetCursorPosX(GetCursorPosX() - H::Draw.Scale(iOffset * 12)); + vOffset = {}; + vSize = { H::Draw.Scale(12), H::Draw.Scale(12) }; + vIconOffset = {}; + } - vOriginalPos = GetCursorPos(); + ImVec2 vOriginalPos = GetCursorPos(); + ImVec2 vContentSize = vSize; + ImVec2 vLastSize = GetItemRectSize(); - auto vWrapped = WrapText(StripDoubleHash(sLabel), vSize.x - H::Draw.Scale(24)); - int iWraps = std::min(int(vWrapped.size()), 2); // prevent too many wraps - vSize.y = H::Draw.Scale(6 + 18 * iWraps); - - SetCursorPos({ vOriginalPos.x + H::Draw.Scale(6), vOriginalPos.y + H::Draw.Scale(-3 + 9 * iWraps) }); - bReturn = ColorPicker(sLabel, pColor, iFlags & FColorPickerEnum::Tooltip); - - for (size_t i = 0; i < iWraps; i++) - { - SetCursorPos({ vOriginalPos.x + H::Draw.Scale(24), vOriginalPos.y + H::Draw.Scale(5 + 18 * i) }); - TextUnformatted(vWrapped[i].c_str()); - } - - SetCursorPos(vOriginalPos); - AddRowSize(vOriginalPos, vSize); - DebugDummy({ vSize.x, GetRowSize(vSize.y) }); - } - else - { - if (iFlags & FColorPickerEnum::SameLine) - SameLine(); - SetCursorPosX(GetContentRegionMax().x - H::Draw.Scale(18 + iOffset * 12)); - - vOriginalPos = GetCursorPos(); - - SetCursorPosY(vOriginalPos.y + H::Draw.Scale(6)); - bReturn = ColorPicker(sLabel, pColor, true); - - SetCursorPos(vOriginalPos); - DebugDummy({}); - vOriginalPos.y += H::Draw.Scale(6); - } + if (iFlags & (FColorPickerEnum::Left | FColorPickerEnum::Right)) + { + vContentSize.x = GetWindowWidth() / 2 - GetStyle().WindowPadding.x * 1.5f; + vContentSize.y = std::max(H::Draw.Scale(24), vContentSize.y); + } + else if (iFlags & FColorPickerEnum::Full) + { + vContentSize.x = GetWindowWidth() - GetStyle().WindowPadding.x * 2; + vContentSize.y = std::max(H::Draw.Scale(24), vContentSize.y); + } + if (iFlags & (FColorPickerEnum::Left | FColorPickerEnum::Full)) + iFlags |= FColorPickerEnum::HoverContents; + else if (iFlags & FColorPickerEnum::Right) + { + SameLine(vContentSize.x + GetStyle().WindowPadding.x * 2.f); + iFlags |= FColorPickerEnum::HoverContents; + } + else if (iFlags & FColorPickerEnum::SameLine) + { + SameLine(); + vOffset.x -= GetStyle().WindowPadding.x; + vIconOffset.y += H::Draw.Scale(8); } else { - float flOriginalPosY = GetCursorPosY(); - SameLine(); - vSize = { H::Draw.Scale(10), flOriginalPosY - GetCursorPosY() - GetStyle().WindowPadding.y }; - - SetCursorPosX(GetCursorPosX() - GetStyle().WindowPadding.y); - vOriginalPos = GetCursorPos(); - SetCursorPosY(GetCursorPosY() + GetStyle().WindowPadding.y); - - bReturn = ColorPicker(sLabel, pColor, iFlags & FColorPickerEnum::Tooltip, iFlags, vSize); - SetCursorPos(vOriginalPos); - AddRowSize(vOriginalPos, { vSize.x, vSize.y + GetStyle().WindowPadding.y }); - DebugDummy({ vSize.x, GetRowSize(vSize.y + GetStyle().WindowPadding.y) }); - - vOriginalPos.y += GetStyle().WindowPadding.y; - vSize = { H::Draw.Scale(10), H::Draw.Scale(40) }; + SetCursorPosX(GetContentRegionMax().x - H::Draw.Scale(18)); + iFlags |= FColorPickerEnum::RetainPosition; + vIconOffset.y += H::Draw.Scale(6); } - if (pHovered) + SetCursorPos(GetCursorPos() + vOffset); + ImVec2 vOriginalPos2 = GetCursorPos(); + + bool bTooltip = iFlags & FColorPickerEnum::Tooltip || !(iFlags & (FColorPickerEnum::Left | FColorPickerEnum::Right | FColorPickerEnum::Full | FColorPickerEnum::NoTooltip)); + { + float flIconOffset; + if (vContentSize.x > vContentSize.y) + flIconOffset = (vContentSize.y - vSize.y) / 2; + else + flIconOffset = (vContentSize.x - vSize.x) / 2; + vIconOffset += { flIconOffset, flIconOffset }; + } + + std::deque vWrapped; + int iWraps = 0; + if (iFlags & (FColorPickerEnum::Left | FColorPickerEnum::Right | FColorPickerEnum::Full)) + { + vWrapped = WrapText(StripDoubleHash(sLabel), vContentSize.x - H::Draw.Scale(24)); + iWraps = std::min(int(vWrapped.size()), 2); // prevent too many wraps + float flNewSizeY = std::max(H::Draw.Scale(6 + 18 * iWraps), vContentSize.y); + vIconOffset.y += (flNewSizeY - vContentSize.y) / 2; + vContentSize.y = flNewSizeY; + } + + SetCursorPos(vOriginalPos2 + vIconOffset); + bool bReturn = ColorPicker(sLabel, pColor, bTooltip, vSize); + if (pHovered && !(iFlags & FColorPickerEnum::HoverContents)) + *pHovered = IsItemHovered(); + + for (size_t i = 0; i < iWraps; i++) + { + SetCursorPos({ vOriginalPos2.x + vIconOffset.x + vSize.x + H::Draw.Scale(6), vOriginalPos2.y + vContentSize.y / 2 + H::Draw.Scale(2 - 9 * iWraps + 18 * int(i)) }); + TextUnformatted(vWrapped[i].c_str()); + } + + if (iFlags & FColorPickerEnum::RetainPosition) + { + SetCursorPos(vOriginalPos); + DebugDummy({}); + } + else + { + vContentSize = { std::max(vSize.x + vIconOffset.x, vContentSize.x), std::max(vSize.y + vIconOffset.y, vContentSize.y) }; + SetCursorPos(vOriginalPos2); + AddRowSize(vOriginalPos2, vContentSize); + DebugDummy(vContentSize); + } + if (pHovered && iFlags & FColorPickerEnum::HoverContents) *pHovered = IsItemHovered(); if (Transparent || Disabled) @@ -2198,7 +2217,7 @@ namespace ImGui ImVec2 vOriginalPos2 = GetCursorPos(); if (bFlagActive) // do here so as to not sink input { - SetCursorPos({ vOriginalPos2.x + vSize.x - H::Draw.Scale(31), vOriginalPos2.y - H::Draw.Scale(1) }); + SetCursorPos({ vOriginalPos2.x + vSize.x - H::Draw.Scale(31), vOriginalPos2.y + H::Draw.Scale(1) }); ColorPicker(std::format("MaterialColor{}", iEntry).c_str(), &it->second->second, false); SetCursorPos(vOriginalPos2); } @@ -2428,7 +2447,7 @@ namespace ImGui vValues.push_back(-1); int iModified = -2; - if (FDropdown("Bind", &iBind, vEntries, vValues, FDropdownEnum::Modifiable, -60, "None", nullptr, &iModified)) + if (FDropdown("Bind", &iBind, vEntries, vValues, FDropdownEnum::Modifiable, -85, "None", nullptr, &iModified)) { if (iBind != DEFAULT_BIND && iBind < F::Binds.m_vBinds.size()) tBind = F::Binds.m_vBinds[iBind]; @@ -2472,19 +2491,29 @@ namespace ImGui { ImVec2 vOriginalPos = GetCursorPos(); + int iOffset = 9; - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(34), H::Draw.Scale(36) }); + PushTransparent(Transparent || !tBind.m_bEnabled, true); + + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), H::Draw.Scale(36) }); PushTransparent(Transparent || tBind.m_iVisibility == BindVisibilityEnum::Hidden, true); if (IconButton(tBind.m_iVisibility == BindVisibilityEnum::Always ? ICON_MD_VISIBILITY : ICON_MD_VISIBILITY_OFF, H::Draw.Scale(24), { 1, 1, 1, -1 }, &bHovered)) tBind.m_iVisibility = (tBind.m_iVisibility + 1) % 3; PopTransparent(1, 1); bLastHovered = bLastHovered || bHovered; - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(59), H::Draw.Scale(36) }); + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), H::Draw.Scale(36) }); if (IconButton(!tBind.m_bNot ? ICON_MD_CODE : ICON_MD_CODE_OFF, H::Draw.Scale(24), { 1, 1, 1, -1 }, &bHovered)) tBind.m_bNot = !tBind.m_bNot; bLastHovered = bLastHovered || bHovered; + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), H::Draw.Scale(36) }); + if (IconButton(!tBind.m_bEnabled ? ICON_MD_TOGGLE_OFF : ICON_MD_TOGGLE_ON, H::Draw.Scale(24), { 1, 1, 1, -1 }, &bHovered)) + tBind.m_bEnabled = !tBind.m_bEnabled; + bLastHovered = bLastHovered || bHovered; + + PopTransparent(1, 1); + SetCursorPos(vOriginalPos); } @@ -2514,6 +2543,7 @@ namespace ImGui _tBind.m_iType = tBind.m_iType; _tBind.m_iInfo = tBind.m_iInfo; _tBind.m_iKey = tBind.m_iKey; + _tBind.m_bEnabled = tBind.m_bEnabled; _tBind.m_iVisibility = tBind.m_iVisibility; _tBind.m_bNot = tBind.m_bNot; } @@ -2550,7 +2580,7 @@ namespace ImGui std::transform(sBind.begin(), sBind.end(), sBind.begin(), ::tolower);\ iFlags = iVarFlags; /*get rid of any visual flags*/\ if (FNV1A::Hash32Const(#function) == FNV1A::Hash32Const("FColorPicker"))\ - iFlags |= FColorPickerEnum::Left; /*add left flag for color pickers*/\ + iFlags |= FColorPickerEnum::Full | FColorPickerEnum::RemoveVisuals;\ PushTransparent(false);\ static bool bLastHovered = false;\ DrawBindInfo(var, staticVal, StripDoubleHash(sBind.c_str()), bNewPopup, bLastHovered);\ @@ -2574,6 +2604,6 @@ namespace ImGui WRAPPER(FDropdown, int, VA_LIST(std::vector vEntries, std::vector vValues = {}, int iFlags = 0, int iSizeOffset = 0), VA_LIST(&val, vEntries, vValues, iFlags, iSizeOffset, var.m_sExtra ? var.m_sExtra : "None")) WRAPPER(FSDropdown, std::string, VA_LIST(int iFlags = 0, int iSizeOffset = 0), VA_LIST(&val, var.m_vValues, iFlags, iSizeOffset)) WRAPPER(FMDropdown, VA_LIST(std::vector>), VA_LIST(int iFlags = 0, int iSizeOffset = 0), VA_LIST(&val, iFlags, iSizeOffset)) - WRAPPER(FColorPicker, Color_t, VA_LIST(int iOffset = 0, int iFlags = 0), VA_LIST(&val, iOffset, iFlags)) - WRAPPER(FColorPicker, Gradient_t, VA_LIST(bool bStart = true, int iOffset = 0, int iFlags = 0), VA_LIST(bStart ? &val.StartColor : &val.EndColor, iOffset, iFlags)) + WRAPPER(FColorPicker, Color_t, VA_LIST(int iFlags = 0, ImVec2 vOffset = {}, ImVec2 vSize = { H::Draw.Scale(12), H::Draw.Scale(12) }, ImVec2 vIconOffset = {}), VA_LIST(&val, iFlags, vOffset, vSize, vIconOffset)) + WRAPPER(FColorPicker, Gradient_t, VA_LIST(bool bStart = true, int iFlags = 0, ImVec2 vOffset = {}, ImVec2 vSize = { H::Draw.Scale(12), H::Draw.Scale(12) }, ImVec2 vIconOffset = {}), VA_LIST(bStart ? &val.StartColor : &val.EndColor, iFlags, vOffset, vSize, vIconOffset)) } \ No newline at end of file diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.cpp b/Amalgam/src/Features/ImGui/Menu/Menu.cpp index 88668ce2..99f30b76 100644 --- a/Amalgam/src/Features/ImGui/Menu/Menu.cpp +++ b/Amalgam/src/Features/ImGui/Menu/Menu.cpp @@ -150,13 +150,13 @@ void CMenu::MenuAimbot(int iTab) FDropdown(Vars::Aimbot::General::Ignore, FDropdownEnum::Right); FSlider(Vars::Aimbot::General::AimFOV); FSlider(Vars::Aimbot::General::MaxTargets, FSliderEnum::Left); - PushTransparent(!(FGet(Vars::Aimbot::General::Ignore) & Vars::Aimbot::General::IgnoreEnum::Cloaked)); + PushTransparent(!(Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Cloaked)); { FSlider(Vars::Aimbot::General::IgnoreCloak, FSliderEnum::Right); } PopTransparent(); FSlider(Vars::Aimbot::General::AssistStrength, FSliderEnum::Left); - PushTransparent(!(FGet(Vars::Aimbot::General::Ignore) & Vars::Aimbot::General::IgnoreEnum::Unsimulated)); + PushTransparent(!(Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Unsimulated)); { FSlider(Vars::Aimbot::General::TickTolerance, FSliderEnum::Right); } @@ -221,10 +221,9 @@ void CMenu::MenuAimbot(int iTab) FDropdown(Vars::Aimbot::Hitscan::Hitboxes, FDropdownEnum::Left); FDropdown(Vars::Aimbot::Hitscan::Modifiers, FDropdownEnum::Right); FSlider(Vars::Aimbot::Hitscan::PointScale); - PushTransparent(!(FGet(Vars::Aimbot::Hitscan::Modifiers) & Vars::Aimbot::Hitscan::ModifiersEnum::Tapfire)); + PushTransparent(!(Vars::Aimbot::Hitscan::Modifiers.Value & Vars::Aimbot::Hitscan::ModifiersEnum::Tapfire)); { - //FSlider(Vars::Aimbot::Hitscan::TapFireDist); - FSlider("Tapfire distance", &Vars::Aimbot::Hitscan::TapFireDist[DEFAULT_BIND], 0.f, 1000.f); + FSlider(Vars::Aimbot::Hitscan::TapFireDist); } PopTransparent(); } EndSection(); @@ -245,14 +244,14 @@ void CMenu::MenuAimbot(int iTab) FDropdown(Vars::Aimbot::Projectile::Hitboxes, FDropdownEnum::Left); FDropdown(Vars::Aimbot::Projectile::Modifiers, FDropdownEnum::Right); FSlider(Vars::Aimbot::Projectile::MaxSimulationTime, FSliderEnum::Left); - PushTransparent(!FGet(Vars::Aimbot::Projectile::StrafePrediction)); + PushTransparent(!Vars::Aimbot::Projectile::StrafePrediction.Value); { FSlider(Vars::Aimbot::Projectile::HitChance, FSliderEnum::Right); } PopTransparent(); FSlider(Vars::Aimbot::Projectile::AutodetRadius, FSliderEnum::Left); FSlider(Vars::Aimbot::Projectile::SplashRadius, FSliderEnum::Right); - PushTransparent(!FGet(Vars::Aimbot::Projectile::AutoRelease)); + PushTransparent(!Vars::Aimbot::Projectile::AutoRelease.Value); { FSlider(Vars::Aimbot::Projectile::AutoRelease); } @@ -350,19 +349,19 @@ void CMenu::MenuAimbot(int iTab) FToggle(Vars::Doubletap::AntiWarp, FToggleEnum::Right); FSlider(Vars::Doubletap::TickLimit, FSliderEnum::Left); FSlider(Vars::Doubletap::WarpRate, FSliderEnum::Right); - FSlider(Vars::Doubletap::PassiveRecharge, FSliderEnum::Left); - FSlider(Vars::Doubletap::RechargeLimit, FSliderEnum::Right); + FSlider(Vars::Doubletap::RechargeLimit, FSliderEnum::Left); + FSlider(Vars::Doubletap::PassiveRecharge, FSliderEnum::Right); } EndSection(); if (Section("Fakelag")) { FDropdown(Vars::Fakelag::Fakelag, FSliderEnum::Left); FDropdown(Vars::Fakelag::Options, FDropdownEnum::Right); - PushTransparent(FGet(Vars::Fakelag::Fakelag) != Vars::Fakelag::FakelagEnum::Plain); + PushTransparent(Vars::Fakelag::Fakelag.Value != Vars::Fakelag::FakelagEnum::Plain); { FSlider(Vars::Fakelag::PlainTicks, FSliderEnum::Left); } PopTransparent(); - PushTransparent(FGet(Vars::Fakelag::Fakelag) != Vars::Fakelag::FakelagEnum::Random); + PushTransparent(Vars::Fakelag::Fakelag.Value != Vars::Fakelag::FakelagEnum::Random); { FSlider(Vars::Fakelag::RandomTicks, FSliderEnum::Right); } @@ -388,17 +387,17 @@ void CMenu::MenuAimbot(int iTab) FDropdown(Vars::AntiAim::FakeYawMode, FDropdownEnum::Right); FSlider(Vars::AntiAim::RealYawOffset, FSliderEnum::Left); FSlider(Vars::AntiAim::FakeYawOffset, FSliderEnum::Right); - PushTransparent(FGet(Vars::AntiAim::YawReal) != Vars::AntiAim::YawEnum::Edge && FGet(Vars::AntiAim::YawReal) != Vars::AntiAim::YawEnum::Jitter); + PushTransparent(Vars::AntiAim::YawReal.Value != Vars::AntiAim::YawEnum::Edge && Vars::AntiAim::YawReal.Value != Vars::AntiAim::YawEnum::Jitter); { FSlider(Vars::AntiAim::RealYawValue, FSliderEnum::Left); } PopTransparent(); - PushTransparent(FGet(Vars::AntiAim::YawFake) != Vars::AntiAim::YawEnum::Edge && FGet(Vars::AntiAim::YawFake) != Vars::AntiAim::YawEnum::Jitter); + PushTransparent(Vars::AntiAim::YawFake.Value != Vars::AntiAim::YawEnum::Edge && Vars::AntiAim::YawFake.Value != Vars::AntiAim::YawEnum::Jitter); { FSlider(Vars::AntiAim::FakeYawValue, FSliderEnum::Right); } PopTransparent(); - PushTransparent(FGet(Vars::AntiAim::YawFake) != Vars::AntiAim::YawEnum::Spin && FGet(Vars::AntiAim::YawReal) != Vars::AntiAim::YawEnum::Spin); + PushTransparent(Vars::AntiAim::YawFake.Value != Vars::AntiAim::YawEnum::Spin && Vars::AntiAim::YawReal.Value != Vars::AntiAim::YawEnum::Spin); { FSlider(Vars::AntiAim::SpinSpeed, FSliderEnum::Left); } @@ -415,19 +414,19 @@ void CMenu::MenuAimbot(int iTab) if (Section("Resolver", 8)) { FToggle(Vars::Resolver::Enabled, FToggleEnum::Left); - PushTransparent(!FGet(Vars::Resolver::Enabled)); + PushTransparent(!Vars::Resolver::Enabled.Value); { FToggle(Vars::Resolver::AutoResolve, FToggleEnum::Right); - PushTransparent(Transparent || !FGet(Vars::Resolver::AutoResolve)); + PushTransparent(Transparent || !Vars::Resolver::AutoResolve.Value); { FToggle(Vars::Resolver::AutoResolveCheatersOnly, FToggleEnum::Left); FToggle(Vars::Resolver::AutoResolveHeadshotOnly, FToggleEnum::Right); - PushTransparent(Transparent || !FGet(Vars::Resolver::AutoResolveYawAmount)); + PushTransparent(Transparent || !Vars::Resolver::AutoResolveYawAmount.Value); { FSlider(Vars::Resolver::AutoResolveYawAmount, FSliderEnum::Left); } PopTransparent(); - PushTransparent(Transparent || !FGet(Vars::Resolver::AutoResolvePitchAmount)); + PushTransparent(Transparent || !Vars::Resolver::AutoResolvePitchAmount.Value); { FSlider(Vars::Resolver::AutoResolvePitchAmount, FSliderEnum::Right); } @@ -448,17 +447,17 @@ void CMenu::MenuAimbot(int iTab) if (Section("Cheater Detection")) { FDropdown(Vars::CheaterDetection::Methods); - PushTransparent(!FGet(Vars::CheaterDetection::DetectionsRequired)); + PushTransparent(!Vars::CheaterDetection::DetectionsRequired.Value); { FSlider(Vars::CheaterDetection::DetectionsRequired); } PopTransparent(); - PushTransparent(!(FGet(Vars::CheaterDetection::Methods) & Vars::CheaterDetection::MethodsEnum::PacketChoking)); + PushTransparent(!(Vars::CheaterDetection::Methods.Value & Vars::CheaterDetection::MethodsEnum::PacketChoking)); { FSlider(Vars::CheaterDetection::MinimumChoking); } PopTransparent(); - PushTransparent(!(FGet(Vars::CheaterDetection::Methods) & Vars::CheaterDetection::MethodsEnum::AimFlicking)); + PushTransparent(!(Vars::CheaterDetection::Methods.Value & Vars::CheaterDetection::MethodsEnum::AimFlicking)); { FSlider(Vars::CheaterDetection::MinimumFlick, FSliderEnum::Left); FSlider(Vars::CheaterDetection::MaximumNoise, FSliderEnum::Right); @@ -468,7 +467,7 @@ void CMenu::MenuAimbot(int iTab) if (Section("Speedhack", 8)) { FToggle(Vars::Speedhack::Enabled); - PushTransparent(!FGet(Vars::Speedhack::Enabled)); + PushTransparent(!Vars::Speedhack::Enabled.Value); { FSlider(Vars::Speedhack::Amount); } @@ -489,32 +488,28 @@ void CMenu::MenuAimbot(int iTab) { if (Section("Line", 8)) { - FColorPicker(Vars::Colors::LineClipped, 0); - FColorPicker(Vars::Colors::Line, 1); + FColorPicker(Vars::Colors::Line, FColorPickerEnum::None, { -H::Draw.Scale(12), 0 }); + FColorPicker(Vars::Colors::LineClipped); FToggle(Vars::Visuals::Line::Enabled); FSlider(Vars::Visuals::Line::DrawDuration); } EndSection(); if (Section("Hitbox")) { - FDropdown(Vars::Visuals::Hitbox::BonesEnabled, FDropdownEnum::None, -110); - FColorPicker(Vars::Colors::TargetHitboxEdge, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); - FColorPicker(Vars::Colors::TargetHitboxEdgeClipped, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); - SameLine(); DebugDummy({ H::Draw.Scale(2), 0 }); - FColorPicker(Vars::Colors::TargetHitboxFace, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); - FColorPicker(Vars::Colors::TargetHitboxFaceClipped, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); - SameLine(); DebugDummy({ H::Draw.Scale(2), 0 }); - FColorPicker(Vars::Colors::BoneHitboxEdge, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); - FColorPicker(Vars::Colors::BoneHitboxEdgeClipped, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); - SameLine(); DebugDummy({ H::Draw.Scale(2), 0 }); - FColorPicker(Vars::Colors::BoneHitboxFace, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); - FColorPicker(Vars::Colors::BoneHitboxFaceClipped, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); + FDropdown(Vars::Visuals::Hitbox::BonesEnabled, FDropdownEnum::None, -50); + FColorPicker(Vars::Colors::BoneHitboxEdge, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(20) }); + FColorPicker(Vars::Colors::BoneHitboxEdgeClipped, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(20) }); + FColorPicker(Vars::Colors::BoneHitboxFace, FColorPickerEnum::SameLine, { H::Draw.Scale(10), 0 }, { H::Draw.Scale(10), H::Draw.Scale(20) }); + FColorPicker(Vars::Colors::BoneHitboxFaceClipped, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(20) }); + FColorPicker(Vars::Colors::TargetHitboxEdge, FColorPickerEnum::SameLine, { -H::Draw.Scale(50), H::Draw.Scale(20) }, { H::Draw.Scale(10), H::Draw.Scale(20) }); + FColorPicker(Vars::Colors::TargetHitboxEdgeClipped, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(20) }); + FColorPicker(Vars::Colors::TargetHitboxFace, FColorPickerEnum::SameLine, { H::Draw.Scale(10), 0 }, { H::Draw.Scale(10), H::Draw.Scale(20) }); + FColorPicker(Vars::Colors::TargetHitboxFaceClipped, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(20) }); FDropdown(Vars::Visuals::Hitbox::BoundsEnabled, FDropdownEnum::None, -50); - FColorPicker(Vars::Colors::BoundHitboxEdge, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); - FColorPicker(Vars::Colors::BoundHitboxEdgeClipped, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); - SameLine(); DebugDummy({ H::Draw.Scale(2), 0 }); - FColorPicker(Vars::Colors::BoundHitboxFace, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); - FColorPicker(Vars::Colors::BoundHitboxFaceClipped, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); + FColorPicker(Vars::Colors::BoundHitboxEdge, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) }); + FColorPicker(Vars::Colors::BoundHitboxEdgeClipped, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) }); + FColorPicker(Vars::Colors::BoundHitboxFace, FColorPickerEnum::SameLine, { H::Draw.Scale(10), 0 }, { H::Draw.Scale(10), H::Draw.Scale(40) }); + FColorPicker(Vars::Colors::BoundHitboxFaceClipped, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) }); FSlider(Vars::Visuals::Hitbox::DrawDuration); } EndSection(); @@ -525,34 +520,34 @@ void CMenu::MenuAimbot(int iTab) if (Section("Simulation")) { FDropdown(Vars::Visuals::Simulation::PlayerPath, FDropdownEnum::Left, -20); - FColorPicker(Vars::Colors::PlayerPath, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); - FColorPicker(Vars::Colors::PlayerPathClipped, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); + FColorPicker(Vars::Colors::PlayerPath, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) }); + FColorPicker(Vars::Colors::PlayerPathClipped, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) }); FDropdown(Vars::Visuals::Simulation::ProjectilePath, FDropdownEnum::Right, -20); - FColorPicker(Vars::Colors::ProjectilePath, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); - FColorPicker(Vars::Colors::ProjectilePathClipped, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); + FColorPicker(Vars::Colors::ProjectilePath, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) }); + FColorPicker(Vars::Colors::ProjectilePathClipped, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) }); FDropdown(Vars::Visuals::Simulation::TrajectoryPath, FDropdownEnum::Left, -20); - FColorPicker(Vars::Colors::TrajectoryPath, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); - FColorPicker(Vars::Colors::TrajectoryPathClipped, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); + FColorPicker(Vars::Colors::TrajectoryPath, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) }); + FColorPicker(Vars::Colors::TrajectoryPathClipped, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) }); FDropdown(Vars::Visuals::Simulation::ShotPath, FDropdownEnum::Right, -20); - FColorPicker(Vars::Colors::ShotPath, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); - FColorPicker(Vars::Colors::ShotPathClipped, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); + FColorPicker(Vars::Colors::ShotPath, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) }); + FColorPicker(Vars::Colors::ShotPathClipped, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) }); FDropdown(Vars::Visuals::Simulation::SplashRadius, FDropdownEnum::None, -20); - FColorPicker(Vars::Colors::SplashRadius, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); - FColorPicker(Vars::Colors::SplashRadiusClipped, 0, FColorPickerEnum::Dropdown | FColorPickerEnum::Tooltip); + FColorPicker(Vars::Colors::SplashRadius, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) }); + FColorPicker(Vars::Colors::SplashRadiusClipped, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) }); FToggle(Vars::Visuals::Simulation::Timed, FToggleEnum::Left); FToggle(Vars::Visuals::Simulation::Box, FToggleEnum::Right); FToggle(Vars::Visuals::Simulation::ProjectileCamera, FToggleEnum::Left); FToggle(Vars::Visuals::Simulation::SwingLines, FToggleEnum::Right); - PushTransparent(FGet(Vars::Visuals::Simulation::Timed)); - { - FSlider(Vars::Visuals::Simulation::DrawDuration); - } - PopTransparent(); + FSlider(Vars::Visuals::Simulation::DrawDuration); } EndSection(); if (Vars::Debug::Options.Value) { - if (Section("##Debug Part1")) + if (Section("##Debug Part1", -8)) { + FDropdown(Vars::Visuals::Simulation::RealPath, FDropdownEnum::None, -20); + FColorPicker(Vars::Colors::RealPath); + FColorPicker(Vars::Colors::RealPathClipped); + FSlider(Vars::Visuals::Simulation::SeparatorSpacing, FSliderEnum::Left); FSlider(Vars::Visuals::Simulation::SeparatorLength, FSliderEnum::Right); } EndSection(); @@ -607,22 +602,22 @@ void CMenu::MenuVisuals(int iTab) if (Section("ESP")) { FDropdown(Vars::ESP::Draw); - PushTransparent(!(FGet(Vars::ESP::Draw) & Vars::ESP::DrawEnum::Players)); + PushTransparent(!(Vars::ESP::Draw.Value & Vars::ESP::DrawEnum::Players)); { FDropdown(Vars::ESP::Player); } PopTransparent(); - PushTransparent(!(FGet(Vars::ESP::Draw) & Vars::ESP::DrawEnum::Buildings)); + PushTransparent(!(Vars::ESP::Draw.Value & Vars::ESP::DrawEnum::Buildings)); { FDropdown(Vars::ESP::Building); } PopTransparent(); - PushTransparent(!(FGet(Vars::ESP::Draw) & Vars::ESP::DrawEnum::Projectiles)); + PushTransparent(!(Vars::ESP::Draw.Value & Vars::ESP::DrawEnum::Projectiles)); { FDropdown(Vars::ESP::Projectile); } PopTransparent(); - PushTransparent(!(FGet(Vars::ESP::Draw) & Vars::ESP::DrawEnum::Objective)); + PushTransparent(!(Vars::ESP::Draw.Value & Vars::ESP::DrawEnum::Objective)); { FDropdown(Vars::ESP::Objective); } @@ -643,22 +638,22 @@ void CMenu::MenuVisuals(int iTab) FToggle(Vars::Colors::Relative); if (FGet(Vars::Colors::Relative)) { - FColorPicker(Vars::Colors::Enemy, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::Team, 0, FColorPickerEnum::Middle); + FColorPicker(Vars::Colors::Enemy, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::Team, FColorPickerEnum::Right); } else { - FColorPicker(Vars::Colors::TeamRed, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::TeamBlu, 0, FColorPickerEnum::Middle); + FColorPicker(Vars::Colors::TeamRed, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::TeamBlu, FColorPickerEnum::Right); } - FColorPicker(Vars::Colors::Local, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::Target, 0, FColorPickerEnum::Middle); - FColorPicker(Vars::Colors::Health, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::Ammo, 0, FColorPickerEnum::Middle); - FColorPicker(Vars::Colors::Money, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::Powerup, 0, FColorPickerEnum::Middle); - FColorPicker(Vars::Colors::NPC, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::Halloween, 0, FColorPickerEnum::Middle); + FColorPicker(Vars::Colors::Local, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::Target, FColorPickerEnum::Right); + FColorPicker(Vars::Colors::Health, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::Ammo, FColorPickerEnum::Right); + FColorPicker(Vars::Colors::Money, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::Powerup, FColorPickerEnum::Right); + FColorPicker(Vars::Colors::NPC, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::Halloween, FColorPickerEnum::Right); } EndSection(); if (Section("Dormancy", 8)) { @@ -768,31 +763,31 @@ void CMenu::MenuVisuals(int iTab) FToggle(Vars::Colors::Relative); if (FGet(Vars::Colors::Relative)) { - FColorPicker(Vars::Colors::Enemy, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::Team, 0, FColorPickerEnum::Middle); + FColorPicker(Vars::Colors::Enemy, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::Team, FColorPickerEnum::Right); } else { - FColorPicker(Vars::Colors::TeamRed, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::TeamBlu, 0, FColorPickerEnum::Middle); + FColorPicker(Vars::Colors::TeamRed, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::TeamBlu, FColorPickerEnum::Right); } - FColorPicker(Vars::Colors::Local, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::Target, 0, FColorPickerEnum::Middle); - FColorPicker(Vars::Colors::Health, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::Ammo, 0, FColorPickerEnum::Middle); - FColorPicker(Vars::Colors::Money, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::Powerup, 0, FColorPickerEnum::Middle); - FColorPicker(Vars::Colors::NPC, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::Halloween, 0, FColorPickerEnum::Middle); + FColorPicker(Vars::Colors::Local, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::Target, FColorPickerEnum::Right); + FColorPicker(Vars::Colors::Health, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::Ammo, FColorPickerEnum::Right); + FColorPicker(Vars::Colors::Money, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::Powerup, FColorPickerEnum::Right); + FColorPicker(Vars::Colors::NPC, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::Halloween, FColorPickerEnum::Right); // may move these colors over to other spots - PushTransparent(!FGet(Vars::Colors::Backtrack).a); + PushTransparent(!Vars::Colors::Backtrack.Value.a); { - FColorPicker(Vars::Colors::Backtrack, 0, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::Backtrack, FColorPickerEnum::Left); } PopTransparent(); - PushTransparent(!FGet(Vars::Colors::FakeAngle).a); + PushTransparent(!Vars::Colors::FakeAngle.Value.a); { - FColorPicker(Vars::Colors::FakeAngle, 0, FColorPickerEnum::Middle); + FColorPicker(Vars::Colors::FakeAngle, FColorPickerEnum::Right); } PopTransparent(); } EndSection(); @@ -896,7 +891,7 @@ void CMenu::MenuVisuals(int iTab) FMDropdown(Vars::Chams::Player::Visible, FDropdownEnum::Left); FMDropdown(Vars::Chams::Player::Occluded, FDropdownEnum::Right); } EndSection(); - bool bRelative = FGet(Vars::Chams::Relative); + bool bRelative = Vars::Chams::Relative.Value; if (Section("##Settings")) { auto vTable = WidgetTable(3, H::Draw.Scale(24)); @@ -1003,12 +998,12 @@ void CMenu::MenuVisuals(int iTab) FToggle(Vars::Glow::Player::Party, FToggleEnum::Right); FToggle(Vars::Glow::Player::Target, FToggleEnum::Left); - PushTransparent(!FGet(Vars::Glow::Player::Stencil)); + PushTransparent(!Vars::Glow::Player::Stencil.Value); { FSlider(Vars::Glow::Player::Stencil, FSliderEnum::Left); } PopTransparent(); - PushTransparent(!FGet(Vars::Glow::Player::Blur)); + PushTransparent(!Vars::Glow::Player::Blur.Value); { FSlider(Vars::Glow::Player::Blur, FSliderEnum::Right); } @@ -1021,12 +1016,12 @@ void CMenu::MenuVisuals(int iTab) FToggle(Vars::Glow::Enemy::Buildings, FToggleEnum::Left); FToggle(Vars::Glow::Enemy::Projectiles, FToggleEnum::Right); - PushTransparent(!FGet(Vars::Glow::Enemy::Stencil)); + PushTransparent(!Vars::Glow::Enemy::Stencil.Value); { FSlider(Vars::Glow::Enemy::Stencil, FSliderEnum::Left); } PopTransparent(); - PushTransparent(!FGet(Vars::Glow::Enemy::Blur)); + PushTransparent(!Vars::Glow::Enemy::Blur.Value); { FSlider(Vars::Glow::Enemy::Blur, FSliderEnum::Right); } @@ -1039,12 +1034,12 @@ void CMenu::MenuVisuals(int iTab) FToggle(Vars::Glow::Team::Buildings, FToggleEnum::Left); FToggle(Vars::Glow::Team::Projectiles, FToggleEnum::Right); - PushTransparent(!FGet(Vars::Glow::Team::Stencil)); + PushTransparent(!Vars::Glow::Team::Stencil.Value); { FSlider(Vars::Glow::Team::Stencil, FSliderEnum::Left); } PopTransparent(); - PushTransparent(!FGet(Vars::Glow::Team::Blur)); + PushTransparent(!Vars::Glow::Team::Blur.Value); { FSlider(Vars::Glow::Team::Blur, FSliderEnum::Right); } @@ -1063,12 +1058,12 @@ void CMenu::MenuVisuals(int iTab) FToggle(Vars::Glow::World::Bombs, FToggleEnum::Left); FToggle(Vars::Glow::World::Halloween, FToggleEnum::Right); - PushTransparent(!FGet(Vars::Glow::World::Stencil)); + PushTransparent(!Vars::Glow::World::Stencil.Value); { FSlider(Vars::Glow::World::Stencil, FSliderEnum::Left); } PopTransparent(); - PushTransparent(!FGet(Vars::Glow::World::Blur)); + PushTransparent(!Vars::Glow::World::Blur.Value); { FSlider(Vars::Glow::World::Blur, FSliderEnum::Right); } @@ -1077,18 +1072,18 @@ void CMenu::MenuVisuals(int iTab) if (Section("Backtrack", 8)) { FToggle(Vars::Glow::Backtrack::Enabled, FToggleEnum::Left); - PushTransparent(!FGet(Vars::Colors::Backtrack).a); + PushTransparent(!Vars::Colors::Backtrack.Value.a); { - FColorPicker(Vars::Colors::Backtrack, 0, FColorPickerEnum::Middle); + FColorPicker(Vars::Colors::Backtrack, FColorPickerEnum::Right); } PopTransparent(); - PushTransparent(!FGet(Vars::Glow::Backtrack::Stencil)); + PushTransparent(!Vars::Glow::Backtrack::Stencil.Value); { FSlider(Vars::Glow::Backtrack::Stencil, FSliderEnum::Left); } PopTransparent(); - PushTransparent(!FGet(Vars::Glow::Backtrack::Blur)); + PushTransparent(!Vars::Glow::Backtrack::Blur.Value); { FSlider(Vars::Glow::Backtrack::Blur, FSliderEnum::Right); } @@ -1098,18 +1093,18 @@ void CMenu::MenuVisuals(int iTab) if (Section("Fake Angle", 8)) { FToggle(Vars::Glow::FakeAngle::Enabled, FToggleEnum::Left); - PushTransparent(!FGet(Vars::Colors::FakeAngle).a); + PushTransparent(!Vars::Colors::FakeAngle.Value.a); { - FColorPicker(Vars::Colors::FakeAngle, 0, FColorPickerEnum::Middle); + FColorPicker(Vars::Colors::FakeAngle, FColorPickerEnum::Right); } PopTransparent(); - PushTransparent(!FGet(Vars::Glow::FakeAngle::Stencil)); + PushTransparent(!Vars::Glow::FakeAngle::Stencil.Value); { FSlider(Vars::Glow::FakeAngle::Stencil, FSliderEnum::Left); } PopTransparent(); - PushTransparent(!FGet(Vars::Glow::FakeAngle::Blur)); + PushTransparent(!Vars::Glow::FakeAngle::Blur.Value); { FSlider(Vars::Glow::FakeAngle::Blur, FSliderEnum::Right); } @@ -1120,12 +1115,12 @@ void CMenu::MenuVisuals(int iTab) FToggle(Vars::Glow::Viewmodel::Weapon, FToggleEnum::Left); FToggle(Vars::Glow::Viewmodel::Hands, FToggleEnum::Right); - PushTransparent(!FGet(Vars::Glow::Viewmodel::Stencil)); + PushTransparent(!Vars::Glow::Viewmodel::Stencil.Value); { FSlider(Vars::Glow::Viewmodel::Stencil, FSliderEnum::Left); } PopTransparent(); - PushTransparent(!FGet(Vars::Glow::Viewmodel::Blur)); + PushTransparent(!Vars::Glow::Viewmodel::Blur.Value); { FSlider(Vars::Glow::Viewmodel::Blur, FSliderEnum::Right); } @@ -1170,7 +1165,7 @@ void CMenu::MenuVisuals(int iTab) FSDropdown(Vars::Visuals::Effects::MedigunCharge, FDropdownEnum::Right); FSDropdown(Vars::Visuals::Effects::ProjectileTrail, FDropdownEnum::Left); FDropdown(Vars::Visuals::Effects::SpellFootsteps, FDropdownEnum::Right, -10); - FColorPicker(Vars::Colors::SpellFootstep, 0, FColorPickerEnum::Dropdown); + FColorPicker(Vars::Colors::SpellFootstep, FColorPickerEnum::SameLine | FColorPickerEnum::NoTooltip, {}, { H::Draw.Scale(10), H::Draw.Scale(40) }); FDropdown(Vars::Visuals::Effects::RagdollEffects); FToggle(Vars::Visuals::Effects::DrawIconsThroughWalls); FToggle(Vars::Visuals::Effects::DrawDamageNumbersThroughWalls); @@ -1185,14 +1180,14 @@ void CMenu::MenuVisuals(int iTab) FSlider(Vars::Visuals::Viewmodel::Yaw, FSliderEnum::Right); FSlider(Vars::Visuals::Viewmodel::OffsetZ, FSliderEnum::Left); FSlider(Vars::Visuals::Viewmodel::Roll, FSliderEnum::Right); - PushTransparent(!FGet(Vars::Visuals::Viewmodel::SwayScale) || !FGet(Vars::Visuals::Viewmodel::SwayInterp)); + PushTransparent(!Vars::Visuals::Viewmodel::SwayScale.Value || !Vars::Visuals::Viewmodel::SwayInterp.Value); { FSlider(Vars::Visuals::Viewmodel::SwayScale, FSliderEnum::Left); FSlider(Vars::Visuals::Viewmodel::SwayInterp, FSliderEnum::Right); } PopTransparent(); /* - PushTransparent(!FGet(Vars::Visuals::Viewmodel::FieldOfView)); + PushTransparent(!Vars::Visuals::Viewmodel::FieldOfView.Value); { FSlider(Vars::Visuals::Viewmodel::FieldOfView); } @@ -1223,17 +1218,17 @@ void CMenu::MenuVisuals(int iTab) { FDropdown(Vars::Visuals::UI::StreamerMode, FDropdownEnum::Left); FDropdown(Vars::Visuals::UI::ChatTags, FDropdownEnum::Right); - PushTransparent(!FGet(Vars::Visuals::UI::FieldOfView)); + PushTransparent(!Vars::Visuals::UI::FieldOfView.Value); { FSlider(Vars::Visuals::UI::FieldOfView); } PopTransparent(); - PushTransparent(!FGet(Vars::Visuals::UI::ZoomFieldOfView)); + PushTransparent(!Vars::Visuals::UI::ZoomFieldOfView.Value); { FSlider(Vars::Visuals::UI::ZoomFieldOfView); } PopTransparent(); - PushTransparent(!FGet(Vars::Visuals::UI::AspectRatio)); + PushTransparent(!Vars::Visuals::UI::AspectRatio.Value); { FSlider(Vars::Visuals::UI::AspectRatio); } @@ -1248,29 +1243,29 @@ void CMenu::MenuVisuals(int iTab) FDropdown(Vars::Visuals::World::Modulations); FSDropdown(Vars::Visuals::World::WorldTexture, FDropdownEnum::Left); FSDropdown(Vars::Visuals::World::SkyboxChanger, FDropdownEnum::Right); - PushTransparent(!(FGet(Vars::Visuals::World::Modulations) & Vars::Visuals::World::ModulationsEnum::World)); + PushTransparent(!(Vars::Visuals::World::Modulations.Value & Vars::Visuals::World::ModulationsEnum::World)); { - FColorPicker(Vars::Colors::WorldModulation, 0, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::WorldModulation, FColorPickerEnum::Left); } PopTransparent(); - PushTransparent(!(FGet(Vars::Visuals::World::Modulations) & Vars::Visuals::World::ModulationsEnum::Sky)); + PushTransparent(!(Vars::Visuals::World::Modulations.Value & Vars::Visuals::World::ModulationsEnum::Sky)); { - FColorPicker(Vars::Colors::SkyModulation, 0, FColorPickerEnum::Middle); + FColorPicker(Vars::Colors::SkyModulation, FColorPickerEnum::Right); } PopTransparent(); - PushTransparent(!(FGet(Vars::Visuals::World::Modulations) & Vars::Visuals::World::ModulationsEnum::Prop)); + PushTransparent(!(Vars::Visuals::World::Modulations.Value & Vars::Visuals::World::ModulationsEnum::Prop)); { - FColorPicker(Vars::Colors::PropModulation, 0, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::PropModulation, FColorPickerEnum::Left); } PopTransparent(); - PushTransparent(!(FGet(Vars::Visuals::World::Modulations) & Vars::Visuals::World::ModulationsEnum::Particle)); + PushTransparent(!(Vars::Visuals::World::Modulations.Value & Vars::Visuals::World::ModulationsEnum::Particle)); { - FColorPicker(Vars::Colors::ParticleModulation, 0, FColorPickerEnum::Middle); + FColorPicker(Vars::Colors::ParticleModulation, FColorPickerEnum::Right); } PopTransparent(); - PushTransparent(!(FGet(Vars::Visuals::World::Modulations) & Vars::Visuals::World::ModulationsEnum::Fog)); + PushTransparent(!(Vars::Visuals::World::Modulations.Value & Vars::Visuals::World::ModulationsEnum::Fog)); { - FColorPicker(Vars::Colors::FogModulation, 0, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::FogModulation, FColorPickerEnum::Left); } PopTransparent(); FToggle(Vars::Visuals::World::NearPropFade, FToggleEnum::Left); @@ -1351,10 +1346,10 @@ void CMenu::MenuVisuals(int iTab) { if (Section("Menu", 8)) { - FColorPicker(Vars::Menu::Theme::Accent, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Menu::Theme::Background, 0, FColorPickerEnum::Middle); - FColorPicker(Vars::Menu::Theme::Active, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Menu::Theme::Inactive, 0, FColorPickerEnum::Middle); + FColorPicker(Vars::Menu::Theme::Accent, FColorPickerEnum::Left); + FColorPicker(Vars::Menu::Theme::Background, FColorPickerEnum::Right); + FColorPicker(Vars::Menu::Theme::Active, FColorPickerEnum::Left); + FColorPicker(Vars::Menu::Theme::Inactive, FColorPickerEnum::Right); FSDropdown(Vars::Menu::CheatTitle, FDropdownEnum::Left); FSDropdown(Vars::Menu::CheatTag, FDropdownEnum::Right); @@ -1376,14 +1371,14 @@ void CMenu::MenuVisuals(int iTab) { if (Section("##Debug")) { - FColorPicker(Vars::Colors::IndicatorGood, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::IndicatorTextGood, 0, FColorPickerEnum::Middle); - FColorPicker(Vars::Colors::IndicatorBad, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::IndicatorTextBad, 0, FColorPickerEnum::Middle); - FColorPicker(Vars::Colors::IndicatorMid, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::IndicatorTextMid, 0, FColorPickerEnum::Middle); - FColorPicker(Vars::Colors::IndicatorMisc, 0, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::IndicatorTextMisc, 0, FColorPickerEnum::Middle); + FColorPicker(Vars::Colors::IndicatorGood, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::IndicatorTextGood, FColorPickerEnum::Right); + FColorPicker(Vars::Colors::IndicatorBad, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::IndicatorTextBad, FColorPickerEnum::Right); + FColorPicker(Vars::Colors::IndicatorMid, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::IndicatorTextMid, FColorPickerEnum::Right); + FColorPicker(Vars::Colors::IndicatorMisc, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::IndicatorTextMisc, FColorPickerEnum::Right); } EndSection(); } @@ -1410,7 +1405,7 @@ void CMenu::MenuMisc(int iTab) if (Section("Movement")) { FDropdown(Vars::Misc::Movement::AutoStrafe); - PushTransparent(FGet(Vars::Misc::Movement::AutoStrafe) != Vars::Misc::Movement::AutoStrafeEnum::Directional); + PushTransparent(Vars::Misc::Movement::AutoStrafe.Value != Vars::Misc::Movement::AutoStrafeEnum::Directional); { FSlider(Vars::Misc::Movement::AutoStrafeTurnScale, FSliderEnum::Left); FSlider(Vars::Misc::Movement::AutoStrafeMaxDelta, FSliderEnum::Right); @@ -1445,7 +1440,7 @@ void CMenu::MenuMisc(int iTab) FToggle(Vars::Misc::Exploits::EquipRegionUnlock, FToggleEnum::Left); FToggle(Vars::Misc::Exploits::BackpackExpander, FToggleEnum::Right); FToggle(Vars::Misc::Exploits::PingReducer); - PushTransparent(!FGet(Vars::Misc::Exploits::PingReducer)); + PushTransparent(!Vars::Misc::Exploits::PingReducer.Value); { FSlider(Vars::Misc::Exploits::PingTarget); } @@ -1922,7 +1917,7 @@ void CMenu::MenuLogs(int iTab) if (BeginChild(vTable[0].m_sName.c_str(), vTable[0].m_vSize, vTable[0].m_iWindowFlags, vTable[0].m_iChildFlags)) { FSDropdown("Name", &tTag.m_sName, {}, FDropdownEnum::Left | FSDropdownEnum::AutoUpdate, -10); - FColorPicker("Color", &tTag.m_tColor, 0, FColorPickerEnum::Dropdown); + FColorPicker("Color", &tTag.m_tColor, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) }); PushDisabled(iID == DEFAULT_TAG || iID == IGNORED_TAG); { @@ -2419,7 +2414,7 @@ void CMenu::MenuLogs(int iTab) } EndSection(); if (Section("Vote Start")) { - PushTransparent(!(FGet(Vars::Logging::Logs) & Vars::Logging::LogsEnum::VoteStart)); + PushTransparent(!(Vars::Logging::Logs.Value & Vars::Logging::LogsEnum::VoteStart)); { FDropdown(Vars::Logging::VoteStart::LogTo); } @@ -2427,7 +2422,7 @@ void CMenu::MenuLogs(int iTab) } EndSection(); if (Section("Vote Cast")) { - PushTransparent(!(FGet(Vars::Logging::Logs) & Vars::Logging::LogsEnum::VoteCast)); + PushTransparent(!(Vars::Logging::Logs.Value & Vars::Logging::LogsEnum::VoteCast)); { FDropdown(Vars::Logging::VoteCast::LogTo); } @@ -2435,7 +2430,7 @@ void CMenu::MenuLogs(int iTab) } EndSection(); if (Section("Class Change")) { - PushTransparent(!(FGet(Vars::Logging::Logs) & Vars::Logging::LogsEnum::ClassChanges)); + PushTransparent(!(Vars::Logging::Logs.Value & Vars::Logging::LogsEnum::ClassChanges)); { FDropdown(Vars::Logging::ClassChange::LogTo); } @@ -2447,7 +2442,7 @@ void CMenu::MenuLogs(int iTab) { if (Section("Damage")) { - PushTransparent(!(FGet(Vars::Logging::Logs) & Vars::Logging::LogsEnum::Damage)); + PushTransparent(!(Vars::Logging::Logs.Value & Vars::Logging::LogsEnum::Damage)); { FDropdown(Vars::Logging::Damage::LogTo); } @@ -2455,7 +2450,7 @@ void CMenu::MenuLogs(int iTab) } EndSection(); if (Section("Cheat Detection")) { - PushTransparent(!(FGet(Vars::Logging::Logs) & Vars::Logging::LogsEnum::CheatDetection)); + PushTransparent(!(Vars::Logging::Logs.Value & Vars::Logging::LogsEnum::CheatDetection)); { FDropdown(Vars::Logging::CheatDetection::LogTo); } @@ -2463,7 +2458,7 @@ void CMenu::MenuLogs(int iTab) } EndSection(); if (Section("Tags")) { - PushTransparent(!(FGet(Vars::Logging::Logs) & Vars::Logging::LogsEnum::Tags)); + PushTransparent(!(Vars::Logging::Logs.Value & Vars::Logging::LogsEnum::Tags)); { FDropdown(Vars::Logging::Tags::LogTo); } @@ -2471,7 +2466,7 @@ void CMenu::MenuLogs(int iTab) } EndSection(); if (Section("Aliases")) { - PushTransparent(!(FGet(Vars::Logging::Logs) & Vars::Logging::LogsEnum::Aliases)); + PushTransparent(!(Vars::Logging::Logs.Value & Vars::Logging::LogsEnum::Aliases)); { FDropdown(Vars::Logging::Aliases::LogTo); } @@ -2479,7 +2474,7 @@ void CMenu::MenuLogs(int iTab) } EndSection(); if (Section("Resolver")) { - PushTransparent(!(FGet(Vars::Logging::Logs) & Vars::Logging::LogsEnum::Resolver)); + PushTransparent(!(Vars::Logging::Logs.Value & Vars::Logging::LogsEnum::Resolver)); { FDropdown(Vars::Logging::Resolver::LogTo); } @@ -3316,7 +3311,7 @@ void CMenu::MenuSettings(int iTab) FToggle(Vars::Debug::Info, FToggleEnum::Left); FToggle(Vars::Debug::Logging, FToggleEnum::Right); FToggle(Vars::Debug::Options, FToggleEnum::Left); - FToggle(Vars::Debug::DrawServerHitboxes, FToggleEnum::Right, &Hovered); FTooltip("Only localhost servers", Hovered); + FToggle(Vars::Debug::DrawHitboxes, FToggleEnum::Right); FToggle(Vars::Debug::AntiAimLines, FToggleEnum::Left); FToggle(Vars::Debug::CrashLogging, FToggleEnum::Right); #ifdef DEBUG_TRACES @@ -3681,14 +3676,14 @@ void CMenu::MenuSearch(std::string sSearch) } if (iOverride == -2) break; - FColorPicker(*pVar, 0, !(i % 2) ? FColorPickerEnum::Left : FColorPickerEnum::Middle, nullptr, iOverride, iOverride); + FColorPicker(*pVar, !(i % 2) ? FColorPickerEnum::Left : FColorPickerEnum::Right, { H::Draw.Scale(12), H::Draw.Scale(12) }, {}, {}, nullptr, iOverride, iOverride); break; } case WidgetEnum::FGColorPicker: { auto pVar = pBase->As(); - FColorPicker(*pVar, true, 0, !(i % 2) ? FColorPickerEnum::Left : FColorPickerEnum::Middle, nullptr, iOverride/*, iOverride*/); - FColorPicker(*pVar, false, 0, !(++i % 2) ? FColorPickerEnum::Left : FColorPickerEnum::Middle, nullptr, iOverride/*, iOverride*/); + FColorPicker(*pVar, true, !(i % 2) ? FColorPickerEnum::Left : FColorPickerEnum::Right, { H::Draw.Scale(12), H::Draw.Scale(12) }, {}, {}, nullptr, iOverride/*, iOverride*/); + FColorPicker(*pVar, false, !(++i % 2) ? FColorPickerEnum::Left : FColorPickerEnum::Right, { H::Draw.Scale(12), H::Draw.Scale(12) }, {}, {}, nullptr, iOverride/*, iOverride*/); break; } case WidgetEnum::FKeybind: diff --git a/Amalgam/src/Features/Misc/Misc.cpp b/Amalgam/src/Features/Misc/Misc.cpp index 64a7e356..ce43dc8d 100644 --- a/Amalgam/src/Features/Misc/Misc.cpp +++ b/Amalgam/src/Features/Misc/Misc.cpp @@ -366,7 +366,7 @@ void CMisc::AutoPeek(CTFPlayer* pLocal, CUserCmd* pCmd, bool bPost) if (bReturning) { - if (vLocalPos.DistTo(m_vPeekReturnPos) < 8.f) + if (vLocalPos.DistTo2D(m_vPeekReturnPos) < 8.f) { bReturning = false; return; diff --git a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp index 7c213461..d5f9e06d 100644 --- a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp +++ b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp @@ -57,50 +57,40 @@ void CAntiAim::FakeShotAngles(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCm } G::SilentAngles = true; - pCmd->viewangles.x += 360 * (vFakeAngles.x < 0 ? -1 : 1); - - // messes with nospread accuracy - //pCmd->viewangles.x = 180 - pCmd->viewangles.x; - //pCmd->viewangles.y += 180; + if (!Vars::Aimbot::General::NoSpread.Value) + { // messes with nospread accuracy + pCmd->viewangles.x = 180 - pCmd->viewangles.x; + pCmd->viewangles.y += 180; + } + else + pCmd->viewangles.x += 360 * (vFakeAngles.x < 0 ? -1 : 1); } -float CAntiAim::EdgeDistance(CTFPlayer* pEntity, float flEdgeRayYaw, float flOffset) +static inline float EdgeDistance(CTFPlayer* pEntity, float flYaw, float flOffset) { - Vec3 vForward, vRight; Math::AngleVectors({ 0, flEdgeRayYaw, 0 }, &vForward, &vRight, nullptr); - - Vec3 vCenter = pEntity->GetCenter() + vRight * flOffset; - Vec3 vEndPos = vCenter + vForward * 300.f; + Vec3 vForward, vRight; Math::AngleVectors({ 0, flYaw, 0 }, &vForward, &vRight, nullptr); + Vec3 vCenter = pEntity->GetCenter(); CGameTrace trace = {}; CTraceFilterWorldAndPropsOnly filter = {}; - SDK::Trace(vCenter, vEndPos, MASK_SHOT | CONTENTS_GRATE, &filter, &trace); - - vEdgeTrace.emplace_back(vCenter, trace.endpos); + SDK::Trace(vCenter, vCenter + vRight * flOffset, MASK_SHOT | CONTENTS_GRATE, &filter, &trace); + F::AntiAim.vEdgeTrace.emplace_back(trace.startpos, trace.endpos); + SDK::Trace(trace.endpos, trace.endpos + vForward * 300.f, MASK_SHOT | CONTENTS_GRATE, &filter, &trace); + F::AntiAim.vEdgeTrace.emplace_back(trace.startpos, trace.endpos); return trace.fraction; } -int CAntiAim::GetEdge(CTFPlayer* pEntity, const float flEdgeOrigYaw) +static inline int GetEdge(CTFPlayer* pEntity, const float flYaw) { float flSize = pEntity->GetSize().y; - float flEdgeLeftDist = EdgeDistance(pEntity, flEdgeOrigYaw, -flSize); - float flEdgeRightDist = EdgeDistance(pEntity, flEdgeOrigYaw, flSize); + float flEdgeLeftDist = EdgeDistance(pEntity, flYaw, -flSize); + float flEdgeRightDist = EdgeDistance(pEntity, flYaw, flSize); return flEdgeLeftDist > flEdgeRightDist ? -1 : 1; } -void CAntiAim::RunOverlapping(CTFPlayer* pEntity, CUserCmd* pCmd, float& flRealYaw, bool bFake, float flEpsilon) -{ - if (!Vars::AntiAim::AntiOverlap.Value || bFake) - return; - - float flFakeYaw = GetBaseYaw(pEntity, pCmd, true) + GetYawOffset(pEntity, true); - const float flYawDiff = Math::NormalizeAngle(flRealYaw - flFakeYaw); - if (fabsf(flYawDiff) < flEpsilon) - flRealYaw += flYawDiff > 0 ? flEpsilon : -flEpsilon; -} - -inline int GetJitter(uint32_t uHash) +static inline int GetJitter(uint32_t uHash) { static std::unordered_map mJitter = {}; @@ -158,6 +148,17 @@ float CAntiAim::GetBaseYaw(CTFPlayer* pLocal, CUserCmd* pCmd, bool bFake) return pCmd->viewangles.y; } +void CAntiAim::RunOverlapping(CTFPlayer* pEntity, CUserCmd* pCmd, float& flYaw, bool bFake, float flEpsilon) +{ + if (!Vars::AntiAim::AntiOverlap.Value || bFake) + return; + + float flFakeYaw = GetBaseYaw(pEntity, pCmd, true) + GetYawOffset(pEntity, true); + const float flYawDiff = Math::NormalizeAngle(flYaw - flFakeYaw); + if (fabsf(flYawDiff) < flEpsilon) + flYaw += flYawDiff > 0 ? flEpsilon : -flEpsilon; +} + float CAntiAim::GetYaw(CTFPlayer* pLocal, CUserCmd* pCmd, bool bFake) { float flYaw = GetBaseYaw(pLocal, pCmd, bFake) + GetYawOffset(pLocal, bFake); @@ -199,7 +200,7 @@ float CAntiAim::GetPitch(float flCurPitch) void CAntiAim::MinWalk(CTFPlayer* pLocal, CUserCmd* pCmd) { - if (!Vars::AntiAim::MinWalk.Value || !F::AntiAim.YawOn() || !pLocal->m_hGroundEntity() || pLocal->InCond(TF_COND_HALLOWEEN_KART)) + if (!Vars::AntiAim::MinWalk.Value || !YawOn() || !pLocal->m_hGroundEntity() || pLocal->InCond(TF_COND_HALLOWEEN_KART)) return; if (!pCmd->forwardmove && !pCmd->sidemove && pLocal->m_vecVelocity().Length2D() < 2.f) diff --git a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h index 044309e1..3ce74d01 100644 --- a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h +++ b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h @@ -5,13 +5,10 @@ class CAntiAim { private: 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); float GetYawOffset(CTFPlayer* pEntity, bool bFake); float GetBaseYaw(CTFPlayer* pLocal, CUserCmd* pCmd, bool bFake); + void RunOverlapping(CTFPlayer* pEntity, CUserCmd* pCmd, float& flYaw, bool bFake, float flEpsilon = 45.f); float GetYaw(CTFPlayer* pLocal, CUserCmd* pCmd, bool bFake); - float GetPitch(float flCurPitch); void MinWalk(CTFPlayer* pLocal, CUserCmd* pCmd); @@ -19,8 +16,6 @@ public: bool AntiAimOn(); bool YawOn(); bool ShouldRun(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); - - int GetEdge(CTFPlayer* pEntity, float flEdgeOrigYaw); void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, bool bSendPacket); inline int AntiAimTicks() { return 2; } diff --git a/Amalgam/src/Features/Resolver/Resolver.h b/Amalgam/src/Features/Resolver/Resolver.h index 030f3f16..6cf47dc6 100644 --- a/Amalgam/src/Features/Resolver/Resolver.h +++ b/Amalgam/src/Features/Resolver/Resolver.h @@ -22,8 +22,8 @@ class CResolver void StoreSniperDots(CTFPlayerResource* pResource); std::optional GetPitchForSniperDot(CTFPlayer* pEntity, CTFPlayerResource* pResource); - std::unordered_map m_mResolverData; - std::unordered_map m_mSniperDots; + std::unordered_map m_mResolverData = {}; + std::unordered_map m_mSniperDots = {}; int m_iWaitingForTarget = -1; float m_flWaitingForDamage = 0.f; diff --git a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp index da8f652e..5e56e6fd 100644 --- a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp +++ b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp @@ -132,7 +132,7 @@ void CMovementSimulation::Store() vRecords.emplace_front( vDirection, pPlayer->m_flSimulationTime(), - pPlayer->m_nWaterLevel() >= 2 ? 2 : pPlayer->IsOnGround() ? 0 : 1, + pPlayer->IsSwimming() ? 2 : pPlayer->IsOnGround() ? 0 : 1, vVelocity, vOrigin ); @@ -364,7 +364,7 @@ bool CMovementSimulation::SetupMoveData(PlayerStorage& tStorage) tStorage.m_flSimTime = tStorage.m_pPlayer->m_flSimulationTime(); tStorage.m_flPredictedSimTime = tStorage.m_flSimTime + tStorage.m_flPredictedDelta; tStorage.m_vPredictedOrigin = tStorage.m_MoveData.m_vecAbsOrigin; - tStorage.m_bDirectMove = tStorage.m_pPlayer->IsOnGround() || tStorage.m_pPlayer->m_nWaterLevel() >= 2; + tStorage.m_bDirectMove = tStorage.m_pPlayer->IsOnGround() || tStorage.m_pPlayer->IsSwimming(); return true; } @@ -658,7 +658,7 @@ void CMovementSimulation::RunTick(PlayerStorage& tStorage, bool bPath, std::func tStorage.m_MoveData.m_flForwardMove = tStorage.m_MoveData.m_flSideMove = 0.f; float flOldSpeed = tStorage.m_MoveData.m_flClientMaxSpeed; - if (tStorage.m_pPlayer->m_bDucked() && tStorage.m_pPlayer->IsOnGround() && tStorage.m_pPlayer->m_nWaterLevel() < 2) + if (tStorage.m_pPlayer->m_bDucked() && tStorage.m_pPlayer->IsOnGround() && !tStorage.m_pPlayer->IsSwimming()) tStorage.m_MoveData.m_flClientMaxSpeed /= 3; if (tStorage.m_bBunnyHop && tStorage.m_pPlayer->IsOnGround() && !tStorage.m_pPlayer->m_bDucked()) @@ -681,7 +681,7 @@ void CMovementSimulation::RunTick(PlayerStorage& tStorage, bool bPath, std::func tStorage.m_flPredictedSimTime += tStorage.m_flPredictedDelta; } bool bLastbDirectMove = tStorage.m_bDirectMove; - tStorage.m_bDirectMove = tStorage.m_pPlayer->IsOnGround() || tStorage.m_pPlayer->m_nWaterLevel() >= 2; + tStorage.m_bDirectMove = tStorage.m_pPlayer->IsOnGround() || tStorage.m_pPlayer->IsSwimming(); if (tStorage.m_flAverageYaw) tStorage.m_MoveData.m_vecViewAngles.y -= flCorrection; diff --git a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h index e9327dfd..864c7efa 100644 --- a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h +++ b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h @@ -70,7 +70,7 @@ struct PlayerStorage bool m_bPredictNetworked = true; Vec3 m_vPredictedOrigin = {}; - std::vector m_vPath; + std::vector m_vPath = {}; bool m_bFailed = false; bool m_bInitFailed = false; @@ -102,8 +102,8 @@ private: bool m_bOldFirstTimePredicted = false; float m_flOldFrametime = 0.f; - std::unordered_map> m_mRecords; - std::unordered_map> m_mSimTimes; + std::unordered_map> m_mRecords = {}; + std::unordered_map> m_mSimTimes = {}; public: void Store(); diff --git a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp index 4b376401..0c916930 100644 --- a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp +++ b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp @@ -128,13 +128,13 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap case TF_WEAPON_FLAREGUN: { SDK::GetProjectileFireSetup(pPlayer, vAngles, { 23.5f, 12.f, bDucking ? 8.f : -3.f }, vPos, vAngle, !bTrace ? true : false, bQuick); - 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 }; + tProjInfo = { pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_flaregun_shell.mdl"), vPos, vAngle, { 0.f, 0.f, 0.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 = { pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_flaregun_shell.mdl"), vPos, vAngle, { 1.f, 1.f, 1.f }, 3000.f, 0.45f * flGravity }; + tProjInfo = { pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_flaregun_shell.mdl"), vPos, vAngle, { 0.f, 0.f, 0.f }, 3000.f, 0.45f * flGravity }; return true; } case TF_WEAPON_COMPOUND_BOW: @@ -254,51 +254,6 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap return false; } -class CTraceFilterWorldPropsObjects : public ITraceFilter -{ -public: - bool ShouldHitEntity(IHandleEntity* pServerEntity, int nContentsMask) override; - TraceType_t GetTraceType() const override; - CBaseEntity* pSkip = nullptr; -}; -bool CTraceFilterWorldPropsObjects::ShouldHitEntity(IHandleEntity* pServerEntity, int nContentsMask) -{ - if (!pServerEntity || pServerEntity == pSkip) - return false; - - auto pEntity = reinterpret_cast(pServerEntity); - - switch (pEntity->GetClassID()) - { - case ETFClassID::CBaseEntity: - case ETFClassID::CBaseDoor: - case ETFClassID::CDynamicProp: - case ETFClassID::CPhysicsProp: - case ETFClassID::CObjectCartDispenser: - case ETFClassID::CFuncTrackTrain: - case ETFClassID::CFuncConveyor: - case ETFClassID::CBaseObject: - case ETFClassID::CObjectSentrygun: - case ETFClassID::CObjectDispenser: - case ETFClassID::CObjectTeleporter: return true; - case ETFClassID::CFuncRespawnRoomVisualizer: - if (nContentsMask & MASK_PLAYERSOLID) - { - switch (pEntity->m_iTeamNum()) - { - case TF_TEAM_RED: return nContentsMask & CONTENTS_REDTEAM; - case TF_TEAM_BLUE: return nContentsMask & CONTENTS_BLUETEAM; - } - } - } - - return false; -} -TraceType_t CTraceFilterWorldPropsObjects::GetTraceType() const -{ - return TRACE_EVERYTHING; -} - bool CProjectileSimulation::GetInfo(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, Vec3 vAngles, ProjectileInfo& tProjInfo, int iFlags, float flAutoCharge) { bool InitCheck = iFlags & ProjSimEnum::InitCheck; @@ -314,11 +269,14 @@ bool CProjectileSimulation::GetInfo(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, if (!bReturn || !InitCheck) return bReturn; - const Vec3 vStart = bQuick ? pPlayer->GetEyePosition() : pPlayer->GetShootPos(); - const Vec3 vEnd = tProjInfo.m_vPos; - CGameTrace trace = {}; - CTraceFilterWorldPropsObjects filter = {}; + CTraceFilterCollideable filter = {}; filter.pSkip = pPlayer; + if (pWeapon->GetWeaponID() == TF_WEAPON_RAYGUN) + filter.iObject = OBJECT_DEFAULT; + + Vec3 vStart = bQuick ? pPlayer->GetEyePosition() : pPlayer->GetShootPos(); + Vec3 vEnd = tProjInfo.m_vPos; + SDK::TraceHull(vStart, vEnd, tProjInfo.m_vHull * -1.f, tProjInfo.m_vHull, MASK_SOLID, &filter, &trace); return !trace.DidHit(); } @@ -617,4 +575,40 @@ Vec3 CProjectileSimulation::GetVelocity() Vec3 vOut; obj->GetVelocity(&vOut, nullptr); return vOut; +} + +void CProjectileSimulation::SetupTrace(CTraceFilterCollideable& filter, int& nMask, CTFWeaponBase* pWeapon, int nTick, bool bQuick) +{ + switch (nTick) + { + case 0: + switch (pWeapon->GetWeaponID()) + { + case TF_WEAPON_RAYGUN: + filter.iObject = OBJECT_DEFAULT; + break; + case TF_WEAPON_FLAMETHROWER: + case TF_WEAPON_FLAME_BALL: + nMask |= CONTENTS_WATER; + break; + case TF_WEAPON_DRG_POMSON: + case TF_WEAPON_SYRINGEGUN_MEDIC: + case TF_WEAPON_BAT_GIFTWRAP: + if (bQuick) + filter.iPlayer = PLAYER_ALL; + } + break; + case 16: + if (bQuick) + { + switch (pWeapon->GetWeaponID()) + { + case TF_WEAPON_RAYGUN: + case TF_WEAPON_GRAPPLINGHOOK: + break; + default: + filter.iPlayer = PLAYER_ALL; + } + } + } } \ No newline at end of file diff --git a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h index 287cb06e..701af00b 100644 --- a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h +++ b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h @@ -56,6 +56,7 @@ public: void RunTick(ProjectileInfo& tProjInfo, bool bPath = true); Vec3 GetOrigin(); Vec3 GetVelocity(); + void SetupTrace(CTraceFilterCollideable& filter, int& nMask, CTFWeaponBase* pWeapon, int nTick = 0, bool bQuick = false); IPhysicsEnvironment* env = nullptr; IPhysicsObject* obj = nullptr; diff --git a/Amalgam/src/Features/Ticks/Ticks.cpp b/Amalgam/src/Features/Ticks/Ticks.cpp index 04c4b5d1..7b1606a6 100644 --- a/Amalgam/src/Features/Ticks/Ticks.cpp +++ b/Amalgam/src/Features/Ticks/Ticks.cpp @@ -248,7 +248,8 @@ void CTickshiftHandler::CLMove(float accumulated_extra_samples, bool bFinalTick) m_iMaxShift = sv_maxusrcmdprocessticks->GetInt(); if (Vars::Misc::Game::AntiCheatCompatibility.Value) m_iMaxShift = std::min(m_iMaxShift, 8); - m_iMaxShift -= std::max(24 - std::clamp(Vars::Doubletap::RechargeLimit.Value, 1, 24), F::AntiAim.YawOn() ? F::AntiAim.AntiAimTicks() : 0); + m_iMaxShift -= std::max(m_iMaxShift - Vars::Doubletap::RechargeLimit.Value, 0) + (F::AntiAim.YawOn() ? F::AntiAim.AntiAimTicks() : 0); + m_iMaxShift = std::max(m_iMaxShift, 1); while (m_iShiftedTicks > m_iMaxShift) CLMoveFunc(accumulated_extra_samples, false); // skim any excess ticks diff --git a/Amalgam/src/Features/Visuals/Materials/Materials.h b/Amalgam/src/Features/Visuals/Materials/Materials.h index 1284b049..55733aa4 100644 --- a/Amalgam/src/Features/Visuals/Materials/Materials.h +++ b/Amalgam/src/Features/Visuals/Materials/Materials.h @@ -34,8 +34,8 @@ public: void EditMaterial(const char* sName, const char* sVMT); void RemoveMaterial(const char* sName); - std::unordered_map m_mMaterials; - std::unordered_map m_mMatList; + std::unordered_map m_mMaterials = {}; + std::unordered_map m_mMatList = {}; bool m_bLoaded = false; }; diff --git a/Amalgam/src/Features/Visuals/SpectatorList/SpectatorList.h b/Amalgam/src/Features/Visuals/SpectatorList/SpectatorList.h index 8fbb9af8..54fb96be 100644 --- a/Amalgam/src/Features/Visuals/SpectatorList/SpectatorList.h +++ b/Amalgam/src/Features/Visuals/SpectatorList/SpectatorList.h @@ -13,8 +13,8 @@ private: int m_iIndex; }; - std::vector m_vSpectators; - std::unordered_map m_mRespawnCache; + std::vector m_vSpectators = {}; + std::unordered_map m_mRespawnCache = {}; public: bool GetSpectators(CTFPlayer* pTarget); diff --git a/Amalgam/src/Features/Visuals/Visuals.cpp b/Amalgam/src/Features/Visuals/Visuals.cpp index 1b84d86f..e2d6b58e 100644 --- a/Amalgam/src/Features/Visuals/Visuals.cpp +++ b/Amalgam/src/Features/Visuals/Visuals.cpp @@ -9,12 +9,14 @@ #include "../Players/PlayerUtils.h" #include "../Spectate/Spectate.h" -MAKE_SIGNATURE(CBaseAnimating_DrawServerHitboxes, "server.dll", "44 88 44 24 ? 53 48 81 EC", 0x0); -MAKE_SIGNATURE(GetServerAnimating, "server.dll", "48 83 EC ? 8B D1 85 C9 7E ? 48 8B 05", 0x0); MAKE_SIGNATURE(CTFPlayer_FireEvent, "client.dll", "48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 4C 89 64 24 ? 55 41 56 41 57 48 8D 6C 24", 0x0); MAKE_SIGNATURE(CWeaponMedigun_UpdateEffects, "client.dll", "40 57 48 81 EC ? ? ? ? 8B 91 ? ? ? ? 48 8B F9 85 D2 0F 84 ? ? ? ? 48 89 B4 24", 0x0); MAKE_SIGNATURE(CWeaponMedigun_StopChargeEffect, "client.dll", "40 53 48 83 EC ? 44 0F B6 C2", 0x0); MAKE_SIGNATURE(CWeaponMedigun_ManageChargeEffect, "client.dll", "48 89 5C 24 ? 48 89 74 24 ? 57 48 81 EC ? ? ? ? 48 8B F1 E8 ? ? ? ? 48 8B D8", 0x0); +MAKE_SIGNATURE(GetServerAnimating, "server.dll", "48 83 EC ? 8B D1 85 C9 7E ? 48 8B 05", 0x0); +MAKE_SIGNATURE(CBaseAnimating_DrawServerHitboxes, "server.dll", "44 88 44 24 ? 53 48 81 EC", 0x0); +MAKE_SIGNATURE(NDebugOverlay_BoxAngles, "server.dll", "48 83 EC ? 4C 8B D9 48 8B 0D ? ? ? ? 48 85 C9 74 ? 8B 84 24 ? ? ? ? F3 0F 10 84 24 ? ? ? ? 4C 8B 11 F3 0F 11 44 24 ? 89 44 24 ? 8B 84 24 ? ? ? ? 89 44 24 ? 8B 84 24 ? ? ? ? 89 44 24 ? 8B 84 24 ? ? ? ? 89 44 24 ? 4C 89 4C 24", 0x0); +MAKE_SIGNATURE(CBaseAnimating_DrawServerHitboxes_BoxAngles_Call, "server.dll", "8B 84 24 ? ? ? ? 49 83 C6", 0x0); static std::vector SplashTrace(Vec3 vOrigin, float flRadius, Vec3 vNormal = { 0, 0, 1 }, bool bTrace = true, int iSegments = 100) { @@ -72,20 +74,23 @@ void CVisuals::ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const return; CGameTrace trace = {}; - CTraceFilterProjectile filter = {}; filter.pSkip = pPlayer; - Vec3* pNormal = nullptr; + CTraceFilterCollideable filter = {}; filter.pSkip = pPlayer; + int nMask = MASK_SOLID; + F::ProjSim.SetupTrace(filter, nMask, pWeapon, 0, bQuick); + Vec3* pNormal = nullptr; for (int n = 1; n <= TIME_TO_TICKS(tProjInfo.m_flLifetime); n++) { Vec3 Old = F::ProjSim.GetOrigin(); F::ProjSim.RunTick(tProjInfo); Vec3 New = F::ProjSim.GetOrigin(); - SDK::TraceHull(Old, New, tProjInfo.m_vHull * -1, tProjInfo.m_vHull, MASK_SOLID, &filter, &trace); + SDK::TraceHull(Old, New, tProjInfo.m_vHull * -1, tProjInfo.m_vHull, nMask, &filter, &trace); + F::ProjSim.SetupTrace(filter, nMask, pWeapon, n, bQuick); if (trace.DidHit()) { pNormal = &trace.plane.normal; - if (n == 1 && trace.startsolid) + if (trace.startsolid) *pNormal = F::ProjSim.GetVelocity().Normalized(); break; } @@ -373,51 +378,54 @@ void CVisuals::DrawDebugInfo(CTFPlayer* pLocal) H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("View: ({:.3f}, {:.3f}, {:.3f})", pCmd->viewangles.x, pCmd->viewangles.y, pCmd->viewangles.z).c_str()); H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("Move: ({}, {}, {})", pCmd->forwardmove, pCmd->sidemove, pCmd->upmove).c_str()); - std::vector> vFlags = { - PAIR(IN_ATTACK), - PAIR(IN_ATTACK2), - PAIR(IN_ATTACK3), - PAIR(IN_FORWARD), - PAIR(IN_BACK), - PAIR(IN_MOVELEFT), - PAIR(IN_MOVERIGHT), - PAIR(IN_JUMP), - PAIR(IN_DUCK), - PAIR(IN_RELOAD), - PAIR(IN_LEFT), - PAIR(IN_RIGHT), - PAIR(IN_SCORE), - /* - PAIR(IN_USE), - PAIR(IN_CANCEL), - PAIR(IN_RUN), - PAIR(IN_ALT1), - PAIR(IN_ALT2), - PAIR(IN_SPEED), - PAIR(IN_WALK), - PAIR(IN_ZOOM), - PAIR(IN_WEAPON1), - PAIR(IN_WEAPON2), - PAIR(IN_BULLRUSH), - PAIR(IN_GRENADE1), - PAIR(IN_GRENADE2), - */ - }; std::string sButtons = "NONE"; - int i = 0; - for (auto& pFlag : vFlags) + if (pCmd->buttons) { - if (pCmd->buttons & pFlag.first) + static std::vector> vFlags = { + PAIR(IN_ATTACK), + PAIR(IN_ATTACK2), + PAIR(IN_ATTACK3), + PAIR(IN_FORWARD), + PAIR(IN_BACK), + PAIR(IN_MOVELEFT), + PAIR(IN_MOVERIGHT), + PAIR(IN_JUMP), + PAIR(IN_DUCK), + PAIR(IN_RELOAD), + PAIR(IN_LEFT), + PAIR(IN_RIGHT), + PAIR(IN_SCORE), + /* + PAIR(IN_USE), + PAIR(IN_CANCEL), + PAIR(IN_RUN), + PAIR(IN_ALT1), + PAIR(IN_ALT2), + PAIR(IN_SPEED), + PAIR(IN_WALK), + PAIR(IN_ZOOM), + PAIR(IN_WEAPON1), + PAIR(IN_WEAPON2), + PAIR(IN_BULLRUSH), + PAIR(IN_GRENADE1), + PAIR(IN_GRENADE2), + */ + }; + + for (int i = 0; i < vFlags.size(); i++) { - if (i) - sButtons += " | "; - else - sButtons = ""; - sButtons += pFlag.second; - i++; + auto& paFlag = vFlags[i]; + if (pCmd->buttons & paFlag.first) + { + if (i) + sButtons += " | "; + else + sButtons = ""; + sButtons += paFlag.second; + } } } - H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("Buttons: {} ({})", pCmd->buttons, sButtons).c_str()); + H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("Buttons: {:#034b} ({})", pCmd->buttons, sButtons).c_str()); } { Vec3 vOrigin = pLocal->m_vecOrigin(); @@ -427,12 +435,13 @@ void CVisuals::DrawDebugInfo(CTFPlayer* pLocal) Vec3 vVelocity = pLocal->m_vecVelocity(); H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("Velocity: {:.3f} ({:.3f}, {:.3f}, {:.3f})", vVelocity.Length(), vVelocity.x, vVelocity.y, vVelocity.z).c_str()); } - H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("Choke: {}, {}", G::Choking, I::ClientState->chokedcommands).c_str()); - H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("Ticks: {}, {}", F::Ticks.m_iShiftedTicks, F::Ticks.m_iShiftedGoal).c_str()); - H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("Round state: {}, {}, {}", SDK::GetRoundState(), SDK::GetWinningTeam(), I::EngineClient->IsPlayingDemo()).c_str()); H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("Tickcount: {}", pLocal->m_nTickBase()).c_str()); - H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("Entities: {} ({}, {})", I::ClientEntityList->GetMaxEntities(), I::ClientEntityList->GetHighestEntityIndex(), I::ClientEntityList->NumberOfEntities(false)).c_str()); + //H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("Choke: {}, {}", G::Choking, I::ClientState->chokedcommands).c_str()); + //H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("Ticks: {}, {}", F::Ticks.m_iShiftedTicks, F::Ticks.m_iShiftedGoal).c_str()); + //H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("Round state: {}, {}, {}", SDK::GetRoundState(), SDK::GetWinningTeam(), I::EngineClient->IsPlayingDemo()).c_str()); + //H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("Entities: {} ({}, {})", I::ClientEntityList->GetMaxEntities(), I::ClientEntityList->GetHighestEntityIndex(), I::ClientEntityList->NumberOfEntities(false)).c_str()); + /* if (pWeapon) { float flTime = TICKS_TO_TIME(pLocal->m_nTickBase()); @@ -448,6 +457,7 @@ void CVisuals::DrawDebugInfo(CTFPlayer* pLocal) H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("Reload: {} ({} || {} != 0)", G::Reloading, pWeapon->m_bInReload(), pWeapon->m_iReloadMode()).c_str()); H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOPLEFT, std::format("Throw: {}, Smack: {}", G::Throwing, pWeapon->m_flSmackTime()).c_str()); } + */ } } #undef PAIR @@ -560,28 +570,108 @@ void CVisuals::DrawEffects() } for (auto& tSightline : m_vSightLines) H::Draw.RenderLine(tSightline.m_vStart, tSightline.m_vEnd, tSightline.m_Color, tSightline.m_bZBuffer); + if (auto& tPath = F::Aimbot.m_tPath; tPath.m_flTime) + H::Draw.RenderPath(tPath.m_vPath, tPath.m_tColor, tPath.m_bZBuffer, tPath.m_iStyle, tPath.m_flTime); + DrawHitboxes(); } -void CVisuals::DrawServerHitboxes(CTFPlayer* pLocal) +static std::vector vHitboxes = {}, vLocalHitboxes = {}; +static bool bHitboxes = false, bBounds = false, bBoxesHeadOnly = false, bBoxesNoAngles = false; +void CVisuals::DrawHitboxes(int iStore) { - if (!Vars::Debug::DrawServerHitboxes.Value) + if (!Vars::Debug::DrawHitboxes.Value) return; - if (I::Input->CAM_IsThirdPerson() && pLocal->IsAlive()) + switch (iStore) { - if (auto pServerAnimating = S::GetServerAnimating.Call(pLocal->entindex())) - S::CBaseAnimating_DrawServerHitboxes.Call(pServerAnimating, 0.f, true); + case 0: + { + for (auto& tBox : vHitboxes) + H::Draw.RenderWireframeBox(tBox.m_vOrigin, tBox.m_vMins, tBox.m_vMaxs, tBox.m_vAngles, tBox.m_tColorEdge, tBox.m_bZBuffer); + for (auto& tBox : vLocalHitboxes) + H::Draw.RenderWireframeBox(tBox.m_vOrigin, tBox.m_vMins, tBox.m_vMaxs, tBox.m_vAngles, tBox.m_tColorEdge, tBox.m_bZBuffer); + break; + } + case 1: + { + vHitboxes.clear(); + + auto pNetChan = I::EngineClient->GetNetChannelInfo(); + bool bLocalhost = pNetChan && pNetChan->IsLoopback(); + + for (auto& pEntity : H::Entities.GetGroup(EGroupType::PLAYERS_ALL)) + { + auto pPlayer = pEntity->As(); + if (pPlayer->entindex() == I::EngineClient->GetLocalPlayer() && !I::Input->CAM_IsThirdPerson() || !pPlayer->IsAlive()) + continue; + + if (auto aBones = H::Entities.GetBones(pPlayer->entindex())) + { + auto vBoxes = GetHitboxes(aBones, pPlayer); + for (auto& tBox : vBoxes) + tBox.m_tColorEdge = { 255, 255, 255, 255 }; + vHitboxes.insert(vHitboxes.end(), vBoxes.begin(), vBoxes.end()); + } + if (bLocalhost) // this ignores latency, beware!! + { + bHitboxes = true; + if (auto pServerAnimating = S::GetServerAnimating.Call(pPlayer->entindex())) + S::CBaseAnimating_DrawServerHitboxes.Call(pServerAnimating, 0.f, true); + bHitboxes = false; + } + } + break; + } + case 2: + { + vLocalHitboxes.clear(); + + if (!I::Input->CAM_IsThirdPerson()) + break; + + auto pLocal = H::Entities.GetLocal(); + if (pLocal && pLocal->SetupBones(F::Backtrack.m_tRecord.m_BoneMatrix.m_aBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, pLocal->m_flSimulationTime())) + { + auto vBoxes = GetHitboxes(F::Backtrack.m_tRecord.m_BoneMatrix.m_aBones, pLocal); + for (auto& tBox : vBoxes) + tBox.m_tColorEdge = { 255, 255, 255, 255 }; + vLocalHitboxes.insert(vLocalHitboxes.end(), vBoxes.begin(), vBoxes.end()); + } + } + } +} + +MAKE_HOOK(CBaseAnimating_DrawServerHitboxes, S::CBaseAnimating_DrawServerHitboxes(), void, + void* rcx, float duration, bool monocolor) +{ + if (bBoxesHeadOnly) + monocolor = false; + + CALL_ORIGINAL(rcx, duration, monocolor); +} + +MAKE_HOOK(NDebugOverlay_BoxAngles, S::NDebugOverlay_BoxAngles(), void, + Vector& origin, Vector& mins, Vector& maxs, QAngle& angles, int r, int g, int b, int a, float duration) +{ + if (bBoxesHeadOnly) + { + static const auto dwDesired = S::CBaseAnimating_DrawServerHitboxes_BoxAngles_Call(); + const auto dwRetAddr = uintptr_t(_ReturnAddress()); + + if (dwRetAddr == dwDesired && (r != 255 || g != 127 || b != 127)) + return; } - for (auto& pEntity : H::Entities.GetGroup(EGroupType::PLAYERS_ALL)) - { - auto pPlayer = pEntity->As(); - if (pPlayer->entindex() == I::EngineClient->GetLocalPlayer() || !pPlayer->IsAlive()) - continue; + if (bBoxesNoAngles) + angles = {}; - if (auto pServerAnimating = S::GetServerAnimating.Call(pPlayer->entindex())) - S::CBaseAnimating_DrawServerHitboxes.Call(pServerAnimating, 0.f, true); + if (bHitboxes) + { + vHitboxes.emplace_back(origin, mins, maxs, angles, 0, Color_t(r, g, b, 255 - a), Color_t(0, 0, 0, 0), true); + return; } + + CALL_ORIGINAL(origin, mins, maxs, angles, r, g, b, a, duration); } @@ -688,11 +778,11 @@ void CVisuals::Event(IGameEvent* pEvent, uint32_t uHash) if (!bBones) break; - auto pBones = H::Entities.GetBones(pEntity->entindex()); - if (!pBones) + auto aBones = H::Entities.GetBones(pEntity->entindex()); + if (!aBones) return; - auto vBoxes = GetHitboxes(pBones, pEntity); + auto vBoxes = GetHitboxes(aBones, pEntity); G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end()); return; @@ -933,11 +1023,12 @@ void CVisuals::CreateMove(CTFPlayer* pLocal, CTFWeaponBase* pWeapon) iOldMedigunCharge = iNewMedigunCharge; } + static auto r_aspectratio = U::ConVars.FindVar("r_aspectratio"); static float flStaticRatio = 0.f; float flOldRatio = flStaticRatio; float flNewRatio = flStaticRatio = Vars::Visuals::UI::AspectRatio.Value; - - static auto r_aspectratio = U::ConVars.FindVar("r_aspectratio"); if (flNewRatio != flOldRatio) r_aspectratio->SetValue(flNewRatio); + + DrawHitboxes(2); } \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/Visuals.h b/Amalgam/src/Features/Visuals/Visuals.h index fea95bcd..f37713e7 100644 --- a/Amalgam/src/Features/Visuals/Visuals.h +++ b/Amalgam/src/Features/Visuals/Visuals.h @@ -22,8 +22,8 @@ class CVisuals { private: int m_nHudZoom = 0; - std::vector m_vSightLines; - std::vector m_vPickups; + std::vector m_vSightLines = {}; + std::vector m_vPickups = {}; public: void Event(IGameEvent* pEvent, uint32_t uHash); @@ -37,7 +37,7 @@ public: std::vector GetHitboxes(matrix3x4* aBones, CBaseAnimating* pEntity, std::vector vHitboxes = {}, int iTarget = -1); void DrawEffects(); - void DrawServerHitboxes(CTFPlayer* pLocal); + void DrawHitboxes(int iStore = 0); void FOV(CTFPlayer* pLocal, CViewSetup* pView); void ThirdPerson(CTFPlayer* pLocal, CViewSetup* pView); diff --git a/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp b/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp index ca613271..60c68c74 100644 --- a/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp +++ b/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp @@ -143,6 +143,18 @@ MAKE_HOOK(CClientModeShared_CreateMove, U::Memory.GetVirtual(I::ClientModeShared G::Reloading = true; } } + if (G::CanPrimaryAttack) + { + switch (pWeapon->GetWeaponID()) + { + case TF_WEAPON_FLAMETHROWER: + case TF_WEAPON_FLAME_BALL: + case TF_WEAPON_FLAREGUN: + case TF_WEAPON_FLAREGUN_REVENGE: + if (pLocal->IsUnderwater()) + G::CanPrimaryAttack = G::CanSecondaryAttack = false; + } + } } G::Attacking = SDK::IsAttacking(pLocal, pWeapon, pCmd); diff --git a/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp b/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp index 56e23be2..bbff89f1 100644 --- a/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp +++ b/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp @@ -1,5 +1,6 @@ #include "../SDK/SDK.h" +#include "../Features/Commands/Commands.h" #include #include @@ -224,6 +225,9 @@ MAKE_HOOK(Cbuf_ExecuteCommand, S::Cbuf_ExecuteCommand(), void, for (int i = 1; i < args.ArgC(); i++) vArgs.push_back(args[i]); + if (F::Commands.Run(sCommand, vArgs)) + return; + switch (FNV1A::Hash32(sCommand.c_str())) { case FNV1A::Hash32Const("say"): diff --git a/Amalgam/src/Hooks/IBaseClientDLL_FrameStageNotify.cpp b/Amalgam/src/Hooks/IBaseClientDLL_FrameStageNotify.cpp index 578f27a1..d32f9e1b 100644 --- a/Amalgam/src/Hooks/IBaseClientDLL_FrameStageNotify.cpp +++ b/Amalgam/src/Hooks/IBaseClientDLL_FrameStageNotify.cpp @@ -1,5 +1,6 @@ #include "../SDK/SDK.h" +#include "../Features/Aimbot/Aimbot.h" #include "../Features/Backtrack/Backtrack.h" #include "../Features/CheaterDetection/CheaterDetection.h" #include "../Features/CritHack/CritHack.h" @@ -82,6 +83,7 @@ MAKE_HOOK(IBaseClientDLL_FrameStageNotify, U::Memory.GetVirtual(I::BaseClientDLL F::Backtrack.Store(); F::MoveSim.Store(); F::CritHack.Store(); + F::Aimbot.Store(); auto pLocal = H::Entities.GetLocal(); F::ESP.Store(pLocal); @@ -93,6 +95,7 @@ MAKE_HOOK(IBaseClientDLL_FrameStageNotify, U::Memory.GetVirtual(I::BaseClientDLL F::Spectate.NetUpdateEnd(pLocal); F::Visuals.Modulate(); + F::Visuals.DrawHitboxes(1); break; } case FRAME_RENDER_START: diff --git a/Amalgam/src/Hooks/IEngineVGui_Paint.cpp b/Amalgam/src/Hooks/IEngineVGui_Paint.cpp index 83eb020f..9b916686 100644 --- a/Amalgam/src/Hooks/IEngineVGui_Paint.cpp +++ b/Amalgam/src/Hooks/IEngineVGui_Paint.cpp @@ -34,7 +34,6 @@ MAKE_HOOK(IEngineVGui_Paint, U::Memory.GetVirtual(I::EngineVGui, 14), void, if (auto pLocal = H::Entities.GetLocal()) { F::CameraWindow.Draw(); - F::Visuals.DrawServerHitboxes(pLocal); F::Visuals.DrawAntiAim(pLocal); F::Visuals.DrawPickupTimers(); diff --git a/Amalgam/src/Hooks/IVEngineClient_ClientCmd_Unrestricted.cpp b/Amalgam/src/Hooks/IVEngineClient_ClientCmd_Unrestricted.cpp deleted file mode 100644 index 6577e5f5..00000000 --- a/Amalgam/src/Hooks/IVEngineClient_ClientCmd_Unrestricted.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "../SDK/SDK.h" - -#include "../Features/Commands/Commands.h" -#include - -class split_q -{ -public: - split_q() : in_q(false) {} - - bool operator()(char ch) const - { - if (ch == '\"') - { - in_q = !in_q; - } - return !in_q && ch == ' '; - } - -private: - mutable bool in_q; -}; - -MAKE_HOOK(IVEngineClient_ClientCmd_Unrestricted, U::Memory.GetVirtual(I::EngineClient, 106), void, - void* rcx, const char* szCmdString) -{ -#ifdef DEBUG_HOOKS - if (!Vars::Hooks::IVEngineClient_ClientCmd_Unrestricted[DEFAULT_BIND]) - return CALL_ORIGINAL(rcx, szCmdString); -#endif - - std::string sCmdString = szCmdString; - std::transform(sCmdString.begin(), sCmdString.end(), sCmdString.begin(), ::tolower); - - std::deque vArgs; - boost::split(vArgs, sCmdString, split_q()); - - if (!vArgs.empty()) - { - std::string sCommand = vArgs.front(); - vArgs.pop_front(); - - if (F::Commands.Run(sCommand, vArgs)) - return; - } - - CALL_ORIGINAL(rcx, szCmdString); -} \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CBasePlayer.cpp b/Amalgam/src/SDK/Definitions/Main/CBasePlayer.cpp index bc71682e..18609703 100644 --- a/Amalgam/src/SDK/Definitions/Main/CBasePlayer.cpp +++ b/Amalgam/src/SDK/Definitions/Main/CBasePlayer.cpp @@ -25,4 +25,9 @@ bool CBasePlayer::OnSolid() bool CBasePlayer::IsSwimming() { return m_nWaterLevel() > 1; +} + +bool CBasePlayer::IsUnderwater() +{ + return m_nWaterLevel() > 2; } \ 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 dd86ab7a..0daaabdb 100644 --- a/Amalgam/src/SDK/Definitions/Main/CBasePlayer.h +++ b/Amalgam/src/SDK/Definitions/Main/CBasePlayer.h @@ -97,4 +97,5 @@ public: Vec3 GetEyePosition(); bool OnSolid(); bool IsSwimming(); + bool IsUnderwater(); }; \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Types.h b/Amalgam/src/SDK/Definitions/Types.h index 3de6bdee..697cbae3 100644 --- a/Amalgam/src/SDK/Definitions/Types.h +++ b/Amalgam/src/SDK/Definitions/Types.h @@ -587,11 +587,21 @@ public: return (*this - v).Length(); } + inline float DistTo2D(const Vec3& v) const + { + return (*this - v).Length2D(); + } + inline float DistToSqr(const Vec3& v) const { return (*this - v).LengthSqr(); } + inline float DistTo2DSqr(const Vec3& v) const + { + return (*this - v).Length2DSqr(); + } + inline float Dot(const Vec3& v) const { return x * v.x + y * v.y + z * v.z; diff --git a/Amalgam/src/SDK/Helpers/Entities/Entities.cpp b/Amalgam/src/SDK/Helpers/Entities/Entities.cpp index 63be7146..37ff7563 100644 --- a/Amalgam/src/SDK/Helpers/Entities/Entities.cpp +++ b/Amalgam/src/SDK/Helpers/Entities/Entities.cpp @@ -479,7 +479,7 @@ CTFPlayer* CEntities::GetLocal() } CTFWeaponBase* CEntities::GetWeapon() { - auto pLocal = I::ClientEntityList->GetClientEntity(I::EngineClient->GetLocalPlayer())->As(); + auto pLocal = GetLocal(); return pLocal ? pLocal->m_hActiveWeapon().Get()->As() : nullptr; //return m_pLocalWeapon; } diff --git a/Amalgam/src/SDK/Helpers/Entities/Entities.h b/Amalgam/src/SDK/Helpers/Entities/Entities.h index b292bcea..5755d559 100644 --- a/Amalgam/src/SDK/Helpers/Entities/Entities.h +++ b/Amalgam/src/SDK/Helpers/Entities/Entities.h @@ -33,26 +33,26 @@ class CEntities std::unordered_map> m_mGroups = {}; - 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; - std::unordered_map m_mLagCompensation; - std::unordered_map m_mDormancy; - std::unordered_map m_mAvgVelocities; - std::unordered_map m_mModels; - std::unordered_map> m_mOrigins; + 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 = {}; + std::unordered_map m_mLagCompensation = {}; + std::unordered_map m_mDormancy = {}; + std::unordered_map m_mAvgVelocities = {}; + std::unordered_map m_mModels = {}; + std::unordered_map> m_mOrigins = {}; - std::unordered_map m_mIPriorities; - std::unordered_map m_mUPriorities; - std::unordered_map m_mIFriends; - std::unordered_map m_mUFriends; - std::unordered_map m_mIParty; - std::unordered_map m_mUParty; - std::unordered_map m_mIF2P; - std::unordered_map m_mUF2P; - std::unordered_map m_mILevels; - std::unordered_map m_mULevels; + std::unordered_map m_mIPriorities = {}; + std::unordered_map m_mUPriorities = {}; + std::unordered_map m_mIFriends = {}; + std::unordered_map m_mUFriends = {}; + std::unordered_map m_mIParty = {}; + std::unordered_map m_mUParty = {}; + std::unordered_map m_mIF2P = {}; + std::unordered_map m_mUF2P = {}; + std::unordered_map m_mILevels = {}; + std::unordered_map m_mULevels = {}; uint32_t m_uFriendsID; bool m_bSettingUpBones = false; diff --git a/Amalgam/src/SDK/Helpers/TraceFilters/TraceFilters.cpp b/Amalgam/src/SDK/Helpers/TraceFilters/TraceFilters.cpp index 6de5cec5..195b84e2 100644 --- a/Amalgam/src/SDK/Helpers/TraceFilters/TraceFilters.cpp +++ b/Amalgam/src/SDK/Helpers/TraceFilters/TraceFilters.cpp @@ -6,10 +6,18 @@ bool CTraceFilterHitscan::ShouldHitEntity(IHandleEntity* pServerEntity, int nCon { if (!pServerEntity || pServerEntity == pSkip) return false; - //if (pServerEntity->GetRefEHandle().GetSerialNumber() == (1 << 15)) - // return I::ClientEntityList->GetClientEntity(0) != pSkip; auto pEntity = reinterpret_cast(pServerEntity); + if (iTeam == -1) iTeam = pSkip ? pSkip->m_iTeamNum() : 0; + if (iType != SKIP_CHECK && !vWeapons.empty()) + { + if (auto pWeapon = pSkip && pSkip->IsPlayer() ? pSkip->As()->m_hActiveWeapon().Get()->As() : nullptr) + { + int iWeaponID = pWeapon->GetWeaponID(); + bWeapon = std::find(vWeapons.begin(), vWeapons.end(), iWeaponID) != vWeapons.end(); + } + vWeapons.clear(); + } switch (pEntity->GetClassID()) { @@ -17,40 +25,16 @@ bool CTraceFilterHitscan::ShouldHitEntity(IHandleEntity* pServerEntity, int nCon case ETFClassID::CFuncAreaPortalWindow: case ETFClassID::CFuncRespawnRoomVisualizer: case ETFClassID::CTFReviveMarker: return false; - case ETFClassID::CTFMedigunShield: - { - auto pLocal = H::Entities.GetLocal(); - auto pWeapon = H::Entities.GetWeapon(); - - const int iTargetTeam = pEntity->m_iTeamNum(), iLocalTeam = pLocal ? pLocal->m_iTeamNum() : iTargetTeam; - return iTargetTeam != iLocalTeam; - } + case ETFClassID::CTFMedigunShield: return pEntity->m_iTeamNum() != iTeam; case ETFClassID::CTFPlayer: case ETFClassID::CBaseObject: case ETFClassID::CObjectSentrygun: case ETFClassID::CObjectDispenser: case ETFClassID::CObjectTeleporter: { - auto pLocal = H::Entities.GetLocal(); - auto pWeapon = H::Entities.GetWeapon(); - - bool bSniperRifle = false; - if (pLocal && pLocal == pSkip && pWeapon) - { - switch (pWeapon->GetWeaponID()) - { - case TF_WEAPON_SNIPERRIFLE: - case TF_WEAPON_SNIPERRIFLE_CLASSIC: - case TF_WEAPON_SNIPERRIFLE_DECAP: - bSniperRifle = true; - } - } - - if (!bSniperRifle) - return true; - - const int iTargetTeam = pEntity->m_iTeamNum(), iLocalTeam = pLocal ? pLocal->m_iTeamNum() : iTargetTeam; - return iTargetTeam != iLocalTeam; + if (iType != SKIP_CHECK && (iWeapon == WEAPON_INCLUDE ? bWeapon : !bWeapon)) + return iType == FORCE_HIT ? true : false; + return pEntity->m_iTeamNum() != iTeam; } } @@ -61,14 +45,22 @@ TraceType_t CTraceFilterHitscan::GetTraceType() const return TRACE_EVERYTHING; } -bool CTraceFilterProjectile::ShouldHitEntity(IHandleEntity* pServerEntity, int nContentsMask) +bool CTraceFilterCollideable::ShouldHitEntity(IHandleEntity* pServerEntity, int nContentsMask) { if (!pServerEntity || pServerEntity == pSkip) return false; - //if (pServerEntity->GetRefEHandle().GetSerialNumber() == (1 << 15)) - // return I::ClientEntityList->GetClientEntity(0) != pSkip; auto pEntity = reinterpret_cast(pServerEntity); + if (iTeam == -1) iTeam = pSkip ? pSkip->m_iTeamNum() : 0; + if (iType != SKIP_CHECK && !vWeapons.empty()) + { + if (auto pWeapon = pSkip && pSkip->IsPlayer() ? pSkip->As()->m_hActiveWeapon().Get()->As() : nullptr) + { + int iWeaponID = pWeapon->GetWeaponID(); + bWeapon = std::find(vWeapons.begin(), vWeapons.end(), iWeaponID) != vWeapons.end(); + } + vWeapons.clear(); + } switch (pEntity->GetClassID()) { @@ -79,36 +71,33 @@ bool CTraceFilterProjectile::ShouldHitEntity(IHandleEntity* pServerEntity, int n case ETFClassID::CPhysicsPropMultiplayer: case ETFClassID::CObjectCartDispenser: case ETFClassID::CFuncTrackTrain: - case ETFClassID::CFuncConveyor: - case ETFClassID::CBaseObject: - case ETFClassID::CObjectSentrygun: - case ETFClassID::CObjectDispenser: - case ETFClassID::CObjectTeleporter: return true; - case ETFClassID::CTFMedigunShield: - { - auto pLocal = H::Entities.GetLocal(); - auto pWeapon = H::Entities.GetWeapon(); - - const int iTargetTeam = pEntity->m_iTeamNum(), iLocalTeam = pLocal ? pLocal->m_iTeamNum() : iTargetTeam; - return iTargetTeam != iLocalTeam; - } + case ETFClassID::CFuncConveyor: return true; case ETFClassID::CTFPlayer: { - auto pLocal = H::Entities.GetLocal(); - auto pWeapon = H::Entities.GetWeapon(); - - const bool bHeal = (pLocal && pLocal == pSkip && pWeapon) ? pWeapon->GetWeaponID() == TF_WEAPON_CROSSBOW || pWeapon->GetWeaponID() == TF_WEAPON_LUNCHBOX : false; - if (bHeal) + if (iPlayer == PLAYER_ALL) return true; - - const int iTargetTeam = pEntity->m_iTeamNum(), iLocalTeam = pLocal ? pLocal->m_iTeamNum() : iTargetTeam; - return iTargetTeam != iLocalTeam; + if (iPlayer == PLAYER_NONE) + return false; + if (iType != SKIP_CHECK && (iWeapon == WEAPON_INCLUDE ? bWeapon : !bWeapon)) + return iType == FORCE_HIT ? true : false; + return pEntity->m_iTeamNum() != iTeam; } + case ETFClassID::CBaseObject: + case ETFClassID::CObjectSentrygun: + case ETFClassID::CObjectDispenser: return iObject == OBJECT_ALL ? true : iObject == OBJECT_NONE ? false : pEntity->m_iTeamNum() != iTeam; + case ETFClassID::CObjectTeleporter: return true; + case ETFClassID::CTFMedigunShield: + if (!(nContentsMask & CONTENTS_PLAYERCLIP)) + return pEntity->m_iTeamNum() != iTeam; + break; + case ETFClassID::CFuncRespawnRoomVisualizer: + if (nContentsMask & CONTENTS_PLAYERCLIP) + return pEntity->m_iTeamNum() != iTeam; } return false; } -TraceType_t CTraceFilterProjectile::GetTraceType() const +TraceType_t CTraceFilterCollideable::GetTraceType() const { return TRACE_EVERYTHING; } @@ -121,6 +110,7 @@ bool CTraceFilterWorldAndPropsOnly::ShouldHitEntity(IHandleEntity* pServerEntity return I::ClientEntityList->GetClientEntity(0) != pSkip; auto pEntity = reinterpret_cast(pServerEntity); + if (iTeam == -1) iTeam = pSkip ? pSkip->m_iTeamNum() : 0; switch (pEntity->GetClassID()) { @@ -133,14 +123,8 @@ bool CTraceFilterWorldAndPropsOnly::ShouldHitEntity(IHandleEntity* pServerEntity case ETFClassID::CFuncTrackTrain: case ETFClassID::CFuncConveyor: return true; case ETFClassID::CFuncRespawnRoomVisualizer: - if (nContentsMask & MASK_PLAYERSOLID) - { - switch (pEntity->m_iTeamNum()) - { - case TF_TEAM_RED: return nContentsMask & CONTENTS_REDTEAM; - case TF_TEAM_BLUE: return nContentsMask & CONTENTS_BLUETEAM; - } - } + if (nContentsMask & CONTENTS_PLAYERCLIP) + return pEntity->m_iTeamNum() != iTeam; } return false; diff --git a/Amalgam/src/SDK/Helpers/TraceFilters/TraceFilters.h b/Amalgam/src/SDK/Helpers/TraceFilters/TraceFilters.h index a8bdd518..b4497318 100644 --- a/Amalgam/src/SDK/Helpers/TraceFilters/TraceFilters.h +++ b/Amalgam/src/SDK/Helpers/TraceFilters/TraceFilters.h @@ -1,20 +1,59 @@ #pragma once #include "../../Definitions/Interfaces/IEngineTrace.h" +enum +{ + SKIP_CHECK, + FORCE_PASS, + FORCE_HIT +}; + +enum +{ + WEAPON_INCLUDE, + WEAPON_EXCLUDE +}; +enum +{ + PLAYER_DEFAULT, + PLAYER_NONE, + PLAYER_ALL +}; +enum +{ + OBJECT_DEFAULT, + OBJECT_NONE, + OBJECT_ALL +}; + class CTraceFilterHitscan : public ITraceFilter { public: bool ShouldHitEntity(IHandleEntity* pServerEntity, int nContentsMask) override; TraceType_t GetTraceType() const override; CBaseEntity* pSkip = nullptr; + + int iTeam = -1; + std::vector vWeapons = { TF_WEAPON_SNIPERRIFLE, TF_WEAPON_SNIPERRIFLE_CLASSIC, TF_WEAPON_SNIPERRIFLE_DECAP }; + int iType = FORCE_HIT; + int iWeapon = WEAPON_EXCLUDE; + bool bWeapon = false; }; -class CTraceFilterProjectile : public ITraceFilter +class CTraceFilterCollideable : public ITraceFilter { public: bool ShouldHitEntity(IHandleEntity* pServerEntity, int nContentsMask) override; TraceType_t GetTraceType() const override; CBaseEntity* pSkip = nullptr; + + int iTeam = -1; + std::vector vWeapons = { TF_WEAPON_CROSSBOW, TF_WEAPON_LUNCHBOX }; + int iType = FORCE_HIT; + int iWeapon = WEAPON_INCLUDE; + bool bWeapon = false; + int iPlayer = PLAYER_DEFAULT; + int iObject = OBJECT_ALL; }; class CTraceFilterWorldAndPropsOnly : public ITraceFilter @@ -23,4 +62,6 @@ public: bool ShouldHitEntity(IHandleEntity* pServerEntity, int nContentsMask) override; TraceType_t GetTraceType() const override; CBaseEntity* pSkip = nullptr; + + int iTeam = -1; }; \ No newline at end of file diff --git a/Amalgam/src/SDK/SDK.cpp b/Amalgam/src/SDK/SDK.cpp index b7dda8f5..ee56eec1 100644 --- a/Amalgam/src/SDK/SDK.cpp +++ b/Amalgam/src/SDK/SDK.cpp @@ -336,10 +336,10 @@ bool SDK::VisPos(CBaseEntity* pSkip, const CBaseEntity* pEntity, const Vec3& vFr return trace.m_pEnt && trace.m_pEnt == pEntity; return true; } -bool SDK::VisPosProjectile(CBaseEntity* pSkip, const CBaseEntity* pEntity, const Vec3& vFrom, const Vec3& vTo, unsigned int nMask) +bool SDK::VisPosCollideable(CBaseEntity* pSkip, const CBaseEntity* pEntity, const Vec3& vFrom, const Vec3& vTo, unsigned int nMask) { CGameTrace trace = {}; - CTraceFilterProjectile filter = {}; filter.pSkip = pSkip; + CTraceFilterCollideable filter = {}; filter.pSkip = pSkip; filter.iType = SKIP_CHECK; Trace(vFrom, vTo, nMask, &filter, &trace); if (trace.DidHit()) return trace.m_pEnt && trace.m_pEnt == pEntity; @@ -717,46 +717,6 @@ void SDK::WalkTo(CUserCmd* pCmd, CTFPlayer* pLocal, Vec3& vTo, float flScale) -class CTraceFilterSetup : public ITraceFilter // trace filter solely for GetProjectileFireSetup -{ -public: - bool ShouldHitEntity(IHandleEntity* pServerEntity, int nContentsMask) override; - TraceType_t GetTraceType() const override; - CBaseEntity* pSkip = nullptr; -}; -bool CTraceFilterSetup::ShouldHitEntity(IHandleEntity* pServerEntity, int nContentsMask) -{ - if (!pServerEntity || pServerEntity == pSkip) - return false; - - auto pEntity = reinterpret_cast(pServerEntity); - - switch (pEntity->GetClassID()) - { - case ETFClassID::CTFAmmoPack: - case ETFClassID::CFuncAreaPortalWindow: - case ETFClassID::CFuncRespawnRoomVisualizer: - case ETFClassID::CTFReviveMarker: return false; - case ETFClassID::CTFMedigunShield: - case ETFClassID::CObjectSentrygun: - case ETFClassID::CObjectDispenser: - case ETFClassID::CObjectTeleporter: return true; - case ETFClassID::CTFPlayer: - { - auto pLocal = H::Entities.GetLocal(); - - const int iTargetTeam = pEntity->m_iTeamNum(), iLocalTeam = pLocal ? pLocal->m_iTeamNum() : iTargetTeam; - return iTargetTeam != iLocalTeam; - } - } - - return true; -} -TraceType_t CTraceFilterSetup::GetTraceType() const -{ - return TRACE_EVERYTHING; -} - void SDK::GetProjectileFireSetup(CTFPlayer* pPlayer, const Vec3& vAngIn, Vec3 vOffset, Vec3& vPosOut, Vec3& vAngOut, bool bPipes, bool bInterp, bool bAllowFlip) { static auto cl_flipviewmodels = U::ConVars.FindVar("cl_flipviewmodels"); @@ -775,7 +735,7 @@ void SDK::GetProjectileFireSetup(CTFPlayer* pPlayer, const Vec3& vAngIn, Vec3 vO Vec3 vEndPos = vShootPos + vForward * 2000.f; CGameTrace trace = {}; - CTraceFilterSetup filter = {}; + CTraceFilterCollideable filter = {}; filter.pSkip = pPlayer; filter.iType = SKIP_CHECK; Trace(vShootPos, vEndPos, MASK_SOLID, &filter, &trace); if (trace.DidHit() && trace.fraction > 0.1f) vEndPos = trace.endpos; diff --git a/Amalgam/src/SDK/SDK.h b/Amalgam/src/SDK/SDK.h index b3e371d0..95b2059b 100644 --- a/Amalgam/src/SDK/SDK.h +++ b/Amalgam/src/SDK/SDK.h @@ -98,7 +98,7 @@ namespace SDK void TraceHull(const Vec3& vecStart, const Vec3& vecEnd, const Vec3& vecHullMin, const Vec3& vecHullMax, unsigned int nMask, ITraceFilter* pFilter, CGameTrace* pTrace); bool VisPos(CBaseEntity* pSkip, const CBaseEntity* pEntity, const Vec3& vFrom, const Vec3& vTo, unsigned int nMask = MASK_SHOT | CONTENTS_GRATE); - bool VisPosProjectile(CBaseEntity* pSkip, const CBaseEntity* pEntity, const Vec3& vFrom, const Vec3& vTo, unsigned int nMask = MASK_SHOT | CONTENTS_GRATE); + bool VisPosCollideable(CBaseEntity* pSkip, const CBaseEntity* pEntity, const Vec3& vFrom, const Vec3& vTo, unsigned int nMask = MASK_SHOT | CONTENTS_GRATE); bool VisPosWorld(CBaseEntity* pSkip, const CBaseEntity* pEntity, const Vec3& vFrom, const Vec3& vTo, unsigned int nMask = MASK_SHOT | CONTENTS_GRATE); int GetRoundState(); diff --git a/Amalgam/src/SDK/Vars.h b/Amalgam/src/SDK/Vars.h index b5e324b1..59639978 100644 --- a/Amalgam/src/SDK/Vars.h +++ b/Amalgam/src/SDK/Vars.h @@ -58,7 +58,7 @@ class ConfigVar : public BaseVar public: T Default; T Value; - std::unordered_map Map; + std::unordered_map Map = {}; ConfigVar(T tValue, std::string sName, const char* sSection, std::vector vTitle, int iFlags = 0, std::vector vValues = {}, const char* sNone = nullptr) { Default = tValue; @@ -249,6 +249,8 @@ namespace Vars CVar(ShotPathClipped, "Shot path clipped color", Color_t(255, 255, 255, 0), VISUAL); CVar(SplashRadius, "Splash radius color", Color_t(255, 255, 255, 255), VISUAL); CVar(SplashRadiusClipped, "Splash radius clipped color", Color_t(255, 255, 255, 0), VISUAL); + CVar(RealPath, "Real path color", Color_t(255, 255, 255, 255), NOSAVE | DEBUGVAR); + CVar(RealPathClipped, "Real path clipped color", Color_t(255, 255, 255, 0), NOSAVE | DEBUGVAR); CVar(BoneHitboxEdge, "Bone hitbox edge color", Color_t(255, 255, 255, 0), VISUAL); CVar(BoneHitboxEdgeClipped, "Bone hitbox edge clipped color", Color_t(255, 255, 255, 255), VISUAL); @@ -437,8 +439,8 @@ namespace Vars CVar(AntiWarp, "Anti-warp", true); CVar(TickLimit, "Tick limit", 22, SLIDER_CLAMP, 2, 22); CVar(WarpRate, "Warp rate", 22, SLIDER_CLAMP, 2, 22); - CVar(PassiveRecharge, "Passive recharge", 0, SLIDER_CLAMP, 0, 67); CVar(RechargeLimit, "Recharge limit", 24, SLIDER_CLAMP, 1, 24); + CVar(PassiveRecharge, "Passive recharge", 0, SLIDER_CLAMP, 0, 67); NAMESPACE_END(DoubleTap) NAMESPACE_BEGIN(Fakelag) @@ -485,8 +487,8 @@ namespace Vars "View", "Target"); 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(RealYawValue, "Real value", 90.f, SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f); + CVar(FakeYawValue, "Fake value", -90.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); @@ -839,7 +841,7 @@ namespace Vars "Off", "Line", "Separators", "Spaced", "Arrows", "Boxes"); CVarValues(ShotPath, "Shot path", 0, VISUAL, nullptr, "Off", "Line", "Separators", "Spaced", "Arrows", "Boxes"); - CVarEnum(SplashRadius, "Splash path", 0b0, VISUAL | DROPDOWN_MULTI, "Off", + CVarEnum(SplashRadius, "Splash radius", 0b0, VISUAL | DROPDOWN_MULTI, "Off", VA_LIST("Simulation", "##Divider", "Priority", "Enemy", "Team", "Local", "Friends", "Party", "##Divider", "Rockets", "Stickies", "Pipes", "Scorch shot", "##Divider", "Trace"), Simulation = 1 << 0, Priority = 1 << 1, Enemy = 1 << 2, Team = 1 << 3, Local = 1 << 4, Friends = 1 << 5, Party = 1 << 6, Rockets = 1 << 7, Stickies = 1 << 8, Pipes = 1 << 9, ScorchShot = 1 << 10, Trace = 1 << 11); CVar(Timed, VA_LIST("Timed", "Timed path"), false, VISUAL); @@ -849,6 +851,8 @@ namespace Vars CVar(SwingLines, "Swing lines", false, VISUAL); CVar(DrawDuration, VA_LIST("Draw duration", "Simulation draw duration"), 5.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f); + CVarValues(RealPath, "Real path", 0, NOSAVE | DEBUGVAR, nullptr, + "Off", "Line", "Separators", "Spaced", "Arrows", "Boxes"); CVar(SeparatorSpacing, "Separator spacing", 4, NOSAVE | DEBUGVAR, 1, 16); CVar(SeparatorLength, "Separator length", 12.f, NOSAVE | DEBUGVAR, 2.f, 16.f); SUBNAMESPACE_END(Simulation); @@ -1109,7 +1113,7 @@ namespace Vars CVar(Info, "Debug info", false, NOSAVE); CVar(Logging, "Debug logging", false, NOSAVE); CVar(Options, "Debug options", false, NOSAVE); - CVar(DrawServerHitboxes, "Show server hitboxes", false, NOSAVE); + CVar(DrawHitboxes, "Show hitboxes", false, NOSAVE); CVar(AntiAimLines, "Anti-aim lines", false); CVar(CrashLogging, "Crash logging", true); #ifdef DEBUG_TRACES diff --git a/Amalgam/src/Utils/ConVars/ConVars.h b/Amalgam/src/Utils/ConVars/ConVars.h index f882f0cd..bc8b9c4a 100644 --- a/Amalgam/src/Utils/ConVars/ConVars.h +++ b/Amalgam/src/Utils/ConVars/ConVars.h @@ -7,8 +7,8 @@ class CConVars { private: - std::unordered_map mCVarMap; - std::unordered_map mFlagMap; + std::unordered_map mCVarMap = {}; + std::unordered_map mFlagMap = {}; public: void Initialize(); diff --git a/Amalgam/src/Utils/KeyHandler/KeyHandler.h b/Amalgam/src/Utils/KeyHandler/KeyHandler.h index 0b0f5581..adfd791e 100644 --- a/Amalgam/src/Utils/KeyHandler/KeyHandler.h +++ b/Amalgam/src/Utils/KeyHandler/KeyHandler.h @@ -28,7 +28,7 @@ public: // Was the button just released? This will only be true once. bool Released(int iKey, const bool bStore = false, KeyStorage* pStorage = nullptr); - std::unordered_map m_mKeyStorage; + std::unordered_map m_mKeyStorage = {}; }; ADD_FEATURE_CUSTOM(CKeyHandler, KeyHandler, U); \ No newline at end of file