-
Автор темы
- #1
Код:
void misc::zeus_range()
{
if (!g_cfg.player.enable)
return;
if (!g_cfg.esp.taser_range)
return;
if (!m_input()->m_fCameraInThirdPerson)
return;
if (!g_ctx.local()->is_alive())
return;
auto weapon = g_ctx.local()->m_hActiveWeapon().Get();
if (!weapon)
return;
if (weapon->m_iItemDefinitionIndex() != WEAPON_TASER)
return;
auto weapon_info = weapon->get_csweapon_info();
if (!weapon_info)
return;
float circle_range = weapon_info->flRange / 2;
auto draw_pos = g_ctx.local()->get_shoot_position();
draw_pos.z -= 32;
render::get().Draw3DRainbowCircle(draw_pos, circle_range);
draw_pos.z -= 4;
render::get().Draw3DRainbowCircle(draw_pos, circle_range);
draw_pos.z -= 26;
render::get().Draw3DFilledCircle(draw_pos, circle_range, Color(255, 255, 255, 120));
}
Код:
void render::Draw3DRainbowCircle(const Vector& origin, float radius)
{
static auto hue_offset = 0.0f;
static auto prevScreenPos = ZERO; //-V656
static auto step = M_PI * 2.0f / 72.0f;
auto screenPos = ZERO;
for (auto rotation = 0.0f; rotation <= M_PI * 2.0f; rotation += step) //-V1034
{
Vector pos(radius * cos(rotation) + origin.x, radius * sin(rotation) + origin.y, origin.z);
Ray_t ray;
trace_t trace;
CTraceFilterWorldOnly filter;
ray.Init(origin, pos);
m_trace()->TraceRay(ray, MASK_SHOT_BRUSHONLY, &filter, &trace);
if (math::world_to_screen(trace.endpos, screenPos))
{
if (!prevScreenPos.IsZero())
{
auto hue = RAD2DEG(rotation) + hue_offset;
float r, g, b;
ColorConvertHSVtoRGB(hue / 360.0f, 1.0f, 1.0f, r, g, b);
render::get().line(prevScreenPos.x, prevScreenPos.y, screenPos.x, screenPos.y, Color(r, g, b));
}
prevScreenPos = screenPos;
}
}
hue_offset += m_globals()->m_frametime * 200.0f;
}