From 9904891162a6749d39110110c0812a64c241a7ea Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 27 Oct 2026 21:22:47 +0100 Subject: Remove stucklaunch; add valuable-item ESP - Drop the stucklaunch feature, its settings, diagnostics and m_hGroundEntity resolution. - Add a Visuals feature that scans the client entity list for valuable pickups: health/medkits/chargers, ammo boxes/crates/grenades, batteries, HEV suit modules/chargers, supply crates and generic items. - Model-first classification with class fallbacks; category toggles, distance labels and a max-distance slider. - Draw colored marker/label tags through walls, independent of the hostile NPC ESP. - Persist [items] active/bind/health/ammo/armor/crates/distance/max_dist; Reset restores defaults; GUI card and CONTEXT updated. --- src/esp.cpp | 318 ++++++++++++++++++++++++++++++++++++++++++++------------ src/gui.cpp | 32 +++--- src/hl2h.cpp | 93 +---------------- src/hl2h.h | 24 ++--- src/menu.cpp | 84 ++++++++------- src/netvars.cpp | 5 +- 6 files changed, 328 insertions(+), 228 deletions(-) (limited to 'src') diff --git a/src/esp.cpp b/src/esp.cpp index ca7bae0..d10a2cf 100644 --- a/src/esp.cpp +++ b/src/esp.cpp @@ -1132,71 +1132,6 @@ static void spread_compute() { g_spread_ready = true; } -static bool icontains(const char *hay, const char *needle) { - if (!hay || !needle || !*needle) - return false; - size_t n = strlen(needle); - for (const char *p = hay; *p; p++) - if (strncasecmp(p, needle, n) == 0) - return true; - return false; -} - -bool entity_is_physics_prop(int idx) { - if (idx <= 0 || idx > 4096) - return false; - void *ent = entitylist_get(idx); - if (!ent) - return false; - int mt = -1; - // The reliable signal: physics objects use MOVETYPE_VPHYSICS. The client - // class is CPhysicsProp / CPhysBox, not the server's prop_physics name. - if (g_net.movetype >= 0) { - mt = *(int *)((uintptr_t)ent + g_net.movetype); - if (mt == MOVETYPE_VPHYSICS) - return true; - } - void *net = entity_networkable(idx); - const char *cls = net ? entity_class_name(net, nullptr) : nullptr; - const char *model = entity_model_name(ent); - bool is_prop = icontains(cls, "physicsprop") || icontains(cls, "physbox") || - icontains(cls, "prop_physics") || - icontains(model, "props_junk") || - icontains(model, "props_physics") || - icontains(model, "props_c17") || - icontains(model, "props_interiors") || - icontains(model, "props_lab"); - if (!is_prop) { - static int miss_logs = 0; - if (miss_logs < 6) { - miss_logs++; - logf("stucklaunch prop? idx=%d movetype=%d cls=%s model=%s", idx, mt, - cls ? cls : "?", model ? model : "?"); - } - } - return is_prop; -} - -bool active_weapon_is_gravity_gun(void *local_ent) { - if (!local_ent || g_net.activeweapon < 0) - return false; - uint32_t h = *(uint32_t *)((uintptr_t)local_ent + g_net.activeweapon); - if (h == 0xFFFFFFFFu) - return false; - int idx = (int)(h & 0xFFFF); - if (idx <= 0 || idx > 4096) - return false; - void *wep = entitylist_get(idx); - void *net = entity_networkable(idx); - const char *cls = net ? entity_class_name(net, nullptr) : nullptr; - const char *model = wep ? entity_model_name(wep) : nullptr; - if (cls && strstr(cls, "physcannon")) - return true; - if (model && (strstr(model, "physcannon") || strstr(model, "w_physics"))) - return true; - return false; -} - static bool active_weapon_is_shotgun(void *local_ent) { if (!local_ent || g_net.activeweapon < 0) return false; @@ -1402,3 +1337,256 @@ void esp_draw() { draw_speed_graph(); } + + +// --------------------------------------------------------------------------- +// Valuable item tags +// --------------------------------------------------------------------------- + +enum ItemKind { IK_HEALTH, IK_AMMO, IK_ARMOR, IK_CRATE, IK_OTHER }; + +struct ItemTarget { + int idx; + int kind; + Vector origin; + char label[48]; +}; + +static ItemTarget g_item_targets[192]; +static int g_nitems = 0; +static bool g_items_logged = false; + +static bool item_icontains(const char *hay, const char *needle) { + if (!hay || !needle || !*needle) + return false; + size_t n = strlen(needle); + for (const char *p = hay; *p; p++) + if (strncasecmp(p, needle, n) == 0) + return true; + return false; +} + +static int classify_item(const char *model, const char *cls, char *label, + size_t outn) { + if (!model && !cls) + return -1; + + if (item_icontains(model, "healthkit")) { + snprintf(label, outn, "Medkit"); + return IK_HEALTH; + } + if (item_icontains(model, "healthvial")) { + snprintf(label, outn, "Health vial"); + return IK_HEALTH; + } + if (item_icontains(model, "health_charger")) { + snprintf(label, outn, "Health charger"); + return IK_HEALTH; + } + if (item_icontains(model, "battery")) { + snprintf(label, outn, "Battery"); + return IK_ARMOR; + } + if (item_icontains(model, "hevsuit")) { + snprintf(label, outn, "HEV suit"); + return IK_ARMOR; + } + if (item_icontains(model, "w_longjump")) { + snprintf(label, outn, "Long jump"); + return IK_ARMOR; + } + if (item_icontains(model, "suit_charger")) { + snprintf(label, outn, "Suit charger"); + return IK_ARMOR; + } + if (item_icontains(model, "item_item_crate") || + item_icontains(model, "item_beacon_crate")) { + snprintf(label, outn, "Supply crate"); + return IK_CRATE; + } + if (item_icontains(model, "ammocrate")) { + snprintf(label, outn, "Ammo crate"); + return IK_AMMO; + } + if (item_icontains(model, "w_missile_closed")) { + snprintf(label, outn, "RPG ammo"); + return IK_AMMO; + } + if (item_icontains(model, "models/items/")) { + if (item_icontains(model, "crossbowrounds")) + snprintf(label, outn, "Crossbow bolts"); + else if (item_icontains(model, "ar2_grenade")) + snprintf(label, outn, "AR2 grenade"); + else if (item_icontains(model, "357ammo")) + snprintf(label, outn, "357 ammo"); + else if (item_icontains(model, "boxbuckshot")) + snprintf(label, outn, "Buckshot"); + else if (item_icontains(model, "boxsniperrounds")) + snprintf(label, outn, "Sniper ammo"); + else + snprintf(label, outn, "Ammo"); + return IK_AMMO; + } + + if (item_icontains(cls, "healthkit") || item_icontains(cls, "healthvial") || + item_icontains(cls, "wallhealth")) { + snprintf(label, outn, "Health"); + return IK_HEALTH; + } + if (item_icontains(cls, "battery") || item_icontains(cls, "itemsuit") || + item_icontains(cls, "recharge")) { + snprintf(label, outn, "Armor"); + return IK_ARMOR; + } + if (item_icontains(cls, "itemcrate") || + item_icontains(cls, "dynamicresupply")) { + snprintf(label, outn, "Supply crate"); + return IK_CRATE; + } + if (item_icontains(cls, "item_ammo") || item_icontains(cls, "itemammo")) { + snprintf(label, outn, "Ammo"); + return IK_AMMO; + } + if (item_icontains(cls, "item") || item_icontains(cls, "pickup")) { + snprintf(label, outn, "Item"); + return IK_OTHER; + } + return -1; +} + +static bool item_kind_enabled(int kind) { + switch (kind) { + case IK_HEALTH: return g_item_health; + case IK_AMMO: return g_item_ammo; + case IK_ARMOR: return g_item_armor; + case IK_CRATE: return g_item_crates; + default: return true; + } +} + +static void items_collect(int local_idx) { + static double last_scan = 0.0; + double now = esp_now(); + if (now - last_scan < 0.10) + return; + last_scan = now; + g_nitems = 0; + if (!g_iface.entitylist || g_net.origin < 0 || g_net.modelindex < 0) + return; + + using Fn = int (*)(void *); + int hi = vfunc(g_iface.entitylist, 6)(g_iface.entitylist); + if (hi < 0 || hi > 4096) + hi = 4096; + + static int dbg_lines = 0; + for (int idx = 1; idx <= hi && g_nitems < 192; idx++) { + if (idx == local_idx) + continue; + void *ent = entitylist_get(idx); + if (!ent) + continue; + void *net = entity_networkable(idx); + if (!net) + continue; + const char *cls = entity_class_name(net, nullptr); + const char *model = entity_model_name(ent); + char label[48]; + int kind = classify_item(model, cls, label, sizeof(label)); + if (kind < 0) + continue; + + Vector origin{*(float *)((uintptr_t)ent + g_net.origin), + *(float *)((uintptr_t)ent + g_net.origin + 4), + *(float *)((uintptr_t)ent + g_net.origin + 8)}; + float dx = origin.x - g_cam_eye.x; + float dy = origin.y - g_cam_eye.y; + float dz = origin.z - g_cam_eye.z; + float dist = sqrtf(dx * dx + dy * dy + dz * dz); + if (g_item_max_dist > 0 && dist > (float)g_item_max_dist) + continue; + + ItemTarget &t = g_item_targets[g_nitems++]; + t.idx = idx; + t.kind = kind; + t.origin = origin; + snprintf(t.label, sizeof(t.label), "%s", label); + if (dbg_lines < 8) { + dbg_lines++; + logf("item: idx=%d kind=%d cls=%s model=%s", idx, kind, + cls ? cls : "?", model ? model : "?"); + } + } + + if (!g_items_logged) { + g_items_logged = true; + logf("items: tagging %d valuable entities", g_nitems); + } +} + +void esp_draw_items() { + if (!g_surface || !g_iface.entitylist || g_net.origin < 0) + return; + if (!g_item_health && !g_item_ammo && !g_item_armor && !g_item_crates) + return; + int local = engine_get_local_player(); + if (local <= 0) + return; + if (!g_scr_w) { + using Fn = void (*)(void *, int &, int &); + vfunc(g_surface, SURF_GetScreenSize)(g_surface, g_scr_w, g_scr_h); + if (!g_scr_w) + return; + } + items_collect(local); + + for (int i = 0; i < g_nitems; i++) { + const ItemTarget &t = g_item_targets[i]; + if (!item_kind_enabled(t.kind)) + continue; + float sx, sy; + if (!world_to_screen(t.origin, sx, sy)) + continue; + if (sx < -40 || sx > (float)g_scr_w + 40 || sy < -20 || + sy > (float)g_scr_h + 20) + continue; + + int r = 230, g = 230, b = 230; + switch (t.kind) { + case IK_HEALTH: r = 90; g = 255; b = 130; break; + case IK_AMMO: r = 255; g = 210; b = 80; break; + case IK_ARMOR: r = 90; g = 180; b = 255; break; + case IK_CRATE: r = 220; g = 150; b = 255; break; + default: break; + } + int x = (int)sx, y = (int)sy; + surf_color(r, g, b, 255); + surf_rect(0, x - 4, y - 4, x + 4, y + 4); + surf_line(x - 8, y, x - 5, y); + surf_line(x + 5, y, x + 8, y); + surf_line(x, y - 8, x, y - 5); + surf_line(x, y + 5, x, y + 8); + + float dx = t.origin.x - g_cam_eye.x; + float dy = t.origin.y - g_cam_eye.y; + float dz = t.origin.z - g_cam_eye.z; + int dist = (int)sqrtf(dx * dx + dy * dy + dz * dz); + char text[96]; + if (g_item_distance) + snprintf(text, sizeof(text), "%s %du", t.label, dist); + else + snprintf(text, sizeof(text), "%s", t.label); + int tw = (int)strlen(text) * 9; + int tx = x + 10; + if (tx + tw > g_scr_w - 4) + tx = x - 10 - tw; + if (tx < 4) + tx = 4; + int ty = y - 7; + if (ty < 0) + ty = 0; + if (ty + 16 > g_scr_h) + ty = g_scr_h - 16; + draw_text_col(tx, ty, text, r, g, b); + } +} diff --git a/src/gui.cpp b/src/gui.cpp index 156e496..eb9a964 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -299,21 +299,6 @@ static void build_cards() { add_card(0, &g_abh, "ABH", "Accelerate on the jump tick by facing away " "from the velocity.", true); - int sl = add_card(0, &g_stucklaunch, "Stucklaunch", - "Hop on a physics prop while spamming grab to build " - "speed in a small space.", - true); - add_toggle(sl, "Use spam", - "Rapidly press +use to keep regrabbing the prop.", - &g_stucklaunch_use_spam); - add_toggle(sl, "Gravity gun spam", - "Alternate +attack and +use while holding the gravity gun.", - &g_stucklaunch_gravspam); - add_toggle(sl, "Auto-strafe", "Air-strafe each hop.", - &g_stucklaunch_autostrafe); - add_slider(sl, "Spam rate", "Ticks between spam toggles; higher is slower.", - 1, 16, &g_stucklaunch_spam_ticks); - int jb = add_card(0, &g_jumpbug, "Jumpbug", "Duck+jump when landing would hurt.", true); add_toggle(jb, "Assist timing", @@ -364,6 +349,23 @@ static void build_cards() { for (int i = 0; i < ESP_OPT_COUNT; i++) add_toggle(esp, esp_names[i], esp_descs[i], &g_esp_opt[i]); + int items = add_card(2, &g_item_esp, "Valuable items", + "Tag medkits, ammo, armor and supply crates.", true); + add_toggle(items, "Medkits / health", + "Tag health kits, health vials and health chargers.", + &g_item_health); + add_toggle(items, "Ammo", "Tag ammo boxes, crates and grenades.", + &g_item_ammo); + add_toggle(items, "Armor / suit", "Tag batteries, HEV suits and chargers.", + &g_item_armor); + add_toggle(items, "Supply crates", "Tag item and beacon crates.", + &g_item_crates); + 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, 5000, + &g_item_max_dist); + int spread = add_card(3, &g_spread, "Spread control", "Choose a server shot seed that tightens the cone.", true); diff --git a/src/hl2h.cpp b/src/hl2h.cpp index defdd27..c51d35e 100644 --- a/src/hl2h.cpp +++ b/src/hl2h.cpp @@ -169,75 +169,6 @@ static void apply_autostrafe(CUserCmd *cmd, const float *vel) { cmd->sidemove = (dx * rx + dy * ry) * 450.0f; } -// True while the player stands on (or just left) a physics prop. m_hGroundEntity -// is latched briefly because it clears during each hop. -static bool stucklaunch_prop_ok(void *ent, int tick) { - if (g_net.groundentity < 0) { - static bool logged = false; - if (!logged) { - logged = true; - logf("stucklaunch: m_hGroundEntity unavailable; prop detection off"); - } - return true; // no netvar: the bind is the only safeguard - } - static int last_prop_tick = -100000; - uint32_t h = *(uint32_t *)((uintptr_t)ent + g_net.groundentity); - int gi = (h == 0xFFFFFFFFu) ? 0 : (int)(h & 0xFFFF); - bool on = gi > 0 && gi <= 4096 && entity_is_physics_prop(gi); - if (on) { - static int prop_logs = 0; - if (prop_logs < 4) { - prop_logs++; - logf("stucklaunch: prop idx=%d engaged", gi); - } - last_prop_tick = tick; - } else { - static int miss_logs = 0; - if (miss_logs < 4) { - miss_logs++; - logf("stucklaunch: ground h=%#x idx=%d is not a physics prop", h, gi); - } - } - return tick - last_prop_tick < 32; // ~0.5 s at 66 tick -} - -// Stucklaunch assist. The player supplies the physics prop and a little -// initial speed; this holds jump, alternates +use (and optionally the gravity -// gun's +attack) to keep regrabbing the prop, and air-strafes the hops. -static void stucklaunch_apply(CUserCmd *cmd, void *local_ent, bool onground, - const float *vel) { - static bool engaged_logged = false; - if (!engaged_logged) { - engaged_logged = true; - logf("stucklaunch: applying jump/spam (onground=%d)", (int)onground); - } - cmd->buttons |= IN_JUMP; - int period = stucklaunch_spam_ticks(); - if (period < 1) - period = 1; - int phase = (cmd->tick_count / period) & 1; - bool gravity = stucklaunch_gravspam_enabled() && - active_weapon_is_gravity_gun(local_ent); - if (gravity) { - // Pick up with +attack, drop with +use on the next half-cycle. Pressing - // both together would punt instead of regrabbing. - if (phase == 0) { - cmd->buttons |= IN_ATTACK; - cmd->buttons &= ~IN_USE; - } else { - cmd->buttons |= IN_USE; - cmd->buttons &= ~IN_ATTACK; - } - } else if (stucklaunch_use_spam_enabled()) { - if (phase == 0) - cmd->buttons |= IN_USE; - else - cmd->buttons &= ~IN_USE; - } - if (stucklaunch_autostrafe_enabled() && !onground) - apply_autostrafe(cmd, vel); -} - // --------------------------------------------------------------------------- // jumpbug // --------------------------------------------------------------------------- @@ -645,23 +576,8 @@ static void do_move(int seq, float frametime) { return; } - bool stuck_on = feature_active(FEAT_STUCKLAUNCH); - if (g_stucklaunch.active) { - static bool state_logged = false; - if (!state_logged) { - state_logged = true; - logf("stucklaunch: active=1 run=%d bind=%d groundoff=%d", - (int)stuck_on, g_stucklaunch.bind, g_net.groundentity); - } - } - bool stuck_engaged = stuck_on && stucklaunch_prop_ok(ent, cmd->tick_count); - if (stuck_engaged) { - stucklaunch_apply(cmd, ent, onground, vel); - note_modified(cmd, flags, vel); - } - - bool bhop_on = !stuck_engaged && feature_active(FEAT_BHOP); - bool abh_on = !stuck_engaged && feature_active(FEAT_ABH); + bool bhop_on = feature_active(FEAT_BHOP); + bool abh_on = feature_active(FEAT_ABH); static bool lastground = false; @@ -712,8 +628,7 @@ static void do_move(int seq, float frametime) { } } - if (!stuck_engaged && - jumpbug_apply(cmd, localIdx, ent, flags, vel, frametime)) + if (jumpbug_apply(cmd, localIdx, ent, flags, vel, frametime)) note_modified(cmd, flags, vel); bool melee = feature_active(FEAT_MELEE) && melee_weapon_active(ent); @@ -951,8 +866,6 @@ static void *setup_thread(void *) { toastf(TOAST_ERROR, "Netvars incomplete; features may be disabled"); else if (g_net.absvelocity < 0) toastf(TOAST_WARN, "Jumpbug assist disabled: velocity netvar missing"); - if (g_net.groundentity < 0) - toastf(TOAST_WARN, "Stucklaunch prop detection unavailable; bind it"); if (!g_iface.engineserver) toastf(TOAST_WARN, "Server interfaces missing; jumpbug/spread limited"); if (!g_iface.debugoverlay) diff --git a/src/hl2h.h b/src/hl2h.h index d6729cb..8aeef7a 100644 --- a/src/hl2h.h +++ b/src/hl2h.h @@ -92,7 +92,6 @@ struct NetVars { int modelindex = -1; int absvelocity = -1; // client C_BaseEntity::m_vecAbsVelocity (prediction) int activeweapon = -1; // client m_hActiveWeapon handle - int groundentity = -1; // client m_hGroundEntity handle // ponytail: mins/maxs may be absent from some HL2 netvar tables; esp.cpp falls back to h=72 bool ok() const { return flags >= 0 && velocity >= 0 && movetype >= 0; } // ponytail: m_iMaxHealth isn't a netvar in HL2 SP; esp.cpp falls back to 100. @@ -141,7 +140,7 @@ struct CUserCmd { enum { IN_ATTACK = 1 << 0, IN_JUMP = 1 << 1, IN_DUCK = 1 << 2, IN_USE = 1 << 5, IN_ATTACK2 = 1 << 11, IN_SPEED = 1 << 17 }; enum { FL_ONGROUND = 1 << 0, FL_DUCKING = 1 << 1, FL_INWATER = 1 << 9 }; -enum { MOVETYPE_WALK = 2, MOVETYPE_VPHYSICS = 6, MOVETYPE_NOCLIP = 8, MOVETYPE_LADDER = 9 }; +enum { MOVETYPE_WALK = 2, MOVETYPE_NOCLIP = 8, MOVETYPE_LADDER = 9 }; // --------------------------------------------------------------------------- // vector math @@ -173,7 +172,7 @@ enum FeatureId { FEAT_JUMPBUG = 6, FEAT_MELEE = 7, FEAT_SPREAD = 8, - FEAT_STUCKLAUNCH = 9, + FEAT_ITEM_ESP = 9, FEAT_COUNT = 10 }; enum EspOption { @@ -206,14 +205,16 @@ struct FeatureState { }; extern FeatureState g_bhop, g_abh, g_jumpbug, g_melee, g_spread, g_esp, - g_aimbot, g_triggerbot, g_silentaim, g_stucklaunch; + g_aimbot, g_triggerbot, g_silentaim, g_item_esp; extern bool g_bhop_autostrafe; extern bool g_jumpbug_assist; extern bool g_spread_no_spread; -extern bool g_stucklaunch_use_spam; -extern bool g_stucklaunch_gravspam; -extern bool g_stucklaunch_autostrafe; -extern int g_stucklaunch_spam_ticks; +extern bool g_item_health; +extern bool g_item_ammo; +extern bool g_item_armor; +extern bool g_item_crates; +extern bool g_item_distance; +extern int g_item_max_dist; extern bool g_aim_bones[AIM_BONE_COUNT]; extern int g_aim_smooth; extern bool g_aim_vischeck; @@ -252,12 +253,6 @@ bool esp_option(int opt); bool bhop_autostrafe_enabled(); bool jumpbug_assist_enabled(); bool spread_no_spread_enabled(); -bool stucklaunch_use_spam_enabled(); -bool stucklaunch_gravspam_enabled(); -bool stucklaunch_autostrafe_enabled(); -int stucklaunch_spam_ticks(); -bool active_weapon_is_gravity_gun(void *local_ent); -bool entity_is_physics_prop(int idx); unsigned aimbot_bone_mask(); int aimbot_smooth_step(); bool aimbot_vischeck_enabled(); @@ -270,6 +265,7 @@ void *entitylist_get(int idx); int engine_get_local_player(); void draw_text_col(int x, int y, const char *s, int r, int g, int b); void esp_draw(); +void esp_draw_items(); bool world_to_screen(const Vector &w, float &sx, float &sy); void set_silent_restore(const QAngle &angles); bool is_visible(const Vector &eye, const Vector &point); diff --git a/src/menu.cpp b/src/menu.cpp index cc3890a..af8d10d 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -44,11 +44,13 @@ FeatureState g_esp{true, 0}; FeatureState g_aimbot{true, 604}; // default Mouse5, rebindable in the GUI FeatureState g_triggerbot{true, 603}; // default Mouse4 FeatureState g_silentaim{true, 602}; // default Mouse3 -FeatureState g_stucklaunch{false, 0}; // opt-in movement assist -bool g_stucklaunch_use_spam = true; -bool g_stucklaunch_gravspam = false; -bool g_stucklaunch_autostrafe = true; -int g_stucklaunch_spam_ticks = 2; +FeatureState g_item_esp{true, 0}; // valuable item tags, always-on by default +bool g_item_health = true; +bool g_item_ammo = true; +bool g_item_armor = true; +bool g_item_crates = true; +bool g_item_distance = true; +int g_item_max_dist = 2500; // Aimbot bone checklist. Head defaults on (v1 behaviour). bool g_aim_bones[AIM_BONE_COUNT] = {true, false, false, @@ -163,11 +165,6 @@ void config_save() { fprintf(f, "[bhop]\nactive=%d\nbind=%d\nautostrafe=%d\n", g_bhop.active, g_bhop.bind, g_bhop_autostrafe); fprintf(f, "[abh]\nactive=%d\nbind=%d\n", g_abh.active, g_abh.bind); - fprintf(f, "[stucklaunch]\nactive=%d\nbind=%d\nuse_spam=%d\n" - "gravspam=%d\nautostrafe=%d\nspam_ticks=%d\n", - g_stucklaunch.active, g_stucklaunch.bind, - (int)g_stucklaunch_use_spam, (int)g_stucklaunch_gravspam, - (int)g_stucklaunch_autostrafe, g_stucklaunch_spam_ticks); fprintf(f, "[jumpbug]\nactive=%d\nbind=%d\nassist=%d\n", g_jumpbug.active, g_jumpbug.bind, (int)g_jumpbug_assist); fprintf(f, "[melee]\nactive=%d\nbind=%d\n", g_melee.active, g_melee.bind); @@ -186,6 +183,11 @@ void config_save() { g_triggerbot.bind); fprintf(f, "[silentaim]\nactive=%d\nbind=%d\nfov=%d\n", g_silentaim.active, g_silentaim.bind, g_silent_fov); + fprintf(f, "[items]\nactive=%d\nbind=%d\nhealth=%d\nammo=%d\n" + "armor=%d\ncrates=%d\ndistance=%d\nmax_dist=%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_crates, + (int)g_item_distance, g_item_max_dist); fprintf(f, "[esp]\nactive=%d\nbind=%d\nneutral=%d\nhealthbar=%d\n" "healthnum=%d\nname=%d\nskeleton=%d\nbox=%d\nspeedgraph=%d\n", g_esp.active, g_esp.bind, g_esp_opt[ESP_OPT_SHOW_NEUTRAL], @@ -214,7 +216,7 @@ static bool config_load() { char line[256]; FeatureState *cur = nullptr; bool in_esp = false, in_bhop = false, in_aim = false, in_silent = false, - in_jumpbug = false, in_spread = false, in_stucklaunch = false; + in_jumpbug = false, in_spread = false, in_items = false; while (fgets(line, sizeof(line), f)) { line[strcspn(line, "\r\n")] = 0; if (line[0] == '[') { @@ -222,8 +224,6 @@ static bool config_load() { cur = &g_bhop; else if (strstr(line, "[abh]")) cur = &g_abh; - else if (strstr(line, "[stucklaunch]")) - cur = &g_stucklaunch; else if (strstr(line, "[jumpbug]")) cur = &g_jumpbug; else if (strstr(line, "[melee]")) @@ -232,6 +232,8 @@ static bool config_load() { cur = &g_spread; else if (strstr(line, "[esp]")) cur = &g_esp; + else if (strstr(line, "[items]")) + cur = &g_item_esp; else if (strstr(line, "[aimbot]")) cur = &g_aimbot; else if (strstr(line, "[triggerbot]")) @@ -246,7 +248,7 @@ static bool config_load() { in_silent = (cur == &g_silentaim); in_jumpbug = (cur == &g_jumpbug); in_spread = (cur == &g_spread); - in_stucklaunch = (cur == &g_stucklaunch); + in_items = (cur == &g_item_esp); } else if (cur) { char *eq = strchr(line, '='); if (!eq) @@ -262,18 +264,22 @@ static bool config_load() { if (in_spread && strcmp(key, "no_spread") == 0) { g_spread_no_spread = atoi(val) != 0; } - if (in_stucklaunch) { - if (strcmp(key, "use_spam") == 0) - g_stucklaunch_use_spam = atoi(val) != 0; - else if (strcmp(key, "gravspam") == 0) - g_stucklaunch_gravspam = atoi(val) != 0; - else if (strcmp(key, "autostrafe") == 0) - g_stucklaunch_autostrafe = atoi(val) != 0; - else if (strcmp(key, "spam_ticks") == 0) { + if (in_items) { + if (strcmp(key, "health") == 0) + g_item_health = atoi(val) != 0; + else if (strcmp(key, "ammo") == 0) + g_item_ammo = atoi(val) != 0; + else if (strcmp(key, "armor") == 0) + g_item_armor = atoi(val) != 0; + else if (strcmp(key, "crates") == 0) + g_item_crates = atoi(val) != 0; + else if (strcmp(key, "distance") == 0) + g_item_distance = atoi(val) != 0; + else if (strcmp(key, "max_dist") == 0) { int v = atoi(val); - if (v < 1) v = 1; - if (v > 16) v = 16; - g_stucklaunch_spam_ticks = v; + if (v < 250) v = 250; + if (v > 5000) v = 5000; + g_item_max_dist = v; } } if (in_aim) { @@ -354,11 +360,6 @@ void config_reset_defaults() { g_bhop = {true, 0}; g_bhop_autostrafe = true; g_abh = {true, 0}; - g_stucklaunch = {false, 0}; - g_stucklaunch_use_spam = true; - g_stucklaunch_gravspam = false; - g_stucklaunch_autostrafe = true; - g_stucklaunch_spam_ticks = 2; g_jumpbug = {true, 0}; g_jumpbug_assist = false; g_melee = {true, 0}; @@ -367,6 +368,13 @@ void config_reset_defaults() { g_esp = {true, 0}; for (int i = 0; i < ESP_OPT_COUNT; i++) g_esp_opt[i] = true; + g_item_esp = {true, 0}; + g_item_health = true; + g_item_ammo = true; + g_item_armor = true; + g_item_crates = true; + g_item_distance = true; + g_item_max_dist = 2500; g_aimbot = {true, 604}; g_triggerbot = {true, 603}; g_silentaim = {true, 602}; @@ -476,7 +484,7 @@ static bool key_held(int sc) { 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_stucklaunch}; + &g_silentaim, &g_jumpbug, &g_melee, &g_spread, &g_item_esp}; if (feature < 0 || feature >= FEAT_COUNT) return nullptr; return feats[feature]; @@ -509,14 +517,6 @@ bool jumpbug_assist_enabled() { return g_jumpbug_assist; } bool spread_no_spread_enabled() { return g_spread_no_spread; } -bool stucklaunch_use_spam_enabled() { return g_stucklaunch_use_spam; } - -bool stucklaunch_gravspam_enabled() { return g_stucklaunch_gravspam; } - -bool stucklaunch_autostrafe_enabled() { return g_stucklaunch_autostrafe; } - -int stucklaunch_spam_ticks() { return g_stucklaunch_spam_ticks; } - unsigned aimbot_bone_mask() { unsigned m = 0; if (g_aim_bones[AIM_BONE_HEAD]) @@ -658,8 +658,10 @@ void outer_draw() { // HL2H_DRAW_TEST=1 draws a probe rect without needing the GUI open 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 toasts = gui_toasts_active(); - if (!g_surface || (!gui_is_open() && !draw_test && !esp_on && !toasts)) + if (!g_surface || + (!gui_is_open() && !draw_test && !esp_on && !items_on && !toasts)) return; // Level/menu -> game transitions can invalidate the VGUI font handle. @@ -709,6 +711,8 @@ void outer_draw() { surf_push_make_current(panel, false); if (esp_on && overlay_font) esp_draw(); + if (items_on && overlay_font) + esp_draw_items(); if (draw_test && overlay_font) { surf_draw_set_color(255, 0, 0, 255); surf_draw_filled_rect(20, 20, 180, 60); diff --git a/src/netvars.cpp b/src/netvars.cpp index e304317..3b2d3b8 100644 --- a/src/netvars.cpp +++ b/src/netvars.cpp @@ -92,9 +92,6 @@ static void collect_netvars(uintptr_t table, uintptr_t base_off, int depth) { } else if (strcmp(pname2, "m_hActiveWeapon") == 0 && g_net.activeweapon < 0) { g_net.activeweapon = (int)(base_off + (uint32_t)poff); - } else if (strcmp(pname2, "m_hGroundEntity") == 0 && - g_net.groundentity < 0) { - g_net.groundentity = (int)(base_off + (uint32_t)poff); } else if (strcmp(pname2, "m_iTeamNum") == 0 && g_net.teamnum < 0) { g_net.teamnum = (int)(base_off + (uint32_t)poff); } else if (strcmp(pname2, "m_vecOrigin") == 0 && g_net.origin < 0) { @@ -275,7 +272,7 @@ void resolve_netvars() { logf("m_vecAbsVelocity unresolved; jumpbug assist disabled"); logf("netvars: flags=%d velocity=%d movetype=%d health=%d maxhealth=%d " "teamnum=%d origin=%d viewoffset=%d mins=%d maxs=%d lifeste=%d " - "modelindex=%d absvelocity=%d activeweapon=%d groundentity=%d", + "modelindex=%d absvelocity=%d activeweapon=%d", g_net.flags, g_net.velocity, g_net.movetype, g_net.health, g_net.maxhealth, g_net.teamnum, g_net.origin, g_net.viewoffset, g_net.mins, g_net.maxs, g_net.lifestate, g_net.modelindex, -- cgit v1.2.3