void Visuals::HitmarkerWorld() {
if (g_cfg[XOR("misc_hitmarker_world")].get<int>() != 1)
return;
for (size_t i{ }; i < m_world_hitmarkers.size(); ++i) {
WorldHitmarkerData_t& info = m_world_hitmarkers[i];
// If the delta between the current time and hurt time is larger than 2 seconds then we should erase
if (g_inputpred.m_stored_variables.m_flCurtime - info.m_time > 2.0f) {
info.m_alpha -= (1.0f / 2.0f) * g_csgo.m_globals->m_frametime;
info.m_alpha = std::clamp<float>(info.m_alpha, 0.0f, 1.0f);
}
if (info.m_alpha <= 0.0f) {
continue;
}
if (info.m_world_to_screen) {
constexpr int line{ 8 };
auto draw_lines = [&](vec2_t pos_custom, Color clr) -> void {
D3D::Line(
vec2_t(int(pos_custom.x - (line - 1)), int(pos_custom.y - (line - 1))),
vec2_t(int(pos_custom.x - (line / 4)), int(pos_custom.y - (line / 4))),
clr.OverrideAlpha(255 * info.m_alpha));
D3D::Line(
vec2_t(int(pos_custom.x - (line - 1)), int(pos_custom.y + (line - 1))),
vec2_t(int(pos_custom.x - (line / 4)), int(pos_custom.y + (line / 4))),
clr.OverrideAlpha(255 * info.m_alpha));
D3D::Line(
vec2_t(int(pos_custom.x + (line - 1)), int(pos_custom.y + (line - 1))),
vec2_t(int(pos_custom.x + (line / 4)), int(pos_custom.y + (line / 4))),
clr.OverrideAlpha(255 * info.m_alpha));
D3D::Line(
vec2_t(int(pos_custom.x + (line - 1)), int(pos_custom.y - (line - 1))),
vec2_t(int(pos_custom.x + (line / 4)), int(pos_custom.y - (line / 4))),
clr.OverrideAlpha(255 * info.m_alpha));
};
draw_lines(info.m_world_pos, Color::Palette_t::White());
}
}
}