summaryrefslogtreecommitdiffstats
path: root/src/esp.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-10-26 15:44:45 +0100
committersalmonik <salmonik@tuta.io>2026-10-26 15:44:45 +0100
commit15e4d33220bedb62beac635580fa4d222a7f5863 (patch)
tree46cd1ee202b7d9d0597b7a91b6716ce4bef6d1a3 /src/esp.cpp
parentESP: vertical health bar right of the box, HP number beside it (diff)
downloadhl2h-15e4d33220bedb62beac635580fa4d222a7f5863.tar.gz
hl2h-15e4d33220bedb62beac635580fa4d222a7f5863.zip
ESP: menu toggles for neutral/healthbar/healthnum/name
Diffstat (limited to 'src/esp.cpp')
-rw-r--r--src/esp.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/esp.cpp b/src/esp.cpp
index 3914342..4462f07 100644
--- a/src/esp.cpp
+++ b/src/esp.cpp
@@ -280,6 +280,8 @@ void esp_draw() {
280 esp_collect(engine_get_local_player()); 280 esp_collect(engine_get_local_player());
281 for (int i = 0; i < g_ntargets; i++) { 281 for (int i = 0; i < g_ntargets; i++) {
282 const EspTarget &t = g_targets[i]; 282 const EspTarget &t = g_targets[i];
283 if (t.neutral && !esp_option(ESP_OPT_SHOW_NEUTRAL))
284 continue;
283 if (t.friendly) surf_color(60, 255, 60, 255); 285 if (t.friendly) surf_color(60, 255, 60, 255);
284 else if (t.neutral) surf_color(220, 220, 220, 255); 286 else if (t.neutral) surf_color(220, 220, 220, 255);
285 else surf_color(255, 60, 60, 255); 287 else surf_color(255, 60, 60, 255);
@@ -289,7 +291,10 @@ void esp_draw() {
289 int top = (int)(t.sy - t.h); 291 int top = (int)(t.sy - t.h);
290 int bot = (int)t.sy; 292 int bot = (int)t.sy;
291 surf_rect(0, left, top, right, bot); 293 surf_rect(0, left, top, right, bot);
292 if (t.show_health) { 294 bool draw_bar = t.show_health && esp_option(ESP_OPT_SHOW_HEALTHBAR);
295 bool draw_num = t.show_health && esp_option(ESP_OPT_SHOW_HEALTHNUM);
296 int num_x = right + 3;
297 if (draw_bar) {
293 float frac = t.health / (t.maxhealth > 1.0f ? t.maxhealth : 100.0f); 298 float frac = t.health / (t.maxhealth > 1.0f ? t.maxhealth : 100.0f);
294 if (frac > 1) frac = 1; 299 if (frac > 1) frac = 1;
295 if (frac < 0) frac = 0; 300 if (frac < 0) frac = 0;
@@ -304,10 +309,14 @@ void esp_draw() {
304 else surf_color(255, 40, 40, 255); 309 else surf_color(255, 40, 40, 255);
305 if (fill_top < bot) 310 if (fill_top < bot)
306 surf_rect(1, bx0, fill_top, bx1, bot); 311 surf_rect(1, bx0, fill_top, bx1, bot);
312 num_x = bx1 + 3;
313 }
314 if (draw_num) {
307 char hptext[16]; 315 char hptext[16];
308 snprintf(hptext, sizeof(hptext), "%d", (int)t.health); 316 snprintf(hptext, sizeof(hptext), "%d", (int)t.health);
309 draw_text_col(bx1 + 3, top, hptext, 255, 255, 255); 317 draw_text_col(num_x, top, hptext, 255, 255, 255);
310 } 318 }
311 draw_text_col(left, top - 14, t.name, 255, 255, 255); 319 if (esp_option(ESP_OPT_SHOW_NAME))
320 draw_text_col(left, top - 14, t.name, 255, 255, 255);
312 } 321 }
313} 322}