From b0551912a4d31c1f92e2a86509aad0f9e1510f8f Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 18:05:29 +0100 Subject: 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. --- src/studio.cpp | 6 ++---- src/world.cpp | 16 +++++++++------- 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() { return g_chams_mat; g_chams_mat_tried = true; g_chams_mat = world_find_material("models/debug/debugwhite"); - if (g_chams_mat) - logf("chams: material models/debug/debugwhite = %p", g_chams_mat); - else - logf("chams: models/debug/debugwhite not found"); + if (!g_chams_mat) + logf("chams: no usable material"); return g_chams_mat; } 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) { for (int g = 0; groups[g]; g++) { void *mat = vfunc(ms, 71)(ms, candidates[c], groups[g], false, nullptr); - if (!mat) { - logf("chams: FindMaterial(%s, %s) -> null", candidates[c], groups[g]); + if (!mat) continue; - } NameFn mat_name = (NameFn)vfunc(mat, 0); const char *n = mat_name(mat); - logf("chams: FindMaterial(%s, %s) -> %p name=%s", candidates[c], - groups[g], mat, n ? n : "?"); - if (n && strstr(n, "debugwhite")) - return mat; + if (!n) + continue; + for (int k = 0; candidates[k]; k++) { + if (strcmp(n, candidates[k]) == 0) { + logf("chams: material %s = %p (FindMaterial)", n, mat); + return mat; + } + } } } return nullptr; -- cgit v1.2.3