-
Автор темы
- #1
C++:
void otheresp::penetration_reticle()
{
if (!g_cfg.player.enable)
return;
if (!g_cfg.esp.penetration_reticle)
return;
if (!g_ctx.local()->is_alive())
return;
auto weapon = g_ctx.local()->m_hActiveWeapon().Get();
if (!weapon)
return;
const auto weapon_info = weapon->get_csweapon_info();
if (!weapon_info)
return;
CTraceFilter filter;
filter.pSkip = g_ctx.local();
Vector view_angles;
m_engine()->GetViewAngles(view_angles);
Vector direction;
math::angle_vectors(view_angles, direction);
trace_t trace;
util::trace_line(g_ctx.globals.eye_pos, g_ctx.globals.eye_pos + direction * weapon_info->flRange, MASK_SHOT_HULL | CONTENTS_HITBOX, &filter, &trace);
if (trace.fraction == 1.0f)
return;
auto color = Color(34, 139, 34, 179);
if (!weapon->is_non_aim() && weapon->m_iItemDefinitionIndex() != WEAPON_TASER && can_penetrate(weapon))
color = Color(237, 42, 28, 179);
float angle_z = math::dot_product(Vector(0, 0, 1), trace.plane.normal);
float invangle_z = math::dot_product(Vector(0, 0, -1), trace.plane.normal);
float angle_y = math::dot_product(Vector(0, 1, 0), trace.plane.normal);
float invangle_y = math::dot_product(Vector(0, -1, 0), trace.plane.normal);
float angle_x = math::dot_product(Vector(1, 0, 0), trace.plane.normal);
float invangle_x = math::dot_product(Vector(-1, 0, 0), trace.plane.normal);
if (angle_z > 0.5 || invangle_z > 0.5)
render::get().filled_rect_world(trace.endpos, Vector2D(5, 5), color, 0);
else if (angle_y > 0.5 || invangle_y > 0.5)
render::get().filled_rect_world(trace.endpos, Vector2D(5, 5), color, 1);
else if (angle_x > 0.5 || invangle_x > 0.5)
render::get().filled_rect_world(trace.endpos, Vector2D(5, 5), color, 2);
}
void render::filled_rect_world(Vector center, Vector2D size, Color color, int angle) {
Vector top_left, top_right, bot_left, bot_right;
switch (angle) {
case 0: // Z
top_left = Vector(-size.x, -size.y, 0);
top_right = Vector(size.x, -size.y, 0);
bot_left = Vector(-size.x, size.y, 0);
bot_right = Vector(size.x, size.y, 0);
break;
case 1: // Y
top_left = Vector(-size.x, 0, -size.y);
top_right = Vector(size.x, 0, -size.y);
bot_left = Vector(-size.x, 0, size.y);
bot_right = Vector(size.x, 0, size.y);
break;
case 2: // X
top_left = Vector(0, -size.y, -size.x);
top_right = Vector(0, -size.y, size.x);
bot_left = Vector(0, size.y, -size.x);
bot_right = Vector(0, size.y, size.x);
break;
}
//top line
// Vector c_top_left = center + add_top_left;
Vector c_top_left = center + top_left;
Vector c_top_right = center + top_right;
//bottom line
Vector c_bot_left = center + bot_left;
Vector c_bot_right = center + bot_right;
Vector m_flTopleft, m_flTopRight, m_flBotLeft, m_flBotRight;
//your standard world to screen if u need one just grab from a past
if (math::world_to_screen(c_top_left, m_flTopleft) && math::world_to_screen(c_top_right, m_flTopRight) &&
math::world_to_screen(c_bot_left, m_flBotLeft) && math::world_to_screen(c_bot_right, m_flBotRight)) {
Vertex_t vertices[4];
//static int m_flTexID = g_pSurface->CreateNewTextureID(true);
static int m_flTexID = m_surface()->CreateNewTextureID(true);
m_surface()->DrawSetTexture(m_flTexID);
m_surface()->DrawSetColor(color);
vertices[0].Init(Vector2D(m_flTopleft.x, m_flTopleft.y));
vertices[1].Init(Vector2D(m_flTopRight.x, m_flTopRight.y));
vertices[2].Init(Vector2D(m_flBotRight.x, m_flBotRight.y));
vertices[3].Init(Vector2D(m_flBotLeft.x, m_flBotLeft.y));
m_surface()->DrawTexturedPolygon(4, vertices, true);
}
}
i hope ppl selling legendware paste for this feature