diff --git a/.github/assets/pdb2.png b/.github/assets/pdb2.png new file mode 100644 index 00000000..6c40c23e Binary files /dev/null and b/.github/assets/pdb2.png differ diff --git a/Amalgam/Amalgam.vcxproj b/Amalgam/Amalgam.vcxproj index 3f648297..fc4d9075 100644 --- a/Amalgam/Amalgam.vcxproj +++ b/Amalgam/Amalgam.vcxproj @@ -245,48 +245,56 @@ $(SolutionDir)build\$(Platform)\$(Configuration)\ $(ProjectDir)include\;$(IncludePath) $(SolutionDir)output\$(Platform)\$(Configuration)\ + false $(ProjectName)$(Platform)$(Configuration) $(SolutionDir)build\$(Platform)\$(Configuration)\ $(ProjectDir)include\;$(IncludePath) $(SolutionDir)output\$(Platform)\$(Configuration)\ + false $(ProjectName)$(Platform)$(Configuration) $(SolutionDir)build\$(Platform)\$(Configuration)\ $(ProjectDir)include\;$(IncludePath) $(SolutionDir)output\$(Platform)\$(Configuration)\ + false $(ProjectName)$(Platform)$(Configuration) $(SolutionDir)build\$(Platform)\$(Configuration)\ $(ProjectDir)include\;$(IncludePath) $(SolutionDir)output\$(Platform)\$(Configuration)\ + false $(ProjectDir)include\;$(IncludePath) $(SolutionDir)build\$(Platform)\$(Configuration)\ $(ProjectName)$(Platform)$(Configuration) $(SolutionDir)output\$(Platform)\$(Configuration)\ + false $(ProjectDir)include\;$(IncludePath) $(SolutionDir)build\$(Platform)\$(Configuration)\ $(ProjectName)$(Platform)$(Configuration) $(SolutionDir)output\$(Platform)\$(Configuration)\ + false $(ProjectDir)include\;$(IncludePath) $(SolutionDir)build\$(Platform)\$(Configuration)\ $(ProjectName)$(Platform)$(Configuration) $(SolutionDir)output\$(Platform)\$(Configuration)\ + false $(ProjectDir)include\;$(IncludePath) $(SolutionDir)build\$(Platform)\$(Configuration)\ $(ProjectName)$(Platform)$(Configuration) $(SolutionDir)output\$(Platform)\$(Configuration)\ + false $(SolutionDir)output\$(Platform)\$(Configuration)\ @@ -297,6 +305,7 @@ $(VC_ReferencesPath_x64); $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64) $(CommonExcludePath);$(VC_ExecutablePath_x64);$(VC_LibraryPath_x64) + false $(SolutionDir)output\$(Platform)\$(Configuration)\ @@ -307,6 +316,7 @@ $(VC_ReferencesPath_x64); $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64) $(CommonExcludePath);$(VC_ExecutablePath_x64);$(VC_LibraryPath_x64) + false $(SolutionDir)output\$(Platform)\$(Configuration)\ @@ -317,6 +327,7 @@ $(VC_ReferencesPath_x64); $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64) $(CommonExcludePath);$(VC_ExecutablePath_x64);$(VC_LibraryPath_x64) + false $(SolutionDir)output\$(Platform)\$(Configuration)\ @@ -327,6 +338,7 @@ $(VC_ReferencesPath_x64); $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64) $(CommonExcludePath);$(VC_ExecutablePath_x64);$(VC_LibraryPath_x64) + false $(SolutionDir)output\$(Platform)\$(Configuration)\ @@ -390,14 +402,18 @@ true ProgramDatabase - MultiThreadedDebugDLL - true + MultiThreadedDLL + + + false Console true + true + true @@ -419,14 +435,18 @@ true ProgramDatabase - MultiThreadedDebugDLL - true + MultiThreadedDLL + + + false Console true + true + true @@ -448,14 +468,18 @@ true ProgramDatabase - MultiThreadedDebugDLL - true + MultiThreadedDLL + + + false Console true + true + true @@ -477,14 +501,18 @@ true ProgramDatabase - MultiThreadedDebugDLL - true + MultiThreadedDLL + + + false Console true + true + true @@ -503,6 +531,9 @@ false ProgramDatabase + MultiThreadedDLL + + Console @@ -530,6 +561,9 @@ false ProgramDatabase + MultiThreadedDLL + + Console @@ -557,6 +591,9 @@ false ProgramDatabase + MultiThreadedDLL + + Console @@ -584,6 +621,9 @@ false ProgramDatabase + MultiThreadedDLL + + Console @@ -613,14 +653,18 @@ NotSet true ProgramDatabase - true - MultiThreadedDebugDLL + + + MultiThreadedDLL + false Console true + true + true @@ -642,14 +686,18 @@ NotSet true ProgramDatabase - true - MultiThreadedDebugDLL + + + MultiThreadedDLL + false Console true + true + true @@ -671,14 +719,18 @@ AdvancedVectorExtensions2 true ProgramDatabase - true - MultiThreadedDebugDLL + + + MultiThreadedDLL + false Console true + true + true @@ -700,14 +752,18 @@ AdvancedVectorExtensions2 true ProgramDatabase - true - MultiThreadedDebugDLL + + + MultiThreadedDLL + false Console true + true + true @@ -727,6 +783,9 @@ NotSet ProgramDatabase false + MultiThreadedDLL + + Console @@ -754,6 +813,9 @@ NotSet ProgramDatabase false + MultiThreadedDLL + + Console @@ -781,6 +843,9 @@ AdvancedVectorExtensions2 ProgramDatabase false + MultiThreadedDLL + + Console @@ -808,6 +873,9 @@ AdvancedVectorExtensions2 ProgramDatabase false + MultiThreadedDLL + + Console @@ -849,7 +917,7 @@ - + @@ -873,7 +941,7 @@ - + @@ -922,6 +990,7 @@ + @@ -1167,7 +1236,7 @@ - + @@ -1256,7 +1325,7 @@ - + diff --git a/Amalgam/Amalgam.vcxproj.filters b/Amalgam/Amalgam.vcxproj.filters index 342d66b0..187857d6 100644 --- a/Amalgam/Amalgam.vcxproj.filters +++ b/Amalgam/Amalgam.vcxproj.filters @@ -2,7 +2,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -194,6 +194,7 @@ + @@ -201,7 +202,7 @@ - + @@ -406,7 +407,7 @@ - + diff --git a/Amalgam/src/BytePatches/BytePatches.cpp b/Amalgam/src/BytePatches/BytePatches.cpp index d8f2a9f8..069823a5 100644 --- a/Amalgam/src/BytePatches/BytePatches.cpp +++ b/Amalgam/src/BytePatches/BytePatches.cpp @@ -60,7 +60,8 @@ bool CBytePatches::Initialize() { m_vPatches = { BytePatch("engine.dll", "0F 82 ? ? ? ? 4A 63 84 2F", 0x0, "90 90 90 90 90 90"), // skybox fix - //BytePatch("server.dll", "75 ? 44 38 A7 ? ? ? ? 75 ? 41 3B DD", 0x0, "EB") // listen server speedhack + //BytePatch("server.dll", "75 ? 44 38 A7 ? ? ? ? 75 ? 41 3B DD", 0x0, "EB"), // listen server speedhack + BytePatch("vguimatsurface.dll", "66 83 FE ? 0F 84", 0x0, "66 83 FE 00"), // include '&' in text size }; for (auto& patch : m_vPatches) diff --git a/Amalgam/src/Core/Core.cpp b/Amalgam/src/Core/Core.cpp index b6539b49..b2b9c006 100644 --- a/Amalgam/src/Core/Core.cpp +++ b/Amalgam/src/Core/Core.cpp @@ -48,6 +48,23 @@ void CCore::AppendFailText(const char* sMessage) OutputDebugStringA(std::format("{}\n", sMessage).c_str()); } +void CCore::LogFailText() +{ + ssFailStream << "\nBuilt @ " __DATE__ ", " __TIME__ ", " __CONFIGURATION__ "\n"; + ssFailStream << "Ctrl + C to copy. \n"; + try + { + std::ofstream file; + file.open(F::Configs.m_sConfigPath + "fail_log.txt", std::ios_base::app); + file << ssFailStream.str() + "\n\n\n"; + file.close(); + ssFailStream << "Logged to Amalgam\\fail_log.txt. "; + } + catch (...) {} + + SDK::Output("Failed to load", ssFailStream.str().c_str(), {}, false, true, false, false, false, false, MB_OK | MB_ICONERROR); +} + void CCore::Load() { if (m_bUnload = m_bFailed = FNV1A::Hash32(GetProcessName(GetCurrentProcessId()).c_str()) != FNV1A::Hash32Const("tf_win64.exe")) @@ -103,24 +120,12 @@ void CCore::Unload() { if (m_bFailed) { - ssFailStream << "\n" __CONFIGURATION__ " @ " __DATE__ ", " __TIME__ " (1)\n"; - ssFailStream << "Ctrl + C to copy. \n"; - try - { - std::ofstream file; - file.open(F::Configs.m_sConfigPath + "fail_log.txt", std::ios_base::app); - file << ssFailStream.str() + "\n\n\n"; - file.close(); - ssFailStream << "Logged to Amalgam\\fail_log.txt. "; - } - catch (...) {} - - SDK::Output("Failed to load", ssFailStream.str().c_str(), {}, false, true, false, false, false, false, MB_OK | MB_ICONERROR); + LogFailText(); return; } G::Unload = true; - m_bFailed2 = !U::Hooks.Unload(); + m_bFailed2 = !U::Hooks.Unload() || m_bFailed2; U::BytePatches.Unload(); H::Events.Unload(); @@ -144,19 +149,7 @@ void CCore::Unload() if (m_bFailed2) { - ssFailStream << "\n" __CONFIGURATION__ " @ " __DATE__ ", " __TIME__ " (2)\n"; - ssFailStream << "Ctrl + C to copy. \n"; - try - { - std::ofstream file; - file.open(F::Configs.m_sConfigPath + "fail_log.txt", std::ios_base::app); - file << ssFailStream.str() + "\n\n\n"; - file.close(); - ssFailStream << "Logged to Amalgam\\fail_log.txt. "; - } - catch (...) {} - - SDK::Output("Failed to load", ssFailStream.str().c_str(), {}, false, true, false, false, false, false, MB_OK | MB_ICONERROR); + LogFailText(); return; } diff --git a/Amalgam/src/Core/Core.h b/Amalgam/src/Core/Core.h index d4645924..6d24931f 100644 --- a/Amalgam/src/Core/Core.h +++ b/Amalgam/src/Core/Core.h @@ -12,6 +12,7 @@ public: void Unload(); void AppendFailText(const char* sMessage); + void LogFailText(); bool m_bUnload = false; diff --git a/Amalgam/src/Features/Aimbot/Aimbot.cpp b/Amalgam/src/Features/Aimbot/Aimbot.cpp index 63816f88..c1c65f7d 100644 --- a/Amalgam/src/Features/Aimbot/Aimbot.cpp +++ b/Amalgam/src/Features/Aimbot/Aimbot.cpp @@ -86,4 +86,21 @@ void CAimbot::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) RunMain(pLocal, pWeapon, pCmd); G::Attacking = SDK::IsAttacking(pLocal, pWeapon, pCmd, true); +} + +void CAimbot::Draw(CTFPlayer* pLocal) +{ + if (!Vars::Aimbot::General::FOVCircle.Value || !Vars::Colors::FOVCircle.Value.a || !pLocal->IsAlive() || pLocal->IsAGhost() || pLocal->IsTaunting() || pLocal->InCond(TF_COND_STUNNED) && pLocal->m_iStunFlags() & (TF_STUN_CONTROLS | TF_STUN_LOSER_STATE) || pLocal->InCond(TF_COND_HALLOWEEN_KART)) + return; + + auto pWeapon = H::Entities.GetWeapon(); + if (pWeapon && SDK::AttribHookValue(1, "mult_dmg", pWeapon) == 0) + return; + + if (Vars::Aimbot::General::AimFOV.Value >= 90.f) + return; + + 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); } \ No newline at end of file diff --git a/Amalgam/src/Features/Aimbot/Aimbot.h b/Amalgam/src/Features/Aimbot/Aimbot.h index e2fd26da..01192591 100644 --- a/Amalgam/src/Features/Aimbot/Aimbot.h +++ b/Amalgam/src/Features/Aimbot/Aimbot.h @@ -10,6 +10,7 @@ private: public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); + void Draw(CTFPlayer* pLocal); bool m_bRan = false; bool m_bRunningSecondary = false; diff --git a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp index 5f8be28d..e29330a0 100644 --- a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp @@ -1,6 +1,8 @@ #include "AimbotGlobal.h" +#include "../Aimbot.h" #include "../../Players/PlayerUtils.h" +#include "../../Ticks/Ticks.h" void CAimbotGlobal::SortTargets(std::vector& vTargets, int iMethod) { // Sort by preference @@ -26,13 +28,17 @@ void CAimbotGlobal::SortPriority(std::vector& vTargets) // this won't prevent shooting bones outside of fov bool CAimbotGlobal::PlayerBoneInFOV(CTFPlayer* pTarget, Vec3 vLocalPos, Vec3 vLocalAngles, float& flFOVTo, Vec3& vPos, Vec3& vAngleTo, int iHitboxes) { + matrix3x4 aBones[MAXSTUDIOBONES]; + if (!pTarget->SetupBones(aBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, I::GlobalVars->curtime)) + return false; + float flMinFOV = 180.f; for (int nHitbox = 0; nHitbox < pTarget->GetNumOfHitboxes(); nHitbox++) { if (!IsHitboxValid(H::Entities.GetModel(pTarget->entindex()), nHitbox, iHitboxes)) continue; - Vec3 vCurPos = pTarget->GetHitboxCenter(nHitbox); + Vec3 vCurPos = pTarget->GetHitboxCenter(aBones, nHitbox); Vec3 vCurAngleTo = Math::CalcAngle(vLocalPos, vCurPos); float flCurFOVTo = Math::CalcFov(vLocalAngles, vCurAngleTo); @@ -76,6 +82,7 @@ bool CAimbotGlobal::IsHitboxValid(uint32_t uHash, int nHitbox, int iHitboxes) case HITBOX_SAXTON_RIGHT_CALF: case HITBOX_SAXTON_RIGHT_FOOT: return iHitboxes & Vars::Aimbot::Hitscan::HitboxesEnum::Legs; } + break; } default: { @@ -257,6 +264,36 @@ int CAimbotGlobal::GetPriority(int targetIdx) return F::PlayerUtils.GetPriority(targetIdx); } +bool CAimbotGlobal::ShouldAim() +{ + switch (Vars::Aimbot::General::AimType.Value) + { + case Vars::Aimbot::General::AimTypeEnum::Plain: + case Vars::Aimbot::General::AimTypeEnum::Silent: + // for performance reasons, the F::Ticks.m_bDoubletap condition is not a great fix here + // and actually properly predicting when shots will be fired should likely be done over this, but it's fine for now + if (!G::CanPrimaryAttack && !G::Reloading && !F::Ticks.m_bDoubletap && !F::Ticks.m_bSpeedhack) + return false; + } + + return true; +} + +bool CAimbotGlobal::ShouldHoldAttack(CTFWeaponBase* pWeapon) +{ + switch (Vars::Aimbot::General::AimHoldsFire.Value) + { + case Vars::Aimbot::General::AimHoldsFireEnum::MinigunOnly: + if (pWeapon->GetWeaponID() != TF_WEAPON_MINIGUN) + break; + [[fallthrough]]; + case Vars::Aimbot::General::AimHoldsFireEnum::Always: + if (!F::Aimbot.m_bRunningSecondary && !G::CanPrimaryAttack && G::LastUserCmd->buttons & IN_ATTACK && Vars::Aimbot::General::AimType.Value && !pWeapon->IsInReload()) + return true; + } + return false; +} + // will not predict for projectile weapons bool CAimbotGlobal::ValidBomb(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CBaseEntity* pBomb) { @@ -273,7 +310,7 @@ bool CAimbotGlobal::ValidBomb(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CBaseEn if (!pEntity || pEntity == pLocal || pEntity->IsPlayer() && (!pEntity->As()->IsAlive() || pEntity->As()->IsAGhost()) || pEntity->m_iTeamNum() == pLocal->m_iTeamNum()) continue; - Vec3 vPos = {}; reinterpret_cast(pEntity->GetCollideable())->CalcNearestPoint(vOrigin, &vPos); + Vec3 vPos; reinterpret_cast(pEntity->GetCollideable())->CalcNearestPoint(vOrigin, &vPos); if (vOrigin.DistTo(vPos) > 300.f) continue; diff --git a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h index 3fe72721..349fff8c 100644 --- a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h +++ b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h @@ -15,7 +15,7 @@ struct Target_t int m_nPriority = 0; int m_nAimedHitbox = -1; - TickRecord m_tRecord = {}; + TickRecord* m_pRecord = nullptr; bool m_bBacktrack = false; }; @@ -31,6 +31,8 @@ public: bool ShouldIgnore(CBaseEntity* pTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon); int GetPriority(int targetIdx); + bool ShouldAim(); + bool ShouldHoldAttack(CTFWeaponBase* pWeapon); bool ValidBomb(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CBaseEntity* pBomb); }; diff --git a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp index 60f303c7..1dd9802e 100644 --- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp @@ -2,7 +2,7 @@ #include "../Aimbot.h" #include "../../Resolver/Resolver.h" -#include "../../TickHandler/TickHandler.h" +#include "../../Ticks/Ticks.h" #include "../../Visuals/Visuals.h" #include "../../Simulation/MovementSimulation/MovementSimulation.h" @@ -280,30 +280,22 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* auto pSet = pHDR->pHitboxSet(tTarget.m_pEntity->As()->m_nHitboxSet()); if (!pSet) return false; - std::deque vRecords; + std::vector vRecords = {}; { - auto pRecords = F::Backtrack.GetRecords(tTarget.m_pEntity); - if (pRecords) + if (F::Backtrack.GetRecords(tTarget.m_pEntity, vRecords)) { - vRecords = F::Backtrack.GetValidRecords(pRecords, pLocal); + vRecords = F::Backtrack.GetValidRecords(vRecords, pLocal); if (vRecords.empty()) return false; - - if (!Vars::Backtrack::Enabled.Value) - vRecords = { vRecords.front() }; } - if (!pRecords || vRecords.empty()) + else { - if (auto pBones = H::Entities.GetBones(tTarget.m_pEntity->entindex())) - vRecords.emplace_front(tTarget.m_pEntity->m_flSimulationTime(), *reinterpret_cast(pBones), tTarget.m_pEntity->m_vecOrigin()); - else - { - matrix3x4 aBones[MAXSTUDIOBONES]; - if (!tTarget.m_pEntity->SetupBones(aBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, tTarget.m_pEntity->m_flSimulationTime())) - return false; + matrix3x4 aBones[MAXSTUDIOBONES]; + if (!tTarget.m_pEntity->SetupBones(aBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, tTarget.m_pEntity->m_flSimulationTime())) + return false; - vRecords.emplace_front(tTarget.m_pEntity->m_flSimulationTime(), *reinterpret_cast(&aBones), tTarget.m_pEntity->m_vecOrigin()); - } + F::Backtrack.m_tRecord = { tTarget.m_pEntity->m_flSimulationTime(), *reinterpret_cast(&aBones), tTarget.m_pEntity->m_vecOrigin() }; + vRecords = { &F::Backtrack.m_tRecord }; } } @@ -316,10 +308,10 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* Vec3* pDoubletapAngle = F::Ticks.GetShootAngle(); if (pDoubletapAngle && tTarget.m_iTargetType == TargetEnum::Player) { - std::sort(vRecords.begin(), vRecords.end(), [&](const TickRecord& a, const TickRecord& b) -> bool + std::sort(vRecords.begin(), vRecords.end(), [&](const TickRecord* a, const TickRecord* b) -> bool { - Vec3 vPosA = { a.m_BoneMatrix.m_aBones[iTargetBone][0][3], a.m_BoneMatrix.m_aBones[iTargetBone][1][3], a.m_BoneMatrix.m_aBones[iTargetBone][2][3] }; - Vec3 vPosB = { b.m_BoneMatrix.m_aBones[iTargetBone][0][3], b.m_BoneMatrix.m_aBones[iTargetBone][1][3], b.m_BoneMatrix.m_aBones[iTargetBone][2][3] }; + Vec3 vPosA = { a->m_BoneMatrix.m_aBones[iTargetBone][0][3], a->m_BoneMatrix.m_aBones[iTargetBone][1][3], a->m_BoneMatrix.m_aBones[iTargetBone][2][3] }; + Vec3 vPosB = { a->m_BoneMatrix.m_aBones[iTargetBone][0][3], a->m_BoneMatrix.m_aBones[iTargetBone][1][3], a->m_BoneMatrix.m_aBones[iTargetBone][2][3] }; Vec3 vAnglesA = Math::CalcAngle(vEyePos, vPosA); Vec3 vAnglesB = Math::CalcAngle(vEyePos, vPosB); return pDoubletapAngle->DeltaAngle(vAnglesA).Length2D() < pDoubletapAngle->DeltaAngle(vAnglesB).Length2D(); @@ -327,7 +319,7 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* } int iReturn = false; - for (auto& tRecord : vRecords) + for (auto pRecord : vRecords) { bool bRunPeekCheck = flSpread && (Vars::Aimbot::General::PeekDTOnly.Value ? F::Ticks.GetTicks(pWeapon) : true) && Vars::Aimbot::General::HitscanPeek.Value; @@ -371,7 +363,7 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* if (!bChanged || Math::RayToOBB(vEyePos, vForward, vCheckMins, vCheckMaxs, mTransform) && SDK::VisPos(pLocal, tTarget.m_pEntity, vEyePos, vEyePos + vForward * flDist)) { tTarget.m_vAngleTo = vAngles; - tTarget.m_tRecord = tRecord; + tTarget.m_pRecord = pRecord; return true; } else if (iReturn == 2 ? vAngles.DeltaAngle(G::CurrentUserCmd->viewangles).Length2D() < tTarget.m_vAngleTo.DeltaAngle(G::CurrentUserCmd->viewangles).Length2D() : true) @@ -384,7 +376,7 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* if (tTarget.m_iTargetType == TargetEnum::Player) { - auto aBones = tRecord.m_BoneMatrix.m_aBones; + auto aBones = pRecord->m_BoneMatrix.m_aBones; if (!aBones) continue; @@ -414,7 +406,7 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* Vec3 vHullMins = (pViewVectors ? pViewVectors->m_vHullMin : Vec3(-24, -24, 0)) * flModelScale; Vec3 vHullMaxs = (pViewVectors ? pViewVectors->m_vHullMax : Vec3(24, 24, 82)) * flModelScale; - const matrix3x4 mTransform = { { 1, 0, 0, tRecord.m_vOrigin.x }, { 0, 1, 0, tRecord.m_vOrigin.y }, { 0, 0, 1, tRecord.m_vOrigin.z } }; + const matrix3x4 mTransform = { { 1, 0, 0, pRecord->m_vOrigin.x }, { 0, 1, 0, pRecord->m_vOrigin.y }, { 0, 0, 1, pRecord->m_vOrigin.z } }; for (auto& [pBox, iHitbox, _] : vHitboxes) { @@ -461,7 +453,7 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* for (auto& vPoint : vPoints) { - Vec3 vOrigin = {}; Math::VectorTransform(vPoint, aBones[pBox->bone], vOrigin); vOrigin += vOffset; + Vec3 vOrigin; Math::VectorTransform(vPoint, aBones[pBox->bone], vOrigin); vOrigin += vOffset; if (vEyePos.DistToSqr(vOrigin) > flMaxRange) continue; @@ -486,7 +478,7 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* iTargetBone = pBox->bone; tTarget.m_vAngleTo = vAngles; - tTarget.m_tRecord = tRecord; + tTarget.m_pRecord = pRecord; tTarget.m_vPos = vOrigin; tTarget.m_nAimedHitbox = iHitbox; tTarget.m_bBacktrack = true; @@ -558,7 +550,7 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* if (!bChanged || Math::RayToOBB(vEyePos, vForward, vCheckMins, vCheckMaxs, mTransform) && SDK::VisPos(pLocal, tTarget.m_pEntity, vEyePos, vEyePos + vForward * flDist)) { tTarget.m_vAngleTo = vAngles; - tTarget.m_tRecord = tRecord; + tTarget.m_pRecord = pRecord; tTarget.m_vPos = vOrigin; return true; } @@ -722,9 +714,10 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC Vars::Aimbot::General::AimType.Value = iLastAimType; } - if (!F::Aimbot.m_bRunningSecondary && (Vars::Aimbot::General::AimHoldsFire.Value == Vars::Aimbot::General::AimHoldsFireEnum::Always || Vars::Aimbot::General::AimHoldsFire.Value == 1 && nWeaponID == TF_WEAPON_MINIGUN) && !G::CanPrimaryAttack && G::LastUserCmd->buttons & IN_ATTACK && Vars::Aimbot::General::AimType.Value && !pWeapon->IsInReload()) + if (F::AimbotGlobal.ShouldHoldAttack(pWeapon)) pCmd->buttons |= IN_ATTACK; - if (!Vars::Aimbot::General::AimType.Value || !G::CanPrimaryAttack && !G::Reloading && !F::Ticks.m_bDoubletap && !F::Ticks.m_bSpeedhack && Vars::Aimbot::General::AimType.Value == 3 && (nWeaponID == TF_WEAPON_MINIGUN ? pWeapon->As()->m_iWeaponState() == AC_STATE_FIRING || pWeapon->As()->m_iWeaponState() == AC_STATE_SPINNING : true)) + if (!Vars::Aimbot::General::AimType.Value + || !F::AimbotGlobal.ShouldAim() && (nWeaponID != TF_WEAPON_MINIGUN || pWeapon->As()->m_iWeaponState() == AC_STATE_FIRING || pWeapon->As()->m_iWeaponState() == AC_STATE_SPINNING)) return; switch (nWeaponID) @@ -821,7 +814,7 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC F::Resolver.HitscanRan(pLocal, tTarget.m_pEntity->As(), pWeapon, tTarget.m_nAimedHitbox); if (tTarget.m_bBacktrack) - pCmd->tick_count = TIME_TO_TICKS(tTarget.m_tRecord.m_flSimTime) + TIME_TO_TICKS(F::Backtrack.GetFakeInterp()); + 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; @@ -844,7 +837,7 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC } if (bBoxes) { - auto vBoxes = F::Visuals.GetHitboxes(tTarget.m_tRecord.m_BoneMatrix.m_aBones, tTarget.m_pEntity->As(), {}, tTarget.m_nAimedHitbox); + 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()); } } diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp index 71e0989e..de4de6ab 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp @@ -2,7 +2,7 @@ #include "../Aimbot.h" #include "../../Simulation/MovementSimulation/MovementSimulation.h" -#include "../../TickHandler/TickHandler.h" +#include "../../Ticks/Ticks.h" #include "../../Visuals/Visuals.h" std::vector CAimbotMelee::GetTargets(CTFPlayer* pLocal, CTFWeaponBase* pWeapon) @@ -110,8 +110,8 @@ int CAimbotMelee::GetSwingTime(CTFWeaponBase* pWeapon) } void CAimbotMelee::SimulatePlayers(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, std::vector vTargets, - Vec3& vEyePos, std::unordered_map>& pRecordMap, - std::unordered_map>& mPaths) + Vec3& vEyePos, std::unordered_map>& mRecordMap, + std::unordered_map>& mPaths) { // swing prediction / auto warp const int iSwingTicks = GetSwingTime(pWeapon); @@ -144,7 +144,7 @@ void CAimbotMelee::SimulatePlayers(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, st F::MoveSim.RunTick(tStorage); if (!tStorage.m_bFailed) - pRecordMap[tTarget.m_pEntity->entindex()].emplace_front( + 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, BoneMatrix(), Vars::Aimbot::Melee::SwingPredictLag.Value ? tStorage.m_vPredictedOrigin : tStorage.m_MoveData.m_vecAbsOrigin @@ -213,7 +213,7 @@ bool CAimbotMelee::CanBackstab(CBaseEntity* pTarget, CTFPlayer* pLocal, Vec3 vEy return false; float flTolerance = 0.0625f; - float flExtra = 2.f * flTolerance / flDist; // account for origin tolerance + float flExtra = 2.f * flTolerance / flDist; // account for origin compression float flPosVsTargetViewMinDot = 0.f + 0.0031f + flExtra; float flPosVsOwnerViewMinDot = 0.5f + flExtra; @@ -268,67 +268,45 @@ int CAimbotMelee::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pW Vec3 vSwingMins = { -flHull, -flHull, -flHull }; Vec3 vSwingMaxs = { flHull, flHull, flHull }; - std::deque vRecords; + std::vector vRecords = {}; { - auto pRecords = F::Backtrack.GetRecords(tTarget.m_pEntity); - if (pRecords) + if (F::Backtrack.GetRecords(tTarget.m_pEntity, vRecords)) { - if (Vars::Backtrack::Enabled.Value) - vRecords = *pRecords; - else + if (!vRecords.empty()) { - vRecords = F::Backtrack.GetValidRecords(pRecords, pLocal); - if (!vRecords.empty()) - vRecords = { vRecords.front() }; + for (auto& tRecord : vSimRecords) + vRecords.push_back(&tRecord); + vRecords = F::Backtrack.GetValidRecords(vRecords, pLocal, true, -TICKS_TO_TIME(vSimRecords.size())); } - if (vRecords.empty()) return false; } - if (!pRecords || vRecords.empty()) + else { - if (auto pBones = H::Entities.GetBones(tTarget.m_pEntity->entindex())) - vRecords.emplace_front(tTarget.m_pEntity->m_flSimulationTime(), *reinterpret_cast(pBones), tTarget.m_pEntity->m_vecOrigin(), - tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs()); - else - { - matrix3x4 aBones[MAXSTUDIOBONES]; - if (!tTarget.m_pEntity->SetupBones(aBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, tTarget.m_pEntity->m_flSimulationTime())) - return false; + matrix3x4 aBones[MAXSTUDIOBONES]; + if (!tTarget.m_pEntity->SetupBones(aBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, tTarget.m_pEntity->m_flSimulationTime())) + return false; - vRecords.emplace_front(tTarget.m_pEntity->m_flSimulationTime(), *reinterpret_cast(&aBones), tTarget.m_pEntity->m_vecOrigin(), - tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs()); - } + F::Backtrack.m_tRecord = { tTarget.m_pEntity->m_flSimulationTime(), *reinterpret_cast(&aBones), tTarget.m_pEntity->m_vecOrigin(), + tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs() }; + vRecords = { &F::Backtrack.m_tRecord }; } } - if (!vSimRecords.empty()) - { - for (TickRecord& tRecord : vSimRecords) - { - vRecords.pop_back(); - vRecords.emplace_front(tRecord.m_flSimTime, BoneMatrix(), tRecord.m_vOrigin, tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs()); - } - for (TickRecord& tRecord : vRecords) - tRecord.m_flSimTime -= TICKS_TO_TIME(vSimRecords.size()); - } - vRecords = tTarget.m_iTargetType == TargetEnum::Player ? F::Backtrack.GetValidRecords(&vRecords, pLocal, true) : vRecords; - if (!Vars::Backtrack::Enabled.Value && !vRecords.empty()) - vRecords = { vRecords.front() }; CGameTrace trace = {}; CTraceFilterHitscan filter = {}; filter.pSkip = pLocal; - for (auto& tRecord : vRecords) + for (auto pRecord : vRecords) { Vec3 vRestoreOrigin = tTarget.m_pEntity->GetAbsOrigin(); Vec3 vRestoreMins = tTarget.m_pEntity->m_vecMins(); Vec3 vRestoreMaxs = tTarget.m_pEntity->m_vecMaxs(); - tTarget.m_pEntity->SetAbsOrigin(tRecord.m_vOrigin); - tTarget.m_pEntity->m_vecMins() = tRecord.m_vMins + 0.125f; // account for origin tolerance - tTarget.m_pEntity->m_vecMaxs() = tRecord.m_vMaxs - 0.125f; + tTarget.m_pEntity->SetAbsOrigin(pRecord->m_vOrigin); + tTarget.m_pEntity->m_vecMins() = pRecord->m_vMins + 0.125f; // account for origin compression + tTarget.m_pEntity->m_vecMaxs() = pRecord->m_vMaxs - 0.125f; - Vec3 vDiff = { 0, 0, std::clamp(vEyePos.z - tRecord.m_vOrigin.z, tTarget.m_pEntity->m_vecMins().z, tTarget.m_pEntity->m_vecMaxs().z) }; - tTarget.m_vPos = tRecord.m_vOrigin + vDiff; + Vec3 vDiff = { 0, 0, std::clamp(vEyePos.z - pRecord->m_vOrigin.z, tTarget.m_pEntity->m_vecMins().z, tTarget.m_pEntity->m_vecMaxs().z) }; + tTarget.m_vPos = pRecord->m_vOrigin + vDiff; Aim(G::CurrentUserCmd->viewangles, Math::CalcAngle(vEyePos, tTarget.m_vPos), tTarget.m_vAngleTo); Vec3 vForward; Math::AngleVectors(tTarget.m_vAngleTo, &vForward); @@ -356,8 +334,8 @@ int CAimbotMelee::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pW if (bReturn) { - tTarget.m_tRecord = tRecord; - tTarget.m_bBacktrack = tTarget.m_iTargetType == TargetEnum::Player /*&& Vars::Backtrack::Enabled.Value*/; + tTarget.m_pRecord = pRecord; + tTarget.m_bBacktrack = tTarget.m_iTargetType == TargetEnum::Player; return true; } @@ -450,9 +428,10 @@ void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd else if (iAimType) Vars::Aimbot::General::AimType.Value = iAimType; - if (!F::Aimbot.m_bRunningSecondary && Vars::Aimbot::General::AimHoldsFire.Value == Vars::Aimbot::General::AimHoldsFireEnum::Always && !G::CanPrimaryAttack && G::LastUserCmd->buttons & IN_ATTACK && Vars::Aimbot::General::AimType.Value) + if (F::AimbotGlobal.ShouldHoldAttack(pWeapon)) pCmd->buttons |= IN_ATTACK; - if (!Vars::Aimbot::General::AimType.Value || Vars::Aimbot::General::AimType.Value == Vars::Aimbot::General::AimTypeEnum::Silent && !G::CanPrimaryAttack && pWeapon->m_flSmackTime() < 0.f) + if (!Vars::Aimbot::General::AimType.Value + || !F::AimbotGlobal.ShouldAim() && pWeapon->m_flSmackTime() < 0.f) return; if (RunSapper(pLocal, pWeapon, pCmd)) @@ -466,16 +445,16 @@ void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd const bool bShouldSwing = iDoubletapTicks <= (GetSwingTime(pWeapon) ? 14 : 0) || Vars::Doubletap::AntiWarp.Value && pLocal->m_hGroundEntity(); Vec3 vEyePos = pLocal->GetShootPos(); - std::unordered_map> pRecordMap; - std::unordered_map> mPaths; - SimulatePlayers(pLocal, pWeapon, vTargets, vEyePos, pRecordMap, mPaths); + std::unordered_map> mRecordMap; + std::unordered_map> mPaths; + SimulatePlayers(pLocal, pWeapon, vTargets, vEyePos, mRecordMap, mPaths); //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, pRecordMap[tTarget.m_pEntity->entindex()]); + const auto iResult = CanHit(tTarget, pLocal, pWeapon, vEyePos, mRecordMap[tTarget.m_pEntity->entindex()]); if (!iResult) continue; if (iResult == 2) { @@ -500,7 +479,7 @@ void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd if (G::Attacking == 1) { if (tTarget.m_bBacktrack) - pCmd->tick_count = TIME_TO_TICKS(tTarget.m_tRecord.m_flSimTime) + TIME_TO_TICKS(F::Backtrack.GetFakeInterp()); + pCmd->tick_count = TIME_TO_TICKS(tTarget.m_pRecord->m_flSimTime) + TIME_TO_TICKS(F::Backtrack.GetFakeInterp()); // bug: fast old records seem to be progressively more unreliable ? } else @@ -550,13 +529,13 @@ void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd } if (bBoxes) { - auto vBoxes = F::Visuals.GetHitboxes(tTarget.m_tRecord.m_BoneMatrix.m_aBones, tTarget.m_pEntity->As()); + 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_tRecord.m_vOrigin, tTarget.m_tRecord.m_vMins, tTarget.m_tRecord.m_vMaxs, Vec3(), I::GlobalVars->curtime + Vars::Visuals::Hitbox::DrawDuration.Value, Vars::Colors::BoneHitboxEdge.Value, Vars::Colors::BoneHitboxFace.Value); + // 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_tRecord.m_vOrigin, tTarget.m_tRecord.m_vMins, tTarget.m_tRecord.m_vMaxs, Vec3(), I::GlobalVars->curtime + Vars::Visuals::Hitbox::DrawDuration.Value, Vars::Colors::BoneHitboxEdgeClipped.Value, Vars::Colors::BoneHitboxFaceClipped.Value, true); + // 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); } } diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h index e13fff4d..1401243d 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h @@ -11,8 +11,8 @@ class CAimbotMelee int GetSwingTime(CTFWeaponBase* pWeapon); void SimulatePlayers(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, std::vector vTargets, Vec3& vEyePos, - std::unordered_map>& pRecordMap, - std::unordered_map>& mPaths); + std::unordered_map>& mRecordMap, + std::unordered_map>& mPaths); bool CanBackstab(CBaseEntity* pTarget, CTFPlayer* pLocal, Vec3 vEyeAngles); int CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Vec3 vEyePos, std::deque& vSimRecords); diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp index 60250ab3..f58c62c0 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp @@ -3,7 +3,7 @@ #include "../Aimbot.h" #include "../../Simulation/MovementSimulation/MovementSimulation.h" #include "../../Simulation/ProjectileSimulation/ProjectileSimulation.h" -#include "../../TickHandler/TickHandler.h" +#include "../../Ticks/Ticks.h" #include "../../Visuals/Visuals.h" //#define SPLASH_DEBUG1 // normal splash visualization @@ -58,6 +58,9 @@ std::vector CAimbotProjectile::GetTargets(CTFPlayer* pLocal, CTFWeapon float flDistTo = iSort == Vars::Aimbot::General::TargetSelectionEnum::Distance ? vLocalPos.DistTo(vPos) : 0.f; vTargets.emplace_back(pEntity, TargetEnum::Player, vPos, vAngleTo, flFOVTo, flDistTo, bTeammate ? 0 : F::AimbotGlobal.GetPriority(pEntity->entindex())); } + + if (pWeapon->GetWeaponID() == TF_WEAPON_LUNCHBOX) + return vTargets; } if (Vars::Aimbot::General::Target.Value) @@ -265,11 +268,15 @@ std::unordered_map CAimbotProjectile::GetDirectPoints(Target_t& tTarg case 0: if (tTarget.m_nAimedHitbox == HITBOX_HEAD) { - //Vec3 vOff = tTarget.m_pEntity->As()->GetHitboxOrigin(HITBOX_HEAD) - tTarget.m_pEntity->GetAbsOrigin(); + auto pBones = H::Entities.GetBones(tTarget.m_pEntity->entindex()); + if (!pBones) + break; + + //Vec3 vOff = tTarget.m_pEntity->As()->GetHitboxOrigin(pBones, 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(HITBOX_HEAD, &vCenter, &vBBoxMins, &vBBoxMaxs); - Vec3 vOff = vCenter + (vBBoxMins + vBBoxMaxs) / 2 - tTarget.m_pEntity->GetAbsOrigin(); + Vec3 vCenter, vBBoxMins, vBBoxMaxs; tTarget.m_pEntity->As()->GetHitboxInfo(pBones, HITBOX_HEAD, &vCenter, &vBBoxMins, &vBBoxMaxs); + Vec3 vOff = vCenter + (vBBoxMins + vBBoxMaxs) / 2 - tTarget.m_pEntity->m_vecOrigin(); float flLow = 0.f; Vec3 vDelta = tTarget.m_vPos + tInfo.m_vTargetEye - tInfo.m_vLocalEye; @@ -639,7 +646,7 @@ std::vector CAimbotProjectile::GetSplashPoints(Target_t& tTarget, std:: bool bValid = vPoint.m_Solution.m_iCalculated != CalculatedEnum::Pending; if (bValid) { - Vec3 vPos = {}; reinterpret_cast(tTarget.m_pEntity->GetCollideable())->CalcNearestPoint(vPoint.m_vPoint, &vPos); + Vec3 vPos; reinterpret_cast(tTarget.m_pEntity->GetCollideable())->CalcNearestPoint(vPoint.m_vPoint, &vPos); bValid = vPoint.m_vPoint.DistTo(vPos) < tInfo.m_flRadius; } @@ -1072,7 +1079,7 @@ 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::deque* pProjectilePath) +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; #ifdef SPLASH_DEBUG6 @@ -1333,7 +1340,7 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, - std::deque* pPlayerPath, std::deque* pProjectilePath, std::vector* pBoxes, float* pTimeTo) + std::vector* pPlayerPath, std::vector* pProjectilePath, std::vector* pBoxes, float* pTimeTo) { //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; @@ -1483,7 +1490,7 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas } Vec3 vAngles; Aim(G::CurrentUserCmd->viewangles, { vPoint.m_Solution.m_flPitch, vPoint.m_Solution.m_flYaw, 0.f }, vAngles); - std::deque vProjLines; bool bHitSolid = false; + std::vector vProjLines; bool bHitSolid = false; if (TestAngle(pLocal, pWeapon, tTarget, vPoint.m_vPoint, vAngles, i, bSplash, &bHitSolid, &vProjLines)) { @@ -1557,6 +1564,7 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas 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; @@ -1590,6 +1598,7 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas pBoxes->push_back(bBox); } } + */ } } @@ -1721,10 +1730,10 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser else if (iAimType) Vars::Aimbot::General::AimType.Value = iAimType; - if (!F::Aimbot.m_bRunningSecondary && Vars::Aimbot::General::AimHoldsFire.Value == Vars::Aimbot::General::AimHoldsFireEnum::Always && !G::CanPrimaryAttack && G::LastUserCmd->buttons & IN_ATTACK && Vars::Aimbot::General::AimType.Value && !pWeapon->IsInReload()) + if (F::AimbotGlobal.ShouldHoldAttack(pWeapon)) pCmd->buttons |= IN_ATTACK; - // the F::Ticks.m_bDoubletap condition is not a great fix here and actually properly predicting when shots will be fired should likely be done over this, but it's fine for now - if (!Vars::Aimbot::General::AimType.Value || !G::CanPrimaryAttack && !G::Reloading && !F::Ticks.m_bDoubletap && !F::Ticks.m_bSpeedhack && Vars::Aimbot::General::AimType.Value == Vars::Aimbot::General::AimTypeEnum::Silent && nWeaponID != TF_WEAPON_PIPEBOMBLAUNCHER && nWeaponID != TF_WEAPON_CANNON && nWeaponID != TF_WEAPON_FLAMETHROWER) + if (!Vars::Aimbot::General::AimType.Value + || !F::AimbotGlobal.ShouldAim() && nWeaponID != TF_WEAPON_PIPEBOMBLAUNCHER && nWeaponID != TF_WEAPON_CANNON && nWeaponID != TF_WEAPON_FLAMETHROWER) return false; auto vTargets = SortTargets(pLocal, pWeapon); @@ -1750,7 +1759,7 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser #endif for (auto& tTarget : vTargets) { - float flTimeTo = 0.f; std::deque vPlayerPath, vProjectilePath; std::vector vBoxes = {}; + float flTimeTo = 0.f; std::vector vPlayerPath, vProjectilePath; std::vector vBoxes = {}; const int iResult = CanHit(tTarget, pLocal, pWeapon, &vPlayerPath, &vProjectilePath, &vBoxes, &flTimeTo); if (iResult != 1 && pWeapon->GetWeaponID() == TF_WEAPON_CANNON && Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::ChargeWeapon && !(pCmd->buttons & IN_ATTACK)) { diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h index 22df568b..bd8c4761 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h @@ -56,9 +56,9 @@ class CAimbotProjectile std::vector GetSplashPointsSimple(Target_t& tTarget, std::vector>& vSpherePoints, Info_t& tInfo, int iSimTime); 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::deque* pProjectilePath = nullptr); + 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::deque* pPlayerPath, std::deque* pProjectilePath, std::vector* pBoxes, float* pTimeTo); + int CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, std::vector* pPlayerPath, std::vector* pProjectilePath, std::vector* pBoxes, float* pTimeTo); bool RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); bool Aim(Vec3 vCurAngle, Vec3 vToAngle, Vec3& vOut, int iMethod = Vars::Aimbot::General::AimType.Value); diff --git a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp index a9573ca0..2dfaefb1 100644 --- a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp +++ b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp @@ -92,7 +92,7 @@ static inline bool CheckEntities(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUse continue; // CEntitySphereQuery actually does a box test so we need to make sure the distance is less than the radius first - Vec3 vPos = {}; reinterpret_cast(pEntity->GetCollideable())->CalcNearestPoint(vOrigin, &vPos); + Vec3 vPos; reinterpret_cast(pEntity->GetCollideable())->CalcNearestPoint(vOrigin, &vPos); if (vOrigin.DistTo(vPos) > flRadius) continue; @@ -156,7 +156,7 @@ static inline bool CheckLocal(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CBaseEn { flRadius += 1; - Vec3 vPos = {}; reinterpret_cast(pLocal->GetCollideable())->CalcNearestPoint(vOrigin, &vPos); + Vec3 vPos; reinterpret_cast(pLocal->GetCollideable())->CalcNearestPoint(vOrigin, &vPos); if (vOrigin.DistTo(vPos) > flRadius) return false; diff --git a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp index 93ec1031..e112f760 100644 --- a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp +++ b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp @@ -46,7 +46,7 @@ bool CAutoRocketJump::SetAngles(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser if (!pLocal->IsOnGround() || pLocal->IsSwimming()) continue; - Vec3 vForward = tStorage.m_MoveData.m_vecVelocity.To2D().Normalized(); + Vec3 vForward = tStorage.m_MoveData.m_vecVelocity.Normalized2D(); vPoint = tStorage.m_MoveData.m_vecAbsOrigin - vForward * flOffset; //- Vec3(0, 0, 20); bShouldReturn = false; break; @@ -165,7 +165,7 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p { const Vec3 vOriginal = pLocal->GetAbsOrigin(); pLocal->SetAbsOrigin(vOrigin); - Vec3 vPos = {}; reinterpret_cast(pLocal->GetCollideable())->CalcNearestPoint(vPoint, &vPos); + Vec3 vPos; reinterpret_cast(pLocal->GetCollideable())->CalcNearestPoint(vPoint, &vPos); pLocal->SetAbsOrigin(vOriginal); return vPoint.DistTo(vPos) < 120.f && SDK::VisPosWorld(pLocal, pLocal, vPoint, vOrigin + pLocal->m_vecViewOffset(), MASK_SHOT); diff --git a/Amalgam/src/Features/Backtrack/Backtrack.cpp b/Amalgam/src/Features/Backtrack/Backtrack.cpp index 03aac802..4238aa9b 100644 --- a/Amalgam/src/Features/Backtrack/Backtrack.cpp +++ b/Amalgam/src/Features/Backtrack/Backtrack.cpp @@ -1,7 +1,7 @@ #include "Backtrack.h" #include "../PacketManip/FakeLag/FakeLag.h" -#include "../TickHandler/TickHandler.h" +#include "../Ticks/Ticks.h" void CBacktrack::Reset() { @@ -15,9 +15,6 @@ void CBacktrack::Reset() // Returns the wish cl_interp float CBacktrack::GetLerp() { - if (!Vars::Backtrack::Enabled.Value) - return G::Lerp; - if (Vars::Misc::Game::AntiCheatCompatibility.Value) return std::clamp(Vars::Backtrack::Interp.Value / 1000.f, G::Lerp, 0.1f); @@ -27,9 +24,6 @@ float CBacktrack::GetLerp() // Returns the wish backtrack latency float CBacktrack::GetFake() { - if (!Vars::Backtrack::Enabled.Value) - return 0.f; - return std::clamp(Vars::Backtrack::Latency.Value / 1000.f, 0.f, m_flMaxUnlag); } @@ -71,20 +65,24 @@ void CBacktrack::SendLerp() if (!tTimer.Run(0.1f)) return; - auto pNetChan = reinterpret_cast(I::EngineClient->GetNetChannelInfo()); - if (!pNetChan || !I::EngineClient->IsConnected()) - return; - float flTarget = GetLerp(); - if (flTarget == m_flWishInterp) - return; + if (m_flWishInterp != flTarget) + { + m_flWishInterp = flTarget; - NET_SetConVar cl_interp("cl_interp", std::to_string(m_flWishInterp = flTarget).c_str()); - pNetChan->SendNetMsg(cl_interp); - NET_SetConVar cl_interp_ratio("cl_interp_ratio", "1"); - pNetChan->SendNetMsg(cl_interp_ratio); - NET_SetConVar cl_interpolate("cl_interpolate", "1"); - pNetChan->SendNetMsg(cl_interpolate); + auto pNetChan = reinterpret_cast(I::EngineClient->GetNetChannelInfo()); + if (pNetChan && I::EngineClient->IsConnected()) + { + NET_SetConVar tConvar1 = { "cl_interp", std::to_string(m_flWishInterp).c_str() }; + pNetChan->SendNetMsg(tConvar1); + + NET_SetConVar tConvar2 = { "cl_interp_ratio", "1" }; + pNetChan->SendNetMsg(tConvar2); + + NET_SetConVar tConvar3 = { "cl_interpolate", "1" }; + pNetChan->SendNetMsg(tConvar3); + } + } } // Manages cl_interp client value @@ -115,75 +113,78 @@ void CBacktrack::UpdateDatagram() -std::deque* CBacktrack::GetRecords(CBaseEntity* pEntity) +bool CBacktrack::GetRecords(CBaseEntity* pEntity, std::vector& vReturn) { if (!m_mRecords.contains(pEntity)) - return nullptr; + return false; - return &m_mRecords[pEntity]; + auto& vRecords = m_mRecords[pEntity]; + for (auto& tRecord : vRecords) + vReturn.push_back(&tRecord); + return true; } -std::deque CBacktrack::GetValidRecords(std::deque* pRecords, CTFPlayer* pLocal, bool bDistance) +std::vector CBacktrack::GetValidRecords(std::vector& vRecords, CTFPlayer* pLocal, bool bDistance, float flTimeMod) { - std::deque vRecords = {}; - if (!pRecords || pRecords->empty()) - return vRecords; + if (vRecords.empty()) + return {}; auto pNetChan = I::EngineClient->GetNetChannelInfo(); if (!pNetChan) - return vRecords; + return {}; - float flCorrect = std::clamp(F::Backtrack.GetReal(MAX_FLOWS, false) + ROUND_TO_TICKS(GetFakeInterp()), 0.f, m_flMaxUnlag); - int iServerTick = m_iTickCount + GetAnticipatedChoke() + Vars::Backtrack::Offset.Value + TIME_TO_TICKS(F::Backtrack.GetReal(FLOW_OUTGOING)); + std::vector vReturn = {}; + float flCorrect = std::clamp(GetReal(MAX_FLOWS, false) + ROUND_TO_TICKS(GetFakeInterp()), 0.f, m_flMaxUnlag); + int iServerTick = m_iTickCount + GetAnticipatedChoke() + Vars::Backtrack::Offset.Value + TIME_TO_TICKS(GetReal(FLOW_OUTGOING)); - for (auto& tRecord : *pRecords) + for (auto pRecord : vRecords) { - float flDelta = fabsf(flCorrect - TICKS_TO_TIME(iServerTick - TIME_TO_TICKS(tRecord.m_flSimTime))); + float flDelta = fabsf(flCorrect - TICKS_TO_TIME(iServerTick - TIME_TO_TICKS(pRecord->m_flSimTime + flTimeMod))); float flWindow = Vars::Misc::Game::AntiCheatCompatibility.Value ? 0 : Vars::Backtrack::Window.Value; if (flDelta > flWindow / 1000) continue; - vRecords.push_back(tRecord); + vReturn.push_back(pRecord); } - if (vRecords.empty()) + if (vReturn.empty()) { // make sure there is at least 1 record float flMinDelta = 0.2f; - for (auto& tRecord : *pRecords) + for (auto pRecord : vRecords) { - float flDelta = fabsf(flCorrect - TICKS_TO_TIME(iServerTick - TIME_TO_TICKS(tRecord.m_flSimTime))); + float flDelta = fabsf(flCorrect - TICKS_TO_TIME(iServerTick - TIME_TO_TICKS(pRecord->m_flSimTime + flTimeMod))); if (flDelta > flMinDelta) continue; flMinDelta = flDelta; - vRecords = { tRecord }; + vReturn = { pRecord }; } } - else if (pLocal && vRecords.size() > 1) + else if (pLocal && vReturn.size() > 1) { if (bDistance) - std::sort(vRecords.begin(), vRecords.end(), [&](const TickRecord& a, const TickRecord& b) -> bool + std::sort(vReturn.begin(), vReturn.end(), [&](const TickRecord* a, const TickRecord* b) -> bool { - if (Vars::Backtrack::PreferOnShot.Value && a.m_bOnShot != b.m_bOnShot) - return a.m_bOnShot > b.m_bOnShot; + if (Vars::Backtrack::PreferOnShot.Value && a->m_bOnShot != b->m_bOnShot) + return a->m_bOnShot > b->m_bOnShot; - return pLocal->m_vecOrigin().DistTo(a.m_vOrigin) < pLocal->m_vecOrigin().DistTo(b.m_vOrigin); + return pLocal->m_vecOrigin().DistTo(a->m_vOrigin) < pLocal->m_vecOrigin().DistTo(b->m_vOrigin); }); else { - std::sort(vRecords.begin(), vRecords.end(), [&](const TickRecord& a, const TickRecord& b) -> bool + std::sort(vReturn.begin(), vReturn.end(), [&](const TickRecord* a, const TickRecord* b) -> bool { - if (Vars::Backtrack::PreferOnShot.Value && a.m_bOnShot != b.m_bOnShot) - return a.m_bOnShot > b.m_bOnShot; + if (Vars::Backtrack::PreferOnShot.Value && a->m_bOnShot != b->m_bOnShot) + return a->m_bOnShot > b->m_bOnShot; - const float flADelta = flCorrect - TICKS_TO_TIME(iServerTick - TIME_TO_TICKS(a.m_flSimTime)); - const float flBDelta = flCorrect - TICKS_TO_TIME(iServerTick - TIME_TO_TICKS(b.m_flSimTime)); + const float flADelta = flCorrect - TICKS_TO_TIME(iServerTick - TIME_TO_TICKS(a->m_flSimTime + flTimeMod)); + const float flBDelta = flCorrect - TICKS_TO_TIME(iServerTick - TIME_TO_TICKS(b->m_flSimTime + flTimeMod)); return fabsf(flADelta) < fabsf(flBDelta); }); } } - return vRecords; + return vReturn; } @@ -194,7 +195,11 @@ void CBacktrack::MakeRecords() { auto pPlayer = pEntity->As(); if (pPlayer->entindex() == I::EngineClient->GetLocalPlayer() || pPlayer->IsDormant() || !pPlayer->IsAlive() || pPlayer->IsAGhost() - || !H::Entities.GetBones(pPlayer->entindex()) || !H::Entities.GetDeltaTime(pPlayer->entindex())) + || !H::Entities.GetDeltaTime(pPlayer->entindex())) + continue; + + auto pBones = H::Entities.GetBones(pPlayer->entindex()); + if (!pBones) continue; auto& vRecords = m_mRecords[pPlayer]; @@ -202,7 +207,7 @@ void CBacktrack::MakeRecords() const TickRecord* pLastRecord = !vRecords.empty() ? &vRecords.front() : nullptr; vRecords.emplace_front( pPlayer->m_flSimulationTime(), - *reinterpret_cast(H::Entities.GetBones(pPlayer->entindex())), + *reinterpret_cast(pBones), pPlayer->m_vecOrigin(), pPlayer->m_vecMins(), pPlayer->m_vecMaxs(), @@ -297,15 +302,10 @@ void CBacktrack::Store() CleanRecords(); } -void CBacktrack::Run(CUserCmd* pCmd) -{ - SendLerp(); -} - void CBacktrack::ResolverUpdate(CBaseEntity* pEntity) { /* - if (!pEntity) + if (!m_mRecords.contains(pEntity)) return; m_mRecords[pEntity].clear(); @@ -330,7 +330,7 @@ void CBacktrack::AdjustPing(CNetChannel* pNetChan) auto Set = [&]() { - if (!Vars::Backtrack::Enabled.Value || !Vars::Backtrack::Latency.Value) + if (!Vars::Backtrack::Latency.Value) return 0.f; auto pLocal = H::Entities.GetLocal(); @@ -363,7 +363,7 @@ void CBacktrack::AdjustPing(CNetChannel* pNetChan) auto flLatency = Set(); m_nLastInSequenceNr = pNetChan->m_nInSequenceNr; - if (Vars::Backtrack::Enabled.Value && Vars::Backtrack::Latency.Value || m_flFakeLatency) + if (Vars::Backtrack::Latency.Value || m_flFakeLatency) { m_flFakeLatency = std::clamp(m_flFakeLatency + (flLatency - m_flFakeLatency) * 0.1f, m_flFakeLatency - TICK_INTERVAL, m_flFakeLatency + TICK_INTERVAL); if (!flLatency && m_flFakeLatency < TICK_INTERVAL) @@ -374,4 +374,50 @@ void CBacktrack::AdjustPing(CNetChannel* pNetChan) void CBacktrack::RestorePing(CNetChannel* pNetChan) { pNetChan->m_nInSequenceNr = m_nOldInSequenceNr, pNetChan->m_nInReliableState = m_nOldInReliableState; +} + +void CBacktrack::Draw(CTFPlayer* pLocal) +{ + if (!(Vars::Menu::Indicators.Value & Vars::Menu::IndicatorsEnum::Ping) || !pLocal->IsAlive()) + return; + + auto pResource = H::Entities.GetPR(); + auto pNetChan = I::EngineClient->GetNetChannelInfo(); + if (!pResource || !pNetChan) + return; + + static float flFakeLatency = 0.f; + { + static Timer tTimer = {}; + if (tTimer.Run(0.5f)) + flFakeLatency = m_flFakeLatency; + } + 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; + int iLatencyScoreboard = pResource->m_iPing(pLocal->entindex()); + + int x = Vars::Menu::PingDisplay.Value.x; + int y = Vars::Menu::PingDisplay.Value.y + 8; + const auto& fFont = H::Fonts.GetFont(FONT_INDICATORS); + const int nTall = fFont.m_nTall + H::Draw.Scale(1); + + EAlign align = ALIGN_TOP; + if (x <= 100 + H::Draw.Scale(50, Scale_Round)) + { + x -= H::Draw.Scale(42, Scale_Round); + align = ALIGN_TOPLEFT; + } + else if (x >= H::Draw.m_nScreenW - 100 - H::Draw.Scale(50, Scale_Round)) + { + x += H::Draw.Scale(42, Scale_Round); + align = ALIGN_TOPRIGHT; + } + + if (flFake || Vars::Backtrack::Interp.Value) + H::Draw.StringOutlined(fFont, x, y, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, align, std::format("Ping {:.0f} (+ {:.0f}) ms", flLatency, flFake).c_str()); + else + H::Draw.StringOutlined(fFont, x, y, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, align, std::format("Ping {:.0f} ms", flLatency).c_str()); + H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, align, "Scoreboard %d ms", iLatencyScoreboard); } \ No newline at end of file diff --git a/Amalgam/src/Features/Backtrack/Backtrack.h b/Amalgam/src/Features/Backtrack/Backtrack.h index 30fa26e2..b0ace30d 100644 --- a/Amalgam/src/Features/Backtrack/Backtrack.h +++ b/Amalgam/src/Features/Backtrack/Backtrack.h @@ -18,7 +18,7 @@ public: struct BoneMatrix { - matrix3x4 m_aBones[128]; + matrix3x4 m_aBones[MAXSTUDIOBONES]; }; struct TickRecord @@ -35,7 +35,6 @@ struct TickRecord class CBacktrack { - void SendLerp(); void UpdateDatagram(); void MakeRecords(); void CleanRecords(); @@ -49,32 +48,36 @@ class CBacktrack int m_nOldInReliableState = 0; int m_nLastInSequenceNr = 0; int m_nOldTickBase = 0; + float m_flMaxUnlag = 1.f; public: + void Store(); + void SendLerp(); + void Draw(CTFPlayer* pLocal); + void Reset(); + + bool GetRecords(CBaseEntity* pEntity, std::vector& vReturn); + std::vector GetValidRecords(std::vector& vRecords, CTFPlayer* pLocal = nullptr, bool bDistance = false, float flTimeMod = 0.f); + float GetLerp(); float GetFake(); float GetReal(int iFlow = MAX_FLOWS, bool bNoFake = true); float GetFakeInterp(); + void SetLerp(IGameEvent* pEvent); int GetAnticipatedChoke(int iMethod = Vars::Aimbot::General::AimType.Value); - std::deque* GetRecords(CBaseEntity* pEntity); - std::deque GetValidRecords(std::deque* pRecords, CTFPlayer* pLocal = nullptr, bool bDistance = false); - - void Store(); - void Run(CUserCmd* pCmd); - void Reset(); - void SetLerp(IGameEvent* pEvent); void ResolverUpdate(CBaseEntity* pEntity); void ReportShot(int iIndex); void AdjustPing(CNetChannel* netChannel); void RestorePing(CNetChannel* netChannel); int m_iTickCount = 0; - float m_flMaxUnlag = 1.f; float m_flFakeLatency = 0.f; float m_flFakeInterp = 0.015f; float m_flWishInterp = -1.f; + + TickRecord m_tRecord = {}; // for temporary use }; ADD_FEATURE(CBacktrack, Backtrack) \ No newline at end of file diff --git a/Amalgam/src/Features/Binds/Binds.cpp b/Amalgam/src/Features/Binds/Binds.cpp index 78c68750..4c840e8e 100644 --- a/Amalgam/src/Features/Binds/Binds.cpp +++ b/Amalgam/src/Features/Binds/Binds.cpp @@ -56,7 +56,7 @@ static inline void GetBinds(int iParent, CTFPlayer* pLocal, CTFWeaponBase* pWeap case BindEnum::KeyEnum::DoubleClick: bKey = U::KeyHandler.Double(tBind.m_iKey, false, &tBind.m_tKeyStorage); break; } const bool bShouldUse = !I::EngineVGui->IsGameUIVisible() && (!I::MatSystemSurface->IsCursorVisible() || I::EngineClient->IsPlayingDemo()) - || F::Menu.m_bIsOpen && !ImGui::GetIO().WantTextInput && !F::Menu.m_bInKeybind; // allow in menu + || F::Menu.m_bIsOpen && !ImGui::GetIO().WantTextInput && !F::Menu.m_bInKeybind && (!F::Menu.m_bWindowHovered || tBind.m_iKey != VK_LBUTTON && tBind.m_iKey != VK_RBUTTON); // allow in menu bKey = bShouldUse && bKey; switch (tBind.m_iInfo) diff --git a/Amalgam/src/Features/Binds/Binds.h b/Amalgam/src/Features/Binds/Binds.h index 34430bfc..93b71729 100644 --- a/Amalgam/src/Features/Binds/Binds.h +++ b/Amalgam/src/Features/Binds/Binds.h @@ -24,7 +24,7 @@ struct Bind_t bool m_bActive = false; KeyStorage m_tKeyStorage = {}; - int m_iParent = -1; + int m_iParent = DEFAULT_BIND; std::vector m_vVars = {}; }; diff --git a/Amalgam/src/Features/Configs/Configs.cpp b/Amalgam/src/Features/Configs/Configs.cpp index 0557fecf..4342bc67 100644 --- a/Amalgam/src/Features/Configs/Configs.cpp +++ b/Amalgam/src/Features/Configs/Configs.cpp @@ -416,8 +416,12 @@ bool CConfigs::LoadConfig(const std::string& sConfigName, bool bNotify) else if (auto getValue = it.second.get_optional("Visible")) { tBind.m_iVisibility = *getValue ? BindVisibilityEnum::Always : BindVisibilityEnum::Hidden; } if (auto getValue = it.second.get_optional("Not")) { tBind.m_bNot = *getValue; } if (auto getValue = it.second.get_optional("Active")) { tBind.m_bActive = *getValue; } - if (auto getValue = it.second.get_optional("Parent")) { tBind.m_iParent = *getValue; } - + if (auto getValue = it.second.get_optional("Parent")) + { + tBind.m_iParent = *getValue; + if (F::Binds.m_vBinds.size() == tBind.m_iParent) + tBind.m_iParent = DEFAULT_BIND - 1; // prevent infinite loop + } F::Binds.m_vBinds.push_back(tBind); } diff --git a/Amalgam/src/Features/CritHack/CritHack.cpp b/Amalgam/src/Features/CritHack/CritHack.cpp index 95587ce1..9ac36108 100644 --- a/Amalgam/src/Features/CritHack/CritHack.cpp +++ b/Amalgam/src/Features/CritHack/CritHack.cpp @@ -1,6 +1,6 @@ #include "CritHack.h" -#include "../TickHandler/TickHandler.h" +#include "../Ticks/Ticks.h" #define WEAPON_RANDOM_RANGE 10000 #define TF_DAMAGE_CRIT_MULTIPLIER 3.0f @@ -518,7 +518,8 @@ void CCritHack::Event(IGameEvent* pEvent, uint32_t uHash, CTFPlayer* pLocal) break; } - case FNV1A::Hash32Const("teamplay_round_start"): + case FNV1A::Hash32Const("scorestats_accumulated_update"): + case FNV1A::Hash32Const("mvm_reset_stats"): m_iRangedDamage = m_iCritDamage = m_iMeleeDamage = 0; break; case FNV1A::Hash32Const("client_beginconnect"): diff --git a/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp b/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp index 1b6ec46d..93d0a7d7 100644 --- a/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp +++ b/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp @@ -1,9 +1,8 @@ #include "EnginePrediction.h" -#include "../TickHandler/TickHandler.h" - -// account for origin tolerance when simulating local player +#include "../Ticks/Ticks.h" +// account for origin compression when simulating local player void CEnginePrediction::ScalePlayers(CBaseEntity* pLocal) { m_mRestore.clear(); @@ -20,7 +19,6 @@ void CEnginePrediction::ScalePlayers(CBaseEntity* pLocal) pPlayer->m_vecMaxs() -= 0.125f; } } - void CEnginePrediction::RestorePlayers() { for (auto& [pPlayer, tRestore] : m_mRestore) diff --git a/Amalgam/src/Features/ImGui/Menu/Components.h b/Amalgam/src/Features/ImGui/Menu/Components.h index 7ef666fc..1eebc6ee 100644 --- a/Amalgam/src/Features/ImGui/Menu/Components.h +++ b/Amalgam/src/Features/ImGui/Menu/Components.h @@ -54,6 +54,7 @@ namespace ImGui bool Disabled = false, Transparent = false; int CurrentBind = DEFAULT_BIND; + bool Hovered = false; std::vector vDisabled = {}, vTransparent = {}; inline void PushDisabled(bool bDisabled) @@ -95,6 +96,53 @@ namespace ImGui PopStyleVar(iPopAlpha); } + inline ImVec2 GetDrawPos() + { + return GetWindowPos() - GetCurrentWindow()->Scroll; + } + inline float GetDrawPosX() + { + return GetWindowPos().x - GetCurrentWindow()->Scroll.x; + } + inline float GetDrawPosY() + { + return GetWindowPos().y - GetCurrentWindow()->Scroll.y; + } + + struct Row_t + { + ImVec2 m_vPos; + ImVec2 m_vSize; + }; + static std::vector vRowSizes; + inline void AddRowSize(ImVec2 vPos, ImVec2 vSize) + { + if (GetCurrentWindow()->Flags & ImGuiWindowFlags_Popup) + return; + + vPos += GetDrawPos(); + if (!vRowSizes.empty() && vRowSizes.back().m_vPos.y != vPos.y) + vRowSizes.clear(); + vRowSizes.emplace_back(vPos, vSize); + } + inline float GetRowPos(bool bDrawPos = false) + { + if (!vRowSizes.empty()) + return vRowSizes.front().m_vPos.y - (!bDrawPos ? GetDrawPos().y : 0.f); + else + return GetCursorPosY() + (bDrawPos ? GetDrawPos().y : 0.f); + } + inline float GetRowSize(float flDefault = 0.f) + { + if (GetCurrentWindow()->Flags & ImGuiWindowFlags_Popup) + return flDefault; + + float flMax = 0.f; + for (auto& [_, vSize] : vRowSizes) + flMax = std::max(flMax, vSize.y); + return flMax; + } + inline float fnmodf(float flX, float flY) { // silly fix for negative values @@ -125,46 +173,6 @@ namespace ImGui }; } - - - inline ImVec2 GetDrawPos() - { - return GetWindowPos() - GetCurrentWindow()->Scroll; - } - - inline float GetDrawPosX() - { - return GetWindowPos().x - GetCurrentWindow()->Scroll.x; - } - - inline float GetDrawPosY() - { - return GetWindowPos().y - GetCurrentWindow()->Scroll.y; - } - - inline bool IsMouseWithin(float x, float y, float w, float h) - { - ImVec2 vMouse = GetMousePos(); - bool bWithin = x <= vMouse.x && vMouse.x < x + w - && y <= vMouse.y && vMouse.y < y + h; - - /* - ImDrawList* pDrawList = GetForegroundDrawList(); - ImVec2 vDrawPos = GetDrawPos() - GetWindowPos(); - pDrawList->AddRectFilled({ vDrawPos.x + x, vDrawPos.y + y }, { vDrawPos.x + x + w, vDrawPos.y + y + h }, bWithin ? ImColor(1.f, 0.f, 0.f, 0.5f) : ImColor(0.f, 1.f, 1.f, 0.5f)); - */ - - return bWithin; - } - - inline std::string StripDoubleHash(const char* sText) - { - std::string sBegin = sText, sEnd = FindRenderedTextEnd(sText); - return sBegin.replace(sBegin.end() - sEnd.size(), sBegin.end(), ""); - } - - - inline void DebugDummy(ImVec2 vSize) { /* @@ -190,6 +198,29 @@ namespace ImGui SetCursorPos({ vOriginalPos.x + vSize.x, vOriginalPos.y + vSize.y }); } + inline bool IsMouseWithin(float x, float y, float w, float h) + { + ImVec2 vMouse = GetMousePos(); + bool bWithin = x <= vMouse.x && vMouse.x < x + w + && y <= vMouse.y && vMouse.y < y + h; + + /* + ImDrawList* pDrawList = GetForegroundDrawList(); + ImVec2 vDrawPos = GetDrawPos() - GetWindowPos(); + pDrawList->AddRectFilled({ vDrawPos.x + x, vDrawPos.y + y }, { vDrawPos.x + x + w, vDrawPos.y + y + h }, bWithin ? ImColor(1.f, 0.f, 0.f, 0.5f) : ImColor(0.f, 1.f, 1.f, 0.5f)); + */ + + return bWithin; + } + + inline std::string StripDoubleHash(const char* sText) + { + std::string sBegin = sText, sEnd = FindRenderedTextEnd(sText); + return sBegin.replace(sBegin.end() - sEnd.size(), sBegin.end(), ""); + } + + + inline void RenderBackground(ImU32 uBackground) { ImVec2 vSize = GetWindowSize(); @@ -198,7 +229,6 @@ namespace ImGui pDrawList->AddRectFilled({ vDrawPos.x, vDrawPos.y }, { vDrawPos.x + vSize.x, vDrawPos.y + vSize.y }, uBackground, H::Draw.Scale(4)); } - inline void RenderBackground(ImU32 uBackground, ImU32 uBorder, float flInset = H::Draw.Scale()) { ImVec2 vSize = GetWindowSize(); @@ -210,7 +240,6 @@ namespace ImGui flInset += H::Draw.Scale(0.5f) - 0.5f - H::Draw.Scale(); pDrawList->AddRect({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x - flInset + vSize.x, vDrawPos.y - flInset + vSize.y }, uBorder, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale()); } - inline void RenderTwoToneBackground(float flSize, ImU32 uTitle, ImU32 uBackground, bool bHorizontal = false) { ImVec2 vSize = GetWindowSize(); @@ -228,7 +257,6 @@ namespace ImGui pDrawList->AddRectFilled({ vDrawPos.x + flSize, vDrawPos.y }, { vDrawPos.x + vSize.x, vDrawPos.y + vSize.y }, uBackground, H::Draw.Scale(4), ImDrawFlags_RoundCornersTopRight | ImDrawFlags_RoundCornersBottomRight); } } - inline void RenderTwoToneBackground(float flSize, ImU32 uTitle, ImU32 uBackground, ImU32 uBorder, float flInset = H::Draw.Scale(), bool bVertical = true, bool bTwoToneBorder = true) { ImVec2 vSize = GetWindowSize(); @@ -253,7 +281,6 @@ namespace ImGui flInset += H::Draw.Scale(0.5f) - 0.5f - H::Draw.Scale(); pDrawList->AddRect({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x - flInset + vSize.x, vDrawPos.y - flInset + vSize.y }, uBorder, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale()); } - inline void Divider(float flInset = H::Draw.Scale(), float flPrePadding = H::Draw.Scale(8), float flPostPadding = H::Draw.Scale(7), ImU32 uBorder = F::Render.Background2) { ImVec2 vSize = GetWindowSize(); @@ -311,12 +338,6 @@ namespace ImGui pDrawList->PopClipRect(); } - inline void FTooltip(const char* sDescription, bool bCondition = IsItemHovered()) - { - if (bCondition) - SetTooltip(sDescription); - } - inline ImVec2 FCalcTextSize(const char* sText, ImFont* pFont = nullptr) { if (pFont) PushFont(pFont); @@ -325,6 +346,157 @@ namespace ImGui return vTextSize; } + inline ImVec2 IconSize(const char* sIcon) + { + PushFont(F::Render.IconFont); + ImVec2 vTextSize = CalcTextSize(sIcon); + PopFont(); + return vTextSize; + } + + inline const char* FormatText(const char* fmt, ...) + { + va_list args; + va_start(args, fmt); + + const char* sText; + ImFormatStringToTempBufferV(&sText, nullptr, fmt, args); + va_end(args); + + return sText; + } + + inline std::string TruncateText(std::string sText, int iPixels, ImFont* pFont = nullptr, std::string sEnd = "...", size_t* pLength = nullptr) + { + if (sText.empty()) + return ""; + else if (FCalcTextSize(sText.c_str(), pFont).x < iPixels) // no unnecessary truncation + return sText; + + std::string sTruncated = ""; + size_t i = 0; + while (FCalcTextSize(std::format("{}{}{}", sTruncated, sText[i + 1], sEnd).c_str(), pFont).x < iPixels) + { + sTruncated += sText[i++]; + if (i >= sText.length()) + { + i = 0; + break; + } + } + if (i) + sTruncated += sEnd; + if (pLength) + *pLength = i; + + return sTruncated; + } + + inline std::deque WrapText(std::string sText, int iPixels, ImFont* pFont = nullptr) + { + if (sText.empty()) + return { "" }; + else if (FCalcTextSize(sText.c_str(), pFont).x < iPixels) // no unnecessary wrapping + return { sText }; + + std::vector vWords = { "" }; + for (char iChar : sText) + { + if (iChar == ' ' || iChar == '\n' || iChar == '\t') + vWords.push_back(std::string(1, iChar)); + else + vWords.back().push_back(iChar); + } + + std::deque vWrapped = { "" }; + int iWord = 0; + for (auto& sWord : vWords) + { + begin: + if (sWord.empty()) + continue; + + auto sSeparator = iWord ? std::string(1, sWord[0]) : ""; + if (sWord[0] == ' ' || sWord[0] == '\n' || sWord[0] == '\t') + sWord.erase(0, 1); + if (sSeparator != "\n" && FCalcTextSize(std::format("{}{}{}", vWrapped.back(), sSeparator, sWord).c_str(), pFont).x < iPixels) + { + vWrapped.back() += std::format("{}{}", sSeparator, sWord); + iWord++; + } + else + { + bool bContinue = false, bFirstWord = !iWord; iWord = 0; + if (bFirstWord) + { + size_t i = 0; + vWrapped.back() += TruncateText(sWord, iPixels, pFont, "-", &i); + if (!i) // i don't know why it fucking does this, but i don't care enough to fix it + bContinue = true; + else + sWord = sWord.substr(i, sWord.length() - i); + } + if (vWrapped.back().empty()) + break; // don't do the same thing over and over + vWrapped.push_back(""); + if (!bContinue) + goto begin; + } + } + + return vWrapped; + } + + inline void FTooltip(const char* sTooltip, bool bCondition = IsItemHovered(), float flWrapWidth = 300, ImVec2* pPosOverride = nullptr, ImVec2* pSizeOverride = nullptr) + { + if (bCondition) + { + PushFont(F::Render.FontSmall); + + ImDrawList* pDrawList = GetForegroundDrawList(); + ImVec2 vPos = pPosOverride ? *pPosOverride : !vRowSizes.empty() ? vRowSizes.back().m_vPos : ImVec2(); + ImVec2 vSize = pSizeOverride ? *pSizeOverride : !vRowSizes.empty() ? vRowSizes.back().m_vSize : ImVec2(); + + std::deque vWraps = WrapText(sTooltip, H::Draw.Scale(flWrapWidth)); + ImVec2 vText = { 0, H::Draw.Scale(9) + vWraps.size() * H::Draw.Scale(16) }; + for (auto& sText : vWraps) + vText.x = std::max(CalcTextSize(sText.c_str()).x, vText.x); + vText.x += GetStyle().WindowPadding.x * 2; + if (fmodf(vText.x, 2.f)) + vText.x += 1; + + vPos += ImVec2(vSize.x / 2, vSize.y + GetStyle().WindowPadding.y); + vPos.x -= vText.x / 2; + + ImVec2 vP1 = { vPos.x + vText.x / 2 - H::Draw.Scale(8), vPos.y + H::Draw.Scale(1) - 0.5f }, vP2 = { vPos.x + vText.x / 2 + H::Draw.Scale(8), vPos.y + H::Draw.Scale(1) - 0.5f }, vP3 = { vPos.x + vText.x / 2, vPos.y - H::Draw.Scale(7) - 0.5f }; + + /* + float flInset = H::Draw.Scale(0.5f) - 0.5f; + pDrawList->AddRect({ vPos.x + flInset, vPos.y + flInset }, { vPos.x - flInset + vText.x, vPos.y - flInset + vText.y }, F::Render.Background2, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale()); + flInset = H::Draw.Scale(); + pDrawList->AddTriangle({ vP1.x - flInset / 2, vP1.y }, { vP2.x + flInset / 2, vP2.y }, { vP3.x, vP3.y - flInset / 2 }, F::Render.Background2, H::Draw.Scale()); + + pDrawList->AddRectFilled({ vPos.x + flInset, vPos.y + flInset }, { vPos.x - flInset + vText.x, vPos.y - flInset + vText.y }, F::Render.Background1p5, H::Draw.Scale(3)); + flInset = 1; + pDrawList->AddTriangleFilled({ vP1.x + flInset / 2, vP1.y }, { vP2.x - flInset / 2, vP2.y }, { vP3.x, vP3.y + flInset / 2 }, F::Render.Background1p5); + */ + + pDrawList->AddRectFilled(vPos, { vPos.x + vText.x, vPos.y + vText.y }, F::Render.Background2, H::Draw.Scale(3)); + pDrawList->AddTriangleFilled(vP1, vP2, vP3, F::Render.Background2); + + vPos.x += vText.x / 2; + vPos.x += GetStyle().WindowPadding.x; + for (size_t i = 0; i < vWraps.size(); i++) + { + auto& sText = vWraps[i]; + //vTextSize.x = CalcTextSize(sText.c_str()).x; + pDrawList->AddText({ vPos.x - vText.x / 2, vPos.y + H::Draw.Scale(6) + H::Draw.Scale(16) * i }, F::Render.Active, sText.c_str()); + } + + PopFont(); + } + } + inline void FText(const char* sText, int iFlags = FTextEnum::None, ImFont* pFont = nullptr) { if (Transparent || Disabled) @@ -372,107 +544,6 @@ namespace ImGui return bReturn; } - inline std::string TruncateText(std::string sText, int iPixels, ImFont* pFont = nullptr, std::string sEnd = "...", size_t* pLength = nullptr) - { - if (sText.empty()) - return ""; - else if (FCalcTextSize(sText.c_str(), pFont).x < iPixels) // no unnecessary truncation - return sText; - - std::string sTruncated = ""; - size_t i = 0; - while (FCalcTextSize(std::format("{}{}{}", sTruncated, sText[i + 1], sEnd).c_str(), pFont).x < iPixels) - { - sTruncated += sText[i++]; - if (i >= sText.length()) - { - i = 0; - break; - } - } - if (i) - sTruncated += sEnd; - if (pLength) - *pLength = i; - - return sTruncated; - } - - inline std::deque WrapText(std::string sText, int iPixels, ImFont* pFont = nullptr) - { - if (sText.empty()) - return { "" }; - else if (FCalcTextSize(sText.c_str(), pFont).x < iPixels) // no unnecessary wrapping - return { sText }; - - std::vector vWords = { "" }; - for (char iChar : sText) - { - if (iChar == ' ' || iChar == '\n' || iChar == '\t') - vWords.push_back(std::string(1, iChar)); - else - vWords.back().push_back(iChar); - } - - std::deque vWrapped = { "" }; - int iWord = 0; - for (auto& sWord : vWords) - { - begin: - if (sWord.empty()) - continue; - - auto sSeparator = iWord ? std::string(1, sWord[0]) : ""; - if (sWord[0] == ' ' || sWord[0] == '\n' || sWord[0] == '\t') - sWord.erase(0, 1); - if (sSeparator != "\n" && FCalcTextSize(std::format("{}{}{}", vWrapped.back(), sSeparator, sWord).c_str(), pFont).x < iPixels) - { - vWrapped.back() += std::format("{}{}", sSeparator, sWord); - iWord++; - } - else - { - bool bContinue = false, bFirstWord = !iWord; iWord = 0; - if (bFirstWord) - { - size_t i = 0; - vWrapped.back() += TruncateText(sWord, iPixels, pFont, "-", &i); - if (!i) // i don't know why it fucking does this, but i don't care enough to fix it - bContinue = true; - else - sWord = sWord.substr(i, sWord.length() - i); - } - if (vWrapped.back().empty()) - break; // don't do the same thing over and over - vWrapped.push_back(""); - if (!bContinue) - goto begin; - } - } - - return vWrapped; - } - - inline const char* FormatText(const char* fmt, ...) - { - va_list args; - va_start(args, fmt); - - const char* sText; - ImFormatStringToTempBufferV(&sText, nullptr, fmt, args); - va_end(args); - - return sText; - } - - inline ImVec2 IconSize(const char* sIcon) - { - PushFont(F::Render.IconFont); - ImVec2 vTextSize = CalcTextSize(sIcon); - PopFont(); - return vTextSize; - } - inline void IconImage(const char* sIcon, ImVec4 tColor = { 1, 1, 1, -1 }) { if (Transparent || Disabled) @@ -492,32 +563,34 @@ namespace ImGui PopStyleVar(); } - inline bool IconButton(const char* sIcon, ImVec4 tColor = { 1, 1, 1, -1 }, bool* pHovered = nullptr) + inline bool IconButton(const char* sIcon, float flSize = H::Draw.Scale(24), ImVec4 tColor = { 1, 1, 1, -1 }, bool* pHovered = nullptr) { if (Transparent || Disabled) PushStyleVar(ImGuiStyleVar_Alpha, 0.5f); - ImVec2 vOriginalPos = GetCursorPos(); - if (tColor.w >= 0.f) PushStyleColor(ImGuiCol_Text, tColor); PushFont(F::Render.IconFont); - TextUnformatted(sIcon); - bool bReturn = IsItemClicked(); + ImVec2 vOriginalPos = GetCursorPos(); + bool bReturn = Button(std::format("{}##{}:{}", sIcon, vOriginalPos.x, vOriginalPos.y).c_str(), { flSize, flSize }); - if (!Disabled && IsItemHovered()) + if (!Disabled && IsItemHovered() && GetMouseCursor() != ImGuiMouseCursor_Hand) + { SetMouseCursor(ImGuiMouseCursor_Hand); + + ImColor tTransparent = GetStyle().Colors[ImGuiCol_Text]; + tTransparent.Value.w *= (IsMouseDown(ImGuiMouseButton_Left) ? 0.1f : 0.05f) * GetStyle().Alpha; + ImDrawList* pDrawList = GetWindowDrawList(); + ImVec2 vDrawPos = GetDrawPos() + ImVec2(vOriginalPos.x + flSize / 2, vOriginalPos.y + flSize / 2); + pDrawList->AddCircleFilled(vDrawPos, flSize / 2, tTransparent); + } if (pHovered) *pHovered = IsItemHovered(); PopFont(); if (tColor.w >= 0.f) PopStyleColor(); - // prevent accidental dragging - SetCursorPos(vOriginalPos); - Button("##", GetItemRectSize()); - if (Transparent || Disabled) PopStyleVar(); @@ -956,40 +1029,6 @@ namespace ImGui return FTabs(vNewEntries, { pVar }, vSize, vPos, iFlags, vNewIcons, vAllTextOffset, vAllBarOffset, vSubTextOffset, vSubBarOffset, flBarSizeMod, flBarThickness); } - struct Row_t - { - float m_flPosY; - float m_flSizeY; - }; - static std::vector vRowSizes; - inline void AddRowSize(float flPosY, float flSizeY) - { - if (GetCurrentWindow()->Flags & ImGuiWindowFlags_Popup) - return; - - flPosY += GetDrawPos().y; - if (!vRowSizes.empty() && vRowSizes.back().m_flPosY != flPosY) - vRowSizes.clear(); - vRowSizes.emplace_back(flPosY, flSizeY); - } - inline float GetRowPos(bool bDrawPos = false) - { - if (!vRowSizes.empty()) - return vRowSizes.front().m_flPosY - (!bDrawPos ? GetDrawPos().y : 0.f); - else - return GetCursorPosY() + (bDrawPos ? GetDrawPos().y : 0.f); - } - inline float GetRowSize(float flDefault = 0.f) - { - if (GetCurrentWindow()->Flags & ImGuiWindowFlags_Popup) - return flDefault; - - float flMax = 0.f; - for (auto& [_, flSize] : vRowSizes) - flMax = std::max(flMax, flSize); - return flMax; - } - inline bool FButton(const char* sLabel, int iFlags = FButtonEnum::None, ImVec2 vSize = { 0, 30 }, int iSizeOffset = 0, ImFont* pFont = nullptr, bool* pHovered = nullptr) { if (pFont) @@ -1049,7 +1088,7 @@ namespace ImGui *pHovered = IsItemHovered(); SetCursorPos(vOriginalPos); - AddRowSize(vOriginalPos.y, vSize.y + GetStyle().WindowPadding.y); + AddRowSize(vOriginalPos, { vSize.x, vSize.y + GetStyle().WindowPadding.y }); DebugDummy({ vSize.x, GetRowSize(vSize.y + GetStyle().WindowPadding.y) }); if (pFont) @@ -1080,6 +1119,9 @@ namespace ImGui vSize.y = H::Draw.Scale(6 + 18 * iWraps); bool bReturn = Button(std::format("##{}", sLabel).c_str(), vSize); + if (pHovered) + *pHovered = IsItemHovered(); + ImColor tColor = *pVar ? (iFlags & FToggleEnum::PlainColor ? F::Render.Active : F::Render.Accent) : F::Render.Inactive; if (Disabled) bReturn = false; @@ -1088,10 +1130,10 @@ namespace ImGui SetMouseCursor(ImGuiMouseCursor_Hand); ImColor tTransparent = tColor; - tTransparent.Value.w *= 0.05f * GetStyle().Alpha; + tTransparent.Value.w *= (IsMouseDown(ImGuiMouseButton_Left) ? 0.1f : 0.05f) * GetStyle().Alpha; ImDrawList* pDrawList = GetWindowDrawList(); ImVec2 vDrawPos = GetDrawPos() + ImVec2(vOriginalPos.x + H::Draw.Scale(12), vOriginalPos.y + H::Draw.Scale(3 + 9 * iWraps)); - pDrawList->AddCircleFilled(vDrawPos, H::Draw.Scale(11), tTransparent); + pDrawList->AddCircleFilled(vDrawPos, H::Draw.Scale(12), tTransparent); } if (bReturn) *pVar = !*pVar; @@ -1106,18 +1148,12 @@ namespace ImGui } SetCursorPos(vOriginalPos); - AddRowSize(vOriginalPos.y, vSize.y); + AddRowSize(vOriginalPos, vSize); DebugDummy({ vSize.x, GetRowSize(vSize.y) }); if (Transparent || Disabled) PopStyleVar(); - if (pHovered && IsWindowHovered()) - { - vOriginalPos += GetDrawPos(); - *pHovered = IsMouseWithin(vOriginalPos.x, vOriginalPos.y, vSize.x, vSize.y); - } - return bReturn; } @@ -1285,7 +1321,7 @@ namespace ImGui int iVar = fabsf(vMouse.x - (vDrawPos.x + flLowerPos)) < fabsf(vMouse.x - (vDrawPos.x + flUpperPos)) ? 1 : 2; if (IsMouseClicked(ImGuiMouseButton_Left)) mActiveMap[uHash] = iVar; - pDrawList->AddCircleFilled({ vDrawPos.x + (iVar == 1 ? flLowerPos : flUpperPos), vDrawPos.y + vMins.y + H::Draw.Scale(1) }, H::Draw.Scale(11), tTransparent); + pDrawList->AddCircleFilled({ vDrawPos.x + (iVar == 1 ? flLowerPos : flUpperPos), vDrawPos.y + vMins.y + H::Draw.Scale(1) }, H::Draw.Scale(12), tTransparent); } else if (mActiveMap[uHash] && IsMouseDown(ImGuiMouseButton_Left)) { @@ -1293,7 +1329,7 @@ namespace ImGui float& flVar = bVar1 ? flSVar1 : flSVar2; flVar = flMin + (flMax - flMin) * flMousePerc; flVar = std::clamp(flVar - fnmodf(flVar, flStep), !bVar1 ? flSVar1 + flStep : flMin, bVar1 ? flSVar2 - flStep : flMax); - pDrawList->AddCircleFilled({ vDrawPos.x + (bVar1 ? flLowerPos : flUpperPos), vDrawPos.y + vMins.y + H::Draw.Scale(1) }, H::Draw.Scale(15), tTransparent); + pDrawList->AddCircleFilled({ vDrawPos.x + (bVar1 ? flLowerPos : flUpperPos), vDrawPos.y + vMins.y + H::Draw.Scale(1) }, H::Draw.Scale(16), tTransparent); } else mActiveMap[uHash] = false; @@ -1320,13 +1356,13 @@ namespace ImGui { if (IsMouseClicked(ImGuiMouseButton_Left)) mActiveMap[uHash] = 1; - pDrawList->AddCircleFilled({ vDrawPos.x + flPos, vDrawPos.y + vMins.y + H::Draw.Scale(1) }, H::Draw.Scale(11), tTransparent); + pDrawList->AddCircleFilled({ vDrawPos.x + flPos, vDrawPos.y + vMins.y + H::Draw.Scale(1) }, H::Draw.Scale(12), tTransparent); } else if (mActiveMap[uHash] && IsMouseDown(ImGuiMouseButton_Left)) { flSVar1 = flMin + (flMax - flMin) * flMousePerc; flSVar1 = std::clamp(flSVar1 - fnmodf(flSVar1, flStep), flMin, flMax); - pDrawList->AddCircleFilled({ vDrawPos.x + flPos, vDrawPos.y + vMins.y + H::Draw.Scale(1) }, H::Draw.Scale(15), tTransparent); + pDrawList->AddCircleFilled({ vDrawPos.x + flPos, vDrawPos.y + vMins.y + H::Draw.Scale(1) }, H::Draw.Scale(16), tTransparent); } else mActiveMap[uHash] = false; @@ -1340,18 +1376,15 @@ namespace ImGui SetCursorPos({ vOriginalPos.x + vMins.x - 6, vOriginalPos.y + vMins.y - 6 }); Button("##", { vMaxs.x - vMins.x + 12, 14 }); // don't drag it around SetCursorPos(vOriginalPos); - AddRowSize(vOriginalPos.y, vSize.y); + AddRowSize(vOriginalPos, vSize); DebugDummy({ vSize.x, GetRowSize(vSize.y) }); + if (pHovered) + *pHovered = IsItemHovered(); + if (Transparent || Disabled) PopStyleVar(); - if (pHovered && IsWindowHovered()) - { - vOriginalPos += GetDrawPos(); - *pHovered = IsMouseWithin(vOriginalPos.x, vOriginalPos.y, vSize.x, vSize.y); - } - return *pVar1 != flOriginal1 || pVar2 && *pVar2 != flOriginal2; } @@ -1505,8 +1538,8 @@ namespace ImGui ImVec2 vOriginalPos2 = GetCursorPos(); if (iFlags & FDropdownEnum::Modifiable) { - SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(15), vOriginalPos2.y - H::Draw.Scale(1) }); - if (IconButton(vValues[i] == -1 ? ICON_MD_ADD_CIRCLE : ICON_MD_REMOVE_CIRCLE, {}) && pModified) + SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(11), vOriginalPos2.y - H::Draw.Scale(5) }); + if (IconButton(vValues[i] == -1 ? ICON_MD_ADD_CIRCLE : ICON_MD_REMOVE_CIRCLE, H::Draw.Scale(24), {}) && pModified) *pModified = vValues[i]; SetCursorPos(vOriginalPos2); } @@ -1536,6 +1569,8 @@ namespace ImGui } if (!Disabled && IsItemHovered()) SetMouseCursor(ImGuiMouseCursor_Hand); + if (pHovered) + *pHovered = IsItemHovered(); if (BeginComboPreview()) { ImVec2 vOriginalPos2 = GetCursorPos(); @@ -1569,18 +1604,12 @@ namespace ImGui PopStyleVar(); SetCursorPos(vOriginalPos); - AddRowSize(vOriginalPos.y, vSize.y + GetStyle().WindowPadding.y); + AddRowSize(vOriginalPos, { vSize.x, vSize.y + GetStyle().WindowPadding.y }); DebugDummy({ vSize.x, GetRowSize(vSize.y + GetStyle().WindowPadding.y) }); if (Transparent || Disabled) PopStyleVar(); - if (pHovered && IsWindowHovered()) - { - vOriginalPos += GetDrawPos(); - *pHovered = IsMouseWithin(vOriginalPos.x, vOriginalPos.y + GetStyle().WindowPadding.y, vSize.x, vSize.y); - } - return bReturn; } @@ -1669,7 +1698,30 @@ namespace ImGui vValid.pop_back(); if (!vValid.empty()) { - int iTab = U::KeyHandler.Pressed(VK_TAB) ? 1 : 0; + if (U::KeyHandler.Pressed(VK_TAB)) + { + int iIndex = -1; + for (int i = 0; i < vValid.size(); i++) + { + if (uPreviewHash == FNV1A::Hash32(vValid[i].c_str())) + iIndex = i; + } + if (iIndex == -1 && U::KeyHandler.Down(VK_SHIFT)) + iIndex = 0; + while (true) + { + iIndex += !U::KeyHandler.Down(VK_SHIFT) ? 1 : -1; + if (iIndex < 0) + iIndex += int(vValid.size()); + else if (iIndex >= vValid.size()) + iIndex -= int(vValid.size()); + if (FNV1A::Hash32(vValid[iIndex].c_str()) == FNV1A::Hash32Const("##Divider")) + continue; + sPreview = vValid[iIndex]; + sTab = sInput; + break; + } + } DebugDummy({ 0, H::Draw.Scale(8) }); PushStyleVar(ImGuiStyleVar_ItemSpacing, { 0, H::Draw.Scale(19) }); @@ -1698,17 +1750,6 @@ namespace ImGui *pVar = sEntry; bReturn = true; CloseCurrentPopup(); break; } - if (iTab) - { - if (uPreviewHash == FNV1A::Hash32(sEntry.c_str())) - iTab = 1; - else if (iTab == 1) - { - sPreview = sEntry; - sTab = sInput; - iTab = 2; - } - } bool bActive = FNV1A::Hash32(pVar->c_str()) == FNV1A::Hash32(sEntry.c_str()); ImVec2 vOriginalPos3 = GetCursorPos(); @@ -1728,7 +1769,7 @@ namespace ImGui if ((bEnter || iFlags & FSDropdownEnum::AutoUpdate) && (iFlags & FSDropdownEnum::Custom || vEntries.empty())) *pVar = sPreview; bReturn = true; - if (bEnter) + if (bEnter || U::KeyHandler.Down(VK_ESCAPE)) CloseCurrentPopup(); EndCombo(); @@ -1737,6 +1778,8 @@ namespace ImGui mActiveMap[uHash] = false; if (!Disabled && IsItemHovered()) SetMouseCursor(ImGuiMouseCursor_TextInput); + if (pHovered) + *pHovered = IsItemHovered(); if (BeginComboPreview()) { ImVec2 vOriginalPos2 = GetCursorPos(); @@ -1795,18 +1838,12 @@ namespace ImGui PopStyleVar(); SetCursorPos(vOriginalPos); - AddRowSize(vOriginalPos.y, vSize.y + GetStyle().WindowPadding.y); + AddRowSize(vOriginalPos, { vSize.x, vSize.y + GetStyle().WindowPadding.y }); DebugDummy({ vSize.x, GetRowSize(vSize.y + GetStyle().WindowPadding.y) }); if (Transparent || Disabled) PopStyleVar(); - if (pHovered && IsWindowHovered()) - { - vOriginalPos += GetDrawPos(); - *pHovered = IsMouseWithin(vOriginalPos.x, vOriginalPos.y + GetStyle().WindowPadding.y, vSize.x, vSize.y); - } - return bReturn; } @@ -1837,7 +1874,10 @@ namespace ImGui PopStyleVar(5); if (bTooltip) - FTooltip(StripDoubleHash(sLabel).c_str()); + { + vOriginalPos += GetDrawPos(); + FTooltip(StripDoubleHash(sLabel).c_str(), IsItemHovered(), 300, &vOriginalPos, &vSize); + } return bReturn; } @@ -1877,7 +1917,7 @@ namespace ImGui } SetCursorPos(vOriginalPos); - AddRowSize(vOriginalPos.y, vSize.y); + AddRowSize(vOriginalPos, vSize); DebugDummy({ vSize.x, GetRowSize(vSize.y) }); } else @@ -1908,17 +1948,14 @@ namespace ImGui bReturn = ColorPicker(sLabel, pColor, iFlags & FColorPickerEnum::Tooltip, iFlags, vSize); SetCursorPos(vOriginalPos); - AddRowSize(vOriginalPos.y, vSize.y + GetStyle().WindowPadding.y); + 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) }; } - if (pHovered && IsWindowHovered()) - { - vOriginalPos += GetDrawPos(); - *pHovered = IsMouseWithin(vOriginalPos.x, vOriginalPos.y, vSize.x, vSize.y); - } + if (pHovered) + *pHovered = IsItemHovered(); if (Transparent || Disabled) PopStyleVar(); @@ -2197,6 +2234,8 @@ namespace ImGui } if (!Disabled && IsItemHovered()) SetMouseCursor(ImGuiMouseCursor_Hand); + if (pHovered) + *pHovered = IsItemHovered(); if (BeginComboPreview()) { ImVec2 vOriginalPos2 = GetCursorPos(); @@ -2230,19 +2269,12 @@ namespace ImGui PopStyleVar(); SetCursorPos(vOriginalPos); - AddRowSize(vOriginalPos.y, vSize.y + GetStyle().WindowPadding.y); + AddRowSize(vOriginalPos, { vSize.x, vSize.y + GetStyle().WindowPadding.y }); DebugDummy({ vSize.x, GetRowSize(vSize.y + GetStyle().WindowPadding.y) }); - if (Transparent || Disabled) PopStyleVar(); - if (pHovered && IsWindowHovered()) - { - vOriginalPos += GetDrawPos(); - *pHovered = IsMouseWithin(vOriginalPos.x, vOriginalPos.y + GetStyle().WindowPadding.y, vSize.x, vSize.y); - } - return bReturn; } @@ -2441,15 +2473,15 @@ namespace ImGui { ImVec2 vOriginalPos = GetCursorPos(); - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(34), H::Draw.Scale(40) }); + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(34), 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, { 1, 1, 1, -1 }, &bHovered)) + 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(40) }); - if (IconButton(!tBind.m_bNot ? ICON_MD_CODE : ICON_MD_CODE_OFF, { 1, 1, 1, -1 }, &bHovered)) + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(59), 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; @@ -2504,7 +2536,7 @@ namespace ImGui if (!(var.m_iFlags & (NOBIND | NOSAVE)) && !Disabled && CurrentBind == DEFAULT_BIND)\ { /*probably a better way to do this*/\ static auto staticVal = val;\ - bool bNewPopup = bHovered && IsMouseReleased(ImGuiMouseButton_Right) && !IsPopupOpen(nullptr, ImGuiPopupFlags_AnyPopupId);\ + bool bNewPopup = bHovered && IsMouseReleased(ImGuiMouseButton_Right) && !IsMouseDown(ImGuiMouseButton_Left) && !IsPopupOpen(nullptr, ImGuiPopupFlags_AnyPopupId);\ if (bNewPopup)\ {\ OpenPopup(var.m_sName.c_str());\ diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.cpp b/Amalgam/src/Features/ImGui/Menu/Menu.cpp index eb90f6ed..9fc3d960 100644 --- a/Amalgam/src/Features/ImGui/Menu/Menu.cpp +++ b/Amalgam/src/Features/ImGui/Menu/Menu.cpp @@ -54,7 +54,7 @@ void CMenu::DrawMenu() FText(TruncateText(tBind.m_sName, H::Draw.Scale(flSideSize - 28)).c_str(), 0, F::Render.FontRegular); PopStyleColor(); - SetCursorPos({ H::Draw.Scale(flSideSize - 27), H::Draw.Scale(10) }); + SetCursorPos({ H::Draw.Scale(flSideSize - 31), H::Draw.Scale(6) }); if (IconButton(ICON_MD_CANCEL)) CurrentBind = DEFAULT_BIND; } @@ -155,11 +155,7 @@ void CMenu::MenuAimbot(int iTab) FSlider(Vars::Aimbot::General::IgnoreCloak, FSliderEnum::Right); } PopTransparent(); - PushTransparent(FGet(Vars::Aimbot::General::AimType) != Vars::Aimbot::General::AimTypeEnum::Smooth && FGet(Vars::Aimbot::General::AimType) != Vars::Aimbot::General::AimTypeEnum::Assistive); - { - FSlider(Vars::Aimbot::General::AssistStrength, FSliderEnum::Left); - } - PopTransparent(); + FSlider(Vars::Aimbot::General::AssistStrength, FSliderEnum::Left); PushTransparent(!(FGet(Vars::Aimbot::General::Ignore) & Vars::Aimbot::General::IgnoreEnum::Unsimulated)); { FSlider(Vars::Aimbot::General::TickTolerance, FSliderEnum::Right); @@ -178,8 +174,7 @@ void CMenu::MenuAimbot(int iTab) if (Section("##Debug Aimbot")) { FSlider(Vars::Aimbot::General::HitscanPeek); - FToggle(Vars::Aimbot::General::PeekDTOnly); - FTooltip("This should probably stay on if you want to be able to\ntarget hitboxes other than the highest priority one"); + FToggle(Vars::Aimbot::General::PeekDTOnly, FToggleEnum::Left, &Hovered); FTooltip("This should probably stay on if you want to be able to target hitboxes other than the highest priority one", Hovered); FSlider(Vars::Aimbot::General::NoSpreadOffset); FSlider(Vars::Aimbot::General::NoSpreadAverage); FSlider(Vars::Aimbot::General::NoSpreadInterval); @@ -189,11 +184,10 @@ void CMenu::MenuAimbot(int iTab) } if (Section("Backtrack", 8)) { - FToggle(Vars::Backtrack::Enabled, FToggleEnum::Left); - FToggle(Vars::Backtrack::PreferOnShot, FToggleEnum::Right); FSlider(Vars::Backtrack::Latency); FSlider(Vars::Backtrack::Interp); FSlider(Vars::Backtrack::Window); + //FToggle(Vars::Backtrack::PreferOnShot); } EndSection(); if (Vars::Debug::Options.Value) { @@ -267,7 +261,7 @@ void CMenu::MenuAimbot(int iTab) FSlider(Vars::Aimbot::Projectile::GroundMaxChanges, FSliderEnum::Left); FSlider(Vars::Aimbot::Projectile::GroundMaxChangeTime, FSliderEnum::Right); - FText("Air"); + FText("\nAir"); FSlider(Vars::Aimbot::Projectile::AirSamples, FSliderEnum::Left); FSlider(Vars::Aimbot::Projectile::AirStraightFuzzyValue, FSliderEnum::Right); FSlider(Vars::Aimbot::Projectile::AirLowMinimumSamples, FSliderEnum::Left); @@ -301,8 +295,7 @@ void CMenu::MenuAimbot(int iTab) FSlider(Vars::Aimbot::Projectile::SplashTraceInterval, FSliderEnum::Left); FSlider(Vars::Aimbot::Projectile::SplashNormalSkip, FSliderEnum::Right); FDropdown(Vars::Aimbot::Projectile::SplashMode, FDropdownEnum::Left); - bool bHovered; FDropdown(Vars::Aimbot::Projectile::RocketSplashMode, FDropdownEnum::Right, 0, &bHovered); - FTooltip("Special splash type for rockets, more expensive", bHovered); + FDropdown(Vars::Aimbot::Projectile::RocketSplashMode, FDropdownEnum::Right, 0, &Hovered); FTooltip("Special splash type for rockets, more expensive", Hovered); FSlider(Vars::Aimbot::Projectile::DeltaCount, FSliderEnum::Left); FDropdown(Vars::Aimbot::Projectile::DeltaMode, FDropdownEnum::Right); FDropdown(Vars::Aimbot::Projectile::MovesimFrictionFlags); @@ -443,27 +436,21 @@ void CMenu::MenuAimbot(int iTab) } EndSection(); if (Section("Cheater Detection")) { - PushTransparent(!FGet(Vars::CheaterDetection::Methods)); + FDropdown(Vars::CheaterDetection::Methods); + PushTransparent(!FGet(Vars::CheaterDetection::DetectionsRequired)); { - FDropdown(Vars::CheaterDetection::Methods); - PushTransparent(Transparent || !FGet(Vars::CheaterDetection::DetectionsRequired)); - { - FSlider(Vars::CheaterDetection::DetectionsRequired); - } - PopTransparent(); - - PushTransparent(Transparent || !(FGet(Vars::CheaterDetection::Methods) & Vars::CheaterDetection::MethodsEnum::PacketChoking)); - { - FSlider(Vars::CheaterDetection::MinimumChoking); - } - PopTransparent(); - - PushTransparent(Transparent || !(FGet(Vars::CheaterDetection::Methods) & Vars::CheaterDetection::MethodsEnum::AimFlicking)); - { - FSlider(Vars::CheaterDetection::MinimumFlick, FSliderEnum::Left); - FSlider(Vars::CheaterDetection::MaximumNoise, FSliderEnum::Right); - } - PopTransparent(); + FSlider(Vars::CheaterDetection::DetectionsRequired); + } + PopTransparent(); + PushTransparent(!(FGet(Vars::CheaterDetection::Methods) & Vars::CheaterDetection::MethodsEnum::PacketChoking)); + { + FSlider(Vars::CheaterDetection::MinimumChoking); + } + PopTransparent(); + PushTransparent(!(FGet(Vars::CheaterDetection::Methods) & Vars::CheaterDetection::MethodsEnum::AimFlicking)); + { + FSlider(Vars::CheaterDetection::MinimumFlick, FSliderEnum::Left); + FSlider(Vars::CheaterDetection::MaximumNoise, FSliderEnum::Right); } PopTransparent(); } EndSection(); @@ -472,7 +459,7 @@ void CMenu::MenuAimbot(int iTab) FToggle(Vars::Speedhack::Enabled); PushTransparent(!FGet(Vars::Speedhack::Enabled)); { - FSlider(Vars::Speedhack::Factor); + FSlider(Vars::Speedhack::Amount); } PopTransparent(); } EndSection(); @@ -749,7 +736,7 @@ void CMenu::MenuVisuals(int iTab) SetCursorPos({ vOriginalPos.x + H::Draw.Scale(9), vOriginalPos.y + H::Draw.Scale(7) }); FText(TruncateText(tGroup.m_sName, flTextWidth).c_str()); - SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(22), vOriginalPos.y + H::Draw.Scale(6) }); + SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(26), vOriginalPos.y + H::Draw.Scale(2) }); bool bDelete = IconButton(ICON_MD_DELETE); SetCursorPos(vOriginalPos); @@ -859,7 +846,7 @@ void CMenu::MenuVisuals(int iTab) FMDropdown("Material", &tGroup.m_tBacktrackChams.Visible, FDropdownEnum::Left); { auto& tRow = vRowSizes.front(); - tRow.m_flPosY += H::Draw.Scale(16), tRow.m_flSizeY -= H::Draw.Scale(16); + tRow.m_vPos.y += H::Draw.Scale(16), tRow.m_vSize.y -= H::Draw.Scale(16); SetCursorPos({ GetWindowWidth() / 2 + GetStyle().WindowPadding.x / 2, GetRowPos() }); } FToggle("Ignore Z", &tGroup.m_bBacktrackIgnoreZ, FToggleEnum::Left); @@ -1581,8 +1568,9 @@ void CMenu::MenuLogs(int iTab) IconImage(ICON_MD_GROUPS); } SetCursorPos({ vOriginalPos.x + lOffset, vOriginalPos.y + H::Draw.Scale(7) }); - FText(player.m_sName.c_str()); - lOffset += FCalcTextSize(player.m_sName.c_str()).x + H::Draw.Scale(8); + auto sName = TruncateText(player.m_sName, flWidth / 2 - lOffset); + FText(sName.c_str()); + lOffset += FCalcTextSize(sName.c_str()).x + H::Draw.Scale(8); // buttons bool bClicked = false; @@ -1632,7 +1620,7 @@ void CMenu::MenuLogs(int iTab) TextColored(IsColorBright(tTagColor) ? ImVec4(0, 0, 0, 1) : ImVec4(1, 1, 1, 1), tTag.m_sName.c_str()); if (iID) { - SetCursorPos({ vTagPos.x + flTagWidth - H::Draw.Scale(18), vTagPos.y + H::Draw.Scale(2) }); + SetCursorPos({ vTagPos.x + flTagWidth - H::Draw.Scale(22), vTagPos.y - H::Draw.Scale(2) }); if (IconButton(ICON_MD_CANCEL)) F::PlayerUtils.RemoveTag(player.m_uFriendsID, iID, true, player.m_sName); } @@ -1647,11 +1635,11 @@ void CMenu::MenuLogs(int iTab) PopFont(); } EndChild(); - bClicked = IsItemHovered() && IsMouseClicked(ImGuiMouseButton_Right); + bClicked = IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right); } SetCursorPos(vOriginalPos); - Button(std::format("##{}", player.m_sName).c_str(), { flWidth, flHeight }); - bClicked = bClicked || IsItemHovered() && IsMouseClicked(ImGuiMouseButton_Right); + Button(std::format("##{}", player.m_uFriendsID).c_str(), { flWidth, flHeight }); + bClicked = bClicked || IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right); // popups if (bClicked) @@ -2011,14 +1999,17 @@ void CMenu::MenuLogs(int iTab) } // buttons / icons - SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(22), vOriginalPos.y + H::Draw.Scale(6) }); if (!_tTag.m_bLocked) + { + SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(26), vOriginalPos.y + H::Draw.Scale(2) }); bDelete = IconButton(ICON_MD_DELETE); + } else { + SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(22), vOriginalPos.y + H::Draw.Scale(6) }); switch (F::PlayerUtils.IndexToTag(_iID)) { - //case DEFAULT_TAG: // no image + //case DEFAULT_TAG: // no image case IGNORED_TAG: IconImage(ICON_MD_DO_NOT_DISTURB); break; case CHEATER_TAG: IconImage(ICON_MD_FLAG); break; case FRIEND_TAG: IconImage(ICON_MD_GROUP); break; @@ -2547,7 +2538,7 @@ void CMenu::MenuLogs(int iTab) SetCursorPos(vOriginalPos); DebugDummy({ flWidth, H::Draw.Scale(13) * iLines + GetStyle().WindowPadding.y }); - if (IsItemHovered() && IsMouseDown(ImGuiMouseButton_Right)) + if (IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right)) OpenPopup(std::format("Output{}", tOutput.m_iID).c_str()); if (FBeginPopup(std::format("Output{}", tOutput.m_iID).c_str())) { @@ -2651,19 +2642,19 @@ void CMenu::MenuSettings(int iTab) bool bCurrentConfig = FNV1A::Hash32(sConfigName.c_str()) == FNV1A::Hash32(F::Configs.m_sCurrentConfig.c_str()); ImVec2 vOriginalPos = GetCursorPos(); - SetCursorPos({ vOriginalPos.x + H::Draw.Scale(6), vOriginalPos.y + H::Draw.Scale(13) }); + SetCursorPos({ vOriginalPos.x + H::Draw.Scale(2), vOriginalPos.y + H::Draw.Scale(9) }); if (IconButton(bCurrentConfig ? ICON_MD_REFRESH : ICON_MD_DOWNLOAD)) F::Configs.LoadConfig(sConfigName); SetCursorPos({ H::Draw.Scale(43), vOriginalPos.y + H::Draw.Scale(14) }); TextColored(bCurrentConfig ? F::Render.Active.Value : F::Render.Inactive.Value, TruncateText(sConfigName, GetWindowWidth() - GetStyle().WindowPadding.x * 2 - H::Draw.Scale(80)).c_str()); - int iOffset = 5; - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(13) }); + int iOffset = 9; + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(9) }); if (IconButton(ICON_MD_DELETE)) OpenPopup(std::format("Confirmation## RemoveConfig{}", sConfigName).c_str()); - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(13) }); + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(9) }); if (IconButton(ICON_MD_SAVE)) { if (!bCurrentConfig || F::Configs.m_sCurrentVisuals.length()) @@ -2717,7 +2708,7 @@ void CMenu::MenuSettings(int iTab) } EndSection(); SetCursorPosX(GetCursorPosX() + 8); PushStyleColor(ImGuiCol_Text, F::Render.Inactive.Value); - FText(__CONFIGURATION__ " @ " __DATE__ ", " __TIME__); + FText("Built @ " __DATE__ ", " __TIME__ ", " __CONFIGURATION__); PopStyleColor(); @@ -2763,19 +2754,19 @@ void CMenu::MenuSettings(int iTab) bool bCurrentConfig = FNV1A::Hash32(sConfigName.c_str()) == FNV1A::Hash32(F::Configs.m_sCurrentVisuals.c_str()); ImVec2 vOriginalPos = GetCursorPos(); - SetCursorPos({ vOriginalPos.x + H::Draw.Scale(6), vOriginalPos.y + H::Draw.Scale(13) }); + SetCursorPos({ vOriginalPos.x + H::Draw.Scale(2), vOriginalPos.y + H::Draw.Scale(9) }); if (IconButton(bCurrentConfig ? ICON_MD_REFRESH : ICON_MD_DOWNLOAD)) F::Configs.LoadVisual(sConfigName); SetCursorPos({ H::Draw.Scale(43), vOriginalPos.y + H::Draw.Scale(14) }); TextColored(bCurrentConfig ? F::Render.Active.Value : F::Render.Inactive.Value, TruncateText(sConfigName, GetWindowWidth() - GetStyle().WindowPadding.x * 2 - H::Draw.Scale(80)).c_str()); - int iOffset = 5; - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(13) }); + int iOffset = 9; + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(9) }); if (IconButton(ICON_MD_DELETE)) OpenPopup(std::format("Confirmation## DeleteVisual{}", sConfigName).c_str()); - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(13) }); + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(9) }); if (IconButton(ICON_MD_SAVE)) { if (!bCurrentConfig) @@ -2932,7 +2923,7 @@ void CMenu::MenuSettings(int iTab) { int _iBind = std::distance(F::Binds.m_vBinds.begin(), it); auto& _tBind = *it; - if (iParent != -2 && iParent != _tBind.m_iParent || mBinds.contains(_iBind)) + if (iParent != DEFAULT_BIND - 1 && iParent != _tBind.m_iParent || mBinds.contains(_iBind)) continue; mBinds[_iBind] = true; @@ -3020,26 +3011,26 @@ void CMenu::MenuSettings(int iTab) FText(sInfo.c_str()); // buttons - int iOffset = -3; + int iOffset = 1; - SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(6) }); + SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(2) }); bool bDelete = IconButton(ICON_MD_DELETE); - SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(6) }); + SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(2) }); if (IconButton(ICON_MD_EDIT)) CurrentBind = CurrentBind != _iBind ? _iBind : DEFAULT_BIND; - SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(6) }); + SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(2) }); if (IconButton(!_tBind.m_bNot ? ICON_MD_CODE : ICON_MD_CODE_OFF)) _tBind.m_bNot = !_tBind.m_bNot; PushTransparent(Transparent || _tBind.m_iVisibility == BindVisibilityEnum::Hidden, true); - SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(6) }); + SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(2) }); if (IconButton(_tBind.m_iVisibility == BindVisibilityEnum::Always ? ICON_MD_VISIBILITY : ICON_MD_VISIBILITY_OFF)) _tBind.m_iVisibility = (_tBind.m_iVisibility + 1) % 3; PopTransparent(1, 1); - SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(6) }); + SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(2) }); if (IconButton(_tBind.m_bEnabled ? ICON_MD_TOGGLE_ON : ICON_MD_TOGGLE_OFF)) _tBind.m_bEnabled = !_tBind.m_bEnabled; @@ -3096,7 +3087,7 @@ void CMenu::MenuSettings(int iTab) EndPopup(); } - if (iParent != -2) + if (iParent != DEFAULT_BIND - 1) getBinds(_iBind, x + 1); } }; @@ -3200,10 +3191,10 @@ void CMenu::MenuSettings(int iTab) SetCursorPos({ H::Draw.Scale(17), vOriginalPos.y + H::Draw.Scale(14) }); TextColored(tMaterial.m_bLocked ? F::Render.Inactive.Value : F::Render.Active.Value, TruncateText(tMaterial.m_sName, GetWindowWidth() - GetStyle().WindowPadding.x * 2 - H::Draw.Scale(56)).c_str()); - int iOffset = 5; + int iOffset = 9; if (!tMaterial.m_bLocked) { - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(13) }); + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(9) }); if (IconButton(ICON_MD_DELETE)) OpenPopup(std::format("Confirmation## DeleteMat{}", tMaterial.m_sName).c_str()); if (FBeginPopupModal(std::format("Confirmation## DeleteMat{}", tMaterial.m_sName).c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysUseWindowPadding)) @@ -3222,7 +3213,7 @@ void CMenu::MenuSettings(int iTab) } } - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(13) }); + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(9) }); if (IconButton(ICON_MD_EDIT)) { CurrentMaterial = tMaterial.m_sName; @@ -3304,7 +3295,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); FTooltip("Only localhost servers"); + FToggle(Vars::Debug::DrawServerHitboxes, FToggleEnum::Right, &Hovered); FTooltip("Only localhost servers", Hovered); FToggle(Vars::Debug::AntiAimLines, FToggleEnum::Left); FToggle(Vars::Debug::CrashLogging, FToggleEnum::Right); #ifdef DEBUG_TRACES @@ -3366,11 +3357,20 @@ void CMenu::MenuSettings(int iTab) if (Section("##Debug", -8)) { if (FButton("Restore lines", FButtonEnum::Left)) - F::Visuals.RestoreLines(); + { + for (auto& tLine : G::LineStorage) + tLine.m_flTime = I::GlobalVars->curtime + 60.f; + } if (FButton("Restore paths", FButtonEnum::Right | FButtonEnum::SameLine)) - F::Visuals.RestorePaths(); + { + for (auto& tPath : G::PathStorage) + tPath.m_flTime = I::GlobalVars->curtime + 60.f; + } if (FButton("Restore boxes", FButtonEnum::Left)) - F::Visuals.RestoreBoxes(); + { + for (auto& tBox : G::BoxStorage) + tBox.m_flTime = I::GlobalVars->curtime + 60.f; + } if (FButton("Clear visuals", FButtonEnum::Right | FButtonEnum::SameLine)) { G::LineStorage.clear(); @@ -3547,7 +3547,7 @@ void CMenu::MenuSearch(std::string sSearch) else if (iTypeEnum == WidgetEnum::FSlider && iLastEnum == WidgetEnum::FDropdown && (i % 2) && !vRowSizes.empty()) { auto& tRow = vRowSizes.front(); - tRow.m_flPosY += H::Draw.Scale(13), tRow.m_flSizeY -= H::Draw.Scale(13); + tRow.m_vPos.y += H::Draw.Scale(13), tRow.m_vSize.y -= H::Draw.Scale(13); SetCursorPos({ GetWindowWidth() / 2 + GetStyle().WindowPadding.x / 2, GetRowPos() }); i = 0; } @@ -3949,21 +3949,21 @@ void CMenu::DrawBinds() if (m_bIsOpen) { // buttons - SetCursorPos({ flWidth - H::Draw.Scale(25), H::Draw.Scale(iListStart - 1 + 18 * i) }); - bool bDelete = IconButton(ICON_MD_DELETE); + SetCursorPos({ flWidth - H::Draw.Scale(26), H::Draw.Scale(iListStart - 2 + 18 * i) }); + bool bDelete = IconButton(ICON_MD_DELETE, H::Draw.Scale(18)); - SetCursorPos({ flWidth - H::Draw.Scale(50), H::Draw.Scale(iListStart - 1 + 18 * i) }); - if (IconButton(!tBind.m_bNot ? ICON_MD_CODE : ICON_MD_CODE_OFF)) + SetCursorPos({ flWidth - H::Draw.Scale(51), H::Draw.Scale(iListStart - 2 + 18 * i) }); + if (IconButton(!tBind.m_bNot ? ICON_MD_CODE : ICON_MD_CODE_OFF, H::Draw.Scale(18))) tBind.m_bNot = !tBind.m_bNot; PushTransparent(Transparent || tBind.m_iVisibility == BindVisibilityEnum::Hidden, true); - SetCursorPos({ flWidth - H::Draw.Scale(75), H::Draw.Scale(iListStart - 1 + 18 * i) }); - if (IconButton(tBind.m_iVisibility == BindVisibilityEnum::Always ? ICON_MD_VISIBILITY : ICON_MD_VISIBILITY_OFF)) + SetCursorPos({ flWidth - H::Draw.Scale(76), H::Draw.Scale(iListStart - 2 + 18 * i) }); + if (IconButton(tBind.m_iVisibility == BindVisibilityEnum::Always ? ICON_MD_VISIBILITY : ICON_MD_VISIBILITY_OFF, H::Draw.Scale(18))) tBind.m_iVisibility = (tBind.m_iVisibility + 1) % 3; PopTransparent(1, 1); - SetCursorPos({ flWidth - H::Draw.Scale(100), H::Draw.Scale(iListStart - 1 + 18 * i) }); - if (IconButton(tBind.m_bEnabled ? ICON_MD_TOGGLE_ON : ICON_MD_TOGGLE_OFF)) + SetCursorPos({ flWidth - H::Draw.Scale(101), H::Draw.Scale(iListStart - 2 + 18 * i) }); + if (IconButton(tBind.m_bEnabled ? ICON_MD_TOGGLE_ON : ICON_MD_TOGGLE_OFF, H::Draw.Scale(18))) tBind.m_bEnabled = !tBind.m_bEnabled; PopTransparent(1, 1); @@ -4020,7 +4020,7 @@ void CMenu::Render() if (!F::Configs.m_bConfigLoaded || !(ImGui::GetIO().DisplaySize.x > 160.f && ImGui::GetIO().DisplaySize.y > 28.f)) return; - m_bInKeybind = false; + m_bInKeybind = m_bWindowHovered = false; if (m_bIsOpen) { for (int iKey = 0; iKey < 256; iKey++) @@ -4052,6 +4052,7 @@ void CMenu::Render() AddResizableDraggable("Radar", Vars::Radar::Main::Window, FGet(Vars::Radar::Main::Enabled), { H::Draw.Scale(100), H::Draw.Scale(100) }, { H::Draw.Scale(1000), H::Draw.Scale(1000) }, SquareConstraints); F::Render.Cursor = GetMouseCursor(); + m_bWindowHovered = IsWindowHovered(ImGuiHoveredFlags_AnyWindow | ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem); if (!vDisabled.empty()) { diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.h b/Amalgam/src/Features/ImGui/Menu/Menu.h index 5e5755fe..954d832b 100644 --- a/Amalgam/src/Features/ImGui/Menu/Menu.h +++ b/Amalgam/src/Features/ImGui/Menu/Menu.h @@ -36,6 +36,7 @@ public: bool m_bIsOpen = false; bool m_bInKeybind = false; + bool m_bWindowHovered = false; }; ADD_FEATURE(CMenu, Menu); \ No newline at end of file diff --git a/Amalgam/src/Features/Misc/Misc.cpp b/Amalgam/src/Features/Misc/Misc.cpp index fe373843..cfef1e9e 100644 --- a/Amalgam/src/Features/Misc/Misc.cpp +++ b/Amalgam/src/Features/Misc/Misc.cpp @@ -1,14 +1,13 @@ #include "Misc.h" #include "../Backtrack/Backtrack.h" -#include "../TickHandler/TickHandler.h" +#include "../Ticks/Ticks.h" #include "../Players/PlayerUtils.h" #include "../Aimbot/AutoRocketJump/AutoRocketJump.h" void CMisc::RunPre(CTFPlayer* pLocal, CUserCmd* pCmd) { CheatsBypass(); - PingReducer(); WeaponSway(); if (!pLocal) @@ -198,15 +197,10 @@ void CMisc::AntiAFK(CTFPlayer* pLocal, CUserCmd* pCmd) { static Timer tTimer = {}; - static auto mp_idledealmethod = U::ConVars.FindVar("mp_idledealmethod"); - static auto mp_idlemaxtime = U::ConVars.FindVar("mp_idlemaxtime"); - const int iIdleMethod = mp_idledealmethod->GetInt(); - const float flMaxIdleTime = mp_idlemaxtime->GetFloat(); - if (pCmd->buttons & (IN_MOVELEFT | IN_MOVERIGHT | IN_FORWARD | IN_BACK) || !pLocal->IsAlive()) tTimer.Update(); - else if (Vars::Misc::Automation::AntiAFK.Value && iIdleMethod && tTimer.Check(flMaxIdleTime * 60.f - 10.f)) // trigger 10 seconds before kick - pCmd->buttons |= I::GlobalVars->tickcount % 2 ? IN_FORWARD : IN_BACK; + else if (Vars::Misc::Automation::AntiAFK.Value && tTimer.Run(25.f)) + pCmd->buttons |= IN_FORWARD; } void CMisc::InstantRespawnMVM(CTFPlayer* pLocal) @@ -235,37 +229,6 @@ void CMisc::CheatsBypass() } } -void CMisc::PingReducer() -{ - static Timer tTimer = {}; - if (!tTimer.Run(0.1f)) - return; - - auto pNetChan = reinterpret_cast(I::EngineClient->GetNetChannelInfo()); - if (!pNetChan) - return; - - static auto cl_cmdrate = U::ConVars.FindVar("cl_cmdrate"); - const int iCmdRate = cl_cmdrate->GetInt(); - - // force highest cl_updaterate command possible - static auto sv_maxupdaterate = U::ConVars.FindVar("sv_maxupdaterate"); - const int iMaxUpdateRate = sv_maxupdaterate->GetInt(); - - const int iTarget = Vars::Misc::Exploits::PingReducer.Value ? Vars::Misc::Exploits::PingTarget.Value : iCmdRate; - if (m_iWishCmdrate != iTarget) - { - NET_SetConVar cmd("cl_cmdrate", std::to_string(m_iWishCmdrate = iTarget).c_str()); - pNetChan->SendNetMsg(cmd); - } - - if (m_iWishUpdaterate != iMaxUpdateRate) - { - NET_SetConVar cmd("cl_updaterate", std::to_string(m_iWishUpdaterate = iMaxUpdateRate).c_str()); - pNetChan->SendNetMsg(cmd); - } -} - void CMisc::WeaponSway() { static auto cl_wpn_sway_interp = U::ConVars.FindVar("cl_wpn_sway_interp"); @@ -452,9 +415,6 @@ void CMisc::Event(IGameEvent* pEvent, uint32_t uHash) case FNV1A::Hash32Const("client_disconnect"): case FNV1A::Hash32Const("client_beginconnect"): case FNV1A::Hash32Const("game_newmap"): - m_iWishCmdrate = m_iWishUpdaterate = -1; - F::Backtrack.m_flWishInterp = -1.f; - [[fallthrough]]; case FNV1A::Hash32Const("teamplay_round_start"): G::LineStorage.clear(); G::BoxStorage.clear(); @@ -530,7 +490,7 @@ int CMisc::AntiBackstab(CTFPlayer* pLocal, CUserCmd* pCmd, bool bSendPacket) return true; float flTolerance = 0.0625f; - float flExtra = 2.f * flTolerance / flDist; // account for origin tolerance + float flExtra = 2.f * flTolerance / flDist; // account for origin compression float flPosVsTargetViewMinDot = 0.f - 0.0031f - flExtra; Vec3 vTargetForward; Math::AngleVectors(pCmd->viewangles, &vTargetForward); @@ -561,6 +521,41 @@ int CMisc::AntiBackstab(CTFPlayer* pLocal, CUserCmd* pCmd, bool bSendPacket) return 0; } +void CMisc::PingReducer() +{ + static Timer tTimer = {}; + if (!tTimer.Run(0.1f)) + return; + + static auto cl_cmdrate = U::ConVars.FindVar("cl_cmdrate"); + int iTarget = Vars::Misc::Exploits::PingReducer.Value ? Vars::Misc::Exploits::PingTarget.Value : cl_cmdrate->GetInt(); + if (m_iWishCmdrate != iTarget) + { + m_iWishCmdrate = iTarget; + + auto pNetChan = reinterpret_cast(I::EngineClient->GetNetChannelInfo()); + if (pNetChan && I::EngineClient->IsConnected()) + { + NET_SetConVar tConvar = { "cl_cmdrate", std::to_string(m_iWishCmdrate).c_str() }; + pNetChan->SendNetMsg(tConvar); + } + } + + static auto sv_maxupdaterate = U::ConVars.FindVar("sv_maxupdaterate"); // force highest cl_updaterate command possible + iTarget = sv_maxupdaterate->GetInt(); + if (m_iWishUpdaterate != iTarget) + { + m_iWishUpdaterate = iTarget; + + auto pNetChan = reinterpret_cast(I::EngineClient->GetNetChannelInfo()); + if (pNetChan && I::EngineClient->IsConnected()) + { + NET_SetConVar tConvar = { "cl_updaterate", std::to_string(m_iWishUpdaterate).c_str() }; + pNetChan->SendNetMsg(tConvar); + } + } +} + void CMisc::UnlockAchievements() { const auto pAchievementMgr = reinterpret_cast(U::Memory.GetVFunc(I::EngineClient, 114))(); diff --git a/Amalgam/src/Features/Misc/Misc.h b/Amalgam/src/Features/Misc/Misc.h index 2628d1ed..5fa4ef34 100644 --- a/Amalgam/src/Features/Misc/Misc.h +++ b/Amalgam/src/Features/Misc/Misc.h @@ -12,7 +12,6 @@ class CMisc void InstantRespawnMVM(CTFPlayer* pLocal); void CheatsBypass(); - void PingReducer(); void WeaponSway(); void TauntKartControl(CTFPlayer* pLocal, CUserCmd* pCmd); @@ -32,6 +31,7 @@ public: void Event(IGameEvent* pEvent, uint32_t uNameHash); int AntiBackstab(CTFPlayer* pLocal, CUserCmd* pCmd, bool bSendPacket); + void PingReducer(); void UnlockAchievements(); void LockAchievements(); bool SteamRPC(); diff --git a/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp b/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp index f1fd5451..b3de949f 100644 --- a/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp +++ b/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp @@ -1,6 +1,6 @@ #include "NoSpreadHitscan.h" -#include "../../TickHandler/TickHandler.h" +#include "../../Ticks/Ticks.h" #include #include diff --git a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp index 2635e7e9..16932b0f 100644 --- a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp +++ b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp @@ -1,6 +1,6 @@ #include "AntiAim.h" -#include "../../TickHandler/TickHandler.h" +#include "../../Ticks/Ticks.h" #include "../../Players/PlayerUtils.h" #include "../../Misc/Misc.h" #include "../../Aimbot/AutoRocketJump/AutoRocketJump.h" diff --git a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h index ae3421fc..727ca460 100644 --- a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h +++ b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h @@ -23,7 +23,7 @@ public: int GetEdge(CTFPlayer* pEntity, float flEdgeOrigYaw); void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, bool bSendPacket); - inline int AntiAimTicks() { return 3; } + inline int AntiAimTicks() { return 2; } Vec2 vFakeAngles = {}; Vec2 vRealAngles = {}; diff --git a/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp b/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp index 0359021a..2ef04bdb 100644 --- a/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp +++ b/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp @@ -1,6 +1,6 @@ #include "FakeLag.h" -#include "../../TickHandler/TickHandler.h" +#include "../../Ticks/Ticks.h" #include "../../Aimbot/AutoRocketJump/AutoRocketJump.h" bool CFakeLag::IsAllowed(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) diff --git a/Amalgam/src/Features/PacketManip/PacketManip.cpp b/Amalgam/src/Features/PacketManip/PacketManip.cpp index 4d5ea22b..ccebee0a 100644 --- a/Amalgam/src/Features/PacketManip/PacketManip.cpp +++ b/Amalgam/src/Features/PacketManip/PacketManip.cpp @@ -1,7 +1,7 @@ #include "PacketManip.h" #include "../Visuals/FakeAngle/FakeAngle.h" -#include "../TickHandler/TickHandler.h" +#include "../Ticks/Ticks.h" static inline bool AntiAimCheck(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) { diff --git a/Amalgam/src/Features/Resolver/Resolver.cpp b/Amalgam/src/Features/Resolver/Resolver.cpp index 54d26c14..b7a81fac 100644 --- a/Amalgam/src/Features/Resolver/Resolver.cpp +++ b/Amalgam/src/Features/Resolver/Resolver.cpp @@ -2,7 +2,7 @@ #include "../Backtrack/Backtrack.h" #include "../Players/PlayerUtils.h" -#include "../TickHandler/TickHandler.h" +#include "../Ticks/Ticks.h" #include "../Output/Output.h" void CResolver::Reset() diff --git a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp index 0e8d81cc..f839f6ef 100644 --- a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp +++ b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp @@ -170,10 +170,10 @@ void CMovementSimulation::Store() { case 0: if (bLocal && Vars::Misc::Movement::Bunnyhop.Value && G::OriginalMove.m_iButtons & IN_JUMP) - tCurRecord.m_vDirection = vVelocity.To2D().Normalized() * flMaxSpeed; + tCurRecord.m_vDirection = vVelocity.Normalized2D() * flMaxSpeed; break; case 1: - tCurRecord.m_vDirection = vVelocity.To2D().Normalized() * flMaxSpeed; + tCurRecord.m_vDirection = vVelocity.Normalized2D() * flMaxSpeed; break; case 2: tCurRecord.m_vDirection *= 2; @@ -412,7 +412,7 @@ static inline void VisualizeRecords(MoveData& tRecord1, MoveData& tRecord2, Colo G::LineStorage.emplace_back(std::pair(tRecord1.m_vOrigin, tRecord1.m_vOrigin + Vec3(0, 0, 5)), I::GlobalVars->curtime + 5.f, tColor); if (!bStraight && flYaw) { - Vec3 vVelocity = tRecord1.m_vVelocity.To2D().Normalized() * 5; + Vec3 vVelocity = tRecord1.m_vVelocity.Normalized2D() * 5; vVelocity = Math::RotatePoint(vVelocity, {}, { 0, flYaw > 0 ? 90.f : -90.f, 0 }); if (Vars::Aimbot::Projectile::MovesimFrictionFlags.Value & Vars::Aimbot::Projectile::MovesimFrictionFlagsEnum::CalculateIncrease && tRecord1.m_iMode == 1) vVelocity /= GetFrictionScale(tRecord1.m_vVelocity.Length2D(), flYaw, tRecord1.m_vVelocity.z + GetGravity() * TICK_INTERVAL, 0.f, 56.f); @@ -599,7 +599,7 @@ void CMovementSimulation::SetBounds(CTFPlayer* pPlayer) if (pPlayer->entindex() == I::EngineClient->GetLocalPlayer()) return; - // fixes issues with origin tolerance + // fixes issues with origin compression if (auto pGameRules = I::TFGameRules()) { if (auto pViewVectors = pGameRules->GetViewVectors()) @@ -690,7 +690,7 @@ void CMovementSimulation::RunTick(PlayerStorage& tStorage, bool bPath, std::func && !tStorage.m_MoveData.m_flForwardMove && !tStorage.m_MoveData.m_flSideMove && tStorage.m_MoveData.m_vecVelocity.Length2D() > tStorage.m_MoveData.m_flMaxSpeed * 0.015f) { - Vec3 vDirection = tStorage.m_MoveData.m_vecVelocity.To2D().Normalized() * 450.f; + Vec3 vDirection = tStorage.m_MoveData.m_vecVelocity.Normalized2D() * 450.f; DummyCmd.forwardmove = vDirection.x, DummyCmd.sidemove = -vDirection.y; SDK::FixMovement(&DummyCmd, {}, tStorage.m_MoveData.m_vecViewAngles); tStorage.m_MoveData.m_flForwardMove = DummyCmd.forwardmove, tStorage.m_MoveData.m_flSideMove = DummyCmd.sidemove; diff --git a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h index 0dfe382c..513837c5 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::deque m_vPath; + std::vector m_vPath; bool m_bFailed = false; bool m_bInitFailed = false; diff --git a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h index 7dad474e..86d15dfa 100644 --- a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h +++ b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h @@ -25,7 +25,7 @@ struct ProjectileInfo CTFPlayer* m_pOwner = nullptr; - std::deque m_vPath = {}; + std::vector m_vPath = {}; bool m_bQuick = false; }; diff --git a/Amalgam/src/Features/TickHandler/TickHandler.cpp b/Amalgam/src/Features/Ticks/Ticks.cpp similarity index 82% rename from Amalgam/src/Features/TickHandler/TickHandler.cpp rename to Amalgam/src/Features/Ticks/Ticks.cpp index a0596347..a742d99a 100644 --- a/Amalgam/src/Features/TickHandler/TickHandler.cpp +++ b/Amalgam/src/Features/Ticks/Ticks.cpp @@ -1,4 +1,4 @@ -#include "TickHandler.h" +#include "Ticks.h" #include "../NetworkFix/NetworkFix.h" #include "../PacketManip/AntiAim/AntiAim.h" @@ -120,7 +120,7 @@ bool CTickshiftHandler::CanChoke() if (Vars::Misc::Game::AntiCheatCompatibility.Value) iMaxTicks = std::min(iMaxTicks, 8); - return I::ClientState->chokedcommands < 21 && F::Ticks.m_iShiftedTicks + I::ClientState->chokedcommands < iMaxTicks; + return I::ClientState->chokedcommands < 21 && m_iShiftedTicks + I::ClientState->chokedcommands < iMaxTicks; } void CTickshiftHandler::AntiWarp(CTFPlayer* pLocal, CUserCmd* pCmd) @@ -262,7 +262,7 @@ void CTickshiftHandler::CLMove(float accumulated_extra_samples, bool bFinalTick) if (m_bSpeedhack) { - m_iShiftedTicks = Vars::Speedhack::Factor.Value; + m_iShiftedTicks = Vars::Speedhack::Amount.Value; m_iShiftedGoal = 0; } @@ -331,8 +331,8 @@ void CTickshiftHandler::CreateMove(CTFPlayer* pLocal, CUserCmd* pCmd, bool* pSen AntiWarp(pLocal, pCmd); ManagePacket(pCmd, pSendPacket); - F::Ticks.SaveShootPos(pLocal); - F::Ticks.SaveShootAngle(pCmd, *pSendPacket); + SaveShootPos(pLocal); + SaveShootAngle(pCmd, *pSendPacket); } void CTickshiftHandler::ManagePacket(CUserCmd* pCmd, bool* pSendPacket) @@ -347,8 +347,7 @@ void CTickshiftHandler::ManagePacket(CUserCmd* pCmd, bool* pSendPacket) } *pSendPacket = m_iShiftedGoal == m_iShiftedTicks; - if (I::ClientState->chokedcommands >= 21 // prevent overchoking - || m_iShiftedTicks == m_iShiftedGoal + Vars::Doubletap::TickLimit.Value - 1 && I::ClientState->chokedcommands) // unchoke if we are choking + if (I::ClientState->chokedcommands >= 21) // prevent overchoking *pSendPacket = true; } @@ -396,4 +395,38 @@ int CTickshiftHandler::GetMinimumTicksNeeded(CTFWeaponBase* pWeapon) } return (GetShotsWithinPacket(pWeapon) - 1) * std::ceilf(pWeapon->GetFireRate() / TICK_INTERVAL) + iDelay; +} + +void CTickshiftHandler::Draw(CTFPlayer* pLocal) +{ + if (!(Vars::Menu::Indicators.Value & Vars::Menu::IndicatorsEnum::Ticks) || !pLocal->IsAlive()) + return; + + const DragBox_t dtPos = Vars::Menu::TicksDisplay.Value; + const auto& fFont = H::Fonts.GetFont(FONT_INDICATORS); + + if (!m_bSpeedhack) + { + int iChoke = std::max(I::ClientState->chokedcommands - (F::AntiAim.YawOn() ? F::AntiAim.AntiAimTicks() : 0), 0); + int iTicks = std::clamp(m_iShiftedTicks + iChoke, 0, m_iMaxShift); + float flRatio = float(iTicks) / m_iMaxShift; + int iSizeX = H::Draw.Scale(100, Scale_Round), iSizeY = H::Draw.Scale(12, Scale_Round); + int iPosX = dtPos.x - iSizeX / 2, iPosY = dtPos.y + fFont.m_nTall + H::Draw.Scale(4) + 1; + + H::Draw.StringOutlined(fFont, dtPos.x, dtPos.y + 2, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOP, std::format("Ticks {} / {}", iTicks, m_iMaxShift).c_str()); + if (m_iWait) + H::Draw.StringOutlined(fFont, dtPos.x, dtPos.y + fFont.m_nTall + H::Draw.Scale(18, Scale_Round) + 1, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOP, "Not Ready"); + + H::Draw.LineRoundRect(iPosX, iPosY, iSizeX, iSizeY, H::Draw.Scale(3, Scale_Round), Vars::Menu::Theme::Accent.Value, 16); + if (flRatio) + { + iSizeX -= H::Draw.Scale(2, Scale_Ceil) * 2, iSizeY -= H::Draw.Scale(2, Scale_Ceil) * 2; + iPosX += H::Draw.Scale(2, Scale_Round), iPosY += H::Draw.Scale(2, Scale_Round); + H::Draw.StartClipping(iPosX, iPosY, iSizeX * flRatio, iSizeY); + H::Draw.FillRoundRect(iPosX, iPosY, iSizeX, iSizeY, H::Draw.Scale(3, Scale_Round), Vars::Menu::Theme::Accent.Value, 16); + H::Draw.EndClipping(); + } + } + else + H::Draw.StringOutlined(fFont, dtPos.x, dtPos.y + 2, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOP, std::format("Speedhack x{}", Vars::Speedhack::Amount.Value).c_str()); } \ No newline at end of file diff --git a/Amalgam/src/Features/TickHandler/TickHandler.h b/Amalgam/src/Features/Ticks/Ticks.h similarity index 98% rename from Amalgam/src/Features/TickHandler/TickHandler.h rename to Amalgam/src/Features/Ticks/Ticks.h index 0d70fd54..d19f7c0e 100644 --- a/Amalgam/src/Features/TickHandler/TickHandler.h +++ b/Amalgam/src/Features/Ticks/Ticks.h @@ -23,6 +23,7 @@ class CTickshiftHandler public: void Run(float accumulated_extra_samples, bool bFinalTick, CTFPlayer* pLocal); + void Draw(CTFPlayer* pLocal); void Reset(); void CLMove(float accumulated_extra_samples, bool bFinalTick); diff --git a/Amalgam/src/Features/CameraWindow/CameraWindow.cpp b/Amalgam/src/Features/Visuals/CameraWindow/CameraWindow.cpp similarity index 98% rename from Amalgam/src/Features/CameraWindow/CameraWindow.cpp rename to Amalgam/src/Features/Visuals/CameraWindow/CameraWindow.cpp index 21c4b31f..ab3656fa 100644 --- a/Amalgam/src/Features/CameraWindow/CameraWindow.cpp +++ b/Amalgam/src/Features/Visuals/CameraWindow/CameraWindow.cpp @@ -1,5 +1,6 @@ #include "CameraWindow.h" -#include "../Visuals/Materials/Materials.h" + +#include "../../Visuals/Materials/Materials.h" // Draws camera to the screen void CCameraWindow::Draw() diff --git a/Amalgam/src/Features/CameraWindow/CameraWindow.h b/Amalgam/src/Features/Visuals/CameraWindow/CameraWindow.h similarity index 93% rename from Amalgam/src/Features/CameraWindow/CameraWindow.h rename to Amalgam/src/Features/Visuals/CameraWindow/CameraWindow.h index 779e0d83..32187427 100644 --- a/Amalgam/src/Features/CameraWindow/CameraWindow.h +++ b/Amalgam/src/Features/Visuals/CameraWindow/CameraWindow.h @@ -1,5 +1,5 @@ #pragma once -#include "../../SDK/SDK.h" +#include "../../../SDK/SDK.h" class CCameraWindow { diff --git a/Amalgam/src/Features/Visuals/Chams/Chams.cpp b/Amalgam/src/Features/Visuals/Chams/Chams.cpp index 94949a3f..aa0464dc 100644 --- a/Amalgam/src/Features/Visuals/Chams/Chams.cpp +++ b/Amalgam/src/Features/Visuals/Chams/Chams.cpp @@ -315,7 +315,7 @@ void CChams::Store(CTFPlayer* pLocal) if (pEntity->IsPlayer() && !pEntity->IsDormant()) { // backtrack - if (Vars::Backtrack::Enabled.Value && Vars::Chams::Backtrack::Enabled.Value && pEntity != pLocal) + if (Vars::Chams::Backtrack::Enabled.Value && pEntity != pLocal) { auto pWeapon = H::Entities.GetWeapon(); if (pWeapon && (G::PrimaryWeaponType != EWeaponType::PROJECTILE || Vars::Chams::Backtrack::Draw.Value & Vars::Chams::Backtrack::DrawEnum::Always)) @@ -379,9 +379,6 @@ void CChams::RenderMain() void CChams::RenderBacktrack(const DrawModelState_t& pState, const ModelRenderInfo_t& pInfo) { - if (!Vars::Backtrack::Enabled.Value || !Vars::Chams::Backtrack::Enabled.Value) - return; - static auto ModelRender_DrawModelExecute = U::Hooks.m_mHooks["IVModelRender_DrawModelExecute"]; auto pRenderContext = I::MaterialSystem->GetRenderContext(); if (!ModelRender_DrawModelExecute || !pRenderContext) @@ -406,8 +403,10 @@ void CChams::RenderBacktrack(const DrawModelState_t& pState, const ModelRenderIn I::RenderView->SetBlend(flOriginalBlend); }; - auto pRecords = F::Backtrack.GetRecords(pEntity); - auto vRecords = F::Backtrack.GetValidRecords(pRecords); + std::vector vRecords = {}; + if (!F::Backtrack.GetRecords(pEntity, vRecords)) + return; + vRecords = F::Backtrack.GetValidRecords(vRecords); if (!vRecords.size()) return; @@ -416,25 +415,25 @@ void CChams::RenderBacktrack(const DrawModelState_t& pState, const ModelRenderIn if (!bDrawLast && !bDrawFirst) { - for (auto& tRecord : vRecords) + for (auto pRecord : vRecords) { - if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(tRecord.m_vOrigin), 1.f, 24.f, 0.f, 1.f)) - drawModel(tRecord.m_vOrigin, pState, pInfo, tRecord.m_BoneMatrix.m_aBones, flBlend); + if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(pRecord->m_vOrigin), 1.f, 24.f, 0.f, 1.f)) + drawModel(pRecord->m_vOrigin, pState, pInfo, pRecord->m_BoneMatrix.m_aBones, flBlend); } } else { if (bDrawLast) { - auto& tRecord = vRecords.back(); - if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(tRecord.m_vOrigin), 1.f, 24.f, 0.f, 1.f)) - drawModel(tRecord.m_vOrigin, pState, pInfo, tRecord.m_BoneMatrix.m_aBones, flBlend); + auto pRecord = vRecords.back(); + if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(pRecord->m_vOrigin), 1.f, 24.f, 0.f, 1.f)) + drawModel(pRecord->m_vOrigin, pState, pInfo, pRecord->m_BoneMatrix.m_aBones, flBlend); } if (bDrawFirst) { - auto& tRecord = vRecords.front(); - if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(tRecord.m_vOrigin), 1.f, 24.f, 0.f, 1.f)) - drawModel(tRecord.m_vOrigin, pState, pInfo, tRecord.m_BoneMatrix.m_aBones, flBlend); + auto pRecord = vRecords.front(); + if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(pRecord->m_vOrigin), 1.f, 24.f, 0.f, 1.f)) + drawModel(pRecord->m_vOrigin, pState, pInfo, pRecord->m_BoneMatrix.m_aBones, flBlend); } } @@ -442,9 +441,6 @@ void CChams::RenderBacktrack(const DrawModelState_t& pState, const ModelRenderIn } void CChams::RenderFakeAngle(const DrawModelState_t& pState, const ModelRenderInfo_t& pInfo) { - if (!Vars::Chams::FakeAngle::Enabled.Value || pInfo.entity_index != I::EngineClient->GetLocalPlayer() || !F::FakeAngle.bDrawChams || !F::FakeAngle.bBonesSetup) - return; - static auto ModelRender_DrawModelExecute = U::Hooks.m_mHooks["IVModelRender_DrawModelExecute"]; auto pRenderContext = I::MaterialSystem->GetRenderContext(); if (!ModelRender_DrawModelExecute || !pRenderContext) diff --git a/Amalgam/src/Features/Visuals/ESP/ESP.cpp b/Amalgam/src/Features/Visuals/ESP/ESP.cpp index 714c5e21..36dbeea2 100644 --- a/Amalgam/src/Features/Visuals/ESP/ESP.cpp +++ b/Amalgam/src/Features/Visuals/ESP/ESP.cpp @@ -954,21 +954,25 @@ void CESP::DrawPlayers() if (tCache.m_bBones) { auto pPlayer = pEntity->As(); - switch (H::Entities.GetModel(pPlayer->entindex())) + matrix3x4 aBones[MAXSTUDIOBONES]; + if (pPlayer->SetupBones(aBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, I::GlobalVars->curtime)) { - case FNV1A::Hash32Const("models/vsh/player/saxton_hale.mdl"): - DrawBones(pPlayer, { HITBOX_SAXTON_HEAD, HITBOX_SAXTON_CHEST, HITBOX_SAXTON_PELVIS }, tCache.m_tColor); - DrawBones(pPlayer, { HITBOX_SAXTON_CHEST, HITBOX_SAXTON_LEFT_UPPER_ARM, HITBOX_SAXTON_LEFT_FOREARM, HITBOX_SAXTON_LEFT_HAND }, tCache.m_tColor); - DrawBones(pPlayer, { HITBOX_SAXTON_CHEST, HITBOX_SAXTON_RIGHT_UPPER_ARM, HITBOX_SAXTON_RIGHT_FOREARM, HITBOX_SAXTON_RIGHT_HAND }, tCache.m_tColor); - DrawBones(pPlayer, { HITBOX_SAXTON_PELVIS, HITBOX_SAXTON_LEFT_THIGH, HITBOX_SAXTON_LEFT_CALF, HITBOX_SAXTON_LEFT_FOOT }, tCache.m_tColor); - DrawBones(pPlayer, { HITBOX_SAXTON_PELVIS, HITBOX_SAXTON_RIGHT_THIGH, HITBOX_SAXTON_RIGHT_CALF, HITBOX_SAXTON_RIGHT_FOOT }, tCache.m_tColor); - break; - default: - DrawBones(pPlayer, { HITBOX_HEAD, HITBOX_CHEST, HITBOX_PELVIS }, tCache.m_tColor); - DrawBones(pPlayer, { HITBOX_CHEST, HITBOX_LEFT_UPPER_ARM, HITBOX_LEFT_FOREARM, HITBOX_LEFT_HAND }, tCache.m_tColor); - DrawBones(pPlayer, { HITBOX_CHEST, HITBOX_RIGHT_UPPER_ARM, HITBOX_RIGHT_FOREARM, HITBOX_RIGHT_HAND }, tCache.m_tColor); - DrawBones(pPlayer, { HITBOX_PELVIS, HITBOX_LEFT_THIGH, HITBOX_LEFT_CALF, HITBOX_LEFT_FOOT }, tCache.m_tColor); - DrawBones(pPlayer, { HITBOX_PELVIS, HITBOX_RIGHT_THIGH, HITBOX_RIGHT_CALF, HITBOX_RIGHT_FOOT }, tCache.m_tColor); + switch (H::Entities.GetModel(pPlayer->entindex())) + { + case FNV1A::Hash32Const("models/vsh/player/saxton_hale.mdl"): + DrawBones(pPlayer, aBones, { HITBOX_SAXTON_HEAD, HITBOX_SAXTON_CHEST, HITBOX_SAXTON_PELVIS }, tCache.m_tColor); + DrawBones(pPlayer, aBones, { HITBOX_SAXTON_CHEST, HITBOX_SAXTON_LEFT_UPPER_ARM, HITBOX_SAXTON_LEFT_FOREARM, HITBOX_SAXTON_LEFT_HAND }, tCache.m_tColor); + DrawBones(pPlayer, aBones, { HITBOX_SAXTON_CHEST, HITBOX_SAXTON_RIGHT_UPPER_ARM, HITBOX_SAXTON_RIGHT_FOREARM, HITBOX_SAXTON_RIGHT_HAND }, tCache.m_tColor); + DrawBones(pPlayer, aBones, { HITBOX_SAXTON_PELVIS, HITBOX_SAXTON_LEFT_THIGH, HITBOX_SAXTON_LEFT_CALF, HITBOX_SAXTON_LEFT_FOOT }, tCache.m_tColor); + DrawBones(pPlayer, aBones, { HITBOX_SAXTON_PELVIS, HITBOX_SAXTON_RIGHT_THIGH, HITBOX_SAXTON_RIGHT_CALF, HITBOX_SAXTON_RIGHT_FOOT }, tCache.m_tColor); + break; + default: + DrawBones(pPlayer, aBones, { HITBOX_HEAD, HITBOX_CHEST, HITBOX_PELVIS }, tCache.m_tColor); + DrawBones(pPlayer, aBones, { HITBOX_CHEST, HITBOX_LEFT_UPPER_ARM, HITBOX_LEFT_FOREARM, HITBOX_LEFT_HAND }, tCache.m_tColor); + DrawBones(pPlayer, aBones, { HITBOX_CHEST, HITBOX_RIGHT_UPPER_ARM, HITBOX_RIGHT_FOREARM, HITBOX_RIGHT_HAND }, tCache.m_tColor); + DrawBones(pPlayer, aBones, { HITBOX_PELVIS, HITBOX_LEFT_THIGH, HITBOX_LEFT_CALF, HITBOX_LEFT_FOOT }, tCache.m_tColor); + DrawBones(pPlayer, aBones, { HITBOX_PELVIS, HITBOX_RIGHT_THIGH, HITBOX_RIGHT_CALF, HITBOX_RIGHT_FOOT }, tCache.m_tColor); + } } } @@ -1183,12 +1187,12 @@ const char* CESP::GetPlayerClass(int iClassNum) return iClassNum < 10 && iClassNum > 0 ? szClasses[iClassNum] : szClasses[0]; } -void CESP::DrawBones(CTFPlayer* pPlayer, std::vector vecBones, Color_t clr) +void CESP::DrawBones(CTFPlayer* pPlayer, matrix3x4* aBones, std::vector vecBones, Color_t clr) { for (size_t n = 1; n < vecBones.size(); n++) { - const auto vBone1 = pPlayer->GetHitboxCenter(vecBones[n]); - const auto vBone2 = pPlayer->GetHitboxCenter(vecBones[n - 1]); + auto vBone1 = pPlayer->GetHitboxCenter(aBones, vecBones[n]); + auto vBone2 = pPlayer->GetHitboxCenter(aBones, vecBones[n - 1]); Vec3 vScreenBone, vScreenParent; if (SDK::W2S(vBone1, vScreenBone) && SDK::W2S(vBone2, vScreenParent)) diff --git a/Amalgam/src/Features/Visuals/ESP/ESP.h b/Amalgam/src/Features/Visuals/ESP/ESP.h index 3480075a..82f641c9 100644 --- a/Amalgam/src/Features/Visuals/ESP/ESP.h +++ b/Amalgam/src/Features/Visuals/ESP/ESP.h @@ -54,7 +54,7 @@ private: Color_t GetColor(CTFPlayer* pLocal, CBaseEntity* pEntity); bool GetDrawBounds(CBaseEntity* pEntity, float& x, float& y, float& w, float& h); const char* GetPlayerClass(int nClassNum); - void DrawBones(CTFPlayer* pPlayer, std::vector vecBones, Color_t clr); + void DrawBones(CTFPlayer* pPlayer, matrix3x4* aBones, std::vector vecBones, Color_t clr); std::unordered_map m_mPlayerCache = {}; std::unordered_map m_mBuildingCache = {}; diff --git a/Amalgam/src/Features/Visuals/FakeAngle/FakeAngle.cpp b/Amalgam/src/Features/Visuals/FakeAngle/FakeAngle.cpp index 75c5972e..39563e2d 100644 --- a/Amalgam/src/Features/Visuals/FakeAngle/FakeAngle.cpp +++ b/Amalgam/src/Features/Visuals/FakeAngle/FakeAngle.cpp @@ -1,7 +1,7 @@ #include "FakeAngle.h" #include "../../PacketManip/AntiAim/AntiAim.h" -#include "../../TickHandler/TickHandler.h" +#include "../../Ticks/Ticks.h" void CFakeAngle::Run(CTFPlayer* pLocal) { @@ -21,7 +21,7 @@ void CFakeAngle::Run(CTFPlayer* pLocal) int nOldSequence = pLocal->m_nSequence(); float flOldCycle = pLocal->m_flCycle(); auto pOldPoseParams = pLocal->m_flPoseParameter(); - char pOldAnimState[sizeof(CTFPlayerAnimState)] = {}; + char pOldAnimState[sizeof(CTFPlayerAnimState)]; memcpy(pOldAnimState, pAnimState, sizeof(CTFPlayerAnimState)); I::GlobalVars->frametime = 0.f; diff --git a/Amalgam/src/Features/Visuals/Glow/Glow.cpp b/Amalgam/src/Features/Visuals/Glow/Glow.cpp index 51483a33..5dfbd56a 100644 --- a/Amalgam/src/Features/Visuals/Glow/Glow.cpp +++ b/Amalgam/src/Features/Visuals/Glow/Glow.cpp @@ -343,7 +343,7 @@ void CGlow::Store(CTFPlayer* pLocal) if (pEntity->IsPlayer() && !pEntity->IsDormant()) { // backtrack - if (Vars::Backtrack::Enabled.Value && Vars::Glow::Backtrack::Enabled.Value && (Vars::Glow::Backtrack::Stencil.Value || Vars::Glow::Backtrack::Blur.Value) && pEntity != pLocal) + if (Vars::Glow::Backtrack::Enabled.Value && (Vars::Glow::Backtrack::Stencil.Value || Vars::Glow::Backtrack::Blur.Value) && pEntity != pLocal) { auto pWeapon = H::Entities.GetWeapon(); if (pWeapon && (G::PrimaryWeaponType != EWeaponType::PROJECTILE || Vars::Glow::Backtrack::Draw.Value & Vars::Glow::Backtrack::DrawEnum::Always)) @@ -434,8 +434,10 @@ void CGlow::RenderBacktrack(const DrawModelState_t& pState, const ModelRenderInf //I::RenderView->SetBlend(flOriginalBlend); }; - const auto& pRecords = F::Backtrack.GetRecords(pEntity); - auto vRecords = F::Backtrack.GetValidRecords(pRecords); + std::vector vRecords = {}; + if (!F::Backtrack.GetRecords(pEntity, vRecords)) + return; + vRecords = F::Backtrack.GetValidRecords(vRecords); if (!vRecords.size()) return; @@ -444,25 +446,25 @@ void CGlow::RenderBacktrack(const DrawModelState_t& pState, const ModelRenderInf if (!bDrawLast && !bDrawFirst) { - for (auto& tRecord : vRecords) + for (auto pRecord : vRecords) { - if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(tRecord.m_vOrigin), 1.f, 24.f, 0.f, 1.f)) - drawModel(tRecord.m_vOrigin, pState, pInfo, tRecord.m_BoneMatrix.m_aBones, flBlend); + if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(pRecord->m_vOrigin), 1.f, 24.f, 0.f, 1.f)) + drawModel(pRecord->m_vOrigin, pState, pInfo, pRecord->m_BoneMatrix.m_aBones, flBlend); } } else { if (bDrawLast) { - auto& tRecord = vRecords.back(); - if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(tRecord.m_vOrigin), 1.f, 24.f, 0.f, 1.f)) - drawModel(tRecord.m_vOrigin, pState, pInfo, tRecord.m_BoneMatrix.m_aBones, flBlend); + auto pRecord = vRecords.back(); + if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(pRecord->m_vOrigin), 1.f, 24.f, 0.f, 1.f)) + drawModel(pRecord->m_vOrigin, pState, pInfo, pRecord->m_BoneMatrix.m_aBones, flBlend); } if (bDrawFirst) { - auto& tRecord = vRecords.front(); - if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(tRecord.m_vOrigin), 1.f, 24.f, 0.f, 1.f)) - drawModel(tRecord.m_vOrigin, pState, pInfo, tRecord.m_BoneMatrix.m_aBones, flBlend); + auto pRecord = vRecords.front(); + if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(pRecord->m_vOrigin), 1.f, 24.f, 0.f, 1.f)) + drawModel(pRecord->m_vOrigin, pState, pInfo, pRecord->m_BoneMatrix.m_aBones, flBlend); } } } diff --git a/Amalgam/src/Features/Visuals/Materials/Materials.cpp b/Amalgam/src/Features/Visuals/Materials/Materials.cpp index a2c4927a..e71cf4b8 100644 --- a/Amalgam/src/Features/Visuals/Materials/Materials.cpp +++ b/Amalgam/src/Features/Visuals/Materials/Materials.cpp @@ -1,7 +1,7 @@ #include "Materials.h" #include "../Glow/Glow.h" -#include "../../CameraWindow/CameraWindow.h" +#include "../CameraWindow/CameraWindow.h" #include "../../Configs/Configs.h" #include "../../Binds/Binds.h" #include @@ -191,6 +191,10 @@ void CMaterials::LoadMaterials() F::Glow.Initialize(); F::CameraWindow.Initialize(); + S::InitializeStandardMaterials.Call(); + auto pMaterial = *reinterpret_cast(U::Memory.RelToAbs(S::Wireframe())); + pMaterial->SetMaterialVarFlag(MATERIAL_VAR_VERTEXALPHA, true); + m_bLoaded = true; } diff --git a/Amalgam/src/Features/Visuals/PlayerArrows/PlayerArrows.cpp b/Amalgam/src/Features/Visuals/PlayerArrows/PlayerArrows.cpp index 6d855a2d..1e01b8d3 100644 --- a/Amalgam/src/Features/Visuals/PlayerArrows/PlayerArrows.cpp +++ b/Amalgam/src/Features/Visuals/PlayerArrows/PlayerArrows.cpp @@ -9,7 +9,7 @@ void CPlayerArrows::DrawArrowTo(const Vec3& vFromPos, const Vec3& vToPos, Color_ return; Vec2 vCenter = { H::Draw.m_nScreenW / 2.f, H::Draw.m_nScreenH / 2.f }; - Vec3 vScreenPos = {}; + Vec3 vScreenPos; if (SDK::W2S(vToPos, vScreenPos, true)) { float flMin = std::min(vCenter.x, vCenter.y); float flMax = std::max(vCenter.x, vCenter.y); diff --git a/Amalgam/src/Features/Visuals/Visuals.cpp b/Amalgam/src/Features/Visuals/Visuals.cpp index d47241c3..b7af3ece 100644 --- a/Amalgam/src/Features/Visuals/Visuals.cpp +++ b/Amalgam/src/Features/Visuals/Visuals.cpp @@ -1,20 +1,14 @@ #include "Visuals.h" #include "../Aimbot/Aimbot.h" -#include "../Visuals/PlayerConditions/PlayerConditions.h" +#include "../Ticks/Ticks.h" #include "../Backtrack/Backtrack.h" #include "../PacketManip/AntiAim/AntiAim.h" #include "../Simulation/ProjectileSimulation/ProjectileSimulation.h" -#include "../CameraWindow/CameraWindow.h" -#include "../NoSpread/NoSpreadHitscan/NoSpreadHitscan.h" +#include "CameraWindow/CameraWindow.h" #include "../Players/PlayerUtils.h" -#include "Materials/Materials.h" #include "../Spectate/Spectate.h" -#include "../TickHandler/TickHandler.h" -MAKE_SIGNATURE(RenderLine, "engine.dll", "48 89 5C 24 ? 48 89 74 24 ? 44 89 44 24", 0x0); -MAKE_SIGNATURE(RenderBox, "engine.dll", "48 83 EC ? 8B 84 24 ? ? ? ? 4D 8B D8", 0x0); -MAKE_SIGNATURE(RenderWireframeBox, "engine.dll", "48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 55 41 54 41 55 41 56 41 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 49 8B F9", 0x0); 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); @@ -22,104 +16,7 @@ MAKE_SIGNATURE(CWeaponMedigun_UpdateEffects, "client.dll", "40 57 48 81 EC ? ? ? 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); -void CVisuals::DrawFOV(CTFPlayer* pLocal) -{ - if (!Vars::Aimbot::General::FOVCircle.Value || !Vars::Colors::FOVCircle.Value.a || !pLocal->IsAlive() || pLocal->IsAGhost() || pLocal->IsTaunting() || pLocal->InCond(TF_COND_STUNNED) && pLocal->m_iStunFlags() & (TF_STUN_CONTROLS | TF_STUN_LOSER_STATE) || pLocal->InCond(TF_COND_HALLOWEEN_KART)) - return; - - auto pWeapon = H::Entities.GetWeapon(); - if (pWeapon && SDK::AttribHookValue(1, "mult_dmg", pWeapon) == 0) - return; - - if (Vars::Aimbot::General::AimFOV.Value >= 90.f) - return; - - 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 CVisuals::DrawTicks(CTFPlayer* pLocal) -{ - if (!(Vars::Menu::Indicators.Value & Vars::Menu::IndicatorsEnum::Ticks) || !pLocal->IsAlive()) - return; - - const DragBox_t dtPos = Vars::Menu::TicksDisplay.Value; - const auto& fFont = H::Fonts.GetFont(FONT_INDICATORS); - - if (!F::Ticks.m_bSpeedhack) - { - int iChoke = std::max(I::ClientState->chokedcommands - (F::AntiAim.YawOn() ? F::AntiAim.AntiAimTicks() : 0), 0); - int iTicks = std::clamp(F::Ticks.m_iShiftedTicks + iChoke, 0, F::Ticks.m_iMaxShift); - float flRatio = float(iTicks) / F::Ticks.m_iMaxShift; - int iSizeX = H::Draw.Scale(100, Scale_Round), iSizeY = H::Draw.Scale(12, Scale_Round); - int iPosX = dtPos.x - iSizeX / 2, iPosY = dtPos.y + fFont.m_nTall + H::Draw.Scale(4) + 1; - - H::Draw.StringOutlined(fFont, dtPos.x, dtPos.y + 2, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOP, std::format("Ticks {} / {}", iTicks, F::Ticks.m_iMaxShift).c_str()); - if (F::Ticks.m_iWait) - H::Draw.StringOutlined(fFont, dtPos.x, dtPos.y + fFont.m_nTall + H::Draw.Scale(18, Scale_Round) + 1, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOP, "Not Ready"); - - H::Draw.LineRoundRect(iPosX, iPosY, iSizeX, iSizeY, H::Draw.Scale(3, Scale_Round), Vars::Menu::Theme::Accent.Value, 16); - if (flRatio) - { - iSizeX -= H::Draw.Scale(2, Scale_Ceil) * 2, iSizeY -= H::Draw.Scale(2, Scale_Ceil) * 2; - iPosX += H::Draw.Scale(2, Scale_Round), iPosY += H::Draw.Scale(2, Scale_Round); - H::Draw.StartClipping(iPosX, iPosY, iSizeX * flRatio, iSizeY); - H::Draw.FillRoundRect(iPosX, iPosY, iSizeX, iSizeY, H::Draw.Scale(3, Scale_Round), Vars::Menu::Theme::Accent.Value, 16); - H::Draw.EndClipping(); - } - } - else - H::Draw.StringOutlined(fFont, dtPos.x, dtPos.y + 2, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOP, std::format("Speedhack x{}", Vars::Speedhack::Factor.Value).c_str()); -} - -void CVisuals::DrawPing(CTFPlayer* pLocal) -{ - if (!(Vars::Menu::Indicators.Value & Vars::Menu::IndicatorsEnum::Ping) || !pLocal->IsAlive()) - return; - - auto pResource = H::Entities.GetPR(); - auto pNetChan = I::EngineClient->GetNetChannelInfo(); - if (!pResource || !pNetChan) - return; - - static float flFakeLatency = 0.f; - { - static Timer tTimer = {}; - if (tTimer.Run(0.5f)) - flFakeLatency = F::Backtrack.m_flFakeLatency; - } - float flFakeLerp = F::Backtrack.GetFakeInterp() > G::Lerp ? F::Backtrack.GetFakeInterp() : 0.f; - - float flFake = std::min(flFakeLatency + flFakeLerp, F::Backtrack.m_flMaxUnlag) * 1000.f; - float flLatency = std::max(pNetChan->GetLatency(FLOW_INCOMING) + pNetChan->GetLatency(FLOW_OUTGOING) - flFakeLatency, 0.f) * 1000.f; - int iLatencyScoreboard = pResource->m_iPing(pLocal->entindex()); - - int x = Vars::Menu::PingDisplay.Value.x; - int y = Vars::Menu::PingDisplay.Value.y + 8; - const auto& fFont = H::Fonts.GetFont(FONT_INDICATORS); - const int nTall = fFont.m_nTall + H::Draw.Scale(1); - - EAlign align = ALIGN_TOP; - if (x <= 100 + H::Draw.Scale(50, Scale_Round)) - { - x -= H::Draw.Scale(42, Scale_Round); - align = ALIGN_TOPLEFT; - } - else if (x >= H::Draw.m_nScreenW - 100 - H::Draw.Scale(50, Scale_Round)) - { - x += H::Draw.Scale(42, Scale_Round); - align = ALIGN_TOPRIGHT; - } - - if (flFake || Vars::Backtrack::Interp.Value && Vars::Backtrack::Enabled.Value) - H::Draw.StringOutlined(fFont, x, y, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, align, std::format("Ping {:.0f} (+ {:.0f}) ms", flLatency, flFake).c_str()); - else - H::Draw.StringOutlined(fFont, x, y, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, align, std::format("Ping {:.0f} ms", flLatency).c_str()); - H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, align, "Scoreboard %d ms", iLatencyScoreboard); -} - -static std::deque SplashTrace(Vec3 vOrigin, float flRadius, Vec3 vNormal = { 0, 0, 1 }, bool bTrace = true, int iSegments = 100) +static std::vector SplashTrace(Vec3 vOrigin, float flRadius, Vec3 vNormal = { 0, 0, 1 }, bool bTrace = true, int iSegments = 100) { if (!flRadius) return {}; @@ -127,7 +24,7 @@ static std::deque SplashTrace(Vec3 vOrigin, float flRadius, Vec3 vNormal = Vec3 vAngles; Math::VectorAngles(vNormal, vAngles); Vec3 vRight, vUp; Math::AngleVectors(vAngles, nullptr, &vRight, &vUp); - std::deque vPoints = {}; + std::vector vPoints = {}; for (float i = 0.f; i < iSegments; i++) { Vec3 vPoint = vOrigin + (vRight * cos(2 * PI * i / iSegments) + vUp * sin(2 * PI * i / iSegments)) * flRadius; @@ -199,7 +96,7 @@ void CVisuals::ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const tProjInfo.m_vPath.push_back(trace.endpos); - std::deque vPoints = {}; + std::vector vPoints = {}; if ((bQuick ? Vars::Visuals::Simulation::TrajectoryPath.Value : Vars::Visuals::Simulation::ShotPath.Value) && Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::Simulation) { float flRadius = 0.f; @@ -260,10 +157,8 @@ void CVisuals::ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const if (Vars::Visuals::Simulation::TrajectoryPath.Value) { - if (Vars::Colors::TrajectoryPath.Value.a) - DrawPath(tProjInfo.m_vPath, Vars::Colors::TrajectoryPath.Value, Vars::Visuals::Simulation::TrajectoryPath.Value); - if (Vars::Colors::TrajectoryPathClipped.Value.a) - DrawPath(tProjInfo.m_vPath, Vars::Colors::TrajectoryPathClipped.Value, Vars::Visuals::Simulation::TrajectoryPath.Value, true); + H::Draw.RenderPath(tProjInfo.m_vPath, Vars::Colors::TrajectoryPath.Value, false, Vars::Visuals::Simulation::TrajectoryPath.Value); + H::Draw.RenderPath(tProjInfo.m_vPath, Vars::Colors::TrajectoryPathClipped.Value, true, Vars::Visuals::Simulation::TrajectoryPath.Value); if (Vars::Visuals::Simulation::Box.Value && pNormal) { @@ -271,18 +166,14 @@ void CVisuals::ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const const Vec3 vSize = { 1.f, flSize, flSize }; Vec3 vAngles; Math::VectorAngles(*pNormal, vAngles); - if (Vars::Colors::TrajectoryPath.Value.a) - RenderBox(trace.endpos, vSize * -1, vSize, vAngles, Vars::Colors::TrajectoryPath.Value, { 0, 0, 0, 0 }); - if (Vars::Colors::TrajectoryPathClipped.Value.a) - RenderBox(trace.endpos, vSize * -1, vSize, vAngles, Vars::Colors::TrajectoryPathClipped.Value, { 0, 0, 0, 0 }, true); + H::Draw.RenderWireframeBox(trace.endpos, vSize * -1, vSize, vAngles, Vars::Colors::TrajectoryPath.Value); + H::Draw.RenderWireframeBox(trace.endpos, vSize * -1, vSize, vAngles, Vars::Colors::TrajectoryPathClipped.Value, true); } if (!vPoints.empty()) { - if (Vars::Colors::SplashRadius.Value.a) - DrawPath(vPoints, Vars::Colors::SplashRadius.Value, Vars::Visuals::Simulation::StyleEnum::Line); - if (Vars::Colors::SplashRadiusClipped.Value.a) - DrawPath(vPoints, Vars::Colors::SplashRadiusClipped.Value, Vars::Visuals::Simulation::StyleEnum::Line, true); + H::Draw.RenderPath(vPoints, Vars::Colors::SplashRadius.Value, false, Vars::Visuals::Simulation::StyleEnum::Line); + H::Draw.RenderPath(vPoints, Vars::Colors::SplashRadiusClipped.Value, true, Vars::Visuals::Simulation::StyleEnum::Line); } } } @@ -413,10 +304,8 @@ void CVisuals::SplashRadius(CTFPlayer* pLocal) } auto vPoints = SplashTrace(pEntity->GetAbsOrigin(), flRadius, { 0, 0, 1 }, Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::Trace); - if (Vars::Colors::SplashRadius.Value.a) - DrawPath(vPoints, Vars::Colors::SplashRadius.Value, Vars::Visuals::Simulation::StyleEnum::Line); - if (Vars::Colors::SplashRadiusClipped.Value.a) - DrawPath(vPoints, Vars::Colors::SplashRadiusClipped.Value, Vars::Visuals::Simulation::StyleEnum::Line, true); + H::Draw.RenderPath(vPoints, Vars::Colors::SplashRadius.Value, false, Vars::Visuals::Simulation::StyleEnum::Line); + H::Draw.RenderPath(vPoints, Vars::Colors::SplashRadiusClipped.Value, true, Vars::Visuals::Simulation::StyleEnum::Line); } } @@ -446,6 +335,39 @@ void CVisuals::DrawAntiAim(CTFPlayer* pLocal) } } +void CVisuals::DrawSightlines() +{ + for (auto& tSightline : m_vSightLines) + H::Draw.RenderLine(tSightline.m_vStart, tSightline.m_vEnd, tSightline.m_Color, tSightline.m_bZBuffer); +} + +void CVisuals::DrawPickupTimers() +{ + if (!Vars::ESP::Other::PickupTimers.Value) + return; + + for (auto it = m_vPickups.begin(); it != m_vPickups.end();) + { + auto& tPickup = *it; + + float flTime = I::EngineClient->Time() - tPickup.Time; + if (flTime > 10.f) + { + it = m_vPickups.erase(it); + continue; + } + + Vec3 vScreen; if (SDK::W2S(tPickup.Location, vScreen)) + { + auto sText = std::format("{:.1f}s", 10.f - flTime); + auto tColor = tPickup.Type ? Vars::Colors::Health.Value : Vars::Colors::Ammo.Value; + H::Draw.StringOutlined(H::Fonts.GetFont(FONT_ESP), vScreen.x, vScreen.y, tColor, Vars::Menu::Theme::Background.Value, ALIGN_CENTER, sText.c_str()); + } + + it++; + } +} + #define PAIR(x) { x, #x } void CVisuals::DrawDebugInfo(CTFPlayer* pLocal) { @@ -544,7 +466,7 @@ void CVisuals::DrawDebugInfo(CTFPlayer* pLocal) -std::vector CVisuals::GetHitboxes(matrix3x4 aBones[MAXSTUDIOBONES], CBaseAnimating* pEntity, std::vector vHitboxes, int iTarget) +std::vector CVisuals::GetHitboxes(matrix3x4* aBones, CBaseAnimating* pEntity, std::vector vHitboxes, int iTarget) { if (!Vars::Colors::BoneHitboxEdge.Value.a && !Vars::Colors::BoneHitboxFace.Value.a && !Vars::Colors::BoneHitboxEdgeClipped.Value.a && !Vars::Colors::BoneHitboxFaceClipped.Value.a && !Vars::Colors::TargetHitboxEdge.Value.a && !Vars::Colors::TargetHitboxFace.Value.a && !Vars::Colors::TargetHitboxEdgeClipped.Value.a && !Vars::Colors::TargetHitboxFaceClipped.Value.a) @@ -609,75 +531,6 @@ std::vector CVisuals::GetHitboxes(matrix3x4 aBones[MAXSTUDIOBONES], C return vBoxes; } -void CVisuals::DrawPath(std::deque& Line, Color_t Color, int iStyle, bool bZBuffer, float flTime) -{ - if (iStyle == Vars::Visuals::Simulation::StyleEnum::Off) - return; - - for (size_t i = 1; i < Line.size(); i++) - { - if (flTime < 0.f && Line.size() - i > -flTime) - continue; - - switch (iStyle) - { - case Vars::Visuals::Simulation::StyleEnum::Line: - { - RenderLine(Line[i - 1], Line[i], Color, bZBuffer); - break; - } - case Vars::Visuals::Simulation::StyleEnum::Separators: - { - RenderLine(Line[i - 1], Line[i], Color, bZBuffer); - if (!(i % Vars::Visuals::Simulation::SeparatorSpacing.Value)) - { - Vec3& vStart = Line[i - 1]; - Vec3& vEnd = Line[i]; - - Vec3 vDir = (vEnd - vStart).To2D().Normalized(); - vDir = Math::RotatePoint(vDir * Vars::Visuals::Simulation::SeparatorLength.Value, {}, { 0, 90, 0 }); - RenderLine(vEnd, vEnd + vDir, Color, bZBuffer); - } - break; - } - case Vars::Visuals::Simulation::StyleEnum::Spaced: - { - if (!(i % 2)) - RenderLine(Line[i - 1], Line[i], Color, bZBuffer); - break; - } - case Vars::Visuals::Simulation::StyleEnum::Arrows: - { - if (!(i % 3)) - { - Vec3& vStart = Line[i - 1]; - Vec3& vEnd = Line[i]; - - if (!(vStart - vEnd).IsZero()) - { - Vec3 vAngles; Math::VectorAngles(vEnd - vStart, vAngles); - Vec3 vForward, vRight, vUp; Math::AngleVectors(vAngles, &vForward, &vRight, &vUp); - RenderLine(vEnd, vEnd - vForward * 5 + vRight * 5, Color, bZBuffer); - RenderLine(vEnd, vEnd - vForward * 5 - vRight * 5, Color, bZBuffer); - // this also looked interesting but i'm not sure i'd actually add it - //RenderLine(vEnd, vEnd + vForward * 5, Color, bZBuffer); - //RenderLine(vEnd, vEnd + vRight * 5, Color, bZBuffer); - //RenderLine(vEnd, vEnd + vUp * 5, Color, bZBuffer); - } - } - break; - } - case Vars::Visuals::Simulation::StyleEnum::Boxes: - { - RenderLine(Line[i - 1], Line[i], Color, bZBuffer); - if (!(i % Vars::Visuals::Simulation::SeparatorSpacing.Value)) - RenderBox(Line[i], { -1, -1, -1 }, { 1, 1, 1 }, {}, Color, { 0, 0, 0, 0 }, bZBuffer); - break; - } - } - } -} - void CVisuals::DrawLines() { for (auto& tLine : G::LineStorage) @@ -685,7 +538,7 @@ void CVisuals::DrawLines() if (tLine.m_flTime < I::GlobalVars->curtime) continue; - RenderLine(tLine.m_vPair.first, tLine.m_vPair.second, tLine.m_tColor, tLine.m_bZBuffer); + H::Draw.RenderLine(tLine.m_vPair.first, tLine.m_vPair.second, tLine.m_tColor, tLine.m_bZBuffer); } } @@ -696,7 +549,7 @@ void CVisuals::DrawPaths() if (tPath.m_flTime >= 0.f && tPath.m_flTime < I::GlobalVars->curtime) continue; - DrawPath(tPath.m_vPath, tPath.m_tColor, tPath.m_iStyle, tPath.m_bZBuffer, tPath.m_flTime); + H::Draw.RenderPath(tPath.m_vPath, tPath.m_tColor, tPath.m_bZBuffer, tPath.m_iStyle, tPath.m_flTime); } } @@ -707,28 +560,11 @@ void CVisuals::DrawBoxes() if (tBox.m_flTime < I::GlobalVars->curtime) continue; - RenderBox(tBox.m_vPos, tBox.m_vMins, tBox.m_vMaxs, tBox.m_vRotation, tBox.m_tColorEdge, tBox.m_tColorFace, tBox.m_bZBuffer); + H::Draw.RenderBox(tBox.m_vPos, tBox.m_vMins, tBox.m_vMaxs, tBox.m_vRotation, tBox.m_tColorFace, tBox.m_bZBuffer); + H::Draw.RenderWireframeBox(tBox.m_vPos, tBox.m_vMins, tBox.m_vMaxs, tBox.m_vRotation, tBox.m_tColorEdge, tBox.m_bZBuffer); } } -void CVisuals::RestoreLines() -{ - for (auto& tLine : G::LineStorage) - tLine.m_flTime = I::GlobalVars->curtime + 60.f; -} - -void CVisuals::RestorePaths() -{ - for (auto& tPath : G::PathStorage) - tPath.m_flTime = I::GlobalVars->curtime + 60.f; -} - -void CVisuals::RestoreBoxes() -{ - for (auto& tBox : G::BoxStorage) - tBox.m_flTime = I::GlobalVars->curtime + 60.f; -} - void CVisuals::DrawServerHitboxes(CTFPlayer* pLocal) { if (!Vars::Debug::DrawServerHitboxes.Value) @@ -751,21 +587,6 @@ void CVisuals::DrawServerHitboxes(CTFPlayer* pLocal) } } -void CVisuals::RenderLine(const Vec3& vStart, const Vec3& vEnd, Color_t cLine, bool bZBuffer) -{ - if (cLine.a) - S::RenderLine.Call(std::ref(vStart), std::ref(vEnd), cLine, bZBuffer); -} - -void CVisuals::RenderBox(const Vec3& vPos, const Vec3& vMins, const Vec3& vMaxs, const Vec3& vOrientation, Color_t cEdge, Color_t cFace, bool bZBuffer) -{ - if (cFace.a) - S::RenderBox.Call(std::ref(vPos), std::ref(vOrientation), std::ref(vMins), std::ref(vMaxs), cFace, bZBuffer, false); - - if (cEdge.a) - S::RenderWireframeBox.Call(std::ref(vPos), std::ref(vOrientation), std::ref(vMins), std::ref(vMaxs), cEdge, bZBuffer); -} - void CVisuals::FOV(CTFPlayer* pLocal, CViewSetup* pView) @@ -843,79 +664,6 @@ void CVisuals::ThirdPerson(CTFPlayer* pLocal, CViewSetup* pView) } } -void CVisuals::DrawSightlines() -{ - for (auto& tSightline : m_vSightLines) - RenderLine(tSightline.m_vStart, tSightline.m_vEnd, tSightline.m_Color, tSightline.m_bZBuffer); -} - -void CVisuals::Store(CTFPlayer* pLocal) -{ - if (!pLocal) - return; - - m_vSightLines.clear(); - if (Vars::ESP::Other::SniperSightlines.Value & ~Vars::ESP::Other::SniperSightlinesEnum::DrawThroughWalls) - { - std::unordered_map mDots = {}; - for (auto pEntity : H::Entities.GetGroup(EGroupType::MISC_DOTS)) - { - if (auto pOwner = pEntity->m_hOwnerEntity().Get()) - mDots[pOwner] = pEntity->m_vecOrigin(); - } - - bool bDrawThroughWalls = Vars::ESP::Other::SniperSightlines.Value & Vars::ESP::Other::SniperSightlinesEnum::DrawThroughWalls; - for (auto pEntity : H::Entities.GetGroup(EGroupType::PLAYERS_ALL)) - { - auto pPlayer = pEntity->As(); - if (pPlayer == pLocal || !(pPlayer->m_iTeamNum() != pLocal->m_iTeamNum() ? Vars::ESP::Other::SniperSightlines.Value & Vars::ESP::Other::SniperSightlinesEnum::Enemy : Vars::ESP::Other::SniperSightlines.Value & Vars::ESP::Other::SniperSightlinesEnum::Team)) - continue; - - auto pWeapon = pPlayer->m_hActiveWeapon().Get()->As(); - if (pPlayer->IsDormant() || !pPlayer->IsAlive() || pPlayer->IsAGhost() || !pPlayer->InCond(TF_COND_AIMING) || - !pWeapon || pWeapon->GetWeaponID() == TF_WEAPON_COMPOUND_BOW || pWeapon->GetWeaponID() == TF_WEAPON_MINIGUN) - continue; - - Vec3 vShootPos = pPlayer->m_vecOrigin() + pPlayer->GetViewOffset(); - Vec3 vForward; Math::AngleVectors(pPlayer->GetEyeAngles(), &vForward); - Vec3 vShootEnd = mDots.contains(pPlayer) ? mDots[pPlayer] : vShootPos + (vForward * 8192.f); - - CGameTrace trace = {}; - CTraceFilterHitscan filter = {}; filter.pSkip = pPlayer; - SDK::Trace(vShootPos, vShootEnd, MASK_SHOT, &filter, &trace); - - m_vSightLines.emplace_back(vShootPos, trace.endpos, H::Color.GetEntityDrawColor(pLocal, pPlayer, Vars::Colors::Relative.Value), !bDrawThroughWalls); - } - } -} - -void CVisuals::DrawPickupTimers() -{ - if (!Vars::ESP::Other::PickupTimers.Value) - return; - - for (auto it = m_vPickups.begin(); it != m_vPickups.end();) - { - auto& tPickup = *it; - - float flTime = I::EngineClient->Time() - tPickup.Time; - if (flTime > 10.f) - { - it = m_vPickups.erase(it); - continue; - } - - Vec3 vScreen; if (SDK::W2S(tPickup.Location, vScreen)) - { - auto sText = std::format("{:.1f}s", 10.f - flTime); - auto tColor = tPickup.Type ? Vars::Colors::Health.Value : Vars::Colors::Ammo.Value; - H::Draw.StringOutlined(H::Fonts.GetFont(FONT_ESP), vScreen.x, vScreen.y, tColor, Vars::Menu::Theme::Background.Value, ALIGN_CENTER, sText.c_str()); - } - - it++; - } -} - void CVisuals::Event(IGameEvent* pEvent, uint32_t uHash) { switch (uHash) @@ -984,6 +732,46 @@ void CVisuals::Event(IGameEvent* pEvent, uint32_t uHash) } } +void CVisuals::Store(CTFPlayer* pLocal) +{ + if (!pLocal) + return; + + m_vSightLines.clear(); + if (Vars::ESP::Other::SniperSightlines.Value & ~Vars::ESP::Other::SniperSightlinesEnum::DrawThroughWalls) + { + std::unordered_map mDots = {}; + for (auto pEntity : H::Entities.GetGroup(EGroupType::MISC_DOTS)) + { + if (auto pOwner = pEntity->m_hOwnerEntity().Get()) + mDots[pOwner] = pEntity->m_vecOrigin(); + } + + bool bDrawThroughWalls = Vars::ESP::Other::SniperSightlines.Value & Vars::ESP::Other::SniperSightlinesEnum::DrawThroughWalls; + for (auto pEntity : H::Entities.GetGroup(EGroupType::PLAYERS_ALL)) + { + auto pPlayer = pEntity->As(); + if (pPlayer == pLocal || !(pPlayer->m_iTeamNum() != pLocal->m_iTeamNum() ? Vars::ESP::Other::SniperSightlines.Value & Vars::ESP::Other::SniperSightlinesEnum::Enemy : Vars::ESP::Other::SniperSightlines.Value & Vars::ESP::Other::SniperSightlinesEnum::Team)) + continue; + + auto pWeapon = pPlayer->m_hActiveWeapon().Get()->As(); + if (pPlayer->IsDormant() || !pPlayer->IsAlive() || pPlayer->IsAGhost() || !pPlayer->InCond(TF_COND_AIMING) || + !pWeapon || pWeapon->GetWeaponID() == TF_WEAPON_COMPOUND_BOW || pWeapon->GetWeaponID() == TF_WEAPON_MINIGUN) + continue; + + Vec3 vShootPos = pPlayer->m_vecOrigin() + pPlayer->GetViewOffset(); + Vec3 vForward; Math::AngleVectors(pPlayer->GetEyeAngles(), &vForward); + Vec3 vShootEnd = mDots.contains(pPlayer) ? mDots[pPlayer] : vShootPos + (vForward * 8192.f); + + CGameTrace trace = {}; + CTraceFilterHitscan filter = {}; filter.pSkip = pPlayer; + SDK::Trace(vShootPos, vShootEnd, MASK_SHOT, &filter, &trace); + + m_vSightLines.emplace_back(vShootPos, trace.endpos, H::Color.GetEntityDrawColor(pLocal, pPlayer, Vars::Colors::Relative.Value), !bDrawThroughWalls); + } + } +} + void CVisuals::OverrideWorldTextures() diff --git a/Amalgam/src/Features/Visuals/Visuals.h b/Amalgam/src/Features/Visuals/Visuals.h index 55d3e195..66104af3 100644 --- a/Amalgam/src/Features/Visuals/Visuals.h +++ b/Amalgam/src/Features/Visuals/Visuals.h @@ -26,32 +26,24 @@ private: std::vector m_vPickups; public: - void DrawFOV(CTFPlayer* pLocal); - void DrawTicks(CTFPlayer* pLocal); - void DrawPing(CTFPlayer* pLocal); + void Event(IGameEvent* pEvent, uint32_t uHash); + void Store(CTFPlayer* pLocal); + void ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const bool bQuick = true); void SplashRadius(CTFPlayer* pLocal); void DrawAntiAim(CTFPlayer* pLocal); + void DrawSightlines(); + void DrawPickupTimers(); void DrawDebugInfo(CTFPlayer* pLocal); - std::vector GetHitboxes(matrix3x4 aBones[MAXSTUDIOBONES], CBaseAnimating* pEntity, std::vector vHitboxes = {}, int iTarget = -1); - void DrawPath(std::deque& Line, Color_t Color, int iStyle, bool bZBuffer = false, float flTime = 0.f); + std::vector GetHitboxes(matrix3x4* aBones, CBaseAnimating* pEntity, std::vector vHitboxes = {}, int iTarget = -1); void DrawLines(); void DrawPaths(); void DrawBoxes(); - void RestoreLines(); - void RestorePaths(); - void RestoreBoxes(); void DrawServerHitboxes(CTFPlayer* pLocal); - void RenderLine(const Vec3& vStart, const Vec3& vEnd, Color_t cLine, bool bZBuffer = false); - void RenderBox(const Vec3& vPos, const Vec3& vMins, const Vec3& vMaxs, const Vec3& vOrientation, Color_t cEdge, Color_t cFace, bool bZBuffer = false); void FOV(CTFPlayer* pLocal, CViewSetup* pView); void ThirdPerson(CTFPlayer* pLocal, CViewSetup* pView); - void DrawSightlines(); - void Store(CTFPlayer* pLocal); - void DrawPickupTimers(); - void Event(IGameEvent* pEvent, uint32_t uHash); void OverrideWorldTextures(); void Modulate(); diff --git a/Amalgam/src/Hooks/CBaseAnimating_Interpolate.cpp b/Amalgam/src/Hooks/CBaseAnimating_Interpolate.cpp index 7557b030..ad9e3d67 100644 --- a/Amalgam/src/Hooks/CBaseAnimating_Interpolate.cpp +++ b/Amalgam/src/Hooks/CBaseAnimating_Interpolate.cpp @@ -1,6 +1,6 @@ #include "../SDK/SDK.h" -#include "../Features/TickHandler/TickHandler.h" +#include "../Features/Ticks/Ticks.h" #include "../Features/Resolver/Resolver.h" MAKE_SIGNATURE(CBaseAnimating_Interpolate, "client.dll", "48 8B C4 48 89 70 ? F3 0F 11 48", 0x0); @@ -16,12 +16,10 @@ MAKE_HOOK(CBaseAnimating_Interpolate, S::CBaseAnimating_Interpolate(), bool, if (rcx == H::Entities.GetLocal() ? F::Ticks.m_bRecharge : Vars::Visuals::Removals::Interpolation.Value) return true; - /* // fixes weird stupid flickering with the resolver, but completely disables interpolation - if anyone knows of a better solution let me know. doesn't seem to cause nonvisual issues so i'm leaving this commented out for now - if (F::Resolver.GetAngles(reinterpret_cast(rcx))) - return true; - */ + // if anyone knows of a better solution let me know. doesn't seem to cause nonvisual issues so i'm leaving this commented out for now + //if (F::Resolver.GetAngles(reinterpret_cast(rcx))) + // return true; return CALL_ORIGINAL(rcx, currentTime); } \ No newline at end of file diff --git a/Amalgam/src/Hooks/CBaseEntity_BaseInterpolatePart1.cpp b/Amalgam/src/Hooks/CBaseEntity_BaseInterpolatePart1.cpp index 84f716c6..bbf259f9 100644 --- a/Amalgam/src/Hooks/CBaseEntity_BaseInterpolatePart1.cpp +++ b/Amalgam/src/Hooks/CBaseEntity_BaseInterpolatePart1.cpp @@ -1,6 +1,6 @@ #include "../SDK/SDK.h" -#include "../Features/TickHandler/TickHandler.h" +#include "../Features/Ticks/Ticks.h" MAKE_SIGNATURE(CBaseEntity_BaseInterpolatePart1, "client.dll", "48 89 5C 24 ? 56 57 41 55 41 56 41 57 48 83 EC ? 4C 8B BC 24", 0x0); diff --git a/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp b/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp index 17377453..0290e609 100644 --- a/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp +++ b/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp @@ -1,4 +1,5 @@ #include "../SDK/SDK.h" + #include "../Features/Aimbot/Aimbot.h" #include "../Features/Backtrack/Backtrack.h" #include "../Features/CritHack/CritHack.h" @@ -8,7 +9,7 @@ #include "../Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.h" #include "../Features/PacketManip/PacketManip.h" #include "../Features/Resolver/Resolver.h" -#include "../Features/TickHandler/TickHandler.h" +#include "../Features/Ticks/Ticks.h" #include "../Features/Visuals/Visuals.h" #include "../Features/Visuals/FakeAngle/FakeAngle.h" #include "../Features/Spectate/Spectate.h" @@ -169,7 +170,6 @@ MAKE_HOOK(CClientModeShared_CreateMove, U::Memory.GetVFunc(I::ClientModeShared, // run features F::Spectate.CreateMove(pLocal, pCmd); F::Misc.RunPre(pLocal, pCmd); - F::Backtrack.Run(pCmd); F::EnginePrediction.Start(pLocal, pCmd); F::Aimbot.Run(pLocal, pWeapon, pCmd); diff --git a/Amalgam/src/Hooks/CClientModeShared_DoPostScreenSpaceEffects.cpp b/Amalgam/src/Hooks/CClientModeShared_DoPostScreenSpaceEffects.cpp index 4745e37c..be1a9276 100644 --- a/Amalgam/src/Hooks/CClientModeShared_DoPostScreenSpaceEffects.cpp +++ b/Amalgam/src/Hooks/CClientModeShared_DoPostScreenSpaceEffects.cpp @@ -2,7 +2,7 @@ #include "../Features/Visuals/Chams/Chams.h" #include "../Features/Visuals/Glow/Glow.h" -#include "../Features/CameraWindow/CameraWindow.h" +#include "../Features/Visuals/CameraWindow/CameraWindow.h" #include "../Features/Visuals/Visuals.h" #include "../Features/Visuals/Materials/Materials.h" diff --git a/Amalgam/src/Hooks/CClientState_ProcessFixAngle.cpp b/Amalgam/src/Hooks/CClientState_ProcessFixAngle.cpp index 82bae4a0..f7a7b2ae 100644 --- a/Amalgam/src/Hooks/CClientState_ProcessFixAngle.cpp +++ b/Amalgam/src/Hooks/CClientState_ProcessFixAngle.cpp @@ -1,4 +1,5 @@ #include "../SDK/SDK.h" + #include "../Features/Spectate/Spectate.h" MAKE_SIGNATURE(CClientState_ProcessFixAngle, "engine.dll", "40 53 48 83 EC ? F3 0F 10 42", 0x0); diff --git a/Amalgam/src/Hooks/CL_Move.cpp b/Amalgam/src/Hooks/CL_Move.cpp index 2c080cfe..0a9a0f96 100644 --- a/Amalgam/src/Hooks/CL_Move.cpp +++ b/Amalgam/src/Hooks/CL_Move.cpp @@ -1,10 +1,11 @@ #include "../SDK/SDK.h" -#include "../Features/TickHandler/TickHandler.h" +#include "../Features/Ticks/Ticks.h" #include "../Features/Binds/Binds.h" #include "../Features/Players/PlayerCore.h" #include "../Features/Misc/AutoQueue/AutoQueue.h" #include "../Features/Backtrack/Backtrack.h" +#include "../Features/Misc/Misc.h" MAKE_SIGNATURE(CL_Move, "engine.dll", "40 55 53 48 8D AC 24 ? ? ? ? B8 ? ? ? ? E8 ? ? ? ? 48 2B E0 83 3D", 0x0); @@ -67,6 +68,8 @@ MAKE_HOOK(CL_Move, S::CL_Move(), void, F::Binds.Run(pLocal, pWeapon); F::PlayerCore.Run(); + F::Backtrack.SendLerp(); + F::Misc.PingReducer(); F::AutoQueue.Run(); F::Ticks.Run(accumulated_extra_samples, bFinalTick, pLocal); diff --git a/Amalgam/src/Hooks/CNetChannel_SendNetMsg.cpp b/Amalgam/src/Hooks/CNetChannel_SendNetMsg.cpp index d52361cd..8d58f5c4 100644 --- a/Amalgam/src/Hooks/CNetChannel_SendNetMsg.cpp +++ b/Amalgam/src/Hooks/CNetChannel_SendNetMsg.cpp @@ -1,6 +1,6 @@ #include "../SDK/SDK.h" -#include "../Features/TickHandler/TickHandler.h" +#include "../Features/Ticks/Ticks.h" #include "../Features/Backtrack/Backtrack.h" #include "../Features/Misc/Misc.h" @@ -128,7 +128,7 @@ MAKE_HOOK(CNetChannel_SendNetMsg, S::CNetChannel_SendNetMsg(), bool, int nChokedCommands = I::ClientState->chokedcommands; int nNextCommandNr = nLastOutGoingCommand + nChokedCommands + 1; - byte data[4000] = {}; + byte data[4000]; pMsg->m_DataOut.StartWriting(data, sizeof(data)); int nCommands = 1 + nChokedCommands; pMsg->m_nNewCommands = std::clamp(nCommands, 0, MAX_NEW_COMMANDS); diff --git a/Amalgam/src/Hooks/COPRenderSprites_Render.cpp b/Amalgam/src/Hooks/COPRenderSprites_Render.cpp index fdbc7616..e74b8bfd 100644 --- a/Amalgam/src/Hooks/COPRenderSprites_Render.cpp +++ b/Amalgam/src/Hooks/COPRenderSprites_Render.cpp @@ -1,4 +1,5 @@ #include "../SDK/SDK.h" + #include "../SDK/Definitions/Misc/UtlObjectReference.h" MAKE_SIGNATURE(COPRenderSprites_Render, "client.dll", "48 89 54 24 ? 55 53 57 41 55 41 56", 0x0); diff --git a/Amalgam/src/Hooks/CPrediction_RunSimulation.cpp b/Amalgam/src/Hooks/CPrediction_RunSimulation.cpp index 49671865..de2250bc 100644 --- a/Amalgam/src/Hooks/CPrediction_RunSimulation.cpp +++ b/Amalgam/src/Hooks/CPrediction_RunSimulation.cpp @@ -1,7 +1,7 @@ #include "../SDK/SDK.h" #include "../Features/EnginePrediction/EnginePrediction.h" -#include "../Features/TickHandler/TickHandler.h" +#include "../Features/Ticks/Ticks.h" MAKE_SIGNATURE(CPrediction_RunSimulation, "client.dll", "48 83 EC 38 4C 8B 44", 0x0); diff --git a/Amalgam/src/Hooks/CSniperDot_GetRenderingPositions.cpp b/Amalgam/src/Hooks/CSniperDot_GetRenderingPositions.cpp index 4b0d2d9e..9ac1fbfe 100644 --- a/Amalgam/src/Hooks/CSniperDot_GetRenderingPositions.cpp +++ b/Amalgam/src/Hooks/CSniperDot_GetRenderingPositions.cpp @@ -6,8 +6,8 @@ MAKE_SIGNATURE(CSniperDot_GetRenderingPositions_EyePosition_Call, "client.dll", MAKE_SIGNATURE(CTFPlayer_EyeAngles, "client.dll", "40 53 48 83 EC ? 48 8B D9 E8 ? ? ? ? 84 C0 74 ? 83 3D", 0x0); MAKE_SIGNATURE(CSniperDot_GetRenderingPositions_EyeAngles_Call, "client.dll", "48 8D 54 24 ? 48 8D 4C 24 ? F2 0F 10 00 F2 0F 11 44 24 ? 8B 40 ? 89 44 24 ? E8 ? ? ? ? 49 8B 07", 0x0); -static Vec3 vEyePosition = {}; -static Vec3 vEyeAngles = {}; +static Vec3 vEyePosition; +static Vec3 vEyeAngles; MAKE_HOOK(CSniperDot_GetRenderingPositions, S::CSniperDot_GetRenderingPositions(), bool, void* rcx, CTFPlayer* pPlayer, Vec3& vecAttachment, Vec3& vecEndPos, float& flSize) diff --git a/Amalgam/src/Hooks/CTFWeaponBase_CalcIsAttackCritical.cpp b/Amalgam/src/Hooks/CTFWeaponBase_CalcIsAttackCritical.cpp index 49a30aa2..998a9ae1 100644 --- a/Amalgam/src/Hooks/CTFWeaponBase_CalcIsAttackCritical.cpp +++ b/Amalgam/src/Hooks/CTFWeaponBase_CalcIsAttackCritical.cpp @@ -1,4 +1,5 @@ #include "../SDK/SDK.h" + #include "../Features/CritHack/CritHack.h" MAKE_SIGNATURE(CTFWeaponBase_CalcIsAttackCritical, "client.dll", "48 89 74 24 ? 57 48 83 EC ? 48 8B F9 E8 ? ? ? ? 48 8B C8 C7 44 24 ? ? ? ? ? 4C 8D 0D ? ? ? ? 33 D2 4C 8D 05 ? ? ? ? E8 ? ? ? ? 48 8B F0 48 85 C0 0F 84 ? ? ? ? 48 8B 10", 0x0); diff --git a/Amalgam/src/Hooks/CViewRender_LevelInit.cpp b/Amalgam/src/Hooks/CViewRender_LevelInit.cpp index 3547b15e..b88cddaa 100644 --- a/Amalgam/src/Hooks/CViewRender_LevelInit.cpp +++ b/Amalgam/src/Hooks/CViewRender_LevelInit.cpp @@ -3,10 +3,11 @@ #include "../Features/Visuals/Materials/Materials.h" #include "../Features/Visuals/Visuals.h" #include "../Features/Backtrack/Backtrack.h" -#include "../Features/CheaterDetection/CheaterDetection.h" +#include "../Features/Ticks/Ticks.h" #include "../Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.h" +#include "../Features/CheaterDetection/CheaterDetection.h" #include "../Features/Resolver/Resolver.h" -#include "../Features/TickHandler/TickHandler.h" +#include "../Features/Spectate/Spectate.h" MAKE_HOOK(CViewRender_LevelInit, U::Memory.GetVFunc(I::ViewRender, 1), void, void* rcx) @@ -20,10 +21,11 @@ MAKE_HOOK(CViewRender_LevelInit, U::Memory.GetVFunc(I::ViewRender, 1), void, F::Visuals.OverrideWorldTextures(); F::Backtrack.Reset(); - F::Resolver.Reset(); F::Ticks.Reset(); F::NoSpreadHitscan.Reset(); F::CheaterDetection.Reset(); + F::Resolver.Reset(); + F::Spectate.m_iIntendedTarget = -1; CALL_ORIGINAL(rcx); } \ No newline at end of file diff --git a/Amalgam/src/Hooks/CViewRender_LevelShutdown.cpp b/Amalgam/src/Hooks/CViewRender_LevelShutdown.cpp new file mode 100644 index 00000000..8c033ea5 --- /dev/null +++ b/Amalgam/src/Hooks/CViewRender_LevelShutdown.cpp @@ -0,0 +1,11 @@ +#include "../SDK/SDK.h" + +#include "../Features/Spectate/Spectate.h" + +MAKE_HOOK(CViewRender_LevelShutdown, U::Memory.GetVFunc(I::ViewRender, 2), void, + void* rcx) +{ + F::Spectate.m_iIntendedTarget = -1; + + CALL_ORIGINAL(rcx); +} \ No newline at end of file diff --git a/Amalgam/src/Hooks/CViewRender_RenderView.cpp b/Amalgam/src/Hooks/CViewRender_RenderView.cpp index 17109e9a..756e56ff 100644 --- a/Amalgam/src/Hooks/CViewRender_RenderView.cpp +++ b/Amalgam/src/Hooks/CViewRender_RenderView.cpp @@ -1,6 +1,6 @@ #include "../SDK/SDK.h" -#include "../Features/CameraWindow/CameraWindow.h" +#include "../Features/Visuals/CameraWindow/CameraWindow.h" MAKE_HOOK(CViewRender_RenderView, U::Memory.GetVFunc(I::ViewRender, 6), void, void* rcx, const CViewSetup& view, ClearFlags_t nClearFlags, RenderViewInfo_t whatToDraw) diff --git a/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp b/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp index d36d3145..d26b3bb1 100644 --- a/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp +++ b/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp @@ -1,4 +1,5 @@ #include "../SDK/SDK.h" + #include #include diff --git a/Amalgam/src/Hooks/Direct3DDevice9.cpp b/Amalgam/src/Hooks/Direct3DDevice9.cpp index cdf2c063..e2e88c65 100644 --- a/Amalgam/src/Hooks/Direct3DDevice9.cpp +++ b/Amalgam/src/Hooks/Direct3DDevice9.cpp @@ -29,13 +29,14 @@ LONG __stdcall WndProc::Func(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (F::Menu.m_bIsOpen) { ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam); - if (ImGui::GetIO().WantTextInput || F::Menu.m_bInKeybind) + + if ((ImGui::GetIO().WantTextInput || F::Menu.m_bInKeybind) && WM_KEYFIRST <= uMsg && uMsg <= WM_KEYLAST) { I::InputSystem->ResetInputState(); return 1; } - if (uMsg >= WM_MOUSEFIRST && WM_MOUSELAST >= uMsg) + if (WM_MOUSEFIRST <= uMsg && uMsg <= WM_MOUSELAST) return 1; } diff --git a/Amalgam/src/Hooks/IEngineVGui_Paint.cpp b/Amalgam/src/Hooks/IEngineVGui_Paint.cpp index 4a45bf19..f00d81ff 100644 --- a/Amalgam/src/Hooks/IEngineVGui_Paint.cpp +++ b/Amalgam/src/Hooks/IEngineVGui_Paint.cpp @@ -1,14 +1,18 @@ #include "../SDK/SDK.h" -#include "../Features/CameraWindow/CameraWindow.h" -#include "../Features/CritHack/CritHack.h" -#include "../Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.h" -#include "../Features/Visuals/ESP/ESP.h" -#include "../Features/Visuals/Notifications/Notifications.h" -#include "../Features/Visuals/PlayerArrows/PlayerArrows.h" -#include "../Features/Visuals/PlayerConditions/PlayerConditions.h" -#include "../Features/Visuals/Radar/Radar.h" -#include "../Features/Visuals/SpectatorList/SpectatorList.h" + #include "../Features/Visuals/Visuals.h" +#include "../Features/Ticks/Ticks.h" +#include "../Features/CritHack/CritHack.h" +#include "../Features/Visuals/SpectatorList/SpectatorList.h" +#include "../Features/Backtrack/Backtrack.h" +#include "../Features/Visuals/PlayerConditions/PlayerConditions.h" +#include "../Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.h" +#include "../Features/Visuals/Radar/Radar.h" +#include "../Features/Aimbot/Aimbot.h" +#include "../Features/Visuals/PlayerArrows/PlayerArrows.h" +#include "../Features/Visuals/ESP/ESP.h" +#include "../Features/Visuals/CameraWindow/CameraWindow.h" +#include "../Features/Visuals/Notifications/Notifications.h" MAKE_HOOK(IEngineVGui_Paint, U::Memory.GetVFunc(I::EngineVGui, 14), void, void* rcx, int iMode) @@ -21,9 +25,9 @@ MAKE_HOOK(IEngineVGui_Paint, U::Memory.GetVFunc(I::EngineVGui, 14), void, if (G::Unload) return CALL_ORIGINAL(rcx, iMode); - H::Draw.UpdateScreenSize(); if (iMode & PAINT_INGAMEPANELS && (!Vars::Visuals::UI::CleanScreenshots.Value || !I::EngineClient->IsTakingScreenshot())) { + H::Draw.UpdateScreenSize(); H::Draw.UpdateW2SMatrix(); H::Draw.Start(true); if (auto pLocal = H::Entities.GetLocal()) @@ -35,15 +39,15 @@ MAKE_HOOK(IEngineVGui_Paint, U::Memory.GetVFunc(I::EngineVGui, 14), void, F::Visuals.DrawPickupTimers(); F::ESP.Draw(); F::PlayerArrows.Run(pLocal); - F::Visuals.DrawFOV(pLocal); + F::Aimbot.Draw(pLocal); F::Radar.Run(pLocal); F::NoSpreadHitscan.Draw(pLocal); F::PlayerConditions.Draw(pLocal); - F::Visuals.DrawPing(pLocal); + F::Backtrack.Draw(pLocal); F::SpectatorList.Draw(pLocal); F::CritHack.Draw(pLocal); - F::Visuals.DrawTicks(pLocal); + F::Ticks.Draw(pLocal); F::Visuals.DrawDebugInfo(pLocal); } H::Draw.End(); @@ -53,6 +57,7 @@ MAKE_HOOK(IEngineVGui_Paint, U::Memory.GetVFunc(I::EngineVGui, 14), void, if (iMode & PAINT_UIPANELS && (!Vars::Visuals::UI::CleanScreenshots.Value || !I::EngineClient->IsTakingScreenshot())) { + H::Draw.UpdateScreenSize(); H::Draw.Start(); { F::Notifications.Draw(); diff --git a/Amalgam/src/Hooks/IMatSystemSurface_OnScreenSizeChanged.cpp b/Amalgam/src/Hooks/IMatSystemSurface_OnScreenSizeChanged.cpp index f5335d66..9df2ae19 100644 --- a/Amalgam/src/Hooks/IMatSystemSurface_OnScreenSizeChanged.cpp +++ b/Amalgam/src/Hooks/IMatSystemSurface_OnScreenSizeChanged.cpp @@ -1,4 +1,5 @@ #include "../SDK/SDK.h" + #include "../Features/Visuals/Materials/Materials.h" MAKE_HOOK(IMatSystemSurface_OnScreenSizeChanged, U::Memory.GetVFunc(I::MatSystemSurface, 111), void, @@ -9,9 +10,6 @@ MAKE_HOOK(IMatSystemSurface_OnScreenSizeChanged, U::Memory.GetVFunc(I::MatSystem return CALL_ORIGINAL(rcx, nOldWidth, nOldHeight); #endif - int nNewWidth, nNewHeight; I::MatSystemSurface->GetScreenSize(nNewWidth, nNewHeight); - SDK::Output("Size", std::format("{}, {} -> {}, {}", nOldWidth, nOldHeight, nNewWidth, nNewHeight).c_str(), {}, true, true); - CALL_ORIGINAL(rcx, nOldWidth, nOldHeight); H::Fonts.Reload(Vars::Menu::Scale[DEFAULT_BIND]); diff --git a/Amalgam/src/Hooks/IVModelRender_DrawModelExecute.cpp b/Amalgam/src/Hooks/IVModelRender_DrawModelExecute.cpp index 0bfa58cf..2a877257 100644 --- a/Amalgam/src/Hooks/IVModelRender_DrawModelExecute.cpp +++ b/Amalgam/src/Hooks/IVModelRender_DrawModelExecute.cpp @@ -3,7 +3,7 @@ #include "../Features/Visuals/Chams/Chams.h" #include "../Features/Visuals/Glow/Glow.h" #include "../Features/Visuals/Materials/Materials.h" -#include "../Features/CameraWindow/CameraWindow.h" +#include "../Features/Visuals/CameraWindow/CameraWindow.h" MAKE_SIGNATURE(CBaseAnimating_DrawModel, "client.dll", "4C 8B DC 49 89 5B ? 89 54 24 ? 55 56 57 41 54 41 55 41 56 41 57 48 83 EC ? 48 8B 05 ? ? ? ? 48 8D 3D", 0x0); MAKE_SIGNATURE(CEconEntity_DrawOverriddenViewmodel_DrawModel_Call, "client.dll", "41 8B D5 FF 50 ? 8B 97", 0x6); diff --git a/Amalgam/src/SDK/Definitions/Interfaces/IVEngineClient.h b/Amalgam/src/SDK/Definitions/Interfaces/IVEngineClient.h index dd6b86ab..b12c9062 100644 --- a/Amalgam/src/SDK/Definitions/Interfaces/IVEngineClient.h +++ b/Amalgam/src/SDK/Definitions/Interfaces/IVEngineClient.h @@ -82,7 +82,7 @@ public: virtual float GetSentenceLength(CAudioSource* pAudioSource) = 0; virtual bool IsStreaming(CAudioSource* pAudioSource) const = 0; virtual void GetViewAngles(QAngle& va) = 0; - inline Vec3 GetViewAngles() { QAngle out = {}; GetViewAngles(out); return out; } + inline Vec3 GetViewAngles() { QAngle vOut; GetViewAngles(vOut); return vOut; } virtual void SetViewAngles(QAngle& va) = 0; virtual int GetMaxClients(void) = 0; virtual const char* Key_LookupBinding(const char* pBinding) = 0; diff --git a/Amalgam/src/SDK/Definitions/Main/CBaseAnimating.h b/Amalgam/src/SDK/Definitions/Main/CBaseAnimating.h index cba66ed8..45280679 100644 --- a/Amalgam/src/SDK/Definitions/Main/CBaseAnimating.h +++ b/Amalgam/src/SDK/Definitions/Main/CBaseAnimating.h @@ -61,7 +61,7 @@ public: return pSet->numhitboxes; } - inline Vec3 GetHitboxOrigin(int nHitbox, Vec3 vOffset = {}) + inline Vec3 GetHitboxOrigin(matrix3x4* aBones, int nHitbox, Vec3 vOffset = {}) { auto pModel = GetModel(); if (!pModel) return {}; @@ -72,16 +72,11 @@ public: auto pBox = pSet->pHitbox(nHitbox); if (!pBox) return {}; - matrix3x4 aBones[MAXSTUDIOBONES] = {}; - if (!SetupBones(aBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, I::GlobalVars->curtime)) - return {}; - - Vec3 vOut = {}; - Math::VectorTransform(vOffset, aBones[pBox->bone], vOut); + Vec3 vOut; Math::VectorTransform(vOffset, aBones[pBox->bone], vOut); return vOut; } - inline Vec3 GetHitboxCenter(int nHitbox, Vec3 vOffset = {}) + inline Vec3 GetHitboxCenter(matrix3x4* aBones, int nHitbox, Vec3 vOffset = {}) { auto pModel = GetModel(); if (!pModel) return {}; @@ -92,16 +87,11 @@ public: auto pBox = pSet->pHitbox(nHitbox); if (!pBox) return {}; - matrix3x4 aBones[MAXSTUDIOBONES] = {}; - if (!SetupBones(aBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, I::GlobalVars->curtime)) - return {}; - - Vec3 vOut = {}; - Math::VectorTransform((pBox->bbmin + pBox->bbmax) / 2 + vOffset, aBones[pBox->bone], vOut); + Vec3 vOut; Math::VectorTransform((pBox->bbmin + pBox->bbmax) / 2 + vOffset, aBones[pBox->bone], vOut); return vOut; } - inline void GetHitboxInfo(int nHitbox, Vec3* pCenter = nullptr, Vec3* pMins = nullptr, Vec3* pMaxs = nullptr, matrix3x4* pMatrix = nullptr, Vec3 vOffset = {}) + inline void GetHitboxInfo(matrix3x4* aBones, int nHitbox, Vec3* pCenter = nullptr, Vec3* pMins = nullptr, Vec3* pMaxs = nullptr, matrix3x4* pMatrix = nullptr, Vec3 vOffset = {}) { auto pModel = GetModel(); if (!pModel) return; @@ -112,10 +102,6 @@ public: auto pBox = pSet->pHitbox(nHitbox); if (!pBox) return; - matrix3x4 aBones[MAXSTUDIOBONES] = {}; - if (!SetupBones(aBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, I::GlobalVars->curtime)) - return; - if (pMins) *pMins = pBox->bbmin; diff --git a/Amalgam/src/SDK/Definitions/Main/CBaseEntity.h b/Amalgam/src/SDK/Definitions/Main/CBaseEntity.h index 31da11ad..c44df46a 100644 --- a/Amalgam/src/SDK/Definitions/Main/CBaseEntity.h +++ b/Amalgam/src/SDK/Definitions/Main/CBaseEntity.h @@ -101,8 +101,7 @@ public: inline Vec3 GetRenderCenter() { - Vec3 vMin = {}, vMax = {}; - GetRenderBounds(vMin, vMax); + Vec3 vMin, vMax; GetRenderBounds(vMin, vMax); return GetRenderOrigin() + Vec3(0.f, 0.f, (vMin.z + vMax.z) / 2); } diff --git a/Amalgam/src/SDK/Events/Events.cpp b/Amalgam/src/SDK/Events/Events.cpp index 95953918..62b41640 100644 --- a/Amalgam/src/SDK/Events/Events.cpp +++ b/Amalgam/src/SDK/Events/Events.cpp @@ -13,7 +13,7 @@ bool CEventListener::Initialize() { std::vector vEvents = { - "client_beginconnect", "client_connected", "client_disconnect", "game_newmap", "teamplay_round_start", "player_connect_client", "player_spawn", "player_changeclass", "player_hurt", "vote_cast", "item_pickup", "revive_player_notify" + "client_beginconnect", "client_connected", "client_disconnect", "game_newmap", "teamplay_round_start", "scorestats_accumulated_update", "mvm_reset_stats", "player_connect_client", "player_spawn", "player_changeclass", "player_hurt", "vote_cast", "item_pickup", "revive_player_notify" }; for (auto szEvent : vEvents) diff --git a/Amalgam/src/SDK/Globals.h b/Amalgam/src/SDK/Globals.h index 832a1b62..a7ec0186 100644 --- a/Amalgam/src/SDK/Globals.h +++ b/Amalgam/src/SDK/Globals.h @@ -16,7 +16,7 @@ struct DrawLine_t struct DrawPath_t { - std::deque m_vPath; + std::vector m_vPath; float m_flTime; Color_t m_tColor; int m_iStyle; @@ -93,7 +93,7 @@ namespace G inline int* RandomSeed() { - static auto dest = U::Memory.RelToAbs(S::RandomSeed()); - return reinterpret_cast(dest); + static auto pRandomSeed = reinterpret_cast(U::Memory.RelToAbs(S::RandomSeed())); + return pRandomSeed; } }; \ No newline at end of file diff --git a/Amalgam/src/SDK/Helpers/Draw/Draw.cpp b/Amalgam/src/SDK/Helpers/Draw/Draw.cpp index bbde2d4f..0bc96994 100644 --- a/Amalgam/src/SDK/Helpers/Draw/Draw.cpp +++ b/Amalgam/src/SDK/Helpers/Draw/Draw.cpp @@ -9,6 +9,12 @@ #include MAKE_SIGNATURE(CHudBaseDeathNotice_GetIcon, "client.dll", "40 53 48 81 EC ? ? ? ? 48 8B DA", 0x0); +MAKE_SIGNATURE(RenderLine, "engine.dll", "48 89 5C 24 ? 48 89 74 24 ? 44 89 44 24", 0x0); +MAKE_SIGNATURE(RenderBox, "engine.dll", "48 83 EC ? 8B 84 24 ? ? ? ? 4D 8B D8", 0x0); +MAKE_SIGNATURE(RenderWireframeBox, "engine.dll", "48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 55 41 54 41 55 41 56 41 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 49 8B F9", 0x0); +MAKE_SIGNATURE(RenderWireframeSweptBox, "engine.dll", "48 8B C4 48 89 58 ? 48 89 50 ? 48 89 48 ? 55 56 57 41 54 41 55 41 56 41 57 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 0F 29 70", 0x0); +MAKE_SIGNATURE(RenderTriangle, "engine.dll", "48 83 EC ? 41 8B C1 44 88 4C 24", 0x0); +MAKE_SIGNATURE(RenderSphere, "engine.dll", "48 8B C4 44 89 48 ? F3 0F 11 48", 0x0); void CDraw::Start(bool bBadFontCheck) { @@ -49,14 +55,13 @@ void CDraw::UpdateScreenSize() void CDraw::UpdateW2SMatrix() { - CViewSetup ViewSetup = {}; - if (I::BaseClientDLL->GetPlayerView(ViewSetup)) + CViewSetup tViewSetup; + if (I::BaseClientDLL->GetPlayerView(tViewSetup)) { - static VMatrix WorldToView = {}; - static VMatrix ViewToProjection = {}; - static VMatrix WorldToPixels = {}; - - I::RenderView->GetMatricesForView(ViewSetup, &WorldToView, &ViewToProjection, &m_WorldToProjection, &WorldToPixels); + static VMatrix mWorldToView; + static VMatrix mViewToProjection; + static VMatrix mWorldToPixels; + I::RenderView->GetMatricesForView(tViewSetup, &mWorldToView, &mViewToProjection, &m_mWorldToProjection, &mWorldToPixels); } } @@ -520,4 +525,141 @@ void CDraw::ClearAvatarCache() } m_mAvatars.clear(); +} + +void CDraw::RenderLine(const Vec3& vStart, const Vec3& vEnd, Color_t tColor, bool bZBuffer) +{ + if (!tColor.a) + return; + + S::RenderLine.Call(std::ref(vStart), std::ref(vEnd), tColor, bZBuffer); +} + +void CDraw::RenderPath(const std::vector& vPath, Color_t tColor, bool bZBuffer, int iStyle, float flTime, int iSeparatorSpacing, float flSeparatorLength) +{ + if (!tColor.a || iStyle == Vars::Visuals::Simulation::StyleEnum::Off) + return; + + for (size_t i = 1; i < vPath.size(); i++) + { + if (flTime < 0.f && vPath.size() - i > -flTime) + continue; + + switch (iStyle) + { + case Vars::Visuals::Simulation::StyleEnum::Line: + { + RenderLine(vPath[i - 1], vPath[i], tColor, bZBuffer); + break; + } + case Vars::Visuals::Simulation::StyleEnum::Separators: + { + RenderLine(vPath[i - 1], vPath[i], tColor, bZBuffer); + if (!(i % iSeparatorSpacing)) + { + const Vec3& vStart = vPath[i - 1]; + const Vec3& vEnd = vPath[i]; + + Vec3 vDir = (vEnd - vStart).Normalized2D(); + vDir = Math::RotatePoint(vDir * flSeparatorLength, {}, { 0, 90, 0 }); + RenderLine(vEnd, vEnd + vDir, tColor, bZBuffer); + } + break; + } + case Vars::Visuals::Simulation::StyleEnum::Spaced: + { + if (!(i % 2)) + RenderLine(vPath[i - 1], vPath[i], tColor, bZBuffer); + break; + } + case Vars::Visuals::Simulation::StyleEnum::Arrows: + { + if (!(i % 3)) + { + const Vec3& vStart = vPath[i - 1]; + const Vec3& vEnd = vPath[i]; + + if (!(vStart - vEnd).IsZero()) + { + Vec3 vAngles; Math::VectorAngles(vEnd - vStart, vAngles); + Vec3 vForward, vRight, vUp; Math::AngleVectors(vAngles, &vForward, &vRight, &vUp); + RenderLine(vEnd, vEnd - vForward * 5 + vRight * 5, tColor, bZBuffer); + RenderLine(vEnd, vEnd - vForward * 5 - vRight * 5, tColor, bZBuffer); + } + } + break; + } + case Vars::Visuals::Simulation::StyleEnum::Boxes: + { + RenderLine(vPath[i - 1], vPath[i], tColor, bZBuffer); + if (!(i % iSeparatorSpacing)) + RenderWireframeBox(vPath[i], { -1, -1, -1 }, { 1, 1, 1 }, {}, tColor, bZBuffer); + break; + } + } + } +} + +void CDraw::RenderBox(const Vec3& vOrigin, const Vec3& vMins, const Vec3& vMaxs, const Vec3& vAngles, Color_t tColor, bool bZBuffer, bool bInsideOut) +{ + if (!tColor.a) + return; + + S::RenderBox.Call(std::ref(vOrigin), std::ref(vAngles), std::ref(vMins), std::ref(vMaxs), tColor, bZBuffer, bInsideOut); +} + +void CDraw::RenderWireframeBox(const Vec3& vOrigin, const Vec3& vMins, const Vec3& vMaxs, const Vec3& vAngles, Color_t tColor, bool bZBuffer) +{ + if (!tColor.a) + return; + + S::RenderWireframeBox.Call(std::ref(vOrigin), std::ref(vAngles), std::ref(vMins), std::ref(vMaxs), tColor, bZBuffer); +} + +void CDraw::RenderWireframeSweptBox(const Vector& vStart, const Vector& vEnd, const Vec3& vMins, const Vec3& vMaxs, const Vec3& vAngles, Color_t tColor, bool bZBuffer) +{ + if (!tColor.a) + return; + + S::RenderWireframeSweptBox.Call(std::ref(vStart), std::ref(vEnd), std::ref(vAngles), std::ref(vMins), std::ref(vMaxs), tColor, bZBuffer); +} + +void CDraw::RenderTriangle(const Vector& vPoint1, const Vector& vPoint2, const Vector& vPoint3, Color_t tColor, bool bZBuffer) +{ + if (!tColor.a) + return; + + S::RenderTriangle.Call(std::ref(vPoint1), std::ref(vPoint2), std::ref(vPoint3), tColor, bZBuffer); +} + +void CDraw::RenderSphere(const Vector& vCenter, float flRadius, int nTheta, int nPhi, Color_t tColor, IMaterial* pMaterial) +{ + if (!tColor.a) + return; + + S::RenderSphere.Call(std::ref(vCenter), flRadius, nTheta, nPhi, tColor, pMaterial); +} + +void CDraw::RenderSphere(const Vector& vCenter, float flRadius, int nTheta, int nPhi, Color_t tColor, bool bZBuffer) +{ + if (!tColor.a) + return; + + static auto pVertexColor = *reinterpret_cast(U::Memory.RelToAbs(S::VertexColor())); + static auto pVertexColorIgnoreZ = *reinterpret_cast(U::Memory.RelToAbs(S::VertexColorIgnoreZ())); + auto pMaterial = bZBuffer ? pVertexColor : pVertexColorIgnoreZ; + + RenderSphere(vCenter, flRadius, nTheta, nPhi, tColor, pMaterial); +} + +void CDraw::RenderWireframeSphere(const Vector& vCenter, float flRadius, int nTheta, int nPhi, Color_t tColor, bool bZBuffer) +{ + if (!tColor.a) + return; + + static auto pWireframe = *reinterpret_cast(U::Memory.RelToAbs(S::Wireframe())); + static auto pWireframeIgnoreZ = *reinterpret_cast(U::Memory.RelToAbs(S::WireframeIgnoreZ())); + auto pMaterial = bZBuffer ? pWireframe : pWireframeIgnoreZ; + + RenderSphere(vCenter, flRadius, nTheta, nPhi, tColor, pMaterial); } \ No newline at end of file diff --git a/Amalgam/src/SDK/Helpers/Draw/Draw.h b/Amalgam/src/SDK/Helpers/Draw/Draw.h index 2e973a38..0343eacd 100644 --- a/Amalgam/src/SDK/Helpers/Draw/Draw.h +++ b/Amalgam/src/SDK/Helpers/Draw/Draw.h @@ -3,6 +3,12 @@ #include "../../Definitions/Definitions.h" #include "../../Vars.h" +MAKE_SIGNATURE(InitializeStandardMaterials, "engine.dll", "48 83 EC ? 80 3D ? ? ? ? ? 0F 85 ? ? ? ? 48 89 5C 24 ? B9 ? ? ? ? 48 89 7C 24 ? C6 05", 0x0); +MAKE_SIGNATURE(Wireframe, "engine.dll", "48 89 05 ? ? ? ? E8 ? ? ? ? 48 85 C0 74 ? 48 8D 15 ? ? ? ? 48 8B C8 E8 ? ? ? ? 48 8B F8 EB ? 48 8B FB 41 B8 ? ? ? ? 48 8D 15 ? ? ? ? 48 8B CF E8 ? ? ? ? 41 B8 ? ? ? ? 48 8D 15 ? ? ? ? 48 8B CF E8 ? ? ? ? 41 B8", 0x0); +MAKE_SIGNATURE(WireframeIgnoreZ, "engine.dll", "48 89 05 ? ? ? ? E8 ? ? ? ? 48 85 C0 74 ? 48 8D 15 ? ? ? ? 48 8B C8 E8 ? ? ? ? 48 8B F8 EB ? 48 8B FB 41 B8 ? ? ? ? 48 8D 15 ? ? ? ? 48 8B CF E8 ? ? ? ? 41 B8 ? ? ? ? 48 8D 15 ? ? ? ? 48 8B CF E8 ? ? ? ? 48 8B 0D", 0x0); +MAKE_SIGNATURE(VertexColor, "engine.dll", "48 89 05 ? ? ? ? E8 ? ? ? ? 48 8B 7C 24", 0x0); +MAKE_SIGNATURE(VertexColorIgnoreZ, "engine.dll", "48 89 05 ? ? ? ? 48 83 C4 ? C3 CC CC CC CC CC CC CC CC CC 48 8B C4", 0x0); + enum EAlign { ALIGN_TOPLEFT, @@ -90,8 +96,21 @@ public: void Avatar(int x, int y, int w, int h, const uint32 nFriendID, const EAlign& eAlign = ALIGN_CENTER); void ClearAvatarCache(); + void RenderLine(const Vec3& vStart, const Vec3& vEnd, Color_t tColor, bool bZBuffer = false); + void RenderPath(const std::vector& vPath, Color_t tColor, bool bZBuffer = false, + int iStyle = Vars::Visuals::Simulation::StyleEnum::Line, float flTime = 0.f, + int iSeparatorSpacing = Vars::Visuals::Simulation::SeparatorSpacing.Value, + float flSeparatorLength = Vars::Visuals::Simulation::SeparatorLength.Value); + void RenderBox(const Vec3& vOrigin, const Vec3& vMins, const Vec3& vMaxs, const Vec3& vAngles, Color_t tColor, bool bZBuffer = false, bool bInsideOut = false); + void RenderWireframeBox(const Vec3& vOrigin, const Vec3& vMins, const Vec3& vMaxs, const Vec3& vAngles, Color_t tColor, bool bZBuffer = false); + void RenderWireframeSweptBox(const Vector& vStart, const Vector& vEnd, const Vec3& vMins, const Vec3& vMaxs, const Vec3& vAngles, Color_t tColor, bool bZBuffer = false); + void RenderTriangle(const Vector& vPoint1, const Vector& vPoint2, const Vector& vPoint3, Color_t tColor, bool bZBuffer = false); + void RenderSphere(const Vector& vCenter, float flRadius, int nTheta, int nPhi, Color_t tColor, IMaterial* pMaterial); + void RenderSphere(const Vector& vCenter, float flRadius, int nTheta, int nPhi, Color_t tColor, bool bZBuffer = false); + void RenderWireframeSphere(const Vector& vCenter, float flRadius, int nTheta, int nPhi, Color_t tColor, bool bZBuffer = false); + int m_nScreenW = 0, m_nScreenH = 0; - VMatrix m_WorldToProjection = {}; + VMatrix m_mWorldToProjection = {}; }; ADD_FEATURE_CUSTOM(CDraw, Draw, H); \ No newline at end of file diff --git a/Amalgam/src/SDK/SDK.cpp b/Amalgam/src/SDK/SDK.cpp index 3bb02362..9df27386 100644 --- a/Amalgam/src/SDK/SDK.cpp +++ b/Amalgam/src/SDK/SDK.cpp @@ -199,7 +199,7 @@ int SDK::HandleToIDX(unsigned int pHandle) bool SDK::W2S(const Vec3& vOrigin, Vec3& vScreen, bool bAlways) { - const auto& worldToScreen = H::Draw.m_WorldToProjection.As3x4(); + const auto& worldToScreen = H::Draw.m_mWorldToProjection.As3x4(); float flW = worldToScreen[3][0] * vOrigin.x + worldToScreen[3][1] * vOrigin.y + worldToScreen[3][2] * vOrigin.z + worldToScreen[3][3]; vScreen.z = 0; @@ -632,7 +632,7 @@ void SDK::FixMovement(CUserCmd* pCmd, const Vec3& vCurAngle, const Vec3& vTarget Vec3 vMove = { pCmd->forwardmove, pCmd->sidemove * (bCurOOB ? -1 : 1), pCmd->upmove}; float flSpeed = vMove.Length2D(); - Vec3 vMoveAng = {}; Math::VectorAngles(vMove, vMoveAng); + Vec3 vMoveAng; Math::VectorAngles(vMove, vMoveAng); float flCurYaw = vCurAngle.y + (bCurOOB ? 180.f : 0.f); float flTargetYaw = vTargetAngle.y + (bTargetOOB ? 180.f : 0.f); diff --git a/Amalgam/src/SDK/Vars.h b/Amalgam/src/SDK/Vars.h index 82569235..b1f22b80 100644 --- a/Amalgam/src/SDK/Vars.h +++ b/Amalgam/src/SDK/Vars.h @@ -19,7 +19,7 @@ public: std::string m_sName; int m_iFlags = 0; - std::vector m_vTitle = {}; + std::vector m_vTitle; const char* m_sSection; union { int i = 0; @@ -282,7 +282,7 @@ namespace Vars Friends = 1 << 0, Party = 1 << 1, Invulnerable = 1 << 2, Cloaked = 1 << 3, Unsimulated = 1 << 4, DeadRinger = 1 << 5, Vaccinator = 1 << 6, Disguised = 1 << 7, Taunting = 1 << 8); CVar(AimFOV, "Aim FOV", 30.f, SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 180.f); CVar(MaxTargets, "Max targets", 2, SLIDER_MIN, 1, 6); - CVar(IgnoreCloak, "Ignore cloak", 100.f, SLIDER_CLAMP | SLIDER_PRECISION, 0, 100, 10, "%g%%"); + CVar(IgnoreCloak, "Ignore cloak", 100.f, SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 100.f, 10.f, "%g%%"); CVar(AssistStrength, "Assist strength", 25.f, SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 100.f, 1.f, "%g%%"); CVar(TickTolerance, "Tick tolerance", 7, SLIDER_CLAMP, 0, 21); CVar(AutoShoot, "Auto shoot", true); @@ -417,11 +417,10 @@ namespace Vars NAMESPACE_END(CritHack); NAMESPACE_BEGIN(Backtrack) - CVar(Enabled, VA_LIST("Enabled", "Backtrack enabled"), false); - CVar(PreferOnShot, "Prefer on shot", false); CVar(Latency, "Fake latency", 0, SLIDER_CLAMP, 0, 1000, 5); CVar(Interp, "Fake interp", 0, SLIDER_CLAMP | SLIDER_PRECISION, 0, 1000, 5); CVar(Window, VA_LIST("Window", "Backtrack window"), 185, SLIDER_CLAMP | SLIDER_PRECISION, 1, 200, 5); + CVar(PreferOnShot, "Prefer on shot", false); CVar(Offset, "Offset", 0, NOSAVE | DEBUGVAR, -1, 1); NAMESPACE_END(Backtrack); @@ -458,7 +457,7 @@ namespace Vars NAMESPACE_BEGIN(Speedhack) CVar(Enabled, VA_LIST("Enabled", "Speedhack enabled"), false); - CVar(Factor, VA_LIST("Factor", "SpeedHack factor"), 1, NONE, 1, 50); + CVar(Amount, VA_LIST("Amount", "SpeedHack amount"), 1, NONE, 1, 50); NAMESPACE_END(Speedhack); NAMESPACE_BEGIN(AntiAim, Anti-Aim) @@ -479,8 +478,8 @@ namespace Vars "View", "Target"); CVarValues(FakeYawMode, "Fake offset", 0, NONE, nullptr, "View", "Target"); - CVar(RealYawOffset, "Real offset", 0, SLIDER_CLAMP | SLIDER_PRECISION, -180, 180, 5, "%i"); - CVar(FakeYawOffset, "Fake offset", 0, SLIDER_CLAMP | SLIDER_PRECISION, -180, 180, 5, "%i"); + CVar(RealYawOffset, "Real offset", 0.f, SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f, "%i"); + CVar(FakeYawOffset, "Fake offset", 0.f, SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f, "%i"); CVar(RealYawValue, "Real value", 0.f, SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f, "%g"); CVar(FakeYawValue, "Fake value", 0.f, SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f, "%g"); CVar(SpinSpeed, "Spin speed", 15.f, SLIDER_PRECISION, -30.f, 30.f); @@ -508,8 +507,8 @@ namespace Vars InvalidPitch = 1 << 0, PacketChoking = 1 << 1, AimFlicking = 1 << 2, DuckSpeed = 1 << 3); CVar(DetectionsRequired, "Detections required", 10, SLIDER_MIN, 0, 50); CVar(MinimumChoking, "Minimum choking", 20, SLIDER_MIN, 4, 22); - CVar(MinimumFlick, "Minimum flick angle", 20.f, NONE, 10.f, 30.f); // min flick size to suspect - CVar(MaximumNoise, "Maximum flick noise", 1.f, NONE, 1.f, 10.f); // max different between angles before and after flick + CVar(MinimumFlick, "Minimum flick angle", 20.f, SLIDER_PRECISION, 10.f, 30.f); // min flick size to suspect + CVar(MaximumNoise, "Maximum flick noise", 1.f, SLIDER_PRECISION, 1.f, 10.f); // max difference between angles before and after flick NAMESPACE_END(CheaterDetection); NAMESPACE_BEGIN(ESP) @@ -763,12 +762,12 @@ namespace Vars SUBNAMESPACE_BEGIN(Viewmodel) CVar(CrosshairAim, "Crosshair aim position", false, VISUAL); CVar(ViewmodelAim, "Viewmodel aim position", false, VISUAL); - CVar(OffsetX, VA_LIST("Offset X", "Viewmodel offset X"), 0, VISUAL | SLIDER_PRECISION, -45, 45, 5); - CVar(OffsetY, VA_LIST("Offset Y", "Viewmodel offset Y"), 0, VISUAL | SLIDER_PRECISION, -45, 45, 5); - CVar(OffsetZ, VA_LIST("Offset Z", "Viewmodel offset Z"), 0, VISUAL | SLIDER_PRECISION, -45, 45, 5); - CVar(Pitch, VA_LIST("Pitch", "Viewmodel pitch"), 0, VISUAL | SLIDER_CLAMP | SLIDER_PRECISION, -180, 180, 5); - CVar(Yaw, VA_LIST("Yaw", "Viewmodel yaw"), 0, VISUAL | SLIDER_CLAMP | SLIDER_PRECISION, -180, 180, 5); - CVar(Roll, VA_LIST("Roll", "Viewmodel roll"), 0, VISUAL | SLIDER_CLAMP | SLIDER_PRECISION, -180, 180, 5); + CVar(OffsetX, VA_LIST("Offset X", "Viewmodel offset X"), 0.f, VISUAL | SLIDER_PRECISION, -45.f, 45.f, 5.f); + CVar(OffsetY, VA_LIST("Offset Y", "Viewmodel offset Y"), 0.f, VISUAL | SLIDER_PRECISION, -45.f, 45.f, 5.f); + CVar(OffsetZ, VA_LIST("Offset Z", "Viewmodel offset Z"), 0.f, VISUAL | SLIDER_PRECISION, -45.f, 45.f, 5.f); + CVar(Pitch, VA_LIST("Pitch", "Viewmodel pitch"), 0.f, VISUAL | SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f); + CVar(Yaw, VA_LIST("Yaw", "Viewmodel yaw"), 0.f, VISUAL | SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f); + CVar(Roll, VA_LIST("Roll", "Viewmodel roll"), 0.f, VISUAL | SLIDER_CLAMP | SLIDER_PRECISION, -180.f, 180.f, 5.f); CVar(SwayScale, VA_LIST("Sway scale", "Viewmodel sway scale"), 0.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 5.f, 0.5f); CVar(SwayInterp, VA_LIST("Sway interp", "Viewmodel sway interp"), 0.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 1.f, 0.1f); CVar(FieldOfView, VA_LIST("Field of view## Viewmodel FOV", "Viewmodel field of view"), 0.f, VISUAL | SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 180.f, 5.f); @@ -786,6 +785,29 @@ namespace Vars CVar(NoPropFade, "No prop fade", false, VISUAL); SUBNAMESPACE_END(World); + SUBNAMESPACE_BEGIN(Other, Other Visuals) + CVar(LocalDominationOverride, "Local domination override", std::string(""), VISUAL); + CVar(LocalRevengeOverride, "Local revenge override", std::string(""), VISUAL); + CVar(DominationOverride, "Domination override", std::string(""), VISUAL); + CVar(RevengeOverride, "Revenge override", std::string(""), VISUAL); + SUBNAMESPACE_END(Other); + + SUBNAMESPACE_BEGIN(Beams) // as of now, these will stay out of the menu + CVar(Model, "Model", std::string("sprites/physbeam.vmt"), VISUAL); + CVar(Life, "Life", 2.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f); + CVar(Width, "Width", 2.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f); + CVar(EndWidth, "End width", 2.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f); + CVar(FadeLength, "Fade length", 10.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 30.f); + CVar(Amplitude, "Amplitude", 2.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f); + CVar(Brightness, "Brightness", 255.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 255.f); + CVar(Speed, "Speed", 0.2f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 5.f); + CVar(Segments, "Segments", 2, VISUAL | SLIDER_MIN, 1, 10); + CVar(Color, "Color", Color_t(255, 255, 255, 255), VISUAL); + CVarEnum(Flags, "Flags", 0b10000000100000000, VISUAL | DROPDOWN_MULTI, nullptr, + VA_LIST("Start entity", "End entity", "Fade in", "Fade out", "Sine noise", "Solid", "Shade in", "Shade out", "Only noise once", "No tile", "Use hitboxes", "Start visible", "End visible", "Is active", "Forever", "Halobeam", "Reverse"), + StartEntity = 1 << 0, EndEntity = 1 << 1, FadeIn = 1 << 2, FadeOut = 1 << 3, SineNoise = 1 << 4, Solid = 1 << 5, ShadeIn = 1 << 6, ShadeOut = 1 << 7, OnlyNoiseOnce = 1 << 8, NoTile = 1 << 9, UseHitboxes = 1 << 10, StartVisible = 1 << 11, EndVisible = 1 << 12, IsActive = 1 << 13, Forever = 1 << 14, Halobeam = 1 << 15, Reverse = 1 << 16); + SUBNAMESPACE_END(Beams); + SUBNAMESPACE_BEGIN(Line) CVar(Enabled, "Line tracers", false, VISUAL); CVar(DrawDuration, VA_LIST("Draw duration", "Line draw duration"), 5.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f); @@ -822,7 +844,7 @@ namespace Vars CVar(DrawDuration, VA_LIST("Draw duration", "Simulation draw duration"), 5.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f); CVar(SeparatorSpacing, "Separator spacing", 4, NOSAVE | DEBUGVAR, 1, 16); - CVar(SeparatorLength, "Separator length", 12, NOSAVE | DEBUGVAR, 2, 16); + CVar(SeparatorLength, "Separator length", 12.f, NOSAVE | DEBUGVAR, 2.f, 16.f); SUBNAMESPACE_END(Simulation); SUBNAMESPACE_BEGIN(Trajectory) @@ -850,29 +872,6 @@ namespace Vars CVar(MaxVelocity, "Max velocity", 2000.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 4000.f, 50.f); CVar(MaxAngularVelocity, "Max angular velocity", 3600.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 7200.f, 50.f); SUBNAMESPACE_END(ProjectileTrajectory); - - SUBNAMESPACE_BEGIN(Other, Other Visuals) - CVar(LocalDominationOverride, "Local domination override", std::string(""), VISUAL); - CVar(LocalRevengeOverride, "Local revenge override", std::string(""), VISUAL); - CVar(DominationOverride, "Domination override", std::string(""), VISUAL); - CVar(RevengeOverride, "Revenge override", std::string(""), VISUAL); - SUBNAMESPACE_END(Other); - - SUBNAMESPACE_BEGIN(Beams) // as of now, these will stay out of the menu - CVar(Model, "Model", std::string("sprites/physbeam.vmt"), VISUAL); - CVar(Life, "Life", 2.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f); - CVar(Width, "Width", 2.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f); - CVar(EndWidth, "End width", 2.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f); - CVar(FadeLength, "Fade length", 10.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 30.f); - CVar(Amplitude, "Amplitude", 2.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f); - CVar(Brightness, "Brightness", 255.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 255.f); - CVar(Speed, "Speed", 0.2f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 5.f); - CVar(Segments, "Segments", 2, VISUAL | SLIDER_MIN, 1, 10); - CVar(Color, "Color", Color_t(255, 255, 255, 255), VISUAL); - CVarEnum(Flags, "Flags", 0b10000000100000000, VISUAL | DROPDOWN_MULTI, nullptr, - VA_LIST("Start entity", "End entity", "Fade in", "Fade out", "Sine noise", "Solid", "Shade in", "Shade out", "Only noise once", "No tile", "Use hitboxes", "Start visible", "End visible", "Is active", "Forever", "Halobeam", "Reverse"), - StartEntity = 1 << 0, EndEntity = 1 << 1, FadeIn = 1 << 2, FadeOut = 1 << 3, SineNoise = 1 << 4, Solid = 1 << 5, ShadeIn = 1 << 6, ShadeOut = 1 << 7, OnlyNoiseOnce = 1 << 8, NoTile = 1 << 9, UseHitboxes = 1 << 10, StartVisible = 1 << 11, EndVisible = 1 << 12, IsActive = 1 << 13, Forever = 1 << 14, Halobeam = 1 << 15, Reverse = 1 << 16); - SUBNAMESPACE_END(Beams); NAMESPACE_END(Visuals); NAMESPACE_BEGIN(Radar) diff --git a/Amalgam/src/Utils/CrashLog/CrashLog.cpp b/Amalgam/src/Utils/CrashLog/CrashLog.cpp index 776bb288..33babe73 100644 --- a/Amalgam/src/Utils/CrashLog/CrashLog.cpp +++ b/Amalgam/src/Utils/CrashLog/CrashLog.cpp @@ -134,7 +134,7 @@ static LONG APIENTRY ExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo) ssErrorStream << "\n"; } - ssErrorStream << __CONFIGURATION__ " @ " __DATE__ ", " __TIME__ "\n"; + ssErrorStream << "Built @ " __DATE__ ", " __TIME__ ", " __CONFIGURATION__ "\n"; ssErrorStream << "Ctrl + C to copy. \n"; if (bException) ssErrorStream << "Shift + Enter to skip repetitive exceptions. \n"; diff --git a/Amalgam/src/Utils/Interfaces/Interfaces.h b/Amalgam/src/Utils/Interfaces/Interfaces.h index c99c4655..aefb195a 100644 --- a/Amalgam/src/Utils/Interfaces/Interfaces.h +++ b/Amalgam/src/Utils/Interfaces/Interfaces.h @@ -4,12 +4,12 @@ struct InterfaceInit_t { - void** m_pPtr = nullptr; - const char* m_pszDLLName = {}; - const char* m_pszVersion = {}; - int m_nOffset = -1; //if not -1 we're going to sig scan (m_sVersion is the sig) - int m_nDereferenceCount = 0; - bool m_bSearchDLL = false; + void** m_pPtr; + const char* m_pszDLLName; + const char* m_pszVersion; + int m_nOffset; //if not -1 we're going to sig scan (m_sVersion is the sig) + int m_nDereferenceCount; + bool m_bSearchDLL; InterfaceInit_t(void** pPtr, const char* sDLLName, const char* sVersion, int nOffset, int nDereferenceCount, bool bSearchDLL = false); }; diff --git a/Amalgam/src/Utils/Memory/Memory.cpp b/Amalgam/src/Utils/Memory/Memory.cpp index 80ce0cd3..6738a755 100644 --- a/Amalgam/src/Utils/Memory/Memory.cpp +++ b/Amalgam/src/Utils/Memory/Memory.cpp @@ -6,48 +6,39 @@ #define GetBits(x) (INRANGE((x & (~0x20)),'A','F') ? ((x & (~0x20)) - 'A' + 0xA) : (INRANGE(x,'0','9') ? x - '0' : 0)) #define GetBytes(x) (GetBits(x[0]) << 4 | GetBits(x[1])) -typedef void* (*InstantiateInterfaceFn)(); - -struct InterfaceInit_t -{ - InstantiateInterfaceFn m_pInterface = nullptr; - const char* m_pszInterfaceName = nullptr; - InterfaceInit_t* m_pNextInterface = nullptr; -}; - std::vector CMemory::PatternToByte(const char* szPattern) { - std::vector bytes = {}; - const auto start = const_cast(szPattern); - const auto end = const_cast(szPattern) + strlen(szPattern); + std::vector vPattern = {}; - for (char* current = start; current < end; ++current) - bytes.push_back(byte(std::strtoul(current, ¤t, 16))); + const auto pStart = const_cast(szPattern); + const auto pEnd = const_cast(szPattern) + strlen(szPattern); + for (char* pCurrent = pStart; pCurrent < pEnd; ++pCurrent) + vPattern.push_back(byte(std::strtoul(pCurrent, &pCurrent, 16))); - return bytes; + return vPattern; } std::vector CMemory::PatternToInt(const char* szPattern) { - std::vector bytes = {}; - const auto start = const_cast(szPattern); - const auto end = const_cast(szPattern) + strlen(szPattern); + std::vector vPattern = {}; - for (char* current = start; current < end; ++current) + const auto pStart = const_cast(szPattern); + const auto pEnd = const_cast(szPattern) + strlen(szPattern); + for (char* pCurrent = pStart; pCurrent < pEnd; ++pCurrent) { - if (*current == '?') // Is current byte a wildcard? Simply ignore that that byte later + if (*pCurrent == '?') // Is current byte a wildcard? Simply ignore that that byte later { - ++current; - if (*current == '?') // Check if following byte is also a wildcard - ++current; + ++pCurrent; + if (*pCurrent == '?') // Check if following byte is also a wildcard + ++pCurrent; - bytes.push_back(-1); + vPattern.push_back(-1); } else - bytes.push_back(std::strtoul(current, ¤t, 16)); + vPattern.push_back(std::strtoul(pCurrent, &pCurrent, 16)); } - return bytes; + return vPattern; } uintptr_t CMemory::FindSignature(const char* szModule, const char* szPattern) @@ -55,51 +46,51 @@ uintptr_t CMemory::FindSignature(const char* szModule, const char* szPattern) if (const auto hMod = GetModuleHandleA(szModule)) { // Get module information to search in the given module - MODULEINFO module_info; - if (!GetModuleInformation(GetCurrentProcess(), hMod, &module_info, sizeof(MODULEINFO))) + MODULEINFO lpModuleInfo; + if (!GetModuleInformation(GetCurrentProcess(), hMod, &lpModuleInfo, sizeof(MODULEINFO))) return {}; // The region where we will search for the byte sequence - const auto image_size = module_info.SizeOfImage; + const auto dwImageSize = lpModuleInfo.SizeOfImage; // Check if the image is faulty - if (!image_size) + if (!dwImageSize) return {}; // Convert IDA-Style signature to a byte sequence - const auto pattern_bytes = PatternToInt(szPattern); - const auto signature_size = pattern_bytes.size(); - const int* signature_bytes = pattern_bytes.data(); + const auto vPattern = PatternToInt(szPattern); + const auto iPatternSize = vPattern.size(); + const int* iPatternBytes = vPattern.data(); - const auto image_bytes = reinterpret_cast(hMod); + const auto pImageBytes = reinterpret_cast(hMod); // Now loop through all bytes and check if the byte sequence matches - for (auto i = 0ul; i < image_size - signature_size; ++i) + for (auto i = 0ul; i < dwImageSize - iPatternSize; ++i) { - auto byte_sequence_found = true; + auto bFound = true; // Go through all bytes from the signature and check if it matches - for (auto j = 0ul; j < signature_size; ++j) + for (auto j = 0ul; j < iPatternSize; ++j) { - if (image_bytes[i + j] != signature_bytes[j] // Bytes don't match - && signature_bytes[j] != -1) // Byte isn't a wildcard either + if (pImageBytes[i + j] != iPatternBytes[j] // Bytes don't match + && iPatternBytes[j] != -1) // Byte isn't a wildcard either { - byte_sequence_found = false; + bFound = false; break; } } - if (byte_sequence_found) - return { reinterpret_cast(&image_bytes[i]) }; + if (bFound) + return uintptr_t(&pImageBytes[i]); } - return {}; + return 0x0; } return 0x0; } -using CreateInterfaceFn = void* (*)(const char* pName, int* pReturnCode); +using CreateInterfaceFn = void*(*)(const char* pName, int* pReturnCode); PVOID CMemory::FindInterface(const char* szModule, const char* szObject) { @@ -107,9 +98,9 @@ PVOID CMemory::FindInterface(const char* szModule, const char* szObject) if (!hModule) return nullptr; - const auto createFn = reinterpret_cast(GetProcAddress(hModule, "CreateInterface")); - if (!createFn) + const auto fnCreateInterface = reinterpret_cast(GetProcAddress(hModule, "CreateInterface")); + if (!fnCreateInterface) return nullptr; - return createFn(szObject, nullptr); + return fnCreateInterface(szObject, nullptr); } \ No newline at end of file diff --git a/Amalgam/src/Utils/Signatures/Signatures.h b/Amalgam/src/Utils/Signatures/Signatures.h index 8442bc94..9ce88878 100644 --- a/Amalgam/src/Utils/Signatures/Signatures.h +++ b/Amalgam/src/Utils/Signatures/Signatures.h @@ -6,11 +6,11 @@ class CSignature { private: - uintptr_t m_dwVal = 0x0; - const char* m_pszDLLName = {}; - const char* m_pszSignature = {}; - int m_nOffset = 0; - const char* m_pszName = {}; + uintptr_t m_dwVal; + const char* m_pszDLLName; + const char* m_pszSignature; + int m_nOffset; + const char* m_pszName; public: CSignature(const char* sDLLName, const char* sSignature, int nOffset, const char* sName); diff --git a/README.md b/README.md index 19e813bf..9ef91435 100644 --- a/README.md +++ b/README.md @@ -3,30 +3,31 @@ Download - PDB + PDB Download AVX2 - PDB AVX2 + PDB AVX2
Download Freetype - PDB Freetype + PDB Freetype Download Freetype AVX2 - PDB Freetype AVX2 + PDB Freetype AVX2

-###### AVX2 may be faster than SSE2 though not all CPUs support it (Steam > Help > System Information > Processor Information > AVX2). Freetype uses freetype as the text rasterizer and includes some custom fonts, which results in better looking text but larger DLL sizes. PDBs are for developer use +###### AVX2 may be faster than SSE2 though not all CPUs support it (`Steam > Help > System Information > Processor Information > AVX2`). Freetype uses freetype as the text rasterizer and includes some custom fonts, which results in better looking text but larger DLL sizes. PDBs are for developer use. +###### If nightly.link is down, you can still download through [github](https://github.com/rei-2/Amalgam/actions) with an account. # Amalgam