summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-10-27 22:04:34 +0100
committersalmonik <salmonik@tuta.io>2026-10-27 22:04:34 +0100
commitb205c6fb73f9d36182ced1deb640c2ed968fb3e0 (patch)
treeff63d6d0ef824defa1bf92e399d02e524a48b4c6
parentedge-case in weapon displaying and fixing RPG filtering (diff)
downloadhl2h-b205c6fb73f9d36182ced1deb640c2ed968fb3e0.tar.gz
hl2h-b205c6fb73f9d36182ced1deb640c2ed968fb3e0.zip
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.
Diffstat (limited to '')
-rw-r--r--src/esp.cpp27
1 files 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 {
1356 int idx; 1356 int idx;
1357 int kind; 1357 int kind;
1358 Vector origin; 1358 Vector origin;
1359 char label[48]; 1359 char label[128];
1360}; 1360};
1361 1361
1362static ItemTarget g_item_targets[192]; 1362static ItemTarget g_item_targets[192];
@@ -1420,7 +1420,8 @@ static int classify_weapon(const char *model, const char *cls, char *label,
1420 else if (item_icontains(model, "w_smg1") || 1420 else if (item_icontains(model, "w_smg1") ||
1421 item_icontains(model, "w_smg2")) 1421 item_icontains(model, "w_smg2"))
1422 snprintf(label, outn, "SMG"); 1422 snprintf(label, outn, "SMG");
1423 else if (item_icontains(model, "w_ar2")) 1423 else if (item_icontains(model, "w_ar2") ||
1424 item_icontains(model, "w_irifle"))
1424 snprintf(label, outn, "AR2"); 1425 snprintf(label, outn, "AR2");
1425 else if (item_icontains(model, "w_shotgun")) 1426 else if (item_icontains(model, "w_shotgun"))
1426 snprintf(label, outn, "Shotgun"); 1427 snprintf(label, outn, "Shotgun");
@@ -1434,12 +1435,15 @@ static int classify_weapon(const char *model, const char *cls, char *label,
1434 else if (item_icontains(model, "w_physcannon") || 1435 else if (item_icontains(model, "w_physcannon") ||
1435 item_icontains(model, "w_physics")) 1436 item_icontains(model, "w_physics"))
1436 snprintf(label, outn, "Gravity gun"); 1437 snprintf(label, outn, "Gravity gun");
1437 else if (item_icontains(model, "w_stunstick")) 1438 else if (item_icontains(model, "w_stunstick") ||
1439 item_icontains(model, "w_stunbaton"))
1438 snprintf(label, outn, "Stunstick"); 1440 snprintf(label, outn, "Stunstick");
1439 else if (item_icontains(model, "w_bugbait")) 1441 else if (item_icontains(model, "w_bugbait"))
1440 snprintf(label, outn, "Bugbait"); 1442 snprintf(label, outn, "Bugbait");
1441 else if (item_icontains(model, "w_sniper")) 1443 else if (item_icontains(model, "w_sniper"))
1442 snprintf(label, outn, "Sniper"); 1444 snprintf(label, outn, "Sniper");
1445 else if (item_icontains(model, "w_slam"))
1446 snprintf(label, outn, "SLAM");
1443 else 1447 else
1444 snprintf(label, outn, "%s", model); 1448 snprintf(label, outn, "%s", model);
1445 return 1; 1449 return 1;
@@ -1660,7 +1664,7 @@ static void items_collect(int local_idx) {
1660 continue; 1664 continue;
1661 const char *cls = entity_class_name(net, nullptr); 1665 const char *cls = entity_class_name(net, nullptr);
1662 const char *model = entity_model_name(ent); 1666 const char *model = entity_model_name(ent);
1663 char label[48]; 1667 char label[128];
1664 int kind = classify_item(model, cls, label, sizeof(label)); 1668 int kind = classify_item(model, cls, label, sizeof(label));
1665 1669
1666 bool propish = item_icontains(cls, "crate") || 1670 bool propish = item_icontains(cls, "crate") ||
@@ -1765,18 +1769,21 @@ void esp_draw_items() {
1765 default: break; 1769 default: break;
1766 } 1770 }
1767 int x = (int)sx, y = (int)sy; 1771 int x = (int)sx, y = (int)sy;
1772 int rad = (t.kind == IK_CRATE) ? 7 : 4;
1768 surf_color(r, g, b, 255); 1773 surf_color(r, g, b, 255);
1769 surf_rect(0, x - 4, y - 4, x + 4, y + 4); 1774 surf_rect(0, x - rad, y - rad, x + rad, y + rad);
1770 surf_line(x - 8, y, x - 5, y); 1775 surf_line(x - rad - 4, y, x - rad - 1, y);
1771 surf_line(x + 5, y, x + 8, y); 1776 surf_line(x + rad + 1, y, x + rad + 4, y);
1772 surf_line(x, y - 8, x, y - 5); 1777 surf_line(x, y - rad - 4, x, y - rad - 1);
1773 surf_line(x, y + 5, x, y + 8); 1778 surf_line(x, y + rad + 1, x, y + rad + 4);
1779 if (t.kind == IK_CRATE)
1780 surf_rect(1, x - 2, y - 2, x + 2, y + 2);
1774 1781
1775 float dx = t.origin.x - g_cam_eye.x; 1782 float dx = t.origin.x - g_cam_eye.x;
1776 float dy = t.origin.y - g_cam_eye.y; 1783 float dy = t.origin.y - g_cam_eye.y;
1777 float dz = t.origin.z - g_cam_eye.z; 1784 float dz = t.origin.z - g_cam_eye.z;
1778 int dist = (int)sqrtf(dx * dx + dy * dy + dz * dz); 1785 int dist = (int)sqrtf(dx * dx + dy * dy + dz * dz);
1779 char text[96]; 1786 char text[192];
1780 if (g_item_distance) 1787 if (g_item_distance)
1781 snprintf(text, sizeof(text), "%s %du", t.label, dist); 1788 snprintf(text, sizeof(text), "%s %du", t.label, dist);
1782 else 1789 else