BHit_f light cleanup

This commit is contained in:
Kawe Mazidjatari 2022-10-11 01:32:43 +02:00
parent 2675fca219
commit addf815873

View File

@ -933,37 +933,37 @@ void BHit_f(const CCommand& args)
if (args.ArgC() != 9)
return;
if (bhit_enable->GetBool() && sv_visualizetraces->GetBool())
if (!bhit_enable->GetBool() && !sv_visualizetraces->GetBool())
return;
Vector3D vecAbsStart;
Vector3D vecAbsEnd;
for (int i = 0; i < 3; ++i)
vecAbsStart[i] = atof(args[i + 4]);
QAngle vecBulletAngles;
for (int i = 0; i < 2; ++i)
vecBulletAngles[i] = atof(args[i + 7]);
vecBulletAngles.z = 180.f; // Flipped axis.
AngleVectors(vecBulletAngles, &vecAbsEnd);
static char szBuf[2048]; // Render physics trace.
snprintf(szBuf, sizeof(szBuf), "drawline %g %g %g %g %g %g",
vecAbsStart.x, vecAbsStart.y, vecAbsStart.z,
vecAbsStart.x + vecAbsEnd.x * MAX_COORD_RANGE,
vecAbsStart.y + vecAbsEnd.y * MAX_COORD_RANGE,
vecAbsStart.z + vecAbsEnd.z * MAX_COORD_RANGE);
Cbuf_AddText(Cbuf_GetCurrentPlayer(), szBuf, cmd_source_t::kCommandSrcCode);
if (bhit_abs_origin->GetBool())
{
Vector3D vecAbsStart;
Vector3D vecAbsEnd;
for (int i = 0; i < 3; ++i)
vecAbsStart[i] = atof(args[i + 4]);
QAngle vecBulletAngles;
for (int i = 0; i < 2; ++i)
vecBulletAngles[i] = atof(args[i + 7]);
vecBulletAngles.z = 180.f; // Flipped axis.
AngleVectors(vecBulletAngles, &vecAbsEnd);
static char szBuf[2048]; // Render physics trace.
snprintf(szBuf, sizeof(szBuf), "drawline %g %g %g %g %g %g",
vecAbsStart.x, vecAbsStart.y, vecAbsStart.z,
vecAbsStart.x + vecAbsEnd.x * MAX_COORD_RANGE,
vecAbsStart.y + vecAbsEnd.y * MAX_COORD_RANGE,
vecAbsStart.z + vecAbsEnd.z * MAX_COORD_RANGE);
Cbuf_AddText(Cbuf_GetCurrentPlayer(), szBuf, cmd_source_t::kCommandSrcCode);
if (bhit_abs_origin->GetBool())
const int iEnt = atof(args[2]);
if (const IClientEntity* pEntity = g_pClientEntityList->GetClientEntity(iEnt))
{
const int iEnt = atof(args[2]);
if (const IClientEntity* pEntity = g_pClientEntityList->GetClientEntity(iEnt))
{
g_pDebugOverlay->AddSphereOverlay( // Render a debug sphere at the client's predicted entity origin.
pEntity->GetAbsOrigin(), 10.f, 8, 6, 20, 60, 255, 0, sv_visualizetraces_duration->GetFloat());
}
g_pDebugOverlay->AddSphereOverlay( // Render a debug sphere at the client's predicted entity origin.
pEntity->GetAbsOrigin(), 10.f, 8, 6, 20, 60, 255, 0, sv_visualizetraces_duration->GetFloat());
}
}
#endif // !DEDICATED