visualize trace debug

+ a couple better global names
This commit is contained in:
rei-2 committed 2024-10-11 15:05:02 -04:00
1 parent 6f8e2a9b47
commit bc0c1b64fb
13 files changed
+67 -50

No files matched your search

@@ -843,14 +843,14 @@ void CAimbotHitscan::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC
{
if (Vars::Visuals::Bullet::BulletTracer.Value)
{
G::BulletsStorage.clear();
G::BulletsStorage.push_back({ {pLocal->GetShootPos(), target.m_vPos}, I::GlobalVars->curtime + 5.f, Vars::Colors::BulletTracer.Value, true });
G::LineStorage.clear();
G::LineStorage.push_back({ {pLocal->GetShootPos(), target.m_vPos}, I::GlobalVars->curtime + 5.f, Vars::Colors::BulletTracer.Value, true });
}
if (Vars::Visuals::Hitbox::ShowHitboxes.Value)
{
G::BoxesStorage.clear();
G::BoxStorage.clear();
auto vBoxes = F::Visuals.GetHitboxes(target.m_Tick.BoneMatrix.aBones, target.m_pEntity->As<CBaseAnimating>());
G::BoxesStorage.insert(G::BoxesStorage.end(), vBoxes.begin(), vBoxes.end());
G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end());
}
}
}
@@ -194,10 +194,10 @@ void CAimbotMelee::SimulatePlayers(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, st
}
else
{
G::LinesStorage.clear();
G::LinesStorage.push_back({ localStorage.PredictionLines, I::GlobalVars->curtime + 5.f, Vars::Colors::ProjectileColor.Value });
G::PathStorage.clear();
G::PathStorage.push_back({ localStorage.PredictionLines, I::GlobalVars->curtime + 5.f, Vars::Colors::ProjectileColor.Value });
for (auto& target : targets)
G::LinesStorage.push_back({ targetStorage[target.m_pEntity].PredictionLines, I::GlobalVars->curtime + 5.f, Vars::Colors::PredictionColor.Value });
G::PathStorage.push_back({ targetStorage[target.m_pEntity].PredictionLines, I::GlobalVars->curtime + 5.f, Vars::Colors::PredictionColor.Value });
}
}
@@ -517,14 +517,14 @@ void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd
if (Vars::Visuals::Bullet::BulletTracer.Value)
{
G::BulletsStorage.clear();
G::BulletsStorage.push_back({ {vEyePos, target.m_vPos}, I::GlobalVars->curtime + 5.f, Vars::Colors::BulletTracer.Value, true });
G::LineStorage.clear();
G::LineStorage.push_back({ {vEyePos, target.m_vPos}, I::GlobalVars->curtime + 5.f, Vars::Colors::BulletTracer.Value, true });
}
if (Vars::Visuals::Hitbox::ShowHitboxes.Value)
{
G::BoxesStorage.clear();
G::BoxStorage.clear();
auto vBoxes = F::Visuals.GetHitboxes(target.m_Tick.BoneMatrix.aBones, target.m_pEntity->As<CBaseAnimating>());
G::BoxesStorage.insert(G::BoxesStorage.end(), vBoxes.begin(), vBoxes.end());
G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end());
}
}
if (Vars::Visuals::Simulation::SwingLines.Value && pCmd->buttons & IN_ATTACK && pWeapon->m_flSmackTime() < 0.f)
@@ -532,9 +532,9 @@ void CAimbotMelee::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd
const bool bAlwaysDraw = !Vars::Aimbot::General::AutoShoot.Value || Vars::Debug::Info.Value;
if (!bAlwaysDraw)
{
G::LinesStorage.clear();
G::LinesStorage.push_back({ simLines[pLocal], I::GlobalVars->curtime + 5.f, Vars::Colors::ProjectileColor.Value });
G::LinesStorage.push_back({ simLines[target.m_pEntity], I::GlobalVars->curtime + 5.f, Vars::Colors::PredictionColor.Value });
G::PathStorage.clear();
G::PathStorage.push_back({ simLines[pLocal], I::GlobalVars->curtime + 5.f, Vars::Colors::ProjectileColor.Value });
G::PathStorage.push_back({ simLines[target.m_pEntity], I::GlobalVars->curtime + 5.f, Vars::Colors::PredictionColor.Value });
}
}
@@ -593,8 +593,8 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar
Vec3 vForward = vOld - vNew; vForward.Normalize();
const Vec3 vPos = trace.endpos + vForward * 16 + vOriginal - target.m_vPos;
//G::BulletsStorage.clear();
//G::BulletsStorage.push_back({ {pLocal->GetShootPos(), vPos}, I::GlobalVars->curtime + 5.f, Vars::Colors::PredictionColor.Value });
//G::LineStorage.clear();
//G::LineStorage.push_back({ {pLocal->GetShootPos(), vPos}, I::GlobalVars->curtime + 5.f, Vars::Colors::PredictionColor.Value });
float closestDist; int closestId = -1;
for (int i = 0; i < pSet->numhitboxes; ++i)
@@ -968,24 +968,24 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser
{
if (Vars::Visuals::Simulation::Enabled.Value)
{
G::LinesStorage.clear();
G::LinesStorage.push_back({ vMoveLines, Vars::Visuals::Simulation::Timed.Value ? -int(vMoveLines.size()) : I::GlobalVars->curtime + 5.f, /*pWeapon->IsInReload() ? Color_t(0, 0, 0, 255) :*/ Vars::Colors::PredictionColor.Value});
G::PathStorage.clear();
G::PathStorage.push_back({ vMoveLines, Vars::Visuals::Simulation::Timed.Value ? -int(vMoveLines.size()) : I::GlobalVars->curtime + 5.f, /*pWeapon->IsInReload() ? Color_t(0, 0, 0, 255) :*/ Vars::Colors::PredictionColor.Value});
if (G::IsAttacking)
G::LinesStorage.push_back({ vProjLines, Vars::Visuals::Simulation::Timed.Value ? -int(vProjLines.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()) : I::GlobalVars->curtime + 5.f, pWeapon->IsInReload() ? Color_t(0, 0, 0, 255) : Vars::Colors::ProjectileColor.Value });
G::PathStorage.push_back({ vProjLines, Vars::Visuals::Simulation::Timed.Value ? -int(vProjLines.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()) : I::GlobalVars->curtime + 5.f, pWeapon->IsInReload() ? Color_t(0, 0, 0, 255) : Vars::Colors::ProjectileColor.Value });
}
if (Vars::Visuals::Hitbox::ShowHitboxes.Value)
{
G::BoxesStorage.clear();
//G::BoxesStorage.insert(G::BoxesStorage.end(), vBoxes.begin(), vBoxes.end());
G::BoxStorage.clear();
//G::BoxStorage.insert(G::BoxStorage.end(), vBoxes.begin(), vBoxes.end());
for (auto& tBox : vBoxes)
{
if (pWeapon->IsInReload())
tBox.m_colorEdge.r = tBox.m_colorFace.r = tBox.m_colorEdge.g = tBox.m_colorFace.g = tBox.m_colorEdge.b = tBox.m_colorFace.b = 0;
G::BoxesStorage.push_back(tBox);
G::BoxStorage.push_back(tBox);
}
}
//if (Vars::Visuals::Simulation::Enabled.Value || Vars::Visuals::Hitbox::ShowHitboxes.Value)
// G::BulletsStorage.clear();
// G::LineStorage.clear();
}
if (!pWeapon->IsInReload())
@@ -101,10 +101,10 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p
SDK::Output("Auto jump", std::format("Ticks to hit: {} ({})", iDelay, n).c_str(), { 255, 0, 0, 255 }, Vars::Debug::Logging.Value);
if (Vars::Debug::Info.Value)
{
G::BulletsStorage.clear(); G::BoxesStorage.clear();
G::BulletsStorage.push_back({ { vOriginal, trace.endpos }, I::GlobalVars->curtime + 5.f, {}, true});
G::LineStorage.clear(); G::BoxStorage.clear();
G::LineStorage.push_back({ { vOriginal, trace.endpos }, I::GlobalVars->curtime + 5.f, {}, true});
Vec3 angles; Math::VectorAngles(trace.plane.normal, angles);
G::BoxesStorage.push_back({ trace.endpos, { -1.f, -1.f, -1.f }, { 1.f, 1.f, 1.f }, angles, I::GlobalVars->curtime + 5.f, {}, { 0, 0, 0, 0 }, true });
G::BoxStorage.push_back({ trace.endpos, { -1.f, -1.f, -1.f }, { 1.f, 1.f, 1.f }, angles, I::GlobalVars->curtime + 5.f, {}, { 0, 0, 0, 0 }, true });
}
}
+2
View File
@@ -1278,6 +1278,8 @@ void CMenu::MenuSettings()
FToggle("Debug logging", Vars::Debug::Logging, FToggle_Middle);
FToggle("Show server hitboxes", Vars::Debug::ServerHitbox); HelpMarker("Only localhost servers");
FToggle("Anti aim lines", Vars::Debug::AntiAimLines, FToggle_Middle);
FToggle("Visualize traces", Vars::Debug::VisualizeTraces);
FToggle("Visualize trace hits", Vars::Debug::VisualizeTraceHits, FToggle_Middle);
} EndSection();
if (Section("Extra"))
{
+3 -3
View File
@@ -479,9 +479,9 @@ void CMisc::Event(IGameEvent* pEvent, uint32_t uHash)
F::Backtrack.flWishInterp = 0.f;
[[fallthrough]];
case FNV1A::Hash32Const("teamplay_round_start"):
G::BulletsStorage.clear();
G::BoxesStorage.clear();
G::LinesStorage.clear();
G::LineStorage.clear();
G::BoxStorage.clear();
G::PathStorage.clear();
}
}
@@ -382,7 +382,7 @@ void CMovementSimulation::Store()
*/
}
//G::BulletsStorage.push_back({ { tRecord.m_vOrigin, tRecord.m_vOrigin + tRecord.m_vDirection }, I::GlobalVars->curtime + 0.5f, bSet ? Color_t(SDK::RandomInt(200, 255), SDK::RandomInt(200, 255), SDK::RandomInt(200, 255), 255) : Color_t(0, 0, 0, 255) });
//G::LineStorage.push_back({ { tRecord.m_vOrigin, tRecord.m_vOrigin + tRecord.m_vDirection }, I::GlobalVars->curtime + 0.5f, bSet ? Color_t(SDK::RandomInt(200, 255), SDK::RandomInt(200, 255), SDK::RandomInt(200, 255), 255) : Color_t(0, 0, 0, 255) });
}
@@ -419,7 +419,7 @@ void CMovementSimulation::Store()
bool CMovementSimulation::Initialize(CBaseEntity* pEntity, PlayerStorage& playerStorageOut, bool useHitchance, bool cancelStrafe)
{
G::BulletsStorage.clear();
G::LineStorage.clear();
if (!pEntity || !pEntity->IsPlayer() || !pEntity->As<CTFPlayer>()->IsAlive())
{
playerStorageOut.m_bInitFailed = playerStorageOut.m_bFailed = true;
@@ -695,7 +695,7 @@ void CMovementSimulation::RunTick(PlayerStorage& playerStorage, bool bLine)
Vec3 v1 = playerStorage.m_MoveData.m_vecAbsOrigin;
Vec3 v2 = v1 + (vMove.IsZero() ? Vec3(0, 0, 1) : Math::RotatePoint(vMove.GetNorm(), {}, { 0, playerStorage.m_MoveData.m_vecViewAngles.y, 0 })) * Vars::Visuals::Simulation::SeparatorLength.Value;
G::BulletsStorage.push_back({ { v1, v2 }, I::GlobalVars->curtime + 5.f, Color_t(SDK::RandomInt(0, 255), SDK::RandomInt(0, 255), SDK::RandomInt(0, 255), 255) });
G::LineStorage.push_back({ { v1, v2 }, I::GlobalVars->curtime + 5.f, Color_t(SDK::RandomInt(0, 255), SDK::RandomInt(0, 255), SDK::RandomInt(0, 255), 255) });
}
*/
+11 -11
View File
@@ -307,8 +307,8 @@ void CVisuals::ProjectileTrace(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const
}
else if (Vars::Visuals::Simulation::TrajectoryOnShot.Value)
{
G::LinesStorage.clear();
G::LinesStorage.push_back({ projInfo.PredictionLines, -float(projInfo.PredictionLines.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()), Vars::Colors::ProjectileColor.Value });
G::PathStorage.clear();
G::PathStorage.push_back({ projInfo.PredictionLines, -float(projInfo.PredictionLines.size()) - TIME_TO_TICKS(F::Backtrack.GetReal()), Vars::Colors::ProjectileColor.Value });
if (pNormal)
{
@@ -316,12 +316,12 @@ void CVisuals::ProjectileTrace(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const
const Vec3 vSize = { 1.f, flSize, flSize };
Vec3 vAngles; Math::VectorAngles(*pNormal, vAngles);
G::BoxesStorage.clear();
G::BoxesStorage.push_back({ trace.endpos, vSize * -1, vSize, vAngles, I::GlobalVars->curtime + TICKS_TO_TIME(projInfo.PredictionLines.size()) + F::Backtrack.GetReal(), Vars::Colors::ProjectileColor.Value, { 0, 0, 0, 0 } });
G::BoxStorage.clear();
G::BoxStorage.push_back({ trace.endpos, vSize * -1, vSize, vAngles, I::GlobalVars->curtime + TICKS_TO_TIME(projInfo.PredictionLines.size()) + F::Backtrack.GetReal(), Vars::Colors::ProjectileColor.Value, { 0, 0, 0, 0 } });
}
if (!vPoints.empty())
G::LinesStorage.push_back({ vPoints, I::GlobalVars->curtime + TICKS_TO_TIME(projInfo.PredictionLines.size()) + F::Backtrack.GetReal(), Vars::Colors::ProjectileColor.Value });
G::PathStorage.push_back({ vPoints, I::GlobalVars->curtime + TICKS_TO_TIME(projInfo.PredictionLines.size()) + F::Backtrack.GetReal(), Vars::Colors::ProjectileColor.Value });
}
}
@@ -521,7 +521,7 @@ std::vector<DrawBox> CVisuals::GetHitboxes(matrix3x4 aBones[MAXSTUDIOBONES], CBa
void CVisuals::DrawBulletLines()
{
for (auto& Line : G::BulletsStorage)
for (auto& Line : G::LineStorage)
{
if (Line.m_flTime < I::GlobalVars->curtime) continue;
@@ -571,7 +571,7 @@ void CVisuals::DrawSimLine(std::deque<Vec3>& Line, Color_t Color, int iStyle, bo
void CVisuals::DrawSimLines()
{
for (auto& Line : G::LinesStorage)
for (auto& Line : G::PathStorage)
{
if (Line.m_flTime >= 0.f && Line.m_flTime < I::GlobalVars->curtime)
continue;
@@ -582,7 +582,7 @@ void CVisuals::DrawSimLines()
void CVisuals::DrawBoxes()
{
for (auto& Box : G::BoxesStorage)
for (auto& Box : G::BoxStorage)
{
if (Box.m_flTime < I::GlobalVars->curtime) continue;
@@ -592,19 +592,19 @@ void CVisuals::DrawBoxes()
void CVisuals::RevealBulletLines()
{
for (auto& Line : G::BulletsStorage)
for (auto& Line : G::LineStorage)
Line.m_flTime = I::GlobalVars->curtime + 60.f;
}
void CVisuals::RevealSimLines()
{
for (auto& PredictionLine : G::LinesStorage)
for (auto& PredictionLine : G::PathStorage)
PredictionLine.m_flTime = I::GlobalVars->curtime + 60.f;
}
void CVisuals::RevealBoxes()
{
for (auto& Box : G::BoxesStorage)
for (auto& Box : G::BoxStorage)
Box.m_flTime = I::GlobalVars->curtime + 60.f;
}
@@ -47,7 +47,7 @@ MAKE_HOOK(CBaseEntity_FireBullets, S::CBaseEntity_FireBullets(), void, __fastcal
else if (uHash == FNV1A::Hash32Const("Line"))
{
bool bClear = false;
for (auto& Line : G::BulletsStorage)
for (auto& Line : G::LineStorage)
{
if (I::GlobalVars->curtime - (Line.m_flTime - 5.f) > 0)
{
@@ -56,9 +56,9 @@ MAKE_HOOK(CBaseEntity_FireBullets, S::CBaseEntity_FireBullets(), void, __fastcal
}
}
if (bClear)
G::BulletsStorage.clear();
G::LineStorage.clear();
G::BulletsStorage.push_back({ {trace.startpos, trace.endpos}, I::GlobalVars->curtime + 5.f, Vars::Colors::BulletTracer.Value, true });
G::LineStorage.push_back({ {trace.startpos, trace.endpos}, I::GlobalVars->curtime + 5.f, Vars::Colors::BulletTracer.Value, true });
}
else if (uHash == FNV1A::Hash32Const("Beam"))
{
+1 -1
View File
@@ -29,7 +29,7 @@ MAKE_HOOK(CL_Move, S::CL_Move(), void, __fastcall,
F::NoSpreadHitscan.AskForPlayerPerf();
for (auto& Line : G::LinesStorage)
for (auto& Line : G::PathStorage)
{
if (Line.m_flTime < 0.f)
Line.m_flTime = std::min(Line.m_flTime + 1.f, 0.f);
+3 -3
View File
@@ -86,9 +86,9 @@ namespace G
inline std::unordered_map<int, std::deque<VelFixRecord>> VelocityMap = {};
inline std::vector<DrawBullet> BulletsStorage = {};
inline std::vector<DrawLine> LinesStorage = {};
inline std::vector<DrawBox> BoxesStorage = {};
inline std::vector<DrawBullet> LineStorage = {};
inline std::vector<DrawLine> PathStorage = {};
inline std::vector<DrawBox> BoxStorage = {};
inline int* RandomSeed()
{
+13
View File
@@ -253,6 +253,9 @@ void SDK::Trace(const Vec3& vecStart, const Vec3& vecEnd, unsigned int nMask, IT
Ray_t ray;
ray.Init(vecStart, vecEnd);
I::EngineTrace->TraceRay(ray, nMask, pFilter, pTrace);
if (Vars::Debug::VisualizeTraces.Value)
G::LineStorage.push_back({ { vecStart, Vars::Debug::VisualizeTraceHits.Value ? pTrace->endpos : vecEnd }, I::GlobalVars->curtime + 0.015f });
}
void SDK::TraceHull(const Vec3& vecStart, const Vec3& vecEnd, const Vec3& vecHullMin, const Vec3& vecHullMax, unsigned int nMask, ITraceFilter* pFilter, CGameTrace* pTrace)
@@ -260,6 +263,16 @@ void SDK::TraceHull(const Vec3& vecStart, const Vec3& vecEnd, const Vec3& vecHul
Ray_t ray;
ray.Init(vecStart, vecEnd, vecHullMin, vecHullMax);
I::EngineTrace->TraceRay(ray, nMask, pFilter, pTrace);
if (Vars::Debug::VisualizeTraces.Value)
{
G::LineStorage.push_back({ { vecStart, Vars::Debug::VisualizeTraceHits.Value ? pTrace->endpos : vecEnd }, I::GlobalVars->curtime + 0.015f });
if (!(vecHullMax - vecHullMin).IsZero())
{
G::BoxStorage.push_back({ vecStart, vecHullMin, vecHullMax, {}, I::GlobalVars->curtime + 0.015f, {}, { 0, 0, 0, 0 } });
G::BoxStorage.push_back({ Vars::Debug::VisualizeTraceHits.Value ? pTrace->endpos : vecEnd, vecHullMin, vecHullMax, {}, I::GlobalVars->curtime + 0.015f, {}, { 0, 0, 0, 0 } });
}
}
}
bool SDK::VisPos(CBaseEntity* pSkip, const CBaseEntity* pEntity, const Vec3& from, const Vec3& to, unsigned int nMask)
+2
View File
@@ -747,5 +747,7 @@ namespace Vars
CVar(Logging, false, NOSAVE)
CVar(ServerHitbox, false, NOSAVE)
CVar(AntiAimLines, false)
CVar(VisualizeTraces, false, NOSAVE)
CVar(VisualizeTraceHits, false, NOSAVE)
NAMESPACE_END(Debug)
}