misc changes and fixes

This commit is contained in:
rei-2
2026-03-31 01:30:57 -04:00
parent 86b86355f8
commit 8862bfee0b
48 changed files with 2213 additions and 1962 deletions
+1
View File
@@ -1490,6 +1490,7 @@
<ClInclude Include="src\Utils\Hooks\Hooks.h" />
<ClInclude Include="src\Utils\Interfaces\Interfaces.h" />
<ClInclude Include="src\Utils\KeyHandler\KeyHandler.h" />
<ClInclude Include="src\Utils\Math\BaseMath.h" />
<ClInclude Include="src\Utils\Math\Math.h" />
<ClInclude Include="src\Utils\Memory\Memory.h" />
<ClInclude Include="src\Utils\NetVars\NetVars.h" />
+1
View File
@@ -610,6 +610,7 @@
<ClInclude Include="src\SDK\Definitions\Interfaces\WorldBrushData.h" />
<ClInclude Include="src\SDK\Definitions\Interfaces\CDispCollTree.h" />
<ClInclude Include="src\SDK\Definitions\Misc\TraceInfo.h" />
<ClInclude Include="src\Utils\Math\BaseMath.h" />
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
+1 -1
View File
@@ -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);
+4 -3
View File
@@ -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;
@@ -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())
@@ -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)
@@ -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<int, std::vector<Vec3>>& 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)
@@ -432,8 +432,8 @@ static inline std::vector<Vec3> 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<Setup_t>& 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<Setup_t>& 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<Setup_t>& 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<Setup_t>& 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<Point_t> 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<Point_t> 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<Point_t> vPoints = {};
int iSplashCount = std::min(
@@ -737,7 +747,8 @@ std::vector<Point_t> 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<Point_t> 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<float>::max();
for (auto& tHistory : vSplashHistory)
{
if (m_tInfo.m_iArmTime && tHistory.m_iSimtime < m_tInfo.m_iArmTime)
continue;
std::vector<Point_t> 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<CTFPlayer>()->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<Vec3>& vPlayerPath, std::vector<Vec3>& vProjectilePath, std::vector<DrawBox_t>& 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<Vec3>
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<CTFPlayer>()->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);
@@ -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);
@@ -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<CTFPipebombLauncher>()->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;
}
}
}
@@ -2,6 +2,7 @@
#include "../../../SDK/SDK.h"
#include "../AimbotGlobal/AimbotGlobal.h"
#include <optional>
class CAutoDetonate
{
@@ -19,6 +20,7 @@ private:
void RestorePlayers();
std::unordered_map<CBaseEntity*, Vec3> m_mRestore = {};
std::optional<Vec3> m_vAimPos = {};
public:
void Run(CTFPlayer* pLocal, CUserCmd* pCmd);
@@ -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<Vec3, Vec3>(tMoveStorage.m_MoveData.m_vecAbsOrigin + pLocal->m_vecViewOffset(), trace.endpos + trace.plane.normal), I::GlobalVars->curtime + 5.f, Color_t(), true);
}
}
+1 -1
View File
@@ -184,7 +184,7 @@ std::vector<TickRecord*> CBacktrack::GetValidRecords(std::vector<TickRecord*>& 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
{
+3 -4
View File
@@ -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);
@@ -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;
}
@@ -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<CTFPlayer*, RestoreInfo_t> 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);
+106 -107
View File
@@ -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<uint32_t, float> mLastHeights = {};
static std::vector<uint32_t> 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)
File diff suppressed because it is too large Load Diff
+6 -5
View File
@@ -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<DragBox_t>& var, bool bShouldDraw = true, ImVec2 vSize = { H::Draw.Scale(100), H::Draw.Scale(40) });
+4 -3
View File
@@ -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();
@@ -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())
@@ -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;
}
}
+1 -1
View File
@@ -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
@@ -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<CTFPlayer>();
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<CTFPlayer>();
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)
@@ -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);
@@ -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<CTFGrenadeLauncher>()->m_flDetonateTime() > 0.f ? pWeapon->As<CTFGrenadeLauncher>()->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<CTFPipebombLauncher>()->m_flChargeBeginTime() > 0.f ? I::GlobalVars->curtime - pWeapon->As<CTFPipebombLauncher>()->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<CTFPipebombLauncher>()->m_flChargeBeginTime() > 0.f ? I::GlobalVars->curtime - pWeapon->As<CTFPipebombLauncher>()->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;
}
}
+22 -25
View File
@@ -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());
}
+5 -5
View File
@@ -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<void>(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);
}
+13 -13
View File
@@ -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<CTFWeaponBase>();
@@ -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<CTFPlayer>();
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);
}
}
+5 -5
View File
@@ -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<void>(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)
{
@@ -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;
+25 -21
View File
@@ -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<Vec3> 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());
}
}
+2 -2
View File
@@ -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);
}
-17
View File
@@ -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<CBasePlayer*>(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);
}
@@ -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();
}
+30 -69
View File
@@ -1,5 +1,5 @@
#pragma once
#include <algorithm>
#include "../../Utils/Math/BaseMath.h"
#include <numbers>
#include <string>
#include <format>
@@ -10,47 +10,6 @@
#include <map>
#include <ranges>
#pragma warning (disable : 26495)
namespace Math
{
template <class T = float>
constexpr T PI_V = static_cast<T>(3.141592653589793);
constexpr float PI = PI_V<>;
template <class T = float>
constexpr T RAD_V = static_cast<T>(57.29577951308232);
constexpr float RAD = RAD_V<>;
template <class T = float>
constexpr T E_V = static_cast<T>(2.718281828459045);
constexpr float E = E_V<>;
template <class T = float>
inline T Deg2Rad(T v)
{
return v * PI_V<T> / T(180);
}
template <class T = float>
inline T Rad2Deg(T v)
{
return v * T(180) / PI_V<T>;
}
inline float DeltaAngle(const float flAngleA, const float flAngleB)
{
float flOut = fmodf((flAngleA - flAngleB) + 180.f, 360.f);
return flOut += flOut < 0 ? 180.f : -180.f;
}
inline float ShortDist(const float flAngleA, const float flAngleB)
{
const float flDelta = fmodf((flAngleA - flAngleB), 360.f);
return fmodf(2 * flDelta, 360.f) - flDelta;
}
}
class Vec2
{
public:
@@ -280,12 +239,12 @@ public:
inline Vec2 Lerp(const Vec2& v, float t) const
{
return { x + (v.x - x) * t, y + (v.y - y) * t };
return { Math::Lerp(x, v.x, t), Math::Lerp(y, v.y, t) };
}
inline Vec2 Lerp(float v, float t) const
{
return { x + (v - x) * t, y + (v - y) * t };
return { Math::Lerp(x, v, t), Math::Lerp(y, v, t) };
}
inline Vec2 DeltaAngle(const Vec2& v) const
@@ -300,12 +259,12 @@ public:
inline Vec2 LerpAngle(const Vec2& v, float t) const
{
return { x - Math::ShortDist(x, v.x) * t, y - Math::ShortDist(y, v.y) * t };
return { Math::LerpAngle(x, v.x, t), Math::LerpAngle(y, v.y, t) };
}
inline Vec2 LerpAngle(float v, float t) const
{
return { x - Math::ShortDist(x, v) * t, y - Math::ShortDist(y, v) * t };
return { Math::LerpAngle(x, v, t), Math::LerpAngle(y, v, t) };
}
inline float Length(void) const
@@ -585,12 +544,12 @@ public:
inline Vec3 Lerp(const Vec3& v, float t) const
{
return { x + (v.x - x) * t, y + (v.y - y) * t, z + (v.z - z) * t };
return { Math::Lerp(x, v.x, t), Math::Lerp(y, v.y, t), Math::Lerp(z, v.z, t) };
}
inline Vec3 Lerp(float v, float t) const
{
return { x + (v - x) * t, y + (v - y) * t, z + (v - z) * t };
return { Math::Lerp(x, v, t), Math::Lerp(y, v, t), Math::Lerp(z, v, t) };
}
inline Vec3 DeltaAngle(const Vec3& v) const
@@ -605,12 +564,12 @@ public:
inline Vec3 LerpAngle(const Vec3& v, float t) const
{
return { x - Math::ShortDist(x, v.x) * t, y - Math::ShortDist(y, v.y) * t, z - Math::ShortDist(z, v.z) * t };
return { Math::LerpAngle(x, v.x, t), Math::LerpAngle(y, v.y, t), Math::LerpAngle(z, v.z, t) };
}
inline Vec3 LerpAngle(float v, float t) const
{
return { x - Math::ShortDist(x, v) * t, y - Math::ShortDist(y, v) * t, z - Math::ShortDist(z, v) * t };
return { Math::LerpAngle(x, v, t), Math::LerpAngle(y, v, t), Math::LerpAngle(z, v, t) };
}
inline float Length(void) const
@@ -752,12 +711,6 @@ public:
}
private:
static inline void SinCos(float flRadians, float* pSin, float* pCos)
{
*pSin = std::sin(flRadians);
*pCos = std::cos(flRadians);
}
static inline void Vector3DMultiplyPosition(const VMatrix& src1, const Vector src2, Vector& dst)
{
dst[0] = src1[0][0] * src2.x + src1[0][1] * src2.y + src1[0][2] * src2.z + src1[0][3];
@@ -768,10 +721,9 @@ private:
static inline void SetupMatrixAnglesInternal(float m2[4][4], const QAngle& vAngles)
{
float sr, sp, sy, cr, cp, cy;
SinCos(Math::Deg2Rad(vAngles[1]), &sy, &cy);
SinCos(Math::Deg2Rad(vAngles[0]), &sp, &cp);
SinCos(Math::Deg2Rad(vAngles[2]), &sr, &cr);
Math::SinCos(Math::Deg2Rad(vAngles[1]), sy, cy);
Math::SinCos(Math::Deg2Rad(vAngles[0]), sp, cp);
Math::SinCos(Math::Deg2Rad(vAngles[2]), sr, cr);
// matrix = (YAW * PITCH) * ROLL
m2[0][0] = cp * cy;
@@ -900,7 +852,7 @@ struct FloatRange_t
namespace LerpEnum {
enum LerpEnum {
All, NoAlpha, Alpha
All, NoAlpha, Alpha, HSV, HSVNoAlpha
};
};
using byte = unsigned char;
@@ -1015,16 +967,16 @@ struct Color_t
{
default:
return {
byte(r + (to.r - r) * t),
byte(g + (to.g - g) * t),
byte(b + (to.b - b) * t),
byte(a + (to.a - a) * t)
byte(Math::Lerp(r, to.r, t)),
byte(Math::Lerp(g, to.g, t)),
byte(Math::Lerp(b, to.b, t)),
byte(Math::Lerp(a, to.a, t))
};
case LerpEnum::NoAlpha:
return {
byte(r + (to.r - r) * t),
byte(g + (to.g - g) * t),
byte(b + (to.b - b) * t),
byte(Math::Lerp(r, to.r, t)),
byte(Math::Lerp(g, to.g, t)),
byte(Math::Lerp(b, to.b, t)),
byte(a)
};
case LerpEnum::Alpha:
@@ -1032,8 +984,17 @@ struct Color_t
r,
g,
b,
byte(a + (to.a - a) * t)
byte(Math::Lerp(a, to.a, t))
};
case LerpEnum::HSV:
case LerpEnum::HSVNoAlpha:
{
float flHFrom, flSFrom, flVFrom; GetHSV(flHFrom, flSFrom, flVFrom);
float flHTo, flSTo, flVTo; to.GetHSV(flHTo, flSTo, flVTo);
float flAOut = (eLerp == LerpEnum::HSV ? Math::Lerp(a, to.a, t) : a) * 255.f;
Color_t tOut; tOut.SetHSV(fnmodf(Math::LerpAngle(flHFrom - 180, flHTo - 180, t) + 180, 360), Math::Lerp(flSFrom, flSTo, t), Math::Lerp(flVFrom, flVTo, t), flAOut);
return tOut;
}
}
}
+22 -24
View File
@@ -24,7 +24,7 @@ void CDraw::Start(bool bBadFontCheck)
if (tTimer.Run(1.f))
{
if (!GetTextSize("", H::Fonts.GetFont(FONT_ESP)).y)
H::Fonts.Reload(Vars::Menu::Scale[DEFAULT_BIND]);
H::Fonts.Reload();
}
}
}
@@ -122,8 +122,11 @@ void CDraw::String(const Font_t& tFont, int x, int y, Color_t tColor, EAlign eAl
I::MatSystemSurface->DrawSetTextColor(tColor);
I::MatSystemSurface->DrawPrintText(wstr, int(wcslen(wstr)));
}
void CDraw::StringOutlined(const Font_t& tFont, int x, int y, Color_t tColor, Color_t tColorOut, EAlign eAlign, const char* str, bool bAlpha)
void CDraw::StringOutlined(const Font_t& tFont, int x, int y, Color_t tColor, Color_t tColorOut, EAlign eAlign, const char* str)
{
if (Vars::Menu::CheapText.Value)
return String(tFont, x, y, tColor, eAlign, str);
wsprintfW(s_wstr, L"%hs", str);
const auto dwFont = tFont.m_dwFont;
@@ -141,15 +144,11 @@ void CDraw::StringOutlined(const Font_t& tFont, int x, int y, Color_t tColor, Co
case ALIGN_BOTTOMRIGHT: x -= vSize.x; y -= vSize.y; break;
}
std::vector<std::pair<int, int>> vOutline = { { 1, 1 } };
if (!Vars::Menu::CheapText.Value)
vOutline = { { -1, 0 }, { 0, -1 }, { 1, 0 }, { 0, 1 }, { -1, -1 }, { 1, 1 }, { -1, 1 }, { 1, -1 } };
if (bAlpha && !Vars::Menu::CheapText.Value)
tColorOut = tColorOut.Alpha(tColorOut.a * Math::RemapVal(tColorOut.Brightness(), 0, 255, 0.5f, 0.1f));
tColorOut.a *= Math::RemapVal(tColorOut.Brightness(), 0, 255, 0.5f, 0.1f);
if (tColorOut.a)
{
std::vector<std::pair<int, int>> vOutline = { { -1, 0 }, { 0, -1 }, { 1, 0 }, { 0, 1 }, { -1, -1 }, { 1, 1 }, { -1, 1 }, { 1, -1 } };
for (auto& [x2, y2] : vOutline)
{
I::MatSystemSurface->DrawSetTextPos(x + x2, y + y2);
@@ -164,8 +163,11 @@ void CDraw::StringOutlined(const Font_t& tFont, int x, int y, Color_t tColor, Co
I::MatSystemSurface->DrawSetTextColor(tColor);
I::MatSystemSurface->DrawPrintText(s_wstr, int(wcslen(s_wstr)));
}
void CDraw::StringOutlined(const Font_t& tFont, int x, int y, Color_t tColor, Color_t tColorOut, EAlign eAlign, const wchar_t* wstr, bool bAlpha)
void CDraw::StringOutlined(const Font_t& tFont, int x, int y, Color_t tColor, Color_t tColorOut, EAlign eAlign, const wchar_t* wstr)
{
if (Vars::Menu::CheapText.Value)
return String(tFont, x, y, tColor, eAlign, wstr);
const auto dwFont = tFont.m_dwFont;
Vec2 vSize = GetTextSize(wstr, tFont);
@@ -181,16 +183,12 @@ void CDraw::StringOutlined(const Font_t& tFont, int x, int y, Color_t tColor, Co
case ALIGN_BOTTOM: x -= vSize.x / 2; y -= vSize.y; break;
case ALIGN_BOTTOMRIGHT: x -= vSize.x; y -= vSize.y; break;
}
std::vector<std::pair<int, int>> vOutline = { { 1, 1 } };
if (!Vars::Menu::CheapText.Value)
vOutline = { { -1, 0 }, { 0, -1 }, { 1, 0 }, { 0, 1 }, { -1, -1 }, { 1, 1 }, { -1, 1 }, { 1, -1 } };
if (bAlpha && !Vars::Menu::CheapText.Value)
tColorOut = tColorOut.Alpha(tColorOut.a * Math::RemapVal(tColorOut.Brightness(), 0, 255, 0.5f, 0.1f));
tColorOut.a *= Math::RemapVal(tColorOut.Brightness(), 0, 255, 0.5f, 0.1f);
if (tColorOut.a)
{
std::vector<std::pair<int, int>> vOutline = { { -1, 0 }, { 0, -1 }, { 1, 0 }, { 0, 1 }, { -1, -1 }, { 1, 1 }, { -1, 1 }, { 1, -1 } };
for (auto& [x2, y2] : vOutline)
{
I::MatSystemSurface->DrawSetTextPos(x + x2, y + y2);
@@ -485,7 +483,7 @@ void CDraw::RenderLine(const Vec3& vStart, const Vec3& vEnd, Color_t tColor, boo
void CDraw::RenderPath(const std::vector<Vec3>& vPath, Color_t tColor, bool bZBuffer, int iStyle, float flTime, int iSeparatorSpacing, float flSeparatorLength)
{
if (!tColor.a || iStyle == Vars::Visuals::Simulation::StyleEnum::Off)
if (!tColor.a || iStyle == Vars::Visuals::Path::StyleEnum::Off)
return;
for (size_t i = 1; i < vPath.size(); i++)
@@ -495,12 +493,12 @@ void CDraw::RenderPath(const std::vector<Vec3>& vPath, Color_t tColor, bool bZBu
switch (iStyle)
{
case Vars::Visuals::Simulation::StyleEnum::Line:
case Vars::Visuals::Path::StyleEnum::Line:
{
RenderLine(vPath[i - 1], vPath[i], tColor, bZBuffer);
break;
}
case Vars::Visuals::Simulation::StyleEnum::Separators:
case Vars::Visuals::Path::StyleEnum::Separators:
{
RenderLine(vPath[i - 1], vPath[i], tColor, bZBuffer);
if (!(i % iSeparatorSpacing))
@@ -514,13 +512,13 @@ void CDraw::RenderPath(const std::vector<Vec3>& vPath, Color_t tColor, bool bZBu
}
break;
}
case Vars::Visuals::Simulation::StyleEnum::Spaced:
case Vars::Visuals::Path::StyleEnum::Spaced:
{
if (!(i % 2))
RenderLine(vPath[i - 1], vPath[i], tColor, bZBuffer);
break;
}
case Vars::Visuals::Simulation::StyleEnum::Arrows:
case Vars::Visuals::Path::StyleEnum::Arrows:
{
if (!(i % 3))
{
@@ -537,7 +535,7 @@ void CDraw::RenderPath(const std::vector<Vec3>& vPath, Color_t tColor, bool bZBu
}
break;
}
case Vars::Visuals::Simulation::StyleEnum::Boxes:
case Vars::Visuals::Path::StyleEnum::Boxes:
{
RenderLine(vPath[i - 1], vPath[i], tColor, bZBuffer);
if (!(i % iSeparatorSpacing))
+5 -5
View File
@@ -77,8 +77,8 @@ public:
void String(const Font_t& tFont, int x, int y, Color_t tColor, EAlign eAlign, const char* str);
void String(const Font_t& tFont, int x, int y, Color_t tColor, EAlign eAlign, const wchar_t* wstr);
void StringOutlined(const Font_t& tFont, int x, int y, Color_t tColor, Color_t tColorOut, EAlign eAlign, const char* str, bool bAlpha = true);
void StringOutlined(const Font_t& tFont, int x, int y, Color_t tColor, Color_t tColorOut, EAlign eAlign, const wchar_t* wstr, bool bAlpha = true);
void StringOutlined(const Font_t& tFont, int x, int y, Color_t tColor, Color_t tColorOut, EAlign eAlign, const char* str);
void StringOutlined(const Font_t& tFont, int x, int y, Color_t tColor, Color_t tColorOut, EAlign eAlign, const wchar_t* wstr);
void Line(int x1, int y1, int x2, int y2, Color_t tColor);
void FillPolygon(std::vector<Vertex_t> vVertices, Color_t tColor);
@@ -106,9 +106,9 @@ public:
void RenderLine(const Vec3& vStart, const Vec3& vEnd, Color_t tColor, bool bZBuffer = false);
void RenderPath(const std::vector<Vec3>& vPath, Color_t tColor, bool bZBuffer = false,
int iStyle = Vars::Visuals::Simulation::StyleEnum::Line, float flTime = 0.f,
int iSeparatorSpacing = Vars::Visuals::Simulation::SeparatorSpacing.Value,
float flSeparatorLength = Vars::Visuals::Simulation::SeparatorLength.Value);
int iStyle = Vars::Visuals::Path::StyleEnum::Line, float flTime = 0.f,
int iSeparatorSpacing = Vars::Visuals::Path::SeparatorSpacing.Value,
float flSeparatorLength = Vars::Visuals::Path::SeparatorLength.Value);
void RenderBox(const Vec3& vOrigin, const Vec3& vMins, const Vec3& vMaxs, const Vec3& vAngles, Color_t tColor, bool bZBuffer = false, bool bInsideOut = false);
void RenderWireframeBox(const Vec3& vOrigin, const Vec3& vMins, const Vec3& vMaxs, const Vec3& vAngles, Color_t tColor, bool bZBuffer = false);
void RenderWireframeSweptBox(const Vector& vStart, const Vector& vEnd, const Vec3& vMins, const Vec3& vMaxs, const Vec3& vAngles, Color_t tColor, bool bZBuffer = false);
+85 -81
View File
@@ -38,9 +38,9 @@ void CEntities::Store()
case ETFClassID::CObjectSentrygun:
case ETFClassID::CObjectDispenser:
case ETFClassID::CObjectTeleporter:
m_mModels[n] = FNV1A::Hash32(I::ModelInfoClient->GetModelName(pEntity->GetModel()));
m_mGroups[EntityEnum::BuildingAll].push_back(pEntity);
m_mGroups[pEntity->m_iTeamNum() != m_pLocal->m_iTeamNum() ? EntityEnum::BuildingEnemy : EntityEnum::BuildingTeam].push_back(pEntity);
m_aModels[n] = FNV1A::Hash32(I::ModelInfoClient->GetModelName(pEntity->GetModel()));
m_aGroups[EntityEnum::BuildingAll].push_back(pEntity);
m_aGroups[pEntity->m_iTeamNum() != m_pLocal->m_iTeamNum() ? EntityEnum::BuildingEnemy : EntityEnum::BuildingTeam].push_back(pEntity);
break;
case ETFClassID::CBaseProjectile:
case ETFClassID::CBaseGrenade:
@@ -88,20 +88,20 @@ void CEntities::Store()
|| (nClassID == ETFClassID::CTFProjectile_Arrow || nClassID == ETFClassID::CTFProjectile_GrapplingHook) && !pEntity->m_MoveType())
break;
m_mGroups[EntityEnum::WorldProjectile].push_back(pEntity);
m_aGroups[EntityEnum::WorldProjectile].push_back(pEntity);
if (nClassID == ETFClassID::CTFGrenadePipebombProjectile)
{
auto pPipebomb = pEntity->As<CTFGrenadePipebombProjectile>();
if (pPipebomb->m_hThrower().Get() == pLocal && pPipebomb->m_iType() == TF_GL_MODE_REMOTE_DETONATE /*pPipebomb->HasStickyEffects()*/)
m_mGroups[EntityEnum::LocalStickies].push_back(pEntity);
m_aGroups[EntityEnum::LocalStickies].push_back(pEntity);
}
if (nClassID == ETFClassID::CTFProjectile_Flare)
{
auto pLauncher = pEntity->As<CTFProjectile_Flare>()->m_hLauncher()->As<CTFWeaponBase>();
if (pEntity->m_hOwnerEntity().Get() == m_pLocal && pLauncher && pLauncher->As<CTFFlareGun>()->GetFlareGunType() == FLAREGUN_DETONATE)
m_mGroups[EntityEnum::LocalFlares].push_back(pEntity);
m_aGroups[EntityEnum::LocalFlares].push_back(pEntity);
}
break;
@@ -112,40 +112,40 @@ void CEntities::Store()
case ETFClassID::CEyeballBoss:
case ETFClassID::CHeadlessHatman:
case ETFClassID::CZombie:
m_mGroups[EntityEnum::WorldNPC].push_back(pEntity);
m_aGroups[EntityEnum::WorldNPC].push_back(pEntity);
break;
case ETFClassID::CTFGenericBomb:
case ETFClassID::CTFPumpkinBomb:
m_mGroups[EntityEnum::WorldBomb].push_back(pEntity);
m_aGroups[EntityEnum::WorldBomb].push_back(pEntity);
break;
case ETFClassID::CBaseAnimating:
{
m_mModels[n] = FNV1A::Hash32(I::ModelInfoClient->GetModelName(pEntity->GetModel()));
m_aModels[n] = FNV1A::Hash32(I::ModelInfoClient->GetModelName(pEntity->GetModel()));
//if (IsHealth(GetModel(n)))
// m_mGroups[EntityEnum::PickupHealth].push_back(pEntity);
// m_aGroups[EntityEnum::PickupHealth].push_back(pEntity);
//else if (IsAmmo(GetModel(n)))
// m_mGroups[EntityEnum::PickupAmmo].push_back(pEntity);
// m_aGroups[EntityEnum::PickupAmmo].push_back(pEntity);
//else if (IsPowerup(GetModel(n)))
// m_mGroups[EntityEnum::PickupPowerup].push_back(pEntity);
// m_aGroups[EntityEnum::PickupPowerup].push_back(pEntity);
//else if (IsSpellbook(GetModel(n)))
// m_mGroups[EntityEnum::PickupSpellbook].push_back(pEntity);
// m_aGroups[EntityEnum::PickupSpellbook].push_back(pEntity);
break;
}
//case ETFClassID::CTFAmmoPack:
// m_mGroups[EntityEnum::PickupAmmo].push_back(pEntity);
// m_aGroups[EntityEnum::PickupAmmo].push_back(pEntity);
// break;
//case ETFClassID::CCurrencyPack:
// m_mGroups[EntityEnum::PickupMoney].push_back(pEntity);
// m_aGroups[EntityEnum::PickupMoney].push_back(pEntity);
// break;
//case ETFClassID::CHalloweenGiftPickup:
// if (pEntity->As<CHalloweenGiftPickup>()->m_hTargetPlayer().Get() == m_pLocal)
// m_mGroups[EntityEnum::PickupGargoyle].push_back(pEntity);
// m_aGroups[EntityEnum::PickupGargoyle].push_back(pEntity);
// break;
//case ETFClassID::CCaptureFlag:
// m_mGroups[EntityEnum::WorldObjective].push_back(pEntity);
// m_aGroups[EntityEnum::WorldObjective].push_back(pEntity);
// break;
case ETFClassID::CSniperDot:
m_mGroups[EntityEnum::SniperDots].push_back(pEntity);
m_aGroups[EntityEnum::SniperDots].push_back(pEntity);
break;
}
}
@@ -247,34 +247,34 @@ void CEntities::Store()
if (!pPlayer || !pPlayer->IsPlayer() || ManageDormancy(pPlayer))
continue;
m_mModels[n] = FNV1A::Hash32(I::ModelInfoClient->GetModelName(pPlayer->GetModel()));
m_mGroups[EntityEnum::PlayerAll].push_back(pPlayer);
m_mGroups[pPlayer->m_iTeamNum() != m_pLocal->m_iTeamNum() ? EntityEnum::PlayerEnemy : EntityEnum::PlayerTeam].push_back(pPlayer);
m_aModels[n] = FNV1A::Hash32(I::ModelInfoClient->GetModelName(pPlayer->GetModel()));
m_aGroups[EntityEnum::PlayerAll].push_back(pPlayer);
m_aGroups[pPlayer->m_iTeamNum() != m_pLocal->m_iTeamNum() ? EntityEnum::PlayerEnemy : EntityEnum::PlayerTeam].push_back(pPlayer);
if (n != I::EngineClient->GetLocalPlayer())
{
bool bDormant = pPlayer->IsDormant();
float flSimTime = pPlayer->m_flSimulationTime(), flOldSimTime = pPlayer->m_flOldSimulationTime();
if (float flDeltaTime = m_mDeltaTimes[n] = TICKS_TO_TIME(std::clamp(TIME_TO_TICKS(flSimTime - flOldSimTime) - iLag, 0, 24)))
if (float flDeltaTime = m_aDeltaTimes[n] = TICKS_TO_TIME(std::clamp(TIME_TO_TICKS(flSimTime - flOldSimTime) - iLag, 0, 24)))
{
m_mLagTimes[n] = flDeltaTime;
m_mSetTicks[n] = I::GlobalVars->tickcount;
m_aLagTimes[n] = flDeltaTime;
m_aSetTicks[n] = I::GlobalVars->tickcount;
if (!bDormant)
{
m_mOrigins[n].emplace_front(pPlayer->m_vecOrigin() + Vec3(0, 0, pPlayer->GetSize().z), flSimTime);
if (m_mOrigins[n].size() > Vars::Aimbot::Projectile::VelocityAverageCount.Value)
m_mOrigins[n].pop_back();
m_aOrigins[n].emplace_front(pPlayer->m_vecOrigin() + Vec3(0, 0, pPlayer->GetSize().z), flSimTime);
if (m_aOrigins[n].size() > Vars::Aimbot::Projectile::VelocityAverageCount.Value)
m_aOrigins[n].pop_back();
if (pPlayer->IsAlive())
F::CheaterDetection.ReportChoke(pPlayer, m_mChokes[n]);
F::CheaterDetection.ReportChoke(pPlayer, m_aChokes[n]);
}
else
m_mOrigins[n].clear();
m_aOrigins[n].clear();
m_mOldAngles[n] = m_mEyeAngles[n];
m_mEyeAngles[n] = pPlayer->As<CTFPlayer>()->GetEyeAngles();
m_aOldAngles[n] = m_aEyeAngles[n];
m_aEyeAngles[n] = pPlayer->As<CTFPlayer>()->GetEyeAngles();
}
m_mChokes[n] = I::GlobalVars->tickcount - m_mSetTicks[n];
m_aChokes[n] = I::GlobalVars->tickcount - m_aSetTicks[n];
}
}
F::Resolver.FrameStageNotify();
@@ -317,35 +317,38 @@ void CEntities::Store()
}
}
static std::unordered_map<unsigned short, DormantData> s_mDormancy = {};
void CEntities::Clear(bool bShutdown)
{
m_pLocal = nullptr;
m_pLocalWeapon = nullptr;
m_pPlayerResource = nullptr;
m_mGroups.clear();
m_aGroups = {};
if (bShutdown)
{
m_mDeltaTimes.clear();
m_mLagTimes.clear();
m_mChokes.clear();
m_mSetTicks.clear();
m_mOldAngles.clear();
m_mEyeAngles.clear();
m_mLagCompensation.clear();
m_mDormancy.clear();
m_mAvgVelocities.clear();
m_mModels.clear();
m_mOrigins.clear();
m_aDeltaTimes = {};
m_aLagTimes = {};
m_aChokes = {};
m_aSetTicks = {};
m_aOldAngles = {};
m_aEyeAngles = {};
m_aLagCompensation = {};
m_aAvgVelocities = {};
m_aOrigins = {};
m_aModels = {};
m_aDormancy = {};
s_mDormancy.clear();
}
}
void CEntities::ManualNetwork(const StartSoundParams_t& params)
{
if (params.soundsource <= 0 || !params.origin || params.soundsource == I::EngineClient->GetLocalPlayer())
int n = params.soundsource;
if (n <= 0 || n > MAX_EDICTS - 1 || !params.origin || n == I::EngineClient->GetLocalPlayer())
return;
auto pEntity = I::ClientEntityList->GetClientEntity(params.soundsource)->As<CBaseEntity>();
auto pEntity = I::ClientEntityList->GetClientEntity(n)->As<CBaseEntity>();
if (!pEntity || !pEntity->IsDormant() || !pEntity->IsPlayer() && !pEntity->IsBuilding())
return;
@@ -358,9 +361,8 @@ void CEntities::ManualNetwork(const StartSoundParams_t& params)
case ETFClassID::CObjectTeleporter: flDuration = 5.f; break;
}
if (flDuration)
m_mDormancy[params.soundsource] = { params.origin, I::GlobalVars->curtime + flDuration };
s_mDormancy[n] = { params.origin, I::GlobalVars->curtime + flDuration }, m_aDormancy[n] = true;
}
bool CEntities::ManageDormancy(CBaseEntity* pEntity)
{
bool bDormant = pEntity->IsDormant();
@@ -373,32 +375,34 @@ bool CEntities::ManageDormancy(CBaseEntity* pEntity)
case ETFClassID::CObjectDispenser:
case ETFClassID::CObjectTeleporter: flDuration = 5.f; break;
}
if (flDuration)
if (!flDuration)
return bDormant;
int n = pEntity->entindex();
if (n < 0 || n > MAX_EDICTS - 1)
return bDormant;
if (bDormant)
{
int n = pEntity->entindex();
if (bDormant)
if (pEntity->IsPlayer())
{
if (pEntity->IsPlayer())
if (auto pResource = GetResource(); pResource)
{
if (auto pResource = GetResource(); pResource)
{
pEntity->As<CTFPlayer>()->m_lifeState() = pResource->m_bAlive(n) ? LIFE_ALIVE : LIFE_DEAD;
pEntity->As<CTFPlayer>()->m_iHealth() = pResource->m_iHealth(n);
}
}
if (m_mDormancy.contains(n))
{
auto& tDormancy = m_mDormancy[n];
if (tDormancy.LastUpdate - I::GlobalVars->curtime > 0.f)
pEntity->SetAbsOrigin(pEntity->m_vecOrigin() = tDormancy.Location);
else
m_mDormancy.erase(n);
pEntity->As<CTFPlayer>()->m_lifeState() = pResource->m_bAlive(n) ? LIFE_ALIVE : LIFE_DEAD;
pEntity->As<CTFPlayer>()->m_iHealth() = pResource->m_iHealth(n);
}
}
else if (!pEntity->IsPlayer() || pEntity->As<CTFPlayer>()->IsAlive())
m_mDormancy[n] = { pEntity->m_vecOrigin(), I::GlobalVars->curtime + flDuration };
if (s_mDormancy.contains(n))
{
auto& tDormancy = s_mDormancy[n];
if (tDormancy.m_flLastUpdate - I::GlobalVars->curtime > 0.f)
pEntity->SetAbsOrigin(pEntity->m_vecOrigin() = tDormancy.m_vLocation);
else
s_mDormancy.erase(n), m_aDormancy[n] = false;
}
}
else if (!pEntity->IsPlayer() || pEntity->As<CTFPlayer>()->IsAlive())
s_mDormancy[n] = { pEntity->m_vecOrigin(), I::GlobalVars->curtime + flDuration }, m_aDormancy[n] = true;
return bDormant;
}
@@ -503,20 +507,20 @@ CTFPlayerResource* CEntities::GetResource()
return m_pPlayerResource;
}
const std::vector<CBaseEntity*>& CEntities::GetGroup(const EntityEnum::EntityEnum iGroup) { return m_mGroups[iGroup]; }
const std::vector<CBaseEntity*>& CEntities::GetGroup(byte iGroup) { return m_aGroups[iGroup]; }
float CEntities::GetDeltaTime(int iIndex) { return m_mDeltaTimes.contains(iIndex) ? m_mDeltaTimes[iIndex] : TICK_INTERVAL; }
float CEntities::GetLagTime(int iIndex) { return m_mLagTimes.contains(iIndex) ? m_mLagTimes[iIndex] : TICK_INTERVAL; }
int CEntities::GetChoke(int iIndex) { return m_mChokes.contains(iIndex) ? m_mChokes[iIndex] : 0; }
bool CEntities::GetDormancy(int iIndex) { return m_mDormancy.contains(iIndex); }
Vec3 CEntities::GetEyeAngles(int iIndex) { return m_mEyeAngles.contains(iIndex) ? m_mEyeAngles[iIndex] : Vec3(); }
Vec3 CEntities::GetDeltaAngles(int iIndex) { return m_mOldAngles.contains(iIndex) ? m_mEyeAngles[iIndex].DeltaAngle(m_mOldAngles[iIndex]) / GetLagTime(iIndex) * (F::Backtrack.GetReal() + TICKS_TO_TIME(F::Backtrack.GetAnticipatedChoke())) : Vec3(); }
bool CEntities::GetLagCompensation(int iIndex) { return m_mLagCompensation[iIndex]; }
void CEntities::SetLagCompensation(int iIndex, bool bLagComp) { m_mLagCompensation[iIndex] = bLagComp; }
Vec3* CEntities::GetAvgVelocity(int iIndex) { return iIndex != I::EngineClient->GetLocalPlayer() ? &m_mAvgVelocities[iIndex] : nullptr; }
void CEntities::SetAvgVelocity(int iIndex, Vec3 vAvgVelocity) { m_mAvgVelocities[iIndex] = vAvgVelocity; }
uint32_t CEntities::GetModel(int iIndex) { return m_mModels[iIndex]; }
std::deque<VelFixRecord>* CEntities::GetOrigins(int iIndex) { return m_mOrigins.contains(iIndex) ? &m_mOrigins[iIndex] : nullptr; }
float CEntities::GetDeltaTime(byte iIndex) { return iIndex < MAX_PLAYERS ? m_aDeltaTimes[iIndex] : TICK_INTERVAL; }
float CEntities::GetLagTime(byte iIndex) { return iIndex < MAX_PLAYERS ? m_aLagTimes[iIndex] : TICK_INTERVAL; }
int CEntities::GetChoke(byte iIndex) { return iIndex < MAX_PLAYERS ? m_aChokes[iIndex] : 0; }
Vec3 CEntities::GetEyeAngles(byte iIndex) { return iIndex < MAX_PLAYERS ? m_aEyeAngles[iIndex] : Vec3(); }
Vec3 CEntities::GetDeltaAngles(byte iIndex) { return iIndex < MAX_PLAYERS ? m_aEyeAngles[iIndex].DeltaAngle(m_aOldAngles[iIndex]) / GetLagTime(iIndex) * (F::Backtrack.GetReal() + TICKS_TO_TIME(F::Backtrack.GetAnticipatedChoke())) : Vec3(); }
bool CEntities::GetLagCompensation(byte iIndex) { return iIndex < MAX_PLAYERS ? m_aLagCompensation[iIndex] : false; }
void CEntities::SetLagCompensation(byte iIndex, bool bLagComp) { if (iIndex < MAX_PLAYERS) m_aLagCompensation[iIndex] = bLagComp; }
Vec3* CEntities::GetAvgVelocity(byte iIndex) { return iIndex < MAX_PLAYERS && iIndex != I::EngineClient->GetLocalPlayer() ? &m_aAvgVelocities[iIndex] : nullptr; }
void CEntities::SetAvgVelocity(byte iIndex, Vec3 vAvgVelocity) { if (iIndex < MAX_PLAYERS) m_aAvgVelocities[iIndex] = vAvgVelocity; }
std::deque<VelFixRecord>* CEntities::GetOrigins(byte iIndex) { return iIndex < MAX_PLAYERS ? &m_aOrigins[iIndex] : nullptr; }
uint32_t CEntities::GetModel(unsigned short iIndex) { return iIndex < MAX_EDICTS ? m_aModels[iIndex] : 0; }
bool CEntities::GetDormancy(unsigned short iIndex) { return iIndex < MAX_EDICTS ? m_aDormancy[iIndex] : false; }
int CEntities::GetPriority(int iIndex) { return m_mIPriorities[iIndex]; }
int CEntities::GetPriority(uint32_t uAccountID) { return m_mUPriorities[uAccountID]; }
+26 -25
View File
@@ -8,13 +8,14 @@ Enum(Entity, Invalid = -1,
BuildingAll, BuildingEnemy, BuildingTeam,
PickupHealth, PickupAmmo, PickupMoney, PickupPowerup, PickupSpellbook, PickupGargoyle,
WorldProjectile, WorldObjective, WorldNPC, WorldBomb,
LocalStickies, LocalFlares, SniperDots
LocalStickies, LocalFlares, SniperDots,
GroupsMax
)
struct DormantData
{
Vec3 Location;
float LastUpdate = 0.f;
Vec3 m_vLocation;
float m_flLastUpdate = 0.f;
};
struct VelFixRecord
@@ -32,16 +33,16 @@ private:
CTFWeaponBase* m_pLocalWeapon = nullptr;
CTFPlayerResource* m_pPlayerResource = nullptr;
std::unordered_map<EntityEnum::EntityEnum, std::vector<CBaseEntity*>> m_mGroups = {};
std::array<std::vector<CBaseEntity*>, EntityEnum::GroupsMax> m_aGroups = {};
std::unordered_map<int, float> m_mDeltaTimes = {}, m_mLagTimes = {};
std::unordered_map<int, int> m_mChokes = {}, m_mSetTicks = {};
std::unordered_map<int, Vec3> m_mOldAngles = {}, m_mEyeAngles = {};
std::unordered_map<int, bool> m_mLagCompensation = {};
std::unordered_map<int, DormantData> m_mDormancy = {};
std::unordered_map<int, Vec3> m_mAvgVelocities = {};
std::unordered_map<int, uint32_t> m_mModels = {};
std::unordered_map<int, std::deque<VelFixRecord>> m_mOrigins = {};
std::array<float, MAX_PLAYERS> m_aDeltaTimes = {}, m_aLagTimes = {};
std::array<int, MAX_PLAYERS> m_aChokes = {}, m_aSetTicks = {};
std::array<Vec3, MAX_PLAYERS> m_aOldAngles = {}, m_aEyeAngles = {};
std::array<bool, MAX_PLAYERS> m_aLagCompensation = {};
std::array<Vec3, MAX_PLAYERS> m_aAvgVelocities = {};
std::array<std::deque<VelFixRecord>, MAX_PLAYERS> m_aOrigins = {};
std::array<uint32_t, MAX_EDICTS> m_aModels = {};
std::array<bool, MAX_EDICTS> m_aDormancy = {};
std::unordered_map<int, int> m_mIPriorities = {};
std::unordered_map<uint32_t, int> m_mUPriorities = {};
@@ -70,20 +71,20 @@ public:
CTFWeaponBase* GetWeapon();
CTFPlayerResource* GetResource();
const std::vector<CBaseEntity*>& GetGroup(const EntityEnum::EntityEnum iGroup);
const std::vector<CBaseEntity*>& GetGroup(byte iGroup);
float GetDeltaTime(int iIndex);
float GetLagTime(int iIndex);
int GetChoke(int iIndex);
Vec3 GetEyeAngles(int iIndex);
Vec3 GetDeltaAngles(int iIndex);
bool GetLagCompensation(int iIndex);
void SetLagCompensation(int iIndex, bool bLagComp);
bool GetDormancy(int iIndex);
Vec3* GetAvgVelocity(int iIndex);
void SetAvgVelocity(int iIndex, Vec3 vAvgVelocity);
uint32_t GetModel(int iIndex);
std::deque<VelFixRecord>* GetOrigins(int iIndex);
float GetDeltaTime(byte iIndex);
float GetLagTime(byte iIndex);
int GetChoke(byte iIndex);
Vec3 GetEyeAngles(byte iIndex);
Vec3 GetDeltaAngles(byte iIndex);
bool GetLagCompensation(byte iIndex);
void SetLagCompensation(byte iIndex, bool bLagComp);
Vec3* GetAvgVelocity(byte iIndex);
void SetAvgVelocity(byte iIndex, Vec3 vAvgVelocity);
std::deque<VelFixRecord>* GetOrigins(byte iIndex);
uint32_t GetModel(unsigned short iIndex);
bool GetDormancy(unsigned short iIndex);
int GetPriority(int iIndex);
int GetPriority(uint32_t uAccountID);
+5 -3
View File
@@ -3,10 +3,12 @@
#include "../../Definitions/Interfaces/IMatSystemSurface.h"
#include <ranges>
void CFonts::Reload(float flDPI)
void CFonts::Reload(float flDPI, bool bOutline)
{
m_mFonts[FONT_ESP] = { "Verdana", int(12.f * flDPI), FONTFLAG_ANTIALIAS, 0 };
m_mFonts[FONT_INDICATORS] = { "Verdana", int(13.f * flDPI), FONTFLAG_ANTIALIAS, 0 };
int iFlags = !bOutline ? FONTFLAG_ANTIALIAS : FONTFLAG_ANTIALIAS | FONTFLAG_DROPSHADOW;
m_mFonts[FONT_ESP] = { "Verdana", int(12.f * flDPI), iFlags, 0 };
m_mFonts[FONT_INDICATORS] = { "Verdana", int(13.f * flDPI), iFlags, 0 };
for (auto& fFont : m_mFonts | std::views::values)
{
+2 -2
View File
@@ -1,5 +1,5 @@
#pragma once
#include "../../../Utils/Macros/Macros.h"
#include "../../Vars.h"
#include <unordered_map>
enum EFonts
@@ -21,7 +21,7 @@ private:
std::unordered_map<EFonts, Font_t> m_mFonts = {};
public:
void Reload(float flDPI = 1.f);
void Reload(float flDPI = Vars::Menu::Scale[DEFAULT_BIND], bool bOutline = Vars::Menu::CheapText[DEFAULT_BIND]);
const Font_t& GetFont(EFonts eFont);
};
+1 -1
View File
@@ -317,7 +317,7 @@ bool SDK::IsOnScreen(CBaseEntity* pEntity, bool bShouldGetOwner)
pEntity = pOwner;
}
return IsOnScreen(pEntity, pEntity->entindex() == I::EngineClient->GetLocalPlayer() && !I::EngineClient->IsPlayingDemo() ? F::EnginePrediction.m_vOrigin : pEntity->GetAbsOrigin());
return IsOnScreen(pEntity, pEntity->GetAbsOrigin());
}
void SDK::Trace(const Vec3& vStart, const Vec3& vEnd, unsigned int nMask, ITraceFilter* pFilter, CGameTrace* pTrace)
-10
View File
@@ -68,16 +68,6 @@
#define OUTPUT_CHAT 1 << 4
#define OUTPUT_PARTY 1 << 5
template <class T> inline int sign(T t)
{
return (t > T(0)) - (t < T(0));
}
inline float fnmodf(float flX, float flY)
{ // silly fix for negative values
return fmodf(flX, flY) + (flX < 0 ? flY : 0);
}
namespace SDK
{
void Output(const char* sFunction, const char* sLog = nullptr, Color_t tColor = { 255, 255, 255, 255 },
+39 -31
View File
@@ -189,7 +189,7 @@ NAMESPACE_BEGIN(Vars)
CVar(SeedPredictionDisplay, "Seed prediction display", DragBox_t(), VISUAL | NOBIND);
CVar(Scale, "Scale", 1.f, NOBIND | SLIDER_MIN | SLIDER_PRECISION | SLIDER_NOAUTOUPDATE, 0.75f, 2.f, 0.25f);
CVar(CheapText, "Cheap text", false);
CVar(CheapText, "Cheap text", false, NOBIND);
NAMESPACE_BEGIN(Theme)
CVar(Accent, "Accent color", Color_t(175, 150, 255, 255), VISUAL);
@@ -639,12 +639,20 @@ NAMESPACE_BEGIN(Vars)
CVar(DrawDuration, VA_LIST("Draw duration", "Hitbox draw duration"), 5.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f);
NAMESPACE_END(Hitbox)
NAMESPACE_BEGIN(Simulation)
Enum(Style, Off, Line, Separators, Spaced, Arrows, Boxes);
NAMESPACE_BEGIN(Prediction)
CVarValues(PlayerPath, "Player path", 0, VISUAL, nullptr,
"Off", "Line", "Separators", "Spaced", "Arrows", "Boxes");
CVarValues(ProjectilePath, "Projectile path", 0, VISUAL, nullptr,
"Off", "Line", "Separators", "Spaced", "Arrows", "Boxes");
CVar(SwingLines, "Swing lines", false, VISUAL);
CVar(PlayerDrawDuration, VA_LIST("Draw duration", "Player path draw duration"), 5.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f);
CVar(ProjectileDrawDuration, VA_LIST("Draw duration", "Projectile path draw duration"), 5.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f);
CVarValues(RealPath, "Real path", 0, NOSAVE | DEBUGVAR, nullptr,
"Off", "Line", "Separators", "Spaced", "Arrows", "Boxes");
NAMESPACE_END(Prediction)
NAMESPACE_BEGIN(Simulation)
CVarValues(TrajectoryPath, "Trajectory path", 0, VISUAL, nullptr,
"Off", "Line", "Separators", "Spaced", "Arrows", "Boxes");
CVarValues(ShotPath, "Shot path", 0, VISUAL, nullptr,
@@ -653,43 +661,43 @@ NAMESPACE_BEGIN(Vars)
VA_LIST("Rockets", "Stickies", "Pipes", "Scorch shot", "##Divider", "Trace", "Sphere"),
Rockets = 1 << 0, Stickies = 1 << 1, Pipes = 1 << 2, ScorchShot = 1 << 3, Trace = 1 << 4, Sphere = 1 << 5,
Enabled = Rockets | Stickies | Pipes | ScorchShot);
CVar(Timed, VA_LIST("Timed", "Timed path"), false, VISUAL);
CVar(Box, VA_LIST("Box", "Path box"), true, VISUAL);
CVar(ProjectileCamera, "Projectile camera", false, VISUAL);
CVar(ProjectileWindow, "Projectile window", WindowBox_t(), VISUAL | NOBIND);
CVar(SwingLines, "Swing lines", false, VISUAL);
CVar(DrawDuration, VA_LIST("Draw duration", "Simulation draw duration"), 5.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f);
CVar(Box, VA_LIST("Box", "Path box"), true, VISUAL);
NAMESPACE_END(Simulation)
NAMESPACE_BEGIN(Path)
Enum(Style, Off, Line, Separators, Spaced, Arrows, Boxes);
CVarValues(RealPath, "Real path", 0, NOSAVE | DEBUGVAR, nullptr,
"Off", "Line", "Separators", "Spaced", "Arrows", "Boxes");
CVar(SeparatorSpacing, "Separator spacing", 4, NOSAVE | DEBUGVAR, 1, 16);
CVar(SeparatorLength, "Separator length", 12.f, NOSAVE | DEBUGVAR, 2.f, 16.f);
NAMESPACE_END(Simulation)
NAMESPACE_END(Path)
NAMESPACE_BEGIN(Trajectory)
CVar(Override, "Simulation override", false, NOSAVE | DEBUGVAR);
CVar(OffsetX, "Offset X", 16.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, -25.f, 25.f, 0.5f);
CVar(OffsetY, "Offset Y", 8.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, -25.f, 25.f, 0.5f);
CVar(OffsetZ, "Offset Z", -6.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, -25.f, 25.f, 0.5f);
CVar(ForwardRedirect, "Forward redirect", 0.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 2000.f, 100.f);
CVar(ForwardCutoff, "Forward cutoff", 0.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 1.f, 0.1f);
CVar(Hull, "Hull", 5.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f, 0.5f);
CVar(Speed, "Speed", 1200.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 5000.f, 50.f);
CVar(Gravity, "Gravity", 1.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 1.f, 0.1f);
CVar(LifeTime, "Life time", 2.2f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f, 0.1f);
CVar(UpVelocity, "Up velocity", 200.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 1000.f, 50.f);
CVar(AngularVelocityX, "Angular velocity X", 600.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, -1000.f, 1000.f, 50.f);
CVar(AngularVelocityY, "Angular velocity Y", -1200.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, -1000.f, 1000.f, 50.f);
CVar(Type, "Type", std::string("custom"), NOSAVE | DEBUGVAR);
CVar(OffsetX, "Offset X", 23.5f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, -25.f, 25.f, 0.5f);
CVar(OffsetY, "Offset Y", 12.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, -25.f, 25.f, 0.5f);
CVar(OffsetZ, "Offset Z", -3.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, -25.f, 25.f, 0.5f);
CVar(ForwardRedirect, "Forward redirect", 2000.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 2000.f, 100.f);
CVar(ForwardCutoff, "Forward cutoff", 0.1f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 1.f, 0.1f);
CVar(Hull, "Hull", 0.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f, 0.5f);
CVar(Speed, "Speed", 1100.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 5000.f, 50.f);
CVar(Gravity, "Gravity", 0.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 1.f, 0.1f);
CVar(LifeTime, "Life time", 10.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f, 0.1f);
CVar(UpVelocity, "Up velocity", 0.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 1000.f, 50.f);
CVar(AngularVelocityX, "Angular velocity X", 0.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, -1000.f, 1000.f, 50.f);
CVar(AngularVelocityY, "Angular velocity Y", 0.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, -1000.f, 1000.f, 50.f);
CVar(AngularVelocityZ, "Angular velocity Z", 0.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, -1000.f, 1000.f, 50.f);
CVar(Drag, "Drag", 1.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 2.f, 0.1f);
CVar(DragX, "Drag X", 0.003902f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 0.1f, 0.01f, "%.15g");
CVar(DragY, "Drag Y", 0.009962f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 0.1f, 0.01f, "%.15g");
CVar(DragZ, "Drag Z", 0.009962f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 0.1f, 0.01f, "%.15g");
CVar(AngularDragX, "Angular drag X", 0.003618f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 0.1f, 0.01f, "%.15g");
CVar(AngularDragY, "Angular drag Y", 0.001514f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 0.1f, 0.01f, "%.15g");
CVar(AngularDragZ, "Angular drag Z", 0.001514f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 0.1f, 0.01f, "%.15g");
CVar(MaxVelocity, "Max velocity", 2000.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 4000.f, 50.f);
CVar(MaxAngularVelocity, "Max angular velocity", 3600.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 7200.f, 50.f);
CVar(Drag, "Drag", 0.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 2.f, 0.1f);
CVar(DragX, "Drag X", 0.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 0.1f, 0.01f, "%.15g");
CVar(DragY, "Drag Y", 0.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 0.1f, 0.01f, "%.15g");
CVar(DragZ, "Drag Z", 0.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 0.1f, 0.01f, "%.15g");
CVar(AngularDragX, "Angular drag X", 0.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 0.1f, 0.01f, "%.15g");
CVar(AngularDragY, "Angular drag Y", 0.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 0.1f, 0.01f, "%.15g");
CVar(AngularDragZ, "Angular drag Z", 0.f, NOSAVE | DEBUGVAR | SLIDER_PRECISION, 0.f, 0.1f, 0.01f, "%.15g");
CVar(MaxVelocity, "Max velocity", 0.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 4000.f, 50.f);
CVar(MaxAngularVelocity, "Max angular velocity", 0.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0.f, 7200.f, 50.f);
NAMESPACE_END(ProjectileTrajectory)
NAMESPACE_END(Visuals)
+5 -2
View File
@@ -48,12 +48,15 @@ public:
#define DEBUG_RETURN()
#else
#define MAKE_HOOK(name, address, type, ...) \
#define DEBUG_VAR(name) \
namespace Vars { \
namespace Hooks { \
inline ConfigVar<bool> name = { true, { #name }, "Vars::Hooks::"#name##"_", "Hooks", NOSAVE | DEBUGVAR }; \
} \
} \
}
#define MAKE_HOOK(name, address, type, ...) \
DEBUG_VAR(name) \
namespace Hooks \
{ \
namespace name \
+202
View File
@@ -0,0 +1,202 @@
#pragma once
#include <cmath>
#include <algorithm>
#include <vector>
template <class T> inline int sign(T t)
{
return (t > T(0)) - (t < T(0));
}
inline float fnmodf(float flX, float flY)
{ // silly fix for negative values
return fmodf(flX, flY) + (flX < 0 ? flY : 0);
}
namespace Math
{
template <class T = float>
constexpr T PI_V = static_cast<T>(3.141592653589793);
constexpr float PI = PI_V<>;
template <class T = float>
constexpr T RAD_V = static_cast<T>(57.29577951308232);
constexpr float RAD = RAD_V<>;
template <class T = float>
constexpr T E_V = static_cast<T>(2.718281828459045);
constexpr float E = E_V<>;
template <class T = float>
inline T Deg2Rad(T v)
{
return v * PI_V<T> / T(180);
}
template <class T = float>
inline T Rad2Deg(T v)
{
return v * T(180) / PI_V<T>;
}
inline void SinCos(float flRadians, float& flSin, float& flCos)
{
flSin = std::sin(flRadians);
flCos = std::cos(flRadians);
}
inline float DeltaAngle(float a, float b, float r = 360.f)
{
float flOut = fmodf(a - b + r / 2, r);
return flOut += flOut < 0 ? r / 2 : -r / 2;
}
inline float ShortDist(float a, float b, float r = 360.f)
{
const float flDelta = fmodf(a - b, r);
return fmodf(2 * flDelta, r) - flDelta;
}
inline float Lerp(float a, float b, float t)
{
return a + (b - a) * t;
}
inline float LerpAngle(float a, float b, float t, float r = 360.f)
{
return a - Math::ShortDist(a, b, r) * t;
}
inline float NormalizeAngle(float flAngle, float flRange = 360.f)
{
return std::isfinite(flAngle) ? std::remainder(flAngle, flRange) : 0.f;
}
inline float NormalizeRad(float flAngle, float flRange = PI * 2)
{
return std::isfinite(flAngle) ? std::remainder(flAngle, flRange) : 0.f;
}
inline float ClampNormalizeAngle(float flAngle, float flRange = 180.f)
{
return std::isfinite(flAngle) ? (flAngle > flRange ? -flRange : flAngle < -flRange ? flRange : flAngle) : 0.f;
}
inline float ClampNormalizeRad(float flAngle, float flRange = PI)
{
return std::isfinite(flAngle) ? (flAngle > flRange ? -flRange : flAngle < -flRange ? flRange : flAngle) : 0.f;
}
inline float SimpleSpline(float val)
{
float flSquared = powf(val, 2);
return 3 * flSquared - 2 * flSquared * val;
}
inline float RemapVal(float flVal, float a, float b, float c, float d, bool bClamp = true)
{
if (a == b)
return flVal >= b ? d : c;
float t = (flVal - a) / (b - a);
if (bClamp)
t = std::clamp(t, 0.f, 1.f);
return Lerp(c, d, t);
}
inline float SimpleSplineRemapVal(float flVal, float a, float b, float c, float d, bool bClamp = true)
{
if (a == b)
return flVal >= b ? d : c;
float t = (flVal - a) / (b - a);
if (bClamp)
t = std::clamp(t, 0.f, 1.f);
return Lerp(c, d, SimpleSpline(t));
}
inline std::vector<float> SolveQuadratic(float a, float b, float c)
{
float flRoot = powf(b, 2.f) - 4 * a * c;
if (flRoot < 0)
return {};
a *= 2;
b = -b;
return { (b + sqrt(flRoot)) / a, (b - sqrt(flRoot)) / a };
}
inline float SolveCubic(float b, float c, float d)
{
float p = c - powf(b, 2) / 3;
float q = 2 * powf(b, 3) / 27 - b * c / 3 + d;
if (p == 0.f)
return powf(q, 1.f / 3);
if (q == 0.f)
return 0.f;
float t = sqrt(fabs(p) / 3);
float g = q / (2.f / 3) / (p * t);
if (p > 0.f)
return -2 * t * sinh(asinh(g) / 3) - b / 3;
if (4 * powf(p, 3) + 27 * powf(q, 2) < 0.f)
return 2 * t * cos(acos(g) / 3) - b / 3;
if (q > 0.f)
return -2 * t * cosh(acosh(-g) / 3) - b / 3;
return 2 * t * cosh(acosh(g) / 3) - b / 3;
}
inline std::vector<float> SolveQuartic(float a, float b, float c, float d, float e)
{
std::vector<float> vRoots = {};
b /= a, c /= a, d /= a, e /= a;
float p = c - powf(b, 2) / (8.f / 3);
float q = powf(b, 3) / 8 - b * c / 2 + d;
float m = SolveCubic(
p,
powf(p, 2) / 4 + powf(b, 4) / (256.f / 3) - e + b * d / 4 - powf(b, 2) * c / 16,
-powf(q, 2) / 8
);
if (m < 0.f)
return vRoots;
float flSqrt2m = sqrt(2 * m);
if (q == 0.f)
{
if (-m - p > 0.f)
{
float flDelta = sqrt(2 * (-m - p));
vRoots.push_back(-b / 4 + (flSqrt2m - flDelta) / 2);
vRoots.push_back(-b / 4 - (flSqrt2m - flDelta) / 2);
vRoots.push_back(-b / 4 + (flSqrt2m + flDelta) / 2);
vRoots.push_back(-b / 4 - (flSqrt2m + flDelta) / 2);
}
if (-m - p == 0.f)
{
vRoots.push_back(-b / 4 - flSqrt2m / 2);
vRoots.push_back(-b / 4 + flSqrt2m / 2);
}
}
else
{
if (-m - p + q / flSqrt2m >= 0.f)
{
float flDelta = sqrt(2 * (-m - p + q / flSqrt2m));
vRoots.push_back((-flSqrt2m + flDelta) / 2 - b / 4);
vRoots.push_back((-flSqrt2m - flDelta) / 2 - b / 4);
}
if (-m - p - q / flSqrt2m >= 0.f)
{
float flDelta = sqrt(2 * (-m - p - q / flSqrt2m));
vRoots.push_back((flSqrt2m + flDelta) / 2 - b / 4);
vRoots.push_back((flSqrt2m - flDelta) / 2 - b / 4);
}
}
return vRoots;
}
}
+47 -179
View File
@@ -1,86 +1,14 @@
#pragma once
#include "BaseMath.h"
#include "../../SDK/Definitions/Types.h"
#include <cmath>
#include <cfloat>
#include <algorithm>
#undef min
#undef max
#pragma warning (push)
#pragma warning (disable : 26451)
#pragma warning (disable : 4244)
#define FLT_COMPARE(x, y) (fabsf(x - y) <= FLT_EPSILON * fmaxf(1.f, fmaxf(fabsf(x), fabsf(y))))
namespace Math
{
inline float Lerp(float a, float b, float t)
{
return a + (b - a) * t;
}
inline float SimpleSpline(float val)
{
float flSquared = powf(val, 2);
return 3 * flSquared - 2 * flSquared * val;
}
inline float RemapVal(float flVal, float a, float b, float c, float d, bool bClamp = true)
{
if (a == b)
return flVal >= b ? d : c;
float t = (flVal - a) / (b - a);
if (bClamp)
t = std::clamp(t, 0.f, 1.f);
return Lerp(c, d, t);
}
inline float SimpleSplineRemapVal(float flVal, float a, float b, float c, float d, bool bClamp = true)
{
if (a == b)
return flVal >= b ? d : c;
float t = (flVal - a) / (b - a);
if (bClamp)
t = std::clamp(t, 0.f, 1.f);
return Lerp(c, d, SimpleSpline(t));
}
inline double FastSqrt(double n)
{
return std::sqrt(n);
}
inline void SinCos(float flRadians, float* pSin, float* pCos)
{
*pSin = std::sin(flRadians);
*pCos = std::cos(flRadians);
}
inline float NormalizeAngle(float flAngle, float flRange = 360.f)
{
return std::isfinite(flAngle) ? std::remainder(flAngle, flRange) : 0.f;
}
inline float NormalizeRad(float flAngle, float flRange = PI * 2)
{
return std::isfinite(flAngle) ? std::remainder(flAngle, flRange) : 0.f;
}
inline float ClampNormalizeAngle(float flAngle, float flRange = 180.f)
{
return std::isfinite(flAngle) ? (flAngle > flRange ? -flRange : flAngle < -flRange ? flRange : flAngle) : 0.f;
}
inline float ClampNormalizeRad(float flAngle, float flRange = PI)
{
return std::isfinite(flAngle) ? (flAngle > flRange ? -flRange : flAngle < -flRange ? flRange : flAngle) : 0.f;
}
inline void ClampAngles(Vec3& v)
{
v.x = std::clamp(NormalizeAngle(v.x), -89.f, 89.f);
@@ -94,6 +22,22 @@ namespace Math
v.y = NormalizeAngle(v.y);
}
inline bool IsBoxIntersectingBox(const Vec3& vMins1, const Vec3& vMaxs1, const Vec3& vMins2, const Vec3& vMaxs2)
{
if (vMins1.x > vMaxs2.x || vMaxs1.x < vMins2.x)
return false;
if (vMins1.y > vMaxs2.y || vMaxs1.y < vMins2.y)
return false;
if (vMins1.z > vMaxs2.z || vMaxs1.z < vMins2.z)
return false;
return true;
}
inline bool IsPointIntersectingBox(const Vec3& vPoint, const Vec3& vMins, const Vec3& vMaxs)
{
return IsBoxIntersectingBox(vPoint, vPoint, vMins, vMaxs);
}
inline void VectorAngles(const Vec3& vForward, Vec3& vAngles)
{
float flYaw, flPitch;
@@ -129,8 +73,8 @@ namespace Math
inline void AngleVectors(const Vec3& vAngles, Vec3* pForward = nullptr, Vec3* pRight = nullptr, Vec3* pUp = nullptr)
{
float sp, sy, sr, cp, cy, cr;
SinCos(Deg2Rad(vAngles.x), &sp, &cp);
SinCos(Deg2Rad(vAngles.y), &sy, &cy);
SinCos(Deg2Rad(vAngles.x), sp, cp);
SinCos(Deg2Rad(vAngles.y), sy, cy);
if (pForward)
{
@@ -141,7 +85,7 @@ namespace Math
if (pRight || pUp)
{
SinCos(Deg2Rad(vAngles.z), &sr, &cr);
SinCos(Deg2Rad(vAngles.z), sr, cr);
if (pRight)
{
@@ -199,9 +143,9 @@ namespace Math
Vec3 vOffset = vPoint - vOrigin;
float sp, sy, sr, cp, cy, cr;
SinCos(Deg2Rad(vAngles.x), &sp, &cp);
SinCos(Deg2Rad(vAngles.y), &sy, &cy);
SinCos(Deg2Rad(vAngles.z), &sr, &cr);
SinCos(Deg2Rad(vAngles.x), sp, cp);
SinCos(Deg2Rad(vAngles.y), sy, cy);
SinCos(Deg2Rad(vAngles.z), sr, cr);
Vec3 vX = {
cy * cp,
@@ -221,21 +165,30 @@ namespace Math
return Vec3(vX.Dot(vOffset), vY.Dot(vOffset), vZ.Dot(vOffset)) + vOrigin;
}
inline bool IsBoxIntersectingBox(const Vec3& vMins1, const Vec3& vMaxs1, const Vec3& vMins2, const Vec3& vMaxs2)
inline float AABBLine(Vec3 vMins, Vec3 vMaxs, Vec3 vStart, Vec3 vDir)
{
if ((vMins1.x > vMaxs2.x) || (vMaxs1.x < vMins2.x))
return false;
if ((vMins1.y > vMaxs2.y) || (vMaxs1.y < vMins2.y))
return false;
if ((vMins1.z > vMaxs2.z) || (vMaxs1.z < vMins2.z))
return false;
return true;
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);
}
inline bool IsPointIntersectingBox(const Vec3& vPoint, const Vec3& vMins, const Vec3& vMaxs)
inline Vec3 PullPoint(Vec3 vFrom, Vec3 vTo, Vec3 vOrigin, Vec3 vMins, Vec3 vMaxs)
{
return IsBoxIntersectingBox(vPoint, vPoint, vMins, vMaxs);
return vTo.Lerp(vFrom, fabsf(AABBLine(vOrigin + vMins, vOrigin + vMaxs, vTo, vFrom - vTo)));
}
inline void VectorTransform(const Vec3& vIn, const matrix3x4& mMatrix, Vec3& vOut)
@@ -277,9 +230,9 @@ namespace Math
inline void AngleMatrix(const Vec3& vAngles, matrix3x4& mMatrix, bool bClearOrigin = true)
{
float sp, sy, sr, cp, cy, cr;
SinCos(Deg2Rad(vAngles.x), &sp, &cp);
SinCos(Deg2Rad(vAngles.y), &sy, &cy);
SinCos(Deg2Rad(vAngles.z), &sr, &cr);
SinCos(Deg2Rad(vAngles.x), sp, cp);
SinCos(Deg2Rad(vAngles.y), sy, cy);
SinCos(Deg2Rad(vAngles.z), sr, cr);
mMatrix[0][0] = cp * cy;
mMatrix[1][0] = cp * sy;
@@ -443,89 +396,4 @@ namespace Math
mOut[2][2] = mIn1[2][0] * mIn2[0][2] + mIn1[2][1] * mIn2[1][2] + mIn1[2][2] * mIn2[2][2];
mOut[2][3] = mIn1[2][0] * mIn2[0][3] + mIn1[2][1] * mIn2[1][3] + mIn1[2][2] * mIn2[2][3] + mIn1[2][3];
}
inline std::vector<float> SolveQuadratic(float a, float b, float c)
{
float flRoot = powf(b, 2.f) - 4 * a * c;
if (flRoot < 0)
return {};
a *= 2;
b = -b;
return { (b + sqrt(flRoot)) / a, (b - sqrt(flRoot)) / a };
}
inline float SolveCubic(float b, float c, float d)
{
float p = c - powf(b, 2) / 3;
float q = 2 * powf(b, 3) / 27 - b * c / 3 + d;
if (p == 0.f)
return powf(q, 1.f / 3);
if (q == 0.f)
return 0.f;
float t = sqrt(fabs(p) / 3);
float g = q / (2.f / 3) / (p * t);
if (p > 0.f)
return -2 * t * sinh(asinh(g) / 3) - b / 3;
if (4 * powf(p, 3) + 27 * powf(q, 2) < 0.f)
return 2 * t * cos(acos(g) / 3) - b / 3;
if (q > 0.f)
return -2 * t * cosh(acosh(-g) / 3) - b / 3;
return 2 * t * cosh(acosh(g) / 3) - b / 3;
}
inline std::vector<float> SolveQuartic(float a, float b, float c, float d, float e)
{
std::vector<float> vRoots = {};
b /= a, c /= a, d /= a, e /= a;
float p = c - powf(b, 2) / (8.f / 3);
float q = powf(b, 3) / 8 - b * c / 2 + d;
float m = SolveCubic(
p,
powf(p, 2) / 4 + powf(b, 4) / (256.f / 3) - e + b * d / 4 - powf(b, 2) * c / 16,
-powf(q, 2) / 8
);
if (m < 0.f)
return vRoots;
float sqrt_2m = sqrt(2 * m);
if (q == 0.f)
{
if (-m - p > 0.f)
{
float flDelta = sqrt(2 * (-m - p));
vRoots.push_back(-b / 4 + (sqrt_2m - flDelta) / 2);
vRoots.push_back(-b / 4 - (sqrt_2m - flDelta) / 2);
vRoots.push_back(-b / 4 + (sqrt_2m + flDelta) / 2);
vRoots.push_back(-b / 4 - (sqrt_2m + flDelta) / 2);
}
if (-m - p == 0.f)
{
vRoots.push_back(-b / 4 - sqrt_2m / 2);
vRoots.push_back(-b / 4 + sqrt_2m / 2);
}
}
else
{
if (-m - p + q / sqrt_2m >= 0.f)
{
float flDelta = sqrt(2 * (-m - p + q / sqrt_2m));
vRoots.push_back((-sqrt_2m + flDelta) / 2 - b / 4);
vRoots.push_back((-sqrt_2m - flDelta) / 2 - b / 4);
}
if (-m - p - q / sqrt_2m >= 0.f)
{
float flDelta = sqrt(2 * (-m - p - q / sqrt_2m));
vRoots.push_back((sqrt_2m + flDelta) / 2 - b / 4);
vRoots.push_back((sqrt_2m - flDelta) / 2 - b / 4);
}
}
return vRoots;
}
}
#pragma warning (pop)
}