From b205c6fb73f9d36182ced1deb640c2ed968fb3e0 Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 27 Oct 2026 22:04:34 +0100 Subject: Item ESP: fix AR2/RPG/stunstick world-model names HL2 uses w_irifle for the AR2, w_rocket_launcher for the RPG and w_stunbaton for the stunstick. Keep the model-path fallback (with larger buffers) so unknown world models can still be identified in-game, and make the supply-crate marker larger. --- src/esp.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/esp.cpp b/src/esp.cpp index a154d5c..2fb5d1b 100644 --- a/src/esp.cpp +++ b/src/esp.cpp @@ -1356,7 +1356,7 @@ struct ItemTarget { int idx; int kind; Vector origin; - char label[48]; + char label[128]; }; static ItemTarget g_item_targets[192]; @@ -1420,7 +1420,8 @@ static int classify_weapon(const char *model, const char *cls, char *label, else if (item_icontains(model, "w_smg1") || item_icontains(model, "w_smg2")) snprintf(label, outn, "SMG"); - else if (item_icontains(model, "w_ar2")) + else if (item_icontains(model, "w_ar2") || + item_icontains(model, "w_irifle")) snprintf(label, outn, "AR2"); else if (item_icontains(model, "w_shotgun")) snprintf(label, outn, "Shotgun"); @@ -1434,12 +1435,15 @@ static int classify_weapon(const char *model, const char *cls, char *label, else if (item_icontains(model, "w_physcannon") || item_icontains(model, "w_physics")) snprintf(label, outn, "Gravity gun"); - else if (item_icontains(model, "w_stunstick")) + else if (item_icontains(model, "w_stunstick") || + item_icontains(model, "w_stunbaton")) snprintf(label, outn, "Stunstick"); else if (item_icontains(model, "w_bugbait")) snprintf(label, outn, "Bugbait"); else if (item_icontains(model, "w_sniper")) snprintf(label, outn, "Sniper"); + else if (item_icontains(model, "w_slam")) + snprintf(label, outn, "SLAM"); else snprintf(label, outn, "%s", model); return 1; @@ -1660,7 +1664,7 @@ static void items_collect(int local_idx) { continue; const char *cls = entity_class_name(net, nullptr); const char *model = entity_model_name(ent); - char label[48]; + char label[128]; int kind = classify_item(model, cls, label, sizeof(label)); bool propish = item_icontains(cls, "crate") || @@ -1765,18 +1769,21 @@ void esp_draw_items() { default: break; } int x = (int)sx, y = (int)sy; + int rad = (t.kind == IK_CRATE) ? 7 : 4; surf_color(r, g, b, 255); - surf_rect(0, x - 4, y - 4, x + 4, y + 4); - surf_line(x - 8, y, x - 5, y); - surf_line(x + 5, y, x + 8, y); - surf_line(x, y - 8, x, y - 5); - surf_line(x, y + 5, x, y + 8); + surf_rect(0, x - rad, y - rad, x + rad, y + rad); + surf_line(x - rad - 4, y, x - rad - 1, y); + surf_line(x + rad + 1, y, x + rad + 4, y); + surf_line(x, y - rad - 4, x, y - rad - 1); + surf_line(x, y + rad + 1, x, y + rad + 4); + if (t.kind == IK_CRATE) + surf_rect(1, x - 2, y - 2, x + 2, y + 2); float dx = t.origin.x - g_cam_eye.x; float dy = t.origin.y - g_cam_eye.y; float dz = t.origin.z - g_cam_eye.z; int dist = (int)sqrtf(dx * dx + dy * dy + dz * dz); - char text[96]; + char text[192]; if (g_item_distance) snprintf(text, sizeof(text), "%s %du", t.label, dist); else -- cgit v1.2.3