From 49df428d95a7c443d418d5b7e2a93af599b54f76 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 17:51:20 +0100 Subject: Add chams - Hook IVModelRender::DrawModelExecute (VEngineModel016 slot 19) and force models/debug/debugwhite for NPC models, identified by ModelRenderInfo_t::entity_index. - Two passes: MATERIAL_VAR_IGNOREZ through walls, then normal depth, with IMaterial::ColorModulate for the configured colour; restore the shared material's flag/colour afterwards. - Material lookup via the IMaterialSystem list, FindMaterial fallback. - New Chams feature/card with Through walls and colour; [chams] config. - Remove the temporary ammo/projectile/fuse diagnostics. --- src/esp.cpp | 41 ++++++++++------------------------------- 1 file changed, 10 insertions(+), 31 deletions(-) (limited to 'src/esp.cpp') diff --git a/src/esp.cpp b/src/esp.cpp index a12cf9c..b50dd87 100644 --- a/src/esp.cpp +++ b/src/esp.cpp @@ -163,6 +163,16 @@ static bool is_npc_class(const char *name) { strstr(name, "BaseHelicopter") != nullptr; } +// Used by the chams hook to decide whether a model-render entity is an NPC. +bool esp_is_npc_index(int idx) { + if (!g_iface.entitylist || idx <= 0 || idx > 8192) + return false; + void *net = entity_networkable(idx); + if (!net) + return false; + return is_npc_class(entity_class_name(net, nullptr)); +} + static bool model_is_friendly(const char *m) { static const char *patterns[] = { "citizen", "humans/", "male_", "female_", "barney", "alyx", @@ -2796,23 +2806,6 @@ void esp_draw_items() { if (g_item_usable) local_vitals(vit_hp, vit_max, vit_armor); - static bool ammo_logged = false; - if (!ammo_logged) { - ammo_logged = true; - void *le = entitylist_get(local); - char buf[512] = {}; - int used = 0; - for (int t = 0; t < 12 && used < (int)sizeof(buf) - 24; t++) { - int w = snprintf(buf + used, sizeof(buf) - (size_t)used, "%d=%d/%d ", t, - local_ammo(le, t), ammo_max(t)); - if (w < 0) - break; - used += w; - } - logf("items: ammo current/max %s(usable=%d my_weapons=%d ammo=%d)", buf, - (int)g_item_usable, g_net.my_weapons, g_net.ammo); - } - for (int i = 0; i < g_nitems; i++) { const ItemTarget &t = g_item_targets[i]; if (!item_kind_enabled(t.kind)) @@ -2830,12 +2823,6 @@ void esp_draw_items() { if (t.kind == IK_AMMO && t.ammo_type >= 0) { int maxa = ammo_max(t.ammo_type); int cura = local_ammo(entitylist_get(local), t.ammo_type); - static int flt_logs = 0; - if (flt_logs < 24) { - flt_logs++; - logf("items: ammo %s type=%d cur=%d max=%d", t.label, t.ammo_type, - cura, maxa); - } if (maxa > 0 && cura >= 0 && cura >= maxa) continue; } @@ -3021,14 +3008,6 @@ static void projs_collect(int local_idx) { p.fuse = -1.0f; } } - static int logs = 0; - if (logs < 8) { - logs++; - logf("projectile: idx=%d cls=%s model=%s kind=%s det=%.2f cur=%.2f " - "fuse=%.2f radius=%.0f", - idx, cls ? cls : "?", model, proj_name(kind), det, curtime, p.fuse, - p.radius); - } } } -- cgit v1.2.3