summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-04 18:05:29 +0100
committersalmonik <salmonik@tuta.io>2026-11-04 18:05:29 +0100
commitb0551912a4d31c1f92e2a86509aad0f9e1510f8f (patch)
treeb38344d20c803e17f71d662835f93df98087fea6
parentChams: tint through $color/$color2 and log the chosen material (diff)
downloadhl2h-b0551912a4d31c1f92e2a86509aad0f9e1510f8f.tar.gz
hl2h-b0551912a4d31c1f92e2a86509aad0f9e1510f8f.zip
Chams: quiet material lookup, accept any fallback by name
FindMaterial diagnostics are no longer logged per attempt; the chosen material is logged once. Accept any candidate name returned by FindMaterial, not just debugwhite.
-rw-r--r--src/studio.cpp6
-rw-r--r--src/world.cpp16
2 files changed, 11 insertions, 11 deletions
diff --git a/src/studio.cpp b/src/studio.cpp
index d472fbc..a1aae12 100644
--- a/src/studio.cpp
+++ b/src/studio.cpp
@@ -204,10 +204,8 @@ void *chams_material() {
204 return g_chams_mat; 204 return g_chams_mat;
205 g_chams_mat_tried = true; 205 g_chams_mat_tried = true;
206 g_chams_mat = world_find_material("models/debug/debugwhite"); 206 g_chams_mat = world_find_material("models/debug/debugwhite");
207 if (g_chams_mat) 207 if (!g_chams_mat)
208 logf("chams: material models/debug/debugwhite = %p", g_chams_mat); 208 logf("chams: no usable material");
209 else
210 logf("chams: models/debug/debugwhite not found");
211 return g_chams_mat; 209 return g_chams_mat;
212} 210}
213 211
diff --git a/src/world.cpp b/src/world.cpp
index 284e64e..897ad0a 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -1055,16 +1055,18 @@ void *world_find_material(const char *name) {
1055 for (int g = 0; groups[g]; g++) { 1055 for (int g = 0; groups[g]; g++) {
1056 void *mat = vfunc<FindFn>(ms, 71)(ms, candidates[c], groups[g], false, 1056 void *mat = vfunc<FindFn>(ms, 71)(ms, candidates[c], groups[g], false,
1057 nullptr); 1057 nullptr);
1058 if (!mat) { 1058 if (!mat)
1059 logf("chams: FindMaterial(%s, %s) -> null", candidates[c], groups[g]);
1060 continue; 1059 continue;
1061 }
1062 NameFn mat_name = (NameFn)vfunc<NameFn>(mat, 0); 1060 NameFn mat_name = (NameFn)vfunc<NameFn>(mat, 0);
1063 const char *n = mat_name(mat); 1061 const char *n = mat_name(mat);
1064 logf("chams: FindMaterial(%s, %s) -> %p name=%s", candidates[c], 1062 if (!n)
1065 groups[g], mat, n ? n : "?"); 1063 continue;
1066 if (n && strstr(n, "debugwhite")) 1064 for (int k = 0; candidates[k]; k++) {
1067 return mat; 1065 if (strcmp(n, candidates[k]) == 0) {
1066 logf("chams: material %s = %p (FindMaterial)", n, mat);
1067 return mat;
1068 }
1069 }
1068 } 1070 }
1069 } 1071 }
1070 return nullptr; 1072 return nullptr;