Various MREA-generation fixes

This commit is contained in:
Jack Andersen 2016-08-12 15:23:27 -10:00
parent a0f6c18e35
commit 7a653bc3af
9 changed files with 89 additions and 9 deletions

View File

@ -143,7 +143,7 @@ void WriteBabeDeadLightFromBlender(BabeDeadLight& lightOut, const hecl::BlenderC
lightOut.position.vec[2] = lightIn.sceneXf[2].vec[3];
zeus::CTransform lightXf(&lightIn.sceneXf[0]);
lightOut.direction = lightXf * zeus::CVector3f(0.f, 0.f, -1.f);
lightOut.direction = (lightXf.basis * zeus::CVector3f(0.f, 0.f, -1.f)).normalized();
}
template void WriteBabeDeadLightFromBlender<DNAMP1::MREA::BabeDeadLight>

View File

@ -337,7 +337,7 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
/* SCLY */
{
DNAMP1::SCLY sclyData;
sclyData.fourCC = FOURCC('SCLY');
sclyData.fourCC = 'SCLY';
sclyData.version = 1;
for (const hecl::ProjectPath& layer : layerScriptPaths)
{

View File

@ -180,7 +180,13 @@ void SCLY::ScriptLayer::write(athena::io::IStreamWriter& ws) const
for (const std::unique_ptr<IScriptObject>& obj : objects)
{
ws.writeByte(obj->type);
atUint32 expLen = obj->binarySize(0);
ws.writeUint32Big(expLen);
auto start = ws.position();
obj->write(ws);
auto wrote = ws.position() - start;
if (wrote != expLen)
Log.report(logvisor::Error, "expected writing %lu byte SCLY obj; wrote %llu", expLen, wrote);
}
}
@ -189,7 +195,7 @@ size_t SCLY::ScriptLayer::binarySize(size_t __isz) const
__isz += 5;
for (const std::unique_ptr<IScriptObject>& obj : objects)
{
__isz += 1;
__isz += 5;
__isz = obj->binarySize(__isz);
}
return __isz;

View File

@ -11,7 +11,6 @@ namespace DNAMP1
struct IScriptObject : BigYAML
{
DECL_YAML
IScriptObject() {}
atUint32 type;
Value<atUint32> id;
struct Connection : BigYAML
@ -26,9 +25,7 @@ struct IScriptObject : BigYAML
Value<atUint32> connectionCount;
Vector<Connection, DNA_COUNT(connectionCount)> connections;
Value<atUint32> propertyCount;
virtual ~IScriptObject()
{
}
virtual ~IScriptObject() = default;
virtual void addCMDLRigPairs(PAKRouter<PAKBridge>&,
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>&) const {}

View File

@ -109,6 +109,19 @@ struct Oculus : IScriptObject
__dna_writer.writeFloatBig(unknown8);
}
size_t binarySize(size_t __isz) const
{
__isz = IScriptObject::binarySize(__isz);
__isz += name.size() + 1;
__isz = patternedInfo.binarySize(__isz);
__isz = actorParameters.binarySize(__isz);
__isz = damageVulnerabilty.binarySize(__isz);
__isz = damageInfo.binarySize(__isz);
if (propertyCount == 16)
__isz += 4;
return __isz + 64;
}
void read(athena::io::YAMLDocReader& __dna_docin)
{
IScriptObject::read(__dna_docin);

View File

@ -344,6 +344,51 @@ struct Ridley : IScriptObject
damageInfo9.write(__dna_writer);
}
size_t binarySize(size_t __isz) const
{
__isz = IScriptObject::binarySize(__isz);
__isz += name.size() + 1;
__isz = patternedInfo.binarySize(__isz);
__isz = actorParameters.binarySize(__isz);
__isz = model1.binarySize(__isz);
__isz = model2.binarySize(__isz);
if (propertyCount == 48)
{
__isz = model3.binarySize(__isz);
__isz = model4.binarySize(__isz);
__isz = model5.binarySize(__isz);
__isz = model6.binarySize(__isz);
__isz = model7.binarySize(__isz);
__isz = model8.binarySize(__isz);
__isz = model9.binarySize(__isz);
__isz = model10.binarySize(__isz);
__isz = model11.binarySize(__isz);
__isz = model12.binarySize(__isz);
}
__isz = particle.binarySize(__isz);
__isz = wpsc1.binarySize(__isz);
__isz = damageInfo1.binarySize(__isz);
__isz = ridleyStruct1.binarySize(__isz);
__isz = wpsc2.binarySize(__isz);
if (propertyCount == 40)
__isz = wpsc3.binarySize(__isz);
__isz = damageInfo2.binarySize(__isz);
__isz = ridleyStruct2_1.binarySize(__isz);
__isz = wpsc4.binarySize(__isz);
__isz = damageInfo3.binarySize(__isz);
__isz = ridleyStruct2_2.binarySize(__isz);
__isz = damageInfo4.binarySize(__isz);
__isz = ridleyStruct2_3.binarySize(__isz);
__isz = damageInfo5.binarySize(__isz);
__isz = damageInfo6.binarySize(__isz);
__isz = damageInfo7.binarySize(__isz);
__isz = elsc.binarySize(__isz);
__isz = damageInfo8.binarySize(__isz);
if (propertyCount == 40)
__isz = damageInfo9.binarySize(__isz);
return __isz + 88;
}
void read(athena::io::YAMLDocReader& __dna_docin)
{
IScriptObject::read(__dna_docin);

View File

@ -159,6 +159,25 @@ struct WorldTeleporter : IScriptObject
__dna_writer.writeFloatBig(unknown16);
}
}
size_t binarySize(size_t __isz) const
{
__isz = IScriptObject::binarySize(__isz);
__isz += name.size() + 1;
__isz = mlvl.binarySize(__isz);
__isz = mrea.binarySize(__isz);
__isz = animationParameters.binarySize(__isz);
__isz = model1.binarySize(__isz);
__isz = model2.binarySize(__isz);
__isz = font.binarySize(__isz);
__isz = strg.binarySize(__isz);
if (propertyCount == 26)
{
__isz += audioStream.size() + 1;
__isz += 13;
}
return __isz + 64;
}
void read(athena::io::YAMLDocReader& __dna_docin)
{

View File

@ -28,7 +28,7 @@ URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
{
SObjectTag areaTag = m_projManager.resourceFactoryMP1().ProjectResourceFactoryBase::TagFromPath(
_S("MP1/Metroid1/!1IntroLevel1027/01 Air Lock/!area.blend"));
_S("MP1/Metroid1/!1IntroLevel1027/00 Exterior Docking Hangar/!area.blend"));
auto areaData = m_projManager.resourceFactoryMP1().LoadResourceSync(areaTag);
//m_modelTest = objStore.GetObj("gun_cmdl");

2
hecl

@ -1 +1 @@
Subproject commit 52b3ba6582d7b5e19be8ad01eb47c95c3c8e9039
Subproject commit 7535cb1a2ff157cc759473ad272daa861e340e32