From fd9fb062a3e8bfabb48d2fd9db90a00c0bcc53a2 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 11:28:49 +0100 Subject: Props: tint through DrawModel/DrawModelArray; drop m_clrRender writes m_clrRender resolved to offset 0 in this build; writing it stomped entity vtables instead of tinting anything. Remove that path. The static-prop logging showed DrawModelStaticProp is never called for these props, so hook the other studio draw entries as well: DrawModel (29) for entity models and DrawModelArray (46, the instanced static-prop path). Both read the model name from DrawModelInfo_t::m_pStudioHdr and force the prop colour for models/props* draws. --- src/esp.cpp | 51 ++++----------------------------------------------- 1 file changed, 4 insertions(+), 47 deletions(-) (limited to 'src/esp.cpp') diff --git a/src/esp.cpp b/src/esp.cpp index 67fbad2..1fd4904 100644 --- a/src/esp.cpp +++ b/src/esp.cpp @@ -1405,55 +1405,12 @@ bool triggerbot_apply(CUserCmd *cmd) { return false; } -// Tints dynamic props by writing their client render colour. StudioRender -// uses m_clrRender as the per-model colour modulation, which is why changing -// the prop MATERIAL colour had no effect. +// Props are tinted through IStudioRender (studio.cpp), which covers both +// dynamic prop_physics entities and map-static props. There is no per-entity +// netvar write here: m_clrRender resolved to offset 0 in this build. void prop_tint_update() { - static bool applied = false; - static bool logged_missing = false; - static bool logged_touched = false; - bool on = feature_active(FEAT_WORLD_TINT) && g_tint_prop_on; - if (on) + if (feature_active(FEAT_WORLD_TINT) && g_tint_prop_on) studio_props_init(); - if (!on && !applied) - return; - if (!g_iface.entitylist || g_net.clr_render < 0) { - if (on && !logged_missing) { - logged_missing = true; - logf("prop tint: m_clrRender unavailable"); - } - return; - } - static double last = 0.0; - double now = esp_now(); - if (on && now - last < 0.01) - return; - last = now; - - using Fn = int (*)(void *); - int hi = vfunc(g_iface.entitylist, 6)(g_iface.entitylist); - if (hi < 0 || hi > 4096) - hi = 4096; - uint32_t col = - on ? ((uint32_t)g_tint_prop_rgb[0] | ((uint32_t)g_tint_prop_rgb[1] << 8) | - ((uint32_t)g_tint_prop_rgb[2] << 16) | (255u << 24)) - : 0xFFFFFFFFu; - int touched = 0; - for (int idx = 1; idx <= hi; idx++) { - void *ent = entitylist_get(idx); - if (!ent) - continue; - const char *model = entity_model_name(ent); - if (!model || strncmp(model, "models/props", 12) != 0) - continue; - *(uint32_t *)((uintptr_t)ent + (uintptr_t)g_net.clr_render) = col; - touched++; - } - applied = on; - if (on && touched > 0 && !logged_touched) { - logged_touched = true; - logf("prop tint: %d prop entities", touched); - } } void esp_draw() { -- cgit v1.2.3