summaryrefslogtreecommitdiffstats
path: root/src/esp.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-04 18:58:13 +0100
committersalmonik <salmonik@tuta.io>2026-11-04 18:58:13 +0100
commit5ddc9eb9d02ddc84e4c3a45bdcb2941513fb0346 (patch)
treec83aa673488b0628e0f63cdc8b82e45c7693be9d /src/esp.cpp
parentChams: apply model-safe styles to the viewmodel (diff)
downloadhl2h-5ddc9eb9d02ddc84e4c3a45bdcb2941513fb0346.tar.gz
hl2h-5ddc9eb9d02ddc84e4c3a45bdcb2941513fb0346.zip
Chams: per-relationship, visible/invisible styles and viewmodel
- Hostile/neutral/friendly each have independent visible and through-wall settings: enable, style and colour. Viewmodel has its own enable/style/colour. - Styles: Flat, Wireframe, Additive, Solid, White, Fullbright, Glow outline. Additive uses the model solid material + ADDITIVE flag (the VGUI additive was invisible on NPCs). White/fullbright are solid-based, so the viewmodel no longer disappears/checkerboards. Glow outline adds a wireframe contour pass for depth. - Config: [chams] active/bind, [chams_hostile|neutral|friendly] vis/inv settings, [chams_vm]. GUI sections for each group.
Diffstat (limited to 'src/esp.cpp')
-rw-r--r--src/esp.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/esp.cpp b/src/esp.cpp
index 1631df1..d32a8bc 100644
--- a/src/esp.cpp
+++ b/src/esp.cpp
@@ -187,6 +187,26 @@ bool esp_is_viewmodel_index(int idx) {
187 return model && (strstr(model, "/v_") || strstr(model, "\\v_")); 187 return model && (strstr(model, "/v_") || strstr(model, "\\v_"));
188} 188}
189 189
190// 0 = hostile, 1 = neutral, 2 = friendly, -1 = not an NPC.
191static bool npc_is_friendly(int idx, const char *model, int local_idx,
192 bool &neutral);
193int esp_npc_relation(int idx) {
194 if (!esp_is_npc_index(idx))
195 return -1;
196 int local = engine_get_local_player();
197 if (local <= 0)
198 return 0;
199 void *ent = entitylist_get(idx);
200 const char *model = ent ? entity_model_name(ent) : nullptr;
201 bool neutral = false;
202 bool friendly = npc_is_friendly(idx, model, local, neutral);
203 if (neutral)
204 return 1;
205 if (friendly)
206 return 2;
207 return 0;
208}
209
190static bool model_is_friendly(const char *m) { 210static bool model_is_friendly(const char *m) {
191 static const char *patterns[] = { 211 static const char *patterns[] = {
192 "citizen", "humans/", "male_", "female_", "barney", "alyx", 212 "citizen", "humans/", "male_", "female_", "barney", "alyx",