From b9d5965c0366fd7777c3627b9fbf89c8526ac0ec Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 01:13:09 +0100 Subject: World tint: colour dynamic props through m_clrRender Prop model materials (VertexLitGeneric) ignore IMaterial::ColorModulate: the engine feeds StudioRender the per-entity render colour (m_clrRender) on every draw, so the material-side tint never showed on crates and other props. Resolve m_clrRender from DT_BaseEntity and, every 10 ms while World tint and Props are enabled, write the prop colour into every entity whose model is under models/props. Restore white once when disabled. --- src/esp.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'src/esp.cpp') diff --git a/src/esp.cpp b/src/esp.cpp index 50d7b5d..9d041b0 100644 --- a/src/esp.cpp +++ b/src/esp.cpp @@ -1405,6 +1405,55 @@ 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. +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 && !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() { if (!g_surface || !g_iface.entitylist || !g_net.esp_ok()) return; if (!g_scr_w) { -- cgit v1.2.3