summaryrefslogtreecommitdiffstats
path: root/src/bones.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-10-26 16:29:10 +0100
committersalmonik <salmonik@tuta.io>2026-10-26 16:29:10 +0100
commitac578cd21c5f05ebdb6647d595b5bdf5aeefd598 (patch)
tree665b6ff0d4a5b54d41e5e7bf128755ce9d0817bf /src/bones.cpp
parentESP: derive skeleton core from hitbox bone paths (fixes unnamed ValveBiped bo... (diff)
downloadhl2h-ac578cd21c5f05ebdb6647d595b5bdf5aeefd598.tar.gz
hl2h-ac578cd21c5f05ebdb6647d595b5bdf5aeefd598.zip
ESP: include zombie head (headcrab body/head) in humanoid skeleton
Diffstat (limited to '')
-rw-r--r--src/bones.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/bones.cpp b/src/bones.cpp
index 35756c2..d1e25cb 100644
--- a/src/bones.cpp
+++ b/src/bones.cpp
@@ -209,15 +209,32 @@ static void build_core_mask(BoneEntry *e) {
209 int b = boxes[i].bone; 209 int b = boxes[i].bone;
210 if (b < 0 || b >= e->count) 210 if (b < 0 || b >= e->count)
211 continue; 211 continue;
212 bool is_head = (boxes[i].group == 1); // HITGROUP_HEAD
212 const char *bn = bone_name_raw(e->hdr, b); 213 const char *bn = bone_name_raw(e->hdr, b);
213 if (bn && (contains_ci(bn, "Headcrab") || contains_ci(bn, "HC_") || 214 if (bn && (contains_ci(bn, "Finger") || contains_ci(bn, "Toe")))
214 contains_ci(bn, "Finger") || contains_ci(bn, "Toe"))) 215 continue;
216 // A zombie's "head" is the headcrab body (HC_Body_Bone); let the head
217 // hitbox through even though its name is HC_*, but keep the headcrab's
218 // extra limbs out.
219 if (!is_head && bn &&
220 (contains_ci(bn, "Headcrab") || contains_ci(bn, "HC_")))
215 continue; 221 continue;
216 int cur = b; 222 int cur = b;
217 for (int guard = 0; cur >= 0 && cur < e->count && guard < 64; guard++) { 223 for (int guard = 0; cur >= 0 && cur < e->count && guard < 64; guard++) {
218 e->core[cur] = true; 224 e->core[cur] = true;
219 cur = bone_at(e->hdr, cur)->parent; 225 cur = bone_at(e->hdr, cur)->parent;
220 } 226 }
227 // Include a direct "head" child of the head bone (zombie: HC_Head_Bone
228 // hanging off HC_Body_Bone).
229 if (is_head) {
230 for (int c = 0; c < e->count; c++) {
231 if (bone_at(e->hdr, c)->parent != b)
232 continue;
233 const char *cn = bone_name_raw(e->hdr, c);
234 if (cn && contains_ci(cn, "Head"))
235 e->core[c] = true;
236 }
237 }
221 } 238 }
222} 239}
223 240