2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 00:27:42 +00:00

More AutoMapper imps (CMapArea and CMappableObject)

This commit is contained in:
2016-07-30 18:43:34 -07:00
parent df4ce27240
commit 4541234706
8 changed files with 158 additions and 13 deletions

View File

@@ -1266,18 +1266,28 @@ bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath
targetMSet.head.addMaterialEndOff(endOff);
}
for (const hecl::ProjectPath& path : texPaths)
texPaths.reserve(mset.size()*4);
for (const Mesh::Material& mat : mset)
{
const hecl::SystemString& relPath = path.getRelativePath();
/* TODO: incorporate hecl hashes */
size_t search = relPath.find(_S("TXTR_"));
if (search != hecl::SystemString::npos)
targetMSet.head.addTexture(relPath.c_str() + search + 5);
else
LogDNACommon.report(logvisor::Fatal, "unable to get hash from path");
for (const hecl::ProjectPath& path : mat.texs)
{
bool found = false;
for (const hecl::ProjectPath& ePath : texPaths)
{
if (path == ePath)
{
found = true;
break;
}
}
if (!found)
texPaths.push_back(path);
}
}
for (const hecl::ProjectPath& path : texPaths)
targetMSet.head.addTexture(path);
size_t secSz = targetMSet.binarySize(0);
size_t secSz32 = ROUND_UP_32(secSz);
head.secSizes.push_back(secSz32);