From 925e51cb1092b18fa392a555a07dfa8b24dd2acb Mon Sep 17 00:00:00 2001 From: Jan Laupetin Date: Sun, 1 Mar 2026 18:36:27 +0100 Subject: [PATCH] fix: not setting correct flags on technique post processing when reusing assets --- .../Game/T6/Techset/TechniqueCompilerT6.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ObjCompiling/Game/T6/Techset/TechniqueCompilerT6.cpp b/src/ObjCompiling/Game/T6/Techset/TechniqueCompilerT6.cpp index 08e285f3..0a243db9 100644 --- a/src/ObjCompiling/Game/T6/Techset/TechniqueCompilerT6.cpp +++ b/src/ObjCompiling/Game/T6/Techset/TechniqueCompilerT6.cpp @@ -207,14 +207,19 @@ namespace return technique; } - void ApplyTechFlagsFromMaterial(const Material& material) + void ApplyTechFlagsFromMaterial(const Material& material, const Zone& zone) { - if (!material.techniqueSet || material.stateBitsTable) + if (!material.techniqueSet || !material.techniqueSet->name || !material.stateBitsTable) + return; + + // Find the techniqueset asset from our zone since the material may link to a different one + const auto techniqueSetAsset = zone.m_pools.GetAsset(material.techniqueSet->name); + if (!techniqueSetAsset) return; for (auto techType = 0u; techType < TECHNIQUE_COUNT; techType++) { - auto* technique = material.techniqueSet->techniques[techType]; + auto* technique = techniqueSetAsset->Asset()->techniques[techType]; const auto stateBitsEntry = material.stateBitsEntry[techType]; if (!technique || stateBitsEntry < 0 || static_cast(stateBitsEntry) >= material.stateBitsCount) @@ -307,7 +312,7 @@ namespace const auto materials = m_zone.m_pools.PoolAssets(); for (auto* materialAsset : materials) { - ApplyTechFlagsFromMaterial(*materialAsset->Asset()); + ApplyTechFlagsFromMaterial(*materialAsset->Asset(), m_zone); } }