void DrawLBYTimer(SDK::CBaseEntity* entity, CColor color, CColor dormant)
{
Vector min, max;
entity->GetRenderBounds(min, max);
Vector pos, pos3D, top, top3D;
pos3D = entity->GetAbsOrigin() - Vector(0, 0, 10);
top3D = pos3D + Vector(0, 0, max.z + 10);
auto local_player = INTERFACES::ClientEntityList->GetClientEntity(INTERFACES::Engine->GetLocalPlayer());
if (!local_player)
return;
bool is_local_player = entity == local_player;
if (is_local_player)
return;
if (entity->GetVelocity().Length2D() > 1)
return;
if (local_player->GetTeam() == entity->GetTeam() && !is_local_player)
return;
auto c_baseweapon = reinterpret_cast<SDK::CBaseWeapon*>(INTERFACES::ClientEntityList->GetClientEntity(entity->GetActiveWeaponIndex()));
if (!c_baseweapon)
return;
if (RENDER::WorldToScreen(pos3D, pos) && RENDER::WorldToScreen(top3D, top))
{
static float next_lby_update[65];
static float last_lby[65];
if (entity->GetVelocity().Length2D() > 28)
next_lby_update[entity->GetIndex()] = entity->GetSimTime() + 0.22f;
else
{
if (next_lby_update[entity->GetIndex()] <= entity->GetSimTime())
next_lby_update[entity->GetIndex()] = entity->GetSimTime() + 1.1f;
}
last_lby[entity->GetIndex()] = entity->GetLowerBodyYaw();
float time_remain_to_update = next_lby_update[entity->GetIndex()] - entity->GetSimTime();
float box_w = (float)fabs(height / 2);
float width;
width = (((time_remain_to_update * (box_w / 1.1f))));
RENDER::DrawFilledRect((pos.x - box_w / 2), top.y + height + 3, (pos.x - box_w / 2) + box_w + 2, top.y + height + 7, dormant);
RENDER::DrawFilledRect((pos.x - box_w / 2) + 1, top.y + height + 4, (pos.x - box_w / 2) + width + 1, top.y + height + 6, color);
}
}