-
Автор темы
- #1
title
C++:
void otheresp::penetration_reticle()
{
if (!g_cfg.player.enable)
return;
if (!g_cfg.esp.penetration_reticle)
return;
if (m_engine()->IsInGame() || !g_ctx.local())
return;
weapon_t* weapon;
const auto weapon_info = weapon->get_csweapon_info();
if (!weapon_info)
return;
const auto m_flWeaponInfo = weapon_info;
trace_t trace;
if (!m_flWeaponInfo)
return;
//insert squidward meme
CGameTrace enterTrace;
CTraceFilter filter;
Ray_t ray;
Vector viewangles; m_engine()->GetViewAngles(viewangles);
Vector direction; math::angle_vectors(viewangles , direction);
Vector start = g_ctx.globals.eye_pos;
auto m_flMaxRange = m_flWeaponInfo->flRange * 2; //
Vector end = start + (direction * m_flMaxRange);
filter.pSkip = g_ctx.local();
ray.Init(start, end);
//cd
m_trace()->TraceRay(ray, MASK_SHOT | CONTENTS_GRATE, &filter, &enterTrace);
float angle_z = math::dot_product(Vector(0, 0, 1), enterTrace.plane.normal);
float invangle_z = math::dot_product(Vector(0, 0, -1), enterTrace.plane.normal);
float angle_y = math::dot_product(Vector(0, 1, 0), enterTrace.plane.normal);
float invangle_y = math::dot_product(Vector(0, -1, 0), enterTrace.plane.normal);
float angle_x = math::dot_product(Vector(1, 0, 0), enterTrace.plane.normal);
float invangle_x = math::dot_product(Vector(-1, 0, 0), enterTrace.plane.normal);
if (angle_z > 0.5 || invangle_z > 0.5)
render::get().filled_rect_world(enterTrace.endpos, Vector2D(5, 5), Color(34, 139, 34, 179), 0);
else if (angle_y > 0.5 || invangle_y > 0.5)
render::get().filled_rect_world(enterTrace.endpos, Vector2D(5, 5), Color(34, 139, 34, 179), 1);
else if (angle_x > 0.5 || invangle_x > 0.5)
render::get().filled_rect_world(enterTrace.endpos, Vector2D(5, 5), Color(34, 139, 34, 179), 2);
}