summaryrefslogtreecommitdiffstats
path: root/src/esp.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-04 11:28:49 +0100
committersalmonik <salmonik@tuta.io>2026-11-04 11:28:49 +0100
commitfd9fb062a3e8bfabb48d2fd9db90a00c0bcc53a2 (patch)
treef8929520e9e7bac37f9dab8fbe28f6994bba64a3 /src/esp.cpp
parentWorld tint: include props/ materials; log static studio draws (diff)
downloadhl2h-fd9fb062a3e8bfabb48d2fd9db90a00c0bcc53a2.tar.gz
hl2h-fd9fb062a3e8bfabb48d2fd9db90a00c0bcc53a2.zip
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.
Diffstat (limited to '')
-rw-r--r--src/esp.cpp51
1 files changed, 4 insertions, 47 deletions
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) {
1405 return false; 1405 return false;
1406} 1406}
1407 1407
1408// Tints dynamic props by writing their client render colour. StudioRender 1408// Props are tinted through IStudioRender (studio.cpp), which covers both
1409// uses m_clrRender as the per-model colour modulation, which is why changing 1409// dynamic prop_physics entities and map-static props. There is no per-entity
1410// the prop MATERIAL colour had no effect. 1410// netvar write here: m_clrRender resolved to offset 0 in this build.
1411void prop_tint_update() { 1411void prop_tint_update() {
1412 static bool applied = false; 1412 if (feature_active(FEAT_WORLD_TINT) && g_tint_prop_on)
1413 static bool logged_missing = false;
1414 static bool logged_touched = false;
1415 bool on = feature_active(FEAT_WORLD_TINT) && g_tint_prop_on;
1416 if (on)
1417 studio_props_init(); 1413 studio_props_init();
1418 if (!on && !applied)
1419 return;
1420 if (!g_iface.entitylist || g_net.clr_render < 0) {
1421 if (on && !logged_missing) {
1422 logged_missing = true;
1423 logf("prop tint: m_clrRender unavailable");
1424 }
1425 return;
1426 }
1427 static double last = 0.0;
1428 double now = esp_now();
1429 if (on && now - last < 0.01)
1430 return;
1431 last = now;
1432
1433 using Fn = int (*)(void *);
1434 int hi = vfunc<Fn>(g_iface.entitylist, 6)(g_iface.entitylist);
1435 if (hi < 0 || hi > 4096)
1436 hi = 4096;
1437 uint32_t col =
1438 on ? ((uint32_t)g_tint_prop_rgb[0] | ((uint32_t)g_tint_prop_rgb[1] << 8) |
1439 ((uint32_t)g_tint_prop_rgb[2] << 16) | (255u << 24))
1440 : 0xFFFFFFFFu;
1441 int touched = 0;
1442 for (int idx = 1; idx <= hi; idx++) {
1443 void *ent = entitylist_get(idx);
1444 if (!ent)
1445 continue;
1446 const char *model = entity_model_name(ent);
1447 if (!model || strncmp(model, "models/props", 12) != 0)
1448 continue;
1449 *(uint32_t *)((uintptr_t)ent + (uintptr_t)g_net.clr_render) = col;
1450 touched++;
1451 }
1452 applied = on;
1453 if (on && touched > 0 && !logged_touched) {
1454 logged_touched = true;
1455 logf("prop tint: %d prop entities", touched);
1456 }
1457} 1414}
1458 1415
1459void esp_draw() { 1416void esp_draw() {