mirror of https://github.com/AxioDL/metaforce.git
Material extraction fix; Layer indices
This commit is contained in:
parent
0bd1469773
commit
a53cf8aad3
|
@ -219,6 +219,7 @@ struct Level
|
||||||
struct Layer
|
struct Layer
|
||||||
{
|
{
|
||||||
HECL::SystemString name;
|
HECL::SystemString name;
|
||||||
|
bool active;
|
||||||
std::unordered_set<IDType> resources;
|
std::unordered_set<IDType> resources;
|
||||||
};
|
};
|
||||||
std::vector<Layer> layers;
|
std::vector<Layer> layers;
|
||||||
|
|
|
@ -590,7 +590,8 @@ static void AddTEVStage(Stream& out, const MaterialSet::Material::TEVStage& stag
|
||||||
/* B nodes */
|
/* B nodes */
|
||||||
if (!strcmp(cc, "ONE"))
|
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);
|
out.format("color_combiner_sockets.append(%s)\n", cb);
|
||||||
++c_combiner_idx;
|
++c_combiner_idx;
|
||||||
|
@ -652,7 +653,8 @@ static void AddTEVStage(Stream& out, const MaterialSet::Material::TEVStage& stag
|
||||||
/* B nodes */
|
/* B nodes */
|
||||||
if (!strcmp(ac, "ONE"))
|
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);
|
out.format("alpha_combiner_sockets.append(%s)\n", ab);
|
||||||
++a_combiner_idx;
|
++a_combiner_idx;
|
||||||
|
|
|
@ -93,6 +93,7 @@ void PAKBridge::build()
|
||||||
for (const MLVL::Area& area : mlvl.areas)
|
for (const MLVL::Area& area : mlvl.areas)
|
||||||
{
|
{
|
||||||
Level::Area& areaDeps = level.areas[area.areaMREAId];
|
Level::Area& areaDeps = level.areas[area.areaMREAId];
|
||||||
|
MLVL::LayerFlags& layerFlags = mlvl.layerFlags[ai];
|
||||||
const PAK::Entry* areaNameEnt = m_pak.lookupEntry(area.areaNameId);
|
const PAK::Entry* areaNameEnt = m_pak.lookupEntry(area.areaNameId);
|
||||||
if (areaNameEnt)
|
if (areaNameEnt)
|
||||||
{
|
{
|
||||||
|
@ -129,6 +130,7 @@ void PAKBridge::build()
|
||||||
areaDeps.layers.emplace_back();
|
areaDeps.layers.emplace_back();
|
||||||
Level::Area::Layer& layer = areaDeps.layers.back();
|
Level::Area::Layer& layer = areaDeps.layers.back();
|
||||||
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
|
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
|
||||||
|
layer.active = layerFlags.flags >> (l-1) & 0x1;
|
||||||
/* Trim possible trailing whitespace */
|
/* Trim possible trailing whitespace */
|
||||||
#if HECL_UCS2
|
#if HECL_UCS2
|
||||||
while (layer.name.size() && iswblank(layer.name.back()))
|
while (layer.name.size() && iswblank(layer.name.back()))
|
||||||
|
@ -137,6 +139,8 @@ void PAKBridge::build()
|
||||||
while (layer.name.size() && isblank(layer.name.back()))
|
while (layer.name.size() && isblank(layer.name.back()))
|
||||||
layer.name.pop_back();
|
layer.name.pop_back();
|
||||||
#endif
|
#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);
|
layer.resources.reserve(area.depLayers[l] - r);
|
||||||
for (; r<area.depLayers[l] ; ++r)
|
for (; r<area.depLayers[l] ; ++r)
|
||||||
|
|
|
@ -90,6 +90,7 @@ void PAKBridge::build()
|
||||||
for (const MLVL::Area& area : mlvl.areas)
|
for (const MLVL::Area& area : mlvl.areas)
|
||||||
{
|
{
|
||||||
Level::Area& areaDeps = level.areas[area.areaMREAId];
|
Level::Area& areaDeps = level.areas[area.areaMREAId];
|
||||||
|
MLVL::LayerFlags& layerFlags = mlvl.layerFlags[ai];
|
||||||
const DNAMP1::PAK::Entry* areaNameEnt = m_pak.lookupEntry(area.areaNameId);
|
const DNAMP1::PAK::Entry* areaNameEnt = m_pak.lookupEntry(area.areaNameId);
|
||||||
if (areaNameEnt)
|
if (areaNameEnt)
|
||||||
{
|
{
|
||||||
|
@ -134,6 +135,7 @@ void PAKBridge::build()
|
||||||
areaDeps.layers.emplace_back();
|
areaDeps.layers.emplace_back();
|
||||||
Level::Area::Layer& layer = areaDeps.layers.back();
|
Level::Area::Layer& layer = areaDeps.layers.back();
|
||||||
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
|
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
|
||||||
|
layer.active = layerFlags.flags >> (l-1) & 0x1;
|
||||||
/* Trim possible trailing whitespace */
|
/* Trim possible trailing whitespace */
|
||||||
#if HECL_UCS2
|
#if HECL_UCS2
|
||||||
while (layer.name.size() && iswblank(layer.name.back()))
|
while (layer.name.size() && iswblank(layer.name.back()))
|
||||||
|
@ -142,6 +144,8 @@ void PAKBridge::build()
|
||||||
while (layer.name.size() && isblank(layer.name.back()))
|
while (layer.name.size() && isblank(layer.name.back()))
|
||||||
layer.name.pop_back();
|
layer.name.pop_back();
|
||||||
#endif
|
#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);
|
layer.resources.reserve(area.depLayers[l] - r);
|
||||||
for (; r<area.depLayers[l] ; ++r)
|
for (; r<area.depLayers[l] ; ++r)
|
||||||
|
|
|
@ -146,6 +146,7 @@ void PAKBridge::build()
|
||||||
areaDeps.layers.emplace_back();
|
areaDeps.layers.emplace_back();
|
||||||
Level::Area::Layer& layer = areaDeps.layers.back();
|
Level::Area::Layer& layer = areaDeps.layers.back();
|
||||||
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
|
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
|
||||||
|
layer.active = areaLayers.flags >> l & 0x1;
|
||||||
/* Trim possible trailing whitespace */
|
/* Trim possible trailing whitespace */
|
||||||
#if HECL_UCS2
|
#if HECL_UCS2
|
||||||
while (layer.name.size() && iswblank(layer.name.back()))
|
while (layer.name.size() && iswblank(layer.name.back()))
|
||||||
|
@ -154,6 +155,8 @@ void PAKBridge::build()
|
||||||
while (layer.name.size() && isblank(layer.name.back()))
|
while (layer.name.size() && isblank(layer.name.back()))
|
||||||
layer.name.pop_back();
|
layer.name.pop_back();
|
||||||
#endif
|
#endif
|
||||||
|
HECL::SNPrintf(num, 16, layer.active ? _S("%02ua ") : _S("%02u "), l-1);
|
||||||
|
layer.name = num + layer.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue