From 62ec2a8e56d9c896f76f7c9884b27b1cd39f6ac8 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Mon, 11 Jun 2018 12:32:53 +0200 Subject: [PATCH] clang-format, add to menu and other changes --- src/hacks/LightESP.cpp | 63 ++++++++++++++++++++---------------- src/visual/menu/ncc/Menu.cpp | 4 +++ 2 files changed, 39 insertions(+), 28 deletions(-) diff --git a/src/hacks/LightESP.cpp b/src/hacks/LightESP.cpp index 5251179c..2fc0dbe4 100644 --- a/src/hacks/LightESP.cpp +++ b/src/hacks/LightESP.cpp @@ -7,57 +7,61 @@ namespace shared namespace lightesp { - -CatVar enable(CV_SWITCH, "lightesp", "0", "Enable LightESP", +CatVar enable(CV_SWITCH, "lightesp_enabled", "0", "Enable LightESP", "Lightweight ESP. Only shows head."); Vector hitp[32]; Vector minp[32]; Vector maxp[32]; +bool drawEsp[32]; -void run() { +void run() +{ for (int i = 1; i < g_IEngine->GetMaxClients(); i++) { CachedEntity *pEntity = ENTITY(i); - if (CE_BAD(pEntity) || !pEntity->m_bAlivePlayer()) { - hitp[i] = {0, 0, 0}; + if (CE_BAD(pEntity) || !pEntity->m_bAlivePlayer()) + { + drawEsp[i] = false; continue; } - if (pEntity->m_iTeam() == LOCAL_E->m_iTeam() && playerlist::IsDefault(pEntity)) { - hitp[i] = {0, 0, 0}; + if (pEntity->m_iTeam() == LOCAL_E->m_iTeam() && + playerlist::IsDefault(pEntity)) + { + drawEsp[i] = false; continue; } if (!pEntity->hitboxes.GetHitbox(0)) continue; - hitp[i] = pEntity->hitboxes.GetHitbox(0)->center; - minp[i] = pEntity->hitboxes.GetHitbox(0)->min; - maxp[i] = pEntity->hitboxes.GetHitbox(0)->max; + hitp[i] = pEntity->hitboxes.GetHitbox(0)->center; + minp[i] = pEntity->hitboxes.GetHitbox(0)->min; + maxp[i] = pEntity->hitboxes.GetHitbox(0)->max; + drawEsp[i] = true; } } -void draw() { - #if ENABLE_VISUALS +void draw() +{ +#if ENABLE_VISUALS if (!enable) return; - for (int i = 1; i < g_IEngine->GetMaxClients(); i++) { + for (int i = 1; i < g_IEngine->GetMaxClients(); i++) + { + if (!drawEsp[i]) + continue; CachedEntity *pEntity = ENTITY(i); if (CE_BAD(pEntity) || !pEntity->m_bAlivePlayer()) continue; - auto hitboxpos = hitp[i]; - auto min = minp[i]; - auto max = maxp[i]; - - if (!hitboxpos.x && !hitboxpos.y && !hitboxpos.z) - continue; Vector out; - if (draw::WorldToScreen(hitboxpos, out)) + if (draw::WorldToScreen(hitp[i], out)) { - float size = 0.0f; - if (abs(max.x - min.x) > abs(max.y - min.y)) - size = abs(max.x - min.x); + float size; + if (abs(maxp[i].x - minp[i].x) > abs(maxp[i].y - minp[i].y)) + size = abs(maxp[i].x - minp[i].x); else - size = abs(max.y - min.y); + size = abs(maxp[i].y - minp[i].y); - draw_api::draw_rect(out.x, out.y, size / 4, size / 4, - hacks::shared::lightesp::LightESPColor(pEntity)); //hacks::shared::lightesp::LightESPColor(pEntity) + draw_api::draw_rect( + out.x, out.y, size / 4, size / 4, + hacks::shared::lightesp::LightESPColor(pEntity)); } } #endif @@ -65,9 +69,12 @@ void draw() { rgba_t LightESPColor(CachedEntity *ent) { - if (!playerlist::IsDefault(ent)) { + if (!playerlist::IsDefault(ent)) + { return playerlist::Color(ent); } return colors::green; } -}}} +} +} +} diff --git a/src/visual/menu/ncc/Menu.cpp b/src/visual/menu/ncc/Menu.cpp index b60af187..e7654014 100644 --- a/src/visual/menu/ncc/Menu.cpp +++ b/src/visual/menu/ncc/Menu.cpp @@ -198,6 +198,10 @@ static const std::string list_hl2dm = R"( "glow_medkits" "glow_ammo" ] + "LightESP" [ + "LightESP Menu" + "lightesp_enabled" + ] "GUI" [ "GUI Settings" "logo"