summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-04 11:32:47 +0100
committersalmonik <salmonik@tuta.io>2026-11-04 11:32:47 +0100
commit0aaf7b61a5c7bd63cf8cdeef8de76e5a609f4e61 (patch)
treec8b88d29d822a472ed5c1de5667c52fe7b945dfc /src
parentDiagnose prop tinting: log prop materials and studio draw model names (diff)
downloadhl2h-0aaf7b61a5c7bd63cf8cdeef8de76e5a609f4e61.tar.gz
hl2h-0aaf7b61a5c7bd63cf8cdeef8de76e5a609f4e61.zip
Props: match the studio model name format
studiohdr_t::name is not "models/props/...". In this build it is the short model name with Windows separators, e.g. "props_junk\wood_crate002a.mdl" (the models/ prefix is stripped). Normalise the prefix/separators and match props/, props\ and props_ (excluding the distant props_skybox set), so the studio hooks actually recognise prop draws.
Diffstat (limited to 'src')
-rw-r--r--src/studio.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/studio.cpp b/src/studio.cpp
index fa004de..baabcfa 100644
--- a/src/studio.cpp
+++ b/src/studio.cpp
@@ -75,7 +75,18 @@ const char *info_model_name(void *info) {
75} 75}
76 76
77bool is_prop_model(const char *name) { 77bool is_prop_model(const char *name) {
78 return name && strncmp(name, "models/props", 12) == 0; 78 if (!name)
79 return false;
80 // studiohdr_t::name is the short model name with Windows separators, e.g.
81 // "props_junk\wood_crate002a.mdl" (the "models/" prefix is stripped).
82 if (strncmp(name, "models/", 7) == 0 || strncmp(name, "models\\", 7) == 0)
83 name += 7;
84 if (strncmp(name, "props_skybox", 12) == 0 ||
85 strncmp(name, "props\\skybox", 13) == 0)
86 return false; // distant 3D-skybox props
87 return strncmp(name, "props/", 6) == 0 ||
88 strncmp(name, "props\\", 6) == 0 ||
89 strncmp(name, "props_", 6) == 0;
79} 90}
80 91
81void hook_set_color(void *self, const float *color) { 92void hook_set_color(void *self, const float *color) {