From d74e4900f8247f2fb20ede70bea4c65c12fd0b55 Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 26 Oct 2026 16:31:44 +0100 Subject: ESP: generic full-bone skeleton for non-humanoid NPCs (headcrabs, crows, ...) --- src/bones.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/bones.cpp') diff --git a/src/bones.cpp b/src/bones.cpp index d1e25cb..f33a4b2 100644 --- a/src/bones.cpp +++ b/src/bones.cpp @@ -371,16 +371,20 @@ int bone_parent(int idx, int bone) { bool bone_is_skeleton_core(int idx, int bone) { BoneEntry *e = find_entry(idx); - if (!e || !e->valid || !e->humanoid || bone < 0 || bone >= e->count) + if (!e || !e->valid || bone < 0 || bone >= e->count) return false; + if (!e->humanoid) + return true; // non-humanoid: draw its full bone tree return e->core[bone]; } int bone_nearest_core_parent(int idx, int bone) { BoneEntry *e = find_entry(idx); - if (!e || !e->valid || !e->humanoid || bone < 0 || bone >= e->count) + if (!e || !e->valid || bone < 0 || bone >= e->count) return -1; int p = bone_at(e->hdr, bone)->parent; + if (!e->humanoid) + return (p >= 0 && p < e->count) ? p : -1; for (int guard = 0; p >= 0 && p < e->count && guard < 64; guard++) { if (e->core[p]) return p; @@ -389,6 +393,11 @@ int bone_nearest_core_parent(int idx, int bone) { return -1; } +bool bones_is_humanoid(int idx) { + BoneEntry *e = find_entry(idx); + return e && e->valid && e->humanoid; +} + bool bone_pos(int idx, int bone, Vector &out) { BoneEntry *e = find_entry(idx); if (!e || !e->valid || bone < 0 || bone >= e->count) -- cgit v1.2.3