diff --git a/Amalgam/Amalgam.vcxproj b/Amalgam/Amalgam.vcxproj index 08a9ade1..17f06c4a 100644 --- a/Amalgam/Amalgam.vcxproj +++ b/Amalgam/Amalgam.vcxproj @@ -1077,7 +1077,7 @@ - + @@ -1451,14 +1451,13 @@ - - + diff --git a/Amalgam/Amalgam.vcxproj.filters b/Amalgam/Amalgam.vcxproj.filters index aaf7a1e6..2b7ca781 100644 --- a/Amalgam/Amalgam.vcxproj.filters +++ b/Amalgam/Amalgam.vcxproj.filters @@ -39,7 +39,7 @@ - + @@ -313,7 +313,6 @@ - @@ -346,7 +345,7 @@ - + diff --git a/Amalgam/src/Core/Core.cpp b/Amalgam/src/Core/Core.cpp index e357ca32..4724ca83 100644 --- a/Amalgam/src/Core/Core.cpp +++ b/Amalgam/src/Core/Core.cpp @@ -28,7 +28,7 @@ static inline std::string GetProcessName(DWORD dwProcessID) static inline bool CheckDXLevel() { - auto mat_dxlevel = U::ConVars.FindVar("mat_dxlevel"); + auto mat_dxlevel = H::ConVars.FindVar("mat_dxlevel"); if (mat_dxlevel->GetInt() < 90) { //const char* sMessage = "You are running with graphics options that Amalgam does not support. -dxlevel must be at least 90."; @@ -83,7 +83,7 @@ void CCore::Load() Sleep(500), flTime += 0.5f; if (m_bUnload = m_bFailed = flTime >= 60.f) { - AppendFailText(std::format("Failed to load in time ({:#x}, {:#x})", uSignature, uintptr_t(hWindow)).c_str()); + AppendFailText(std::format("Failed to load in time:\n {:#x}\n {:#x}", uSignature, uintptr_t(hWindow)).c_str()); return; } if (m_bUnload = m_bFailed = U::KeyHandler.Down(VK_F11, true)) @@ -99,7 +99,7 @@ void CCore::Load() if (m_bUnload = m_bFailed2 = !U::Hooks.Initialize() || !U::BytePatches.Initialize() || !H::Events.Initialize()) return; F::Materials.LoadMaterials(); - U::ConVars.Unlock(); + H::ConVars.Unlock(); F::Configs.LoadConfig(F::Configs.m_sCurrentConfig, false); @@ -142,12 +142,12 @@ void CCore::Unload() pLocal->ThirdPersonSwitch(); } } - U::ConVars.FindVar("cl_wpn_sway_interp")->SetValue(0.f); - U::ConVars.FindVar("cl_wpn_sway_scale")->SetValue(0.f); + H::ConVars.FindVar("cl_wpn_sway_interp")->SetValue(0.f); + H::ConVars.FindVar("cl_wpn_sway_scale")->SetValue(0.f); Sleep(250); F::EnginePrediction.Unload(); - U::ConVars.Restore(); + H::ConVars.Restore(); F::Materials.UnloadMaterials(); if (m_bFailed2) diff --git a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp index fb78cf8e..702e8106 100644 --- a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp @@ -274,7 +274,7 @@ int CAimbotGlobal::GetPriority(int iIndex) bool CAimbotGlobal::FriendlyFire() { - static auto mp_friendlyfire = U::ConVars.FindVar("mp_friendlyfire"); + static auto mp_friendlyfire = H::ConVars.FindVar("mp_friendlyfire"); return mp_friendlyfire->GetBool(); } diff --git a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp index 419b50a4..1c05f049 100644 --- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp @@ -669,7 +669,7 @@ bool CAimbotHitscan::Aim(Vec3 vCurAngle, Vec3 vToAngle, Vec3& vOut, int iMethod) // assume angle calculated outside with other overload void CAimbotHitscan::Aim(CUserCmd* pCmd, Vec3& vAngle, int iMethod) { - bool bUnsure = F::Ticks.IsTimingUnsure() || F::Ticks.GetTicks(H::Entities.GetWeapon()); + bool bUnsure = F::Ticks.IsTimingUnsure(); switch (iMethod) { case Vars::Aimbot::General::AimTypeEnum::Plain: diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp index 1930bfc1..0670abee 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp @@ -468,7 +468,7 @@ bool CAimbotMelee::Aim(Vec3 vCurAngle, Vec3 vToAngle, Vec3& vOut, int iMethod) // assume angle calculated outside with other overload void CAimbotMelee::Aim(CUserCmd* pCmd, Vec3& vAngle, int iMethod) { - bool bUnsure = F::Ticks.IsTimingUnsure() || F::Ticks.GetTicks(H::Entities.GetWeapon()); + bool bUnsure = F::Ticks.IsTimingUnsure(); switch (iMethod) { case Vars::Aimbot::General::AimTypeEnum::Plain: @@ -629,7 +629,7 @@ bool CAimbotMelee::FindNearestBuildPoint(CBaseObject* pBuilding, CTFPlayer* pLoc bool bFoundPoint = false; m_vEyePos = pLocal->GetShootPos(); - static auto tf_obj_max_attach_dist = U::ConVars.FindVar("tf_obj_max_attach_dist"); + static auto tf_obj_max_attach_dist = H::ConVars.FindVar("tf_obj_max_attach_dist"); float flNearestPoint = tf_obj_max_attach_dist->GetFloat(); for (int i = 0; i < pBuilding->GetNumBuildPoints(); i++) diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp index 5ae6b7dd..3e60edb7 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp @@ -282,7 +282,7 @@ static inline float PrimeTime(CTFWeaponBase* pWeapon) { if (Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::UsePrimeTime && pWeapon->GetWeaponID() == TF_WEAPON_PIPEBOMBLAUNCHER) { - static auto tf_grenadelauncher_livetime = U::ConVars.FindVar("tf_grenadelauncher_livetime"); + static auto tf_grenadelauncher_livetime = H::ConVars.FindVar("tf_grenadelauncher_livetime"); const float flLiveTime = tf_grenadelauncher_livetime->GetFloat(); return SDK::AttribHookValue(flLiveTime, "sticky_arm_time", pWeapon); } @@ -1630,7 +1630,7 @@ bool CAimbotProjectile::Aim(Vec3 vCurAngle, Vec3 vToAngle, Vec3& vOut, int iMeth // assume angle calculated outside with other overload void CAimbotProjectile::Aim(CUserCmd* pCmd, Vec3& vAngle, int iMethod) { - bool bUnsure = F::Ticks.IsTimingUnsure() || F::Ticks.GetTicks(H::Entities.GetWeapon()); + bool bUnsure = F::Ticks.IsTimingUnsure(); switch (iMethod) { case Vars::Aimbot::General::AimTypeEnum::Plain: @@ -1746,7 +1746,7 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser if (F::AimbotGlobal.ShouldHoldAttack(pWeapon)) pCmd->buttons |= IN_ATTACK; if (!Vars::Aimbot::General::AimType.Value - || !F::AimbotGlobal.ShouldAim() && nWeaponID != TF_WEAPON_PIPEBOMBLAUNCHER && nWeaponID != TF_WEAPON_CANNON && nWeaponID != TF_WEAPON_FLAMETHROWER) + || !F::AimbotGlobal.ShouldAim() && nWeaponID != TF_WEAPON_FLAMETHROWER) return false; auto vTargets = SortTargets(pLocal, pWeapon); diff --git a/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp b/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp index 5f234eac..1b43613c 100644 --- a/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp +++ b/Amalgam/src/Features/Aimbot/AutoAirblast/AutoAirblast.cpp @@ -53,7 +53,7 @@ void CAutoAirblast::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCm if (iWeaponID != TF_WEAPON_FLAMETHROWER && iWeaponID != TF_WEAPON_FLAME_BALL || SDK::AttribHookValue(0, "airblast_disabled", pWeapon)) return; - static auto tf_flamethrower_burstammo = U::ConVars.FindVar("tf_flamethrower_burstammo"); + static auto tf_flamethrower_burstammo = H::ConVars.FindVar("tf_flamethrower_burstammo"); int iAmmoPerShot = tf_flamethrower_burstammo->GetInt() * SDK::AttribHookValue(1, "mult_airblast_cost", pWeapon); int iAmmo = pLocal->GetAmmoCount(pWeapon->m_iPrimaryAmmoType()); int iBuffType = SDK::AttribHookValue(0, "set_buff_type", pWeapon); diff --git a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp index 13bb32fa..a2b2b07a 100644 --- a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp +++ b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp @@ -48,9 +48,9 @@ static inline bool GetRadius(EntityEnum::EntityEnum iGroup, CBaseEntity* pProjec flRadius *= 146.f; if (!pPipebomb->m_bTouched()) { - static auto tf_grenadelauncher_livetime = U::ConVars.FindVar("tf_grenadelauncher_livetime"); - static auto tf_sticky_radius_ramp_time = U::ConVars.FindVar("tf_sticky_radius_ramp_time"); - static auto tf_sticky_airdet_radius = U::ConVars.FindVar("tf_sticky_airdet_radius"); + static auto tf_grenadelauncher_livetime = H::ConVars.FindVar("tf_grenadelauncher_livetime"); + static auto tf_sticky_radius_ramp_time = H::ConVars.FindVar("tf_sticky_radius_ramp_time"); + static auto tf_sticky_airdet_radius = H::ConVars.FindVar("tf_sticky_airdet_radius"); float flLiveTime = tf_grenadelauncher_livetime->GetFloat(); float flRampTime = tf_sticky_radius_ramp_time->GetFloat(); float flAirdetRadius = tf_sticky_airdet_radius->GetFloat(); diff --git a/Amalgam/src/Features/Backtrack/Backtrack.cpp b/Amalgam/src/Features/Backtrack/Backtrack.cpp index 045810af..912e907e 100644 --- a/Amalgam/src/Features/Backtrack/Backtrack.cpp +++ b/Amalgam/src/Features/Backtrack/Backtrack.cpp @@ -249,7 +249,7 @@ void CBacktrack::MakeRecords() { const Vec3 vDelta = tCurRecord.m_vOrigin - pLastRecord->m_vOrigin; - static auto sv_lagcompensation_teleport_dist = U::ConVars.FindVar("sv_lagcompensation_teleport_dist"); + static auto sv_lagcompensation_teleport_dist = H::ConVars.FindVar("sv_lagcompensation_teleport_dist"); const float flDist = powf(sv_lagcompensation_teleport_dist->GetFloat(), 2.f); if (vDelta.Length2DSqr() > flDist) { @@ -320,7 +320,7 @@ void CBacktrack::Store() if (!I::EngineClient->IsInGame()) return; - static auto sv_maxunlag = U::ConVars.FindVar("sv_maxunlag"); + static auto sv_maxunlag = H::ConVars.FindVar("sv_maxunlag"); m_flMaxUnlag = sv_maxunlag->GetFloat(); MakeRecords(); @@ -362,7 +362,7 @@ void CBacktrack::AdjustPing(CNetChannel* pNetChan) if (!pLocal || !pLocal->m_iClass()) return 0.f; - static auto host_timescale = U::ConVars.FindVar("host_timescale"); + static auto host_timescale = H::ConVars.FindVar("host_timescale"); float flTimescale = host_timescale->GetFloat(); static float flStaticReal = 0.f; diff --git a/Amalgam/src/Features/CritHack/CritHack.cpp b/Amalgam/src/Features/CritHack/CritHack.cpp index cb881980..9c31a97e 100644 --- a/Amalgam/src/Features/CritHack/CritHack.cpp +++ b/Amalgam/src/Features/CritHack/CritHack.cpp @@ -106,7 +106,7 @@ void CCritHack::UpdateWeaponInfo(CTFPlayer* pLocal, CTFWeaponBase* pWeapon) if (pWeapon == pOldWeapon && flBucket == flLastBucket && iCritChecks == iLastCritChecks && iCritSeedRequests == iLastCritSeedRequests) return; - static auto tf_weapon_criticals_bucket_cap = U::ConVars.FindVar("tf_weapon_criticals_bucket_cap"); + static auto tf_weapon_criticals_bucket_cap = H::ConVars.FindVar("tf_weapon_criticals_bucket_cap"); const float flBucketCap = tf_weapon_criticals_bucket_cap->GetFloat(); bool bRapidFire = pWeapon->IsRapidFire(); float flFireRate = pWeapon->GetFireRate(); diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.cpp b/Amalgam/src/Features/ImGui/Menu/Menu.cpp index 4294bfb2..6d589102 100644 --- a/Amalgam/src/Features/ImGui/Menu/Menu.cpp +++ b/Amalgam/src/Features/ImGui/Menu/Menu.cpp @@ -1248,23 +1248,14 @@ void CMenu::MenuLogs(int iTab) const auto& vPlayers = F::PlayerUtils.m_vPlayerCache; std::unordered_map> mParties = {}; - std::unordered_map mHues = {}; // don't just shift based on party id in the case that it will be similar + int iPartyCount = 0; for (auto& tPlayer : vPlayers) { if (tPlayer.m_iParty) + { mParties[tPlayer.m_iParty].push_back(&tPlayer); - } - for (auto it = mParties.begin(); it != mParties.end();) - { - if (it->second.size() > 1) - it++; - else - it = mParties.erase(it); - } - { - float flParties = mParties.size() + 1 - mParties.contains(1); - int i = 0; for (auto& [iParty, _] : mParties) - mHues[iParty] = iParty != 1 ? 360 * ++i / flParties : 0; + iPartyCount = std::max(iPartyCount, tPlayer.m_iParty); + } } auto getTeamColor = [&](int iTeam, bool bAlive) @@ -1318,10 +1309,19 @@ void CMenu::MenuLogs(int iTab) { std::vector vLabels = {}; std::vector> vTags = {}; - if (mHues.contains(tPlayer.m_iParty)) - vLabels.emplace_back("Party", F::PlayerUtils.m_vTags[F::PlayerUtils.TagToIndex(PARTY_TAG)].m_tColor.HueShift(mHues[tPlayer.m_iParty])); + if (int iParty = tPlayer.m_iParty) + { + auto pTag = &F::PlayerUtils.m_vTags[F::PlayerUtils.TagToIndex(PARTY_TAG)]; + if (!--iParty) + vTags.emplace_back(pTag, 0); + else + vLabels.emplace_back(std::format("{}: {}", pTag->m_sName, iParty), pTag->m_tColor.HueShift(iParty * 360.f / iPartyCount)); + } if (tPlayer.m_bF2P) - vTags.emplace_back(&F::PlayerUtils.m_vTags[F::PlayerUtils.TagToIndex(F2P_TAG)], 0); + { + auto pTag = &F::PlayerUtils.m_vTags[F::PlayerUtils.TagToIndex(F2P_TAG)]; + vTags.emplace_back(pTag, 0); + } for (auto& iID : F::PlayerUtils.GetPlayerTags(tPlayer.m_uAccountID)) { if (auto pTag = F::PlayerUtils.GetTag(iID)) diff --git a/Amalgam/src/Features/Misc/Misc.cpp b/Amalgam/src/Features/Misc/Misc.cpp index fb0b1a33..39ff3a01 100644 --- a/Amalgam/src/Features/Misc/Misc.cpp +++ b/Amalgam/src/Features/Misc/Misc.cpp @@ -111,7 +111,7 @@ void CMisc::AutoStrafe(CTFPlayer* pLocal, CUserCmd* pCmd) { case Vars::Misc::Movement::AutoStrafeEnum::Legit: { - static auto cl_sidespeed = U::ConVars.FindVar("cl_sidespeed"); + static auto cl_sidespeed = H::ConVars.FindVar("cl_sidespeed"); const float flSideSpeed = cl_sidespeed->GetFloat(); if (pCmd->mousedx) @@ -232,7 +232,7 @@ void CMisc::NoisemakerSpam(CTFPlayer* pLocal) void CMisc::CheatsBypass() { static bool bCheatSet = false; - static auto sv_cheats = U::ConVars.FindVar("sv_cheats"); + static auto sv_cheats = H::ConVars.FindVar("sv_cheats"); if (Vars::Misc::Exploits::CheatsBypass.Value) { sv_cheats->m_nValue = 1; @@ -247,8 +247,8 @@ void CMisc::CheatsBypass() void CMisc::WeaponSway() { - static auto cl_wpn_sway_interp = U::ConVars.FindVar("cl_wpn_sway_interp"); - static auto cl_wpn_sway_scale = U::ConVars.FindVar("cl_wpn_sway_scale"); + static auto cl_wpn_sway_interp = H::ConVars.FindVar("cl_wpn_sway_interp"); + static auto cl_wpn_sway_scale = H::ConVars.FindVar("cl_wpn_sway_scale"); bool bSway = Vars::Visuals::Viewmodel::SwayInterp.Value || Vars::Visuals::Viewmodel::SwayScale.Value; cl_wpn_sway_interp->SetValue(bSway ? Vars::Visuals::Viewmodel::SwayInterp.Value : 0.f); @@ -530,7 +530,7 @@ void CMisc::PingReducer() if (!tTimer.Run(0.1f)) return; - static auto cl_cmdrate = U::ConVars.FindVar("cl_cmdrate"); + static auto cl_cmdrate = H::ConVars.FindVar("cl_cmdrate"); int iTarget = Vars::Misc::Exploits::PingReducer.Value ? Vars::Misc::Exploits::PingTarget.Value : cl_cmdrate->GetInt(); if (m_iWishCmdrate != iTarget) { @@ -544,7 +544,7 @@ void CMisc::PingReducer() } } - static auto sv_maxupdaterate = U::ConVars.FindVar("sv_maxupdaterate"); // force highest cl_updaterate command possible + static auto sv_maxupdaterate = H::ConVars.FindVar("sv_maxupdaterate"); // force highest cl_updaterate command possible iTarget = sv_maxupdaterate->GetInt(); if (m_iWishUpdaterate != iTarget) { diff --git a/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp b/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp index 1fe328a0..87f8320e 100644 --- a/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp +++ b/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp @@ -30,7 +30,7 @@ bool CNoSpreadHitscan::ShouldRun(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, bool int CNoSpreadHitscan::GetSeed(CUserCmd* pCmd) { - static auto sv_usercmd_custom_random_seed = U::ConVars.FindVar("sv_usercmd_custom_random_seed"); + static auto sv_usercmd_custom_random_seed = H::ConVars.FindVar("sv_usercmd_custom_random_seed"); if (!sv_usercmd_custom_random_seed->GetBool()) return pCmd->random_seed & 255; diff --git a/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp b/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp index 0a2ce498..a8a1e4bb 100644 --- a/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp +++ b/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp @@ -36,7 +36,7 @@ bool CFakeLag::IsAllowed(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC return I::ClientState->chokedcommands < m_iGoal; case Vars::Fakelag::FakelagEnum::Adaptive: { - static auto sv_lagcompensation_teleport_dist = U::ConVars.FindVar("sv_lagcompensation_teleport_dist"); + static auto sv_lagcompensation_teleport_dist = H::ConVars.FindVar("sv_lagcompensation_teleport_dist"); const float flDist = powf(sv_lagcompensation_teleport_dist->GetFloat(), 2.f); return (m_vLastPosition - pLocal->m_vecOrigin()).Length2DSqr() < flDist; } diff --git a/Amalgam/src/Features/Players/PlayerUtils.h b/Amalgam/src/Features/Players/PlayerUtils.h index f52fb1ce..a4c2ca72 100644 --- a/Amalgam/src/Features/Players/PlayerUtils.h +++ b/Amalgam/src/Features/Players/PlayerUtils.h @@ -23,7 +23,7 @@ struct ListPlayer bool m_bParty; bool m_bF2P; int m_iLevel; - uint64_t m_iParty; + int m_iParty; }; struct PriorityLabel_t diff --git a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp index 6ce6b25c..dd8d8441 100644 --- a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp +++ b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp @@ -300,7 +300,7 @@ bool CMovementSimulation::SetupMoveData(MoveStorage& tStorage) static inline float GetGravity() { - static auto sv_gravity = U::ConVars.FindVar("sv_gravity"); + static auto sv_gravity = H::ConVars.FindVar("sv_gravity"); return sv_gravity->GetFloat(); } @@ -310,7 +310,7 @@ static inline float GetFrictionScale(float flVelocityXY, float flTurn, float flV if (0.f >= flVelocityZ || flVelocityZ > 250.f) return 1.f; - static auto sv_airaccelerate = U::ConVars.FindVar("sv_airaccelerate"); + static auto sv_airaccelerate = H::ConVars.FindVar("sv_airaccelerate"); float flScale = std::max(sv_airaccelerate->GetFloat(), 1.f); flMin *= flScale, flMax *= flScale; diff --git a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp index ae5cd42c..d2330e43 100644 --- a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp +++ b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp @@ -8,7 +8,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap if (!pPlayer || !pPlayer->IsAlive() || pPlayer->IsAGhost() || pPlayer->IsTaunting() || !pWeapon) return false; - static auto sv_gravity = U::ConVars.FindVar("sv_gravity"); + static auto sv_gravity = H::ConVars.FindVar("sv_gravity"); float flGravity = sv_gravity->GetFloat() / 800.f; bool bDucking = pPlayer->m_fFlags() & FL_DUCKING; @@ -179,7 +179,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap } case TF_WEAPON_FLAMETHROWER: { - static auto tf_flamethrower_boxsize = U::ConVars.FindVar("tf_flamethrower_boxsize"); + static auto tf_flamethrower_boxsize = H::ConVars.FindVar("tf_flamethrower_boxsize"); const float flHull = tf_flamethrower_boxsize->GetFloat(); SDK::GetProjectileFireSetup(pPlayer, vAngles, { 40.f, 5.f, 0.f }, vPos, vAngle, true, bQuick, false); @@ -204,7 +204,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap case TF_WEAPON_BAT_WOOD: case TF_WEAPON_BAT_GIFTWRAP: { - static auto tf_scout_stunball_base_speed = U::ConVars.FindVar("tf_scout_stunball_base_speed"); + static auto tf_scout_stunball_base_speed = H::ConVars.FindVar("tf_scout_stunball_base_speed"); const bool bWrapAssassin = pWeapon->GetWeaponID() == TF_WEAPON_BAT_GIFTWRAP; SDK::GetProjectileFireSetup(pPlayer, vAngles, { 0.f, 0.f, 0.f }, vPos, vAngle, true, bQuick); @@ -239,8 +239,8 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap } case TF_WEAPON_GRAPPLINGHOOK: { - static auto tf_grapplinghook_projectile_speed = U::ConVars.FindVar("tf_grapplinghook_projectile_speed"); - static auto tf_grapplinghook_max_distance = U::ConVars.FindVar("tf_grapplinghook_max_distance"); + static auto tf_grapplinghook_projectile_speed = H::ConVars.FindVar("tf_grapplinghook_projectile_speed"); + static auto tf_grapplinghook_max_distance = H::ConVars.FindVar("tf_grapplinghook_max_distance"); SDK::GetProjectileFireSetup(pPlayer, vAngles, { 23.5f, -8.f, -3.f }, vPos, vAngle, !bTrace ? true : false, bQuick); @@ -594,7 +594,7 @@ void CProjectileSimulation::RunTick(ProjectileInfo& tProjInfo, bool bPath) // bu /* // params.maxVelocity limits velocity uniformly Vec3 vVelocity, vAngular; m_pObj->GetVelocity(&vVelocity, &vAngular); - static auto sv_maxvelocity = U::ConVars.FindVar("sv_maxvelocity"); + static auto sv_maxvelocity = H::ConVars.FindVar("sv_maxvelocity"); const float flMaxVel = sv_maxvelocity->GetFloat(); vVelocity = { std::clamp(vVelocity.x, -flMaxVel, flMaxVel), std::clamp(vVelocity.y, -flMaxVel, flMaxVel), std::clamp(vVelocity.z, -flMaxVel, flMaxVel) }; m_pObj->SetVelocity(&vVelocity, &vAngular); diff --git a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h index 87a8748f..5dc9d161 100644 --- a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h +++ b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.h @@ -149,7 +149,7 @@ public: { float flReturn = 0.f; - static auto sv_gravity = U::ConVars.FindVar("sv_gravity"); + static auto sv_gravity = H::ConVars.FindVar("sv_gravity"); float flGravity = sv_gravity->GetFloat() / 800.f; switch (pProjectile->GetClassID()) { diff --git a/Amalgam/src/Features/Ticks/Ticks.cpp b/Amalgam/src/Features/Ticks/Ticks.cpp index 31674706..2e9faaac 100644 --- a/Amalgam/src/Features/Ticks/Ticks.cpp +++ b/Amalgam/src/Features/Ticks/Ticks.cpp @@ -188,7 +188,7 @@ void CTicks::Move(float accumulated_extra_samples, bool bFinalTick) else m_iWait = 2; - static auto sv_maxusrcmdprocessticks = U::ConVars.FindVar("sv_maxusrcmdprocessticks"); + static auto sv_maxusrcmdprocessticks = H::ConVars.FindVar("sv_maxusrcmdprocessticks"); m_iMaxShift = sv_maxusrcmdprocessticks->GetInt(); if (Vars::Misc::Game::AntiCheatCompatibility.Value) m_iMaxShift = std::min(m_iMaxShift, 8); @@ -310,7 +310,7 @@ void CTicks::End(CTFPlayer* pLocal, CUserCmd* pCmd) bool CTicks::CanChoke() { - static auto sv_maxusrcmdprocessticks = U::ConVars.FindVar("sv_maxusrcmdprocessticks"); + static auto sv_maxusrcmdprocessticks = H::ConVars.FindVar("sv_maxusrcmdprocessticks"); int iMaxTicks = sv_maxusrcmdprocessticks->GetInt(); if (Vars::Misc::Game::AntiCheatCompatibility.Value) iMaxTicks = std::min(iMaxTicks, 8); @@ -376,7 +376,7 @@ Vec3 CTicks::GetShootPos() void CTicks::SaveShootAngle(CUserCmd* pCmd, bool bSendPacket) { - static auto sv_maxusrcmdprocessticks_holdaim = U::ConVars.FindVar("sv_maxusrcmdprocessticks_holdaim"); + static auto sv_maxusrcmdprocessticks_holdaim = H::ConVars.FindVar("sv_maxusrcmdprocessticks_holdaim"); if (bSendPacket) m_bShootAngle = false; diff --git a/Amalgam/src/Features/Visuals/ESP/ESP.cpp b/Amalgam/src/Features/Visuals/ESP/ESP.cpp index 82d4d403..ca5ce26e 100644 --- a/Amalgam/src/Features/Visuals/ESP/ESP.cpp +++ b/Amalgam/src/Features/Visuals/ESP/ESP.cpp @@ -60,30 +60,35 @@ static inline void StorePlayer(CTFPlayer* pPlayer, CTFPlayer* pLocal, Group_t* p if (pGroup->m_iESP & ESPEnum::Labels) { - std::vector vTags = {}; + std::vector> vTags = {}; for (auto& iID : F::PlayerUtils.GetPlayerTags(uAccountID)) { auto pTag = F::PlayerUtils.GetTag(iID); if (pTag && pTag->m_bLabel) - vTags.push_back(pTag); + vTags.emplace_back(pTag->m_sName, pTag->m_tColor, pTag->m_iPriority); } if (H::Entities.IsFriend(uAccountID)) { auto pTag = &F::PlayerUtils.m_vTags[F::PlayerUtils.TagToIndex(FRIEND_TAG)]; if (pTag->m_bLabel) - vTags.push_back(pTag); + vTags.emplace_back(pTag->m_sName, pTag->m_tColor, pTag->m_iPriority); } - if (H::Entities.InParty(uAccountID)) + if (auto iParty = H::Entities.GetParty(uAccountID)) { auto pTag = &F::PlayerUtils.m_vTags[F::PlayerUtils.TagToIndex(PARTY_TAG)]; - if (pTag->m_bLabel) - vTags.push_back(pTag); + if (int iPartyCount = H::Entities.GetPartyCount() + 1; pTag->m_bLabel) + { + if (!--iParty) + vTags.emplace_back(pTag->m_sName, pTag->m_tColor, pTag->m_iPriority); + else + vTags.emplace_back(std::format("{}: {}", pTag->m_sName, iParty), pTag->m_tColor.HueShift(iParty * 360.f / iPartyCount), pTag->m_iPriority); + } } if (H::Entities.IsF2P(uAccountID)) { auto pTag = &F::PlayerUtils.m_vTags[F::PlayerUtils.TagToIndex(F2P_TAG)]; if (pTag->m_bLabel) - vTags.push_back(pTag); + vTags.emplace_back(pTag->m_sName, pTag->m_tColor, pTag->m_iPriority); } if (!vTags.empty()) @@ -91,14 +96,14 @@ static inline void StorePlayer(CTFPlayer* pPlayer, CTFPlayer* pLocal, Group_t* p std::sort(vTags.begin(), vTags.end(), [&](const auto a, const auto b) -> bool { // sort by priority if unequal - if (a->m_iPriority != b->m_iPriority) - return a->m_iPriority > b->m_iPriority; + if (std::get<2>(a) != std::get<2>(b)) + return std::get<2>(a) > std::get<2>(b); - return a->m_sName < b->m_sName; + return std::get<0>(a) < std::get<0>(b); }); - for (auto& pTag : vTags) - tCache.m_vText.emplace_back(ALIGN_TOPRIGHT, pTag->m_sName, pTag->m_tColor, pTag->m_tColor.IsColorDark() ? Color_t(255, 255, 255) : Color_t(0, 0, 0)); + for (auto& [sName, tColor, _] : vTags) + tCache.m_vText.emplace_back(ALIGN_TOPRIGHT, sName, tColor, tColor.IsColorDark() ? Color_t(255, 255, 255) : Color_t(0, 0, 0)); } } } @@ -858,8 +863,21 @@ void CESP::DrawPlayers() if (tCache.m_iClassIcon) { - int size = H::Draw.Scale(18, Scale_Round); - H::Draw.Texture(m, t - tOffset, size, size, tCache.m_iClassIcon - 1, ALIGN_BOTTOM); + const char* sTexture = "vgui/glyph_multiplayer.vtf"; + switch (tCache.m_iClassIcon) + { + case TF_CLASS_SCOUT: sTexture = "hud/leaderboard_class_scout.vtf"; break; + case TF_CLASS_SOLDIER: sTexture = "hud/leaderboard_class_soldier.vtf"; break; + case TF_CLASS_PYRO: sTexture = "hud/leaderboard_class_pyro.vtf"; break; + case TF_CLASS_DEMOMAN: sTexture = "hud/leaderboard_class_demo.vtf"; break; + case TF_CLASS_HEAVY: sTexture = "hud/leaderboard_class_heavy.vtf"; break; + case TF_CLASS_ENGINEER: sTexture = "hud/leaderboard_class_engineer.vtf"; break; + case TF_CLASS_MEDIC: sTexture = "hud/leaderboard_class_medic.vtf"; break; + case TF_CLASS_SNIPER: sTexture = "hud/leaderboard_class_sniper.vtf"; break; + case TF_CLASS_SPY: sTexture = "hud/leaderboard_class_spy.vtf"; break; + } + int iSize = H::Draw.Scale(18, Scale_Round); + H::Draw.Texture(sTexture, m, t - tOffset, iSize, iSize, ALIGN_BOTTOM); } if (tCache.m_pWeaponIcon) diff --git a/Amalgam/src/Features/Visuals/Visuals.cpp b/Amalgam/src/Features/Visuals/Visuals.cpp index 6239128f..b1800675 100644 --- a/Amalgam/src/Features/Visuals/Visuals.cpp +++ b/Amalgam/src/Features/Visuals/Visuals.cpp @@ -651,7 +651,7 @@ MAKE_HOOK(NDebugOverlay_BoxAngles, S::NDebugOverlay_BoxAngles(), void, void CVisuals::FOV(CTFPlayer* pLocal, CViewSetup* pView) { - static auto fov_desired = U::ConVars.FindVar("fov_desired"); + static auto fov_desired = H::ConVars.FindVar("fov_desired"); bool bZoomed = pLocal->InCond(TF_COND_ZOOMED); float flRegularFOV = fov_desired->GetFloat(); @@ -697,7 +697,7 @@ void CVisuals::ThirdPerson(CTFPlayer* pLocal, CViewSetup* pView) I::Input->CAM_ToFirstPerson(); pLocal->ThirdPersonSwitch(); - static auto cam_ideallag = U::ConVars.FindVar("cam_ideallag"); + static auto cam_ideallag = H::ConVars.FindVar("cam_ideallag"); cam_ideallag->SetValue(0.f); if (I::Input->CAM_IsThirdPerson()) @@ -1016,7 +1016,7 @@ void CVisuals::CreateMove(CTFPlayer* pLocal, CTFWeaponBase* pWeapon) iOldMedigunCharge = iNewMedigunCharge; } - static auto r_aspectratio = U::ConVars.FindVar("r_aspectratio"); + static auto r_aspectratio = H::ConVars.FindVar("r_aspectratio"); static float flStaticRatio = 0.f; float flOldRatio = flStaticRatio; float flNewRatio = flStaticRatio = Vars::Visuals::UI::AspectRatio.Value; diff --git a/Amalgam/src/Hooks/CBaseEntity_SetAbsVelocity.cpp b/Amalgam/src/Hooks/CBaseEntity_SetAbsVelocity.cpp index a20d162c..11982687 100644 --- a/Amalgam/src/Hooks/CBaseEntity_SetAbsVelocity.cpp +++ b/Amalgam/src/Hooks/CBaseEntity_SetAbsVelocity.cpp @@ -15,7 +15,7 @@ public: float flGravityCorrection = 0.f; if (bZ) { - static auto sv_gravity = U::ConVars.FindVar("sv_gravity"); + static auto sv_gravity = H::ConVars.FindVar("sv_gravity"); float flDeltaTicks = float(iDeltaTicks) + 0.5f; // ? flGravityCorrection = (powf(flDeltaTicks, 2.f) - flDeltaTicks) / 2.f * sv_gravity->GetFloat() * powf(TICK_INTERVAL, 2); } @@ -83,7 +83,7 @@ MAKE_HOOK(CBaseEntity_SetAbsVelocity, S::CBaseEntity_SetAbsVelocity(), void, if (iDeltaTicks <= 0) return; - static auto sv_lagcompensation_teleport_dist = U::ConVars.FindVar("sv_lagcompensation_teleport_dist"); + static auto sv_lagcompensation_teleport_dist = H::ConVars.FindVar("sv_lagcompensation_teleport_dist"); float flDist = powf(sv_lagcompensation_teleport_dist->GetFloat(), 2.f) * iDeltaTicks; if ((tNewRecord.m_vecOrigin - tOldRecord.m_vecOrigin).Length2DSqr() >= flDist) return pRecords->clear(); @@ -122,7 +122,7 @@ MAKE_HOOK(CBaseEntity_SetAbsVelocity, S::CBaseEntity_SetAbsVelocity(), void, FloatRange_t flPositionRange = { tAxisInfo[i].m_flNewAxisValue + flVelocityRange.Max * flRewind, tAxisInfo[i].m_flNewAxisValue + flVelocityRange.Min * flRewind }; if (i == 2) { - static auto sv_gravity = U::ConVars.FindVar("sv_gravity"); + static auto sv_gravity = H::ConVars.FindVar("sv_gravity"); float flGravityCorrection = sv_gravity->GetFloat() * powf(flRewind + TICK_INTERVAL / 2, 2.f) / 2; flPositionRange.Min -= flGravityCorrection, flPositionRange.Max -= flGravityCorrection; } diff --git a/Amalgam/src/Hooks/CNetChannel_SendNetMsg.cpp b/Amalgam/src/Hooks/CNetChannel_SendNetMsg.cpp index 696c7964..8a5c26fb 100644 --- a/Amalgam/src/Hooks/CNetChannel_SendNetMsg.cpp +++ b/Amalgam/src/Hooks/CNetChannel_SendNetMsg.cpp @@ -81,7 +81,7 @@ MAKE_HOOK(CNetChannel_SendNetMsg, S::CNetChannel_SendNetMsg(), bool, auto cvarName = reinterpret_cast(pMsg[6]); if (!cvarName) break; - auto pConVar = U::ConVars.FindVar(cvarName); + auto pConVar = H::ConVars.FindVar(cvarName); if (!pConVar) break; static std::string sValue = ""; @@ -155,7 +155,7 @@ MAKE_HOOK(CNetChannel_SendNetMsg, S::CNetChannel_SendNetMsg(), bool, if (!F::Ticks.m_bSpeedhack) { - static auto sv_maxusrcmdprocessticks = U::ConVars.FindVar("sv_maxusrcmdprocessticks"); + static auto sv_maxusrcmdprocessticks = H::ConVars.FindVar("sv_maxusrcmdprocessticks"); const int iAllowedNewCommands = std::max(sv_maxusrcmdprocessticks->GetInt() - F::Ticks.m_iShiftedTicks, 0); const int iCmdCount = pMsg->m_nNewCommands + pMsg->m_nBackupCommands - 3; if (iCmdCount > iAllowedNewCommands) diff --git a/Amalgam/src/Hooks/R_DrawSkyBox.cpp b/Amalgam/src/Hooks/R_DrawSkyBox.cpp index 9eb2ecc6..ce0f4395 100644 --- a/Amalgam/src/Hooks/R_DrawSkyBox.cpp +++ b/Amalgam/src/Hooks/R_DrawSkyBox.cpp @@ -13,7 +13,7 @@ MAKE_HOOK(R_DrawSkyBox, S::R_DrawSkyBox(), void, if (FNV1A::Hash32(Vars::Visuals::World::SkyboxChanger.Value.c_str()) == FNV1A::Hash32Const("Off") || Vars::Visuals::UI::CleanScreenshots.Value && I::EngineClient->IsTakingScreenshot()) return CALL_ORIGINAL(zFar, nDrawFlags); - static auto sv_skyname = U::ConVars.FindVar("sv_skyname"); + static auto sv_skyname = H::ConVars.FindVar("sv_skyname"); std::string sOriginal = sv_skyname->GetString(); sv_skyname->SetValue(Vars::Visuals::World::SkyboxChanger.Value.c_str()); CALL_ORIGINAL(zFar, nDrawFlags); diff --git a/Amalgam/src/Utils/ConVars/ConVars.cpp b/Amalgam/src/SDK/Helpers/ConVars/ConVars.cpp similarity index 93% rename from Amalgam/src/Utils/ConVars/ConVars.cpp rename to Amalgam/src/SDK/Helpers/ConVars/ConVars.cpp index 8165771f..98a16d00 100644 --- a/Amalgam/src/Utils/ConVars/ConVars.cpp +++ b/Amalgam/src/SDK/Helpers/ConVars/ConVars.cpp @@ -1,6 +1,6 @@ #include "ConVars.h" -#include "../../SDK/Definitions/Interfaces/ICVar.h" +#include "../../Definitions/Interfaces/ICVar.h" bool CConVars::Unlock() { diff --git a/Amalgam/src/Utils/ConVars/ConVars.h b/Amalgam/src/SDK/Helpers/ConVars/ConVars.h similarity index 63% rename from Amalgam/src/Utils/ConVars/ConVars.h rename to Amalgam/src/SDK/Helpers/ConVars/ConVars.h index 0ac246d4..fc07a45c 100644 --- a/Amalgam/src/Utils/ConVars/ConVars.h +++ b/Amalgam/src/SDK/Helpers/ConVars/ConVars.h @@ -1,7 +1,7 @@ #pragma once -#include "../Macros/Macros.h" -#include "../../SDK/Definitions/Misc/ConVar.h" -#include "../Hash/FNV1A.h" +#include "../../Definitions/Misc/ConVar.h" +#include "../../../Utils/Macros/Macros.h" +#include "../../../Utils/Hash/FNV1A.h" #include class CConVars @@ -18,4 +18,4 @@ public: ConVar* FindVar(const char* sCVar); }; -ADD_FEATURE_CUSTOM(CConVars, ConVars, U); \ No newline at end of file +ADD_FEATURE_CUSTOM(CConVars, ConVars, H); \ No newline at end of file diff --git a/Amalgam/src/SDK/Helpers/Draw/Draw.cpp b/Amalgam/src/SDK/Helpers/Draw/Draw.cpp index 63e1029c..62ddc3c4 100644 --- a/Amalgam/src/SDK/Helpers/Draw/Draw.cpp +++ b/Amalgam/src/SDK/Helpers/Draw/Draw.cpp @@ -1,7 +1,6 @@ #include "Draw.h" #include "../../SDK.h" -#include "Icons.h" #include "../../Definitions/Interfaces.h" #include "../../../Utils/Math/Math.h" #include "../../../Utils/Timer/Timer.h" @@ -58,9 +57,7 @@ void CDraw::UpdateW2SMatrix() CViewSetup tViewSetup; if (I::Client->GetPlayerView(tViewSetup)) { - static VMatrix mWorldToView; - static VMatrix mViewToProjection; - static VMatrix mWorldToPixels; + static VMatrix mWorldToView, mViewToProjection, mWorldToPixels; I::RenderView->GetMatricesForView(tViewSetup, &mWorldToView, &mViewToProjection, &m_mWorldToProjection, &mWorldToPixels); } } @@ -343,8 +340,10 @@ void CDraw::LineCircle(int x, int y, float iRadius, int iSegments, Color_t tColo I::MatSystemSurface->DrawOutlinedCircle(x, y, iRadius, iSegments); } -void CDraw::Texture(int x, int y, int w, int h, int iId, EAlign eAlign) +void CDraw::Texture(const char* sTexture, int x, int y, int w, int h, EAlign eAlign) { + static std::unordered_map mTextures = {}; + switch (eAlign) { case ALIGN_TOPLEFT: break; @@ -358,14 +357,9 @@ void CDraw::Texture(int x, int y, int w, int h, int iId, EAlign eAlign) case ALIGN_BOTTOMRIGHT: x -= w; y -= h; break; } - int nTexture = 0; - if (ICONS::TEXTURES[iId].first != -1) - nTexture = ICONS::TEXTURES[iId].first; - else - { - nTexture = ICONS::TEXTURES[iId].first = I::MatSystemSurface->CreateNewTextureID(); - I::MatSystemSurface->DrawSetTextureFile(nTexture, ICONS::TEXTURES[iId].second.c_str(), false, true); - } + auto& nTexture = mTextures[FNV1A::Hash32Const(sTexture)]; + if (!nTexture) + I::MatSystemSurface->DrawSetTextureFile(nTexture = I::MatSystemSurface->CreateNewTextureID(), sTexture, false, true); I::MatSystemSurface->DrawSetColor(255, 255, 255, 255); I::MatSystemSurface->DrawSetTexture(nTexture); diff --git a/Amalgam/src/SDK/Helpers/Draw/Draw.h b/Amalgam/src/SDK/Helpers/Draw/Draw.h index 3fe6de4f..a85be508 100644 --- a/Amalgam/src/SDK/Helpers/Draw/Draw.h +++ b/Amalgam/src/SDK/Helpers/Draw/Draw.h @@ -92,7 +92,7 @@ public: void FillCircle(int x, int y, float iRadius, int iSegments, Color_t tColor); void LineCircle(int x, int y, float iRadius, int iSegments, Color_t tColor); - void Texture(int x, int y, int w, int h, int iId, EAlign eAlign = ALIGN_CENTER); + void Texture(const char* sTexture, int x, int y, int w, int h, EAlign eAlign = ALIGN_CENTER); CHudTexture* GetIcon(const char* szIcon, int eIconFormat = 0); int CreateTextureFromArray(const unsigned char* rgba, int w, int h); void DrawHudTexture(float x, float y, float s, const CHudTexture* pTexture, Color_t tColor = { 255, 255, 255, 255 }); diff --git a/Amalgam/src/SDK/Helpers/Draw/Icons.h b/Amalgam/src/SDK/Helpers/Draw/Icons.h deleted file mode 100644 index 0c5516d8..00000000 --- a/Amalgam/src/SDK/Helpers/Draw/Icons.h +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once -#include - -namespace ICONS -{ - inline std::vector> TEXTURES = { - { -1, "hud/leaderboard_class_scout.vtf" }, - { -1, "hud/leaderboard_class_sniper.vtf" }, - { -1, "hud/leaderboard_class_soldier.vtf" }, - { -1, "hud/leaderboard_class_demo.vtf" }, - { -1, "hud/leaderboard_class_medic.vtf" }, - { -1, "hud/leaderboard_class_heavy.vtf" }, - { -1, "hud/leaderboard_class_pyro.vtf" }, - { -1, "hud/leaderboard_class_spy.vtf" }, - { -1, "hud/leaderboard_class_engineer.vtf" }, - { -1, "vgui/class_portraits/scout_alpha.vtf" }, - { -1, "vgui/class_portraits/sniper_alpha.vtf" }, - { -1, "vgui/class_portraits/soldier_alpha.vtf" }, - { -1, "vgui/class_portraits/demoman_alpha.vtf" }, - { -1, "vgui/class_portraits/medic_alpha.vtf" }, - { -1, "vgui/class_portraits/heavy_alpha.vtf" }, - { -1, "vgui/class_portraits/pyro_alpha.vtf" }, - { -1, "vgui/class_portraits/spy_alpha.vtf" }, - { -1, "vgui/class_portraits/engineer_alpha.vtf" }, - { -1, "vgui/class_portraits/scout_blue_alpha.vtf" }, - { -1, "vgui/class_portraits/sniper_blue_alpha.vtf" }, - { -1, "vgui/class_portraits/soldier_blue_alpha.vtf" }, - { -1, "vgui/class_portraits/demoman_blue_alpha.vtf" }, - { -1, "vgui/class_portraits/medic_blue_alpha.vtf" }, - { -1, "vgui/class_portraits/heavy_blue_alpha.vtf" }, - { -1, "vgui/class_portraits/pyro_blue_alpha.vtf" }, - { -1, "vgui/class_portraits/spy_blue_alpha.vtf" }, - { -1, "vgui/class_portraits/engineer_blue_alpha.vtf" }, - { -1, "hud/hud_obj_status_sentry_1.vtf" }, - { -1, "hud/hud_obj_status_sentry_2.vtf" }, - { -1, "hud/hud_obj_status_sentry_3.vtf" }, - { -1, "hud/hud_obj_status_dispenser.vtf" }, - { -1, "hud/hud_obj_status_tele_entrance.vtf" }, - { -1, "hud/hud_obj_status_tele_exit.vtf" }, - { -1, "sprites/healbeam.vtf" }, - { -1, "hud/hud_obj_status_ammo_64.vtf" }, - { -1, "hud/mvm_cash.vtf" }, - { -1, "effects/powerup_supernova_icon.vtf" }, - { -1, "hud/ico_demolish.vtf" }, - { -1, "vgui/spellbook_book.vtf" }, - { -1, "backpack/player/items/crafting/hwn2015_gargoyle_stone.vtf" } - }; -} \ No newline at end of file diff --git a/Amalgam/src/SDK/Helpers/Entities/Entities.cpp b/Amalgam/src/SDK/Helpers/Entities/Entities.cpp index c7b82185..506ca6a9 100644 --- a/Amalgam/src/SDK/Helpers/Entities/Entities.cpp +++ b/Amalgam/src/SDK/Helpers/Entities/Entities.cpp @@ -201,6 +201,28 @@ void CEntities::Store() mParties[uAccountID] = 1; } } + + std::map> mParties2 = {}; + for (auto& [uAccountID, uParty] : mParties) + { + if (uParty) + mParties2[uParty].push_back(uAccountID); + } + for (auto it = mParties2.begin(); it != mParties2.end();) + { + if (it->second.size() > 1) + it++; + else + it = mParties2.erase(it); + } + mParties.clear(); + uint64_t uPartyCount = 0; for (auto& [uParty, vAccountIDs] : mParties2) + { + int iParty = uParty == 1 ? 1 : ++uPartyCount + 1; + for (auto uAccountID : vAccountIDs) + mParties[uAccountID] = iParty; + } + m_iPartyCount = uPartyCount; } for (int n = 1; n <= I::EngineClient->GetMaxClients(); n++) { @@ -506,5 +528,6 @@ bool CEntities::IsF2P(int iIndex) { return m_mIF2P[iIndex]; } bool CEntities::IsF2P(uint32_t uAccountID) { return m_mUF2P[uAccountID]; } int CEntities::GetLevel(int iIndex) { return m_mILevels.contains(iIndex) ? m_mILevels[iIndex] : -2; } int CEntities::GetLevel(uint32_t uAccountID) { return m_mULevels.contains(uAccountID) ? m_mULevels[uAccountID] : -2; } -uint64_t CEntities::GetParty(int iIndex) { return m_mIParty.contains(iIndex) ? m_mIParty[iIndex] : 0; } -uint64_t CEntities::GetParty(uint32_t uAccountID) { return m_mUParty.contains(uAccountID) ? m_mUParty[uAccountID] : 0; } \ No newline at end of file +int CEntities::GetParty(int iIndex) { return m_mIParty.contains(iIndex) ? m_mIParty[iIndex] : 0; } +int CEntities::GetParty(uint32_t uAccountID) { return m_mUParty.contains(uAccountID) ? m_mUParty[uAccountID] : 0; } +int CEntities::GetPartyCount() { return m_iPartyCount; } \ No newline at end of file diff --git a/Amalgam/src/SDK/Helpers/Entities/Entities.h b/Amalgam/src/SDK/Helpers/Entities/Entities.h index 396775f6..2bd2c0b3 100644 --- a/Amalgam/src/SDK/Helpers/Entities/Entities.h +++ b/Amalgam/src/SDK/Helpers/Entities/Entities.h @@ -2,7 +2,6 @@ #include "../../../Utils/Macros/Macros.h" #include "../../Definitions/Classes.h" #include "../../Vars.h" -#include Enum(Entity, Invalid = -1, PlayerAll, PlayerEnemy, PlayerTeam, @@ -48,13 +47,14 @@ private: std::unordered_map m_mUPriorities = {}; std::unordered_map m_mIFriends = {}; std::unordered_map m_mUFriends = {}; - std::unordered_map m_mIParty = {}; - std::unordered_map m_mUParty = {}; + std::unordered_map m_mIParty = {}; + std::unordered_map m_mUParty = {}; std::unordered_map m_mIF2P = {}; std::unordered_map m_mUF2P = {}; std::unordered_map m_mILevels = {}; std::unordered_map m_mULevels = {}; uint32_t m_uAccountID; + int m_iPartyCount = 0; public: void Store(); @@ -95,8 +95,9 @@ public: bool IsF2P(uint32_t uAccountID); int GetLevel(int iIndex); int GetLevel(uint32_t uAccountID); - uint64_t GetParty(int iIndex); - uint64_t GetParty(uint32_t uAccountID); + int GetParty(int iIndex); + int GetParty(uint32_t uAccountID); + int GetPartyCount(); }; ADD_FEATURE_CUSTOM(CEntities, Entities, H); \ No newline at end of file diff --git a/Amalgam/src/SDK/Helpers/TraceFilters/TraceFilters.cpp b/Amalgam/src/SDK/Helpers/TraceFilters/TraceFilters.cpp index 2982a4cf..46415000 100644 --- a/Amalgam/src/SDK/Helpers/TraceFilters/TraceFilters.cpp +++ b/Amalgam/src/SDK/Helpers/TraceFilters/TraceFilters.cpp @@ -31,12 +31,10 @@ bool CTraceFilterHitscan::ShouldHitEntity(IHandleEntity* pServerEntity, int nCon case ETFClassID::CObjectSentrygun: case ETFClassID::CObjectDispenser: case ETFClassID::CObjectTeleporter: - { if (iType != SKIP_CHECK && (iWeapon == WEAPON_INCLUDE ? bWeapon : !bWeapon)) return iType == FORCE_HIT ? true : false; return pEntity->m_iTeamNum() != iTeam; } - } return true; } @@ -84,7 +82,6 @@ bool CTraceFilterCollideable::ShouldHitEntity(IHandleEntity* pServerEntity, int return pEntity->m_iTeamNum() != iTeam; break; case ETFClassID::CTFPlayer: - { if (iPlayer == PLAYER_ALL) return true; if (iPlayer == PLAYER_NONE) @@ -92,7 +89,6 @@ bool CTraceFilterCollideable::ShouldHitEntity(IHandleEntity* pServerEntity, int if (iType != SKIP_CHECK && (iWeapon == WEAPON_INCLUDE ? bWeapon : !bWeapon)) return iType == FORCE_HIT ? true : false; return pEntity->m_iTeamNum() != iTeam; - } case ETFClassID::CBaseObject: case ETFClassID::CObjectSentrygun: case ETFClassID::CObjectDispenser: return iObject == OBJECT_ALL ? true : iObject == OBJECT_NONE ? false : pEntity->m_iTeamNum() != iTeam; @@ -102,9 +98,8 @@ bool CTraceFilterCollideable::ShouldHitEntity(IHandleEntity* pServerEntity, int //case ETFClassID::CMerasmus: //case ETFClassID::CEyeballBoss: //case ETFClassID::CHeadlessHatman: - //case ETFClassID::CZombie: - case ETFClassID::CTFGrenadePipebombProjectile: - return bMisc ? true : false; + //case ETFClassID::CZombie: return bMisc; + case ETFClassID::CTFGrenadePipebombProjectile: return bMisc && pEntity->As()->m_iType() == TF_GL_MODE_REMOTE_DETONATE; } return false; @@ -135,9 +130,7 @@ bool CTraceFilterWorldAndPropsOnly::ShouldHitEntity(IHandleEntity* pServerEntity case ETFClassID::CObjectCartDispenser: case ETFClassID::CFuncTrackTrain: case ETFClassID::CFuncConveyor: return true; - case ETFClassID::CFuncRespawnRoomVisualizer: - if (nContentsMask & CONTENTS_PLAYERCLIP) - return pEntity->m_iTeamNum() != iTeam; + case ETFClassID::CFuncRespawnRoomVisualizer: return nContentsMask & CONTENTS_PLAYERCLIP && pEntity->m_iTeamNum() != iTeam; } return false; diff --git a/Amalgam/src/SDK/SDK.cpp b/Amalgam/src/SDK/SDK.cpp index e3ec4aeb..9157378b 100644 --- a/Amalgam/src/SDK/SDK.cpp +++ b/Amalgam/src/SDK/SDK.cpp @@ -619,7 +619,7 @@ int SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* CGameTrace trace = {}; CTraceFilterHitscan filter = {}; filter.pSkip = pLocal; - static auto tf_grapplinghook_max_distance = U::ConVars.FindVar("tf_grapplinghook_max_distance"); + static auto tf_grapplinghook_max_distance = H::ConVars.FindVar("tf_grapplinghook_max_distance"); const float flGrappleDistance = tf_grapplinghook_max_distance->GetFloat(); Trace(vPos, vPos + vForward * flGrappleDistance, MASK_SOLID, &filter, &trace); return trace.DidHit() && !(trace.surface.flags & SURF_SKY); @@ -785,7 +785,7 @@ void SDK::WalkTo(CUserCmd* pCmd, CTFPlayer* pLocal, Vec3& vTo, float flScale) void SDK::GetProjectileFireSetup(CTFPlayer* pPlayer, const Vec3& vAngIn, Vec3 vOffset, Vec3& vPosOut, Vec3& vAngOut, bool bPipes, bool bInterp, bool bAllowFlip) { - static auto cl_flipviewmodels = U::ConVars.FindVar("cl_flipviewmodels"); + static auto cl_flipviewmodels = H::ConVars.FindVar("cl_flipviewmodels"); if (bAllowFlip && FNV1A::Hash32(cl_flipviewmodels->GetString()) == FNV1A::Hash32Const("1")) vOffset.y *= -1.f; diff --git a/Amalgam/src/SDK/SDK.h b/Amalgam/src/SDK/SDK.h index 4f6ebc27..5128b7a0 100644 --- a/Amalgam/src/SDK/SDK.h +++ b/Amalgam/src/SDK/SDK.h @@ -2,6 +2,7 @@ #include "Vars.h" #include "Globals.h" +#include "Helpers/ConVars/ConVars.h" #include "Helpers/Entities/Entities.h" #include "Helpers/Draw/Draw.h" #include "Helpers/TraceFilters/TraceFilters.h" @@ -13,7 +14,6 @@ #include "../Utils/Interfaces/Interfaces.h" #include "../Utils/Hooks/Hooks.h" #include "../Utils/Memory/Memory.h" -#include "../Utils/ConVars/ConVars.h" #include "../Utils/KeyHandler/KeyHandler.h" #include "../Utils/Hash/FNV1A.h" #include "../Utils/Math/Math.h" diff --git a/Amalgam/src/SDK/Vars.h b/Amalgam/src/SDK/Vars.h index 16aab991..2d231bec 100644 --- a/Amalgam/src/SDK/Vars.h +++ b/Amalgam/src/SDK/Vars.h @@ -3,6 +3,7 @@ #include "../Utils/Macros/Macros.h" #include #include +#include #include #define DEFAULT_BIND -1