diff --git a/memory-external/classes/render.hpp b/memory-external/classes/render.hpp index bab648d..ec5ce9e 100644 --- a/memory-external/classes/render.hpp +++ b/memory-external/classes/render.hpp @@ -3,6 +3,17 @@ namespace render { + void DrawCircle(HDC hdc, int x, int y, int radius, COLORREF color) + { + HBRUSH hBrush = CreateSolidBrush(color); + HBRUSH hOldBrush = (HBRUSH)SelectObject(hdc, hBrush); + + Ellipse(hdc, x - radius, y - radius, x + radius, y + radius); + + SelectObject(hdc, hOldBrush); + DeleteObject(hBrush); + } + void DrawBorderBox(HDC hdc, int x, int y, int w, int h, COLORREF borderColor) { HBRUSH hBorderBrush = CreateSolidBrush(borderColor); diff --git a/memory-external/hacks/hack.hpp b/memory-external/hacks/hack.hpp index 195ffe3..988a924 100644 --- a/memory-external/hacks/hack.hpp +++ b/memory-external/hacks/hack.hpp @@ -125,21 +125,40 @@ namespace hack { const Vector3 origin = process->read(pCSPlayerPawn + updater::offsets::m_vecOrigin); const Vector3 head = { origin.x, origin.y, origin.z + 75.f }; + if (origin.x == localOrigin.x && origin.y == localOrigin.y && origin.z == localOrigin.z) + continue; + + const uintptr_t gamescene = process->read(pCSPlayerPawn + 0x310); + const uintptr_t bonearray = process->read(gamescene + 0x160 + 0x80); + const Vector3 headPos = process->read(bonearray + 6 * 32); + if (config::render_distance != -1 && (localOrigin - origin).length2d() > config::render_distance) continue; + if (origin.x == 0 && origin.y == 0) + continue; + const Vector3 screenPos = origin.world_to_screen(view_matrix); const Vector3 screenHead = head.world_to_screen(view_matrix); + const Vector3 screenHeadPos = headPos.world_to_screen(view_matrix); if (screenPos.z >= 0.01f) { const float height = screenPos.y - screenHead.y; const float width = height / 2.4f; - const float head_height = (screenPos.y - screenHead.y) / 8; - const float head_width = (height / 2.4f) / 4; + const float head_height = (screenHeadPos.y - screenHeadPos.y) / 8; + const float head_width = (head_height / 2.4f) / 4; float distance = localOrigin.calculate_distance(origin); int roundedDistance = std::round(distance / 10.f); + render::DrawCircle( + g::hdcBuffer, + screenHeadPos.x, + screenHeadPos.y, + 5, + config::esp_box_color_enemy + ); + render::DrawBorderBox( g::hdcBuffer, screenHead.x - width / 2, @@ -293,7 +312,7 @@ namespace hack { } } } - std::this_thread::sleep_for(std::chrono::milliseconds(1)); + // std::this_thread::sleep_for(std::chrono::milliseconds(1)); } } diff --git a/offsets/offsets.json b/offsets/offsets.json index f3f7d1b..06969f6 100644 --- a/offsets/offsets.json +++ b/offsets/offsets.json @@ -22,4 +22,4 @@ "m_sSanitizedPlayerName": 1824, "m_iTeamNum": 959, "m_vecOrigin": 4644 -} +} \ No newline at end of file