From ea163c157bd30e4c54fa917ffe0465f5a6d1c663 Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 26 Oct 2026 16:15:22 +0100 Subject: ESP: skeleton ESP - render parent->child bone links from the SetupBones world matrices (ISurface DrawLine, projected once per bone) - menu option "Show skeleton" under ESP, persisted as skeleton=1 - skeletons use the same hostile/friendly/neutral colours as the boxes --- src/esp.cpp | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'src/esp.cpp') diff --git a/src/esp.cpp b/src/esp.cpp index 996a886..b75a7a9 100644 --- a/src/esp.cpp +++ b/src/esp.cpp @@ -11,7 +11,7 @@ static constexpr float PI_F = 3.14159265358979323846f; // ISurface slots (binary = SDK header + 4, disassembly-confirmed) enum SurfSlot { SURF_DrawSetColor = 10, SURF_FilledRect = 12, SURF_OutlinedRect = 14, - SURF_GetScreenSize = 38, + SURF_DrawLine = 15, SURF_GetScreenSize = 38, }; enum { LIFE_ALIVE = 0 }; @@ -271,6 +271,37 @@ static void surf_color(int r, int g, int b, int a) { using Fn = void (*)(void *, int, int, int, int); vfunc(g_surface, SURF_DrawSetColor)(g_surface, r, g, b, a); } +static void surf_line(int x0, int y0, int x1, int y1) { + using Fn = void (*)(void *, int, int, int, int); + vfunc(g_surface, SURF_DrawLine)(g_surface, x0, y0, x1, y1); +} + +// Draw the parent->child bone links. Bone snapshots are world-space matrices +// from SetupBones; project each bone once and reuse for both endpoints. +static void draw_skeleton(const EspTarget &t) { + int n = bones_count(t.idx); + if (n <= 0 || n > 256) + return; + Vector wp[256]; + float xs[256], ys[256]; + bool ok[256]; + for (int i = 0; i < n; i++) { + ok[i] = bone_pos(t.idx, i, wp[i]) && + world_to_screen(wp[i], xs[i], ys[i]) && std::isfinite(xs[i]) && + std::isfinite(ys[i]); + } + if (t.friendly) + surf_color(60, 255, 60, 255); + else if (t.neutral) + surf_color(220, 220, 220, 255); + else + surf_color(255, 60, 60, 255); + for (int i = 0; i < n; i++) { + int p = bone_parent(t.idx, i); + if (p >= 0 && p < n && ok[i] && ok[p]) + surf_line((int)xs[p], (int)ys[p], (int)xs[i], (int)ys[i]); + } +} void esp_draw() { if (!g_surface || !g_iface.entitylist || !g_net.esp_ok()) return; @@ -285,6 +316,11 @@ void esp_draw() { const EspTarget &t = g_targets[i]; if (t.neutral && !esp_option(ESP_OPT_SHOW_NEUTRAL)) continue; + if (esp_option(ESP_OPT_SHOW_SKELETON)) { + void *ent = entitylist_get(t.idx); + if (ent && bones_update(t.idx, ent)) + draw_skeleton(t); + } if (t.friendly) surf_color(60, 255, 60, 255); else if (t.neutral) surf_color(220, 220, 220, 255); else surf_color(255, 60, 60, 255); -- cgit v1.2.3