summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-04 11:46:40 +0100
committersalmonik <salmonik@tuta.io>2026-11-04 11:46:40 +0100
commit0adb4eba090dfa5684b661a01ea9d67244fede75 (patch)
tree67e6ace7a981ad3a182a720bf0bc1fb231f39ac9 /src
parentProps: install the studio hooks again (diff)
downloadhl2h-0adb4eba090dfa5684b661a01ea9d67244fede75.tar.gz
hl2h-0adb4eba090dfa5684b661a01ea9d67244fede75.zip
Props: force colour inside prop DrawModel; no prop material tint
The engine calls SetColorModulation(1,1,1) immediately before DrawModel, so the in-draw flag never sees it. Set the prop colour at the start of the prop DrawModel hook instead (colour only, not alpha), and stop applying ColorModulate to prop materials so only one mechanism touches props.
Diffstat (limited to 'src')
-rw-r--r--src/studio.cpp6
-rw-r--r--src/world.cpp13
2 files changed, 11 insertions, 8 deletions
diff --git a/src/studio.cpp b/src/studio.cpp
index 110ce74..c4c3cfb 100644
--- a/src/studio.cpp
+++ b/src/studio.cpp
@@ -125,8 +125,12 @@ void hook_draw_model(void *self, void *results, void *info, void *bone,
125 logf("studio: DrawModel model=\"%s\" prop=%d", model ? model : "?", 125 logf("studio: DrawModel model=\"%s\" prop=%d", model ? model : "?",
126 (int)prop); 126 (int)prop);
127 } 127 }
128 if (prop) 128 if (prop) {
129 float c[4];
130 prop_color(c);
131 g_orig_set_color(self, c);
129 g_prop_depth++; 132 g_prop_depth++;
133 }
130 g_orig_draw_model(self, results, info, bone, flex, flex_delayed, flags); 134 g_orig_draw_model(self, results, info, bone, flex, flex_delayed, flags);
131 if (prop) 135 if (prop)
132 g_prop_depth--; 136 g_prop_depth--;
diff --git a/src/world.cpp b/src/world.cpp
index d7023c7..2fa1fc4 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -180,7 +180,9 @@ bool apply_tint(int world_r, int world_g, int world_b, int sky_r, int sky_g,
180 180
181 float wr = world_r / 255.0f, wg = world_g / 255.0f, wb = world_b / 255.0f; 181 float wr = world_r / 255.0f, wg = world_g / 255.0f, wb = world_b / 255.0f;
182 float sr = sky_r / 255.0f, sg = sky_g / 255.0f, sb = sky_b / 255.0f; 182 float sr = sky_r / 255.0f, sg = sky_g / 255.0f, sb = sky_b / 255.0f;
183 float pr = prop_r / 255.0f, pg = prop_g / 255.0f, pb = prop_b / 255.0f; 183 (void)prop_r;
184 (void)prop_g;
185 (void)prop_b;
184 186
185 unsigned short inv = invalid(ms); 187 unsigned short inv = invalid(ms);
186 int seen = 0, world_hits = 0, sky_hits = 0, prop_hits = 0; 188 int seen = 0, world_hits = 0, sky_hits = 0, prop_hits = 0;
@@ -215,13 +217,10 @@ bool apply_tint(int world_r, int world_g, int world_b, int sky_r, int sky_g,
215 mod_fn(mat, sr, sg, sb); 217 mod_fn(mat, sr, sg, sb);
216 sky_hits++; 218 sky_hits++;
217 } else if (is_prop_material(name)) { 219 } else if (is_prop_material(name)) {
218 mod_fn(mat, pr, pg, pb); 220 // Props are tinted through IStudioRender (studio.cpp); material
221 // modulation is overridden per draw by the engine, so leave prop
222 // materials untouched here.
219 prop_hits++; 223 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 }
225 } 224 }
226 } 225 }
227 logf("tint: applied world=%d(%d,%d,%d) sky=%d(%d,%d,%d) props=%d(%d,%d,%d) " 226 logf("tint: applied world=%d(%d,%d,%d) sky=%d(%d,%d,%d) props=%d(%d,%d,%d) "