From a53cf8aad3a87f5417b4a462babdec5883167f51 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Mon, 12 Oct 2015 11:10:38 -1000 Subject: [PATCH] Material extraction fix; Layer indices --- DataSpec/DNACommon/PAK.hpp | 1 + DataSpec/DNAMP1/CMDLMaterials.cpp | 6 ++++-- DataSpec/DNAMP1/DNAMP1.cpp | 4 ++++ DataSpec/DNAMP2/DNAMP2.cpp | 4 ++++ DataSpec/DNAMP3/DNAMP3.cpp | 3 +++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/DataSpec/DNACommon/PAK.hpp b/DataSpec/DNACommon/PAK.hpp index bf4d928c7..e0835c634 100644 --- a/DataSpec/DNACommon/PAK.hpp +++ b/DataSpec/DNACommon/PAK.hpp @@ -219,6 +219,7 @@ struct Level struct Layer { HECL::SystemString name; + bool active; std::unordered_set resources; }; std::vector layers; diff --git a/DataSpec/DNAMP1/CMDLMaterials.cpp b/DataSpec/DNAMP1/CMDLMaterials.cpp index caa7f5076..bc65bc567 100644 --- a/DataSpec/DNAMP1/CMDLMaterials.cpp +++ b/DataSpec/DNAMP1/CMDLMaterials.cpp @@ -590,7 +590,8 @@ static void AddTEVStage(Stream& out, const MaterialSet::Material::TEVStage& stag /* B nodes */ if (!strcmp(cc, "ONE")) { - if (strcmp(cb, "ZERO") && strcmp(cb, "HALF") && strcmp(cb, "ONE")) + if (strcmp(cb, "ZERO") && strcmp(cb, "HALF") && strcmp(cb, "ONE") && + strcmp(cb, "D0") && strcmp(cb, "D1") && strcmp(cb, "D2")) { out.format("color_combiner_sockets.append(%s)\n", cb); ++c_combiner_idx; @@ -652,7 +653,8 @@ static void AddTEVStage(Stream& out, const MaterialSet::Material::TEVStage& stag /* B nodes */ if (!strcmp(ac, "ONE")) { - if (strcmp(ab, "ZERO") && strcmp(ab, "HALF") && strcmp(ab, "ONE")) + if (strcmp(ab, "ZERO") && strcmp(ab, "HALF") && strcmp(ab, "ONE") && + strcmp(ab, "D0") && strcmp(ab, "D1") && strcmp(ab, "D2")) { out.format("alpha_combiner_sockets.append(%s)\n", ab); ++a_combiner_idx; diff --git a/DataSpec/DNAMP1/DNAMP1.cpp b/DataSpec/DNAMP1/DNAMP1.cpp index 9cc7e2240..ac140e101 100644 --- a/DataSpec/DNAMP1/DNAMP1.cpp +++ b/DataSpec/DNAMP1/DNAMP1.cpp @@ -93,6 +93,7 @@ void PAKBridge::build() for (const MLVL::Area& area : mlvl.areas) { Level::Area& areaDeps = level.areas[area.areaMREAId]; + MLVL::LayerFlags& layerFlags = mlvl.layerFlags[ai]; const PAK::Entry* areaNameEnt = m_pak.lookupEntry(area.areaNameId); if (areaNameEnt) { @@ -129,6 +130,7 @@ void PAKBridge::build() areaDeps.layers.emplace_back(); Level::Area::Layer& layer = areaDeps.layers.back(); layer.name = LayerName(mlvl.layerNames[layerIdx++]); + layer.active = layerFlags.flags >> (l-1) & 0x1; /* Trim possible trailing whitespace */ #if HECL_UCS2 while (layer.name.size() && iswblank(layer.name.back())) @@ -137,6 +139,8 @@ void PAKBridge::build() while (layer.name.size() && isblank(layer.name.back())) layer.name.pop_back(); #endif + HECL::SNPrintf(num, 16, layer.active ? _S("%02ua ") : _S("%02u "), l-1); + layer.name = num + layer.name; layer.resources.reserve(area.depLayers[l] - r); for (; r> (l-1) & 0x1; /* Trim possible trailing whitespace */ #if HECL_UCS2 while (layer.name.size() && iswblank(layer.name.back())) @@ -142,6 +144,8 @@ void PAKBridge::build() while (layer.name.size() && isblank(layer.name.back())) layer.name.pop_back(); #endif + HECL::SNPrintf(num, 16, layer.active ? _S("%02ua ") : _S("%02u "), l-1); + layer.name = num + layer.name; layer.resources.reserve(area.depLayers[l] - r); for (; r> l & 0x1; /* Trim possible trailing whitespace */ #if HECL_UCS2 while (layer.name.size() && iswblank(layer.name.back())) @@ -154,6 +155,8 @@ void PAKBridge::build() while (layer.name.size() && isblank(layer.name.back())) layer.name.pop_back(); #endif + HECL::SNPrintf(num, 16, layer.active ? _S("%02ua ") : _S("%02u "), l-1); + layer.name = num + layer.name; } }