From 8862bfee0be70481cf3828297e9c19d0dd6022de Mon Sep 17 00:00:00 2001
From: rei-2 <174158077+rei-2@users.noreply.github.com>
Date: Tue, 31 Mar 2026 01:30:57 -0400
Subject: [PATCH] misc changes and fixes
---
Amalgam/Amalgam.vcxproj | 1 +
Amalgam/Amalgam.vcxproj.filters | 1 +
Amalgam/src/Core/Core.cpp | 2 +-
Amalgam/src/Features/Aimbot/Aimbot.cpp | 7 +-
.../Aimbot/AimbotGlobal/AimbotGlobal.cpp | 3 +-
.../Aimbot/AimbotHitscan/AimbotHitscan.cpp | 16 +-
.../Aimbot/AimbotMelee/AimbotMelee.cpp | 40 +-
.../AimbotProjectile/AimbotProjectile.cpp | 289 +-
.../AimbotProjectile/AimbotProjectile.h | 4 +-
.../Aimbot/AutoDetonate/AutoDetonate.cpp | 23 +-
.../Aimbot/AutoDetonate/AutoDetonate.h | 2 +
.../Aimbot/AutoRocketJump/AutoRocketJump.cpp | 9 +-
Amalgam/src/Features/Backtrack/Backtrack.cpp | 2 +-
Amalgam/src/Features/Configs/Configs.cpp | 7 +-
.../EnginePrediction/EnginePrediction.cpp | 13 +-
.../EnginePrediction/EnginePrediction.h | 8 +-
Amalgam/src/Features/ImGui/Menu/Components.h | 213 +-
Amalgam/src/Features/ImGui/Menu/Menu.cpp | 2315 +++++++++--------
Amalgam/src/Features/ImGui/Menu/Menu.h | 11 +-
Amalgam/src/Features/Misc/Misc.cpp | 7 +-
.../NoSpreadHitscan/NoSpreadHitscan.cpp | 2 +-
.../Features/PacketManip/FakeLag/FakeLag.cpp | 2 +-
Amalgam/src/Features/Resolver/Resolver.cpp | 2 +-
.../MovementSimulation/MovementSimulation.cpp | 66 +-
.../MovementSimulation/MovementSimulation.h | 1 +
.../ProjectileSimulation.cpp | 63 +-
Amalgam/src/Features/Ticks/Ticks.cpp | 47 +-
Amalgam/src/Features/Visuals/Chams/Chams.cpp | 10 +-
Amalgam/src/Features/Visuals/ESP/ESP.cpp | 26 +-
Amalgam/src/Features/Visuals/Glow/Glow.cpp | 10 +-
.../OffscreenArrows/OffscreenArrows.cpp | 3 +-
Amalgam/src/Features/Visuals/Visuals.cpp | 46 +-
Amalgam/src/Hooks/CM_TraceToDispTree.cpp | 4 +-
Amalgam/src/Hooks/CTFPlayer_GetMinFOV.cpp | 17 -
.../IMatSystemSurface_OnScreenSizeChanged.cpp | 2 +-
Amalgam/src/SDK/Definitions/Types.h | 99 +-
Amalgam/src/SDK/Helpers/Draw/Draw.cpp | 46 +-
Amalgam/src/SDK/Helpers/Draw/Draw.h | 10 +-
Amalgam/src/SDK/Helpers/Entities/Entities.cpp | 166 +-
Amalgam/src/SDK/Helpers/Entities/Entities.h | 51 +-
Amalgam/src/SDK/Helpers/Fonts/Fonts.cpp | 8 +-
Amalgam/src/SDK/Helpers/Fonts/Fonts.h | 4 +-
Amalgam/src/SDK/SDK.cpp | 2 +-
Amalgam/src/SDK/SDK.h | 10 -
Amalgam/src/SDK/Vars.h | 70 +-
Amalgam/src/Utils/Hooks/Hooks.h | 7 +-
Amalgam/src/Utils/Math/BaseMath.h | 202 ++
Amalgam/src/Utils/Math/Math.h | 226 +-
48 files changed, 2213 insertions(+), 1962 deletions(-)
create mode 100644 Amalgam/src/Utils/Math/BaseMath.h
diff --git a/Amalgam/Amalgam.vcxproj b/Amalgam/Amalgam.vcxproj
index a531a26d..3c33541e 100644
--- a/Amalgam/Amalgam.vcxproj
+++ b/Amalgam/Amalgam.vcxproj
@@ -1490,6 +1490,7 @@
+
diff --git a/Amalgam/Amalgam.vcxproj.filters b/Amalgam/Amalgam.vcxproj.filters
index c103b6eb..4206cdb1 100644
--- a/Amalgam/Amalgam.vcxproj.filters
+++ b/Amalgam/Amalgam.vcxproj.filters
@@ -610,6 +610,7 @@
+
diff --git a/Amalgam/src/Core/Core.cpp b/Amalgam/src/Core/Core.cpp
index 11c52648..4256f2c7 100644
--- a/Amalgam/src/Core/Core.cpp
+++ b/Amalgam/src/Core/Core.cpp
@@ -113,7 +113,7 @@ void CCore::Load()
if (m_bUnload = m_bFailed2 = !U::Hooks.Initialize() || !U::BytePatches.Initialize() || !H::Events.Initialize())
return;
F::Materials.LoadMaterials();
- H::Fonts.Reload(Vars::Menu::Scale[DEFAULT_BIND]);
+ H::Fonts.Reload();
F::Configs.LoadConfig(F::Configs.m_sCurrentConfig, false);
SDK::Output("Amalgam", "Loaded", DEFAULT_COLOR, OUTPUT_CONSOLE | OUTPUT_TOAST | OUTPUT_MENU | OUTPUT_DEBUG);
diff --git a/Amalgam/src/Features/Aimbot/Aimbot.cpp b/Amalgam/src/Features/Aimbot/Aimbot.cpp
index d5ff38f8..8456c0a3 100644
--- a/Amalgam/src/Features/Aimbot/Aimbot.cpp
+++ b/Amalgam/src/Features/Aimbot/Aimbot.cpp
@@ -96,7 +96,7 @@ void CAimbot::Draw(CTFPlayer* pLocal)
void CAimbot::Store(CBaseEntity* pEntity, size_t iSize)
{
- if (!Vars::Visuals::Simulation::RealPath.Value)
+ if (!Vars::Visuals::Prediction::RealPath.Value)
return;
if (!pEntity->IsPlayer())
@@ -104,7 +104,8 @@ void CAimbot::Store(CBaseEntity* pEntity, size_t iSize)
if (auto pResource = H::Entities.GetResource())
{
- m_tPath = { { pEntity->m_vecOrigin() }, I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Color_t(), Vars::Visuals::Simulation::RealPath.Value };
+ float flDuration = Vars::Visuals::Prediction::PlayerDrawDuration.Value ? Vars::Visuals::Prediction::PlayerDrawDuration.Value : 5.f;
+ m_tPath = { { pEntity->m_vecOrigin() }, I::GlobalVars->curtime + flDuration, Color_t(), Vars::Visuals::Prediction::RealPath.Value };
m_iSize = iSize;
m_iPlayer = pResource->m_iUserID(pEntity->entindex());
}
@@ -112,7 +113,7 @@ void CAimbot::Store(CBaseEntity* pEntity, size_t iSize)
void CAimbot::Store(bool bFrameStageNotify)
{
- if (!Vars::Visuals::Simulation::RealPath.Value)
+ if (!Vars::Visuals::Prediction::RealPath.Value)
return;
int iLag = 1;
diff --git a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp
index 48d5ce4b..61a5c37d 100644
--- a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp
+++ b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp
@@ -354,6 +354,7 @@ bool CAimbotGlobal::ShouldHoldAttack(CTFWeaponBase* pWeapon)
bool CAimbotGlobal::ValidBomb(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CBaseEntity* pBomb)
{
Vec3 vOrigin = pBomb->m_vecOrigin();
+ float flRadiusSqr = powf(300.f, 2);
CBaseEntity* pEntity;
for (CEntitySphereQuery sphere(vOrigin, 300.f);
@@ -365,7 +366,7 @@ bool CAimbotGlobal::ValidBomb(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CBaseEn
continue;
Vec3 vPos; pEntity->m_Collision()->CalcNearestPoint(vOrigin, &vPos);
- if (vOrigin.DistTo(vPos) > 300.f)
+ if (vOrigin.DistToSqr(vPos) > flRadiusSqr)
continue;
if (pEntity->IsPlayer() || pEntity->IsBuilding() || pEntity->IsNPC())
diff --git a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp
index 2c3c0d85..f0dfa9ae 100644
--- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp
+++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp
@@ -687,11 +687,22 @@ void CAimbotHitscan::Aim(CUserCmd* pCmd, Vec3& vAngle, int iMethod)
static inline void DrawVisuals(CTFPlayer* pLocal, Target_t& tTarget, int nWeaponID)
{
+ if (G::Attacking == 1)
+ {
+ G::AimTarget = { tTarget.m_pEntity->entindex(), I::GlobalVars->tickcount };
+ G::AimPoint = { tTarget.m_vPos, I::GlobalVars->tickcount };
+ }
+ else
+ {
+ G::AimTarget = { tTarget.m_pEntity->entindex(), I::GlobalVars->tickcount, 0 };
+ G::AimPoint = { tTarget.m_vPos, I::GlobalVars->tickcount, 0 };
+ }
+
if (G::Attacking == 1 && nWeaponID != TF_WEAPON_LASER_POINTER)
{
bool bLine = Vars::Visuals::Line::Enabled.Value;
bool bBoxes = Vars::Visuals::Hitbox::BonesEnabled.Value & Vars::Visuals::Hitbox::BonesEnabledEnum::OnShot;
- if (G::CanPrimaryAttack && (bLine || bBoxes))
+ if (bLine || bBoxes)
{
G::LineStorage.clear();
G::BoxStorage.clear();
@@ -796,9 +807,6 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC
break;
}
- G::AimTarget = { tTarget.m_pEntity->entindex(), I::GlobalVars->tickcount };
- G::AimPoint = { tTarget.m_vPos, I::GlobalVars->tickcount };
-
if (ShouldFire(pLocal, pWeapon, pCmd, tTarget))
{
switch (nWeaponID)
diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp
index 2c30a634..83e3caaa 100644
--- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp
+++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp
@@ -196,7 +196,7 @@ void CAimbotMelee::UpdateInfo(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCm
m_vEyePos = mMoveStorage[I::EngineClient->GetLocalPlayer()].m_MoveData.m_vecAbsOrigin + pLocal->m_vecViewOffset();
m_flRange = pWeapon->GetSwingRange();
- if (Vars::Visuals::Simulation::SwingLines.Value && Vars::Visuals::Simulation::PlayerPath.Value)
+ if (Vars::Visuals::Prediction::SwingLines.Value && Vars::Visuals::Prediction::PlayerPath.Value)
{
for (auto& [iIndex, tMoveStorage] : mMoveStorage)
m_mPaths[iIndex] = tMoveStorage.m_vPath;
@@ -210,10 +210,11 @@ void CAimbotMelee::UpdateInfo(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCm
for (auto& vPath : m_mPaths | std::views::values)
{
+ float flDuration = Vars::Visuals::Prediction::PlayerDrawDuration.Value;
if (Vars::Colors::PlayerPathIgnoreZ.Value.a)
- G::PathStorage.emplace_back(vPath, I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPathIgnoreZ.Value, Vars::Visuals::Simulation::PlayerPath.Value);
+ G::PathStorage.emplace_back(vPath, !flDuration ? -int(vPath.size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPathIgnoreZ.Value, Vars::Visuals::Prediction::PlayerPath.Value);
if (Vars::Colors::PlayerPath.Value.a)
- G::PathStorage.emplace_back(vPath, I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPath.Value, Vars::Visuals::Simulation::PlayerPath.Value, true);
+ G::PathStorage.emplace_back(vPath, !flDuration ? -int(vPath.size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPath.Value, Vars::Visuals::Prediction::PlayerPath.Value, true);
}
}
}
@@ -248,7 +249,7 @@ bool CAimbotMelee::CanBackstab(CBaseEntity* pTarget, CTFPlayer* pLocal, Vec3 vEy
if (auto pCmd = G::CurrentUserCmd;
m_mRecordMap[pLocal->entindex()].empty() && pCmd->viewangles != vEyeAngles && G::CanPrimaryAttack)
- { // repredict, prevent prediction error causing miss
+ { // repredict, prevent prediction error potentially causing miss
CUserCmd tOldCmd = *pCmd;
Vec3 vOldAngles = I::EngineClient->GetViewAngles();
int iOldAttacking = G::Attacking;
@@ -357,6 +358,7 @@ int CAimbotMelee::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pW
CGameTrace trace = {};
CTraceFilterHitscan filter = {};
filter.pSkip = pLocal;
+
for (auto pRecord : vRecords)
{
Vec3 vRestoreOrigin = tTarget.m_pEntity->GetAbsOrigin();
@@ -364,15 +366,16 @@ int CAimbotMelee::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pW
Vec3 vRestoreMaxs = tTarget.m_pEntity->m_vecMaxs();
tTarget.m_pEntity->SetAbsOrigin(pRecord->m_vOrigin);
- tTarget.m_pEntity->m_vecMins() = pRecord->m_vMins + PLAYER_ORIGIN_COMPRESSION; // account for origin compression
+ tTarget.m_pEntity->m_vecMins() = pRecord->m_vMins + PLAYER_ORIGIN_COMPRESSION;
tTarget.m_pEntity->m_vecMaxs() = pRecord->m_vMaxs - PLAYER_ORIGIN_COMPRESSION;
- Vec3 vDiff = { 0, 0, std::clamp(m_vEyePos.z - pRecord->m_vOrigin.z, pRecord->m_vMins.z, pRecord->m_vMaxs.z) };
- tTarget.m_vPos = pRecord->m_vOrigin + vDiff;
+ tTarget.m_vPos = m_vEyePos.Clamp(pRecord->m_vOrigin + tTarget.m_pEntity->m_vecMins(), pRecord->m_vOrigin + tTarget.m_pEntity->m_vecMaxs());
+ if (Vars::Aimbot::Melee::AutoBackstab.Value && pWeapon->GetWeaponID() == TF_WEAPON_KNIFE)
+ tTarget.m_vPos.x = pRecord->m_vOrigin.x, tTarget.m_vPos.y = pRecord->m_vOrigin.y;
Aim(G::CurrentUserCmd->viewangles, Math::CalcAngle(m_vEyePos, tTarget.m_vPos), tTarget.m_vAngleTo);
Vec3 vForward; Math::AngleVectors(tTarget.m_vAngleTo, &vForward);
- Vec3 vTraceEnd = m_vEyePos + (vForward * flRange);
+ Vec3 vTraceEnd = m_vEyePos + vForward * flRange;
SDK::TraceHull(m_vEyePos, vTraceEnd, {}, {}, MASK_SOLID, &filter, &trace);
bool bReturn = trace.m_pEnt && trace.m_pEnt == tTarget.m_pEntity;
@@ -393,7 +396,7 @@ int CAimbotMelee::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pW
{
tTarget.m_pRecord = pRecord;
tTarget.m_bBacktrack = tTarget.m_iTargetType == TargetEnum::Player;
-
+
return true;
}
else switch (Vars::Aimbot::General::AimType.Value)
@@ -404,7 +407,7 @@ int CAimbotMelee::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pW
auto vAngle = Math::CalcAngle(m_vEyePos, tTarget.m_vPos);
Math::AngleVectors(vAngle, &vForward);
- vTraceEnd = m_vEyePos + (vForward * flRange);
+ vTraceEnd = m_vEyePos + vForward * flRange;
SDK::TraceHull(m_vEyePos, vTraceEnd, vSwingMins, vSwingMaxs, MASK_SOLID, &filter, &trace);
if (trace.m_pEnt && trace.m_pEnt == tTarget.m_pEntity)
@@ -487,7 +490,10 @@ void CAimbotMelee::Aim(CUserCmd* pCmd, Vec3& vAngle, int iMethod)
static inline void DrawVisuals(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, Target_t& tTarget, std::unordered_map>& mPaths)
{
- bool bPath = Vars::Visuals::Simulation::SwingLines.Value && Vars::Visuals::Simulation::PlayerPath.Value;
+ G::AimTarget = { tTarget.m_pEntity->entindex(), I::GlobalVars->tickcount };
+ G::AimPoint = { tTarget.m_vPos, I::GlobalVars->tickcount };
+
+ bool bPath = Vars::Visuals::Prediction::SwingLines.Value && Vars::Visuals::Prediction::PlayerPath.Value;
bool bLine = Vars::Visuals::Line::Enabled.Value;
bool bBoxes = Vars::Visuals::Hitbox::BonesEnabled.Value & Vars::Visuals::Hitbox::BonesEnabledEnum::OnShot;
if (bPath || bLine || bBoxes)
@@ -500,15 +506,16 @@ static inline void DrawVisuals(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserC
if (bPath)
{
+ float flDuration = Vars::Visuals::Prediction::PlayerDrawDuration.Value;
if (Vars::Colors::PlayerPathIgnoreZ.Value.a)
{
- G::PathStorage.emplace_back(mPaths[I::EngineClient->GetLocalPlayer()], I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPathIgnoreZ.Value, Vars::Visuals::Simulation::PlayerPath.Value);
- G::PathStorage.emplace_back(mPaths[tTarget.m_pEntity->entindex()], I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPathIgnoreZ.Value, Vars::Visuals::Simulation::PlayerPath.Value);
+ G::PathStorage.emplace_back(mPaths[I::EngineClient->GetLocalPlayer()], !flDuration ? -int(mPaths[I::EngineClient->GetLocalPlayer()].size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPathIgnoreZ.Value, Vars::Visuals::Prediction::PlayerPath.Value);
+ G::PathStorage.emplace_back(mPaths[tTarget.m_pEntity->entindex()], !flDuration ? -int(mPaths[tTarget.m_pEntity->entindex()].size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPathIgnoreZ.Value, Vars::Visuals::Prediction::PlayerPath.Value);
}
if (Vars::Colors::PlayerPath.Value.a)
{
- G::PathStorage.emplace_back(mPaths[I::EngineClient->GetLocalPlayer()], I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPath.Value, Vars::Visuals::Simulation::PlayerPath.Value, true);
- G::PathStorage.emplace_back(mPaths[tTarget.m_pEntity->entindex()], I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPath.Value, Vars::Visuals::Simulation::PlayerPath.Value, true);
+ G::PathStorage.emplace_back(mPaths[I::EngineClient->GetLocalPlayer()], !flDuration ? -int(mPaths[I::EngineClient->GetLocalPlayer()].size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPath.Value, Vars::Visuals::Prediction::PlayerPath.Value, true);
+ G::PathStorage.emplace_back(mPaths[tTarget.m_pEntity->entindex()], !flDuration ? -int(mPaths[tTarget.m_pEntity->entindex()].size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPath.Value, Vars::Visuals::Prediction::PlayerPath.Value, true);
}
}
}
@@ -577,9 +584,6 @@ void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd
break;
}
- G::AimTarget = { tTarget.m_pEntity->entindex(), I::GlobalVars->tickcount };
- G::AimPoint = { tTarget.m_vPos, I::GlobalVars->tickcount };
-
if (Vars::Aimbot::General::AutoShoot.Value && pWeapon->m_flSmackTime() < 0.f)
{
if (m_bShouldSwing)
diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp
index 2e83b4c9..8e1b6a07 100644
--- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp
+++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp
@@ -432,8 +432,8 @@ static inline std::vector ComputePoints(float flRadius, int iSamples, bool
{
vPoints.reserve(iSamples + 1);
- float flRotateX = Vars::Aimbot::Projectile::SplashRotateX.Value < 0.f ? SDK::RandomFloat(0.f, 360.f) : Vars::Aimbot::Projectile::SplashRotateX.Value;
- float flRotateY = Vars::Aimbot::Projectile::SplashRotateY.Value < 0.f ? SDK::RandomFloat(0.f, 360.f) : Vars::Aimbot::Projectile::SplashRotateY.Value;
+ float flRotateX = Vars::Aimbot::Projectile::SplashRotateX.Value < 0.f ? SDK::StdRandomFloat(0.f, 360.f) : Vars::Aimbot::Projectile::SplashRotateX.Value;
+ float flRotateY = Vars::Aimbot::Projectile::SplashRotateY.Value < 0.f ? SDK::StdRandomFloat(0.f, 360.f) : Vars::Aimbot::Projectile::SplashRotateY.Value;
float a = Math::PI * (3.f - sqrtf(5.f));
for (int n = 0; n < iSamples; n++)
@@ -533,7 +533,7 @@ static inline void HandleFace(const Face_t& tFace, std::vector& vPoints
for (int i = 0; i < iSamples; i++)
{
- float flRandom1 = SDK::RandomFloat(), flRandom2 = SDK::RandomFloat();
+ float flRandom1 = SDK::StdRandomFloat(), flRandom2 = SDK::StdRandomFloat();
if (flRandom1 + flRandom2 > 1)
flRandom1 = 1 - flRandom1, flRandom2 = 1 - flRandom2;
@@ -579,20 +579,20 @@ void CAimbotProjectile::SetupSplashPoints(Vec3& vOrigin, std::vector& v
bool bAirSplash = AirSplash(m_tInfo.m_pWeapon);
auto fCheckNormal = [&](const Vec3& vNormal, const Vec3& vPoint, Vec3* pAngle = nullptr)
+ {
+ if (pAngle)
{
- if (pAngle)
- {
- Vec3 vForward, vRight, vUp; Math::AngleVectors(*pAngle, &vForward, &vRight, &vUp);
- Vec3 vShootPos = m_tInfo.m_vLocalEye + (vForward * m_tInfo.m_vOffset.x) + (vRight * m_tInfo.m_vOffset.y) + (vUp * m_tInfo.m_vOffset.z);
- vForward = (vShootPos - vPoint).Normalized();
- return vForward.Dot(vNormal) > 0;
- }
- else
- {
- Vec3 vForward = (m_tInfo.m_vLocalEye - vPoint).Normalized();
- return vForward.Dot(vNormal) > 0;
- }
- };
+ Vec3 vForward, vRight, vUp; Math::AngleVectors(*pAngle, &vForward, &vRight, &vUp);
+ Vec3 vShootPos = m_tInfo.m_vLocalEye + (vForward * m_tInfo.m_vOffset.x) + (vRight * m_tInfo.m_vOffset.y) + (vUp * m_tInfo.m_vOffset.z);
+ vForward = (vShootPos - vPoint).Normalized();
+ return vForward.Dot(vNormal) > 0;
+ }
+ else
+ {
+ Vec3 vForward = (m_tInfo.m_vLocalEye - vPoint).Normalized();
+ return vForward.Dot(vNormal) > 0;
+ }
+ };
// Trace
int iPoints = !m_tInfo.m_flGravity ? Vars::Aimbot::Projectile::SplashPointsDirect.Value : Vars::Aimbot::Projectile::SplashPointsArc.Value;
@@ -626,7 +626,7 @@ void CAimbotProjectile::SetupSplashPoints(Vec3& vOrigin, std::vector& v
if (bAirSplash && !trace.DidHit())
{
if (!Vars::Aimbot::Projectile::SplashAirCount.Value)
- vSplashPoints.emplace_back(vPoints[i] * SDK::RandomFloat() + vTargetCenter, PointTypeEnum::Air);
+ vSplashPoints.emplace_back(vPoints[i] * SDK::StdRandomFloat() + vTargetCenter, PointTypeEnum::Air);
else for (float r = 0; r < Vars::Aimbot::Projectile::SplashAirCount.Value; r++)
vSplashPoints.emplace_back(vPoints[i] * r / Vars::Aimbot::Projectile::SplashAirCount.Value + vTargetCenter, PointTypeEnum::Air);
}
@@ -672,7 +672,7 @@ void CAimbotProjectile::SetupSplashPoints(Vec3& vOrigin, std::vector& v
SDK::Output("Faces", std::format("{}", vFaces.size()).c_str(), {}, OUTPUT_CONSOLE);
#endif
- float flCutoff = Vars::Aimbot::Projectile::SplashSamplesCutoff.Value * powf(vFaces.size(), 2); s_flTotal = SDK::RandomFloat();
+ float flCutoff = Vars::Aimbot::Projectile::SplashSamplesCutoff.Value * powf(vFaces.size(), 2); s_flTotal = SDK::StdRandomFloat();
for (auto& tFace : vFaces)
{
HandleFace(tFace, vSplashPoints, flDensity, flRadius, flCutoff, vTargetEye, vTargetCenter, m_tInfo, trace, filter);
@@ -694,7 +694,17 @@ std::vector CAimbotProjectile::GetSplashPoints(Vec3 vOrigin, std::vecto
m_tInfo.m_pTarget->m_vPos = vOrigin;
Vec3 vTargetEye = vOrigin + m_tInfo.m_vTargetEye;
- float flRadiusSqr = powf(m_tInfo.m_flRadius, 2);
+ float flRadiusSqr = powf(m_tInfo.m_flRadius, 2), flRadiusAirSqr = flRadiusSqr;
+ if (Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::AirSplash && m_tInfo.m_pWeapon->GetWeaponID() == TF_WEAPON_PIPEBOMBLAUNCHER)
+ {
+ 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();
+ flRadiusAirSqr = powf(m_tInfo.m_flRadius * Math::RemapVal(TICKS_TO_TIME(iSimTime), flLiveTime, flLiveTime + flRampTime, flAirdetRadius, 1.f), 2);
+ }
for (auto it = vSplashPoints.begin(); it != vSplashPoints.end();)
{
@@ -716,9 +726,9 @@ std::vector CAimbotProjectile::GetSplashPoints(Vec3 vOrigin, std::vecto
}
std::sort(vPointDistances.begin(), vPointDistances.end(), [&](const auto& a, const auto& b) -> bool
- {
- return a.second < b.second;
- });
+ {
+ return a.second < b.second;
+ });
std::vector vPoints = {};
int iSplashCount = std::min(
@@ -737,7 +747,8 @@ std::vector CAimbotProjectile::GetSplashPoints(Vec3 vOrigin, std::vecto
if (bValid)
{
Vec3 vPos = {}; m_tInfo.m_pTarget->m_pEntity->m_Collision()->CalcNearestPoint(tPoint.m_vPoint, &vPos);
- bValid = tPoint.m_vPoint.DistToSqr(vPos) < flRadiusSqr;
+ float flRadiusSqrCheck = tPoint.m_iType == PointTypeEnum::Geometry ? flRadiusSqr : flRadiusAirSqr;
+ bValid = tPoint.m_vPoint.DistToSqr(vPos) < flRadiusSqrCheck;
}
if (bValid)
@@ -750,26 +761,7 @@ std::vector CAimbotProjectile::GetSplashPoints(Vec3 vOrigin, std::vecto
return vPoints;
}
-static inline float AABBLine(Vec3 vMins, Vec3 vMaxs, Vec3 vStart, Vec3 vDir)
-{
- Vec3 a = {
- (vMins.x - vStart.x) / vDir.x,
- (vMins.y - vStart.y) / vDir.y,
- (vMins.z - vStart.z) / vDir.z
- };
- Vec3 b = {
- (vMaxs.x - vStart.x) / vDir.x,
- (vMaxs.y - vStart.y) / vDir.y,
- (vMaxs.z - vStart.z) / vDir.z
- };
- Vec3 c = {
- std::min(a.x, b.x),
- std::min(a.y, b.y),
- std::min(a.z, b.z)
- };
- return std::max(std::max(c.x, c.y), c.z);
-}
-static inline Vec3 PullPoint(const Vec3& vPoint, Vec3 vLocalPos, Info_t& tInfo, const Vec3& vMins, const Vec3& vMaxs, const Vec3& vTargetPos)
+static inline Vec3 PullPoint(const Vec3& vPoint, Vec3 vLocalPos, Info_t& tInfo, const Vec3& vTargetPos, const Vec3& vMins, const Vec3& vMaxs)
{
auto fHeightenLocalPos = [&]()
{ // basic trajectory pass
@@ -792,7 +784,7 @@ static inline Vec3 PullPoint(const Vec3& vPoint, Vec3 vLocalPos, Info_t& tInfo,
vLocalPos = fHeightenLocalPos();
Vec3 vForward, vRight, vUp; Math::AngleVectors(Math::CalcAngle(vLocalPos, vPoint), &vForward, &vRight, &vUp);
vLocalPos += (vForward * tInfo.m_vOffset.x) + (vRight * tInfo.m_vOffset.y) + (vUp * tInfo.m_vOffset.z);
- return vLocalPos + (vPoint - vLocalPos) * fabsf(AABBLine(vMins + vTargetPos, vMaxs + vTargetPos, vLocalPos, vPoint - vLocalPos));
+ return Math::PullPoint(vPoint, vLocalPos, vTargetPos, vMins, vMaxs);
}
@@ -975,7 +967,6 @@ void CAimbotProjectile::CalculateAngle(const Vec3& vLocalPos, const Vec3& vTarge
case TF_WEAPON_CROSSBOW:
case TF_WEAPON_SHOTGUN_BUILDING_RESCUE:
case TF_WEAPON_SYRINGEGUN_MEDIC:
- case TF_WEAPON_FLAME_BALL:
s_mTraceCount[__FUNCTION__": setup trace"]++;
}
}
@@ -1068,7 +1059,6 @@ bool CAimbotProjectile::TestAngle(const Vec3& vPoint, const Vec3& vAngles, int i
case TF_WEAPON_CROSSBOW:
case TF_WEAPON_SHOTGUN_BUILDING_RESCUE:
case TF_WEAPON_SYRINGEGUN_MEDIC:
- case TF_WEAPON_FLAME_BALL:
s_mTraceCount[__FUNCTION__": setup trace"]++;
}
}
@@ -1218,7 +1208,7 @@ bool CAimbotProjectile::TestAngle(const Vec3& vPoint, const Vec3& vAngles, int i
else
{
G::BoxStorage.emplace_back(vPoint, -vHull, vHull, Vec3(), I::GlobalVars->curtime + 5.f, Color_t(127, 0, 255), Color_t(0, 0, 0, 0));
- if (bSplash)
+ if (iType != PointTypeEnum::Direct)
{
G::BoxStorage.emplace_back(trace.endpos, Vec3::Get(-1), Vec3::Get(1), Vec3(), I::GlobalVars->curtime + 5.f, Color_t(0, 0, 0), Color_t(0, 0, 0, 0));
G::BoxStorage.emplace_back(vPoint, Vec3::Get(-1), Vec3::Get(1), Vec3(), I::GlobalVars->curtime + 5.f, Color_t(255, 255, 255), Color_t(0, 0, 0, 0));
@@ -1331,17 +1321,25 @@ bool CAimbotProjectile::HandlePoint(const Vec3& vOrigin, int iSimTime, float flP
}
}
- if (bReturn)
+ if (bReturn && m_bUpdate)
{
- m_vAngleTo = vAngles, m_vPredicted = vOrigin, m_vTarget = vPoint;
- if (m_bVisuals)
+ m_vAngleTo = vAngles, m_vTarget = vPoint, m_vPredicted = vOrigin;
+ m_vPlayerPath.clear();
+ if (m_tMoveStorage.m_vPath.empty())
+ return true;
+
+ if (m_tInfo.m_iArmTime && iType == PointTypeEnum::Geometry)
{
- m_vPlayerPath.clear();
int iCount = std::min(iSimTime + TIME_TO_TICKS(m_tInfo.m_flLatency) + 1, int(m_tMoveStorage.m_vPath.size()));
- for (int i = 0; i < iCount; i++)
- m_vPlayerPath.push_back(m_tMoveStorage.m_vPath[i]);
- m_vProjectilePath = m_tProjInfo.m_vPath;
+ m_vPlayerPath.insert(m_vPlayerPath.end(), m_tMoveStorage.m_vPath.begin(), m_tMoveStorage.m_vPath.begin() + iCount);
}
+ else
+ {
+ size_t iCount = std::min(m_tProjInfo.m_vPath.size() + TIME_TO_TICKS(m_tInfo.m_flLatency), m_tMoveStorage.m_vPath.size());
+ m_vPlayerPath.insert(m_vPlayerPath.end(), m_tMoveStorage.m_vPath.begin(), m_tMoveStorage.m_vPath.begin() + iCount);
+ m_vPredicted = m_vPlayerPath.back();
+ }
+ m_vProjectilePath = m_tProjInfo.m_vPath;
}
return bReturn;
@@ -1355,9 +1353,9 @@ bool CAimbotProjectile::HandleDirect(DirectHistory_t& mDirectHistory)
for (auto& vDirectHistory : mDirectHistory | std::views::values)
{
std::sort(vDirectHistory.begin(), vDirectHistory.end(), [&](const Direct_t& a, const Direct_t& b) -> bool
- {
- return a.m_iPriority < b.m_iPriority;
- });
+ {
+ return a.m_iPriority < b.m_iPriority;
+ });
m_flTimeTo = vDirectHistory.front().m_flTime + m_tInfo.m_flLatency;
for (auto& tHistory : vDirectHistory)
@@ -1378,9 +1376,9 @@ bool CAimbotProjectile::HandleSplash(SplashHistory_t& mSplashHistory)
for (auto& [iType, vSplashHistory] : mSplashHistory)
{
std::sort(vSplashHistory.begin(), vSplashHistory.end(), [&](const Splash_t& a, const Splash_t& b) -> bool
- {
- return a.m_flTimeTo < b.m_flTimeTo;
- });
+ {
+ return a.m_flTimeTo < b.m_flTimeTo;
+ });
byte iFlags = CalculateFlagsEnum::None;
if (iType == PointFlagsEnum::Alternate)
iFlags |= CalculateFlagsEnum::AlternateAngle;
@@ -1392,9 +1390,6 @@ bool CAimbotProjectile::HandleSplash(SplashHistory_t& mSplashHistory)
float flLowestDistance = std::numeric_limits::max();
for (auto& tHistory : vSplashHistory)
{
- if (m_tInfo.m_iArmTime && tHistory.m_iSimtime < m_tInfo.m_iArmTime)
- continue;
-
std::vector vSplashPoints = {};
vSplashPoints = GetSplashPoints(tHistory.m_vOrigin, m_vSplashPoints, tHistory.m_iSimtime, iFlags);
@@ -1416,24 +1411,25 @@ bool CAimbotProjectile::HandleSplash(SplashHistory_t& mSplashHistory)
return false;
}
-int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, bool bVisuals)
+int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, bool bUpdate)
{
//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;
+ m_tMoveStorage = {};
+ if (!F::MoveSim.Initialize(tTarget.m_pEntity, m_tMoveStorage) && tTarget.m_iTargetType == TargetEnum::Player)
+ return false;
+
m_tProjInfo = {};
if (!F::ProjSim.GetInfo(pLocal, pWeapon, {}, m_tProjInfo, ProjSimEnum::NoRandomAngles | ProjSimEnum::PredictCmdNum)
|| !F::ProjSim.Initialize(m_tProjInfo, false))
return false;
- m_tMoveStorage = {};
- F::MoveSim.Initialize(tTarget.m_pEntity, m_tMoveStorage);
- tTarget.m_vPos = tTarget.m_pEntity->m_vecOrigin();
-
m_tInfo = { pLocal, pWeapon, &tTarget };
m_tInfo.m_vLocalEye = pLocal->GetShootPos();
m_tInfo.m_vTargetEye = tTarget.m_pEntity->As()->GetViewOffset();
m_tInfo.m_flLatency = F::Backtrack.GetReal() + TICKS_TO_TIME(F::Backtrack.GetAnticipatedChoke());
+ tTarget.m_vPos = tTarget.m_pEntity->m_vecOrigin();
Vec3 vVelocity = F::ProjSim.GetVelocity();
m_tInfo.m_flVelocity = vVelocity.Length();
@@ -1484,7 +1480,7 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas
Vec3 vPoint = tTarget.m_vPos + vOffset;
if (Vars::Aimbot::Projectile::HuntsmanPullPoint.Value && tTarget.m_nAimedHitbox == HITBOX_HEAD)
{
- vPoint = PullPoint(vPoint, m_tInfo.m_vLocalEye, m_tInfo, tTarget.m_pEntity->m_vecMins() + m_tInfo.m_vHull, tTarget.m_pEntity->m_vecMaxs() - m_tInfo.m_vHull, tTarget.m_vPos);
+ vPoint = PullPoint(vPoint, m_tInfo.m_vLocalEye, m_tInfo, tTarget.m_vPos, tTarget.m_pEntity->m_vecMins() + m_tInfo.m_vHull, tTarget.m_pEntity->m_vecMaxs() - m_tInfo.m_vHull);
if (Vars::Aimbot::Projectile::HuntsmanPullNoZ.Value)
vPoint.z = tTarget.m_vPos.z + vOffset.z;
}
@@ -1518,7 +1514,7 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas
}
const float flTimeTo = tSolution.m_flTime - TICKS_TO_TIME(i);
- if (flTimeTo > m_tInfo.m_flBoundingTime)
+ if (flTimeTo > m_tInfo.m_flBoundingTime || m_tInfo.m_iArmTime && m_tInfo.m_iArmTime > i)
{
++it;
continue;
@@ -1537,7 +1533,7 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas
break;
}
- m_iResult = false;
+ m_iResult = false, m_bUpdate = bUpdate;
switch (m_tInfo.m_flRadius ? Vars::Aimbot::Projectile::SplashPrediction.Value : Vars::Aimbot::Projectile::SplashPredictionEnum::Off)
{
case Vars::Aimbot::Projectile::SplashPredictionEnum::Off:
@@ -1555,35 +1551,40 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas
HandleSplash(mSplashHistory);
}
F::MoveSim.Restore(m_tMoveStorage);
+ if (!bUpdate)
+ return m_iResult;
tTarget.m_vPos = m_vTarget;
tTarget.m_vAngleTo = m_vAngleTo;
- if (tTarget.m_iTargetType != TargetEnum::Player || !m_tMoveStorage.m_bFailed) // don't attempt to aim at players when movesim fails
+
+ bool bMain = m_iResult == 1;
+ bool bAny = m_iResult;
+ if (bAny && (Vars::Colors::BoundHitboxEdge.Value.a || Vars::Colors::BoundHitboxFace.Value.a || Vars::Colors::BoundHitboxEdgeIgnoreZ.Value.a || Vars::Colors::BoundHitboxFaceIgnoreZ.Value.a))
{
- bool bMain = m_iResult == 1;
- bool bAny = m_iResult;
-
- if (bVisuals && bAny && (Vars::Colors::BoundHitboxEdge.Value.a || Vars::Colors::BoundHitboxFace.Value.a || Vars::Colors::BoundHitboxEdgeIgnoreZ.Value.a || Vars::Colors::BoundHitboxFaceIgnoreZ.Value.a))
+ float flProjectileTime = 0.f, flTargetTime = 0.f;
+ bool bBox = Vars::Visuals::Hitbox::BoundsEnabled.Value & Vars::Visuals::Hitbox::BoundsEnabledEnum::OnShot;
+ bool bPoint = Vars::Visuals::Hitbox::BoundsEnabled.Value & Vars::Visuals::Hitbox::BoundsEnabledEnum::AimPoint;
+ bool bTimed = !Vars::Visuals::Prediction::PlayerDrawDuration.Value;
+ if (bTimed)
{
- float flProjectileTime = TICKS_TO_TIME(m_vProjectilePath.size());
- float flTargetTime = m_tMoveStorage.m_bFailed ? flProjectileTime : TICKS_TO_TIME(m_vPlayerPath.size());
-
- bool bBox = Vars::Visuals::Hitbox::BoundsEnabled.Value & Vars::Visuals::Hitbox::BoundsEnabledEnum::OnShot;
- bool bPoint = Vars::Visuals::Hitbox::BoundsEnabled.Value & Vars::Visuals::Hitbox::BoundsEnabledEnum::AimPoint;
- if (bBox)
- {
- if (Vars::Colors::BoundHitboxEdgeIgnoreZ.Value.a || Vars::Colors::BoundHitboxFaceIgnoreZ.Value.a)
- m_vBoxes.emplace_back(m_vPredicted, tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs(), Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flTargetTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdgeIgnoreZ.Value, Vars::Colors::BoundHitboxFaceIgnoreZ.Value);
- if (Vars::Colors::BoundHitboxEdge.Value.a || Vars::Colors::BoundHitboxFace.Value.a)
- m_vBoxes.emplace_back(m_vPredicted, tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs(), Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flTargetTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdge.Value, Vars::Colors::BoundHitboxFace.Value, true);
- }
- if (bMain && bPoint)
- {
- if (Vars::Colors::BoundHitboxEdgeIgnoreZ.Value.a || Vars::Colors::BoundHitboxFaceIgnoreZ.Value.a)
- m_vBoxes.emplace_back(m_vTarget, Vec3::Get(-1), Vec3::Get(1), Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flProjectileTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdgeIgnoreZ.Value, Vars::Colors::BoundHitboxFaceIgnoreZ.Value);
- if (Vars::Colors::BoundHitboxEdge.Value.a || Vars::Colors::BoundHitboxFace.Value.a)
- m_vBoxes.emplace_back(m_vTarget, Vec3::Get(-1), Vec3::Get(1), Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flProjectileTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdge.Value, Vars::Colors::BoundHitboxFace.Value, true);
- }
+ flProjectileTime = TICKS_TO_TIME(m_vProjectilePath.size());
+ flTargetTime = m_tMoveStorage.m_bFailed ? flProjectileTime : TICKS_TO_TIME(m_vPlayerPath.size());
+ }
+ if (bBox)
+ {
+ float flDuration = bTimed ? flTargetTime : Vars::Visuals::Hitbox::DrawDuration.Value;
+ if (Vars::Colors::BoundHitboxEdgeIgnoreZ.Value.a || Vars::Colors::BoundHitboxFaceIgnoreZ.Value.a)
+ m_vBoxes.emplace_back(m_vPredicted, tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs(), Vec3(), I::GlobalVars->curtime + flDuration, Vars::Colors::BoundHitboxEdgeIgnoreZ.Value, Vars::Colors::BoundHitboxFaceIgnoreZ.Value);
+ if (Vars::Colors::BoundHitboxEdge.Value.a || Vars::Colors::BoundHitboxFace.Value.a)
+ m_vBoxes.emplace_back(m_vPredicted, tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs(), Vec3(), I::GlobalVars->curtime + flDuration, Vars::Colors::BoundHitboxEdge.Value, Vars::Colors::BoundHitboxFace.Value, true);
+ }
+ if (bMain && bPoint)
+ {
+ float flDuration = bTimed ? flProjectileTime : Vars::Visuals::Hitbox::DrawDuration.Value;
+ if (Vars::Colors::BoundHitboxEdgeIgnoreZ.Value.a || Vars::Colors::BoundHitboxFaceIgnoreZ.Value.a)
+ m_vBoxes.emplace_back(m_vTarget, Vec3::Get(-1), Vec3::Get(1), Vec3(), I::GlobalVars->curtime + flDuration, Vars::Colors::BoundHitboxEdgeIgnoreZ.Value, Vars::Colors::BoundHitboxFaceIgnoreZ.Value);
+ if (Vars::Colors::BoundHitboxEdge.Value.a || Vars::Colors::BoundHitboxFace.Value.a)
+ m_vBoxes.emplace_back(m_vTarget, Vec3::Get(-1), Vec3::Get(1), Vec3(), I::GlobalVars->curtime + flDuration, Vars::Colors::BoundHitboxEdge.Value, Vars::Colors::BoundHitboxFace.Value, true);
}
}
@@ -1689,12 +1690,26 @@ static inline void CancelShot(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCm
static inline void DrawVisuals(int iResult, Target_t& tTarget, std::vector& vPlayerPath, std::vector& vProjectilePath, std::vector& vBoxes)
{
+ if (iResult == 1)
+ {
+ if (G::Attacking == 1)
+ {
+ G::AimTarget = { tTarget.m_pEntity->entindex(), I::GlobalVars->tickcount };
+ G::AimPoint = { tTarget.m_vPos, I::GlobalVars->tickcount };
+ }
+ else
+ {
+ G::AimTarget = { tTarget.m_pEntity->entindex(), I::GlobalVars->tickcount, 0 };
+ G::AimPoint = { tTarget.m_vPos, I::GlobalVars->tickcount, 0 };
+ }
+ }
+
if (G::Attacking == 1 || iResult != 1 || !Vars::Aimbot::General::AutoShoot.Value || Vars::Debug::Info.Value)
{
- bool bPlayerPath = Vars::Visuals::Simulation::PlayerPath.Value;
- bool bProjectilePath = Vars::Visuals::Simulation::ProjectilePath.Value && (G::Attacking == 1 || Vars::Debug::Info.Value) && iResult == 1;
+ bool bPlayerPath = Vars::Visuals::Prediction::PlayerPath.Value;
+ bool bProjectilePath = Vars::Visuals::Prediction::ProjectilePath.Value && (G::Attacking == 1 || Vars::Debug::Info.Value) && iResult == 1;
bool bBoxes = Vars::Visuals::Hitbox::BoundsEnabled.Value & (Vars::Visuals::Hitbox::BoundsEnabledEnum::OnShot | Vars::Visuals::Hitbox::BoundsEnabledEnum::AimPoint);
- bool bRealPath = Vars::Visuals::Simulation::RealPath.Value && iResult == 1;
+ bool bRealPath = Vars::Visuals::Prediction::RealPath.Value && iResult == 1;
if (bPlayerPath || bProjectilePath || bBoxes || bRealPath)
{
G::PathStorage.clear();
@@ -1703,17 +1718,19 @@ static inline void DrawVisuals(int iResult, Target_t& tTarget, std::vector
if (bPlayerPath)
{
+ float flDuration = Vars::Visuals::Prediction::PlayerDrawDuration.Value;
if (Vars::Colors::PlayerPathIgnoreZ.Value.a)
- G::PathStorage.emplace_back(vPlayerPath, Vars::Visuals::Simulation::Timed.Value ? -int(vPlayerPath.size()) : I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPathIgnoreZ.Value, Vars::Visuals::Simulation::PlayerPath.Value);
+ G::PathStorage.emplace_back(vPlayerPath, !flDuration ? -int(vPlayerPath.size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPathIgnoreZ.Value, Vars::Visuals::Prediction::PlayerPath.Value);
if (Vars::Colors::PlayerPath.Value.a)
- G::PathStorage.emplace_back(vPlayerPath, Vars::Visuals::Simulation::Timed.Value ? -int(vPlayerPath.size()) : I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::PlayerPath.Value, Vars::Visuals::Simulation::PlayerPath.Value, true);
+ G::PathStorage.emplace_back(vPlayerPath, !flDuration ? -int(vPlayerPath.size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPath.Value, Vars::Visuals::Prediction::PlayerPath.Value, true);
}
if (bProjectilePath)
{
+ float flDuration = Vars::Visuals::Prediction::ProjectileDrawDuration.Value;
if (Vars::Colors::ProjectilePathIgnoreZ.Value.a)
- G::PathStorage.emplace_back(vProjectilePath, Vars::Visuals::Simulation::Timed.Value ? -int(vProjectilePath.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()) : I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::ProjectilePathIgnoreZ.Value, Vars::Visuals::Simulation::ProjectilePath.Value);
+ G::PathStorage.emplace_back(vProjectilePath, !flDuration ? -int(vProjectilePath.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()) : I::GlobalVars->curtime + flDuration, Vars::Colors::ProjectilePathIgnoreZ.Value, Vars::Visuals::Prediction::ProjectilePath.Value);
if (Vars::Colors::ProjectilePath.Value.a)
- G::PathStorage.emplace_back(vProjectilePath, Vars::Visuals::Simulation::Timed.Value ? -int(vProjectilePath.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()) : I::GlobalVars->curtime + Vars::Visuals::Simulation::DrawDuration.Value, Vars::Colors::ProjectilePath.Value, Vars::Visuals::Simulation::ProjectilePath.Value, true);
+ G::PathStorage.emplace_back(vProjectilePath, !flDuration ? -int(vProjectilePath.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()) : I::GlobalVars->curtime + flDuration, Vars::Colors::ProjectilePath.Value, Vars::Visuals::Prediction::ProjectilePath.Value, true);
}
if (bBoxes)
G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end());
@@ -1811,9 +1828,6 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser
break;
}
- G::AimTarget = { tTarget.m_pEntity->entindex(), I::GlobalVars->tickcount };
- G::AimPoint = { tTarget.m_vPos, I::GlobalVars->tickcount };
-
if (Vars::Aimbot::General::AutoShoot.Value)
{
switch (nWeaponID)
@@ -2114,15 +2128,15 @@ bool CAimbotProjectile::TestAngle(CBaseEntity* pProjectile, const Vec3& vPoint,
bool CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CBaseEntity* pProjectile)
{
+ m_tMoveStorage = {};
+ if (!F::MoveSim.Initialize(tTarget.m_pEntity, m_tMoveStorage) && tTarget.m_iTargetType == TargetEnum::Player)
+ return false;
+
m_tProjInfo = {};
F::ProjSim.GetInfo(pProjectile, m_tProjInfo);
if (!F::ProjSim.Initialize(m_tProjInfo, false, true))
return false;
- m_tMoveStorage = {};
- F::MoveSim.Initialize(tTarget.m_pEntity, m_tMoveStorage);
- tTarget.m_vPos = tTarget.m_pEntity->m_vecOrigin();
-
m_tInfo = { pLocal, m_tProjInfo.m_pWeapon, &tTarget, pProjectile };
m_tInfo.m_flLatency = F::Backtrack.GetReal() + TICKS_TO_TIME(F::Backtrack.GetAnticipatedChoke());
m_tInfo.m_vHull = pProjectile->m_vecMaxs().Min(3);
@@ -2143,6 +2157,7 @@ bool CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBa
pProjectile->SetAbsOrigin(m_tProjInfo.m_vPos);
}
m_tInfo.m_vTargetEye = tTarget.m_pEntity->As()->GetViewOffset();
+ tTarget.m_vPos = tTarget.m_pEntity->m_vecOrigin();
m_tInfo.m_flVelocity = m_tProjInfo.m_flVelocity;
@@ -2232,7 +2247,7 @@ bool CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBa
break;
}
- m_iResult = false;
+ m_iResult = false, m_bUpdate = true;
switch (m_tInfo.m_flRadius ? Vars::Aimbot::Projectile::SplashPrediction.Value : Vars::Aimbot::Projectile::SplashPredictionEnum::Off)
{
case Vars::Aimbot::Projectile::SplashPredictionEnum::Off:
@@ -2253,33 +2268,36 @@ bool CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBa
tTarget.m_vPos = m_vTarget;
tTarget.m_vAngleTo = m_vAngleTo;
- if (tTarget.m_iTargetType != TargetEnum::Player || !m_tMoveStorage.m_bFailed) // don't attempt to aim at players when movesim fails
+
+ bool bMain = m_iResult == 1;
+ if (bMain)
{
- bool bMain = m_iResult == 1;
-
- if (bMain)
+ if (Vars::Colors::BoundHitboxEdge.Value.a || Vars::Colors::BoundHitboxFace.Value.a || Vars::Colors::BoundHitboxEdgeIgnoreZ.Value.a || Vars::Colors::BoundHitboxFaceIgnoreZ.Value.a)
{
- if (Vars::Colors::BoundHitboxEdge.Value.a || Vars::Colors::BoundHitboxFace.Value.a || Vars::Colors::BoundHitboxEdgeIgnoreZ.Value.a || Vars::Colors::BoundHitboxFaceIgnoreZ.Value.a)
+ float flProjectileTime = 0.f, flTargetTime = 0.f;
+ bool bBox = Vars::Visuals::Hitbox::BoundsEnabled.Value & Vars::Visuals::Hitbox::BoundsEnabledEnum::OnShot;
+ bool bPoint = Vars::Visuals::Hitbox::BoundsEnabled.Value & Vars::Visuals::Hitbox::BoundsEnabledEnum::AimPoint;
+ bool bTimed = !Vars::Visuals::Prediction::PlayerDrawDuration.Value;
+ if (bTimed)
{
- float flProjectileTime = TICKS_TO_TIME(m_vProjectilePath.size());
- float flTargetTime = m_tMoveStorage.m_bFailed ? flProjectileTime : TICKS_TO_TIME(m_vPlayerPath.size());
-
- bool bBox = Vars::Visuals::Hitbox::BoundsEnabled.Value & Vars::Visuals::Hitbox::BoundsEnabledEnum::OnShot;
- bool bPoint = Vars::Visuals::Hitbox::BoundsEnabled.Value & Vars::Visuals::Hitbox::BoundsEnabledEnum::AimPoint;
- if (bBox)
- {
- if (Vars::Colors::BoundHitboxEdgeIgnoreZ.Value.a || Vars::Colors::BoundHitboxFaceIgnoreZ.Value.a)
- m_vBoxes.emplace_back(m_vPredicted, tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs(), Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flTargetTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdgeIgnoreZ.Value, Vars::Colors::BoundHitboxFaceIgnoreZ.Value);
- if (Vars::Colors::BoundHitboxEdge.Value.a || Vars::Colors::BoundHitboxFace.Value.a)
- m_vBoxes.emplace_back(m_vPredicted, tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs(), Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flTargetTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdge.Value, Vars::Colors::BoundHitboxFace.Value, true);
- }
- if (bPoint)
- {
- if (Vars::Colors::BoundHitboxEdgeIgnoreZ.Value.a || Vars::Colors::BoundHitboxFaceIgnoreZ.Value.a)
- m_vBoxes.emplace_back(m_vTarget, Vec3::Get(-1), Vec3::Get(1), Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flProjectileTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdgeIgnoreZ.Value, Vars::Colors::BoundHitboxFaceIgnoreZ.Value);
- if (Vars::Colors::BoundHitboxEdge.Value.a || Vars::Colors::BoundHitboxFace.Value.a)
- m_vBoxes.emplace_back(m_vTarget, Vec3::Get(-1), Vec3::Get(1), Vec3(), I::GlobalVars->curtime + (Vars::Visuals::Simulation::Timed.Value ? flProjectileTime : Vars::Visuals::Hitbox::DrawDuration.Value), Vars::Colors::BoundHitboxEdge.Value, Vars::Colors::BoundHitboxFace.Value, true);
- }
+ flProjectileTime = TICKS_TO_TIME(m_vProjectilePath.size());
+ flTargetTime = m_tMoveStorage.m_bFailed ? flProjectileTime : TICKS_TO_TIME(m_vPlayerPath.size());
+ }
+ if (bBox)
+ {
+ float flDuration = bTimed ? flTargetTime : Vars::Visuals::Hitbox::DrawDuration.Value;
+ if (Vars::Colors::BoundHitboxEdgeIgnoreZ.Value.a || Vars::Colors::BoundHitboxFaceIgnoreZ.Value.a)
+ m_vBoxes.emplace_back(m_vPredicted, tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs(), Vec3(), I::GlobalVars->curtime + flDuration, Vars::Colors::BoundHitboxEdgeIgnoreZ.Value, Vars::Colors::BoundHitboxFaceIgnoreZ.Value);
+ if (Vars::Colors::BoundHitboxEdge.Value.a || Vars::Colors::BoundHitboxFace.Value.a)
+ m_vBoxes.emplace_back(m_vPredicted, tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs(), Vec3(), I::GlobalVars->curtime + flDuration, Vars::Colors::BoundHitboxEdge.Value, Vars::Colors::BoundHitboxFace.Value, true);
+ }
+ if (bPoint)
+ {
+ float flDuration = bTimed ? flProjectileTime : Vars::Visuals::Hitbox::DrawDuration.Value;
+ if (Vars::Colors::BoundHitboxEdgeIgnoreZ.Value.a || Vars::Colors::BoundHitboxFaceIgnoreZ.Value.a)
+ m_vBoxes.emplace_back(m_vTarget, Vec3::Get(-1), Vec3::Get(1), Vec3(), I::GlobalVars->curtime + flDuration, Vars::Colors::BoundHitboxEdgeIgnoreZ.Value, Vars::Colors::BoundHitboxFaceIgnoreZ.Value);
+ if (Vars::Colors::BoundHitboxEdge.Value.a || Vars::Colors::BoundHitboxFace.Value.a)
+ m_vBoxes.emplace_back(m_vTarget, Vec3::Get(-1), Vec3::Get(1), Vec3(), I::GlobalVars->curtime + flDuration, Vars::Colors::BoundHitboxEdge.Value, Vars::Colors::BoundHitboxFace.Value, true);
}
}
}
@@ -2304,9 +2322,6 @@ bool CAimbotProjectile::AutoAirblast(CTFPlayer* pLocal, CTFWeaponBase* pWeapon,
const bool bResult = CanHit(tTarget, pLocal, pWeapon, pProjectile);
if (!bResult) continue;
- G::AimTarget = { tTarget.m_pEntity->entindex(), I::GlobalVars->tickcount };
- G::AimPoint = { tTarget.m_vPos, I::GlobalVars->tickcount };
-
G::Attacking = true;
DrawVisuals(1, tTarget, m_vPlayerPath, m_vProjectilePath, m_vBoxes);
diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h
index 5e72e556..825d3e26 100644
--- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h
+++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h
@@ -101,7 +101,7 @@ private:
bool HandleDirect(DirectHistory_t& vDirectHistory);
bool HandleSplash(SplashHistory_t& vSplashHistory);
- int CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, bool bVisuals = true);
+ int CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, bool bUpdate = true);
bool RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd);
bool CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CBaseEntity* pProjectile);
@@ -127,7 +127,7 @@ private:
Vec3 m_vTarget = {};
int m_iResult = false;
- bool m_bVisuals = true;
+ bool m_bUpdate = true;
public:
void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd);
diff --git a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp
index 04dee66e..ecba411e 100644
--- a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp
+++ b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp
@@ -84,7 +84,8 @@ bool CAutoDetonate::CheckEntity(CBaseEntity* pEntity, CTFPlayer* pLocal, CTFWeap
{
// CEntitySphereQuery actually does a box test so we need to make sure the distance is less than the radius first
Vec3 vPos; pEntity->m_Collision()->CalcNearestPoint(vOrigin, &vPos);
- if (vOrigin.DistTo(vPos) > flRadius)
+ float flRadiusSqr = powf(flRadius, 2);
+ if (vOrigin.DistToSqr(vPos) > flRadiusSqr)
return false;
if (pEntity != pLocal
@@ -94,11 +95,12 @@ bool CAutoDetonate::CheckEntity(CBaseEntity* pEntity, CTFPlayer* pLocal, CTFWeap
if (pCmd && pWeapon->GetWeaponID() == TF_WEAPON_PIPEBOMBLAUNCHER && pWeapon->As()->GetDetonateType() == TF_DETONATE_MODE_DOT)
{
- Vec3 vAngleTo = Math::CalcAngle(pLocal->GetShootPos(), vOrigin);
- SDK::FixMovement(pCmd, vAngleTo);
- pCmd->viewangles = vAngleTo;
- G::PSilentAngles = true;
+ if (G::Attacking == 1 || I::ClientState->chokedcommands)
+ return false;
+
+ m_vAimPos = vOrigin;
}
+
return true;
}
@@ -195,7 +197,18 @@ void CAutoDetonate::Run(CTFPlayer* pLocal, CUserCmd* pCmd)
if (!Vars::Aimbot::Projectile::AutoDetonate.Value)
return;
+ m_vAimPos = std::nullopt;
if (Check(pLocal, pCmd, EntityEnum::LocalStickies, Vars::Aimbot::Projectile::AutoDetonateEnum::Stickies)
|| Check(pLocal, pCmd, EntityEnum::LocalFlares, Vars::Aimbot::Projectile::AutoDetonateEnum::Flares))
+ {
pCmd->buttons |= IN_ATTACK2;
+
+ if (m_vAimPos)
+ {
+ Vec3 vAngleTo = Math::CalcAngle(pLocal->GetShootPos(), *m_vAimPos);
+ SDK::FixMovement(pCmd, vAngleTo);
+ pCmd->viewangles = vAngleTo;
+ G::PSilentAngles = true;
+ }
+ }
}
\ No newline at end of file
diff --git a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.h b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.h
index 4ce49b1c..e39d9446 100644
--- a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.h
+++ b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.h
@@ -2,6 +2,7 @@
#include "../../../SDK/SDK.h"
#include "../AimbotGlobal/AimbotGlobal.h"
+#include
class CAutoDetonate
{
@@ -19,6 +20,7 @@ private:
void RestorePlayers();
std::unordered_map m_mRestore = {};
+ std::optional m_vAimPos = {};
public:
void Run(CTFPlayer* pLocal, CUserCmd* pCmd);
diff --git a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp
index c44723ca..bd3d8f0c 100644
--- a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp
+++ b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp
@@ -151,7 +151,7 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p
for (int n = 1; n < 10; n++)
{
F::MoveSim.RunTick(tMoveStorage);
- if (n <= iSkip)
+ if (n <= iSkip || n == 1 && G::Reloading)
continue;
Vec3 Old = F::ProjSim.GetOrigin();
@@ -174,7 +174,8 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p
Vec3 vPos; pLocal->m_Collision()->CalcNearestPoint(vPoint, &vPos);
pLocal->SetAbsOrigin(vOriginal);
- return vPoint.DistTo(vPos) < TF_ROCKET_RADIUS_FOR_RJS && SDK::VisPosWorld(pLocal, pLocal, vPoint, vOrigin + pLocal->m_vecViewOffset(), MASK_SHOT);
+ float flRadiusSqr = powf(TF_ROCKET_RADIUS_FOR_RJS, 2);
+ return vPoint.DistToSqr(vPos) < flRadiusSqr && SDK::VisPosWorld(pLocal, pLocal, vPoint, vOrigin + pLocal->m_vecViewOffset(), MASK_SHOT);
};
bWillHit = fWillHit(pLocal, tMoveStorage.m_MoveData.m_vecAbsOrigin, trace.endpos + trace.plane.normal);
@@ -189,9 +190,9 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p
SDK::Output("Auto jump", std::format("Ticks to hit: {} ({})", m_iDelay, n).c_str(), { 255, 0, 0 }, Vars::Debug::Logging.Value);
if (Vars::Debug::Info.Value)
{
- //G::LineStorage.clear(); G::BoxStorage.clear();
Vec3 vAngles = Math::VectorAngles(trace.plane.normal);
- G::BoxStorage.emplace_back(trace.endpos + trace.plane.normal, Vec3(-1.f, -1.f, -1.f), Vec3(1.f, 1.f, 1.f), vAngles, I::GlobalVars->curtime + 5.f, Color_t(), Color_t(0, 0, 0, 0), true);
+ G::LineStorage.clear(); G::BoxStorage.clear();
+ G::BoxStorage.emplace_back(trace.endpos + trace.plane.normal, Vec3::Get(-1), Vec3::Get(1), vAngles, I::GlobalVars->curtime + 5.f, Color_t(), Color_t(0, 0, 0, 0), true);
G::LineStorage.emplace_back(std::pair(tMoveStorage.m_MoveData.m_vecAbsOrigin + pLocal->m_vecViewOffset(), trace.endpos + trace.plane.normal), I::GlobalVars->curtime + 5.f, Color_t(), true);
}
}
diff --git a/Amalgam/src/Features/Backtrack/Backtrack.cpp b/Amalgam/src/Features/Backtrack/Backtrack.cpp
index 6386804a..a73897c4 100644
--- a/Amalgam/src/Features/Backtrack/Backtrack.cpp
+++ b/Amalgam/src/Features/Backtrack/Backtrack.cpp
@@ -184,7 +184,7 @@ std::vector CBacktrack::GetValidRecords(std::vector& v
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().DistToSqr(a->m_vOrigin) < pLocal->m_vecOrigin().DistToSqr(b->m_vOrigin);
});
else
{
diff --git a/Amalgam/src/Features/Configs/Configs.cpp b/Amalgam/src/Features/Configs/Configs.cpp
index 9113686d..a0706c63 100644
--- a/Amalgam/src/Features/Configs/Configs.cpp
+++ b/Amalgam/src/Features/Configs/Configs.cpp
@@ -506,8 +506,7 @@ bool CConfigs::LoadConfig(const std::string& sConfigName, bool bNotify)
if (sConfigName == std::string("default"))
{
SaveConfig("default", false);
-
- H::Fonts.Reload(Vars::Menu::Scale[DEFAULT_BIND]);
+ H::Fonts.Reload();
}
return false;
}
@@ -599,7 +598,7 @@ bool CConfigs::LoadConfig(const std::string& sConfigName, bool bNotify)
SDK::Output("Amalgam", "Config groups not found", ALTERNATE_COLOR, OUTPUT_CONSOLE | OUTPUT_MENU | OUTPUT_DEBUG);
F::Binds.SetVars(nullptr, nullptr, false);
- H::Fonts.Reload(Vars::Menu::Scale[DEFAULT_BIND]);
+ H::Fonts.Reload();
m_sCurrentConfig = sConfigName; m_sCurrentVisuals = "";
if (bNotify)
@@ -848,7 +847,7 @@ void CConfigs::ResetConfig(const std::string& sConfigName, bool bNotify)
SaveConfig(sConfigName, false);
F::Binds.SetVars(nullptr, nullptr, false);
- H::Fonts.Reload(Vars::Menu::Scale[DEFAULT_BIND]);
+ H::Fonts.Reload();
if (bNotify)
SDK::Output("Amalgam", std::format("Config {} reset", sConfigName).c_str(), DEFAULT_COLOR, OUTPUT_CONSOLE | OUTPUT_TOAST | OUTPUT_MENU | OUTPUT_DEBUG);
diff --git a/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp b/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp
index b94e8f0a..0ebaf5c3 100644
--- a/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp
+++ b/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp
@@ -1,6 +1,7 @@
#include "EnginePrediction.h"
#include "../Ticks/Ticks.h"
+#include "../Simulation/MovementSimulation/MovementSimulation.h"
// account for interp and origin compression when simulating local player
void CEnginePrediction::AdjustPlayers(CBaseEntity* pLocal)
@@ -45,9 +46,9 @@ void CEnginePrediction::Simulate(CTFPlayer* pLocal, CUserCmd* pCmd)
I::Prediction->SetLocalViewAngles(pCmd->viewangles);
AdjustPlayers(pLocal);
- I::Prediction->SetupMove(pLocal, pCmd, I::MoveHelper, &m_MoveData);
- I::GameMovement->ProcessMovement(pLocal, &m_MoveData);
- I::Prediction->FinishMove(pLocal, pCmd, &m_MoveData);
+ I::Prediction->SetupMove(pLocal, pCmd, I::MoveHelper, &m_tMoveData);
+ I::GameMovement->ProcessMovement(pLocal, &m_tMoveData);
+ I::Prediction->FinishMove(pLocal, pCmd, &m_tMoveData);
RestorePlayers();
I::MoveHelper->SetHost(nullptr);
@@ -58,10 +59,8 @@ void CEnginePrediction::Simulate(CTFPlayer* pLocal, CUserCmd* pCmd)
I::Prediction->m_bFirstTimePredicted = bOldIsFirstPrediction;
I::Prediction->m_bInPrediction = bOldInPrediction;
- m_vOrigin = m_MoveData.m_vecAbsOrigin;
- m_vVelocity = m_MoveData.m_vecVelocity;
- m_vDirection = { m_MoveData.m_flForwardMove, -m_MoveData.m_flSideMove, m_MoveData.m_flUpMove };
- m_vAngles = m_MoveData.m_vecViewAngles;
+ if (static int nLastTickBase = 0; nLastTickBase != nOldTickBase)
+ F::MoveSim.StorePlayer(pLocal, m_tMoveData, TICKS_TO_TIME(nOldTickBase)), nLastTickBase = nOldTickBase;
}
diff --git a/Amalgam/src/Features/EnginePrediction/EnginePrediction.h b/Amalgam/src/Features/EnginePrediction/EnginePrediction.h
index 6c78b9b5..5f6d927f 100644
--- a/Amalgam/src/Features/EnginePrediction/EnginePrediction.h
+++ b/Amalgam/src/Features/EnginePrediction/EnginePrediction.h
@@ -19,7 +19,7 @@ class CEnginePrediction
private:
void Simulate(CTFPlayer* pLocal, CUserCmd* pCmd);
- CMoveData m_MoveData = {};
+ CMoveData m_tMoveData = {};
DatamapRestore_t m_tLocal = {};
std::unordered_map m_mRestore = {};
@@ -37,12 +37,6 @@ public:
int m_nOldTickCount = 0;
float m_flOldCurrentTime = 0.f;
float m_flOldFrameTime = 0.f;
-
- // localplayer use in net_update_end
- Vec3 m_vOrigin = {};
- Vec3 m_vVelocity = {};
- Vec3 m_vDirection = {};
- Vec3 m_vAngles = {};
};
ADD_FEATURE(CEnginePrediction, EnginePrediction);
\ No newline at end of file
diff --git a/Amalgam/src/Features/ImGui/Menu/Components.h b/Amalgam/src/Features/ImGui/Menu/Components.h
index b28e8bd1..bd51f254 100644
--- a/Amalgam/src/Features/ImGui/Menu/Components.h
+++ b/Amalgam/src/Features/ImGui/Menu/Components.h
@@ -165,26 +165,22 @@ namespace ImGui
inline void DebugDummy(ImVec2 vSize)
{
/*
- ImVec2 vOriginalPos = GetCursorPos();
- PushStyleColor(ImGuiCol_Button, { 0.f, 0.f, 0.f, 0.5f });
- Button("##", { std::max(vSize.x, 2.f), std::max(vSize.y, 2.f) });
- PopStyleColor();
- SetCursorPos(vOriginalPos);
+ ImDrawList* pDrawList = GetWindowDrawList();
+ ImVec2 vDrawPos = GetDrawPos() + GetCursorPos();
+ pDrawList->AddRectFilled(vDrawPos, vDrawPos + ImVec2(std::max(vSize.x, 2.f), std::max(vSize.y, 2.f)), ImColor(0.f, 0.f, 0.f, 0.5f));
*/
Dummy(vSize);
}
inline void DebugShift(ImVec2 vSize)
{
- ImVec2 vOriginalPos = GetCursorPos();
-
/*
- PushStyleColor(ImGuiCol_Button, { 1.f, 1.f, 1.f, 0.5f });
- Button("##", { std::max(vSize.x, 2.f), std::max(vSize.y, 2.f) });
- PopStyleColor();
+ ImDrawList* pDrawList = GetWindowDrawList();
+ ImVec2 vDrawPos = GetDrawPos() + GetCursorPos();
+ pDrawList->AddRectFilled(vDrawPos, vDrawPos + ImVec2(std::max(vSize.x, 2.f), std::max(vSize.y, 2.f)), ImColor(1.f, 1.f, 1.f, 0.5f));
*/
- SetCursorPos({ vOriginalPos.x + vSize.x, vOriginalPos.y + vSize.y });
+ SetCursorPos(GetCursorPos() + vSize);
}
inline bool IsMouseWithin(float x, float y, float w, float h)
@@ -194,9 +190,9 @@ namespace ImGui
&& y <= vMouse.y && vMouse.y < y + h;
/*
- ImDrawList* pDrawList = GetForegroundDrawList();
+ ImDrawList* pDrawList = GetWindowDrawList();
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));
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(x, y), vDrawPos + ImVec2(x + w, y + h), bWithin ? ImColor(1.f, 0.f, 0.f, 0.5f) : ImColor(0.f, 1.f, 1.f, 0.5f));
*/
return bWithin;
@@ -216,7 +212,7 @@ namespace ImGui
ImVec2 vDrawPos = GetDrawPos();
ImDrawList* pDrawList = GetWindowDrawList();
- pDrawList->AddRectFilled({ vDrawPos.x, vDrawPos.y }, { vDrawPos.x + vSize.x, vDrawPos.y + vSize.y }, uBackground, H::Draw.Scale(4));
+ pDrawList->AddRectFilled(vDrawPos, vDrawPos + vSize, uBackground, H::Draw.Scale(4));
}
inline void RenderBackground(ImU32 uBackground, ImU32 uBorder, float flInset = H::Draw.Scale())
{
@@ -224,10 +220,10 @@ namespace ImGui
ImVec2 vDrawPos = GetDrawPos();
ImDrawList* pDrawList = GetWindowDrawList();
- pDrawList->AddRectFilled({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x - flInset + vSize.x, vDrawPos.y - flInset + vSize.y }, uBackground, H::Draw.Scale(3));
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(flInset, flInset), vDrawPos + vSize - ImVec2(flInset, flInset), uBackground, H::Draw.Scale(3));
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());
+ pDrawList->AddRect(vDrawPos + ImVec2(flInset, flInset), vDrawPos + vSize - ImVec2(flInset, flInset), uBorder, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale());
}
inline void RenderTwoToneBackground(float flSize, ImU32 uTitle, ImU32 uBackground, bool bHorizontal = false)
{
@@ -237,13 +233,13 @@ namespace ImGui
if (!bHorizontal)
{
- pDrawList->AddRectFilled({ vDrawPos.x, vDrawPos.y }, { vDrawPos.x + vSize.x, vDrawPos.y + flSize }, uTitle, H::Draw.Scale(4), ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight);
- pDrawList->AddRectFilled({ vDrawPos.x, vDrawPos.y + flSize }, { vDrawPos.x + vSize.x, vDrawPos.y + vSize.y }, uBackground, H::Draw.Scale(4), ImDrawFlags_RoundCornersBottomLeft | ImDrawFlags_RoundCornersBottomRight);
+ pDrawList->AddRectFilled(vDrawPos, vDrawPos + ImVec2(vSize.x, flSize), uTitle, H::Draw.Scale(4), ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight);
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(0, flSize), vDrawPos + vSize, uBackground, H::Draw.Scale(4), ImDrawFlags_RoundCornersBottomLeft | ImDrawFlags_RoundCornersBottomRight);
}
else
{
- pDrawList->AddRectFilled({ vDrawPos.x, vDrawPos.y }, { vDrawPos.x + flSize, vDrawPos.y + vSize.y }, uTitle, H::Draw.Scale(4), ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersBottomLeft);
- pDrawList->AddRectFilled({ vDrawPos.x + flSize, vDrawPos.y }, { vDrawPos.x + vSize.x, vDrawPos.y + vSize.y }, uBackground, H::Draw.Scale(4), ImDrawFlags_RoundCornersTopRight | ImDrawFlags_RoundCornersBottomRight);
+ pDrawList->AddRectFilled(vDrawPos, vDrawPos + ImVec2(flSize, vSize.y), uTitle, H::Draw.Scale(4), ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersBottomLeft);
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(flSize, 0), vDrawPos + vSize, 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)
@@ -255,28 +251,28 @@ namespace ImGui
if (bVertical)
{
if (!bTwoToneBorder)
- pDrawList->AddRectFilled({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x + vSize.x - flInset, vDrawPos.y + flSize }, uTitle, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight);
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(flInset, flInset), vDrawPos + ImVec2(vSize.x - flInset, flSize), uTitle, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight);
else
{
- pDrawList->AddRectFilled({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x + vSize.x - flInset, vDrawPos.y + flSize - H::Draw.Scale() }, uTitle, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight);
- pDrawList->AddRectFilled({ vDrawPos.x + flInset, vDrawPos.y + flSize - H::Draw.Scale() }, { vDrawPos.x + vSize.x - flInset, vDrawPos.y + flSize }, uBorder);
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(flInset, flInset), vDrawPos + ImVec2(vSize.x - flInset, flSize - H::Draw.Scale()), uTitle, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight);
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(flInset, flSize - H::Draw.Scale()), vDrawPos + ImVec2(vSize.x - flInset, flSize), uBorder);
}
- pDrawList->AddRectFilled({ vDrawPos.x + flInset, vDrawPos.y + flSize }, { vDrawPos.x + vSize.x - flInset, vDrawPos.y + vSize.y - flInset }, uBackground, H::Draw.Scale(3), ImDrawFlags_RoundCornersBottomLeft | ImDrawFlags_RoundCornersBottomRight);
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(flInset, flSize), vDrawPos + vSize - ImVec2(flInset, flInset), uBackground, H::Draw.Scale(3), ImDrawFlags_RoundCornersBottomLeft | ImDrawFlags_RoundCornersBottomRight);
}
else
{
if (!bTwoToneBorder)
- pDrawList->AddRectFilled({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x + flSize, vDrawPos.y + vSize.y - flInset }, uTitle, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersBottomLeft);
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(flInset, flInset), vDrawPos + ImVec2(flSize, vSize.y - flInset), uTitle, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersBottomLeft);
else
{
- pDrawList->AddRectFilled({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x + flSize - H::Draw.Scale(), vDrawPos.y + vSize.y - flInset }, uTitle, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersBottomLeft);
- pDrawList->AddRectFilled({ vDrawPos.x + flSize - H::Draw.Scale(), vDrawPos.y + flInset }, { vDrawPos.x + flSize, vDrawPos.y + vSize.y - flInset }, uBorder);
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(flInset, flInset), vDrawPos + ImVec2(flSize - H::Draw.Scale(), vSize.y - flInset), uTitle, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersBottomLeft);
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(flSize - H::Draw.Scale(), flInset), vDrawPos + ImVec2(flSize, vSize.y - flInset), uBorder);
}
- pDrawList->AddRectFilled({ vDrawPos.x + flSize, vDrawPos.y + flInset }, { vDrawPos.x + vSize.x - flInset, vDrawPos.y + vSize.y - flInset }, uBackground, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopRight | ImDrawFlags_RoundCornersBottomRight);
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(flSize, flInset), vDrawPos + vSize - ImVec2(flInset, flInset), uBackground, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopRight | ImDrawFlags_RoundCornersBottomRight);
}
flInset += H::Draw.Scale(0.5f) - 0.5f - H::Draw.Scale();
- pDrawList->AddRect({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x + vSize.x - flInset, vDrawPos.y + vSize.y - flInset }, uBorder, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale());
+ pDrawList->AddRect(vDrawPos + ImVec2(flInset, flInset), vDrawPos + vSize - ImVec2(flInset, flInset), uBorder, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale());
}
inline void Divider(float flPrePadding = H::Draw.Scale(8), float flPostPadding = H::Draw.Scale(7), float flInset = H::Draw.Scale(), ImU32 uBorder = F::Render.Background2)
{
@@ -284,14 +280,14 @@ namespace ImGui
ImVec2 vDrawPos = GetDrawPos() + ImVec2(0, GetCursorPosY());
ImDrawList* pDrawList = GetWindowDrawList();
- pDrawList->AddRectFilled({ vDrawPos.x + flInset, vDrawPos.y + flPrePadding - H::Draw.Scale() }, {vDrawPos.x - flInset + vSize.x, vDrawPos.y + flPrePadding }, uBorder);
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(flInset, flPrePadding - H::Draw.Scale()), vDrawPos + ImVec2(vSize.x - flInset, flPrePadding), uBorder);
DebugDummy({ 0, flPrePadding + flPostPadding });
}
inline void AddSteppedRect(ImVec2 vPos, ImVec2 vPosMin, ImVec2 vPosMax, ImVec2 vClipMin, ImVec2 vClipMax, float flVMin, float flVMax, float flStep, ImU32 uPrimary, ImU32 uSecondary, float flStepWidth)
{
ImDrawList* pDrawList = GetWindowDrawList();
- pDrawList->PushClipRect({ vPos.x + vClipMin.x, vPos.y + vClipMin.y }, { vPos.x + vClipMax.x, vPos.y + vClipMax.y }, true);
+ pDrawList->PushClipRect(vPos + vClipMin, vPos + vClipMax, true);
int iSteps = (flVMax - flVMin) / flStep;
if (iSteps < 21 || (vPosMax.x - vPosMin.x) / iSteps > 6.f)
@@ -320,17 +316,17 @@ namespace ImGui
for (size_t i = 0; i < vSteps.size(); i++)
{
if (!i)
- pDrawList->AddRectFilled({ vPos.x + vPosMin.x, vPos.y + vPosMin.y }, { vPos.x + vSteps.front().first, vPos.y + vPosMax.y }, uPrimary);
+ pDrawList->AddRectFilled(vPos + vPosMin, vPos + ImVec2(vSteps.front().first, vPosMax.y), uPrimary);
else
- pDrawList->AddRectFilled({ vPos.x + vSteps[i - 1].second, vPos.y + vPosMin.y }, { vPos.x + vSteps[i].first, vPos.y + vPosMax.y }, uPrimary);
- pDrawList->AddRectFilled({ vPos.x + vSteps[i].first, vPos.y + vPosMin.y }, { vPos.x + vSteps[i].second, vPos.y + vPosMax.y }, uSecondary);
+ pDrawList->AddRectFilled(vPos + ImVec2(vSteps[i - 1].second, vPosMin.y), vPos + ImVec2(vSteps[i].first, vPosMax.y), uPrimary);
+ pDrawList->AddRectFilled(vPos + ImVec2(vSteps[i].first, vPosMin.y), vPos + ImVec2(vSteps[i].second, vPosMax.y), uSecondary);
}
- pDrawList->AddRectFilled({ vPos.x + vSteps.back().second, vPos.y + vPosMin.y }, { vPos.x + vPosMax.x, vPos.y + vPosMax.y }, uPrimary);
+ pDrawList->AddRectFilled(vPos + ImVec2(vSteps.back().second, vPosMin.y), vPos + vPosMax, uPrimary);
return pDrawList->PopClipRect();
}
}
- pDrawList->AddRectFilled({ vPos.x + vPosMin.x, vPos.y + vPosMin.y }, { vPos.x + vPosMax.x, vPos.y + vPosMax.y }, uPrimary);
+ pDrawList->AddRectFilled(vPos + vPosMin, vPos + vPosMax, uPrimary);
pDrawList->PopClipRect();
}
@@ -469,17 +465,17 @@ namespace ImGui
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 };
+ ImVec2 vP1 = vPos + ImVec2(vText.x / 2 - H::Draw.Scale(8), H::Draw.Scale(1) - 0.5f), vP2 = vPos + ImVec2(vText.x / 2 + H::Draw.Scale(8), H::Draw.Scale(1) - 0.5f), vP3 = vPos + ImVec2(vText.x / 2, 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());
+ pDrawList->AddRect(vPos + ImVec2(flInset, flInset), vPos + ImVec2(vText.x - flInset, vText.y - flInset), 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->AddTriangle(vP1 + ImVec2(-flInset / 2, 0), vP2 + ImVec2(flInset / 2, 0), vP3 + ImVec2(0, -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));
+ pDrawList->AddRectFilled(vPos + ImVec2(flInset, flInset), vPos + ImVec2(vText.x-flInset, vText.y - flInset), 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->AddTriangleFilled(vP1 + ImVec2(flInset / 2, 0), vP2 + ImVec2(-flInset / 2, 0), vP3 + ImVec2(0, flInset / 2), F::Render.Background1p5);
*/
pDrawList->AddRectFilled(vPos, { vPos.x + vText.x, vPos.y + vText.y }, F::Render.Background2, H::Draw.Scale(3));
@@ -491,7 +487,7 @@ namespace ImGui
{
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());
+ pDrawList->AddText(vPos + ImVec2(-vText.x / 2, H::Draw.Scale(6) + H::Draw.Scale(16) * i), F::Render.Active, sText.c_str());
}
PopFont();
@@ -535,7 +531,7 @@ namespace ImGui
bool bReturn = InputText(std::format("##{}", sLabel).c_str(), &sText, iFlags | ImGuiInputTextFlags_NoKeyboardNavigate, fCallback);
ImVec2 vSize = GetItemRectSize();
float flInset = H::Draw.Scale(0.5f) - 0.5f;
- GetWindowDrawList()->AddRect({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x - flInset + vSize.x, vDrawPos.y - flInset + vSize.y }, F::Render.Background2, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale());
+ GetWindowDrawList()->AddRect(vDrawPos + ImVec2(flInset, flInset), vDrawPos + ImVec2(vSize.x - flInset, vSize.y - flInset), F::Render.Background2, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale());
if (sText.empty())
GetWindowDrawList()->AddText(vDrawPos + GetStyle().FramePadding, F::Render.Inactive, sLabel);
@@ -583,7 +579,7 @@ namespace ImGui
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);
+ ImVec2 vDrawPos = GetDrawPos() + vOriginalPos + ImVec2(flSize / 2, flSize / 2);
pDrawList->AddCircleFilled(vDrawPos, flSize / 2, tTransparent);
}
if (pHovered)
@@ -654,7 +650,7 @@ namespace ImGui
ImDrawList* pDrawList = GetWindowDrawList();
ImVec2 vDrawPos = GetDrawPos();
ImVec2 vOriginalPos = GetCursorPos();
- ImVec2 vPos = vOriginalPos + vDrawPos + ImVec2(GetWindowWidth() - H::Draw.Scale(30), -H::Draw.Scale(1));
+ ImVec2 vPos = vOriginalPos + vDrawPos + ImVec2(GetWindowWidth() - H::Draw.Scale(30), H::Draw.Scale(-1));
PushStyleVar(ImGuiStyleVar_FrameRounding, flRounding);
if (pColor)
@@ -686,10 +682,9 @@ namespace ImGui
static std::unordered_map mLastHeights = {};
static std::vector vStoredLabels = {};
- inline bool Section(const char* sLabel, float flPaddingMod = 0.f, float flMinHeight = 28.f, bool bForceHeight = false, uint32_t uHash = 0)
+ inline bool Section(const char* sLabel, float flPaddingMod = 0.f, float flMinHeight = 28.f, bool bForceHeight = false)
{
- if (!uHash)
- uHash = FNV1A::Hash32(sLabel);
+ uint32_t uHash = FNV1A::Hash32(sLabel);
vStoredLabels.push_back(uHash);
if (!bForceHeight && mLastHeights.contains(uHash) && mLastHeights[uHash] > flMinHeight)
@@ -865,29 +860,29 @@ namespace ImGui
{
case 1: // left
pDrawList->AddRectFilled(
- { vDrawPos.x + vCurBarOffset.x, vDrawPos.y + vCurBarOffset.y + flBarSizeMod },
- { vDrawPos.x + vCurBarOffset.x + H::Draw.Scale(flBarThickness), vDrawPos.y + vCurBarOffset.y - flBarSizeMod + vNewSize.y },
+ vDrawPos + vCurBarOffset + ImVec2(0, flBarSizeMod),
+ vDrawPos + vCurBarOffset + ImVec2(H::Draw.Scale(flBarThickness), vNewSize.y - flBarSizeMod),
F::Render.Accent
);
break;
case 2: // right
pDrawList->AddRectFilled(
- { vDrawPos.x + vCurBarOffset.x + vNewSize.x - H::Draw.Scale(flBarThickness), vDrawPos.y + vCurBarOffset.y + flBarSizeMod },
- { vDrawPos.x + vCurBarOffset.x + vNewSize.x, vDrawPos.y + vCurBarOffset.y - flBarSizeMod + vNewSize.y },
+ vDrawPos + vCurBarOffset + ImVec2(vNewSize.x - H::Draw.Scale(flBarThickness), flBarSizeMod),
+ vDrawPos + vCurBarOffset + ImVec2(vNewSize.x, vNewSize.y - flBarSizeMod),
F::Render.Accent
);
break;
case 3: // top
pDrawList->AddRectFilled(
- { vDrawPos.x + vCurBarOffset.x + flBarSizeMod, vDrawPos.y + vCurBarOffset.y },
- { vDrawPos.x + vCurBarOffset.x - flBarSizeMod + vNewSize.x, vDrawPos.y + vCurBarOffset.y + H::Draw.Scale(flBarThickness) },
+ vDrawPos + vCurBarOffset + ImVec2(flBarSizeMod, 0),
+ vDrawPos + vCurBarOffset + ImVec2(vNewSize.x - flBarSizeMod, H::Draw.Scale(flBarThickness)),
F::Render.Accent
);
break;
case 4: // bottom
pDrawList->AddRectFilled(
- { vDrawPos.x + vCurBarOffset.x + flBarSizeMod, vDrawPos.y + vCurBarOffset.y + vNewSize.y - H::Draw.Scale(flBarThickness) },
- { vDrawPos.x + vCurBarOffset.x - flBarSizeMod + vNewSize.x, vDrawPos.y + vCurBarOffset.y + vNewSize.y },
+ vDrawPos + vCurBarOffset + ImVec2(flBarSizeMod, vNewSize.y - H::Draw.Scale(flBarThickness)),
+ vDrawPos + vCurBarOffset + ImVec2(vNewSize.x - flBarSizeMod, vNewSize.y),
F::Render.Accent
);
break;
@@ -1055,7 +1050,11 @@ namespace ImGui
SetCursorPosX(vSize.x + 20);
}
else
+ {
vSize.x = H::Draw.Scale(vSize.x);
+ if (iFlags & FButtonEnum::SameLine)
+ SameLine();
+ }
vSize.x += H::Draw.Scale(iSizeOffset); vSize.y = H::Draw.Scale(vSize.y);
ImVec2 vOriginalPos = GetCursorPos();
@@ -1069,7 +1068,7 @@ namespace ImGui
PushStyleColor(ImGuiCol_Text, tColor.Value);
bool bReturn = Button(sLabel, vSize);
float flInset = H::Draw.Scale(0.5f) - 0.5f;
- GetWindowDrawList()->AddRect({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x - flInset + vSize.x, vDrawPos.y - flInset + vSize.y }, tColor, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale());
+ GetWindowDrawList()->AddRect(vDrawPos + ImVec2(flInset, flInset), vDrawPos + vSize - ImVec2(flInset, flInset), tColor, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale());
if (bWithin)
{
if (bClicked)
@@ -1077,7 +1076,7 @@ namespace ImGui
else
tColor.Value.w /= 20;
flInset = H::Draw.Scale();
- GetWindowDrawList()->AddRectFilled({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x - flInset + vSize.x, vDrawPos.y - flInset + vSize.y }, tColor, H::Draw.Scale(3));
+ GetWindowDrawList()->AddRectFilled(vDrawPos + ImVec2(flInset, flInset), vDrawPos + vSize - ImVec2(flInset, flInset), tColor, H::Draw.Scale(3));
}
PopStyleColor();
@@ -1087,7 +1086,7 @@ namespace ImGui
*pHovered = IsItemHovered();
SetCursorPos(vOriginalPos);
- AddRowSize(vOriginalPos, { vSize.x, vSize.y + GetStyle().WindowPadding.y });
+ AddRowSize(vOriginalPos, vSize + ImVec2(0, GetStyle().WindowPadding.y));
DebugDummy({ vSize.x, GetRowSize(vSize.y + GetStyle().WindowPadding.y) });
if (pFont)
@@ -1129,18 +1128,18 @@ namespace ImGui
ImColor tTransparent = tColor;
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));
+ ImVec2 vDrawPos = GetDrawPos() + vOriginalPos + ImVec2(H::Draw.Scale(12), H::Draw.Scale(3 + 9 * iWraps));
pDrawList->AddCircleFilled(vDrawPos, H::Draw.Scale(12), tTransparent);
}
if (bReturn)
*pVar = !*pVar;
- SetCursorPos({ vOriginalPos.x + H::Draw.Scale(4), vOriginalPos.y + H::Draw.Scale(-5 + 9 * iWraps) });
+ SetCursorPos(vOriginalPos + ImVec2(H::Draw.Scale(4), H::Draw.Scale(-5 + 9 * iWraps)));
IconImage(*pVar ? ICON_MD_CHECK_BOX : ICON_MD_CHECK_BOX_OUTLINE_BLANK, tColor);
for (size_t i = 0; i < iWraps; i++)
{
- SetCursorPos({ vOriginalPos.x + H::Draw.Scale(24), vOriginalPos.y + H::Draw.Scale(5 + 18 * i) });
+ SetCursorPos(vOriginalPos + ImVec2(H::Draw.Scale(24), H::Draw.Scale(5 + 18 * i)));
TextColored(*pVar ? F::Render.Active : F::Render.Inactive, vWrapped[i].c_str());
}
@@ -1214,9 +1213,9 @@ namespace ImGui
for (size_t i = 0; i < iWraps; i++)
{
#ifdef ALTERNATE_FULL_SLIDER
- SetCursorPos({ vOriginalPos.x + H::Draw.Scale(6), vOriginalPos.y + H::Draw.Scale((bFull ? 5 : 3) + 18 * i) });
+ SetCursorPos(vOriginalPos + ImVec2(H::Draw.Scale(6), H::Draw.Scale((bFull ? 5 : 3) + 18 * i)));
#else
- SetCursorPos({ vOriginalPos.x + H::Draw.Scale(6), vOriginalPos.y + H::Draw.Scale(3 + 18 * i) });
+ SetCursorPos(vOriginalPos + ImVec2(H::Draw.Scale(6), H::Draw.Scale(3 + 18 * i)));
#endif
TextUnformatted(vWrapped[i].c_str());
}
@@ -1290,7 +1289,7 @@ namespace ImGui
if (!Disabled && IsItemHovered() && IsWindowHovered())
SetMouseCursor(ImGuiMouseCursor_TextInput);
if (mActiveMap[uHash2])
- pDrawList->AddRectFilled({ vDrawPos.x + vOriginalPos2.x, vDrawPos.y + vOriginalPos2.y + H::Draw.Scale(14) }, { vDrawPos.x + vOriginalPos2.x + flWidth, vDrawPos.y + vOriginalPos2.y + H::Draw.Scale(15) }, F::Render.Active);
+ pDrawList->AddRectFilled(vDrawPos + vOriginalPos2 + ImVec2(0, H::Draw.Scale(14)), vDrawPos + vOriginalPos2 + ImVec2(flWidth, H::Draw.Scale(15)), F::Render.Active);
else if (IsItemClicked())
{
float* pVar = !pVar2 || GetMousePos().x - vDrawPos.x - vOriginalPos2.x < flWidth / 2 ? pVar1 : pVar2;
@@ -1327,8 +1326,8 @@ namespace ImGui
AddSteppedRect(vDrawPos, vMins, vMaxs, vMins, { flLowerPos, vMaxs.y }, flMin, flMax, flStep, tWashed, tMuted, H::Draw.Scale(2));
AddSteppedRect(vDrawPos, vMins, vMaxs, { flLowerPos, vMins.y }, { flUpperPos, vMaxs.y }, flMin, flMax, flStep, tAccent, tWashed, H::Draw.Scale(2));
AddSteppedRect(vDrawPos, vMins, vMaxs, { flUpperPos, vMins.y }, vMaxs, flMin, flMax, flStep, tWashed, tMuted, H::Draw.Scale(2));
- pDrawList->AddCircleFilled({ vDrawPos.x + flLowerPos, vDrawPos.y + vMins.y + H::Draw.Scale(1) }, H::Draw.Scale(3), tAccent);
- pDrawList->AddCircleFilled({ vDrawPos.x + flUpperPos, vDrawPos.y + vMins.y + H::Draw.Scale(1) }, H::Draw.Scale(3), tAccent);
+ pDrawList->AddCircleFilled(vDrawPos + ImVec2(flLowerPos, vMins.y + H::Draw.Scale(1)), H::Draw.Scale(3), tAccent);
+ pDrawList->AddCircleFilled(vDrawPos + ImVec2(flUpperPos, vMins.y + H::Draw.Scale(1)), H::Draw.Scale(3), tAccent);
if (!Disabled)
{
@@ -1337,7 +1336,7 @@ namespace ImGui
int iVar = vMouse.x - vDrawPos.x < (flLowerPos + flUpperPos) / 2 ? 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(12), tTransparent);
+ pDrawList->AddCircleFilled(vDrawPos + ImVec2((iVar == 1 ? flLowerPos : flUpperPos), vMins.y + H::Draw.Scale(1)), H::Draw.Scale(12), tTransparent);
}
else if (mActiveMap[uHash] && IsMouseDown(ImGuiMouseButton_Left))
{
@@ -1345,7 +1344,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(16), tTransparent);
+ pDrawList->AddCircleFilled(vDrawPos + ImVec2((bVar1 ? flLowerPos : flUpperPos), vMins.y + H::Draw.Scale(1)), H::Draw.Scale(16), tTransparent);
}
else
mActiveMap[uHash] = false;
@@ -1364,7 +1363,7 @@ namespace ImGui
AddSteppedRect(vDrawPos, vMins, vMaxs, vMins, { flPos, vMaxs.y }, flMin, flMax, flStep, tAccent, tWashed, H::Draw.Scale(2));
AddSteppedRect(vDrawPos, vMins, vMaxs, { flPos, vMins.y }, vMaxs, flMin, flMax, flStep, tWashed, tMuted, H::Draw.Scale(2));
- pDrawList->AddCircleFilled({ vDrawPos.x + flPos, vDrawPos.y + vMins.y + H::Draw.Scale(1) }, H::Draw.Scale(3), tAccent);
+ pDrawList->AddCircleFilled(vDrawPos + ImVec2(flPos, vMins.y + H::Draw.Scale(1)), H::Draw.Scale(3), tAccent);
if (!Disabled)
{
@@ -1372,13 +1371,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(12), tTransparent);
+ pDrawList->AddCircleFilled(vDrawPos + ImVec2(flPos, 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(16), tTransparent);
+ pDrawList->AddCircleFilled(vDrawPos + ImVec2(flPos, vMins.y + H::Draw.Scale(1)), H::Draw.Scale(16), tTransparent);
}
else
mActiveMap[uHash] = false;
@@ -1389,7 +1388,7 @@ namespace ImGui
}
PopStyleColor();
- SetCursorPos({ vOriginalPos.x + vMins.x - 6, vOriginalPos.y + vMins.y - 6 });
+ SetCursorPos(vOriginalPos + vMins + ImVec2(-6, -6));
Button("##", { vMaxs.x - vMins.x + 12, 14 }); // don't drag it around
SetCursorPos(vOriginalPos);
AddRowSize(vOriginalPos, vSize);
@@ -1539,7 +1538,7 @@ namespace ImGui
{
ImVec2 vDrawPos = GetDrawPos(); float flPosY = GetCursorPosY();
ImColor tInactive = F::Render.Inactive; tInactive.Value.w *= GetStyle().Alpha;
- GetWindowDrawList()->AddRectFilled({ vDrawPos.x + H::Draw.Scale(17), vDrawPos.y + flPosY }, { vDrawPos.x + GetWindowWidth() - H::Draw.Scale(17), vDrawPos.y + flPosY + H::Draw.Scale(1) }, tInactive);
+ GetWindowDrawList()->AddRectFilled(vDrawPos + ImVec2(H::Draw.Scale(17), flPosY), vDrawPos + ImVec2(GetWindowWidth() - H::Draw.Scale(17), flPosY + H::Draw.Scale(1)), tInactive);
DebugDummy({});
continue;
}
@@ -1560,11 +1559,11 @@ namespace ImGui
}
ImVec2 vOriginalPos3 = GetCursorPos();
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(40), vOriginalPos2.y });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(40), 0));
TextColored(bFlagActive ? F::Render.Active : F::Render.Inactive, sStripped.c_str());
SameLine(); DebugDummy({ H::Draw.Scale(!GetCurrentWindow()->ScrollbarY ? 16 : 9), 0 });
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(15), vOriginalPos2.y - H::Draw.Scale(1) });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(15), H::Draw.Scale(-1)));
IconImage(bFlagActive ? ICON_MD_CHECK_BOX : ICON_MD_CHECK_BOX_OUTLINE_BLANK, bFlagActive ? F::Render.Accent : F::Render.Inactive);
SetCursorPos(vOriginalPos3);
}
@@ -1573,7 +1572,7 @@ namespace ImGui
ImVec2 vOriginalPos2 = GetCursorPos();
if (iFlags & FDropdownEnum::Modifiable)
{
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(11), vOriginalPos2.y - H::Draw.Scale(5) });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(11), 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);
@@ -1583,13 +1582,13 @@ namespace ImGui
*pVar = vValues[i], bReturn = true;
ImVec2 vOriginalPos3 = GetCursorPos();
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(iFlags & FDropdownEnum::Modifiable ? 40 : 18), vOriginalPos2.y });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(iFlags & FDropdownEnum::Modifiable ? 40 : 18), 0));
TextColored(*pVar == vValues[i] ? F::Render.Active : F::Render.Inactive, sStripped.c_str());
SameLine(); DebugDummy({ H::Draw.Scale(!GetCurrentWindow()->ScrollbarY ? 16 : 9), 0 });
if (iFlags & FDropdownEnum::Modifiable) // do second image here so as to not cover
{
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(15), vOriginalPos2.y - H::Draw.Scale(1) });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(15), H::Draw.Scale(-1)));
IconImage(vValues[i] == -1 ? ICON_MD_ADD_CIRCLE : ICON_MD_REMOVE_CIRCLE);
}
SetCursorPos(vOriginalPos3);
@@ -1612,23 +1611,23 @@ namespace ImGui
if (bTitle)
{
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(12), vOriginalPos2.y - H::Draw.Scale(6) });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(12), H::Draw.Scale(-6)));
PushFont(F::Render.FontSmall);
TextColored(F::Render.Inactive, TruncateText(StripDoubleHash(sLabel), vSize.x - H::Draw.Scale(45)).c_str());
PopFont();
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(12), vOriginalPos2.y + H::Draw.Scale(8) });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(12), H::Draw.Scale(8)));
TextUnformatted(TruncateText(sPreview, vSize.x - H::Draw.Scale(45)).c_str());
- SetCursorPos({ vOriginalPos2.x + vSize.x - H::Draw.Scale(24), vOriginalPos2.y - H::Draw.Scale(1) });
+ SetCursorPos(vOriginalPos2 + ImVec2(vSize.x - H::Draw.Scale(24), H::Draw.Scale(-1)));
IconImage(bActive ? ICON_MD_KEYBOARD_ARROW_UP : ICON_MD_KEYBOARD_ARROW_DOWN);
}
else
{
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(12), vOriginalPos2.y });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(12), 0));
TextUnformatted(TruncateText(sPreview, vSize.x - H::Draw.Scale(45)).c_str());
- SetCursorPos({ vOriginalPos2.x + vSize.x - H::Draw.Scale(24), vOriginalPos2.y - H::Draw.Scale(1) });
+ SetCursorPos(vOriginalPos2 + ImVec2(vSize.x - H::Draw.Scale(24), H::Draw.Scale(-1)));
IconImage(bActive ? ICON_MD_KEYBOARD_ARROW_UP : ICON_MD_KEYBOARD_ARROW_DOWN);
}
@@ -1639,7 +1638,7 @@ namespace ImGui
PopStyleVar();
SetCursorPos(vOriginalPos);
- AddRowSize(vOriginalPos, { vSize.x, vSize.y + GetStyle().WindowPadding.y });
+ AddRowSize(vOriginalPos, vSize + ImVec2(0, GetStyle().WindowPadding.y));
DebugDummy({ vSize.x, GetRowSize(vSize.y + GetStyle().WindowPadding.y) });
if (Transparent || Disabled)
@@ -1771,7 +1770,7 @@ namespace ImGui
{
ImVec2 vDrawPos = GetDrawPos(); float flPosY = GetCursorPosY();
ImColor tInactive = F::Render.Inactive; tInactive.Value.w *= GetStyle().Alpha;
- GetWindowDrawList()->AddRectFilled({ vDrawPos.x + H::Draw.Scale(17), vDrawPos.y + flPosY }, { vDrawPos.x + GetWindowWidth() - H::Draw.Scale(17), vDrawPos.y + flPosY + H::Draw.Scale(1) }, tInactive);
+ GetWindowDrawList()->AddRectFilled(vDrawPos + ImVec2(H::Draw.Scale(17), flPosY), vDrawPos + ImVec2(GetWindowWidth() - H::Draw.Scale(17), flPosY + H::Draw.Scale(1)), tInactive);
DebugDummy({});
}
bDivider = true;
@@ -1792,7 +1791,7 @@ namespace ImGui
*pVar = sEntry, bReturn = true;
ImVec2 vOriginalPos4 = GetCursorPos();
- SetCursorPos({ vOriginalPos3.x + H::Draw.Scale(18), vOriginalPos3.y });
+ SetCursorPos(vOriginalPos3 + ImVec2(H::Draw.Scale(18), 0));
TextColored(bActive ? F::Render.Active : F::Render.Inactive, sEntry.c_str());
SameLine(); DebugDummy({ H::Draw.Scale(!GetCurrentWindow()->ScrollbarY ? 16 : 9), 0 });
SetCursorPos(vOriginalPos4);
@@ -1821,17 +1820,17 @@ namespace ImGui
if (bTitle)
{
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(12), vOriginalPos2.y - H::Draw.Scale(5) });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(12), H::Draw.Scale(-6)));
PushFont(F::Render.FontSmall);
TextColored(F::Render.Inactive, TruncateText(StripDoubleHash(sLabel), vSize.x - H::Draw.Scale(vEntries.empty() ? 24 : 45)).c_str());
PopFont();
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(12), vOriginalPos2.y + H::Draw.Scale(8) });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(12), H::Draw.Scale(8)));
TextUnformatted(TruncateText(mActiveMap[uHash] ? sPreview : *pVar, vSize.x - H::Draw.Scale(vEntries.empty() ? 24 : 45)).c_str());
if (!vEntries.empty())
{
- SetCursorPos({ vOriginalPos2.x + vSize.x - H::Draw.Scale(24), vOriginalPos2.y - H::Draw.Scale(1) });
+ SetCursorPos(vOriginalPos2 + ImVec2(vSize.x - H::Draw.Scale(24), H::Draw.Scale(-1)));
IconImage(mActiveMap[uHash] ? ICON_MD_KEYBOARD_ARROW_UP : ICON_MD_KEYBOARD_ARROW_DOWN);
}
@@ -1839,17 +1838,17 @@ namespace ImGui
{
ImVec2 vDrawPos = GetDrawPos() + vOriginalPos2 + ImVec2(H::Draw.Scale(12), H::Draw.Scale(22));
vDrawPos.x = floorf(vDrawPos.x), vDrawPos.y = floorf(vDrawPos.y);
- GetWindowDrawList()->AddRectFilled({ vDrawPos.x, vDrawPos.y }, { vDrawPos.x + vSize.x - H::Draw.Scale(vEntries.empty() ? 25 : 45), vDrawPos.y + H::Draw.Scale(2) }, mActiveMap[uHash] ? F::Render.Active : F::Render.Inactive);
+ GetWindowDrawList()->AddRectFilled(vDrawPos, vDrawPos + ImVec2(vSize.x - H::Draw.Scale(vEntries.empty() ? 25 : 45), H::Draw.Scale(2)), mActiveMap[uHash] ? F::Render.Active : F::Render.Inactive);
}
}
else
{
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(12), vOriginalPos2.y });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(12), 0));
TextUnformatted(TruncateText(mActiveMap[uHash] ? sPreview : *pVar, vSize.x - H::Draw.Scale(vEntries.empty() ? 24 : 45)).c_str());
if (!vEntries.empty())
{
- SetCursorPos({ vOriginalPos2.x + vSize.x - H::Draw.Scale(24), vOriginalPos2.y - H::Draw.Scale(1) });
+ SetCursorPos(vOriginalPos2 + ImVec2(vSize.x - H::Draw.Scale(24), H::Draw.Scale(-1)));
IconImage(mActiveMap[uHash] ? ICON_MD_KEYBOARD_ARROW_UP : ICON_MD_KEYBOARD_ARROW_DOWN);
}
@@ -1857,7 +1856,7 @@ namespace ImGui
{
ImVec2 vDrawPos = GetDrawPos() + vOriginalPos2 + ImVec2(H::Draw.Scale(12), H::Draw.Scale(14));
vDrawPos.x = floorf(vDrawPos.x), vDrawPos.y = floorf(vDrawPos.y);
- GetWindowDrawList()->AddRectFilled({ vDrawPos.x, vDrawPos.y }, { vDrawPos.x + vSize.x - H::Draw.Scale(vEntries.empty() ? 25 : 45), vDrawPos.y + H::Draw.Scale(2) }, mActiveMap[uHash] ? F::Render.Active : F::Render.Inactive);
+ GetWindowDrawList()->AddRectFilled(vDrawPos, vDrawPos + ImVec2(vSize.x - H::Draw.Scale(vEntries.empty() ? 25 : 45), H::Draw.Scale(2)), mActiveMap[uHash] ? F::Render.Active : F::Render.Inactive);
}
}
@@ -1873,7 +1872,7 @@ namespace ImGui
PopStyleVar();
SetCursorPos(vOriginalPos);
- AddRowSize(vOriginalPos, { vSize.x, vSize.y + GetStyle().WindowPadding.y });
+ AddRowSize(vOriginalPos, vSize + ImVec2(0, GetStyle().WindowPadding.y));
DebugDummy({ vSize.x, GetRowSize(vSize.y + GetStyle().WindowPadding.y) });
if (Transparent || Disabled)
@@ -1917,7 +1916,7 @@ namespace ImGui
return bReturn;
}
- // if items overlap, use before to have working input, e.g. a middle toggle and a color picker
+ // if items overlap, use before to have working input, e.g. a right toggle and a color picker
inline bool FColorPicker(const char* sLabel, Color_t* pColor, int iFlags = FColorPickerEnum::None, ImVec2 vOffset = {}, ImVec2 vSize = { H::Draw.Scale(12), H::Draw.Scale(12) }, ImVec2 vIconOffset = {}, bool* pHovered = nullptr)
{
if (Transparent || Disabled)
@@ -1994,7 +1993,7 @@ namespace ImGui
for (size_t i = 0; i < iWraps; i++)
{
- SetCursorPos({ vOriginalPos2.x + vIconOffset.x + vSize.x + H::Draw.Scale(6), vOriginalPos2.y + vContentSize.y / 2 + H::Draw.Scale(2 - 9 * iWraps + 18 * int(i)) });
+ SetCursorPos(vOriginalPos2 + ImVec2(vIconOffset.x + vSize.x + H::Draw.Scale(6), vContentSize.y / 2 + H::Draw.Scale(2 - 9 * iWraps + 18 * int(i))));
TextUnformatted(vWrapped[i].c_str());
}
@@ -2249,7 +2248,7 @@ namespace ImGui
{
ImVec2 vDrawPos = GetDrawPos(); float flPosY = GetCursorPosY();
ImColor tInactive = F::Render.Inactive; tInactive.Value.w *= GetStyle().Alpha;
- GetWindowDrawList()->AddRectFilled({ vDrawPos.x + H::Draw.Scale(17), vDrawPos.y + flPosY }, { vDrawPos.x + GetWindowWidth() - H::Draw.Scale(17), vDrawPos.y + flPosY + H::Draw.Scale(1) }, tInactive);
+ GetWindowDrawList()->AddRectFilled(vDrawPos + ImVec2(H::Draw.Scale(17), flPosY), vDrawPos + ImVec2(GetWindowWidth() - H::Draw.Scale(17), flPosY + H::Draw.Scale(1)), tInactive);
DebugDummy({});
continue;
}
@@ -2261,7 +2260,7 @@ namespace ImGui
ImVec2 vOriginalPos2 = GetCursorPos();
if (bFlagActive) // do here so as to not sink input
{
- SetCursorPos({ vOriginalPos2.x + vSize.x - H::Draw.Scale(31), vOriginalPos2.y + H::Draw.Scale(1) });
+ SetCursorPos(vOriginalPos2 + ImVec2(vSize.x - H::Draw.Scale(31), H::Draw.Scale(1)));
ColorPicker(std::format("MaterialColor{}", iEntry).c_str(), &it->second->second, false);
SetCursorPos(vOriginalPos2);
}
@@ -2279,13 +2278,13 @@ namespace ImGui
// shift based on number of digits in var size
ImVec2 vOriginalPos3 = GetCursorPos();
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(40 + 6 * int(log10(std::max(pVar->size(), 1ui64)))), vOriginalPos2.y });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(40 + 6 * int(log10(std::max(pVar->size(), 1ui64)))), 0));
TextColored(bFlagActive ? F::Render.Active : F::Render.Inactive, (bHovered ? sEntry : TruncateText(sEntry, vSize.x - (bFlagActive ? 81 : 57))).c_str());
SameLine(); DebugDummy({ H::Draw.Scale(!GetCurrentWindow()->ScrollbarY ? 16 : 9), 0 });
if (bFlagActive)
{
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(18), vOriginalPos2.y });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(18), 0));
TextColored(F::Render.Accent, "%i", iEntry);
}
SetCursorPos(vOriginalPos3);
@@ -2305,23 +2304,23 @@ namespace ImGui
if (bTitle)
{
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(12), vOriginalPos2.y - H::Draw.Scale(5) });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(12), H::Draw.Scale(-6)));
PushFont(F::Render.FontSmall);
TextColored(F::Render.Inactive, TruncateText(StripDoubleHash(sLabel), vSize.x - H::Draw.Scale(45)).c_str());
PopFont();
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(12), vOriginalPos2.y + H::Draw.Scale(8) });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(12), H::Draw.Scale(8)));
TextUnformatted(TruncateText(sPreview, vSize.x - H::Draw.Scale(45)).c_str());
- SetCursorPos({ vOriginalPos2.x + vSize.x - H::Draw.Scale(24), vOriginalPos2.y - H::Draw.Scale(1) });
+ SetCursorPos(vOriginalPos2 + ImVec2(vSize.x - H::Draw.Scale(24), H::Draw.Scale(-1)));
IconImage(bActive ? ICON_MD_KEYBOARD_ARROW_UP : ICON_MD_KEYBOARD_ARROW_DOWN);
}
else
{
- SetCursorPos({ vOriginalPos2.x + H::Draw.Scale(12), vOriginalPos2.y });
+ SetCursorPos(vOriginalPos2 + ImVec2(H::Draw.Scale(12), 0));
TextUnformatted(TruncateText(sPreview, vSize.x - H::Draw.Scale(45)).c_str());
- SetCursorPos({ vOriginalPos2.x + vSize.x - H::Draw.Scale(24), vOriginalPos2.y - H::Draw.Scale(1) });
+ SetCursorPos(vOriginalPos2 + ImVec2(vSize.x - H::Draw.Scale(24), H::Draw.Scale(-1)));
IconImage(bActive ? ICON_MD_KEYBOARD_ARROW_UP : ICON_MD_KEYBOARD_ARROW_DOWN);
}
@@ -2332,7 +2331,7 @@ namespace ImGui
PopStyleVar();
SetCursorPos(vOriginalPos);
- AddRowSize(vOriginalPos, { vSize.x, vSize.y + GetStyle().WindowPadding.y });
+ AddRowSize(vOriginalPos, vSize + ImVec2(0, GetStyle().WindowPadding.y));
DebugDummy({ vSize.x, GetRowSize(vSize.y + GetStyle().WindowPadding.y) });
if (Transparent || Disabled)
diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.cpp b/Amalgam/src/Features/ImGui/Menu/Menu.cpp
index d83e54d0..81affb15 100644
--- a/Amalgam/src/Features/ImGui/Menu/Menu.cpp
+++ b/Amalgam/src/Features/ImGui/Menu/Menu.cpp
@@ -11,6 +11,7 @@
#include "../../Misc/Misc.h"
#include "../../Output/Output.h"
#include "../../World/World.h"
+#include "../../Simulation/ProjectileSimulation/ProjectileSimulation.h"
void CMenu::DrawMenu()
{
@@ -41,9 +42,9 @@ void CMenu::DrawMenu()
if (CurrentBind != DEFAULT_BIND) // bind
{
flOffset = H::Draw.Scale(60);
- pDrawList->AddRectFilled({ vDrawPos.x, vDrawPos.y }, { vDrawPos.x + flSize - flInset, vDrawPos.y + flOffset - flInset }, F::Render.Background0, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopLeft);
- pDrawList->AddRectFilled({ vDrawPos.x, vDrawPos.y + flOffset - flInset }, { vDrawPos.x + flSize - flInset, vDrawPos.y + flOffset }, F::Render.Background2);
- pDrawList->AddRectFilled({ vDrawPos.x, vDrawPos.y + flOffset }, { vDrawPos.x + flSize - flInset, vDrawPos.y + vWindowSize.y }, F::Render.Background0, H::Draw.Scale(3), ImDrawFlags_RoundCornersBottomLeft);
+ pDrawList->AddRectFilled(vDrawPos, vDrawPos + ImVec2(flSize - flInset, flOffset - flInset), F::Render.Background0, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopLeft);
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(0, flOffset - flInset), vDrawPos + ImVec2(flSize - flInset, flOffset), F::Render.Background2);
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(0, flOffset), vDrawPos + ImVec2(flSize - flInset, vWindowSize.y), F::Render.Background0, H::Draw.Scale(3), ImDrawFlags_RoundCornersBottomLeft);
SetCursorPos({ H::Draw.Scale(12), H::Draw.Scale(11) });
FText("Editing bind", 0, F::Render.FontRegular);
@@ -59,9 +60,9 @@ void CMenu::DrawMenu()
else if (!Vars::Menu::CheatTitle.Value.empty()) // title
{
flOffset = H::Draw.Scale(36);
- pDrawList->AddRectFilled({ vDrawPos.x, vDrawPos.y }, { vDrawPos.x + flSize - flInset, vDrawPos.y + flOffset - flInset }, F::Render.Background0, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopLeft);
- pDrawList->AddRectFilled({ vDrawPos.x, vDrawPos.y + flOffset - flInset }, { vDrawPos.x + flSize - flInset, vDrawPos.y + flOffset }, F::Render.Background2);
- pDrawList->AddRectFilled({ vDrawPos.x, vDrawPos.y + flOffset }, { vDrawPos.x + flSize - flInset, vDrawPos.y + vWindowSize.y }, F::Render.Background0, H::Draw.Scale(3), ImDrawFlags_RoundCornersBottomLeft);
+ pDrawList->AddRectFilled(vDrawPos, vDrawPos + ImVec2(flSize - flInset, flOffset - flInset), F::Render.Background0, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopLeft);
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(0, flOffset - flInset), vDrawPos + ImVec2(flSize - flInset, flOffset), F::Render.Background2);
+ pDrawList->AddRectFilled(vDrawPos + ImVec2(0, flOffset), vDrawPos + ImVec2(flSize - flInset, vWindowSize.y), F::Render.Background0, H::Draw.Scale(3), ImDrawFlags_RoundCornersBottomLeft);
SetCursorPos({ H::Draw.Scale(12), H::Draw.Scale(11) });
PushStyleColor(ImGuiCol_Text, F::Render.Accent.Value);
@@ -69,27 +70,28 @@ void CMenu::DrawMenu()
PopStyleColor();
}
else
- pDrawList->AddRectFilled({ vDrawPos.x, vDrawPos.y }, { vDrawPos.x + flSize - flInset, vDrawPos.y + vWindowSize.y }, F::Render.Background0, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersBottomLeft);
+ pDrawList->AddRectFilled(vDrawPos, vDrawPos + ImVec2(flSize - flInset, vWindowSize.y), F::Render.Background0, H::Draw.Scale(3), ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersBottomLeft);
PushClipRect({ 0, 0 }, { ImGui::GetIO().DisplaySize.x, ImGui::GetIO().DisplaySize.y }, false);
RenderTwoToneBackground(flSize, {}, F::Render.Background1, F::Render.Background2, 0.f, false);
PopClipRect();
- static int iTab = 0, iAimbotTab = 0, iVisualsTab = 0, iMiscTab = 0, iLogsTab = 0, iSettingsTab = 0;
+ static int iTab = 0, iAimbotTab = 0, iVisualsTab = 0, iLogsTab = 0, iSettingsTab = 0;
PushFont(F::Render.FontBold);
FTabs(
{
{ "AIMBOT", "GENERAL", "DRAW" },
+ { "HVH" },
{ "VISUALS", "ESP", "MISC##", "MENU" },
- { "MISC", "MAIN", "HVH" },
+ { "MISC" },
{ "LOGS", "PLAYERLIST", "SETTINGS##", "OUTPUT" },
{ "SETTINGS", "CONFIG", "BINDS", "MATERIALS", "EXTRA" }
},
- { &iTab, &iAimbotTab, &iVisualsTab, &iMiscTab, &iLogsTab, &iSettingsTab },
+ { &iTab, &iAimbotTab, nullptr, &iVisualsTab, nullptr, &iLogsTab, &iSettingsTab },
{ flSize - H::Draw.Scale(16), H::Draw.Scale(36) },
{ H::Draw.Scale(8), H::Draw.Scale(8) + flOffset },
FTabsEnum::Vertical | FTabsEnum::HorizontalIcons | FTabsEnum::AlignLeft | FTabsEnum::BarLeft,
- { { ICON_MD_PERSON }, { ICON_MD_VISIBILITY }, { ICON_MD_ARTICLE }, { ICON_MD_IMPORT_CONTACTS }, { ICON_MD_SETTINGS } },
+ { { ICON_MD_PERSON }, { ICON_MD_BOLT }, { ICON_MD_VISIBILITY }, { ICON_MD_ARTICLE }, { ICON_MD_IMPORT_CONTACTS }, { ICON_MD_SETTINGS } },
{ H::Draw.Scale(10), 0 }, {},
{}, { H::Draw.Scale(22), 0 }
);
@@ -117,10 +119,11 @@ void CMenu::DrawMenu()
switch (iTab)
{
case 0: MenuAimbot(iAimbotTab); break;
- case 1: MenuVisuals(iVisualsTab); break;
- case 2: MenuMisc(iMiscTab); break;
- case 3: MenuLogs(iLogsTab); break;
- case 4: MenuSettings(iSettingsTab); break;
+ case 1: MenuHVH(); break;
+ case 2: MenuVisuals(iVisualsTab); break;
+ case 3: MenuMisc(); break;
+ case 4: MenuLogs(iLogsTab); break;
+ case 5: MenuSettings(iSettingsTab); break;
}
}
else
@@ -140,7 +143,7 @@ void CMenu::MenuAimbot(int iTab)
switch (iTab)
{
- // General
+ // General
case 0:
{
if (BeginTable("AimbotTable", 2))
@@ -376,28 +379,30 @@ void CMenu::MenuAimbot(int iTab)
{
if (Section("Line", 8))
{
- FColorPicker(Vars::Colors::Line, FColorPickerEnum::None, { -H::Draw.Scale(12), 0 });
- FColorPicker(Vars::Colors::LineIgnoreZ);
+ FColorPicker(Vars::Colors::LineIgnoreZ, FColorPickerEnum::None, { 0, H::Draw.Scale(6) }, { H::Draw.Scale(12), H::Draw.Scale(6) });
+ FColorPicker(Vars::Colors::Line, FColorPickerEnum::None, {}, { H::Draw.Scale(12), H::Draw.Scale(6) });
FToggle(Vars::Visuals::Line::Enabled);
FSlider(Vars::Visuals::Line::DrawDuration);
} EndSection();
if (Section("Hitbox"))
{
- FDropdown(Vars::Visuals::Hitbox::BonesEnabled, FDropdownEnum::None, -50);
- FColorPicker(Vars::Colors::BoneHitboxEdge, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(20) });
- FColorPicker(Vars::Colors::BoneHitboxEdgeIgnoreZ, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(20) });
- FColorPicker(Vars::Colors::BoneHitboxFace, FColorPickerEnum::SameLine, { H::Draw.Scale(10), 0 }, { H::Draw.Scale(10), H::Draw.Scale(20) });
- FColorPicker(Vars::Colors::BoneHitboxFaceIgnoreZ, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(20) });
- FColorPicker(Vars::Colors::TargetHitboxEdge, FColorPickerEnum::SameLine, { -H::Draw.Scale(50), H::Draw.Scale(20) }, { H::Draw.Scale(10), H::Draw.Scale(20) });
- FColorPicker(Vars::Colors::TargetHitboxEdgeIgnoreZ, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(20) });
- FColorPicker(Vars::Colors::TargetHitboxFace, FColorPickerEnum::SameLine, { H::Draw.Scale(10), 0 }, { H::Draw.Scale(10), H::Draw.Scale(20) });
- FColorPicker(Vars::Colors::TargetHitboxFaceIgnoreZ, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(20) });
+ FDropdown(Vars::Visuals::Hitbox::BonesEnabled, FDropdownEnum::None, -20);
+ FColorPicker(Vars::Colors::TargetHitboxEdgeIgnoreZ, FColorPickerEnum::SameLine, { 0, H::Draw.Scale(30) }, { H::Draw.Scale(10), H::Draw.Scale(10) });
+ FColorPicker(Vars::Colors::TargetHitboxEdge, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(-10) }, { H::Draw.Scale(10), H::Draw.Scale(10) });
+ FColorPicker(Vars::Colors::BoneHitboxEdgeIgnoreZ, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(-10) }, { H::Draw.Scale(10), H::Draw.Scale(10) });
+ FColorPicker(Vars::Colors::BoneHitboxEdge, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(-10) }, { H::Draw.Scale(10), H::Draw.Scale(10) });
+ FColorPicker(Vars::Colors::TargetHitboxFaceIgnoreZ, FColorPickerEnum::SameLine, { 0, H::Draw.Scale(30) }, { H::Draw.Scale(10), H::Draw.Scale(10) });
+ FColorPicker(Vars::Colors::TargetHitboxFace, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(-10) }, { H::Draw.Scale(10), H::Draw.Scale(10) });
+ FColorPicker(Vars::Colors::BoneHitboxFaceIgnoreZ, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(-10) }, { H::Draw.Scale(10), H::Draw.Scale(10) });
+ FColorPicker(Vars::Colors::BoneHitboxFace, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(-10) }, { H::Draw.Scale(10), H::Draw.Scale(10) });
+ SameLine(); DebugDummy({ 2, H::Draw.Scale(48) });
- FDropdown(Vars::Visuals::Hitbox::BoundsEnabled, FDropdownEnum::None, -50);
- FColorPicker(Vars::Colors::BoundHitboxEdge, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) });
- FColorPicker(Vars::Colors::BoundHitboxEdgeIgnoreZ, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) });
- FColorPicker(Vars::Colors::BoundHitboxFace, FColorPickerEnum::SameLine, { H::Draw.Scale(10), 0 }, { H::Draw.Scale(10), H::Draw.Scale(40) });
- FColorPicker(Vars::Colors::BoundHitboxFaceIgnoreZ, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) });
+ FDropdown(Vars::Visuals::Hitbox::BoundsEnabled, FDropdownEnum::None, -20);
+ FColorPicker(Vars::Colors::BoundHitboxEdgeIgnoreZ, FColorPickerEnum::SameLine, { 0, H::Draw.Scale(20) }, { H::Draw.Scale(10), H::Draw.Scale(20) });
+ FColorPicker(Vars::Colors::BoundHitboxEdge, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(-20) }, { H::Draw.Scale(10), H::Draw.Scale(20) });
+ FColorPicker(Vars::Colors::BoundHitboxFaceIgnoreZ, FColorPickerEnum::SameLine, { 0, H::Draw.Scale(20) }, {H::Draw.Scale(10), H::Draw.Scale(20)});
+ FColorPicker(Vars::Colors::BoundHitboxFace, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(-20) }, { H::Draw.Scale(10), H::Draw.Scale(20) });
+ SameLine(); DebugDummy({ 0, H::Draw.Scale(48) });
FSlider(Vars::Visuals::Hitbox::DrawDuration);
} EndSection();
@@ -405,43 +410,53 @@ void CMenu::MenuAimbot(int iTab)
/* Column 2 */
TableNextColumn();
{
+ if (Section("Prediction"))
+ {
+ FDropdown(Vars::Visuals::Prediction::PlayerPath, FDropdownEnum::Left, -10);
+ FColorPicker(Vars::Colors::PlayerPathIgnoreZ, FColorPickerEnum::SameLine, { 0, H::Draw.Scale(20) }, { H::Draw.Scale(10), H::Draw.Scale(20) });
+ FColorPicker(Vars::Colors::PlayerPath, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(-20) }, { H::Draw.Scale(10), H::Draw.Scale(20) });
+ SameLine(); DebugDummy({ 0, H::Draw.Scale(48) });
+ FDropdown(Vars::Visuals::Prediction::ProjectilePath, FDropdownEnum::Right, -10);
+ FColorPicker(Vars::Colors::ProjectilePathIgnoreZ, FColorPickerEnum::SameLine, { 0, H::Draw.Scale(20) }, { H::Draw.Scale(10), H::Draw.Scale(20) });
+ FColorPicker(Vars::Colors::ProjectilePath, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(-20) }, { H::Draw.Scale(10), H::Draw.Scale(20) });
+ SameLine(); DebugDummy({ 0, H::Draw.Scale(48) });
+ FToggle(Vars::Visuals::Prediction::SwingLines);
+ FSlider(Vars::Visuals::Prediction::PlayerDrawDuration, FSliderEnum::Left, !Vars::Visuals::Prediction::PlayerDrawDuration[DEFAULT_BIND] ? "timed" : "%g");
+ FSlider(Vars::Visuals::Prediction::ProjectileDrawDuration, FSliderEnum::Right, !Vars::Visuals::Prediction::ProjectileDrawDuration[DEFAULT_BIND] ? "timed" : "%g");
+ } EndSection();
if (Section("Simulation"))
{
- FDropdown(Vars::Visuals::Simulation::PlayerPath, FDropdownEnum::Left, -20);
- FColorPicker(Vars::Colors::PlayerPath, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) });
- FColorPicker(Vars::Colors::PlayerPathIgnoreZ, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) });
- FDropdown(Vars::Visuals::Simulation::ProjectilePath, FDropdownEnum::Right, -20);
- FColorPicker(Vars::Colors::ProjectilePath, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) });
- FColorPicker(Vars::Colors::ProjectilePathIgnoreZ, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) });
- FDropdown(Vars::Visuals::Simulation::TrajectoryPath, FDropdownEnum::Left, -20);
- FColorPicker(Vars::Colors::TrajectoryPath, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) });
- FColorPicker(Vars::Colors::TrajectoryPathIgnoreZ, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) });
- FDropdown(Vars::Visuals::Simulation::ShotPath, FDropdownEnum::Right, -20);
- FColorPicker(Vars::Colors::ShotPath, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) });
- FColorPicker(Vars::Colors::ShotPathIgnoreZ, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) });
- FDropdown(Vars::Visuals::Simulation::SplashRadius, FDropdownEnum::None, -20);
- FColorPicker(Vars::Colors::SplashRadius, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) });
- FColorPicker(Vars::Colors::SplashRadiusIgnoreZ, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) });
- FToggle(Vars::Visuals::Simulation::Timed, FToggleEnum::Left);
- FToggle(Vars::Visuals::Simulation::Box, FToggleEnum::Right);
+ FDropdown(Vars::Visuals::Simulation::TrajectoryPath, FDropdownEnum::Left, -10);
+ FColorPicker(Vars::Colors::TrajectoryPathIgnoreZ, FColorPickerEnum::SameLine, { 0, H::Draw.Scale(20) }, { H::Draw.Scale(10), H::Draw.Scale(20) });
+ FColorPicker(Vars::Colors::TrajectoryPath, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(-20) }, { H::Draw.Scale(10), H::Draw.Scale(20) });
+ SameLine(); DebugDummy({ 0, H::Draw.Scale(48) });
+ FDropdown(Vars::Visuals::Simulation::ShotPath, FDropdownEnum::Right, -10);
+ FColorPicker(Vars::Colors::ShotPathIgnoreZ, FColorPickerEnum::SameLine, { 0, H::Draw.Scale(20) }, { H::Draw.Scale(10), H::Draw.Scale(20) });
+ FColorPicker(Vars::Colors::ShotPath, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(-20) }, { H::Draw.Scale(10), H::Draw.Scale(20) });
+ SameLine(); DebugDummy({ 0, H::Draw.Scale(48) });
+ FDropdown(Vars::Visuals::Simulation::SplashRadius, FDropdownEnum::None, -10);
+ FColorPicker(Vars::Colors::SplashRadiusIgnoreZ, FColorPickerEnum::SameLine, { 0, H::Draw.Scale(20) }, { H::Draw.Scale(10), H::Draw.Scale(20) });
+ FColorPicker(Vars::Colors::SplashRadius, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(-20) }, { H::Draw.Scale(10), H::Draw.Scale(20) });
+ SameLine(); DebugDummy({ 0, H::Draw.Scale(48) });
FToggle(Vars::Visuals::Simulation::ProjectileCamera, FToggleEnum::Left);
- FToggle(Vars::Visuals::Simulation::SwingLines, FToggleEnum::Right);
- FSlider(Vars::Visuals::Simulation::DrawDuration);
+ FToggle(Vars::Visuals::Simulation::Box, FToggleEnum::Right);
} EndSection();
if (Vars::Debug::Options.Value)
{
if (Section("##Debug Part1", -8))
{
- FDropdown(Vars::Visuals::Simulation::RealPath, FDropdownEnum::None, -20);
- FColorPicker(Vars::Colors::RealPath, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) });
- FColorPicker(Vars::Colors::RealPathIgnoreZ, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(40) });
+ FDropdown(Vars::Visuals::Prediction::RealPath, FDropdownEnum::None, -10);
+ FColorPicker(Vars::Colors::RealPath, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(20) });
+ FColorPicker(Vars::Colors::RealPathIgnoreZ, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(20) }, { H::Draw.Scale(10), H::Draw.Scale(20) });
- FSlider(Vars::Visuals::Simulation::SeparatorSpacing, FSliderEnum::Left);
- FSlider(Vars::Visuals::Simulation::SeparatorLength, FSliderEnum::Right);
+ FSlider(Vars::Visuals::Path::SeparatorSpacing, FSliderEnum::Left);
+ FSlider(Vars::Visuals::Path::SeparatorLength, FSliderEnum::Right);
} EndSection();
if (Section("##Debug Part2"))
{
FToggle(Vars::Visuals::Trajectory::Override);
+ bool bApply = FButton("Apply current");
+ FSDropdown(Vars::Visuals::Trajectory::Type);
FSlider(Vars::Visuals::Trajectory::OffsetX);
FSlider(Vars::Visuals::Trajectory::OffsetY);
FSlider(Vars::Visuals::Trajectory::OffsetZ);
@@ -464,6 +479,64 @@ void CMenu::MenuAimbot(int iTab)
FSlider(Vars::Visuals::Trajectory::AngularDragZ);
FSlider(Vars::Visuals::Trajectory::MaxVelocity);
FSlider(Vars::Visuals::Trajectory::MaxAngularVelocity);
+
+ if (bApply)
+ {
+ auto pLocal = H::Entities.GetLocal();
+ auto pWeapon = H::Entities.GetWeapon();
+ if (pLocal && pWeapon)
+ {
+ ProjectileInfo tProjInfo = {};
+ bool bOriginal = Vars::Visuals::Trajectory::Override.Value;
+ Vars::Visuals::Trajectory::Override.Value = false;
+ bool bSetup = F::ProjSim.GetInfo(pLocal, pWeapon, {}, tProjInfo, ProjSimEnum::Interp)
+ && F::ProjSim.Initialize(tProjInfo, false);
+ Vars::Visuals::Trajectory::Override.Value = bOriginal;
+ if (bSetup)
+ {
+ Vec3 vLocalEye = pLocal->GetEyePosition();
+ Vec3 vOffset = tProjInfo.m_vPos - vLocalEye; vOffset.y *= -1;
+ float flForwardRedirect = 0.f, flForwardCutoff = 0.f;
+ switch (tProjInfo.m_uType)
+ {
+ case FNV1A::Hash32Const("models/weapons/w_models/w_rocket.mdl"):
+ case FNV1A::Hash32Const("models/weapons/w_models/w_drg_ball.mdl"):
+ case FNV1A::Hash32Const("models/weapons/w_models/w_flaregun_shell.mdl"):
+ case FNV1A::Hash32Const("models/weapons/w_models/w_arrow.mdl"):
+ case FNV1A::Hash32Const("models/weapons/w_models/w_syringe_proj.mdl"):
+ case FNV1A::Hash32Const("models/weapons/w_models/w_repair_claw.mdl"):
+ flForwardRedirect = 2000.f, flForwardCutoff = 0.1f; break;
+ case FNV1A::Hash32Const("models/weapons/c_models/c_flameball/c_flameball.mdl"):
+ flForwardRedirect = H::ConVars.FindVar("tf_fireball_distance")->GetFloat(), flForwardCutoff = 1.f;
+ }
+ physics_performanceparams_t params = {}; F::ProjSim.m_pEnv->GetPerformanceSettings(¶ms);
+ Vec3 vVelocity, vAngVelocity; F::ProjSim.m_pObj->GetVelocity(&vVelocity, &vAngVelocity);
+
+ Vars::Visuals::Trajectory::OffsetX[DEFAULT_BIND] = vOffset.x;
+ Vars::Visuals::Trajectory::OffsetY[DEFAULT_BIND] = vOffset.y;
+ Vars::Visuals::Trajectory::OffsetZ[DEFAULT_BIND] = vOffset.z;
+ Vars::Visuals::Trajectory::ForwardRedirect[DEFAULT_BIND] = flForwardRedirect;
+ Vars::Visuals::Trajectory::ForwardCutoff[DEFAULT_BIND] = flForwardCutoff;
+ Vars::Visuals::Trajectory::Hull[DEFAULT_BIND] = tProjInfo.m_vHull.x;
+ Vars::Visuals::Trajectory::Speed[DEFAULT_BIND] = vVelocity.x;
+ Vars::Visuals::Trajectory::Gravity[DEFAULT_BIND] = tProjInfo.m_flGravity;
+ Vars::Visuals::Trajectory::LifeTime[DEFAULT_BIND] = tProjInfo.m_flLifetime;
+ Vars::Visuals::Trajectory::UpVelocity[DEFAULT_BIND] = vVelocity.z;
+ Vars::Visuals::Trajectory::AngularVelocityX[DEFAULT_BIND] = vAngVelocity.x;
+ Vars::Visuals::Trajectory::AngularVelocityY[DEFAULT_BIND] = vAngVelocity.y;
+ Vars::Visuals::Trajectory::AngularVelocityZ[DEFAULT_BIND] = vAngVelocity.z;
+ Vars::Visuals::Trajectory::Drag[DEFAULT_BIND] = F::ProjSim.m_pObj->m_dragCoefficient;
+ Vars::Visuals::Trajectory::DragX[DEFAULT_BIND] = F::ProjSim.m_pObj->m_dragBasis.x;
+ Vars::Visuals::Trajectory::DragY[DEFAULT_BIND] = F::ProjSim.m_pObj->m_dragBasis.y;
+ Vars::Visuals::Trajectory::DragZ[DEFAULT_BIND] = F::ProjSim.m_pObj->m_dragBasis.z;
+ Vars::Visuals::Trajectory::AngularDragX[DEFAULT_BIND] = F::ProjSim.m_pObj->m_angDragBasis.x;
+ Vars::Visuals::Trajectory::AngularDragY[DEFAULT_BIND] = F::ProjSim.m_pObj->m_angDragBasis.y;
+ Vars::Visuals::Trajectory::AngularDragZ[DEFAULT_BIND] = F::ProjSim.m_pObj->m_angDragBasis.z;
+ Vars::Visuals::Trajectory::MaxVelocity[DEFAULT_BIND] = params.maxVelocity;
+ Vars::Visuals::Trajectory::MaxAngularVelocity[DEFAULT_BIND] = params.maxAngularVelocity;
+ }
+ }
+ }
} EndSection();
}
}
@@ -474,13 +547,167 @@ void CMenu::MenuAimbot(int iTab)
}
}
+void CMenu::MenuHVH(int iTab)
+{
+ using namespace ImGui;
+
+ switch (iTab)
+ {
+ // HvH
+ case 0:
+ {
+ if (BeginTable("HvHTable", 2))
+ {
+ /* Column 1 */
+ TableNextColumn();
+ {
+ if (Section("Doubletap", 8))
+ {
+ FToggle(Vars::Doubletap::Doubletap, FToggleEnum::Left);
+ FToggle(Vars::Doubletap::Warp, FToggleEnum::Right);
+ FToggle(Vars::Doubletap::RechargeTicks, FToggleEnum::Left);
+ FToggle(Vars::Doubletap::AntiWarp, FToggleEnum::Right);
+ FSlider(Vars::Doubletap::TickLimit, FSliderEnum::Left);
+ FSlider(Vars::Doubletap::WarpRate, FSliderEnum::Right);
+ FSlider(Vars::Doubletap::RechargeLimit, FSliderEnum::Left);
+ FSlider(Vars::Doubletap::PassiveRecharge, FSliderEnum::Right);
+ } EndSection();
+ if (Section("Fakelag"))
+ {
+ FDropdown(Vars::Fakelag::Fakelag, FSliderEnum::Left);
+ FDropdown(Vars::Fakelag::Options, FDropdownEnum::Right);
+ PushTransparent(Vars::Fakelag::Fakelag.Value != Vars::Fakelag::FakelagEnum::Plain);
+ {
+ FSlider(Vars::Fakelag::PlainTicks, FSliderEnum::Left);
+ }
+ PopTransparent();
+ PushTransparent(Vars::Fakelag::Fakelag.Value != Vars::Fakelag::FakelagEnum::Random);
+ {
+ FSlider(Vars::Fakelag::RandomTicks, FSliderEnum::Right);
+ }
+ PopTransparent();
+ FToggle(Vars::Fakelag::UnchokeOnAttack, FToggleEnum::Left);
+ FToggle(Vars::Fakelag::RetainBlastJump, FToggleEnum::Right);
+ } EndSection();
+ if (Vars::Debug::Options.Value)
+ {
+ if (Section("##Debug"))
+ {
+ FToggle(Vars::Fakelag::RetainSoldierOnly);
+ } EndSection();
+ }
+ if (Section("Antiaim", 8))
+ {
+ FToggle(Vars::AntiAim::Enabled);
+ FDropdown(Vars::AntiAim::PitchReal, FDropdownEnum::Left);
+ FDropdown(Vars::AntiAim::PitchFake, FDropdownEnum::Right);
+ FDropdown(Vars::AntiAim::YawReal, FDropdownEnum::Left);
+ FDropdown(Vars::AntiAim::YawFake, FDropdownEnum::Right);
+ FDropdown(Vars::AntiAim::RealYawBase, FDropdownEnum::Left);
+ FDropdown(Vars::AntiAim::FakeYawBase, FDropdownEnum::Right);
+ FSlider(Vars::AntiAim::RealYawOffset, FSliderEnum::Left);
+ FSlider(Vars::AntiAim::FakeYawOffset, FSliderEnum::Right);
+ PushTransparent(Vars::AntiAim::YawReal.Value != Vars::AntiAim::YawEnum::Edge && Vars::AntiAim::YawReal.Value != Vars::AntiAim::YawEnum::Jitter);
+ {
+ FSlider(Vars::AntiAim::RealYawValue, FSliderEnum::Left);
+ }
+ PopTransparent();
+ PushTransparent(Vars::AntiAim::YawFake.Value != Vars::AntiAim::YawEnum::Edge && Vars::AntiAim::YawFake.Value != Vars::AntiAim::YawEnum::Jitter);
+ {
+ FSlider(Vars::AntiAim::FakeYawValue, FSliderEnum::Right);
+ }
+ PopTransparent();
+ PushTransparent(Vars::AntiAim::YawFake.Value != Vars::AntiAim::YawEnum::Spin && Vars::AntiAim::YawReal.Value != Vars::AntiAim::YawEnum::Spin);
+ {
+ FSlider(Vars::AntiAim::SpinSpeed, FSliderEnum::Left);
+ }
+ PopTransparent();
+ SetCursorPos({ GetWindowWidth() / 2 + GetStyle().WindowPadding.x / 2, GetRowPos() + H::Draw.Scale(8) });
+ FToggle(Vars::AntiAim::MinWalk, FToggleEnum::Left);
+ FToggle(Vars::AntiAim::AntiOverlap, FToggleEnum::Left);
+ FToggle(Vars::AntiAim::InvalidShootPitch, FToggleEnum::Right);
+ } EndSection();
+ }
+ /* Column 2 */
+ TableNextColumn();
+ {
+ if (Section("Resolver", 8))
+ {
+ FToggle(Vars::Resolver::Enabled, FToggleEnum::Left);
+ PushTransparent(!Vars::Resolver::Enabled.Value);
+ {
+ FToggle(Vars::Resolver::AutoResolve, FToggleEnum::Right);
+ PushTransparent(Transparent || !Vars::Resolver::AutoResolve.Value);
+ {
+ FToggle(Vars::Resolver::AutoResolveCheatersOnly, FToggleEnum::Left);
+ FToggle(Vars::Resolver::AutoResolveHeadshotOnly, FToggleEnum::Right);
+ PushTransparent(Transparent || !Vars::Resolver::AutoResolveYawAmount.Value);
+ {
+ FSlider(Vars::Resolver::AutoResolveYawAmount, FSliderEnum::Left);
+ }
+ PopTransparent();
+ PushTransparent(Transparent || !Vars::Resolver::AutoResolvePitchAmount.Value);
+ {
+ FSlider(Vars::Resolver::AutoResolvePitchAmount, FSliderEnum::Right);
+ }
+ PopTransparent();
+ }
+ PopTransparent();
+ FSlider(Vars::Resolver::CycleYaw, FSliderEnum::Left);
+ FSlider(Vars::Resolver::CyclePitch, FSliderEnum::Right);
+ FToggle(Vars::Resolver::CycleView, FToggleEnum::Left);
+ FToggle(Vars::Resolver::CycleMinwalk, FToggleEnum::Right);
+ }
+ PopTransparent();
+ } EndSection();
+ if (Section("Auto Peek", 8))
+ {
+ FToggle(Vars::AutoPeek::Enabled);
+ } EndSection();
+ if (Section("Cheater Detection"))
+ {
+ FDropdown(Vars::CheaterDetection::Methods);
+ PushTransparent(!Vars::CheaterDetection::DetectionsRequired.Value);
+ {
+ FSlider(Vars::CheaterDetection::DetectionsRequired);
+ }
+ PopTransparent();
+ PushTransparent(!(Vars::CheaterDetection::Methods.Value & Vars::CheaterDetection::MethodsEnum::PacketChoking));
+ {
+ FSlider(Vars::CheaterDetection::MinimumChoking);
+ }
+ PopTransparent();
+ PushTransparent(!(Vars::CheaterDetection::Methods.Value & Vars::CheaterDetection::MethodsEnum::AimFlicking));
+ {
+ FSlider(Vars::CheaterDetection::MinimumFlick, FSliderEnum::Left);
+ FSlider(Vars::CheaterDetection::MaximumNoise, FSliderEnum::Right);
+ }
+ PopTransparent();
+ } EndSection();
+ if (Section("Speedhack", 8))
+ {
+ FToggle(Vars::Speedhack::Enabled);
+ PushTransparent(!Vars::Speedhack::Enabled.Value);
+ {
+ FSlider(Vars::Speedhack::Amount);
+ }
+ PopTransparent();
+ } EndSection();
+ }
+ EndTable();
+ }
+ break;
+ }
+ }
+}
+
void CMenu::MenuVisuals(int iTab)
{
using namespace ImGui;
switch (iTab)
{
- // ESP
+ // ESP
case 0:
{
// fake angle/viewmodel visuals, pickup timers?
@@ -517,12 +744,12 @@ void CMenu::MenuVisuals(int iTab)
PopStyleColor();
auto fPositionToIndex = [](ImVec2 vPos)
- {
- int iIndex = floorf((vPos.y - GetCursorPosY() - H::Draw.Scale(4)) / H::Draw.Scale(36)) * 2
- + (vPos.x > GetWindowWidth() / 2 ? 1 : 0);
- iIndex = std::clamp(iIndex, 0, int(F::Groups.m_vGroups.size() - 1));
- return iIndex;
- };
+ {
+ int iIndex = floorf((vPos.y - GetCursorPosY() - H::Draw.Scale(4)) / H::Draw.Scale(36)) * 2
+ + (vPos.x > GetWindowWidth() / 2 ? 1 : 0);
+ iIndex = std::clamp(iIndex, 0, int(F::Groups.m_vGroups.size() - 1));
+ return iIndex;
+ };
static int iDragging = -1;
if (!IsMouseDown(ImGuiMouseButton_Left))
@@ -533,6 +760,12 @@ void CMenu::MenuVisuals(int iTab)
if (iDragging != iTo)
{
F::Groups.Move(iDragging, iTo);
+ if (iCurrentGroup == iDragging)
+ iCurrentGroup = iTo;
+ else if (iCurrentGroup < iDragging && iCurrentGroup >= iTo)
+ iCurrentGroup++;
+ else if (iCurrentGroup > iDragging && iCurrentGroup <= iTo)
+ iCurrentGroup--;
iDragging = iTo;
}
}
@@ -552,27 +785,27 @@ void CMenu::MenuVisuals(int iTab)
ImColor tColor = ColorToVec(tGroup.m_tColor.Lerp(Vars::Menu::Theme::Background.Value, 0.5f, LerpEnum::NoAlpha));
ImVec2 vDrawPos = GetDrawPos() + vOriginalPos;
if (iCurrentGroup != iGroup)
- GetWindowDrawList()->AddRectFilled(vDrawPos, { vDrawPos.x + flWidth, vDrawPos.y + flHeight }, tColor, H::Draw.Scale(4));
+ GetWindowDrawList()->AddRectFilled(vDrawPos, vDrawPos + ImVec2(flWidth, flHeight), tColor, H::Draw.Scale(4));
else
{
ImColor tColor2 = { tColor.Value.x * 1.1f, tColor.Value.y * 1.1f, tColor.Value.z * 1.1f, tColor.Value.w };
- GetWindowDrawList()->AddRectFilled(vDrawPos, { vDrawPos.x + flWidth, vDrawPos.y + flHeight }, tColor2, H::Draw.Scale(4));
+ GetWindowDrawList()->AddRectFilled(vDrawPos, vDrawPos + ImVec2(flWidth, flHeight), tColor2, H::Draw.Scale(4));
tColor2 = ColorToVec(tGroup.m_tColor.Lerp(Vars::Menu::Theme::Background.Value, 0.25f, LerpEnum::NoAlpha));
float flInset = H::Draw.Scale(0.5f) - 0.5f;
- GetWindowDrawList()->AddRect({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x - flInset + flWidth, vDrawPos.y - flInset + flHeight }, tColor2, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale());
+ GetWindowDrawList()->AddRect(vDrawPos + ImVec2(flInset, flInset), vDrawPos + ImVec2(flWidth - flInset, flHeight - flInset), tColor2, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale());
}
// text + icons
float flTextWidth = flWidth - H::Draw.Scale(36);
- SetCursorPos({ vOriginalPos.x + H::Draw.Scale(9), vOriginalPos.y + H::Draw.Scale(7) });
+ SetCursorPos(vOriginalPos + ImVec2(H::Draw.Scale(9), H::Draw.Scale(7)));
PushTransparent(!(Vars::ESP::ActiveGroups.Value & 1 << iGroup), true);
{
FText(TruncateText(tGroup.m_sName, flTextWidth).c_str());
}
PopTransparent(1, 1);
- SetCursorPos({ vOriginalPos.x + flWidth - H::Draw.Scale(26), vOriginalPos.y + H::Draw.Scale(2) });
+ SetCursorPos(vOriginalPos + ImVec2(flWidth - H::Draw.Scale(26), H::Draw.Scale(2)));
bool bDelete = IconButton(ICON_MD_DELETE);
SetCursorPos(vOriginalPos);
@@ -989,8 +1222,9 @@ void CMenu::MenuVisuals(int iTab)
{
FDropdown(Vars::Menu::Indicators);
if (FSlider(Vars::Menu::Scale))
- H::Fonts.Reload(Vars::Menu::Scale[DEFAULT_BIND]);
- FToggle(Vars::Menu::CheapText);
+ H::Fonts.Reload();
+ if (FToggle(Vars::Menu::CheapText))
+ H::Fonts.Reload();
} EndSection();
if (Vars::Debug::Options.Value)
{
@@ -1021,7 +1255,7 @@ void CMenu::MenuMisc(int iTab)
switch (iTab)
{
- // Main
+ // Main
case 0:
{
if (BeginTable("MiscTable", 2))
@@ -1131,151 +1365,6 @@ void CMenu::MenuMisc(int iTab)
}
break;
}
- // HvH
- case 1:
- {
- if (BeginTable("HvHTable", 2))
- {
- /* Column 1 */
- TableNextColumn();
- {
- if (Section("Doubletap", 8))
- {
- FToggle(Vars::Doubletap::Doubletap, FToggleEnum::Left);
- FToggle(Vars::Doubletap::Warp, FToggleEnum::Right);
- FToggle(Vars::Doubletap::RechargeTicks, FToggleEnum::Left);
- FToggle(Vars::Doubletap::AntiWarp, FToggleEnum::Right);
- FSlider(Vars::Doubletap::TickLimit, FSliderEnum::Left);
- FSlider(Vars::Doubletap::WarpRate, FSliderEnum::Right);
- FSlider(Vars::Doubletap::RechargeLimit, FSliderEnum::Left);
- FSlider(Vars::Doubletap::PassiveRecharge, FSliderEnum::Right);
- } EndSection();
- if (Section("Fakelag"))
- {
- FDropdown(Vars::Fakelag::Fakelag, FSliderEnum::Left);
- FDropdown(Vars::Fakelag::Options, FDropdownEnum::Right);
- PushTransparent(Vars::Fakelag::Fakelag.Value != Vars::Fakelag::FakelagEnum::Plain);
- {
- FSlider(Vars::Fakelag::PlainTicks, FSliderEnum::Left);
- }
- PopTransparent();
- PushTransparent(Vars::Fakelag::Fakelag.Value != Vars::Fakelag::FakelagEnum::Random);
- {
- FSlider(Vars::Fakelag::RandomTicks, FSliderEnum::Right);
- }
- PopTransparent();
- FToggle(Vars::Fakelag::UnchokeOnAttack, FToggleEnum::Left);
- FToggle(Vars::Fakelag::RetainBlastJump, FToggleEnum::Right);
- } EndSection();
- if (Vars::Debug::Options.Value)
- {
- if (Section("##Debug"))
- {
- FToggle(Vars::Fakelag::RetainSoldierOnly);
- } EndSection();
- }
- if (Section("Antiaim", 8))
- {
- FToggle(Vars::AntiAim::Enabled);
- FDropdown(Vars::AntiAim::PitchReal, FDropdownEnum::Left);
- FDropdown(Vars::AntiAim::PitchFake, FDropdownEnum::Right);
- FDropdown(Vars::AntiAim::YawReal, FDropdownEnum::Left);
- FDropdown(Vars::AntiAim::YawFake, FDropdownEnum::Right);
- FDropdown(Vars::AntiAim::RealYawBase, FDropdownEnum::Left);
- FDropdown(Vars::AntiAim::FakeYawBase, FDropdownEnum::Right);
- FSlider(Vars::AntiAim::RealYawOffset, FSliderEnum::Left);
- FSlider(Vars::AntiAim::FakeYawOffset, FSliderEnum::Right);
- PushTransparent(Vars::AntiAim::YawReal.Value != Vars::AntiAim::YawEnum::Edge && Vars::AntiAim::YawReal.Value != Vars::AntiAim::YawEnum::Jitter);
- {
- FSlider(Vars::AntiAim::RealYawValue, FSliderEnum::Left);
- }
- PopTransparent();
- PushTransparent(Vars::AntiAim::YawFake.Value != Vars::AntiAim::YawEnum::Edge && Vars::AntiAim::YawFake.Value != Vars::AntiAim::YawEnum::Jitter);
- {
- FSlider(Vars::AntiAim::FakeYawValue, FSliderEnum::Right);
- }
- PopTransparent();
- PushTransparent(Vars::AntiAim::YawFake.Value != Vars::AntiAim::YawEnum::Spin && Vars::AntiAim::YawReal.Value != Vars::AntiAim::YawEnum::Spin);
- {
- FSlider(Vars::AntiAim::SpinSpeed, FSliderEnum::Left);
- }
- PopTransparent();
- SetCursorPos({ GetWindowWidth() / 2 + GetStyle().WindowPadding.x / 2, GetRowPos() + H::Draw.Scale(8) });
- FToggle(Vars::AntiAim::MinWalk, FToggleEnum::Left);
- FToggle(Vars::AntiAim::AntiOverlap, FToggleEnum::Left);
- FToggle(Vars::AntiAim::InvalidShootPitch, FToggleEnum::Right);
- } EndSection();
- }
- /* Column 2 */
- TableNextColumn();
- {
- if (Section("Resolver", 8))
- {
- FToggle(Vars::Resolver::Enabled, FToggleEnum::Left);
- PushTransparent(!Vars::Resolver::Enabled.Value);
- {
- FToggle(Vars::Resolver::AutoResolve, FToggleEnum::Right);
- PushTransparent(Transparent || !Vars::Resolver::AutoResolve.Value);
- {
- FToggle(Vars::Resolver::AutoResolveCheatersOnly, FToggleEnum::Left);
- FToggle(Vars::Resolver::AutoResolveHeadshotOnly, FToggleEnum::Right);
- PushTransparent(Transparent || !Vars::Resolver::AutoResolveYawAmount.Value);
- {
- FSlider(Vars::Resolver::AutoResolveYawAmount, FSliderEnum::Left);
- }
- PopTransparent();
- PushTransparent(Transparent || !Vars::Resolver::AutoResolvePitchAmount.Value);
- {
- FSlider(Vars::Resolver::AutoResolvePitchAmount, FSliderEnum::Right);
- }
- PopTransparent();
- }
- PopTransparent();
- FSlider(Vars::Resolver::CycleYaw, FSliderEnum::Left);
- FSlider(Vars::Resolver::CyclePitch, FSliderEnum::Right);
- FToggle(Vars::Resolver::CycleView, FToggleEnum::Left);
- FToggle(Vars::Resolver::CycleMinwalk, FToggleEnum::Right);
- }
- PopTransparent();
- } EndSection();
- if (Section("Auto Peek", 8))
- {
- FToggle(Vars::AutoPeek::Enabled);
- } EndSection();
- if (Section("Cheater Detection"))
- {
- FDropdown(Vars::CheaterDetection::Methods);
- PushTransparent(!Vars::CheaterDetection::DetectionsRequired.Value);
- {
- FSlider(Vars::CheaterDetection::DetectionsRequired);
- }
- PopTransparent();
- PushTransparent(!(Vars::CheaterDetection::Methods.Value & Vars::CheaterDetection::MethodsEnum::PacketChoking));
- {
- FSlider(Vars::CheaterDetection::MinimumChoking);
- }
- PopTransparent();
- PushTransparent(!(Vars::CheaterDetection::Methods.Value & Vars::CheaterDetection::MethodsEnum::AimFlicking));
- {
- FSlider(Vars::CheaterDetection::MinimumFlick, FSliderEnum::Left);
- FSlider(Vars::CheaterDetection::MaximumNoise, FSliderEnum::Right);
- }
- PopTransparent();
- } EndSection();
- if (Section("Speedhack", 8))
- {
- FToggle(Vars::Speedhack::Enabled);
- PushTransparent(!Vars::Speedhack::Enabled.Value);
- {
- FSlider(Vars::Speedhack::Amount);
- }
- PopTransparent();
- } EndSection();
- }
- EndTable();
- }
- break;
- }
}
}
@@ -1285,7 +1374,7 @@ void CMenu::MenuLogs(int iTab)
switch (iTab)
{
- // PlayerList
+ // PlayerList
case 0:
{
if (Section("Players"))
@@ -1307,309 +1396,323 @@ void CMenu::MenuLogs(int iTab)
}
auto fGetTeamColor = [&](int iTeam, bool bAlive)
+ {
+ switch (iTeam)
{
- switch (iTeam)
- {
- case 3: return Color_t(100, 150, 200, bAlive ? 255 : 127).Lerp(Vars::Menu::Theme::Background.Value, 0.5f, LerpEnum::NoAlpha);
- case 2: return Color_t(255, 100, 100, bAlive ? 255 : 127).Lerp(Vars::Menu::Theme::Background.Value, 0.5f, LerpEnum::NoAlpha);
- }
- return Color_t(127, 127, 127, 255).Lerp(Vars::Menu::Theme::Background.Value, 0.5f, LerpEnum::NoAlpha);
- };
+ case 3: return Color_t(100, 150, 200, bAlive ? 255 : 127).Lerp(Vars::Menu::Theme::Background.Value, 0.5f, LerpEnum::NoAlpha);
+ case 2: return Color_t(255, 100, 100, bAlive ? 255 : 127).Lerp(Vars::Menu::Theme::Background.Value, 0.5f, LerpEnum::NoAlpha);
+ }
+ return Color_t(127, 127, 127, 255).Lerp(Vars::Menu::Theme::Background.Value, 0.5f, LerpEnum::NoAlpha);
+ };
auto fDrawPlayer = [&](const ListPlayer& tPlayer, int x, int y)
+ {
+ ImVec2 vOriginalPos = { !x ? GetStyle().WindowPadding.x : GetWindowWidth() / 2 + GetStyle().WindowPadding.x / 2, H::Draw.Scale(35 + 36 * y) };
+
+ // background
+ float flWidth = GetWindowWidth() / 2 - GetStyle().WindowPadding.x * 1.5f;
+ float flHeight = H::Draw.Scale(28);
+ ImColor tColor = ColorToVec(fGetTeamColor(tPlayer.m_iTeam, tPlayer.m_bAlive));
+ ImVec2 vDrawPos = GetDrawPos() + vOriginalPos;
+ GetWindowDrawList()->AddRectFilled(vDrawPos, vDrawPos + ImVec2(flWidth, flHeight), tColor, H::Draw.Scale(4));
+
+ // tag bar
+ bool bPopup = false;
+ float flBarWidth = 0.f;
+
+ if (!tPlayer.m_bFake)
{
- ImVec2 vOriginalPos = { !x ? GetStyle().WindowPadding.x : GetWindowWidth() / 2 + GetStyle().WindowPadding.x / 2, H::Draw.Scale(35 + 36 * y) };
-
- // background
- float flWidth = GetWindowWidth() / 2 - GetStyle().WindowPadding.x * 1.5f;
- float flHeight = H::Draw.Scale(28);
- ImColor tColor = ColorToVec(fGetTeamColor(tPlayer.m_iTeam, tPlayer.m_bAlive));
- ImVec2 vDrawPos = GetDrawPos() + vOriginalPos;
- GetWindowDrawList()->AddRectFilled(vDrawPos, { vDrawPos.x + flWidth, vDrawPos.y + flHeight }, tColor, H::Draw.Scale(4));
-
- // text + icons
- int lOffset = H::Draw.Scale(10);
- if (tPlayer.m_bLocal || F::Spectate.GetTarget(true) == tPlayer.m_iUserID || tPlayer.m_bFriend || tPlayer.m_bParty)
+ std::vector vLabels = {};
+ std::vector> vTags = {};
+ if (int iParty = tPlayer.m_iParty)
{
- lOffset += H::Draw.Scale(19);
- SetCursorPos({ vOriginalPos.x + H::Draw.Scale(7), vOriginalPos.y + H::Draw.Scale(6) });
- if (tPlayer.m_bLocal)
- IconImage(ICON_MD_PERSON);
- else if (F::Spectate.GetTarget(true) == tPlayer.m_iUserID)
- IconImage(ICON_MD_VISIBILITY);
- else if (tPlayer.m_bFriend)
- IconImage(ICON_MD_GROUP);
- else if (tPlayer.m_bParty)
- IconImage(ICON_MD_GROUPS);
+ 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));
}
- SetCursorPos({ vOriginalPos.x + lOffset, vOriginalPos.y + H::Draw.Scale(7) });
- auto sName = TruncateText(tPlayer.m_sName, flWidth / 2 - lOffset);
- FText(sName.c_str());
- lOffset += FCalcTextSize(sName.c_str()).x + H::Draw.Scale(8);
-
- // buttons
- bool bPopup = false;
-
- if (!tPlayer.m_bFake)
+ if (tPlayer.m_bF2P)
{
- // tag bar
- SetCursorPos({ vOriginalPos.x + lOffset, vOriginalPos.y });
- if (BeginChild(std::format("TagBar{}", tPlayer.m_iUserID).c_str(), { flWidth - lOffset - H::Draw.Scale(4), flHeight }, ImGuiWindowFlags_None, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoBackground))
+ 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))
+ vTags.emplace_back(pTag, iID);
+ }
+
+ if (!vLabels.empty() || !vTags.empty())
+ {
+ PushFont(F::Render.FontSmall);
+ flBarWidth = H::Draw.Scale(4);
+ for (auto& tTag : vLabels)
+ flBarWidth += FCalcTextSize(tTag.m_sName.c_str()).x + H::Draw.Scale(14);
+ for (auto& [pTag, iID] : vTags)
+ flBarWidth += FCalcTextSize(pTag->m_sName.c_str()).x + H::Draw.Scale(iID ? 29 : 14);
+
+ flBarWidth = std::min(flBarWidth, flWidth / 2);
+
+ SetCursorPos(vOriginalPos + ImVec2(flWidth - floorf(flBarWidth), 0));
+ if (BeginChild(std::format("TagBar{}", tPlayer.m_iUserID).c_str(), { flBarWidth, flHeight }, ImGuiWindowFlags_None, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoBackground))
{
- std::vector vLabels = {};
- std::vector> vTags = {};
- 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)
- {
- 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))
- vTags.emplace_back(pTag, iID);
- }
-
- PushFont(F::Render.FontSmall);
const auto vDrawPos = GetDrawPos();
- float flTagOffset = 0;
+ float flTagOffset = H::Draw.Scale(4);
auto fDrawTag = [&](PriorityLabel_t& tTag, int iID)
+ {
+ ImColor tTagColor = ColorToVec(tTag.m_tColor);
+ float flTagWidth = FCalcTextSize(tTag.m_sName.c_str()).x + H::Draw.Scale(!iID ? 10 : 25);
+ float flTagHeight = H::Draw.Scale(20);
+ ImVec2 vTagPos = { flTagOffset, H::Draw.Scale(4) };
+
+ GetWindowDrawList()->AddRectFilled(vDrawPos + vTagPos, vDrawPos + vTagPos + ImVec2(flTagWidth, flTagHeight), tTagColor, H::Draw.Scale(4));
+ SetCursorPos(vTagPos + ImVec2(H::Draw.Scale(5), H::Draw.Scale(3)));
+ TextColored(VecToColor(tColor).Blend(tTag.m_tColor).IsColorBright() ? ImVec4(0, 0, 0, 1) : ImVec4(1, 1, 1, 1), tTag.m_sName.c_str());
+ if (iID)
{
- ImColor tTagColor = ColorToVec(tTag.m_tColor);
- float flTagWidth = FCalcTextSize(tTag.m_sName.c_str()).x + H::Draw.Scale(!iID ? 10 : 25);
- float flTagHeight = H::Draw.Scale(20);
- ImVec2 vTagPos = { flTagOffset, H::Draw.Scale(4) };
+ SetCursorPos(vTagPos + ImVec2(flTagWidth - H::Draw.Scale(22), H::Draw.Scale(-2)));
+ if (IconButton(ICON_MD_CANCEL))
+ F::PlayerUtils.RemoveTag(tPlayer.m_uAccountID, iID, true, tPlayer.m_sName.c_str());
+ }
- GetWindowDrawList()->AddRectFilled(vDrawPos + vTagPos, { vDrawPos.x + vTagPos.x + flTagWidth, vDrawPos.y + vTagPos.y + flTagHeight }, tTagColor, H::Draw.Scale(4));
- SetCursorPos({ vTagPos.x + H::Draw.Scale(5), vTagPos.y + H::Draw.Scale(3) });
- TextColored(VecToColor(tColor).Blend(tTag.m_tColor).IsColorBright() ? ImVec4(0, 0, 0, 1) : ImVec4(1, 1, 1, 1), tTag.m_sName.c_str());
- if (iID)
- {
- SetCursorPos({ vTagPos.x + flTagWidth - H::Draw.Scale(22), vTagPos.y - H::Draw.Scale(2) });
- if (IconButton(ICON_MD_CANCEL))
- F::PlayerUtils.RemoveTag(tPlayer.m_uAccountID, iID, true, tPlayer.m_sName.c_str());
- }
-
- flTagOffset += flTagWidth + H::Draw.Scale(4);
- };
+ flTagOffset += flTagWidth + H::Draw.Scale(4);
+ };
for (auto& tTag : vLabels)
fDrawTag(tTag, 0);
for (auto& [pTag, iID] : vTags)
fDrawTag(*pTag, iID);
- PopFont();
+ SetCursorPosX(flTagOffset); DebugDummy({});
} EndChild();
+ PopFont();
bPopup = IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right);
}
- SetCursorPos(vOriginalPos);
- Button(std::format("##{}", tPlayer.m_iUserID).c_str(), { flWidth, flHeight });
- bPopup |= IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right);
+ }
- // popups
- if (bPopup)
- OpenPopup(std::format("RightClicked{}", tPlayer.m_iUserID).c_str());
+ // text + icons
+ int lOffset = H::Draw.Scale(10);
+ if (tPlayer.m_bLocal || F::Spectate.GetTarget(true) == tPlayer.m_iUserID || tPlayer.m_bFriend || tPlayer.m_bParty)
+ {
+ lOffset += H::Draw.Scale(19);
+ SetCursorPos(vOriginalPos + ImVec2(H::Draw.Scale(7), H::Draw.Scale(6)));
+ if (tPlayer.m_bLocal)
+ IconImage(ICON_MD_PERSON);
+ else if (F::Spectate.GetTarget(true) == tPlayer.m_iUserID)
+ IconImage(ICON_MD_VISIBILITY);
+ else if (tPlayer.m_bFriend)
+ IconImage(ICON_MD_GROUP);
+ else if (tPlayer.m_bParty)
+ IconImage(ICON_MD_GROUPS);
+ }
+ SetCursorPos(vOriginalPos + ImVec2(lOffset, H::Draw.Scale(7)));
+ auto sName = TruncateText(tPlayer.m_sName, flWidth - lOffset - flBarWidth);
+ FText(sName.c_str());
+ lOffset += FCalcTextSize(sName.c_str()).x + H::Draw.Scale(8);
- if (FBeginPopup(std::format("RightClicked{}", tPlayer.m_iUserID).c_str()))
+ // buttons
+ SetCursorPos(vOriginalPos);
+ Button(std::format("##{}", tPlayer.m_iUserID).c_str(), { flWidth, flHeight });
+ bPopup |= IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right);
+
+ // popups
+ if (bPopup)
+ OpenPopup(std::format("RightClicked{}", tPlayer.m_iUserID).c_str());
+
+ if (FBeginPopup(std::format("RightClicked{}", tPlayer.m_iUserID).c_str()))
+ {
+ PushStyleVar(ImGuiStyleVar_ItemSpacing, { H::Draw.Scale(8), H::Draw.Scale(8) });
+
+ if (!tPlayer.m_bFake)
{
- PushStyleVar(ImGuiStyleVar_ItemSpacing, { H::Draw.Scale(8), H::Draw.Scale(8) });
+ if (FSelectable("Profile"))
+ I::SteamFriends->ActivateGameOverlayToUser("steamid", CSteamID(tPlayer.m_uAccountID, k_EUniversePublic, k_EAccountTypeIndividual));
+ if (FSelectable("History"))
+ I::SteamFriends->ActivateGameOverlayToWebPage(std::format("https://steamhistory.net/id/{}", CSteamID(tPlayer.m_uAccountID, k_EUniversePublic, k_EAccountTypeIndividual).ConvertToUint64()).c_str());
+ }
- if (!tPlayer.m_bFake)
+ if (FSelectable(F::Spectate.GetTarget(true) == tPlayer.m_iUserID ? "Unspectate" : "Spectate"))
+ F::Spectate.SetTarget(tPlayer.m_iUserID);
+
+ if (!I::EngineClient->IsPlayingDemo() && FBeginMenu("Votekick"))
+ {
+ if (FSelectable("No reason"))
+ I::ClientState->SendStringCmd(std::format("callvote Kick \"{} other\"", tPlayer.m_iUserID).c_str());
+ if (FSelectable("Cheating"))
+ I::ClientState->SendStringCmd(std::format("callvote Kick \"{} cheating\"", tPlayer.m_iUserID).c_str());
+ if (FSelectable("Idle"))
+ I::ClientState->SendStringCmd(std::format("callvote Kick \"{} idle\"", tPlayer.m_iUserID).c_str());
+ if (FSelectable("Scamming"))
+ I::ClientState->SendStringCmd(std::format("callvote Kick \"{} scamming\"", tPlayer.m_iUserID).c_str());
+
+ ImGui::EndMenu();
+ }
+
+ if (!tPlayer.m_bFake)
+ {
+ if (FBeginMenu("Add tag"))
{
- if (FSelectable("Profile"))
- I::SteamFriends->ActivateGameOverlayToUser("steamid", CSteamID(tPlayer.m_uAccountID, k_EUniversePublic, k_EAccountTypeIndividual));
- if (FSelectable("History"))
- I::SteamFriends->ActivateGameOverlayToWebPage(std::format("https://steamhistory.net/id/{}", CSteamID(tPlayer.m_uAccountID, k_EUniversePublic, k_EAccountTypeIndividual).ConvertToUint64()).c_str());
- }
+ for (auto it = F::PlayerUtils.m_vTags.begin(); it != F::PlayerUtils.m_vTags.end(); it++)
+ {
+ int iID = std::distance(F::PlayerUtils.m_vTags.begin(), it);
+ auto& tTag = *it;
+ if (!tTag.m_bAssignable || F::PlayerUtils.HasTag(tPlayer.m_uAccountID, iID))
+ continue;
- if (FSelectable(F::Spectate.GetTarget(true) == tPlayer.m_iUserID ? "Unspectate" : "Spectate"))
- F::Spectate.SetTarget(tPlayer.m_iUserID);
-
- if (!I::EngineClient->IsPlayingDemo() && FBeginMenu("Votekick"))
- {
- if (FSelectable("No reason"))
- I::ClientState->SendStringCmd(std::format("callvote Kick \"{} other\"", tPlayer.m_iUserID).c_str());
- if (FSelectable("Cheating"))
- I::ClientState->SendStringCmd(std::format("callvote Kick \"{} cheating\"", tPlayer.m_iUserID).c_str());
- if (FSelectable("Idle"))
- I::ClientState->SendStringCmd(std::format("callvote Kick \"{} idle\"", tPlayer.m_iUserID).c_str());
- if (FSelectable("Scamming"))
- I::ClientState->SendStringCmd(std::format("callvote Kick \"{} scamming\"", tPlayer.m_iUserID).c_str());
+ auto imColor = ColorToVec(tTag.m_tColor);
+ PushStyleColor(ImGuiCol_Text, imColor);
+ imColor.x /= 3; imColor.y /= 3; imColor.z /= 3;
+ if (FSelectable(tTag.m_sName.c_str(), imColor))
+ F::PlayerUtils.AddTag(tPlayer.m_uAccountID, iID, true, tPlayer.m_sName.c_str());
+ PopStyleColor();
+ }
ImGui::EndMenu();
}
-
- if (!tPlayer.m_bFake)
+ if (FBeginMenu("Alias"))
{
- if (FBeginMenu("Add tag"))
+ bool bHasAlias = F::PlayerUtils.m_mPlayerAliases.contains(tPlayer.m_uAccountID);
+ static std::string sInput = "";
+
+ bool bEnter = FInputText("Alias...", sInput, H::Draw.Scale(150), ImGuiInputTextFlags_EnterReturnsTrue);
+ if (!IsItemFocused())
+ sInput = bHasAlias ? F::PlayerUtils.m_mPlayerAliases[tPlayer.m_uAccountID] : "";
+ if (bEnter)
{
- for (auto it = F::PlayerUtils.m_vTags.begin(); it != F::PlayerUtils.m_vTags.end(); it++)
+ if (sInput.empty() && bHasAlias)
{
- int iID = std::distance(F::PlayerUtils.m_vTags.begin(), it);
- auto& tTag = *it;
- if (!tTag.m_bAssignable || F::PlayerUtils.HasTag(tPlayer.m_uAccountID, iID))
- continue;
+ F::Output.AliasChanged(tPlayer.m_sName.c_str(), "Removed", F::PlayerUtils.m_mPlayerAliases[tPlayer.m_uAccountID].c_str());
- auto imColor = ColorToVec(tTag.m_tColor);
- PushStyleColor(ImGuiCol_Text, imColor);
- imColor.x /= 3; imColor.y /= 3; imColor.z /= 3;
- if (FSelectable(tTag.m_sName.c_str(), imColor))
- F::PlayerUtils.AddTag(tPlayer.m_uAccountID, iID, true, tPlayer.m_sName.c_str());
- PopStyleColor();
+ F::PlayerUtils.m_mPlayerAliases.erase(tPlayer.m_uAccountID);
+ F::PlayerUtils.m_bSave = true;
}
-
- ImGui::EndMenu();
- }
- if (FBeginMenu("Alias"))
- {
- bool bHasAlias = F::PlayerUtils.m_mPlayerAliases.contains(tPlayer.m_uAccountID);
- static std::string sInput = "";
-
- bool bEnter = FInputText("Alias...", sInput, H::Draw.Scale(150), ImGuiInputTextFlags_EnterReturnsTrue);
- if (!IsItemFocused())
- sInput = bHasAlias ? F::PlayerUtils.m_mPlayerAliases[tPlayer.m_uAccountID] : "";
- if (bEnter)
+ else if (!sInput.empty())
{
- if (sInput.empty() && bHasAlias)
- {
- F::Output.AliasChanged(tPlayer.m_sName.c_str(), "Removed", F::PlayerUtils.m_mPlayerAliases[tPlayer.m_uAccountID].c_str());
+ F::PlayerUtils.m_mPlayerAliases[tPlayer.m_uAccountID] = sInput;
+ F::PlayerUtils.m_bSave = true;
- F::PlayerUtils.m_mPlayerAliases.erase(tPlayer.m_uAccountID);
- F::PlayerUtils.m_bSave = true;
- }
- else if (!sInput.empty())
- {
- F::PlayerUtils.m_mPlayerAliases[tPlayer.m_uAccountID] = sInput;
- F::PlayerUtils.m_bSave = true;
-
- F::Output.AliasChanged(tPlayer.m_sName.c_str(), bHasAlias ? "Changed" : "Added", sInput.c_str());
- }
+ F::Output.AliasChanged(tPlayer.m_sName.c_str(), bHasAlias ? "Changed" : "Added", sInput.c_str());
}
-
- ImGui::EndMenu();
}
+
+ ImGui::EndMenu();
}
-
- if (Vars::Resolver::Enabled.Value && !tPlayer.m_bLocal && !I::EngineClient->IsPlayingDemo())
- {
- if (FBeginMenu("Set yaw"))
- {
- static std::vector> vYaws = {
- { "Auto", 0.f },
- { "Forward", 0.f },
- { "Left", 90.f },
- { "Right", -90.f },
- { "Backwards", 180.f }
- };
- for (auto& [sYaw, flValue] : vYaws)
- {
- if (FSelectable(sYaw))
- {
- switch (FNV1A::Hash32(sYaw))
- {
- case FNV1A::Hash32Const("Auto"):
- F::Resolver.SetYaw(tPlayer.m_iUserID, 0.f, true);
- break;
- default:
- F::Resolver.SetYaw(tPlayer.m_iUserID, flValue);
- }
- }
- }
-
- ImGui::EndMenu();
- }
- if (FBeginMenu("Set pitch"))
- {
- static std::vector> vPitches = {
- { "Auto", 0.f },
- { "Up", -90.f },
- { "Down", 90.f },
- { "Zero", 0.f },
- { "Inverse", 0.f }
- };
- for (auto& [sPitch, flValue] : vPitches)
- {
- if (FSelectable(sPitch))
- {
- switch (FNV1A::Hash32(sPitch))
- {
- case FNV1A::Hash32Const("Auto"):
- F::Resolver.SetPitch(tPlayer.m_iUserID, 0.f, false, true);
- break;
- case FNV1A::Hash32Const("Inverse"):
- F::Resolver.SetPitch(tPlayer.m_iUserID, 0.f, true);
- break;
- default:
- F::Resolver.SetPitch(tPlayer.m_iUserID, flValue);
- }
- }
- }
-
- ImGui::EndMenu();
- }
- if (FBeginMenu("Set view"))
- {
- static std::vector> vPitches = {
- { "Offset from static view", true },
- { "Offset from view to local", false }
- };
- for (auto& [sPitch, bValue] : vPitches)
- {
- if (FSelectable(sPitch))
- F::Resolver.SetView(tPlayer.m_iUserID, bValue);
- }
-
- ImGui::EndMenu();
- }
- if (FBeginMenu("Set minwalk"))
- {
- static std::vector> vPitches = {
- { "Minwalk on", true },
- { "Minwalk off", false }
- };
- for (auto& [sPitch, bValue] : vPitches)
- {
- if (FSelectable(sPitch))
- F::Resolver.SetMinwalk(tPlayer.m_iUserID, bValue);
- }
-
- ImGui::EndMenu();
- }
- }
-
- if (mParties.contains(tPlayer.m_iParty))
- {
- Divider(H::Draw.Scale(1), 0);
-
- TextColored(F::Render.Inactive.Value, "Partied:");
- for (auto& pPlayer2 : mParties[tPlayer.m_iParty])
- TextColored(F::Render.Inactive.Value, pPlayer2->m_sName.c_str());
- }
-
- if (tPlayer.m_iLevel != -2)
- {
- Divider(H::Draw.Scale(1), 0);
-
- std::string sLevel = "T? L?";
- if (tPlayer.m_iLevel != -1)
- {
- int iTier = std::max(ceilf(tPlayer.m_iLevel / 150.f), 1.f);
- int iLevel = ((tPlayer.m_iLevel - 1) % 150) + 1;
- sLevel = std::format("T{} L{}", iTier, iLevel);
- }
- TextColored(F::Render.Inactive.Value, sLevel.c_str());
- }
-
- PopStyleVar();
- EndPopup();
}
- };
+
+ if (Vars::Resolver::Enabled.Value && !tPlayer.m_bLocal && !I::EngineClient->IsPlayingDemo())
+ {
+ if (FBeginMenu("Set yaw"))
+ {
+ static std::vector> vYaws = {
+ { "Auto", 0.f },
+ { "Forward", 0.f },
+ { "Left", 90.f },
+ { "Right", -90.f },
+ { "Backwards", 180.f }
+ };
+ for (auto& [sYaw, flValue] : vYaws)
+ {
+ if (FSelectable(sYaw))
+ {
+ switch (FNV1A::Hash32(sYaw))
+ {
+ case FNV1A::Hash32Const("Auto"):
+ F::Resolver.SetYaw(tPlayer.m_iUserID, 0.f, true);
+ break;
+ default:
+ F::Resolver.SetYaw(tPlayer.m_iUserID, flValue);
+ }
+ }
+ }
+
+ ImGui::EndMenu();
+ }
+ if (FBeginMenu("Set pitch"))
+ {
+ static std::vector> vPitches = {
+ { "Auto", 0.f },
+ { "Up", -90.f },
+ { "Down", 90.f },
+ { "Zero", 0.f },
+ { "Inverse", 0.f }
+ };
+ for (auto& [sPitch, flValue] : vPitches)
+ {
+ if (FSelectable(sPitch))
+ {
+ switch (FNV1A::Hash32(sPitch))
+ {
+ case FNV1A::Hash32Const("Auto"):
+ F::Resolver.SetPitch(tPlayer.m_iUserID, 0.f, false, true);
+ break;
+ case FNV1A::Hash32Const("Inverse"):
+ F::Resolver.SetPitch(tPlayer.m_iUserID, 0.f, true);
+ break;
+ default:
+ F::Resolver.SetPitch(tPlayer.m_iUserID, flValue);
+ }
+ }
+ }
+
+ ImGui::EndMenu();
+ }
+ if (FBeginMenu("Set view"))
+ {
+ static std::vector> vPitches = {
+ { "Offset from static view", true },
+ { "Offset from view to local", false }
+ };
+ for (auto& [sPitch, bValue] : vPitches)
+ {
+ if (FSelectable(sPitch))
+ F::Resolver.SetView(tPlayer.m_iUserID, bValue);
+ }
+
+ ImGui::EndMenu();
+ }
+ if (FBeginMenu("Set minwalk"))
+ {
+ static std::vector> vPitches = {
+ { "Minwalk on", true },
+ { "Minwalk off", false }
+ };
+ for (auto& [sPitch, bValue] : vPitches)
+ {
+ if (FSelectable(sPitch))
+ F::Resolver.SetMinwalk(tPlayer.m_iUserID, bValue);
+ }
+
+ ImGui::EndMenu();
+ }
+ }
+
+ if (mParties.contains(tPlayer.m_iParty))
+ {
+ Divider(H::Draw.Scale(1), 0);
+
+ TextColored(F::Render.Inactive.Value, "Partied:");
+ for (auto& pPlayer2 : mParties[tPlayer.m_iParty])
+ TextColored(F::Render.Inactive.Value, pPlayer2->m_sName.c_str());
+ }
+
+ if (tPlayer.m_iLevel != -2)
+ {
+ Divider(H::Draw.Scale(1), 0);
+
+ std::string sLevel = "T? L?";
+ if (tPlayer.m_iLevel != -1)
+ {
+ int iTier = std::max(ceilf(tPlayer.m_iLevel / 150.f), 1.f);
+ int iLevel = ((tPlayer.m_iLevel - 1) % 150) + 1;
+ sLevel = std::format("T{} L{}", iTier, iLevel);
+ }
+ TextColored(F::Render.Inactive.Value, sLevel.c_str());
+ }
+
+ PopStyleVar();
+ EndPopup();
+ }
+ };
// display players
std::vector vBlu, vRed, vOther;
@@ -1722,155 +1825,155 @@ void CMenu::MenuLogs(int iTab)
} EndChild();
auto fDrawTag = [](std::vector::iterator it, PriorityLabel_t& _tTag, int y)
+ {
+ int _iID = std::distance(F::PlayerUtils.m_vTags.begin(), it);
+
+ ImVec2 vOriginalPos = { !_tTag.m_bLabel ? GetStyle().WindowPadding.x : GetWindowWidth() * 2 / 3 + GetStyle().WindowPadding.x / 2, H::Draw.Scale(96 + 36 * y) };
+
+ // background
+ float flWidth = GetWindowWidth() * (_tTag.m_bLabel ? 1.f / 3 : 2.f / 3) - GetStyle().WindowPadding.x * 1.5f;
+ float flHeight = H::Draw.Scale(28);
+ ImColor tColor = ColorToVec(_tTag.m_tColor.Lerp(Vars::Menu::Theme::Background.Value, 0.5f, LerpEnum::NoAlpha));
+ ImVec2 vDrawPos = GetDrawPos() + vOriginalPos;
+ if (iID != _iID)
+ GetWindowDrawList()->AddRectFilled(vDrawPos, vDrawPos + ImVec2(flWidth, flHeight), tColor, H::Draw.Scale(4));
+ else
{
- int _iID = std::distance(F::PlayerUtils.m_vTags.begin(), it);
+ ImColor tColor2 = { tColor.Value.x * 1.1f, tColor.Value.y * 1.1f, tColor.Value.z * 1.1f, tColor.Value.w };
+ GetWindowDrawList()->AddRectFilled(vDrawPos, vDrawPos + ImVec2(flWidth, flHeight), tColor2, H::Draw.Scale(4));
- ImVec2 vOriginalPos = { !_tTag.m_bLabel ? GetStyle().WindowPadding.x : GetWindowWidth() * 2 / 3 + GetStyle().WindowPadding.x / 2, H::Draw.Scale(96 + 36 * y) };
+ tColor2 = ColorToVec(_tTag.m_tColor.Lerp(Vars::Menu::Theme::Background.Value, 0.25f, LerpEnum::NoAlpha));
+ float flInset = H::Draw.Scale(0.5f) - 0.5f;
+ GetWindowDrawList()->AddRect(vDrawPos + ImVec2(flInset, flInset), vDrawPos + ImVec2(flWidth - flInset, flHeight - flInset), tColor2, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale());
+ }
- // background
- float flWidth = GetWindowWidth() * (_tTag.m_bLabel ? 1.f / 3 : 2.f / 3) - GetStyle().WindowPadding.x * 1.5f;
- float flHeight = H::Draw.Scale(28);
- ImColor tColor = ColorToVec(_tTag.m_tColor.Lerp(Vars::Menu::Theme::Background.Value, 0.5f, LerpEnum::NoAlpha));
- ImVec2 vDrawPos = GetDrawPos() + vOriginalPos;
- if (iID != _iID)
- GetWindowDrawList()->AddRectFilled(vDrawPos, { vDrawPos.x + flWidth, vDrawPos.y + flHeight }, tColor, H::Draw.Scale(4));
- else
+ // text
+ SetCursorPos(vOriginalPos + ImVec2(H::Draw.Scale(9), H::Draw.Scale(7)));
+ FText(TruncateText(_tTag.m_sName, _tTag.m_bLabel ? flWidth - H::Draw.Scale(38) : flWidth / 2 - H::Draw.Scale(20)).c_str());
+
+ if (!_tTag.m_bLabel)
+ {
+ SetCursorPos(vOriginalPos + ImVec2(flWidth / 2, H::Draw.Scale(7)));
+ FText(std::format("{}", _tTag.m_iPriority).c_str());
+ }
+
+ // buttons / icons
+ bool bDelete = false;
+ if (!_tTag.m_bLocked)
+ {
+ SetCursorPos(vOriginalPos + ImVec2(flWidth - H::Draw.Scale(26), H::Draw.Scale(2)));
+ bDelete = IconButton(ICON_MD_DELETE);
+ }
+ else
+ {
+ SetCursorPos(vOriginalPos + ImVec2(flWidth - H::Draw.Scale(22), H::Draw.Scale(6)));
+ switch (F::PlayerUtils.IndexToTag(_iID))
{
- ImColor tColor2 = { tColor.Value.x * 1.1f, tColor.Value.y * 1.1f, tColor.Value.z * 1.1f, tColor.Value.w };
- GetWindowDrawList()->AddRectFilled(vDrawPos, { vDrawPos.x + flWidth, vDrawPos.y + flHeight }, tColor2, H::Draw.Scale(4));
-
- tColor2 = ColorToVec(_tTag.m_tColor.Lerp(Vars::Menu::Theme::Background.Value, 0.25f, LerpEnum::NoAlpha));
- float flInset = H::Draw.Scale(0.5f) - 0.5f;
- GetWindowDrawList()->AddRect({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x - flInset + flWidth, vDrawPos.y - flInset + flHeight }, tColor2, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale());
+ //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;
+ case PARTY_TAG: IconImage(ICON_MD_GROUPS); break;
+ case F2P_TAG: IconImage(ICON_MD_MONEY_OFF); break;
}
+ }
- // text
- SetCursorPos({ vOriginalPos.x + H::Draw.Scale(9), vOriginalPos.y + H::Draw.Scale(7) });
- FText(TruncateText(_tTag.m_sName, _tTag.m_bLabel ? flWidth - H::Draw.Scale(38) : flWidth / 2 - H::Draw.Scale(20)).c_str());
+ SetCursorPos(vOriginalPos);
+ bool bClicked = Button(std::format("##{}", _tTag.m_sName).c_str(), { flWidth, flHeight });
+ bool bPopup = IsItemClicked(ImGuiMouseButton_Right);
- if (!_tTag.m_bLabel)
- {
- SetCursorPos({ vOriginalPos.x + flWidth / 2, vOriginalPos.y + H::Draw.Scale(7) });
- FText(std::format("{}", _tTag.m_iPriority).c_str());
- }
+ if (bClicked)
+ {
+ iID = _iID;
+ tTag.m_sName = _tTag.m_sName;
+ tTag.m_tColor = _tTag.m_tColor;
+ tTag.m_iPriority = _tTag.m_iPriority;
+ tTag.m_bLabel = _tTag.m_bLabel;
+ }
+ else if (bPopup)
+ OpenPopup(std::format("RightClicked{}", _iID).c_str());
+ else if (bDelete)
+ OpenPopup(std::format("DeleteTag{}", _iID).c_str());
+
+ if (FBeginPopup(std::format("RightClicked{}", _iID).c_str()))
+ {
+ PushStyleVar(ImGuiStyleVar_ItemSpacing, { H::Draw.Scale(8), 0 });
+
+ auto& _tTag2 = *it;
+ bool bSave = false;
- // buttons / icons
- bool bDelete = false;
- 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))
+ static std::string sInput = "";
+
+ bool bEnter = FInputText("Name...", sInput, H::Draw.Scale(284), ImGuiInputTextFlags_EnterReturnsTrue);
+ if (!IsItemFocused())
+ sInput = _tTag2.m_sName;
+ if (bEnter)
{
- //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;
- case PARTY_TAG: IconImage(ICON_MD_GROUPS); break;
- case F2P_TAG: IconImage(ICON_MD_MONEY_OFF); break;
- }
- }
-
- SetCursorPos(vOriginalPos);
- bool bClicked = Button(std::format("##{}", _tTag.m_sName).c_str(), { flWidth, flHeight });
- bool bPopup = IsItemClicked(ImGuiMouseButton_Right);
-
- if (bClicked)
- {
- iID = _iID;
- tTag.m_sName = _tTag.m_sName;
- tTag.m_tColor = _tTag.m_tColor;
- tTag.m_iPriority = _tTag.m_iPriority;
- tTag.m_bLabel = _tTag.m_bLabel;
- }
- else if (bPopup)
- OpenPopup(std::format("RightClicked{}", _iID).c_str());
- else if (bDelete)
- OpenPopup(std::format("DeleteTag{}", _iID).c_str());
-
- if (FBeginPopup(std::format("RightClicked{}", _iID).c_str()))
- {
- PushStyleVar(ImGuiStyleVar_ItemSpacing, { H::Draw.Scale(8), 0 });
-
- auto& _tTag2 = *it;
- bool bSave = false;
-
- {
- static std::string sInput = "";
-
- bool bEnter = FInputText("Name...", sInput, H::Draw.Scale(284), ImGuiInputTextFlags_EnterReturnsTrue);
- if (!IsItemFocused())
- sInput = _tTag2.m_sName;
- if (bEnter)
- {
- _tTag2.m_sName = sInput;
- bSave = true;
- }
- }
-
- PushDisabled(_iID == DEFAULT_TAG || _iID == IGNORED_TAG);
- {
- int iLabel = Disabled ? 0 : _tTag2.m_bLabel;
- if (FDropdown("Type##", &iLabel, { "Priority", "Label" }))
- bSave = true;
- _tTag2.m_bLabel = iLabel;
- if (Disabled)
- _tTag2.m_bLabel = false;
- }
- PopDisabled();
- if (FSlider("Priority##", &_tTag2.m_iPriority, -10, 10))
+ _tTag2.m_sName = sInput;
bSave = true;
-
- if (bSave)
- F::PlayerUtils.m_bSave = true;
-
- PopStyleVar();
- EndPopup();
+ }
}
- else if (FBeginPopupModal(std::format("DeleteTag{}", _iID).c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysUseWindowPadding))
+
+ PushDisabled(_iID == DEFAULT_TAG || _iID == IGNORED_TAG);
{
- FText(std::format("Do you really want to delete '{}'?", _tTag.m_sName).c_str());
+ int iLabel = Disabled ? 0 : _tTag2.m_bLabel;
+ if (FDropdown("Type##", &iLabel, { "Priority", "Label" }))
+ bSave = true;
+ _tTag2.m_bLabel = iLabel;
+ if (Disabled)
+ _tTag2.m_bLabel = false;
+ }
+ PopDisabled();
+ if (FSlider("Priority##", &_tTag2.m_iPriority, -10, 10))
+ bSave = true;
- if (FButton("Yes", FButtonEnum::Left))
+ if (bSave)
+ F::PlayerUtils.m_bSave = true;
+
+ PopStyleVar();
+ EndPopup();
+ }
+ else if (FBeginPopupModal(std::format("DeleteTag{}", _iID).c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysUseWindowPadding))
+ {
+ FText(std::format("Do you really want to delete '{}'?", _tTag.m_sName).c_str());
+
+ if (FButton("Yes", FButtonEnum::Left))
+ {
+ F::PlayerUtils.m_vTags.erase(it);
+ F::PlayerUtils.m_bSave = F::PlayerUtils.m_bSave = true;
+
+ for (auto& vTags : F::PlayerUtils.m_mPlayerTags | std::views::values)
{
- F::PlayerUtils.m_vTags.erase(it);
- F::PlayerUtils.m_bSave = F::PlayerUtils.m_bSave = true;
-
- for (auto& vTags : F::PlayerUtils.m_mPlayerTags | std::views::values)
+ for (auto it = vTags.begin(); it != vTags.end();)
{
- for (auto it = vTags.begin(); it != vTags.end();)
+ if (_iID == *it)
+ vTags.erase(it);
+ else
{
- if (_iID == *it)
- vTags.erase(it);
- else
- {
- if (_iID < *it)
- (*it)--;
- it++;
- }
+ if (_iID < *it)
+ (*it)--;
+ it++;
}
}
-
- if (iID == _iID)
- {
- iID = -1;
- tTag = {};
- }
- else if (iID > _iID)
- iID--;
-
- CloseCurrentPopup();
}
- if (FButton("No", FButtonEnum::Right | FButtonEnum::SameLine))
- CloseCurrentPopup();
- EndPopup();
+ if (iID == _iID)
+ {
+ iID = -1;
+ tTag = {};
+ }
+ else if (iID > _iID)
+ iID--;
+
+ CloseCurrentPopup();
}
- };
+ if (FButton("No", FButtonEnum::Right | FButtonEnum::SameLine))
+ CloseCurrentPopup();
+
+ EndPopup();
+ }
+ };
PushStyleColor(ImGuiCol_Text, F::Render.Inactive.Value);
SetCursorPos({ H::Draw.Scale(13), H::Draw.Scale(80) }); FText("Priorities");
@@ -1889,27 +1992,27 @@ void CMenu::MenuLogs(int iTab)
}
std::sort(vPriorities.begin(), vPriorities.end(), [&](const auto& a, const auto& b) -> bool
- {
- // override for default tag
- if (std::distance(F::PlayerUtils.m_vTags.begin(), a.first) == DEFAULT_TAG)
- return true;
- if (std::distance(F::PlayerUtils.m_vTags.begin(), b.first) == DEFAULT_TAG)
- return false;
+ {
+ // override for default tag
+ if (std::distance(F::PlayerUtils.m_vTags.begin(), a.first) == DEFAULT_TAG)
+ return true;
+ if (std::distance(F::PlayerUtils.m_vTags.begin(), b.first) == DEFAULT_TAG)
+ return false;
- // sort by priority if unequal
- if (a.second.m_iPriority != b.second.m_iPriority)
- return a.second.m_iPriority > b.second.m_iPriority;
+ // sort by priority if unequal
+ if (a.second.m_iPriority != b.second.m_iPriority)
+ return a.second.m_iPriority > b.second.m_iPriority;
- return a.second.m_sName < b.second.m_sName;
- });
+ return a.second.m_sName < b.second.m_sName;
+ });
std::sort(vLabels.begin(), vLabels.end(), [&](const auto& a, const auto& b) -> bool
- {
- // sort by priority if unequal
- if (a.second.m_iPriority != b.second.m_iPriority)
- return a.second.m_iPriority > b.second.m_iPriority;
+ {
+ // sort by priority if unequal
+ if (a.second.m_iPriority != b.second.m_iPriority)
+ return a.second.m_iPriority > b.second.m_iPriority;
- return a.second.m_sName < b.second.m_sName;
- });
+ return a.second.m_sName < b.second.m_sName;
+ });
// display tags
int iPriorities = 0, iLabels = 0;
@@ -1932,6 +2035,9 @@ void CMenu::MenuLogs(int iTab)
if (FButton(ICON_MD_SYNC, FButtonEnum::None, { 30, 30 }, 0, F::Render.IconFont))
F::PlayerUtils.m_bLoad = true;
+ if (FButton(ICON_MD_FOLDER, FButtonEnum::Fit | FButtonEnum::SameLine, { 30, 30 }, 0, F::Render.IconFont))
+ ShellExecuteA(NULL, NULL, F::Configs.m_sCorePath.c_str(), NULL, NULL, SW_SHOWNORMAL);
+
if (FButton("Export", FButtonEnum::Fit | FButtonEnum::SameLine))
{
// this should be up2date anyways
@@ -2151,9 +2257,6 @@ void CMenu::MenuLogs(int iTab)
}
}
PopDisabled();
-
- if (FButton("Folder", FButtonEnum::Fit | FButtonEnum::SameLine))
- ShellExecuteA(NULL, NULL, F::Configs.m_sCorePath.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
break;
}
@@ -2337,7 +2440,7 @@ void CMenu::MenuSettings(int iTab)
switch (iTab)
{
- // Settings
+ // Settings
case 0:
{
if (BeginTable("ConfigSettingsTable", 2))
@@ -2355,152 +2458,154 @@ void CMenu::MenuSettings(int iTab)
*/
auto fDrawConfigs = [](std::string& sStaticName, bool bVisual = false)
+ {
+ auto& sPath = !bVisual ? F::Configs.m_sConfigPath : F::Configs.m_sVisualsPath;
+ auto& sConfig = !bVisual ? F::Configs.m_sCurrentConfig : F::Configs.m_sCurrentVisuals;
+ auto sType = !bVisual ? "Config" : "Visual";
+ bool bNoSave = GetAsyncKeyState(VK_SHIFT) & 0x8000;
+
+ FSDropdown("Name", &sStaticName, {}, FSDropdownEnum::AutoUpdate, -H::Draw.Unscale(FCalcTextSize("CREATE").x + H::Draw.Scale(40)) - 44);
+ PushDisabled(sStaticName.empty());
{
- auto& sPath = !bVisual ? F::Configs.m_sConfigPath : F::Configs.m_sVisualsPath;
- auto& sConfig = !bVisual ? F::Configs.m_sCurrentConfig : F::Configs.m_sCurrentVisuals;
- auto sType = !bVisual ? "Config" : "Visual";
- bool bNoSave = GetAsyncKeyState(VK_SHIFT) & 0x8000;
-
- FSDropdown("Name", &sStaticName, {}, FSDropdownEnum::AutoUpdate, -H::Draw.Unscale(FCalcTextSize("CREATE").x + FCalcTextSize("FOLDER").x) - 72);
- PushDisabled(sStaticName.empty());
+ if (FButton("Create", FButtonEnum::Fit | FButtonEnum::SameLine, { 0, 40 }))
{
- if (FButton("Create", FButtonEnum::Fit | FButtonEnum::SameLine, { 0, 40 }))
- {
- if (!std::filesystem::exists(sPath + sStaticName))
- {
- if (!bVisual)
- F::Configs.SaveConfig(sStaticName);
- else
- F::Configs.SaveVisual(sStaticName);
- }
- sStaticName.clear();
- }
- }
- PopDisabled();
- if (FButton("Folder", FButtonEnum::Fit | FButtonEnum::SameLine, { 0, 40 }))
- ShellExecuteA(NULL, NULL, sPath.c_str(), NULL, NULL, SW_SHOWNORMAL);
- vRowSizes.clear();
-
- std::vector> vConfigs = {};
- bool bDefaultFound = false;
- for (auto& tEntry : std::filesystem::directory_iterator(sPath))
- {
- if (!tEntry.is_regular_file() || tEntry.path().extension() != F::Configs.m_sConfigExtension)
- continue;
-
- std::string sName = tEntry.path().filename().string();
- sName.erase(sName.end() - F::Configs.m_sConfigExtension.size(), sName.end());
- if (FNV1A::Hash32(sName.c_str()) == FNV1A::Hash32Const("default"))
- bDefaultFound = true;
-
- vConfigs.emplace_back(tEntry, sName);
- }
- if (!bVisual)
- {
- if (!bDefaultFound)
- F::Configs.SaveConfig("default");
- std::sort(vConfigs.begin(), vConfigs.end(), [&](const auto& a, const auto& b) -> bool
- {
- // override for default config
- if (FNV1A::Hash32(a.second.c_str()) == FNV1A::Hash32Const("default"))
- return true;
- if (FNV1A::Hash32(b.second.c_str()) == FNV1A::Hash32Const("default"))
- return false;
-
- return a.second < b.second;
- });
- }
-
- for (auto& [entry, sConfigName] : vConfigs)
- {
- bool bCurrentConfig = FNV1A::Hash32(sConfigName.c_str()) == FNV1A::Hash32(sConfig.c_str());
- ImVec2 vOriginalPos = GetCursorPos();
-
- SetCursorPos({ vOriginalPos.x + H::Draw.Scale(2), vOriginalPos.y + H::Draw.Scale(9) });
- bool bLoad = IconButton(bCurrentConfig ? ICON_MD_REFRESH : ICON_MD_DOWNLOAD);
- FTooltip(ICON_MD_ADD ICON_MD_FILE_UPLOAD_OFF, bNoSave && IsItemHovered(), 300.f, F::Render.IconFont);
-
- 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 = 9;
- SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(9) });
- bool bDelete = IconButton(ICON_MD_DELETE);
-
- SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(9) });
- bool bSave = IconButton(ICON_MD_SAVE);
- FTooltip(ICON_MD_ADD ICON_MD_FILE_DOWNLOAD_OFF, bNoSave && IsItemHovered(), 300.f, F::Render.IconFont);
-
- if (bLoad)
+ if (!std::filesystem::exists(sPath + sStaticName))
{
if (!bVisual)
- F::Configs.LoadConfig(sConfigName);
+ F::Configs.SaveConfig(sStaticName);
else
- F::Configs.LoadVisual(sConfigName);
+ F::Configs.SaveVisual(sStaticName);
}
- else if (bSave)
+ sStaticName.clear();
+ }
+ }
+ PopDisabled();
+
+ if (FButton(ICON_MD_FOLDER, FButtonEnum::Fit | FButtonEnum::SameLine, { 40, 40 }, 0, F::Render.IconFont))
+ ShellExecuteA(NULL, NULL, sPath.c_str(), NULL, NULL, SW_SHOWNORMAL);
+
+ vRowSizes.clear();
+
+ std::vector> vConfigs = {};
+ bool bDefaultFound = false;
+ for (auto& tEntry : std::filesystem::directory_iterator(sPath))
+ {
+ if (!tEntry.is_regular_file() || tEntry.path().extension() != F::Configs.m_sConfigExtension)
+ continue;
+
+ std::string sName = tEntry.path().filename().string();
+ sName.erase(sName.end() - F::Configs.m_sConfigExtension.size(), sName.end());
+ if (FNV1A::Hash32(sName.c_str()) == FNV1A::Hash32Const("default"))
+ bDefaultFound = true;
+
+ vConfigs.emplace_back(tEntry, sName);
+ }
+ if (!bVisual)
+ {
+ if (!bDefaultFound)
+ F::Configs.SaveConfig("default");
+ std::sort(vConfigs.begin(), vConfigs.end(), [&](const auto& a, const auto& b) -> bool
+ {
+ // override for default config
+ if (FNV1A::Hash32(a.second.c_str()) == FNV1A::Hash32Const("default"))
+ return true;
+ if (FNV1A::Hash32(b.second.c_str()) == FNV1A::Hash32Const("default"))
+ return false;
+
+ return a.second < b.second;
+ });
+ }
+
+ for (auto& [entry, sConfigName] : vConfigs)
+ {
+ bool bCurrentConfig = FNV1A::Hash32(sConfigName.c_str()) == FNV1A::Hash32(sConfig.c_str());
+ ImVec2 vOriginalPos = GetCursorPos();
+
+ SetCursorPos(vOriginalPos + ImVec2(H::Draw.Scale(2), H::Draw.Scale(9)));
+ bool bLoad = IconButton(bCurrentConfig ? ICON_MD_REFRESH : ICON_MD_DOWNLOAD);
+ FTooltip(ICON_MD_ADD ICON_MD_FILE_UPLOAD_OFF, bNoSave && IsItemHovered(), 300.f, F::Render.IconFont);
+
+ 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 = 9;
+ SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(9) });
+ bool bDelete = IconButton(ICON_MD_DELETE);
+
+ SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), vOriginalPos.y + H::Draw.Scale(9) });
+ bool bSave = IconButton(ICON_MD_SAVE);
+ FTooltip(ICON_MD_ADD ICON_MD_FILE_DOWNLOAD_OFF, bNoSave && IsItemHovered(), 300.f, F::Render.IconFont);
+
+ if (bLoad)
+ {
+ if (!bVisual)
+ F::Configs.LoadConfig(sConfigName);
+ else
+ F::Configs.LoadVisual(sConfigName);
+ }
+ else if (bSave)
+ {
+ if (!bCurrentConfig || !bVisual && !F::Configs.m_sCurrentVisuals.empty())
+ OpenPopup(std::format("Save{}{}", sType, sConfigName).c_str());
+ else if (!bVisual)
+ F::Configs.SaveConfig(sConfigName);
+ else
+ F::Configs.SaveVisual(sConfigName);
+ }
+ else if (bDelete)
+ OpenPopup(std::format("Remove{}{}", sType, sConfigName).c_str());
+
+ if (FBeginPopupModal(std::format("Save{}{}", sType, sConfigName).c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysUseWindowPadding))
+ {
+ FText(std::format("Do you really want to override '{}'?", sConfigName).c_str());
+
+ if (FButton("Yes, override", FButtonEnum::Left))
{
- if (!bCurrentConfig || !bVisual && !F::Configs.m_sCurrentVisuals.empty())
- OpenPopup(std::format("Save{}{}", sType, sConfigName).c_str());
- else if (!bVisual)
+ if (!bVisual)
F::Configs.SaveConfig(sConfigName);
else
F::Configs.SaveVisual(sConfigName);
+ CloseCurrentPopup();
}
- else if (bDelete)
- OpenPopup(std::format("Remove{}{}", sType, sConfigName).c_str());
+ if (FButton("No", FButtonEnum::Right | FButtonEnum::SameLine))
+ CloseCurrentPopup();
- if (FBeginPopupModal(std::format("Save{}{}", sType, sConfigName).c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysUseWindowPadding))
- {
- FText(std::format("Do you really want to override '{}'?", sConfigName).c_str());
-
- if (FButton("Yes, override", FButtonEnum::Left))
- {
- if (!bVisual)
- F::Configs.SaveConfig(sConfigName);
- else
- F::Configs.SaveVisual(sConfigName);
- CloseCurrentPopup();
- }
- if (FButton("No", FButtonEnum::Right | FButtonEnum::SameLine))
- CloseCurrentPopup();
-
- EndPopup();
- }
- else if (FBeginPopupModal(std::format("Remove{}{}", sType, sConfigName).c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysUseWindowPadding))
- {
- FText(std::format("Do you really want to remove '{}'?", sConfigName).c_str());
-
- PushDisabled(!bVisual && FNV1A::Hash32(sConfigName.c_str()) == FNV1A::Hash32Const("default"));
- {
- if (FButton("Yes, delete", FButtonEnum::Fit))
- {
- if (!bVisual)
- F::Configs.DeleteConfig(sConfigName);
- else
- F::Configs.DeleteVisual(sConfigName);
- CloseCurrentPopup();
- }
- }
- PopDisabled();
- if (FButton("Yes, reset", FButtonEnum::Fit | FButtonEnum::SameLine))
- {
- if (!bVisual)
- F::Configs.ResetConfig(sConfigName);
- else
- F::Configs.ResetVisual(sConfigName);
- CloseCurrentPopup();
- }
- if (FButton("No", FButtonEnum::Fit | FButtonEnum::SameLine))
- CloseCurrentPopup();
-
- EndPopup();
- }
-
- SetCursorPos(vOriginalPos); DebugDummy({ 0, H::Draw.Scale(28) });
+ EndPopup();
}
- DebugDummy({ 0, H::Draw.Scale(7) });
- };
+ else if (FBeginPopupModal(std::format("Remove{}{}", sType, sConfigName).c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysUseWindowPadding))
+ {
+ FText(std::format("Do you really want to remove '{}'?", sConfigName).c_str());
+
+ PushDisabled(!bVisual && FNV1A::Hash32(sConfigName.c_str()) == FNV1A::Hash32Const("default"));
+ {
+ if (FButton("Yes, delete", FButtonEnum::Fit))
+ {
+ if (!bVisual)
+ F::Configs.DeleteConfig(sConfigName);
+ else
+ F::Configs.DeleteVisual(sConfigName);
+ CloseCurrentPopup();
+ }
+ }
+ PopDisabled();
+ if (FButton("Yes, reset", FButtonEnum::Fit | FButtonEnum::SameLine))
+ {
+ if (!bVisual)
+ F::Configs.ResetConfig(sConfigName);
+ else
+ F::Configs.ResetVisual(sConfigName);
+ CloseCurrentPopup();
+ }
+ if (FButton("No", FButtonEnum::Fit | FButtonEnum::SameLine))
+ CloseCurrentPopup();
+
+ EndPopup();
+ }
+
+ SetCursorPos(vOriginalPos); DebugDummy({ 0, H::Draw.Scale(28) });
+ }
+ DebugDummy({ 0, H::Draw.Scale(7) });
+ };
/* Column 1 */
TableNextColumn();
@@ -2624,38 +2729,38 @@ void CMenu::MenuSettings(int iTab)
PopStyleColor();
auto fNumberToIndex = [](int iNumber, int iLayer)
+ {
+ int iIndex = -1, i = -1;
+
+ std::unordered_map mBinds = {};
+ std::function fGetBinds = [&](int iParent)
{
- int iIndex = -1, i = -1;
+ for (int _iBind = 0; _iBind < F::Binds.m_vBinds.size(); _iBind++)
+ {
+ auto& _tBind = F::Binds.m_vBinds[_iBind];
+ if (iParent != _tBind.m_iParent || mBinds.contains(_iBind))
+ continue;
- std::unordered_map mBinds = {};
- std::function fGetBinds = [&](int iParent)
- {
- for (int _iBind = 0; _iBind < F::Binds.m_vBinds.size(); _iBind++)
- {
- auto& _tBind = F::Binds.m_vBinds[_iBind];
- if (iParent != _tBind.m_iParent || mBinds.contains(_iBind))
- continue;
+ mBinds[_iBind];
- mBinds[_iBind];
-
- i++;
- //if (iParent == iLayer && iNumber >= i)
- if (iIndex == -1 && iParent == iLayer && iNumber <= i)
- iIndex = _iBind;
- fGetBinds(_iBind);
- }
- };
- fGetBinds(DEFAULT_BIND);
-
- return iIndex;
+ i++;
+ //if (iParent == iLayer && iNumber >= i)
+ if (iIndex == -1 && iParent == iLayer && iNumber <= i)
+ iIndex = _iBind;
+ fGetBinds(_iBind);
+ }
};
+ fGetBinds(DEFAULT_BIND);
+
+ return iIndex;
+ };
auto fPositionToIndex = [&](ImVec2 vPos, int iLayer = DEFAULT_BIND)
- {
- int iIndex = floorf((vPos.y - GetCursorPosY() - H::Draw.Scale(4)) / H::Draw.Scale(36));
- iIndex = std::clamp(iIndex, 0, int(F::Binds.m_vBinds.size() - 1));
- iIndex = fNumberToIndex(iIndex, iLayer);
- return iIndex;
- };
+ {
+ int iIndex = floorf((vPos.y - GetCursorPosY() - H::Draw.Scale(4)) / H::Draw.Scale(36));
+ iIndex = std::clamp(iIndex, 0, int(F::Binds.m_vBinds.size() - 1));
+ iIndex = fNumberToIndex(iIndex, iLayer);
+ return iIndex;
+ };
static int iDragging = -1, iLayer = DEFAULT_BIND;
if (!IsMouseDown(ImGuiMouseButton_Left))
@@ -2666,245 +2771,251 @@ void CMenu::MenuSettings(int iTab)
if (iTo != -1 && iDragging != iTo)
{
F::Binds.Move(iDragging, iTo);
+ if (iBind == iDragging)
+ iBind = iTo;
+ else if (iBind < iDragging && iBind >= iTo)
+ iBind++;
+ else if (iBind > iDragging && iBind <= iTo)
+ iBind--;
iDragging = iTo;
}
}
std::unordered_map mBinds = {};
std::function fGetBinds = [&](int iParent, int x)
+ {
+ for (int _iBind = 0; _iBind < F::Binds.m_vBinds.size(); _iBind++)
{
- for (int _iBind = 0; _iBind < F::Binds.m_vBinds.size(); _iBind++)
+ auto& _tBind = F::Binds.m_vBinds[_iBind];
+ if (iParent != DEFAULT_BIND - 1 && iParent != _tBind.m_iParent || mBinds.contains(_iBind))
+ continue;
+
+ mBinds[_iBind];
+
+ std::string sType; std::string sInfo;
+ switch (_tBind.m_iType)
{
- auto& _tBind = F::Binds.m_vBinds[_iBind];
- if (iParent != DEFAULT_BIND - 1 && iParent != _tBind.m_iParent || mBinds.contains(_iBind))
- continue;
-
- mBinds[_iBind];
-
- std::string sType; std::string sInfo;
- switch (_tBind.m_iType)
+ case BindEnum::Key:
+ switch (_tBind.m_iInfo)
{
- case BindEnum::Key:
+ case BindEnum::KeyEnum::Hold: { sType = "hold"; break; }
+ case BindEnum::KeyEnum::Toggle: { sType = "toggle"; break; }
+ case BindEnum::KeyEnum::DoubleClick: { sType = "double"; break; }
+ }
+ sInfo = VK2STR(_tBind.m_iKey);
+ break;
+ case BindEnum::Class:
+ sType = "class";
+ switch (_tBind.m_iInfo)
+ {
+ case BindEnum::ClassEnum::Scout: { sInfo = "scout"; break; }
+ case BindEnum::ClassEnum::Soldier: { sInfo = "soldier"; break; }
+ case BindEnum::ClassEnum::Pyro: { sInfo = "pyro"; break; }
+ case BindEnum::ClassEnum::Demoman: { sInfo = "demoman"; break; }
+ case BindEnum::ClassEnum::Heavy: { sInfo = "heavy"; break; }
+ case BindEnum::ClassEnum::Engineer: { sInfo = "engineer"; break; }
+ case BindEnum::ClassEnum::Medic: { sInfo = "medic"; break; }
+ case BindEnum::ClassEnum::Sniper: { sInfo = "sniper"; break; }
+ case BindEnum::ClassEnum::Spy: { sInfo = "spy"; break; }
+ }
+ break;
+ case BindEnum::WeaponType:
+ sType = "weapon";
+ switch (_tBind.m_iInfo)
+ {
+ case BindEnum::WeaponTypeEnum::Hitscan: { sInfo = "hitscan"; break; }
+ case BindEnum::WeaponTypeEnum::Projectile: { sInfo = "projectile"; break; }
+ case BindEnum::WeaponTypeEnum::Melee: { sInfo = "melee"; break; }
+ case BindEnum::WeaponTypeEnum::Throwable: { sInfo = "throwable"; break; }
+ }
+ break;
+ case BindEnum::ItemSlot:
+ sType = "slot";
+ sInfo = std::format("{}", _tBind.m_iInfo + 1);
+ break;
+ case BindEnum::Misc:
+ switch (_tBind.m_iInfo)
+ {
+ case BindEnum::MiscEnum::Spectated:
+ case BindEnum::MiscEnum::SpectatedFirst:
+ case BindEnum::MiscEnum::SpectatedThird:
+ sType = "spectated";
switch (_tBind.m_iInfo)
{
- case BindEnum::KeyEnum::Hold: { sType = "hold"; break; }
- case BindEnum::KeyEnum::Toggle: { sType = "toggle"; break; }
- case BindEnum::KeyEnum::DoubleClick: { sType = "double"; break; }
- }
- sInfo = VK2STR(_tBind.m_iKey);
- break;
- case BindEnum::Class:
- sType = "class";
- switch (_tBind.m_iInfo)
- {
- case BindEnum::ClassEnum::Scout: { sInfo = "scout"; break; }
- case BindEnum::ClassEnum::Soldier: { sInfo = "soldier"; break; }
- case BindEnum::ClassEnum::Pyro: { sInfo = "pyro"; break; }
- case BindEnum::ClassEnum::Demoman: { sInfo = "demoman"; break; }
- case BindEnum::ClassEnum::Heavy: { sInfo = "heavy"; break; }
- case BindEnum::ClassEnum::Engineer: { sInfo = "engineer"; break; }
- case BindEnum::ClassEnum::Medic: { sInfo = "medic"; break; }
- case BindEnum::ClassEnum::Sniper: { sInfo = "sniper"; break; }
- case BindEnum::ClassEnum::Spy: { sInfo = "spy"; break; }
+ case BindEnum::MiscEnum::Spectated: { sInfo = "any"; break; }
+ case BindEnum::MiscEnum::SpectatedFirst: { sInfo = "1st"; break; }
+ case BindEnum::MiscEnum::SpectatedThird: { sInfo = "3rd"; break; }
}
break;
- case BindEnum::WeaponType:
- sType = "weapon";
+ case BindEnum::MiscEnum::Zoomed:
+ case BindEnum::MiscEnum::Aiming:
+ sType = "cond";
switch (_tBind.m_iInfo)
{
- case BindEnum::WeaponTypeEnum::Hitscan: { sInfo = "hitscan"; break; }
- case BindEnum::WeaponTypeEnum::Projectile: { sInfo = "projectile"; break; }
- case BindEnum::WeaponTypeEnum::Melee: { sInfo = "melee"; break; }
- case BindEnum::WeaponTypeEnum::Throwable: { sInfo = "throwable"; break; }
- }
- break;
- case BindEnum::ItemSlot:
- sType = "slot";
- sInfo = std::format("{}", _tBind.m_iInfo + 1);
- break;
- case BindEnum::Misc:
- switch (_tBind.m_iInfo)
- {
- case BindEnum::MiscEnum::Spectated:
- case BindEnum::MiscEnum::SpectatedFirst:
- case BindEnum::MiscEnum::SpectatedThird:
- sType = "spectated";
- switch (_tBind.m_iInfo)
- {
- case BindEnum::MiscEnum::Spectated: { sInfo = "any"; break; }
- case BindEnum::MiscEnum::SpectatedFirst: { sInfo = "1st"; break; }
- case BindEnum::MiscEnum::SpectatedThird: { sInfo = "3rd"; break; }
- }
- break;
- case BindEnum::MiscEnum::Zoomed:
- case BindEnum::MiscEnum::Aiming:
- sType = "cond";
- switch (_tBind.m_iInfo)
- {
- case BindEnum::MiscEnum::Zoomed: { sInfo = "zoomed"; break; }
- case BindEnum::MiscEnum::Aiming: { sInfo = "aiming"; break; }
- }
- break;
+ case BindEnum::MiscEnum::Zoomed: { sInfo = "zoomed"; break; }
+ case BindEnum::MiscEnum::Aiming: { sInfo = "aiming"; break; }
}
break;
}
- if (_tBind.m_bNot && (_tBind.m_iType != BindEnum::Key || _tBind.m_iInfo == BindEnum::KeyEnum::Hold))
- sType = std::format("not {}", sType);
+ break;
+ }
+ if (_tBind.m_bNot && (_tBind.m_iType != BindEnum::Key || _tBind.m_iInfo == BindEnum::KeyEnum::Hold))
+ sType = std::format("not {}", sType);
- ImVec2 vOriginalPos = { H::Draw.Scale(8) + H::Draw.Scale(28) * std::min(x, 3), GetCursorPosY() + H::Draw.Scale(8) };
+ ImVec2 vOriginalPos = { H::Draw.Scale(8) + H::Draw.Scale(28) * std::min(x, 3), GetCursorPosY() + H::Draw.Scale(8) };
- // background
- float flWidth = GetWindowWidth() - GetStyle().WindowPadding.x * 2 - H::Draw.Scale(28) * std::min(x, 3);
- float flHeight = H::Draw.Scale(28);
- ImVec2 vDrawPos = GetDrawPos() + vOriginalPos;
- if (iBind != _iBind)
- GetWindowDrawList()->AddRectFilled(vDrawPos, { vDrawPos.x + flWidth, vDrawPos.y + flHeight }, F::Render.Background1p5, H::Draw.Scale(4));
+ // background
+ float flWidth = GetWindowWidth() - GetStyle().WindowPadding.x * 2 - H::Draw.Scale(28) * std::min(x, 3);
+ float flHeight = H::Draw.Scale(28);
+ ImVec2 vDrawPos = GetDrawPos() + vOriginalPos;
+ if (iBind != _iBind)
+ GetWindowDrawList()->AddRectFilled(vDrawPos, vDrawPos + ImVec2(flWidth, flHeight), F::Render.Background1p5, H::Draw.Scale(4));
+ else
+ {
+ ImColor tColor = F::Render.Background1p5L;
+ GetWindowDrawList()->AddRectFilled(vDrawPos, vDrawPos + ImVec2(flWidth, flHeight), tColor, H::Draw.Scale(4));
+
+ tColor = ColorToVec((VecToColor(F::Render.Background1p5)).Lerp({ 127, 127, 127 }, 1.f / 9, LerpEnum::NoAlpha));
+ float flInset = H::Draw.Scale(0.5f) - 0.5f;
+ GetWindowDrawList()->AddRect(vDrawPos + ImVec2(flInset, flInset), vDrawPos + ImVec2(flWidth - flInset, flHeight - flInset), tColor, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale());
+ }
+
+ // text
+ if (x > 3)
+ { // don't indent too much
+ auto sText = std::format("-> {}", x);
+ SetCursorPos(vOriginalPos + ImVec2(-FCalcTextSize(sText.c_str()).x - H::Draw.Scale(10), H::Draw.Scale(7)));
+ FText(sText.c_str());
+ }
+
+ float flTextWidth = flWidth - H::Draw.Scale(127);
+ PushTransparent(!F::Binds.WillBeEnabled(_iBind), true);
+
+ SetCursorPos(vOriginalPos + ImVec2(H::Draw.Scale(9), H::Draw.Scale(7)));
+ FText(TruncateText(_tBind.m_sName, flTextWidth * (1.f / 3) - H::Draw.Scale(20)).c_str());
+
+ SetCursorPos(vOriginalPos + ImVec2(flTextWidth * (1.f / 3), H::Draw.Scale(7)));
+ FText(sType.c_str());
+
+ SetCursorPos(vOriginalPos + ImVec2(flTextWidth * (2.f / 3), H::Draw.Scale(7)));
+ FText(sInfo.c_str());
+
+ // buttons
+ int iOffset = 1;
+
+ SetCursorPos(vOriginalPos + ImVec2(flWidth - H::Draw.Scale(iOffset += 25), H::Draw.Scale(2)));
+ bool bDelete = IconButton(ICON_MD_DELETE);
+
+ SetCursorPos(vOriginalPos + ImVec2(flWidth - H::Draw.Scale(iOffset += 25), H::Draw.Scale(2)));
+ if (IconButton(ICON_MD_EDIT))
+ CurrentBind = CurrentBind != _iBind ? _iBind : DEFAULT_BIND;
+
+ SetCursorPos(vOriginalPos + ImVec2(flWidth - H::Draw.Scale(iOffset += 25), 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 + ImVec2(flWidth - H::Draw.Scale(iOffset += 25), 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 + ImVec2(flWidth - H::Draw.Scale(iOffset += 25), H::Draw.Scale(2)));
+ if (IconButton(_tBind.m_bEnabled ? ICON_MD_TOGGLE_ON : ICON_MD_TOGGLE_OFF))
+ _tBind.m_bEnabled = !_tBind.m_bEnabled;
+
+ SetCursorPos(vOriginalPos);
+ bool bClicked = Button(std::format("##{}", _iBind).c_str(), { flWidth, flHeight });
+ bool bPopup = IsItemClicked(ImGuiMouseButton_Right);
+
+ PopTransparent(1, 1);
+
+ if (bClicked)
+ {
+ if (!bParent)
+ {
+ iBind = _iBind;
+ tBind = _tBind;
+ }
else
{
- ImColor tColor = F::Render.Background1p5L;
- GetWindowDrawList()->AddRectFilled(vDrawPos, { vDrawPos.x + flWidth, vDrawPos.y + flHeight }, tColor, H::Draw.Scale(4));
+ bParent = false;
+ tBind.m_iParent = _iBind;
- tColor = ColorToVec((VecToColor(F::Render.Background1p5)).Lerp({ 127, 127, 127 }, 1.f / 9, LerpEnum::NoAlpha));
- float flInset = H::Draw.Scale(0.5f) - 0.5f;
- GetWindowDrawList()->AddRect({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x - flInset + flWidth, vDrawPos.y - flInset + flHeight }, tColor, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale());
- }
-
- // text
- if (x > 3)
- { // don't indent too much
- auto sText = std::format("-> {}", x);
- SetCursorPos({ vOriginalPos.x - FCalcTextSize(sText.c_str()).x - H::Draw.Scale(10), vOriginalPos.y + H::Draw.Scale(7) });
- FText(sText.c_str());
- }
-
- float flTextWidth = flWidth - H::Draw.Scale(127);
- PushTransparent(!F::Binds.WillBeEnabled(_iBind), true);
-
- SetCursorPos({ vOriginalPos.x + H::Draw.Scale(9), vOriginalPos.y + H::Draw.Scale(7) });
- FText(TruncateText(_tBind.m_sName, flTextWidth * (1.f / 3) - H::Draw.Scale(20)).c_str());
-
- SetCursorPos({ vOriginalPos.x + flTextWidth * (1.f / 3), vOriginalPos.y + H::Draw.Scale(7) });
- FText(sType.c_str());
-
- SetCursorPos({ vOriginalPos.x + flTextWidth * (2.f / 3), vOriginalPos.y + H::Draw.Scale(7) });
- FText(sInfo.c_str());
-
- // buttons
- int iOffset = 1;
-
- 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(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(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(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(2) });
- if (IconButton(_tBind.m_bEnabled ? ICON_MD_TOGGLE_ON : ICON_MD_TOGGLE_OFF))
- _tBind.m_bEnabled = !_tBind.m_bEnabled;
-
- SetCursorPos(vOriginalPos);
- bool bClicked = Button(std::format("##{}", _iBind).c_str(), { flWidth, flHeight });
- bool bPopup = IsItemClicked(ImGuiMouseButton_Right);
-
- PopTransparent(1, 1);
-
- if (bClicked)
- {
- if (!bParent)
+ // make sure bind can't be parented to itself or any of its children
+ int _iBind2 = _iBind;
+ Bind_t _tBind2;
+ while (F::Binds.GetBind(_iBind2, &_tBind2))
{
- iBind = _iBind;
- tBind = _tBind;
- }
- else
- {
- bParent = false;
- tBind.m_iParent = _iBind;
-
- // make sure bind can't be parented to itself or any of its children
- int _iBind2 = _iBind;
- Bind_t _tBind2;
- while (F::Binds.GetBind(_iBind2, &_tBind2))
- {
- if (_iBind2 == iBind)
- tBind.m_iParent = DEFAULT_BIND;
- _iBind2 = _tBind2.m_iParent;
- }
+ if (_iBind2 == iBind)
+ tBind.m_iParent = DEFAULT_BIND;
+ _iBind2 = _tBind2.m_iParent;
}
}
- else if (bPopup)
- OpenPopup(std::format("RightClicked{}", _iBind).c_str());
- else if (iDragging == -1 && IsItemHovered() && IsMouseDown(ImGuiMouseButton_Left))
- iDragging = _iBind, iLayer = iParent;
- else if (bDelete)
- {
- if (U::KeyHandler.Down(VK_SHIFT)) // allow user to quickly remove binds
- F::Binds.RemoveBind(_iBind);
- else
- OpenPopup(std::format("DeleteBind{}", _iBind).c_str());
- }
-
- if (FBeginPopup(std::format("RightClicked{}", _iBind).c_str()))
- {
- PushStyleVar(ImGuiStyleVar_ItemSpacing, { H::Draw.Scale(8), 0 });
-
- {
- static std::string sInput = "";
-
- bool bEnter = FInputText("Name...", sInput, H::Draw.Scale(284), ImGuiInputTextFlags_EnterReturnsTrue);
- if (!IsItemFocused())
- sInput = _tBind.m_sName;
- if (bEnter)
- _tBind.m_sName = sInput;
- }
-
- FDropdown("Type", &_tBind.m_iType, { "Key", "Class", "Weapon type", "Item slot", "Misc" }, {}, FDropdownEnum::Left);
- switch (_tBind.m_iType)
- {
- case BindEnum::Key: FDropdown("Behavior", &_tBind.m_iInfo, { "Hold", "Toggle", "Double click" }, {}, FDropdownEnum::Right); break;
- case BindEnum::Class: FDropdown("Class", &_tBind.m_iInfo, { "Scout", "Soldier", "Pyro", "Demoman", "Heavy", "Engineer", "Medic", "Sniper", "Spy" }, {}, FDropdownEnum::Right); break;
- case BindEnum::WeaponType: FDropdown("Weapon type", &_tBind.m_iInfo, { "Hitscan", "Projectile", "Melee", "Throwable" }, {}, FDropdownEnum::Right); break;
- case BindEnum::ItemSlot: FDropdown("Item slot", &_tBind.m_iInfo, { "1", "2", "3", "4", "5", "6", "7", "8", "9" }, {}, FDropdownEnum::Right); break;
- case BindEnum::Misc: FDropdown("Misc", &_tBind.m_iInfo, { "Spectated", "Spectated 1st", "Spectated 3rd", "##Divider", "Zoomed", "Aiming" }, {}, FDropdownEnum::Right); break;
- }
- if (_tBind.m_iType == BindEnum::Key)
- FKeybind("Key", _tBind.m_iKey);
-
- PopStyleVar();
- EndPopup();
- }
- else if (FBeginPopupModal(std::format("DeleteBind{}", _iBind).c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysUseWindowPadding))
- {
- FText(std::format("Do you really want to delete '{}'{}?", _tBind.m_sName, F::Binds.HasChildren(_iBind) ? " and all of its children" : "").c_str());
-
- if (FButton("Yes", FButtonEnum::Left))
- {
- F::Binds.RemoveBind(_iBind);
- CloseCurrentPopup();
-
- iBind = DEFAULT_BIND;
- tBind = {};
- }
- if (FButton("No", FButtonEnum::Right | FButtonEnum::SameLine))
- CloseCurrentPopup();
-
- EndPopup();
- }
-
- if (iParent != DEFAULT_BIND - 1)
- fGetBinds(_iBind, x + 1);
}
- };
+ else if (bPopup)
+ OpenPopup(std::format("RightClicked{}", _iBind).c_str());
+ else if (iDragging == -1 && IsItemHovered() && IsMouseDown(ImGuiMouseButton_Left))
+ iDragging = _iBind, iLayer = iParent;
+ else if (bDelete)
+ {
+ if (U::KeyHandler.Down(VK_SHIFT)) // allow user to quickly remove binds
+ F::Binds.RemoveBind(_iBind);
+ else
+ OpenPopup(std::format("DeleteBind{}", _iBind).c_str());
+ }
+
+ if (FBeginPopup(std::format("RightClicked{}", _iBind).c_str()))
+ {
+ PushStyleVar(ImGuiStyleVar_ItemSpacing, { H::Draw.Scale(8), 0 });
+
+ {
+ static std::string sInput = "";
+
+ bool bEnter = FInputText("Name...", sInput, H::Draw.Scale(284), ImGuiInputTextFlags_EnterReturnsTrue);
+ if (!IsItemFocused())
+ sInput = _tBind.m_sName;
+ if (bEnter)
+ _tBind.m_sName = sInput;
+ }
+
+ FDropdown("Type", &_tBind.m_iType, { "Key", "Class", "Weapon type", "Item slot", "Misc" }, {}, FDropdownEnum::Left);
+ switch (_tBind.m_iType)
+ {
+ case BindEnum::Key: FDropdown("Behavior", &_tBind.m_iInfo, { "Hold", "Toggle", "Double click" }, {}, FDropdownEnum::Right); break;
+ case BindEnum::Class: FDropdown("Class", &_tBind.m_iInfo, { "Scout", "Soldier", "Pyro", "Demoman", "Heavy", "Engineer", "Medic", "Sniper", "Spy" }, {}, FDropdownEnum::Right); break;
+ case BindEnum::WeaponType: FDropdown("Weapon type", &_tBind.m_iInfo, { "Hitscan", "Projectile", "Melee", "Throwable" }, {}, FDropdownEnum::Right); break;
+ case BindEnum::ItemSlot: FDropdown("Item slot", &_tBind.m_iInfo, { "1", "2", "3", "4", "5", "6", "7", "8", "9" }, {}, FDropdownEnum::Right); break;
+ case BindEnum::Misc: FDropdown("Misc", &_tBind.m_iInfo, { "Spectated", "Spectated 1st", "Spectated 3rd", "##Divider", "Zoomed", "Aiming" }, {}, FDropdownEnum::Right); break;
+ }
+ if (_tBind.m_iType == BindEnum::Key)
+ FKeybind("Key", _tBind.m_iKey);
+
+ PopStyleVar();
+ EndPopup();
+ }
+ else if (FBeginPopupModal(std::format("DeleteBind{}", _iBind).c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysUseWindowPadding))
+ {
+ FText(std::format("Do you really want to delete '{}'{}?", _tBind.m_sName, F::Binds.HasChildren(_iBind) ? " and all of its children" : "").c_str());
+
+ if (FButton("Yes", FButtonEnum::Left))
+ {
+ F::Binds.RemoveBind(_iBind);
+ CloseCurrentPopup();
+
+ iBind = DEFAULT_BIND;
+ tBind = {};
+ }
+ if (FButton("No", FButtonEnum::Right | FButtonEnum::SameLine))
+ CloseCurrentPopup();
+
+ EndPopup();
+ }
+
+ if (iParent != DEFAULT_BIND - 1)
+ fGetBinds(_iBind, x + 1);
+ }
+ };
fGetBinds(DEFAULT_BIND, 0);
// this should ideally never happen, but failsafe
@@ -2953,7 +3064,7 @@ void CMenu::MenuSettings(int iTab)
{
static std::string sStaticName;
- FSDropdown("Name", &sStaticName, {}, FSDropdownEnum::AutoUpdate, -H::Draw.Unscale(FCalcTextSize("CREATE").x + FCalcTextSize("FOLDER").x) - 72);
+ FSDropdown("Name", &sStaticName, {}, FSDropdownEnum::AutoUpdate, -H::Draw.Unscale(FCalcTextSize("CREATE").x + H::Draw.Scale(40)) - 44);
PushDisabled(sStaticName.empty());
{
if (FButton("Create", FButtonEnum::Fit | FButtonEnum::SameLine, { 0, 40 }))
@@ -2963,7 +3074,8 @@ void CMenu::MenuSettings(int iTab)
}
}
PopDisabled();
- if (FButton("Folder", FButtonEnum::Fit | FButtonEnum::SameLine, { 0, 40 }))
+
+ if (FButton(ICON_MD_FOLDER, FButtonEnum::Fit | FButtonEnum::SameLine, { 40, 40 }, 0, F::Render.IconFont))
ShellExecuteA(NULL, NULL, F::Configs.m_sMaterialsPath.c_str(), NULL, NULL, SW_SHOWNORMAL);
std::vector vMaterials;
@@ -2971,21 +3083,21 @@ void CMenu::MenuSettings(int iTab)
vMaterials.push_back(tMaterial);
std::sort(vMaterials.begin(), vMaterials.end(), [&](const auto& a, const auto& b) -> bool
- {
- // override for none material
- if (FNV1A::Hash32(a.m_sName.c_str()) == FNV1A::Hash32Const("None"))
- return true;
- if (FNV1A::Hash32(b.m_sName.c_str()) == FNV1A::Hash32Const("None"))
- return false;
+ {
+ // override for none material
+ if (FNV1A::Hash32(a.m_sName.c_str()) == FNV1A::Hash32Const("None"))
+ return true;
+ if (FNV1A::Hash32(b.m_sName.c_str()) == FNV1A::Hash32Const("None"))
+ return false;
- // keep locked materials higher
- if (a.m_bLocked && !b.m_bLocked)
- return true;
- if (!a.m_bLocked && b.m_bLocked)
- return false;
+ // keep locked materials higher
+ if (a.m_bLocked && !b.m_bLocked)
+ return true;
+ if (!a.m_bLocked && b.m_bLocked)
+ return false;
- return a.m_sName < b.m_sName;
- });
+ return a.m_sName < b.m_sName;
+ });
for (auto& tMaterial : vMaterials)
{
@@ -3034,9 +3146,9 @@ void CMenu::MenuSettings(int iTab)
SetScrollY(0);
EndSection();
- /* Column 2 */
if (bTable)
{
+ /* Column 2 */
TableNextColumn();
if (CurrentMaterial.length())
{
@@ -3080,7 +3192,7 @@ void CMenu::MenuSettings(int iTab)
TextEditor.Render("TextEditor");
ImVec2 vSize = GetItemRectSize();
float flInset = H::Draw.Scale(0.5f) - 0.5f;
- GetWindowDrawList()->AddRect({ vDrawPos.x + flInset, vDrawPos.y + flInset }, { vDrawPos.x - flInset + vSize.x, vDrawPos.y - flInset + vSize.y }, F::Render.Background2, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale());
+ GetWindowDrawList()->AddRect(vDrawPos + ImVec2(flInset, flInset), vDrawPos + ImVec2(vSize.x - flInset, vSize.y - flInset), F::Render.Background2, H::Draw.Scale(4), ImDrawFlags_None, H::Draw.Scale());
PopFont();
} EndSection();
}
@@ -3245,8 +3357,30 @@ void CMenu::MenuSettings(int iTab)
} EndSection();
#endif
#ifdef DEBUG_HOOKS
- if (Section("Hooks", 8))
+ if (Section("Hooks"))
{
+ auto SetAll = [](bool bEnable)
+ {
+ for (auto& pBase : G::Vars)
+ {
+ if (std::string(pBase->Name()).find("Vars::Hooks::") == std::string::npos)
+ continue;
+
+ switch (FNV1A::Hash32(pBase->Name()))
+ {
+ case FNV1A::Hash32Const("Vars::Hooks::Direct3DDevice9_Present"):
+ case FNV1A::Hash32Const("Vars::Hooks::Direct3DDevice9_Reset"):
+ break;
+ default:
+ pBase->As()->Map[DEFAULT_BIND] = bEnable;
+ }
+ }
+ };
+ if (FButton("Enable all", FButtonEnum::Left))
+ SetAll(true);
+ if (FButton("Disable all", FButtonEnum::Right | FButtonEnum::SameLine))
+ SetAll(false);
+
int i = 0; for (auto& pBase : G::Vars)
{
if (std::string(pBase->Name()).find("Vars::Hooks::") == std::string::npos)
@@ -3419,6 +3553,11 @@ void CMenu::MenuSearch(std::string sSearch)
const char* sFormat = nullptr;
switch (FNV1A::Hash32(pVar->Name()))
{
+ case FNV1A::Hash32Const("Vars::Visuals::Prediction::PlayerDrawDuration"):
+ case FNV1A::Hash32Const("Vars::Visuals::Prediction::ProjectileDrawDuration"):
+ if (!pVar->Map[DEFAULT_BIND])
+ sFormat = "timed";
+ break;
case FNV1A::Hash32Const("Vars::Aimbot::Projectile::SplashRotateX"):
case FNV1A::Hash32Const("Vars::Aimbot::Projectile::SplashRotateY"):
if (pVar->Map[DEFAULT_BIND] < 0.f)
@@ -3616,92 +3755,92 @@ void CMenu::DrawBinds()
std::vector vInfo;
std::function fGetBinds = [&](int iParent)
+ {
+ for (int iBind = 0; iBind < F::Binds.m_vBinds.size(); iBind++)
{
- for (int iBind = 0; iBind < F::Binds.m_vBinds.size(); iBind++)
- {
- auto& tBind = F::Binds.m_vBinds[iBind];
- if (iParent != tBind.m_iParent || !tBind.m_bEnabled && !m_bIsOpen)
- continue;
+ auto& tBind = F::Binds.m_vBinds[iBind];
+ if (iParent != tBind.m_iParent || !tBind.m_bEnabled && !m_bIsOpen)
+ continue;
- if (tBind.m_iVisibility == BindVisibilityEnum::Always || tBind.m_iVisibility == BindVisibilityEnum::WhileActive && tBind.m_bActive || m_bIsOpen)
+ if (tBind.m_iVisibility == BindVisibilityEnum::Always || tBind.m_iVisibility == BindVisibilityEnum::WhileActive && tBind.m_bActive || m_bIsOpen)
+ {
+ std::string sType; std::string sInfo;
+ switch (tBind.m_iType)
{
- std::string sType; std::string sInfo;
- switch (tBind.m_iType)
+ case BindEnum::Key:
+ switch (tBind.m_iInfo)
{
- case BindEnum::Key:
+ case BindEnum::KeyEnum::Hold: { sType = "hold"; break; }
+ case BindEnum::KeyEnum::Toggle: { sType = "toggle"; break; }
+ case BindEnum::KeyEnum::DoubleClick: { sType = "double"; break; }
+ }
+ sInfo = VK2STR(tBind.m_iKey);
+ break;
+ case BindEnum::Class:
+ sType = "class";
+ switch (tBind.m_iInfo)
+ {
+ case BindEnum::ClassEnum::Scout: { sInfo = "scout"; break; }
+ case BindEnum::ClassEnum::Soldier: { sInfo = "soldier"; break; }
+ case BindEnum::ClassEnum::Pyro: { sInfo = "pyro"; break; }
+ case BindEnum::ClassEnum::Demoman: { sInfo = "demoman"; break; }
+ case BindEnum::ClassEnum::Heavy: { sInfo = "heavy"; break; }
+ case BindEnum::ClassEnum::Engineer: { sInfo = "engineer"; break; }
+ case BindEnum::ClassEnum::Medic: { sInfo = "medic"; break; }
+ case BindEnum::ClassEnum::Sniper: { sInfo = "sniper"; break; }
+ case BindEnum::ClassEnum::Spy: { sInfo = "spy"; break; }
+ }
+ break;
+ case BindEnum::WeaponType:
+ sType = "weapon";
+ switch (tBind.m_iInfo)
+ {
+ case BindEnum::WeaponTypeEnum::Hitscan: { sInfo = "hitscan"; break; }
+ case BindEnum::WeaponTypeEnum::Projectile: { sInfo = "projectile"; break; }
+ case BindEnum::WeaponTypeEnum::Melee: { sInfo = "melee"; break; }
+ case BindEnum::WeaponTypeEnum::Throwable: { sInfo = "throwable"; break; }
+ }
+ break;
+ case BindEnum::ItemSlot:
+ sType = "slot";
+ sInfo = std::format("{}", tBind.m_iInfo + 1);
+ break;
+ case BindEnum::Misc:
+ switch (tBind.m_iInfo)
+ {
+ case BindEnum::MiscEnum::Spectated:
+ case BindEnum::MiscEnum::SpectatedFirst:
+ case BindEnum::MiscEnum::SpectatedThird:
+ sType = "spectated";
switch (tBind.m_iInfo)
{
- case BindEnum::KeyEnum::Hold: { sType = "hold"; break; }
- case BindEnum::KeyEnum::Toggle: { sType = "toggle"; break; }
- case BindEnum::KeyEnum::DoubleClick: { sType = "double"; break; }
- }
- sInfo = VK2STR(tBind.m_iKey);
- break;
- case BindEnum::Class:
- sType = "class";
- switch (tBind.m_iInfo)
- {
- case BindEnum::ClassEnum::Scout: { sInfo = "scout"; break; }
- case BindEnum::ClassEnum::Soldier: { sInfo = "soldier"; break; }
- case BindEnum::ClassEnum::Pyro: { sInfo = "pyro"; break; }
- case BindEnum::ClassEnum::Demoman: { sInfo = "demoman"; break; }
- case BindEnum::ClassEnum::Heavy: { sInfo = "heavy"; break; }
- case BindEnum::ClassEnum::Engineer: { sInfo = "engineer"; break; }
- case BindEnum::ClassEnum::Medic: { sInfo = "medic"; break; }
- case BindEnum::ClassEnum::Sniper: { sInfo = "sniper"; break; }
- case BindEnum::ClassEnum::Spy: { sInfo = "spy"; break; }
+ case BindEnum::MiscEnum::Spectated: { sInfo = "any"; break; }
+ case BindEnum::MiscEnum::SpectatedFirst: { sInfo = "1st"; break; }
+ case BindEnum::MiscEnum::SpectatedThird: { sInfo = "3rd"; break; }
}
break;
- case BindEnum::WeaponType:
- sType = "weapon";
+ case BindEnum::MiscEnum::Zoomed:
+ case BindEnum::MiscEnum::Aiming:
+ sType = "cond";
switch (tBind.m_iInfo)
{
- case BindEnum::WeaponTypeEnum::Hitscan: { sInfo = "hitscan"; break; }
- case BindEnum::WeaponTypeEnum::Projectile: { sInfo = "projectile"; break; }
- case BindEnum::WeaponTypeEnum::Melee: { sInfo = "melee"; break; }
- case BindEnum::WeaponTypeEnum::Throwable: { sInfo = "throwable"; break; }
- }
- break;
- case BindEnum::ItemSlot:
- sType = "slot";
- sInfo = std::format("{}", tBind.m_iInfo + 1);
- break;
- case BindEnum::Misc:
- switch (tBind.m_iInfo)
- {
- case BindEnum::MiscEnum::Spectated:
- case BindEnum::MiscEnum::SpectatedFirst:
- case BindEnum::MiscEnum::SpectatedThird:
- sType = "spectated";
- switch (tBind.m_iInfo)
- {
- case BindEnum::MiscEnum::Spectated: { sInfo = "any"; break; }
- case BindEnum::MiscEnum::SpectatedFirst: { sInfo = "1st"; break; }
- case BindEnum::MiscEnum::SpectatedThird: { sInfo = "3rd"; break; }
- }
- break;
- case BindEnum::MiscEnum::Zoomed:
- case BindEnum::MiscEnum::Aiming:
- sType = "cond";
- switch (tBind.m_iInfo)
- {
- case BindEnum::MiscEnum::Zoomed: { sInfo = "zoomed"; break; }
- case BindEnum::MiscEnum::Aiming: { sInfo = "aiming"; break; }
- }
- break;
+ case BindEnum::MiscEnum::Zoomed: { sInfo = "zoomed"; break; }
+ case BindEnum::MiscEnum::Aiming: { sInfo = "aiming"; break; }
}
break;
}
- if (tBind.m_bNot && (tBind.m_iType != BindEnum::Key || tBind.m_iInfo == BindEnum::KeyEnum::Hold))
- sInfo = std::format("not {}", sInfo);
-
- vInfo.emplace_back(tBind.m_sName.c_str(), sType, sInfo, iBind, tBind);
+ break;
}
+ if (tBind.m_bNot && (tBind.m_iType != BindEnum::Key || tBind.m_iInfo == BindEnum::KeyEnum::Hold))
+ sInfo = std::format("not {}", sInfo);
- if (tBind.m_bActive || m_bIsOpen)
- fGetBinds(iBind);
+ vInfo.emplace_back(tBind.m_sName.c_str(), sType, sInfo, iBind, tBind);
}
- };
+
+ if (tBind.m_bActive || m_bIsOpen)
+ fGetBinds(iBind);
+ }
+ };
fGetBinds(DEFAULT_BIND);
if (vInfo.empty())
return;
diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.h b/Amalgam/src/Features/ImGui/Menu/Menu.h
index 47a22343..62a85140 100644
--- a/Amalgam/src/Features/ImGui/Menu/Menu.h
+++ b/Amalgam/src/Features/ImGui/Menu/Menu.h
@@ -18,11 +18,12 @@ class CMenu
private:
void DrawMenu();
- void MenuAimbot(int iTab);
- void MenuVisuals(int iTab);
- void MenuMisc(int iTab);
- void MenuLogs(int iTab);
- void MenuSettings(int iTab);
+ void MenuAimbot(int iTab = 0);
+ void MenuHVH(int iTab = 0);
+ void MenuVisuals(int iTab = 0);
+ void MenuMisc(int iTab = 0);
+ void MenuLogs(int iTab = 0);
+ void MenuSettings(int iTab = 0);
void MenuSearch(std::string sSearch);
void AddDraggable(const char* sLabel, ConfigVar& var, bool bShouldDraw = true, ImVec2 vSize = { H::Draw.Scale(100), H::Draw.Scale(40) });
diff --git a/Amalgam/src/Features/Misc/Misc.cpp b/Amalgam/src/Features/Misc/Misc.cpp
index de57cd75..b563e78c 100644
--- a/Amalgam/src/Features/Misc/Misc.cpp
+++ b/Amalgam/src/Features/Misc/Misc.cpp
@@ -453,8 +453,9 @@ int CMisc::AntiBackstab(CTFPlayer* pLocal, CUserCmd* pCmd, bool bSendPacket)
Vec3 vTargetPos1 = pPlayer->GetCenter();
Vec3 vTargetPos2 = vTargetPos1 + pPlayer->m_vecVelocity() * F::Backtrack.GetReal();
float flDistance = std::max(std::max(SDK::MaxSpeed(pPlayer), SDK::MaxSpeed(pLocal)), pPlayer->m_vecVelocity().Length());
- if ((vLocalPos.DistTo(vTargetPos1) > flDistance || !SDK::VisPosWorld(pLocal, pPlayer, vLocalPos, vTargetPos1))
- && (vLocalPos.DistTo(vTargetPos2) > flDistance || !SDK::VisPosWorld(pLocal, pPlayer, vLocalPos, vTargetPos2)))
+ float flDistanceSqr = powf(flDistance, 2);
+ if ((vLocalPos.DistToSqr(vTargetPos1) > flDistanceSqr || !SDK::VisPosWorld(pLocal, pPlayer, vLocalPos, vTargetPos1))
+ && (vLocalPos.DistToSqr(vTargetPos2) > flDistanceSqr || !SDK::VisPosWorld(pLocal, pPlayer, vLocalPos, vTargetPos2)))
continue;
vTargets.emplace_back(vTargetPos2, pEntity);
@@ -464,7 +465,7 @@ int CMisc::AntiBackstab(CTFPlayer* pLocal, CUserCmd* pCmd, bool bSendPacket)
std::sort(vTargets.begin(), vTargets.end(), [&](const auto& a, const auto& b) -> bool
{
- return pLocal->GetCenter().DistTo(a.first) < pLocal->GetCenter().DistTo(b.first);
+ return pLocal->GetCenter().DistToSqr(a.first) < pLocal->GetCenter().DistToSqr(b.first);
});
auto& pTargetPos = vTargets.front();
diff --git a/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp b/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp
index 3c4d899e..19b65e5a 100644
--- a/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp
+++ b/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp
@@ -178,7 +178,7 @@ void CNoSpreadHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd*
const auto cFixedSpread = std::ranges::min_element(vBulletCorrections,
[&](const Vec3& lhs, const Vec3& rhs)
{
- return lhs.DistTo(vAverageSpread) < rhs.DistTo(vAverageSpread);
+ return lhs.DistToSqr(vAverageSpread) < rhs.DistToSqr(vAverageSpread);
});
if (cFixedSpread == vBulletCorrections.end())
diff --git a/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp b/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp
index 3027ee55..1a948ff4 100644
--- a/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp
+++ b/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp
@@ -92,7 +92,7 @@ void CFakeLag::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, bo
{
case Vars::Fakelag::FakelagEnum::Off: m_iGoal = 0; break;
case Vars::Fakelag::FakelagEnum::Plain: m_iGoal = Vars::Fakelag::PlainTicks.Value; break;
- case Vars::Fakelag::FakelagEnum::Random: m_iGoal = SDK::RandomInt(Vars::Fakelag::RandomTicks.Value.Min, Vars::Fakelag::RandomTicks.Value.Max); break;
+ case Vars::Fakelag::FakelagEnum::Random: m_iGoal = SDK::StdRandomInt(Vars::Fakelag::RandomTicks.Value.Min, Vars::Fakelag::RandomTicks.Value.Max); break;
case Vars::Fakelag::FakelagEnum::Adaptive: m_iGoal = 22; break;
}
}
diff --git a/Amalgam/src/Features/Resolver/Resolver.cpp b/Amalgam/src/Features/Resolver/Resolver.cpp
index d9e0ed72..b4743505 100644
--- a/Amalgam/src/Features/Resolver/Resolver.cpp
+++ b/Amalgam/src/Features/Resolver/Resolver.cpp
@@ -70,7 +70,7 @@ void CResolver::FrameStageNotify()
if (fabsf(pPlayer->m_angEyeAnglesX()) == 90.f)
{
if (auto flPitch = GetPitchForSniperDot(pPlayer, pResource))
- tData.m_flPitch = flPitch.value();
+ tData.m_flPitch = *flPitch;
else if (!tData.m_bFirstOOBPitch && tData.m_bAutoSetPitch || tData.m_bInversePitch)
tData.m_flPitch = -pPlayer->m_angEyeAnglesX(); // set to inverse by default
else
diff --git a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp
index 41b873b8..8fb3db05 100644
--- a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp
+++ b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp
@@ -50,6 +50,8 @@ static inline void HandleMovement(CTFPlayer* pPlayer, MoveData* pLastRecord, Mov
{ // does this eat up fps? i can't tell currently
CGameTrace trace = {};
CTraceFilterWorldAndPropsOnly filter = {};
+ filter.pSkip = pPlayer;
+
SDK::TraceHull(pLastRecord->m_vOrigin, pLastRecord->m_vOrigin + pLastRecord->m_vVelocity * TICK_INTERVAL, pPlayer->m_vecMins() + PLAYER_ORIGIN_COMPRESSION, pPlayer->m_vecMaxs() - PLAYER_ORIGIN_COMPRESSION, pPlayer->SolidMask(), &filter, &trace);
if (trace.DidHit() && trace.plane.normal.z < 0.707f)
{
@@ -65,7 +67,7 @@ static inline void HandleMovement(CTFPlayer* pPlayer, MoveData* pLastRecord, Mov
{
s_tDummyCmd.forwardmove = 450.f;
s_tDummyCmd.sidemove = 0.f;
- SDK::FixMovement(&s_tDummyCmd, bLocal ? F::EnginePrediction.m_vAngles : pPlayer->GetEyeAngles(), {});
+ SDK::FixMovement(&s_tDummyCmd, bLocal ? G::CurrentUserCmd->viewangles : pPlayer->GetEyeAngles(), {});
tCurRecord.m_vDirection.x = s_tDummyCmd.forwardmove;
tCurRecord.m_vDirection.y = -s_tDummyCmd.sidemove;
return;
@@ -97,23 +99,24 @@ static inline void HandleMovement(CTFPlayer* pPlayer, MoveData* pLastRecord, Mov
void CMovementSimulation::Store()
{
+ if (I::EngineClient->IsPlayingDemo())
+ return;
+
for (auto pEntity : H::Entities.GetGroup(EntityEnum::PlayerAll))
{
auto pPlayer = pEntity->As();
auto& vRecords = m_mRecords[pPlayer->entindex()];
-
- if (!pPlayer->IsAlive() || pPlayer->IsAGhost() || pPlayer->m_vecVelocity().IsZero())
+ if (!pPlayer->IsAlive() || pPlayer->IsAGhost() || pPlayer->IsDormant() || pPlayer->m_vecVelocity().IsZero())
{
vRecords.clear();
continue;
}
- else if (!H::Entities.GetDeltaTime(pPlayer->entindex()))
+ else if (pPlayer->entindex() == I::EngineClient->GetLocalPlayer() || !H::Entities.GetDeltaTime(pPlayer->entindex()))
continue;
- bool bLocal = pPlayer->entindex() == I::EngineClient->GetLocalPlayer() && !I::EngineClient->IsPlayingDemo();
- Vec3 vVelocity = bLocal ? F::EnginePrediction.m_vVelocity : pPlayer->m_vecVelocity();
- Vec3 vOrigin = bLocal ? F::EnginePrediction.m_vOrigin : pPlayer->m_vecOrigin();
- Vec3 vDirection = bLocal ? Math::RotatePoint(F::EnginePrediction.m_vDirection, {}, { 0, F::EnginePrediction.m_vAngles.y, 0 }) : vVelocity.To2D();
+ Vec3 vVelocity = pPlayer->m_vecVelocity();
+ Vec3 vOrigin = pPlayer->m_vecOrigin();
+ Vec3 vDirection = vVelocity.To2D();
MoveData* pLastRecord = !vRecords.empty() ? &vRecords.front() : nullptr;
vRecords.emplace_front(
@@ -134,8 +137,7 @@ void CMovementSimulation::Store()
{
auto pPlayer = pEntity->As();
auto& vSimTimes = m_mSimTimes[pPlayer->entindex()];
-
- if (pEntity->entindex() == I::EngineClient->GetLocalPlayer() || !pPlayer->IsAlive() || pPlayer->IsAGhost())
+ if (pEntity->entindex() == I::EngineClient->GetLocalPlayer() || !pPlayer->IsAlive() || pPlayer->IsAGhost() || pPlayer->IsDormant())
{
vSimTimes.clear();
continue;
@@ -151,6 +153,34 @@ void CMovementSimulation::Store()
}
}
+void CMovementSimulation::StorePlayer(CTFPlayer* pPlayer, CMoveData& tMoveData, float flTime)
+{
+ auto& vRecords = m_mRecords[pPlayer->entindex()];
+ if (!pPlayer->IsAlive() || pPlayer->IsAGhost() || pPlayer->IsDormant() || pPlayer->m_vecVelocity().IsZero())
+ {
+ vRecords.clear();
+ return;
+ }
+
+ Vec3 vVelocity = tMoveData.m_vecVelocity;
+ Vec3 vOrigin = tMoveData.m_vecAbsOrigin;
+ Vec3 vDirection = Math::RotatePoint({ tMoveData.m_flForwardMove, -tMoveData.m_flSideMove, tMoveData.m_flUpMove }, {}, { 0, tMoveData.m_vecViewAngles.y, 0 });
+
+ MoveData* pLastRecord = !vRecords.empty() ? &vRecords.front() : nullptr;
+ vRecords.emplace_front(
+ vDirection,
+ flTime,
+ pPlayer->IsSwimming() ? MoveEnum::Swim : pPlayer->IsOnGround() ? MoveEnum::Ground : MoveEnum::Air,
+ vVelocity,
+ vOrigin
+ );
+ MoveData& tCurRecord = vRecords.front();
+ if (vRecords.size() > 66)
+ vRecords.pop_back();
+
+ HandleMovement(pPlayer, pLastRecord, tCurRecord, vRecords);
+}
+
bool CMovementSimulation::Initialize(CBaseEntity* pEntity, MoveStorage& tMoveStorage, bool bHitchance, bool bStrafe)
@@ -253,6 +283,7 @@ bool CMovementSimulation::Initialize(CBaseEntity* pEntity, MoveStorage& tMoveSto
}
}
+ tMoveStorage.m_vPath = { tMoveStorage.m_MoveData.m_vecAbsOrigin };
for (int i = 0; i < H::Entities.GetChoke(pPlayer->entindex()); i++)
RunTick(tMoveStorage);
@@ -416,6 +447,7 @@ static inline bool GetYawDifference(MoveData& tRecord1, MoveData& tRecord2, bool
void CMovementSimulation::GetAverageYaw(MoveStorage& tMoveStorage, int iSamples)
{
auto pPlayer = tMoveStorage.m_pPlayer;
+ bool bLocal = pPlayer->entindex() == I::EngineClient->GetLocalPlayer();
auto& vRecords = m_mRecords[pPlayer->entindex()];
if (vRecords.empty())
return;
@@ -441,8 +473,8 @@ void CMovementSimulation::GetAverageYaw(MoveStorage& tMoveStorage, int iSamples)
bGround = tRecord1.m_iMode != MoveEnum::Air;
float flStraightFuzzyValue = bGround ? Vars::Aimbot::Projectile::GroundStraightFuzzyValue.Value : Vars::Aimbot::Projectile::AirStraightFuzzyValue.Value;
- int iMaxChanges = bGround ? Vars::Aimbot::Projectile::GroundMaxChanges.Value : Vars::Aimbot::Projectile::AirMaxChanges.Value;
- int iMaxChangeTime = bGround ? Vars::Aimbot::Projectile::GroundMaxChangeTime.Value : Vars::Aimbot::Projectile::AirMaxChangeTime.Value;
+ int iMaxChanges = bLocal ? 0 : bGround ? Vars::Aimbot::Projectile::GroundMaxChanges.Value : Vars::Aimbot::Projectile::AirMaxChanges.Value;
+ int iMaxChangeTime = bLocal ? 0 : bGround ? Vars::Aimbot::Projectile::GroundMaxChangeTime.Value : Vars::Aimbot::Projectile::AirMaxChangeTime.Value;
iMinimumStrafes = 4 + iMaxChanges;
#ifdef VISUALIZE_RECORDS
VisualizeRecords(tRecord1, tRecord2, { 255, 0, 0 }, flStraightFuzzyValue);
@@ -481,7 +513,7 @@ void CMovementSimulation::GetAverageYaw(MoveStorage& tMoveStorage, int iSamples)
return;
int iMinimum = flLowMinimumSamples;
- if (pPlayer->entindex() != I::EngineClient->GetLocalPlayer())
+ if (!bLocal)
{
float flDistance = 0.f;
if (auto pLocal = H::Entities.GetLocal())
@@ -494,7 +526,7 @@ void CMovementSimulation::GetAverageYaw(MoveStorage& tMoveStorage, int iSamples)
return;
tMoveStorage.m_flAverageYaw = flAverageYaw;
- SDK::Output("MovementSimulation", std::format("flAverageYaw calculated to {} from {} ({}) {}", flAverageYaw, iTicks, iMinimum, pPlayer->entindex() == I::EngineClient->GetLocalPlayer() ? "(local)" : "").c_str(), { 100, 255, 150 }, Vars::Debug::Logging.Value);
+ SDK::Output("MovementSimulation", std::format("flAverageYaw calculated to {} from {} ({}){}", flAverageYaw, iTicks, iMinimum, bLocal ? " (local)" : "").c_str(), { 100, 255, 150 }, Vars::Debug::Logging.Value);
}
bool CMovementSimulation::StrafePrediction(MoveStorage& tMoveStorage, int iSamples)
@@ -584,9 +616,6 @@ void CMovementSimulation::RunTick(MoveStorage& tMoveStorage, bool bPath, RunTick
if (tMoveStorage.m_bFailed || !tMoveStorage.m_pPlayer || !tMoveStorage.m_pPlayer->IsPlayer())
return;
- if (bPath)
- tMoveStorage.m_vPath.push_back(tMoveStorage.m_MoveData.m_vecAbsOrigin);
-
// make sure frametime and prediction vars are right
I::Prediction->m_bInPrediction = true;
I::Prediction->m_bFirstTimePredicted = false;
@@ -647,6 +676,9 @@ void CMovementSimulation::RunTick(MoveStorage& tMoveStorage, bool bPath, RunTick
}
RestoreBounds(tMoveStorage.m_pPlayer);
+
+ if (bPath)
+ tMoveStorage.m_vPath.push_back(tMoveStorage.m_MoveData.m_vecAbsOrigin);
}
void CMovementSimulation::RunTick(MoveStorage& tMoveStorage, bool bPath, RunTickCallback fCallback)
diff --git a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h
index 5735ddfc..7e62d175 100644
--- a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h
+++ b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h
@@ -60,6 +60,7 @@ private:
public:
void Store();
+ void StorePlayer(CTFPlayer* pPlayer, CMoveData& tMoveData, float flTime);
bool Initialize(CBaseEntity* pEntity, MoveStorage& tMoveStorage, bool bHitchance = true, bool bStrafe = true);
bool SetDuck(MoveStorage& tMoveStorage, bool bDuck);
diff --git a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp
index 62738f65..7d50d3c8 100644
--- a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp
+++ b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp
@@ -25,7 +25,8 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap
{
SDK::GetProjectileFireSetup(pPlayer, vAngles, { Vars::Visuals::Trajectory::OffsetX.Value, Vars::Visuals::Trajectory::OffsetY.Value, Vars::Visuals::Trajectory::OffsetZ.Value }, vPos, vAngle, bRedirect ? Vars::Visuals::Trajectory::ForwardRedirect.Value : 0.f, Vars::Visuals::Trajectory::ForwardCutoff.Value, bInterp);
- tProjInfo = { pPlayer, pWeapon, FNV1A::Hash32Const("custom"), vPos, vAngle, { Vars::Visuals::Trajectory::Hull.Value, Vars::Visuals::Trajectory::Hull.Value, Vars::Visuals::Trajectory::Hull.Value }, Vars::Visuals::Trajectory::Speed.Value, Vars::Visuals::Trajectory::Gravity.Value, Vars::Visuals::Trajectory::LifeTime.Value };
+ auto uType = FNV1A::Hash32(Vars::Visuals::Trajectory::Type.Value.c_str());
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { Vars::Visuals::Trajectory::Hull.Value, Vars::Visuals::Trajectory::Hull.Value, Vars::Visuals::Trajectory::Hull.Value }, Vars::Visuals::Trajectory::Speed.Value, Vars::Visuals::Trajectory::Gravity.Value, Vars::Visuals::Trajectory::LifeTime.Value };
return true;
}
@@ -79,8 +80,9 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap
{
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 23.5f, int(SDK::AttribHookValue(0, "centerfire_projectile", pWeapon)) == 1 ? 0.f : 12.f, bDucking ? 8.f : -3.f }, vPos, vAngle, bRedirect ? 2000.f : 0.f, 0.1f, bInterp);
+ auto uType = FNV1A::Hash32Const("models/weapons/w_models/w_rocket.mdl");
float flSpeed = pPlayer->InCond(TF_COND_RUNE_PRECISION) ? 3000.f : SDK::AttribHookValue(1100.f, "mult_projectile_speed", pWeapon);
- tProjInfo = { pPlayer, pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_rocket.mdl"), vPos, vAngle, { 0.f, 0.f, 0.f }, flSpeed, 0.f };
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { 0.f, 0.f, 0.f }, flSpeed, 0.f };
return true;
}
case TF_WEAPON_PARTICLE_CANNON:
@@ -93,8 +95,10 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap
if (pWeapon->GetWeaponID() == TF_WEAPON_DRG_POMSON)
vPos.z -= 13.f;
+ auto uType = FNV1A::Hash32Const("models/weapons/w_models/w_drg_ball.mdl");
+ Vec3 vHull = bCowMangler ? Vec3() : Vec3(1.f, 1.f, 1.f);
float flSpeed = bCowMangler ? 1100.f : 1200.f;
- tProjInfo = { pPlayer, pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_drg_ball.mdl"), vPos, vAngle, bCowMangler ? Vec3() : Vec3(1.f, 1.f, 1.f), flSpeed, 0.f };
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, vHull, flSpeed, 0.f };
return true;
}
case TF_WEAPON_GRENADELAUNCHER: // vphysics projectiles affected by server start gravity
@@ -105,37 +109,43 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 16.f, 8.f, -6.f }, vPos, vAngle, 0.f, 0.f, bInterp);
+ auto uType = bCannon ? FNV1A::Hash32Const("models/weapons/w_models/w_cannonball.mdl") : FNV1A::Hash32Const("models/weapons/w_models/w_grenade_grenadelauncher.mdl");
+ Vec3 vHull = pWeapon->GetWeaponID() == TF_WEAPON_CANNON ? Vec3(6.f, 6.f, 6.f) : !SDK::AttribHookValue(0, "grenade_no_spin", pWeapon) ? Vec3(5.f, 5.f, 5.f) : Vec3(3.f, 3.f, 3.f);
float flSpeed = SDK::AttribHookValue(pPlayer->InCond(TF_COND_RUNE_PRECISION) ? 3000.f : SDK::AttribHookValue(1200.f, "mult_projectile_speed", pWeapon), "mult_projectile_range", pWeapon);
- float flLifetime = flMortar
+ float flLifeTime = flMortar
? pWeapon->As()->m_flDetonateTime() > 0.f ? pWeapon->As()->m_flDetonateTime() - I::GlobalVars->curtime : flMortar
: SDK::AttribHookValue(2.f, "fuse_mult", pWeapon);
- auto uType = bCannon ? FNV1A::Hash32Const("models/weapons/w_models/w_cannonball.mdl") : FNV1A::Hash32Const("models/weapons/w_models/w_grenade_grenadelauncher.mdl");
- tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { 6.f, 6.f, 6.f }, flSpeed, 1.f, ceilf(flLifetime / GRENADE_CHECK_INTERVAL) * GRENADE_CHECK_INTERVAL + GetDesync() };
+ flLifeTime = ceilf(flLifeTime / GRENADE_CHECK_INTERVAL) * GRENADE_CHECK_INTERVAL + GetDesync();
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, vHull, flSpeed, 1.f, flLifeTime };
return true;
}
case TF_WEAPON_PIPEBOMBLAUNCHER:
{
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 16.f, 8.f, -6.f }, vPos, vAngle, 0.f, 0.f, bInterp);
+ auto uType = FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb.mdl");
float flCharge = flAutoCharge > 0.f && SDK::AttribHookValue(1, "mult_dmg", pWeapon)
? SDK::AttribHookValue(4.f, "stickybomb_charge_rate", pWeapon) * flAutoCharge
: (pWeapon->As()->m_flChargeBeginTime() > 0.f ? I::GlobalVars->curtime - pWeapon->As()->m_flChargeBeginTime() : 0.f);
float flSpeed = SDK::AttribHookValue(bMaxSpeed ? 2400.f : Math::RemapVal(flCharge, 0.f, SDK::AttribHookValue(4.f, "stickybomb_charge_rate", pWeapon), 900.f, 2400.f), "mult_projectile_range", pWeapon);
- tProjInfo = { pPlayer, pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_stickybomb.mdl"), vPos, vAngle, { 6.f, 6.f, 6.f }, flSpeed, 1.f };
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { 4.f, 4.f, 4.f }, flSpeed, 1.f };
return true;
}
case TF_WEAPON_FLAREGUN:
{
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 23.5f, 12.f, bDucking ? 8.f : -3.f }, vPos, vAngle, bRedirect ? 2000.f : 0.f, 0.1f, bInterp);
- tProjInfo = { pPlayer, pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_flaregun_shell.mdl"), vPos, vAngle, { 0.f, 0.f, 0.f }, SDK::AttribHookValue(2000.f, "mult_projectile_speed", pWeapon), 0.3f * flGravity };
+ auto uType = FNV1A::Hash32Const("models/weapons/w_models/w_flaregun_shell.mdl");
+ float flSpeed = SDK::AttribHookValue(2000.f, "mult_projectile_speed", pWeapon);
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { 0.f, 0.f, 0.f }, flSpeed, 0.3f * flGravity };
return true;
}
case TF_WEAPON_FLAREGUN_REVENGE:
{
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 23.5f, 12.f, bDucking ? 8.f : -3.f }, vPos, vAngle, bRedirect ? 2000.f : 0.f, 0.1f, bInterp);
- tProjInfo = { pPlayer, pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_flaregun_shell.mdl"), vPos, vAngle, { 0.f, 0.f, 0.f }, 3000.f, 0.45f * flGravity };
+ auto uType = FNV1A::Hash32Const("models/weapons/w_models/w_flaregun_shell.mdl");
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { 0.f, 0.f, 0.f }, 3000.f, 0.45f * flGravity };
return true;
}
case TF_WEAPON_COMPOUND_BOW:
@@ -154,10 +164,11 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap
else
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 23.5f, 8.f, -3.f }, vPos, vAngle, bRedirect ? 2000.f : 0.f, 0.1f, bInterp);
+ auto uType = FNV1A::Hash32Const("models/weapons/w_models/w_arrow.mdl");
float flCharge = pWeapon->As()->m_flChargeBeginTime() > 0.f ? I::GlobalVars->curtime - pWeapon->As()->m_flChargeBeginTime() : 0.f;
float flSpeed = bMaxSpeed ? 2600.f : Math::RemapVal(flCharge, 0.f, 1.f, 1800.f, 2600.f);
flGravity = Math::RemapVal(flCharge, 0.f, 1.f, 0.5f, 0.1f) * flGravity;
- tProjInfo = { pPlayer, pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_arrow.mdl"), vPos, vAngle, { 1.f, 1.f, 1.f }, flSpeed, flGravity, 10.f /*arrows have some lifetime check for whatever reason*/ };
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { 1.f, 1.f, 1.f }, flSpeed, flGravity, 10.f };
return true;
}
case TF_WEAPON_CROSSBOW:
@@ -168,14 +179,16 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 23.5f, 8.f, -3.f }, vPos, vAngle, bRedirect ? 2000.f : 0.f, 0.1f, bInterp);
auto uType = bCrossbow ? FNV1A::Hash32Const("models/weapons/w_models/w_syringe_proj.mdl") : FNV1A::Hash32Const("models/weapons/w_models/w_repair_claw.mdl");
- tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, pWeapon->GetWeaponID() == TF_WEAPON_CROSSBOW ? Vec3(3.f, 3.f, 3.f) : Vec3(1.f, 1.f, 1.f), 2400.f, 0.2f * flGravity, 10.f /*arrows have some lifetime check for whatever reason*/ };
+ Vec3 vHull = pWeapon->GetWeaponID() == TF_WEAPON_CROSSBOW ? Vec3(3.f, 3.f, 3.f) : Vec3(1.f, 1.f, 1.f);
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, vHull, 2400.f, 0.2f * flGravity, 10.f };
return true;
}
case TF_WEAPON_SYRINGEGUN_MEDIC:
{
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 16.f, 6.f, -8.f }, vPos, vAngle, bRedirect ? 2000.f : 0.f, 0.1f, bInterp);
- tProjInfo = { pPlayer, pWeapon, FNV1A::Hash32Const("models/weapons/w_models/w_syringe_proj.mdl"), vPos, vAngle, { 1.f, 1.f, 1.f }, 1000.f, 0.3f * flGravity };
+ auto uType = FNV1A::Hash32Const("models/weapons/w_models/w_syringe_proj.mdl");
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { 1.f, 1.f, 1.f }, 1000.f, 0.3f * flGravity };
return true;
}
case TF_WEAPON_FLAMETHROWER:
@@ -185,7 +198,8 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 40.f, 5.f, 0.f }, vPos, vAngle, 0.f, 0.f, bInterp, false);
- tProjInfo = { pPlayer, pWeapon, FNV1A::Hash32Const("particles/flamethrower.pcf"), vPos, vAngle, { flHull, flHull, flHull }, 1000.f, 0.f, 0.285f };
+ auto uType = FNV1A::Hash32Const("particles/flamethrower.pcf");
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { flHull, flHull, flHull }, 1000.f, 0.f, 0.285f };
return true;
}
case TF_WEAPON_FLAME_BALL:
@@ -196,16 +210,18 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 3.f, 7.f, -9.f }, vPos, vAngle, bRedirect ? tf_fireball_distance->GetFloat() : 0.f, 1.f, bInterp);
+ auto uType = FNV1A::Hash32Const("models/weapons/c_models/c_flameball/c_flameball.mdl");
float flSpeed = tf_fireball_speed->GetFloat();
float flLifeTime = std::min(tf_fireball_distance->GetFloat() / flSpeed, tf_fireball_max_lifetime->GetFloat());
- tProjInfo = { pPlayer, pWeapon, FNV1A::Hash32Const("models/weapons/c_models/c_flameball/c_flameball.mdl"), vPos, vAngle, { 1.f, 1.f, 1.f /*damaging hull much bigger, shouldn't matter here*/ }, flSpeed, 0.f, flLifeTime };
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { 1.f, 1.f, 1.f } /*damaging hull much bigger, shouldn't matter here*/, flSpeed, 0.f, flLifeTime };
return true;
}
case TF_WEAPON_CLEAVER:
{
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 16.f, 8.f, -6.f }, vPos, vAngle, 0.f, 0.f, bInterp);
- tProjInfo = { pPlayer, pWeapon, FNV1A::Hash32Const("models/workshop_partner/weapons/c_models/c_sd_cleaver/c_sd_cleaver.mdl"), vPos, vAngle, { 1.f, 1.f, 10.f /*weird, probably still inaccurate*/ }, 3000.f, 1.f, 2.2f };
+ auto uType = FNV1A::Hash32Const("models/workshop_partner/weapons/c_models/c_sd_cleaver/c_sd_cleaver.mdl");
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { 1.f, 1.f, 10.f } /*weird, probably still inaccurate*/, 3000.f, 1.f, 2.2f };
return true;
}
case TF_WEAPON_BAT_WOOD:
@@ -216,10 +232,10 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 0.f, 0.f, 0.f }, vPos, vAngle, 0.f, 0.f, bInterp);
+ auto uType = bWrapAssassin ? FNV1A::Hash32Const("models/weapons/c_models/c_xms_festive_ornament.mdl") : FNV1A::Hash32Const("models/weapons/w_models/w_baseball.mdl");
Vec3 vForward; Math::AngleVectors(vAngle, &vForward);
vPos = (bInterp ? pPlayer->GetAbsOrigin() : pPlayer->m_vecOrigin()) + (Vec3(0, 0, 50) + vForward * 32.f) * pPlayer->m_flModelScale(); // why?
- auto uHash = bWrapAssassin ? FNV1A::Hash32Const("models/weapons/c_models/c_xms_festive_ornament.mdl") : FNV1A::Hash32Const("models/weapons/w_models/w_baseball.mdl");
- tProjInfo = { pPlayer, pWeapon, uHash, vPos, vAngle, { 3.f, 3.f, 3.f }, tf_scout_stunball_base_speed->GetFloat(), 1.f, bWrapAssassin ? 2.3f : 100.f };
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { 3.f, 3.f, 3.f }, tf_scout_stunball_base_speed->GetFloat(), 1.f, bWrapAssassin ? 2.3f : 100.f };
return true;
}
case TF_WEAPON_JAR:
@@ -227,7 +243,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap
{
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 16.f, 8.f, -6.f }, vPos, vAngle, 0.f, 0.f, bInterp);
- uint32_t uType = uType = FNV1A::Hash32Const("models/weapons/c_models/urinejar.mdl");
+ auto uType = FNV1A::Hash32Const("models/weapons/c_models/urinejar.mdl");
switch (pWeapon->m_iItemDefinitionIndex())
{
case Scout_s_MadMilk: uType = FNV1A::Hash32Const("models/workshop/weapons/c_models/c_madmilk/c_madmilk.mdl"); break;
@@ -241,7 +257,8 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap
{
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 16.f, 8.f, -6.f }, vPos, vAngle, 0.f, 0.f, bInterp);
- tProjInfo = { pPlayer, pWeapon, FNV1A::Hash32Const("models/weapons/c_models/c_gascan/c_gascan.mdl"), vPos, vAngle, { 3.f, 3.f, 3.f }, 2000.f, 1.f, 2.2f };
+ auto uType = FNV1A::Hash32Const("models/weapons/c_models/c_gascan/c_gascan.mdl");
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { 3.f, 3.f, 3.f }, 2000.f, 1.f, 2.2f };
return true;
}
case TF_WEAPON_GRAPPLINGHOOK:
@@ -251,6 +268,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 23.5f, -8.f, -3.f }, vPos, vAngle, bRedirect ? 2000.f : 0.f, 0.1f, bInterp);
+ auto uType = FNV1A::Hash32Const("models/weapons/c_models/c_grapple_proj/c_grapple_proj.mdl");
float flSpeed = tf_grapplinghook_projectile_speed->GetFloat();
if (pPlayer->InCond(TF_COND_RUNE_AGILITY))
{
@@ -261,8 +279,8 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap
default: flSpeed = 3000.f;
}
}
- float flLifetime = tf_grapplinghook_max_distance->GetFloat() / flSpeed;
- tProjInfo = { pPlayer, pWeapon, FNV1A::Hash32Const("models/weapons/c_models/c_grapple_proj/c_grapple_proj.mdl"), vPos, vAngle, { 1.2f, 1.2f, 1.2f }, flSpeed, 0.f, flLifetime };
+ float flLifeTime = tf_grapplinghook_max_distance->GetFloat() / flSpeed;
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { 1.2f, 1.2f, 1.2f }, flSpeed, 0.f, flLifeTime };
return true;
}
case TF_WEAPON_LUNCHBOX:
@@ -278,7 +296,8 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap
{
SDK::GetProjectileFireSetup(pPlayer, vAngles, { 0.f, 0.f, -8.f }, vPos, vAngle, 0.f, 0.f, bInterp);
- tProjInfo = { pPlayer, pWeapon, FNV1A::Hash32Const("models/weapons/c_models/c_sandwich/c_sandwich.mdl"), vPos, vAngle, { 17.f, 17.f, 7.f }, 500.f, 1.f * flGravity };
+ auto uType = FNV1A::Hash32Const("models/weapons/c_models/c_sandwich/c_sandwich.mdl");
+ tProjInfo = { pPlayer, pWeapon, uType, vPos, vAngle, { 17.f, 17.f, 7.f }, 500.f, 1.f * flGravity };
return true;
}
}
diff --git a/Amalgam/src/Features/Ticks/Ticks.cpp b/Amalgam/src/Features/Ticks/Ticks.cpp
index 090d3e2a..77e4f283 100644
--- a/Amalgam/src/Features/Ticks/Ticks.cpp
+++ b/Amalgam/src/Features/Ticks/Ticks.cpp
@@ -413,31 +413,28 @@ void CTicks::Draw(CTFPlayer* pLocal)
const DragBox_t dtPos = Vars::Menu::TicksDisplay.Value;
const auto& fFont = H::Fonts.GetFont(FONT_INDICATORS);
- if (!m_bSpeedhack)
+ if (m_bSpeedhack)
+ return 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());
+
+ int iAntiAimTicks = F::AntiAim.YawOn() ? F::AntiAim.AntiAimTicks() : 0;
+ int iTicks = std::clamp(m_iShiftedTicks + std::max(I::ClientState->chokedcommands - iAntiAimTicks, 0), 0, m_iMaxUsrCmdProcessTicks);
+ int iMax = std::max(m_iMaxUsrCmdProcessTicks - iAntiAimTicks, 0);
+
+ float flRatio = float(iTicks) / float(iMax);
+ 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, iMax).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(4, Scale_Round), Vars::Menu::Theme::Accent.Value, 16);
+ if (flRatio)
{
- int iAntiAimTicks = F::AntiAim.YawOn() ? F::AntiAim.AntiAimTicks() : 0;
-
- int iTicks = std::clamp(m_iShiftedTicks + std::max(I::ClientState->chokedcommands - iAntiAimTicks, 0), 0, m_iMaxUsrCmdProcessTicks);
- int iMax = std::max(m_iMaxUsrCmdProcessTicks - iAntiAimTicks, 0);
-
- float flRatio = float(iTicks) / float(iMax);
- 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, iMax).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(4, 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();
- }
+ 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/Visuals/Chams/Chams.cpp b/Amalgam/src/Features/Visuals/Chams/Chams.cpp
index 49a3a953..54377f13 100644
--- a/Amalgam/src/Features/Visuals/Chams/Chams.cpp
+++ b/Amalgam/src/Features/Visuals/Chams/Chams.cpp
@@ -180,22 +180,21 @@ void CChams::RenderBacktrack(const DrawModelState_t& pState, const ModelRenderIn
pRenderContext->DepthRange(0.f, m_iFlags & BacktrackEnum::IgnoreZ ? 0.2f : 1.f);
+ float flOriginalBlend = I::RenderView->GetBlend();
auto fDrawModel = [&](Vec3& vOrigin, const DrawModelState_t& pState, const ModelRenderInfo_t& pInfo, matrix3x4* pBoneToWorld, float flBlend)
{
if (!SDK::IsOnScreen(pEntity, vOrigin))
return;
- float flOriginalBlend = I::RenderView->GetBlend();
I::RenderView->SetBlend(flBlend * flOriginalBlend);
static auto IVModelRender_DrawModelExecute = U::Hooks.m_mHooks["IVModelRender_DrawModelExecute"];
IVModelRender_DrawModelExecute->Call(I::ModelRender, pState, pInfo, pBoneToWorld);
- I::RenderView->SetBlend(flOriginalBlend);
};
if (!bDrawLast && !bDrawFirst)
{
for (auto pRecord : vRecords)
{
- if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(pRecord->m_vOrigin), 1.f, 24.f, 0.f, 1.f))
+ if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistToSqr(pRecord->m_vOrigin), 1.f, 576.f, 0.f, 1.f))
fDrawModel(pRecord->m_vOrigin, pState, pInfo, pRecord->m_aBones, flBlend);
}
}
@@ -204,16 +203,17 @@ void CChams::RenderBacktrack(const DrawModelState_t& pState, const ModelRenderIn
if (bDrawLast)
{
auto pRecord = vRecords.back();
- if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(pRecord->m_vOrigin), 1.f, 24.f, 0.f, 1.f))
+ if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistToSqr(pRecord->m_vOrigin), 1.f, 576.f, 0.f, 1.f))
fDrawModel(pRecord->m_vOrigin, pState, pInfo, pRecord->m_aBones, flBlend);
}
if (bDrawFirst)
{
auto pRecord = vRecords.front();
- if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(pRecord->m_vOrigin), 1.f, 24.f, 0.f, 1.f))
+ if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistToSqr(pRecord->m_vOrigin), 1.f, 576.f, 0.f, 1.f))
fDrawModel(pRecord->m_vOrigin, pState, pInfo, pRecord->m_aBones, flBlend);
}
}
+ I::RenderView->SetBlend(flOriginalBlend);
pRenderContext->DepthRange(0.f, 1.f);
}
diff --git a/Amalgam/src/Features/Visuals/ESP/ESP.cpp b/Amalgam/src/Features/Visuals/ESP/ESP.cpp
index 7f87ddfe..5ce776f8 100644
--- a/Amalgam/src/Features/Visuals/ESP/ESP.cpp
+++ b/Amalgam/src/Features/Visuals/ESP/ESP.cpp
@@ -13,10 +13,9 @@ static inline void StorePlayer(CTFPlayer* pPlayer, CTFPlayer* pLocal, Group_t* p
{
int iIndex = pPlayer->entindex();
- if (int iObserverMode = pLocal->m_iObserverMode();
- iObserverMode == OBS_MODE_FIRSTPERSON || iObserverMode == OBS_MODE_THIRDPERSON
- ? !I::Input->CAM_IsThirdPerson() && iIndex == I::EngineClient->GetLocalPlayer()
- : iObserverMode == OBS_MODE_FIRSTPERSON && pLocal->m_hObserverTarget().GetEntryIndex() == iIndex)
+ if (int iObserverMode = pLocal->m_iObserverMode(); iObserverMode == OBS_MODE_FIRSTPERSON || iObserverMode == OBS_MODE_THIRDPERSON
+ ? iObserverMode == OBS_MODE_FIRSTPERSON && pLocal->m_hObserverTarget().GetEntryIndex() == iIndex
+ : !I::Input->CAM_IsThirdPerson() && iIndex == I::EngineClient->GetLocalPlayer())
return;
auto pWeapon = pPlayer->m_hActiveWeapon()->As();
@@ -108,7 +107,7 @@ static inline void StorePlayer(CTFPlayer* pPlayer, CTFPlayer* pLocal, Group_t* p
tCache.m_flHealth = flHealth > flMaxHealth
? 1.f + std::clamp((flHealth - flMaxHealth) / (floorf(flMaxHealth / 10.f) * 5), 0.f, 1.f)
: std::clamp(flHealth / flMaxHealth, 0.f, 1.f);
- Color_t tColor = Vars::Colors::IndicatorBad.Value.Lerp(Vars::Colors::IndicatorGood.Value, std::clamp(tCache.m_flHealth, 0.f, 1.f));
+ Color_t tColor = Vars::Colors::IndicatorBad.Value.Lerp(Vars::Colors::IndicatorGood.Value, std::clamp(tCache.m_flHealth, 0.f, 1.f), LerpEnum::HSV);
tCache.m_vBars.emplace_back(ALIGN_LEFT, tCache.m_flHealth, tColor, Vars::Colors::IndicatorMisc.Value);
}
if (pGroup->m_iESP & ESPEnum::HealthText)
@@ -418,7 +417,7 @@ static inline void StoreBuilding(CBaseObject* pBuilding, CTFPlayer* pLocal, Grou
if (pGroup->m_iESP & ESPEnum::HealthBar)
{
tCache.m_flHealth = std::clamp(flHealth / flMaxHealth, 0.f, 1.f);
- Color_t tColor = Vars::Colors::IndicatorBad.Value.Lerp(Vars::Colors::IndicatorGood.Value, std::clamp(tCache.m_flHealth, 0.f, 1.f));
+ Color_t tColor = Vars::Colors::IndicatorBad.Value.Lerp(Vars::Colors::IndicatorGood.Value, std::clamp(tCache.m_flHealth, 0.f, 1.f), LerpEnum::HSV);
tCache.m_vBars.emplace_back(ALIGN_LEFT, tCache.m_flHealth, tColor, Vars::Colors::IndicatorMisc.Value);
}
if (pGroup->m_iESP & ESPEnum::HealthText)
@@ -743,6 +742,8 @@ void CESP::Store(CTFPlayer* pLocal)
}
}
+static matrix3x4 s_aBones[MAXSTUDIOBONES];
+
void CESP::Draw()
{
DrawWorld();
@@ -774,8 +775,7 @@ void CESP::DrawPlayers()
if (tCache.m_bBones)
{
auto pPlayer = pEntity->As();
- matrix3x4 aBones[MAXSTUDIOBONES];
- if (pPlayer->SetupBones(aBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, I::GlobalVars->curtime))
+ if (pPlayer->SetupBones(s_aBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, I::GlobalVars->curtime))
{
int iHead = pPlayer->GetBaseToHitbox(HITBOX_HEAD);
int iSpine2 = pPlayer->GetBaseToHitbox(HITBOX_SPINE2);
@@ -793,11 +793,11 @@ void CESP::DrawPlayers()
int iRightCalf = pPlayer->GetBaseToHitbox(HITBOX_RIGHT_CALF);
int iRightFoot = pPlayer->GetBaseToHitbox(HITBOX_RIGHT_FOOT);
- DrawBones(pPlayer, aBones, { iHead, iSpine2, iPelvis }, tCache.m_tColor);
- DrawBones(pPlayer, aBones, { iSpine2, iLeftUpperarm, iLeftForearm, iLeftHand }, tCache.m_tColor);
- DrawBones(pPlayer, aBones, { iSpine2, iRightUpperarm, iRightForearm, iRightHand }, tCache.m_tColor);
- DrawBones(pPlayer, aBones, { iPelvis, iLeftThigh, iLeftCalf, iLeftFoot }, tCache.m_tColor);
- DrawBones(pPlayer, aBones, { iPelvis, iRightThigh, iRightCalf, iRightFoot }, tCache.m_tColor);
+ DrawBones(pPlayer, s_aBones, { iHead, iSpine2, iPelvis }, tCache.m_tColor);
+ DrawBones(pPlayer, s_aBones, { iSpine2, iLeftUpperarm, iLeftForearm, iLeftHand }, tCache.m_tColor);
+ DrawBones(pPlayer, s_aBones, { iSpine2, iRightUpperarm, iRightForearm, iRightHand }, tCache.m_tColor);
+ DrawBones(pPlayer, s_aBones, { iPelvis, iLeftThigh, iLeftCalf, iLeftFoot }, tCache.m_tColor);
+ DrawBones(pPlayer, s_aBones, { iPelvis, iRightThigh, iRightCalf, iRightFoot }, tCache.m_tColor);
}
}
diff --git a/Amalgam/src/Features/Visuals/Glow/Glow.cpp b/Amalgam/src/Features/Visuals/Glow/Glow.cpp
index 2fda5d7f..6cdeaf2f 100644
--- a/Amalgam/src/Features/Visuals/Glow/Glow.cpp
+++ b/Amalgam/src/Features/Visuals/Glow/Glow.cpp
@@ -223,22 +223,21 @@ void CGlow::RenderBacktrack(const DrawModelState_t& pState, const ModelRenderInf
bool bDrawLast = m_iFlags & BacktrackEnum::Last;
bool bDrawFirst = m_iFlags & BacktrackEnum::First;
+ //float flOriginalBlend = I::RenderView->GetBlend();
auto fDrawModel = [&](Vec3& vOrigin, const DrawModelState_t& pState, const ModelRenderInfo_t& pInfo, matrix3x4* pBoneToWorld, float flBlend)
{
if (!SDK::IsOnScreen(pEntity, vOrigin))
return;
- //float flOriginalBlend = I::RenderView->GetBlend();
//I::RenderView->SetBlend(flBlend * flOriginalBlend);
static auto IVModelRender_DrawModelExecute = U::Hooks.m_mHooks["IVModelRender_DrawModelExecute"];
IVModelRender_DrawModelExecute->Call(I::ModelRender, pState, pInfo, pBoneToWorld);
- //I::RenderView->SetBlend(flOriginalBlend);
};
if (!bDrawLast && !bDrawFirst)
{
for (auto pRecord : vRecords)
{
- if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(pRecord->m_vOrigin), 1.f, 24.f, 0.f, 1.f))
+ if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistToSqr(pRecord->m_vOrigin), 1.f, 576.f, 0.f, 1.f))
fDrawModel(pRecord->m_vOrigin, pState, pInfo, pRecord->m_aBones, flBlend);
}
}
@@ -247,16 +246,17 @@ void CGlow::RenderBacktrack(const DrawModelState_t& pState, const ModelRenderInf
if (bDrawLast)
{
auto pRecord = vRecords.back();
- if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(pRecord->m_vOrigin), 1.f, 24.f, 0.f, 1.f))
+ if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistToSqr(pRecord->m_vOrigin), 1.f, 576.f, 0.f, 1.f))
fDrawModel(pRecord->m_vOrigin, pState, pInfo, pRecord->m_aBones, flBlend);
}
if (bDrawFirst)
{
auto pRecord = vRecords.front();
- if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistTo(pRecord->m_vOrigin), 1.f, 24.f, 0.f, 1.f))
+ if (float flBlend = Math::RemapVal(pEntity->GetAbsOrigin().DistToSqr(pRecord->m_vOrigin), 1.f, 576.f, 0.f, 1.f))
fDrawModel(pRecord->m_vOrigin, pState, pInfo, pRecord->m_aBones, flBlend);
}
}
+ //I::RenderView->SetBlend(flOriginalBlend);
}
void CGlow::RenderFakeAngle(const DrawModelState_t& pState, const ModelRenderInfo_t& pInfo)
{
diff --git a/Amalgam/src/Features/Visuals/OffscreenArrows/OffscreenArrows.cpp b/Amalgam/src/Features/Visuals/OffscreenArrows/OffscreenArrows.cpp
index 1d589b88..5d0247d3 100644
--- a/Amalgam/src/Features/Visuals/OffscreenArrows/OffscreenArrows.cpp
+++ b/Amalgam/src/Features/Visuals/OffscreenArrows/OffscreenArrows.cpp
@@ -4,8 +4,7 @@
void COffscreenArrows::DrawArrowTo(const Vec3& vFromPos, const Vec3& vToPos, Color_t tColor, int iOffset, float flMaxDistance)
{
- float flMap = Math::RemapVal(vFromPos.DistTo(vToPos), flMaxDistance, flMaxDistance * 0.9f, 0.f, 1.f);
- tColor.a *= flMap;
+ tColor.a *= Math::RemapVal(vFromPos.DistTo(vToPos), flMaxDistance, flMaxDistance * 0.9f, 0.f, 1.f);
if (!tColor.a)
return;
diff --git a/Amalgam/src/Features/Visuals/Visuals.cpp b/Amalgam/src/Features/Visuals/Visuals.cpp
index dfe54213..423d3265 100644
--- a/Amalgam/src/Features/Visuals/Visuals.cpp
+++ b/Amalgam/src/Features/Visuals/Visuals.cpp
@@ -47,7 +47,10 @@ void CVisuals::ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const
{
if (bInterp)
F::CameraWindow.m_bShouldDraw = false;
- if (bInterp ? !Vars::Visuals::Simulation::TrajectoryPath.Value && !Vars::Visuals::Simulation::ProjectileCamera.Value : !Vars::Visuals::Simulation::ShotPath.Value)
+
+ if (bInterp
+ ? !Vars::Visuals::Simulation::TrajectoryPath.Value && !Vars::Visuals::Simulation::ProjectileCamera.Value && !(Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::Enabled)
+ : !Vars::Visuals::Simulation::ShotPath.Value)
return;
Vec3 vAngles = bInterp ? I::EngineClient->GetViewAngles() : G::CurrentUserCmd->viewangles;
@@ -108,7 +111,7 @@ void CVisuals::ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const
float flRadius = 0.f;
Vec3 vEndPos = trace.endpos;
- if ((bInterp ? Vars::Visuals::Simulation::TrajectoryPath.Value : Vars::Visuals::Simulation::ShotPath.Value) && Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::Enabled)
+ if (Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::Enabled)
{
switch (pWeapon->GetWeaponID())
{
@@ -150,7 +153,8 @@ void CVisuals::ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const
if (bInterp)
{
- if (Vars::Visuals::Simulation::ProjectileCamera.Value && !I::EngineVGui->IsGameUIVisible() && pPlayer->m_vecOrigin().DistTo(trace.endpos) > 500.f)
+ float flDistanceSqr = powf(500.f, 2);
+ if (Vars::Visuals::Simulation::ProjectileCamera.Value && !I::EngineVGui->IsGameUIVisible() && pPlayer->m_vecOrigin().DistToSqr(trace.endpos) > flDistanceSqr)
{
CGameTrace cameraTrace = {};
@@ -177,20 +181,20 @@ void CVisuals::ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const
H::Draw.RenderWireframeBox(trace.endpos, -vSize, vSize, vAngles, Vars::Colors::TrajectoryPathIgnoreZ.Value);
H::Draw.RenderWireframeBox(trace.endpos, -vSize, vSize, vAngles, Vars::Colors::TrajectoryPath.Value, true);
}
+ }
- if (flRadius)
+ if (flRadius)
+ {
+ if (!(Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::Sphere))
{
- if (!(Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::Sphere))
- {
- auto vPoints = SplashTrace(vEndPos, flRadius, pNormal ? *pNormal : Vec3(0, 0, 1), Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::Trace);
- H::Draw.RenderPath(vPoints, Vars::Colors::SplashRadiusIgnoreZ.Value, false, Vars::Visuals::Simulation::StyleEnum::Line);
- H::Draw.RenderPath(vPoints, Vars::Colors::SplashRadius.Value, true, Vars::Visuals::Simulation::StyleEnum::Line);
- }
- else
- {
- H::Draw.RenderSphere(vEndPos, flRadius, 36, 36, Vars::Colors::SplashRadiusIgnoreZ.Value);
- H::Draw.RenderSphere(vEndPos, flRadius, 36, 36, Vars::Colors::SplashRadius.Value, true);
- }
+ auto vPoints = SplashTrace(vEndPos, flRadius, pNormal ? *pNormal : Vec3(0, 0, 1), Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::Trace);
+ H::Draw.RenderPath(vPoints, Vars::Colors::SplashRadiusIgnoreZ.Value, false, Vars::Visuals::Path::StyleEnum::Line);
+ H::Draw.RenderPath(vPoints, Vars::Colors::SplashRadius.Value, true, Vars::Visuals::Path::StyleEnum::Line);
+ }
+ else
+ {
+ H::Draw.RenderSphere(vEndPos, flRadius, 36, 36, Vars::Colors::SplashRadiusIgnoreZ.Value);
+ H::Draw.RenderSphere(vEndPos, flRadius, 36, 36, Vars::Colors::SplashRadius.Value, true);
}
}
}
@@ -222,9 +226,9 @@ void CVisuals::ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const
{
std::vector vPoints = SplashTrace(vEndPos, flRadius, pNormal ? *pNormal : Vec3(0, 0, 1), Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::Trace);
if (Vars::Colors::SplashRadiusIgnoreZ.Value.a)
- G::PathStorage.emplace_back(vPoints, I::GlobalVars->curtime + TICKS_TO_TIME(tProjInfo.m_vPath.size()) + F::Backtrack.GetReal(), Vars::Colors::SplashRadiusIgnoreZ.Value, Vars::Visuals::Simulation::StyleEnum::Line);
+ G::PathStorage.emplace_back(vPoints, I::GlobalVars->curtime + TICKS_TO_TIME(tProjInfo.m_vPath.size()) + F::Backtrack.GetReal(), Vars::Colors::SplashRadiusIgnoreZ.Value, Vars::Visuals::Path::StyleEnum::Line);
if (Vars::Colors::SplashRadius.Value.a)
- G::PathStorage.emplace_back(vPoints, I::GlobalVars->curtime + TICKS_TO_TIME(tProjInfo.m_vPath.size()) + F::Backtrack.GetReal(), Vars::Colors::SplashRadius.Value, Vars::Visuals::Simulation::StyleEnum::Line, true);
+ G::PathStorage.emplace_back(vPoints, I::GlobalVars->curtime + TICKS_TO_TIME(tProjInfo.m_vPath.size()) + F::Backtrack.GetReal(), Vars::Colors::SplashRadius.Value, Vars::Visuals::Path::StyleEnum::Line, true);
}
else
{
@@ -542,7 +546,7 @@ void CVisuals::DrawEffects()
bool bPredict = tProjectile.m_iFlags & TrajectoryEnum::Predict && tProjectile.m_vPath.size() && tProjectile.m_flTime;
if (bPredict && tProjectile.m_iFlags & TrajectoryEnum::Path)
- H::Draw.RenderPath(tProjectile.m_vPath, tProjectile.m_tColor, bZBuffer, Vars::Visuals::Simulation::StyleEnum::Line, tProjectile.m_flTime);
+ H::Draw.RenderPath(tProjectile.m_vPath, tProjectile.m_tColor, bZBuffer, Vars::Visuals::Path::StyleEnum::Line, tProjectile.m_flTime);
if (tProjectile.m_iFlags & TrajectoryEnum::Radius)
{
@@ -552,7 +556,7 @@ void CVisuals::DrawEffects()
if (!(tProjectile.m_iFlags & TrajectoryEnum::Sphere))
{
auto vPoints = SplashTrace(vOrigin, tProjectile.m_flRadius, vNormal, tProjectile.m_iFlags & TrajectoryEnum::Trace);
- H::Draw.RenderPath(vPoints, tProjectile.m_tColor, bZBuffer, Vars::Visuals::Simulation::StyleEnum::Line);
+ H::Draw.RenderPath(vPoints, tProjectile.m_tColor, bZBuffer, Vars::Visuals::Path::StyleEnum::Line);
}
else
H::Draw.RenderSphere(vOrigin, tProjectile.m_flRadius, 36, 36, tProjectile.m_tColor, bZBuffer);
@@ -700,8 +704,8 @@ void CVisuals::FOV(CTFPlayer* pLocal, CViewSetup* pView)
G::FOV = pView->fov;
if (pLocal->IsAlive())
{
- pLocal->m_iFOV() = pView->fov;
- pLocal->m_iDefaultFOV() = std::max(flRegularOverride, flRegularFOV);
+ pLocal->m_iFOV() = ceilf(pView->fov);
+ pLocal->m_iDefaultFOV() = ceilf(std::max(flRegularOverride, flRegularFOV));
default_fov->SetValue(pLocal->m_iDefaultFOV());
}
}
diff --git a/Amalgam/src/Hooks/CM_TraceToDispTree.cpp b/Amalgam/src/Hooks/CM_TraceToDispTree.cpp
index a830990c..1fb05885 100644
--- a/Amalgam/src/Hooks/CM_TraceToDispTree.cpp
+++ b/Amalgam/src/Hooks/CM_TraceToDispTree.cpp
@@ -58,7 +58,7 @@ MAKE_HOOK(CDispCollTree_SweepAABBTriIntersect, S::CDispCollTree_SweepAABBTriInte
CALL_ORIGINAL(rcx, ray, rayDir, iTri, pTri, pTrace);
if (s_vOriginal)
- pTri->m_vecNormal = s_vOriginal.value(), s_vOriginal = std::nullopt;
+ pTri->m_vecNormal = *s_vOriginal, s_vOriginal = std::nullopt;
}
MAKE_HOOK(CDispCollTree_EdgeCrossAxis_0, S::CDispCollTree_EdgeCrossAxis_0(), void,
@@ -67,7 +67,7 @@ MAKE_HOOK(CDispCollTree_EdgeCrossAxis_0, S::CDispCollTree_EdgeCrossAxis_0(), voi
DEBUG_RETURN(CDispCollTree_EdgeCrossAxis_0, rcx, ray, iPlane, pHelper);
if (s_vOriginal)
- s_pTri->m_vecNormal = s_vOriginal.value(), s_vOriginal = std::nullopt;
+ s_pTri->m_vecNormal = *s_vOriginal, s_vOriginal = std::nullopt;
CALL_ORIGINAL(rcx, ray, iPlane, pHelper);
}
\ No newline at end of file
diff --git a/Amalgam/src/Hooks/CTFPlayer_GetMinFOV.cpp b/Amalgam/src/Hooks/CTFPlayer_GetMinFOV.cpp
index d931700d..44108101 100644
--- a/Amalgam/src/Hooks/CTFPlayer_GetMinFOV.cpp
+++ b/Amalgam/src/Hooks/CTFPlayer_GetMinFOV.cpp
@@ -1,7 +1,6 @@
#include "../SDK/SDK.h"
MAKE_SIGNATURE(CTFPlayer_GetMinFOV, "client.dll", "F3 0F 10 05 ? ? ? ? C3 CC CC CC CC CC CC CC 48 8B 81 ? ? ? ? 8B D2", 0x0);
-MAKE_SIGNATURE(CBasePlayer_GetFOV, "client.dll", "40 53 48 83 EC ? 48 8B D9 0F 29 74 24 ? 48 8B 0D ? ? ? ? 48 8B 01", 0x0);
MAKE_HOOK(CTFPlayer_GetMinFOV, S::CTFPlayer_GetMinFOV(), float,
/*void* rcx*/)
@@ -9,20 +8,4 @@ MAKE_HOOK(CTFPlayer_GetMinFOV, S::CTFPlayer_GetMinFOV(), float,
DEBUG_RETURN(CTFPlayer_GetMinFOV, /*rcx*/);
return 0.f;
-}
-
-MAKE_HOOK(CBasePlayer_GetFOV, S::CBasePlayer_GetFOV(), float,
- void* rcx)
-{
- DEBUG_RETURN(CTFPlayer_GetMinFOV, rcx);
-
- auto pPlayer = reinterpret_cast(rcx);
- if (pPlayer->entindex() != I::EngineClient->GetLocalPlayer())
- return CALL_ORIGINAL(rcx);
-
- int iOriginalFOV = pPlayer->m_iFOV();
- pPlayer->m_iFOV() = ceilf(G::FOV);
- float flReturn = CALL_ORIGINAL(rcx);
- pPlayer->m_iFOV() = iOriginalFOV;
- return ceilf(flReturn);
}
\ No newline at end of file
diff --git a/Amalgam/src/Hooks/IMatSystemSurface_OnScreenSizeChanged.cpp b/Amalgam/src/Hooks/IMatSystemSurface_OnScreenSizeChanged.cpp
index 74c8c69b..6766e671 100644
--- a/Amalgam/src/Hooks/IMatSystemSurface_OnScreenSizeChanged.cpp
+++ b/Amalgam/src/Hooks/IMatSystemSurface_OnScreenSizeChanged.cpp
@@ -9,6 +9,6 @@ MAKE_HOOK(IMatSystemSurface_OnScreenSizeChanged, U::Memory.GetVirtual(I::MatSyst
CALL_ORIGINAL(rcx, nOldWidth, nOldHeight);
- H::Fonts.Reload(Vars::Menu::Scale[DEFAULT_BIND]);
+ H::Fonts.Reload();
F::Materials.ReloadMaterials();
}
\ No newline at end of file
diff --git a/Amalgam/src/SDK/Definitions/Types.h b/Amalgam/src/SDK/Definitions/Types.h
index 5ba83ab3..f347fa6f 100644
--- a/Amalgam/src/SDK/Definitions/Types.h
+++ b/Amalgam/src/SDK/Definitions/Types.h
@@ -1,5 +1,5 @@
#pragma once
-#include
+#include "../../Utils/Math/BaseMath.h"
#include
#include
#include
@@ -10,47 +10,6 @@
#include