diff --git a/src/Components/Modules/AssetInterfaces/IMaterial.cpp b/src/Components/Modules/AssetInterfaces/IMaterial.cpp index e9b9d86e..c782a2c8 100644 --- a/src/Components/Modules/AssetInterfaces/IMaterial.cpp +++ b/src/Components/Modules/AssetInterfaces/IMaterial.cpp @@ -30,19 +30,22 @@ namespace Assets }; std::map techSetCorrespondance = { - {"effect_zfeather_outdoor", "effect_zfeather_blend"}, + {"effect", "effect_blend"}, {"effect", "effect_blend"}, {"effect_nofog", "effect_blend_nofog"}, + {"effect_zfeather", "effect_zfeather_blend"}, + {"wc_unlit_add", "wc_unlit_add_lin"}, {"wc_unlit_multiply", "wc_unlit_multiply_lin"}, {"wc_unlit_falloff_add", "wc_unlit_falloff_add_lin_ua"}, - {"mc_unlit_replace", "mc_unlit_replace_lin"}, - {"mc_unlit_nofog", "mc_unlit_blend_nofog_ua"}, {"wc_unlit", "wc_unlit_add"}, {"wc_unlit_multiply_lin", "wc_unlit_multiply_lin"}, {"wc_unlit_blend", "wc_unlit_blend_lin"}, - {"mc_unlit", "mc_unlit_replace_lin"}, - {"effect_zfeather", "effect_zfeather_blend"}/*, + {"wc_unlit_replace", "wc_unlit_replace_lin"}, + + {"mc_unlit_replace", "mc_unlit_replace_lin"}, + {"mc_unlit_nofog", "mc_unlit_blend_nofog_ua"}, + {"mc_unlit", "mc_unlit_blend_lin"}/*, {"", ""}, {"", ""}, {"", ""}, @@ -236,26 +239,27 @@ namespace Assets std::string techName = asset->techniqueSet->name; if (techSetCorrespondance.find(techName) != techSetCorrespondance.end()) { auto iw4TechSetName = techSetCorrespondance[techName]; - Game::XAssetEntry* entry = Game::DB_FindXAssetEntry(Game::XAssetType::ASSET_TYPE_TECHNIQUE_SET, iw4TechSetName.data()); + Game::XAssetEntry* iw4TechSet = Game::DB_FindXAssetEntry(Game::XAssetType::ASSET_TYPE_TECHNIQUE_SET, iw4TechSetName.data()); - if (entry) { - Game::DB_EnumXAssetEntries(Game::XAssetType::ASSET_TYPE_MATERIAL, [asset](Game::XAssetEntry* entry) + if (iw4TechSet) { + Game::DB_EnumXAssetEntries(Game::XAssetType::ASSET_TYPE_MATERIAL, [asset, iw4TechSet](Game::XAssetEntry* entry) { if (!replacementFound) { Game::XAssetHeader header = entry->asset.header; - if (header.material->techniqueSet == asset->techniqueSet) + if (header.material->techniqueSet == iw4TechSet->asset.header.techniqueSet) { - Components::Logger::Print("Material %s with techset %s has been mapped (last chance!) to %s\n", asset->info.name, asset->techniqueSet->name, header.material->techniqueSet->name); + Components::Logger::Print("Material %s with techset %s has been mapped to %s (last chance!)\n", asset->info.name, asset->techniqueSet->name, header.material->techniqueSet->name); asset->info.sortKey = header.material->info.sortKey; + asset->techniqueSet = iw4TechSet->asset.header.techniqueSet; replacementFound = true; } } }, false, false); if (!replacementFound) { - Components::Logger::Print("Could not find any loaded material with techset %s, so I cannot set the sortkey for material %s\n", asset->techniqueSet->name, asset->info.name); + Components::Logger::Print("Could not find any loaded material with techset %s (in replacement of %s), so I cannot set the sortkey for material %s\n", iw4TechSetName.data(), asset->techniqueSet->name, asset->info.name); } } else { @@ -263,7 +267,7 @@ namespace Assets } } else { - Components::Logger::Print("Could not match iw3 techset %s with any of the techsets I know! This is a critical error, there's a good chance the map will not be playable.\n", asset->techniqueSet->name); + Components::Logger::Print("Could not match iw3 techset %s with any of the techsets I know! This is a critical error, there's a good chance the map will not be playable.\n", techName.c_str()); } }