From 714262bcf759a238daf906de16e7b204712a104f Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 14:28:21 +0100 Subject: Add usable item filter, projectile ESP and gravity-gun melee - Items: "Only if usable" hides health tags at full health and armor at full suit. Health ceiling is the server player's m_iMaxHealth; armor uses the server m_ArmorValue against HL2's 100 cap. Fails open when unreadable. - Projectiles: new Visuals feature/card for thrown grenades, RPG rockets, helicopter bombs and AR2 balls. Fuse from server m_flDetonateTime vs engine time; radius from m_DmgRadius with per-type fallback; optional 24-segment radius ring and FRAG timer label. - Melee: the killbot now handles the gravity gun as well; only VULNERABLE targets, 1200-unit range, primary attack to launch the held object, and no aim-punch compensation because the launch uses EyeVectors. - Server/netvars: m_ArmorValue, m_flDetonateTime, m_DmgRadius. --- src/menu.cpp | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'src/menu.cpp') diff --git a/src/menu.cpp b/src/menu.cpp index 020d2c5..521bf43 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -60,12 +60,16 @@ int g_fog_rgb[3] = {160, 170, 190}; int g_fog_start = 200; int g_fog_end = 3000; FeatureState g_skybox{false, 0}; // skybox.png image override +FeatureState g_projectiles{true, 0}; // grenade / rocket ESP +bool g_proj_fuse = true; +bool g_proj_radius = true; bool g_item_health = true; bool g_item_ammo = true; bool g_item_armor = true; bool g_item_weapons = true; bool g_item_crates = true; bool g_item_distance = true; +bool g_item_usable = true; int g_item_max_dist = 5000; // Aimbot bone checklist. Head defaults on (v1 behaviour). @@ -227,11 +231,16 @@ void config_save() { g_fog_start, g_fog_end, (int)g_fog_skybox, (int)g_fog_disable); fprintf(f, "[skybox]\nactive=%d\nbind=%d\n", g_skybox.active, g_skybox.bind); + fprintf(f, "[projectiles]\nactive=%d\nbind=%d\nfuse=%d\nradius=%d\n", + g_projectiles.active, g_projectiles.bind, (int)g_proj_fuse, + (int)g_proj_radius); fprintf(f, "[items]\nactive=%d\nbind=%d\nhealth=%d\nammo=%d\n" - "armor=%d\nweapons=%d\ncrates=%d\ndistance=%d\nmax_dist=%d\n", + "armor=%d\nweapons=%d\ncrates=%d\ndistance=%d\nmax_dist=%d\n" + "usable=%d\n", g_item_esp.active, g_item_esp.bind, (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); + (int)g_item_crates, (int)g_item_distance, g_item_max_dist, + (int)g_item_usable); fprintf(f, "[esp]\nactive=%d\nbind=%d\nneutral=%d\nhealthbar=%d\n" "healthnum=%d\nname=%d\nskeleton=%d\nbox=%d\nspeedgraph=%d\n" "dmg=%d\nalert=%d\nweapon=%d\narrows=%d\n" @@ -274,7 +283,8 @@ static bool config_load() { FeatureState *cur = nullptr; bool in_esp = false, in_bhop = false, in_aim = false, in_jumpbug = false, in_spread = false, in_items = false, - in_tint = false, in_fog = false, in_view = false, in_movement = false; + in_tint = false, in_fog = false, in_view = false, in_movement = false, + in_proj = false; while (fgets(line, sizeof(line), f)) { line[strcspn(line, "\r\n")] = 0; if (line[0] == '[') { @@ -300,6 +310,8 @@ static bool config_load() { cur = &g_fog; else if (strstr(line, "[skybox]")) cur = &g_skybox; + else if (strstr(line, "[projectiles]")) + cur = &g_projectiles; else if (strstr(line, "[aimbot]")) cur = &g_aimbot; else if (strstr(line, "[triggerbot]")) @@ -322,6 +334,7 @@ static bool config_load() { in_fog = (cur == &g_fog); in_view = strstr(line, "[view]") != nullptr; in_movement = strstr(line, "[movement]") != nullptr; + in_proj = (cur == &g_projectiles); } else if (cur || in_view || in_movement) { char *eq = strchr(line, '='); if (!eq) @@ -353,6 +366,8 @@ static bool config_load() { g_item_crates = atoi(val) != 0; else if (strcmp(key, "distance") == 0) g_item_distance = atoi(val) != 0; + else if (strcmp(key, "usable") == 0) + g_item_usable = atoi(val) != 0; else if (strcmp(key, "max_dist") == 0) { int v = atoi(val); if (v < 0) v = 0; // 0 = unlimited @@ -360,6 +375,12 @@ static bool config_load() { g_item_max_dist = v; } } + if (in_proj) { + if (strcmp(key, "fuse") == 0) + g_proj_fuse = atoi(val) != 0; + else if (strcmp(key, "radius") == 0) + g_proj_radius = atoi(val) != 0; + } if (in_aim) { if (strcmp(key, "smooth") == 0) { int v = atoi(val); @@ -581,12 +602,16 @@ void config_reset_defaults() { g_fog_start = 200; g_fog_end = 3000; g_skybox = {false, 0}; + g_projectiles = {true, 0}; + g_proj_fuse = true; + g_proj_radius = true; g_item_health = true; g_item_ammo = true; g_item_armor = true; g_item_weapons = true; g_item_crates = true; g_item_distance = true; + g_item_usable = true; g_item_max_dist = 5000; g_aimbot = {true, 604}; g_triggerbot = {true, 603}; @@ -713,7 +738,7 @@ static FeatureState *feature_state(int feature) { static FeatureState *feats[FEAT_COUNT] = { &g_bhop, &g_abh, &g_esp, &g_aimbot, &g_triggerbot, &g_silentaim, &g_jumpbug, &g_melee, &g_spread, &g_item_esp, - &g_fullbright, &g_world_tint, &g_fog, &g_skybox}; + &g_fullbright, &g_world_tint, &g_fog, &g_skybox, &g_projectiles}; if (feature < 0 || feature >= FEAT_COUNT) return nullptr; return feats[feature]; @@ -940,9 +965,11 @@ void outer_draw() { static bool draw_test = getenv("HL2H_DRAW_TEST") != nullptr; bool esp_on = feature_active(FEAT_ESP); bool items_on = feature_active(FEAT_ITEM_ESP); + bool projs_on = feature_active(FEAT_PROJECTILES); bool toasts = gui_toasts_active(); if (!g_surface || - (!gui_is_open() && !draw_test && !esp_on && !items_on && !toasts)) + (!gui_is_open() && !draw_test && !esp_on && !items_on && !projs_on && + !toasts)) return; // Level/menu -> game transitions can invalidate the VGUI font handle. @@ -1007,6 +1034,8 @@ void outer_draw() { esp_draw(); if (items_on && overlay_font) esp_draw_items(); + if (projs_on && overlay_font) + esp_draw_projectiles(); if (draw_test && overlay_font) { surf_draw_set_color(255, 0, 0, 255); surf_draw_filled_rect(20, 20, 180, 60); -- cgit v1.2.3