summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-04 11:30:56 +0100
committersalmonik <salmonik@tuta.io>2026-11-04 11:30:56 +0100
commit33c6bf853e1292816882ca4df9ba2a79f8a7288a (patch)
treea65d1112e5a1a10c3417912900442ac876c80d50
parentProps: tint through DrawModel/DrawModelArray; drop m_clrRender writes (diff)
downloadhl2h-33c6bf853e1292816882ca4df9ba2a79f8a7288a.tar.gz
hl2h-33c6bf853e1292816882ca4df9ba2a79f8a7288a.zip
Diagnose prop tinting: log prop materials and studio draw model names
Log the first crate materials the tint pass modifies and the first DrawModel/ DrawModelArray calls with their model names, to see whether the crates are brush materials that were never reached, materials loaded after the tint was applied, or a studio draw path that is still missed.
-rw-r--r--src/studio.cpp13
-rw-r--r--src/world.cpp5
2 files changed, 15 insertions, 3 deletions
diff --git a/src/studio.cpp b/src/studio.cpp
index 01f4830..fa004de 100644
--- a/src/studio.cpp
+++ b/src/studio.cpp
@@ -40,6 +40,8 @@ bool g_installed = false;
40int g_prop_depth = 0; 40int g_prop_depth = 0;
41int g_static_calls = 0; 41int g_static_calls = 0;
42int g_static_props = 0; 42int g_static_props = 0;
43int g_model_logs = 0;
44int g_array_logs = 0;
43 45
44bool prop_tint_on() { 46bool prop_tint_on() {
45 return feature_active(FEAT_WORLD_TINT) && g_tint_prop_on; 47 return feature_active(FEAT_WORLD_TINT) && g_tint_prop_on;
@@ -105,8 +107,11 @@ void hook_draw_model(void *self, void *results, void *info, void *bone,
105 void *flex, void *flex_delayed, int flags) { 107 void *flex, void *flex_delayed, int flags) {
106 const char *model = info_model_name(info); 108 const char *model = info_model_name(info);
107 bool prop = prop_tint_on() && is_prop_model(model); 109 bool prop = prop_tint_on() && is_prop_model(model);
108 if (g_static_calls < 3 && prop) 110 if (g_model_logs < 10) {
109 logf("studio: DrawModel prop model=\"%s\"", model ? model : "?"); 111 g_model_logs++;
112 logf("studio: DrawModel model=\"%s\" prop=%d", model ? model : "?",
113 (int)prop);
114 }
110 if (prop) { 115 if (prop) {
111 force_prop_color(self); 116 force_prop_color(self);
112 g_prop_depth++; 117 g_prop_depth++;
@@ -120,9 +125,11 @@ void hook_draw_array(void *self, void *info, int count, void *instances,
120 int stride, int flags) { 125 int stride, int flags) {
121 const char *model = info_model_name(info); 126 const char *model = info_model_name(info);
122 bool prop = prop_tint_on() && is_prop_model(model); 127 bool prop = prop_tint_on() && is_prop_model(model);
123 if (g_static_calls < 3) 128 if (g_array_logs < 10) {
129 g_array_logs++;
124 logf("studio: DrawModelArray count=%d model=\"%s\" prop=%d", count, 130 logf("studio: DrawModelArray count=%d model=\"%s\" prop=%d", count,
125 model ? model : "?", (int)prop); 131 model ? model : "?", (int)prop);
132 }
126 if (prop) { 133 if (prop) {
127 force_prop_color(self); 134 force_prop_color(self);
128 g_prop_depth++; 135 g_prop_depth++;
diff --git a/src/world.cpp b/src/world.cpp
index 0de86c6..d7023c7 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -217,6 +217,11 @@ bool apply_tint(int world_r, int world_g, int world_b, int sky_r, int sky_g,
217 } else if (is_prop_material(name)) { 217 } else if (is_prop_material(name)) {
218 mod_fn(mat, pr, pg, pb); 218 mod_fn(mat, pr, pg, pb);
219 prop_hits++; 219 prop_hits++;
220 static int crate_logs = 0;
221 if (crate_logs < 8 && strstr(name, "crate")) {
222 crate_logs++;
223 logf("tint: prop material \"%s\"", name);
224 }
220 } 225 }
221 } 226 }
222 logf("tint: applied world=%d(%d,%d,%d) sky=%d(%d,%d,%d) props=%d(%d,%d,%d) " 227 logf("tint: applied world=%d(%d,%d,%d) sky=%d(%d,%d,%d) props=%d(%d,%d,%d) "