mirror of https://github.com/AxioDL/metaforce.git
Fix cooking new world/area data without an underscore in the name
This commit is contained in:
parent
27f25223fb
commit
137e96c732
|
@ -291,7 +291,7 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
||||||
/* World background */
|
/* World background */
|
||||||
hecl::ProjectPath worldDir = outPath.getParentPath().getParentPath();
|
hecl::ProjectPath worldDir = outPath.getParentPath().getParentPath();
|
||||||
for (const auto& ent : hecl::DirectoryEnumerator(worldDir.getAbsolutePath())) {
|
for (const auto& ent : hecl::DirectoryEnumerator(worldDir.getAbsolutePath())) {
|
||||||
if (hecl::StringUtils::BeginsWith(ent.m_name, _SYS_STR("!world_")) &&
|
if (hecl::StringUtils::BeginsWith(ent.m_name, _SYS_STR("!world")) &&
|
||||||
hecl::StringUtils::EndsWith(ent.m_name, _SYS_STR(".blend"))) {
|
hecl::StringUtils::EndsWith(ent.m_name, _SYS_STR(".blend"))) {
|
||||||
hecl::SystemUTF8Conv conv(ent.m_name);
|
hecl::SystemUTF8Conv conv(ent.m_name);
|
||||||
os.linkBackground(fmt::format(FMT_STRING("//../{}"), conv), "World"sv);
|
os.linkBackground(fmt::format(FMT_STRING("//../{}"), conv), "World"sv);
|
||||||
|
|
|
@ -115,7 +115,7 @@ bool MAPU::Cook(const hecl::blender::MapUniverse& mapuIn, const hecl::ProjectPat
|
||||||
MAPU::World& wldOut = mapu.worlds.back();
|
MAPU::World& wldOut = mapu.worlds.back();
|
||||||
wldOut.name = wld.name;
|
wldOut.name = wld.name;
|
||||||
for (const auto& ent : wld.worldPath.enumerateDir()) {
|
for (const auto& ent : wld.worldPath.enumerateDir()) {
|
||||||
if (hecl::StringUtils::BeginsWith(ent.m_name, _SYS_STR("!world_")) &&
|
if (hecl::StringUtils::BeginsWith(ent.m_name, _SYS_STR("!world")) &&
|
||||||
hecl::StringUtils::EndsWith(ent.m_name, _SYS_STR(".blend"))) {
|
hecl::StringUtils::EndsWith(ent.m_name, _SYS_STR(".blend"))) {
|
||||||
wldOut.mlvl = hecl::ProjectPath(wld.worldPath, ent.m_name);
|
wldOut.mlvl = hecl::ProjectPath(wld.worldPath, ent.m_name);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -112,15 +112,15 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||||
|
|
||||||
mlvl.magic = 0xDEAFBABE;
|
mlvl.magic = 0xDEAFBABE;
|
||||||
mlvl.version = 0x11;
|
mlvl.version = 0x11;
|
||||||
hecl::ProjectPath namePath = GetPathBeginsWith(dEnum, parentPath, _SYS_STR("!name_"));
|
hecl::ProjectPath namePath = GetPathBeginsWith(dEnum, parentPath, _SYS_STR("!name"));
|
||||||
if (namePath.isFile())
|
if (namePath.isFile())
|
||||||
mlvl.worldNameId = namePath;
|
mlvl.worldNameId = namePath;
|
||||||
hecl::ProjectPath savwPath = GetPathBeginsWith(dEnum, parentPath, _SYS_STR("!savw_"));
|
hecl::ProjectPath savwPath = GetPathBeginsWith(dEnum, parentPath, _SYS_STR("!savw"));
|
||||||
if (savwPath.isFile()) {
|
if (savwPath.isFile()) {
|
||||||
CookSAVW(savwPath.getCookedPath(SpecEntMP1), wld);
|
CookSAVW(savwPath.getCookedPath(SpecEntMP1), wld);
|
||||||
mlvl.saveWorldId = savwPath;
|
mlvl.saveWorldId = savwPath;
|
||||||
}
|
}
|
||||||
hecl::ProjectPath mapwPath = GetPathBeginsWith(dEnum, parentPath, _SYS_STR("!mapw_"));
|
hecl::ProjectPath mapwPath = GetPathBeginsWith(dEnum, parentPath, _SYS_STR("!mapw"));
|
||||||
if (mapwPath.isFile()) {
|
if (mapwPath.isFile()) {
|
||||||
CookMAPW(mapwPath.getCookedPath(SpecEntMP1), wld);
|
CookMAPW(mapwPath.getCookedPath(SpecEntMP1), wld);
|
||||||
mlvl.worldMap = mapwPath;
|
mlvl.worldMap = mapwPath;
|
||||||
|
@ -133,7 +133,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const hecl::DirectoryEnumerator areaDEnum(area.path.getAbsolutePath());
|
const hecl::DirectoryEnumerator areaDEnum(area.path.getAbsolutePath());
|
||||||
const hecl::ProjectPath areaPath = GetPathBeginsWith(areaDEnum, area.path, _SYS_STR("!area_"));
|
const hecl::ProjectPath areaPath = GetPathBeginsWith(areaDEnum, area.path, _SYS_STR("!area"));
|
||||||
if (!areaPath.isFile())
|
if (!areaPath.isFile())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||||
mlvl.areas.emplace_back();
|
mlvl.areas.emplace_back();
|
||||||
MLVL::Area& areaOut = mlvl.areas.back();
|
MLVL::Area& areaOut = mlvl.areas.back();
|
||||||
|
|
||||||
hecl::ProjectPath namePath = GetPathBeginsWith(areaDEnum, area.path, _SYS_STR("!name_"));
|
namePath = GetPathBeginsWith(areaDEnum, area.path, _SYS_STR("!name"));
|
||||||
if (namePath.isFile())
|
if (namePath.isFile())
|
||||||
areaOut.areaNameId = namePath;
|
areaOut.areaNameId = namePath;
|
||||||
|
|
||||||
|
|
|
@ -536,7 +536,7 @@ void SpecBase::copyBuildListData(std::vector<std::tuple<size_t, size_t, bool>>&
|
||||||
static bool IsWorldBlend(const hecl::ProjectPath& path) {
|
static bool IsWorldBlend(const hecl::ProjectPath& path) {
|
||||||
if (path.isFile()) {
|
if (path.isFile()) {
|
||||||
auto lastComp = path.getLastComponent();
|
auto lastComp = path.getLastComponent();
|
||||||
return hecl::StringUtils::BeginsWith(lastComp, _SYS_STR("!world_")) &&
|
return hecl::StringUtils::BeginsWith(lastComp, _SYS_STR("!world")) &&
|
||||||
hecl::StringUtils::EndsWith(lastComp, _SYS_STR(".blend"));
|
hecl::StringUtils::EndsWith(lastComp, _SYS_STR(".blend"));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -680,7 +680,7 @@ std::optional<hecl::blender::World> SpecBase::compileWorldFromDir(const hecl::Pr
|
||||||
hecl::blender::Token& btok) const {
|
hecl::blender::Token& btok) const {
|
||||||
hecl::ProjectPath asBlend;
|
hecl::ProjectPath asBlend;
|
||||||
for (const auto& ent : hecl::DirectoryEnumerator(dir.getAbsolutePath())) {
|
for (const auto& ent : hecl::DirectoryEnumerator(dir.getAbsolutePath())) {
|
||||||
if (hecl::StringUtils::BeginsWith(ent.m_name, _SYS_STR("!world_"))) {
|
if (hecl::StringUtils::BeginsWith(ent.m_name, _SYS_STR("!world"))) {
|
||||||
asBlend = hecl::ProjectPath(dir, ent.m_name).getWithExtension(_SYS_STR(".blend"), true);
|
asBlend = hecl::ProjectPath(dir, ent.m_name).getWithExtension(_SYS_STR(".blend"), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -712,7 +712,7 @@ struct SpecMP1 : SpecBase {
|
||||||
if (ent2.m_isDir) {
|
if (ent2.m_isDir) {
|
||||||
hecl::ProjectPath wldDir(pakPath, ent2.m_name);
|
hecl::ProjectPath wldDir(pakPath, ent2.m_name);
|
||||||
for (const auto& ent3 : wldDir.enumerateDir()) {
|
for (const auto& ent3 : wldDir.enumerateDir()) {
|
||||||
if (hecl::StringUtils::BeginsWith(ent3.m_name, _SYS_STR("!world_")) &&
|
if (hecl::StringUtils::BeginsWith(ent3.m_name, _SYS_STR("!world")) &&
|
||||||
hecl::StringUtils::EndsWith(ent3.m_name, _SYS_STR(".blend"))) {
|
hecl::StringUtils::EndsWith(ent3.m_name, _SYS_STR(".blend"))) {
|
||||||
hecl::ProjectPath wldPath(wldDir, ent3.m_name);
|
hecl::ProjectPath wldPath(wldDir, ent3.m_name);
|
||||||
if (wldPath.isFile()) {
|
if (wldPath.isFile()) {
|
||||||
|
|
|
@ -348,7 +348,7 @@ void CMain::AddWorldPaks() {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pakPrefix = g_tweakGame->GetWorldPrefix();
|
auto pakPrefix = g_tweakGame->GetWorldPrefix();
|
||||||
for (int i = 0; i < 9; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
std::string path(pakPrefix);
|
std::string path(pakPrefix);
|
||||||
|
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
|
|
|
@ -21,7 +21,7 @@ class ToolPackage final : public ToolBase {
|
||||||
|
|
||||||
void CheckFile(const hecl::ProjectPath& path) {
|
void CheckFile(const hecl::ProjectPath& path) {
|
||||||
auto lastComp = path.getLastComponent();
|
auto lastComp = path.getLastComponent();
|
||||||
if (hecl::StringUtils::BeginsWith(lastComp, _SYS_STR("!world_")) &&
|
if (hecl::StringUtils::BeginsWith(lastComp, _SYS_STR("!world")) &&
|
||||||
hecl::StringUtils::EndsWith(lastComp, _SYS_STR(".blend")))
|
hecl::StringUtils::EndsWith(lastComp, _SYS_STR(".blend")))
|
||||||
AddSelectedItem(path);
|
AddSelectedItem(path);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue