From 2eda18951fde7ebd803aeb48595f203c0bb2f82a Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 28 Oct 2026 12:42:46 +0100 Subject: 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. --- CONTEXT.md | 5 +++-- src/esp.cpp | 41 +++++++++-------------------------------- src/gui.cpp | 12 +++++++++--- src/menu.cpp | 2 +- 4 files changed, 22 insertions(+), 38 deletions(-) diff --git a/CONTEXT.md b/CONTEXT.md index 7a1ee33..0ecf80c 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -284,8 +284,9 @@ vocabulary / decisions. - Scans the client entity list every 100 ms and tags health, ammo, armor/suit, world weapon pickups, the two supply-crate models and generic items. - Each tag is a colored marker with a name and optional distance, filtered by - category toggles and a max-distance slider (default 5000 units). Drawn - through walls and independently of the hostile NPC ESP. + category toggles and a max-distance slider (default 5000 units; 0 means + unlimited and displays as "All"). Drawn through walls and independently of + the hostile NPC ESP. - Ammo labels are specific where the model is known: pistol, SMG, AR2, .357, crossbow, shotgun, sniper, flares, AR2 grenade, RPG rocket, plus ammo-crate variants. Unknown ammo falls back to "Ammo". 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) { static bool cats_logged = false; if (!cats_logged) { cats_logged = true; + char maxbuf[16]; + if (g_item_max_dist == 0) + snprintf(maxbuf, sizeof(maxbuf), "All"); + else + snprintf(maxbuf, sizeof(maxbuf), "%d", g_item_max_dist); logf("items: categories health=%d ammo=%d armor=%d weapons=%d " - "crates=%d distance=%d max=%d", + "crates=%d distance=%d max=%s", (int)g_item_health, (int)g_item_ammo, (int)g_item_armor, (int)g_item_weapons, (int)g_item_crates, (int)g_item_distance, - g_item_max_dist); + maxbuf); } static int dbg_lines = 0; - static int prop_logs = 0; - static int crate_logs = 0; static bool owner_warned = false; if (!owner_warned && g_net.owner < 0 && g_net.weapon_owner < 0) { owner_warned = true; @@ -1680,14 +1683,7 @@ static void items_collect(int local_idx) { } char label[128]; int kind = classify_item(model, cls, label, sizeof(label)); - - bool propish = item_icontains(cls, "crate") || - item_icontains(model, "crate") || - item_icontains(cls, "physicsprop") || - item_icontains(cls, "breakableprop") || - item_icontains(cls, "func_breakable") || - item_icontains(cls, "physbox"); - if (kind < 0 && !propish) + if (kind < 0) continue; Vector origin{*(float *)((uintptr_t)ent + g_net.origin), @@ -1698,30 +1694,11 @@ static void items_collect(int local_idx) { float dz = origin.z - g_cam_eye.z; float dist = sqrtf(dx * dx + dy * dy + dz * dz); - if (propish && dist < 1500.0f && prop_logs < 40) { - prop_logs++; - logd("item prop: idx=%d cls=%s model=%s kind=%d dist=%.0f " - "origin=(%.0f %.0f %.0f)", - idx, cls ? cls : "?", model ? model : "?", kind, dist, origin.x, - origin.y, origin.z); - } - bool crateish = item_icontains(cls, "crate") || - item_icontains(model, "crate"); - if (crateish && dist < 1500.0f && crate_logs < 40) { - crate_logs++; - logf("item crate seen: idx=%d cls=%s model=%s kind=%d dist=%.0f " - "origin=(%.0f %.0f %.0f)", - idx, cls ? cls : "?", model ? model : "?", kind, dist, origin.x, - origin.y, origin.z); - } - if (kind < 0) - continue; - if (kind == IK_WEAPON) { if (idx == active_idx || item_weapon_is_owned(ent)) continue; } - // Distance applies to every tag, including supply crates. + // Distance applies to every tag; 0 means unlimited. if (g_item_max_dist > 0 && dist > (float)g_item_max_dist) continue; diff --git a/src/gui.cpp b/src/gui.cpp index e826ba9..b512ef3 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -193,6 +193,7 @@ struct Ctrl { int *ival; // CK_SLIDER int min, max; int action; // CK_BUTTON + bool zero_unlimited; // slider: value 0 displays as "All" }; struct Card { @@ -243,6 +244,7 @@ static void add_ctrl(int card, int kind, const char *label, const char *desc, c.min = min; c.max = max; c.action = action; + c.zero_unlimited = false; g_cards[card].n++; } static void add_toggle(int card, const char *label, const char *desc, @@ -364,8 +366,9 @@ static void build_cards() { add_toggle(items, "Show distance", "Append the distance in units.", &g_item_distance); add_slider(items, "Max distance", - "Items farther away than this are not tagged.", 250, 10000, - &g_item_max_dist); + "0 = unlimited; otherwise items farther away are hidden.", 0, + 10000, &g_item_max_dist); + g_ctrls[g_nctrl - 1].zero_unlimited = true; int spread = add_card(3, &g_spread, "Spread control", "Choose a server shot seed that tightens the cone.", @@ -1290,7 +1293,10 @@ static void draw_slider(const Rect &clip, const Rect &cr, int y, int rh, int kx = track.x + fw - S(4.0f); fill(Rect{kx, track.y - S(4.0f), S(8.0f), S(16.0f)}, C_ACCENT, &clip); char val[32]; - snprintf(val, sizeof(val), "%d", value); + if (ct.zero_unlimited && value == 0) + snprintf(val, sizeof(val), "All"); + else + snprintf(val, sizeof(val), "%d", value); text_in(clip, cr.x + cr.w - S(52.0f), y + (rh - g_body_h) / 2, val, g_font_body, g_body_h, 0, C_TEXT); } diff --git a/src/menu.cpp b/src/menu.cpp index 6d7143d..2d4c660 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -280,7 +280,7 @@ static bool config_load() { g_item_distance = atoi(val) != 0; else if (strcmp(key, "max_dist") == 0) { int v = atoi(val); - if (v < 250) v = 250; + if (v < 0) v = 0; // 0 = unlimited if (v > 10000) v = 10000; g_item_max_dist = v; } -- cgit v1.2.3