summaryrefslogtreecommitdiffstats
path: root/src/gui.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/gui.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/gui.cpp12
1 files changed, 9 insertions, 3 deletions
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 {
193 int *ival; // CK_SLIDER 193 int *ival; // CK_SLIDER
194 int min, max; 194 int min, max;
195 int action; // CK_BUTTON 195 int action; // CK_BUTTON
196 bool zero_unlimited; // slider: value 0 displays as "All"
196}; 197};
197 198
198struct Card { 199struct Card {
@@ -243,6 +244,7 @@ static void add_ctrl(int card, int kind, const char *label, const char *desc,
243 c.min = min; 244 c.min = min;
244 c.max = max; 245 c.max = max;
245 c.action = action; 246 c.action = action;
247 c.zero_unlimited = false;
246 g_cards[card].n++; 248 g_cards[card].n++;
247} 249}
248static void add_toggle(int card, const char *label, const char *desc, 250static void add_toggle(int card, const char *label, const char *desc,
@@ -364,8 +366,9 @@ static void build_cards() {
364 add_toggle(items, "Show distance", "Append the distance in units.", 366 add_toggle(items, "Show distance", "Append the distance in units.",
365 &g_item_distance); 367 &g_item_distance);
366 add_slider(items, "Max distance", 368 add_slider(items, "Max distance",
367 "Items farther away than this are not tagged.", 250, 10000, 369 "0 = unlimited; otherwise items farther away are hidden.", 0,
368 &g_item_max_dist); 370 10000, &g_item_max_dist);
371 g_ctrls[g_nctrl - 1].zero_unlimited = true;
369 372
370 int spread = add_card(3, &g_spread, "Spread control", 373 int spread = add_card(3, &g_spread, "Spread control",
371 "Choose a server shot seed that tightens the cone.", 374 "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,
1290 int kx = track.x + fw - S(4.0f); 1293 int kx = track.x + fw - S(4.0f);
1291 fill(Rect{kx, track.y - S(4.0f), S(8.0f), S(16.0f)}, C_ACCENT, &clip); 1294 fill(Rect{kx, track.y - S(4.0f), S(8.0f), S(16.0f)}, C_ACCENT, &clip);
1292 char val[32]; 1295 char val[32];
1293 snprintf(val, sizeof(val), "%d", value); 1296 if (ct.zero_unlimited && value == 0)
1297 snprintf(val, sizeof(val), "All");
1298 else
1299 snprintf(val, sizeof(val), "%d", value);
1294 text_in(clip, cr.x + cr.w - S(52.0f), y + (rh - g_body_h) / 2, val, 1300 text_in(clip, cr.x + cr.w - S(52.0f), y + (rh - g_body_h) / 2, val,
1295 g_font_body, g_body_h, 0, C_TEXT); 1301 g_font_body, g_body_h, 0, C_TEXT);
1296} 1302}