mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 15:44:56 +00:00
Implement CActorLights::BuildAreaLightList
This commit is contained in:
@@ -167,12 +167,15 @@ bool MREA::Extract(const SpecBase& dataSpec,
|
||||
rs.seek(secStart + head.secSizes[curSec++], athena::Begin);
|
||||
|
||||
/* Dump VISI entities */
|
||||
auto visiPos = rs.position();
|
||||
if (head.secSizes[curSec] && rs.readUint32Big() == 'VISI')
|
||||
{
|
||||
athena::io::YAMLDocWriter visiWriter("VISI");
|
||||
uint32_t unkCount = 0;
|
||||
if (auto __vec = visiWriter.enterSubVector("entities"))
|
||||
{
|
||||
rs.seek(18, athena::Current);
|
||||
rs.seek(14, athena::Current);
|
||||
unkCount = rs.readUint32Big();
|
||||
uint32_t entityCount = rs.readUint32Big();
|
||||
rs.seek(8, athena::Current);
|
||||
for (int i=0 ; i<entityCount ; ++i)
|
||||
@@ -184,6 +187,14 @@ bool MREA::Extract(const SpecBase& dataSpec,
|
||||
hecl::ProjectPath visiMetadataPath(outPath.getParentPath(), _S("!visi.yaml"));
|
||||
athena::io::FileWriter visiMetadata(visiMetadataPath.getAbsolutePath());
|
||||
visiWriter.finish(&visiMetadata);
|
||||
|
||||
if (unkCount)
|
||||
{
|
||||
rs.seek(visiPos, athena::Begin);
|
||||
auto bytes = rs.readUBytes(head.secSizes[curSec]);
|
||||
athena::io::FileWriter fw(std::string("/Users/jacko/Desktop/") + pakRouter.getBestEntryName(entry, false).c_str() + ".visi");
|
||||
fw.writeUBytes(bytes.get(), head.secSizes[curSec]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Origins to center of mass */
|
||||
@@ -398,15 +409,16 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
|
||||
}
|
||||
|
||||
/* Lights */
|
||||
std::vector<atVec3f> lightsVisi;
|
||||
std::vector<atVec3f> lightsVisi[2];
|
||||
{
|
||||
int actualCount = 0;
|
||||
int actualCounts[2] = {};
|
||||
for (const Light& l : lights)
|
||||
if (l.layer == 0 || l.layer == 1)
|
||||
++actualCount;
|
||||
lightsVisi.reserve(actualCount);
|
||||
++actualCounts[l.layer];
|
||||
lightsVisi[0].reserve(actualCounts[0]);
|
||||
lightsVisi[1].reserve(actualCounts[1]);
|
||||
|
||||
secs.emplace_back(12 + 65 * actualCount, 0);
|
||||
secs.emplace_back(12 + 65 * (actualCounts[0] + actualCounts[1]), 0);
|
||||
athena::io::MemoryWriter w(secs.back().data(), secs.back().size());
|
||||
w.writeUint32Big(0xBABEDEAD);
|
||||
|
||||
@@ -426,7 +438,7 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
|
||||
BabeDeadLight light = {};
|
||||
WriteBabeDeadLightFromBlender(light, l);
|
||||
light.write(w);
|
||||
lightsVisi.push_back(light.position);
|
||||
lightsVisi[l.layer].push_back(light.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -495,8 +507,11 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
|
||||
w.writeVec3fBig(ent.second.max);
|
||||
}
|
||||
|
||||
w.writeUint32Big(lightsVisi.size());
|
||||
for (const auto& light : lightsVisi)
|
||||
w.writeUint32Big(lightsVisi[0].size() + lightsVisi[1].size());
|
||||
w.writeUint32Big(lightsVisi[1].size());
|
||||
for (const auto& light : lightsVisi[1])
|
||||
w.writeVec3fBig(light);
|
||||
for (const auto& light : lightsVisi[0])
|
||||
w.writeVec3fBig(light);
|
||||
|
||||
w.close();
|
||||
|
||||
@@ -237,15 +237,15 @@ struct LightParameters : BigYAML
|
||||
Value<atUint32> shadowTesselation;
|
||||
Value<float> unknown3;
|
||||
Value<float> unknown4;
|
||||
Value<atVec4f> unknown5; // CColor
|
||||
Value<bool> unknown6;
|
||||
Value<atVec4f> noLightsAmbient; // CColor
|
||||
Value<bool> makeLights;
|
||||
Value<atUint32> worldLightingOptions;
|
||||
Value<atUint32> lightRecalculationOptions;
|
||||
Value<atVec3f> unknown7;
|
||||
Value<atUint32> unknown8;
|
||||
Value<atUint32> unknown9;
|
||||
Value<bool> unknown10;
|
||||
Value<atUint32> unknown11;
|
||||
Value<atVec3f> actorPosBias;
|
||||
Value<atUint32> maxDynamicLights;
|
||||
Value<atUint32> maxAreaLights;
|
||||
Value<bool> ambientChannelOverflow;
|
||||
Value<atUint32> layerIndex;
|
||||
};
|
||||
|
||||
struct PatternedInfo : BigYAML
|
||||
|
||||
@@ -1071,8 +1071,8 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
|
||||
x130_ = __dna_docin.readFloat("x130_");
|
||||
/* x134_ */
|
||||
x134_ = __dna_docin.readFloat("x134_");
|
||||
/* x138_ */
|
||||
x138_hudLagAmount = __dna_docin.readFloat("x138_");
|
||||
/* x138_hudLagAmount */
|
||||
x138_hudLagAmount = __dna_docin.readFloat("x138_hudLagAmount");
|
||||
/* x13c_ */
|
||||
x13c_ = __dna_docin.readFloat("x13c_");
|
||||
/* x140_ */
|
||||
@@ -1580,8 +1580,8 @@ void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout)
|
||||
__dna_docout.writeFloat("x130_", x130_);
|
||||
/* x134_ */
|
||||
__dna_docout.writeFloat("x134_", x134_);
|
||||
/* x138_ */
|
||||
__dna_docout.writeFloat("x138_", x138_hudLagAmount);
|
||||
/* x138_hudLagAmount */
|
||||
__dna_docout.writeFloat("x138_hudLagAmount", x138_hudLagAmount);
|
||||
/* x13c_ */
|
||||
__dna_docout.writeFloat("x13c_", x13c_);
|
||||
/* x140_ */
|
||||
|
||||
Reference in New Issue
Block a user