summaryrefslogtreecommitdiffstats
path: root/src/esp.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-10-26 16:20:05 +0100
committersalmonik <salmonik@tuta.io>2026-10-26 16:20:24 +0100
commita3e769a2a8d6f04fdae4e97d2a39d45e1cb062b8 (patch)
treee3d15ab891bd52027055229dacde967c1c45226f /src/esp.cpp
parentESP: skeleton ESP (diff)
downloadhl2h-a3e769a2a8d6f04fdae4e97d2a39d45e1cb062b8.tar.gz
hl2h-a3e769a2a8d6f04fdae4e97d2a39d45e1cb062b8.zip
ESP: restrict skeleton to humanoid core bones (no fingers/toes/headcrab)
Diffstat (limited to '')
-rw-r--r--src/esp.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/esp.cpp b/src/esp.cpp
index b75a7a9..b5cb9b0 100644
--- a/src/esp.cpp
+++ b/src/esp.cpp
@@ -285,11 +285,21 @@ static void draw_skeleton(const EspTarget &t) {
285 Vector wp[256]; 285 Vector wp[256];
286 float xs[256], ys[256]; 286 float xs[256], ys[256];
287 bool ok[256]; 287 bool ok[256];
288 int core_count = 0;
288 for (int i = 0; i < n; i++) { 289 for (int i = 0; i < n; i++) {
290 ok[i] = false;
291 if (!bone_is_skeleton_core(t.idx, i))
292 continue;
293 core_count++;
289 ok[i] = bone_pos(t.idx, i, wp[i]) && 294 ok[i] = bone_pos(t.idx, i, wp[i]) &&
290 world_to_screen(wp[i], xs[i], ys[i]) && std::isfinite(xs[i]) && 295 world_to_screen(wp[i], xs[i], ys[i]) && std::isfinite(xs[i]) &&
291 std::isfinite(ys[i]); 296 std::isfinite(ys[i]);
292 } 297 }
298 static int logged = 0;
299 if (core_count > 0 && logged < 4) {
300 logged++;
301 logf("skeleton: idx=%d bones=%d core=%d", t.idx, n, core_count);
302 }
293 if (t.friendly) 303 if (t.friendly)
294 surf_color(60, 255, 60, 255); 304 surf_color(60, 255, 60, 255);
295 else if (t.neutral) 305 else if (t.neutral)
@@ -297,8 +307,10 @@ static void draw_skeleton(const EspTarget &t) {
297 else 307 else
298 surf_color(255, 60, 60, 255); 308 surf_color(255, 60, 60, 255);
299 for (int i = 0; i < n; i++) { 309 for (int i = 0; i < n; i++) {
300 int p = bone_parent(t.idx, i); 310 if (!ok[i])
301 if (p >= 0 && p < n && ok[i] && ok[p]) 311 continue;
312 int p = bone_nearest_core_parent(t.idx, i);
313 if (p >= 0 && p < n && ok[p])
302 surf_line((int)xs[p], (int)ys[p], (int)xs[i], (int)ys[i]); 314 surf_line((int)xs[p], (int)ys[p], (int)xs[i], (int)ys[i]);
303 } 315 }
304} 316}