summaryrefslogtreecommitdiffstats
path: root/src/esp.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-10-28 12:42:46 +0100
committersalmonik <salmonik@tuta.io>2026-10-28 12:42:46 +0100
commit2eda18951fde7ebd803aeb48595f203c0bb2f82a (patch)
tree01b93c7ceb45c29652ccf261aa63faaa9a85fec4 /src/esp.cpp
parentLogging: per-session file and debug-gated verbose logs (diff)
downloadhl2h-2eda18951fde7ebd803aeb48595f203c0bb2f82a.tar.gz
hl2h-2eda18951fde7ebd803aeb48595f203c0bb2f82a.zip
Item ESP: make 0 = unlimited explicit and persistent
- config_load now accepts max_dist=0 instead of clamping it to 250, so the "unlimited" setting survives a restart. - The Max distance slider shows "All" at 0 and its tooltip documents 0 = unlimited; the categories log prints max=All. - Skip unclassified entities before projecting them / computing distance. - Keep the removed prop/crate debug logging and the user's rule that the distance slider applies to every tag.
Diffstat (limited to '')
-rw-r--r--src/esp.cpp41
1 files changed, 9 insertions, 32 deletions
diff --git a/src/esp.cpp b/src/esp.cpp
index 50549a1..4d2345d 100644
--- a/src/esp.cpp
+++ b/src/esp.cpp
@@ -1644,15 +1644,18 @@ static void items_collect(int local_idx) {
1644 static bool cats_logged = false; 1644 static bool cats_logged = false;
1645 if (!cats_logged) { 1645 if (!cats_logged) {
1646 cats_logged = true; 1646 cats_logged = true;
1647 char maxbuf[16];
1648 if (g_item_max_dist == 0)
1649 snprintf(maxbuf, sizeof(maxbuf), "All");
1650 else
1651 snprintf(maxbuf, sizeof(maxbuf), "%d", g_item_max_dist);
1647 logf("items: categories health=%d ammo=%d armor=%d weapons=%d " 1652 logf("items: categories health=%d ammo=%d armor=%d weapons=%d "
1648 "crates=%d distance=%d max=%d", 1653 "crates=%d distance=%d max=%s",
1649 (int)g_item_health, (int)g_item_ammo, (int)g_item_armor, 1654 (int)g_item_health, (int)g_item_ammo, (int)g_item_armor,
1650 (int)g_item_weapons, (int)g_item_crates, (int)g_item_distance, 1655 (int)g_item_weapons, (int)g_item_crates, (int)g_item_distance,
1651 g_item_max_dist); 1656 maxbuf);
1652 } 1657 }
1653 static int dbg_lines = 0; 1658 static int dbg_lines = 0;
1654 static int prop_logs = 0;
1655 static int crate_logs = 0;
1656 static bool owner_warned = false; 1659 static bool owner_warned = false;
1657 if (!owner_warned && g_net.owner < 0 && g_net.weapon_owner < 0) { 1660 if (!owner_warned && g_net.owner < 0 && g_net.weapon_owner < 0) {
1658 owner_warned = true; 1661 owner_warned = true;
@@ -1680,14 +1683,7 @@ static void items_collect(int local_idx) {
1680 } 1683 }
1681 char label[128]; 1684 char label[128];
1682 int kind = classify_item(model, cls, label, sizeof(label)); 1685 int kind = classify_item(model, cls, label, sizeof(label));
1683 1686 if (kind < 0)
1684 bool propish = item_icontains(cls, "crate") ||
1685 item_icontains(model, "crate") ||
1686 item_icontains(cls, "physicsprop") ||
1687 item_icontains(cls, "breakableprop") ||
1688 item_icontains(cls, "func_breakable") ||
1689 item_icontains(cls, "physbox");
1690 if (kind < 0 && !propish)
1691 continue; 1687 continue;
1692 1688
1693 Vector origin{*(float *)((uintptr_t)ent + g_net.origin), 1689 Vector origin{*(float *)((uintptr_t)ent + g_net.origin),
@@ -1698,30 +1694,11 @@ static void items_collect(int local_idx) {
1698 float dz = origin.z - g_cam_eye.z; 1694 float dz = origin.z - g_cam_eye.z;
1699 float dist = sqrtf(dx * dx + dy * dy + dz * dz); 1695 float dist = sqrtf(dx * dx + dy * dy + dz * dz);
1700 1696
1701 if (propish && dist < 1500.0f && prop_logs < 40) {
1702 prop_logs++;
1703 logd("item prop: idx=%d cls=%s model=%s kind=%d dist=%.0f "
1704 "origin=(%.0f %.0f %.0f)",
1705 idx, cls ? cls : "?", model ? model : "?", kind, dist, origin.x,
1706 origin.y, origin.z);
1707 }
1708 bool crateish = item_icontains(cls, "crate") ||
1709 item_icontains(model, "crate");
1710 if (crateish && dist < 1500.0f && crate_logs < 40) {
1711 crate_logs++;
1712 logf("item crate seen: idx=%d cls=%s model=%s kind=%d dist=%.0f "
1713 "origin=(%.0f %.0f %.0f)",
1714 idx, cls ? cls : "?", model ? model : "?", kind, dist, origin.x,
1715 origin.y, origin.z);
1716 }
1717 if (kind < 0)
1718 continue;
1719
1720 if (kind == IK_WEAPON) { 1697 if (kind == IK_WEAPON) {
1721 if (idx == active_idx || item_weapon_is_owned(ent)) 1698 if (idx == active_idx || item_weapon_is_owned(ent))
1722 continue; 1699 continue;
1723 } 1700 }
1724 // Distance applies to every tag, including supply crates. 1701 // Distance applies to every tag; 0 means unlimited.
1725 if (g_item_max_dist > 0 && dist > (float)g_item_max_dist) 1702 if (g_item_max_dist > 0 && dist > (float)g_item_max_dist)
1726 continue; 1703 continue;
1727 1704