mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 17:04:55 +00:00
Work on world cooking
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "../DNACommon/FONT.hpp"
|
||||
#include "../DNACommon/FSM2.hpp"
|
||||
#include "../DNACommon/DGRP.hpp"
|
||||
#include "Runtime/GCNTypes.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
@@ -127,13 +128,7 @@ void PAKBridge::build()
|
||||
areaDeps.name = areaName.getSystemString(FOURCC('ENGL'), 0);
|
||||
|
||||
/* Trim possible trailing whitespace */
|
||||
#if HECL_UCS2
|
||||
while (areaDeps.name.size() && iswspace(areaDeps.name.back()))
|
||||
areaDeps.name.pop_back();
|
||||
#else
|
||||
while (areaDeps.name.size() && isspace(areaDeps.name.back()))
|
||||
areaDeps.name.pop_back();
|
||||
#endif
|
||||
areaDeps.name = hecl::StringUtils::TrimWhitespace(areaDeps.name);
|
||||
}
|
||||
if (areaDeps.name.empty())
|
||||
{
|
||||
@@ -218,6 +213,63 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||
}
|
||||
}
|
||||
|
||||
static const atVec4f BottomRow = {0.f, 0.f, 0.f, 1.f};
|
||||
|
||||
void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
|
||||
std::unordered_map<UniqueID64, zeus::CMatrix4f>& addTo,
|
||||
std::unordered_map<UniqueID64, hecl::ProjectPath>& pathOverrides) const
|
||||
{
|
||||
for (const std::pair<UniqueID64, PAK::Entry*>& entry : m_pak.m_idMap)
|
||||
{
|
||||
if (entry.second->type == FOURCC('MLVL'))
|
||||
{
|
||||
MLVL mlvl;
|
||||
{
|
||||
PAKEntryReadStream rs = entry.second->beginReadStream(m_node);
|
||||
mlvl.read(rs);
|
||||
}
|
||||
hecl::ProjectPath mlvlDirPath = pakRouter.getWorking(entry.second).getParentPath();
|
||||
|
||||
if (mlvl.worldNameId)
|
||||
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath, _S("!name.yaml"));
|
||||
|
||||
for (const MLVL::Area& area : mlvl.areas)
|
||||
{
|
||||
hecl::ProjectPath areaDirPath = pakRouter.getWorking(area.areaMREAId).getParentPath();
|
||||
if (area.areaNameId)
|
||||
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath, _S("!name.yaml"));
|
||||
}
|
||||
|
||||
if (mlvl.worldMap)
|
||||
{
|
||||
const nod::Node* mapNode;
|
||||
const PAK::Entry* mapEntry = pakRouter.lookupEntry(mlvl.worldMap, &mapNode);
|
||||
if (mapEntry)
|
||||
{
|
||||
PAKEntryReadStream rs = mapEntry->beginReadStream(*mapNode);
|
||||
u32 magic = rs.readUint32Big();
|
||||
if (magic == 0xDEADF00D)
|
||||
{
|
||||
rs.readUint32Big();
|
||||
u32 count = rs.readUint32Big();
|
||||
for (u32 i=0 ; i<count && i<mlvl.areas.size() ; ++i)
|
||||
{
|
||||
MLVL::Area& areaData = mlvl.areas[i];
|
||||
UniqueID64 mapaId;
|
||||
mapaId.read(rs);
|
||||
addTo[mapaId] = zeus::CMatrix4f(
|
||||
areaData.transformMtx[0],
|
||||
areaData.transformMtx[1],
|
||||
areaData.transformMtx[2],
|
||||
BottomRow).transposed();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::Entry& entry)
|
||||
{
|
||||
switch (entry.type)
|
||||
|
||||
@@ -38,6 +38,10 @@ public:
|
||||
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||
std::unordered_map<UniqueID64, std::pair<UniqueID64, UniqueID64>>& addTo,
|
||||
std::unordered_map<UniqueID64, std::pair<UniqueID64, std::string>>& cskrCinfToChar) const;
|
||||
|
||||
void addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
|
||||
std::unordered_map<UniqueID64, zeus::CMatrix4f>& addTo,
|
||||
std::unordered_map<UniqueID64, hecl::ProjectPath>& pathOverrides) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user