2015-08-15 04:12:15 +00:00
|
|
|
#include "ANCS.hpp"
|
|
|
|
|
2016-02-13 09:02:47 +00:00
|
|
|
namespace DataSpec
|
2015-08-15 04:12:15 +00:00
|
|
|
{
|
|
|
|
namespace DNAMP2
|
|
|
|
{
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void ANCS::CharacterSet::CharacterInfo::read(athena::io::IStreamReader& reader)
|
2015-08-15 04:12:15 +00:00
|
|
|
{
|
|
|
|
idx = reader.readUint32Big();
|
|
|
|
atUint16 sectionCount = reader.readUint16Big();
|
|
|
|
name = reader.readString();
|
|
|
|
cmdl.read(reader);
|
|
|
|
cskr.read(reader);
|
|
|
|
cinf.read(reader);
|
|
|
|
|
|
|
|
atUint32 animationCount = reader.readUint32Big();
|
|
|
|
reader.enumerate(animations, animationCount);
|
|
|
|
|
|
|
|
pasDatabase.read(reader);
|
|
|
|
|
|
|
|
atUint32 partCount = reader.readUint32Big();
|
|
|
|
reader.enumerate(partResData.part, partCount);
|
|
|
|
|
|
|
|
atUint32 swhcCount = reader.readUint32Big();
|
|
|
|
reader.enumerate(partResData.swhc, swhcCount);
|
|
|
|
|
|
|
|
atUint32 unkCount = reader.readUint32Big();
|
|
|
|
reader.enumerate(partResData.unk, unkCount);
|
|
|
|
|
|
|
|
atUint32 elscCount = reader.readUint32Big();
|
|
|
|
reader.enumerate(partResData.elsc, elscCount);
|
|
|
|
|
|
|
|
atUint32 spscCount = reader.readUint32Big();
|
|
|
|
reader.enumerate(partResData.spsc, spscCount);
|
|
|
|
|
|
|
|
atUint32 unkCount2 = reader.readUint32Big();
|
|
|
|
if (unkCount2)
|
|
|
|
abort();
|
|
|
|
reader.enumerate(partResData.unk2, unkCount2);
|
|
|
|
|
|
|
|
unk1 = reader.readUint32Big();
|
|
|
|
|
|
|
|
animAABBs.clear();
|
|
|
|
if (sectionCount > 1)
|
|
|
|
{
|
|
|
|
atUint32 aabbCount = reader.readUint32Big();
|
|
|
|
reader.enumerate(animAABBs, aabbCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
effects.clear();
|
|
|
|
if (sectionCount > 2)
|
|
|
|
{
|
|
|
|
atUint32 effectCount = reader.readUint32Big();
|
|
|
|
reader.enumerate(effects, effectCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 3)
|
|
|
|
{
|
2015-09-26 03:12:08 +00:00
|
|
|
cmdlOverlay.read(reader);
|
2015-09-27 02:24:03 +00:00
|
|
|
cskrOverlay.read(reader);
|
2015-08-15 04:12:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
animIdxs.clear();
|
|
|
|
if (sectionCount > 4)
|
|
|
|
{
|
|
|
|
atUint32 aidxCount = reader.readUint32Big();
|
|
|
|
reader.enumerateBig(animIdxs, aidxCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
extents.clear();
|
|
|
|
if (sectionCount > 9)
|
|
|
|
{
|
|
|
|
unk4 = reader.readUint32Big();
|
|
|
|
unk5 = reader.readUByte();
|
|
|
|
atUint32 extentsCount = reader.readUint32Big();
|
|
|
|
reader.enumerate(extents, extentsCount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void ANCS::CharacterSet::CharacterInfo::write(athena::io::IStreamWriter& writer) const
|
2015-08-15 04:12:15 +00:00
|
|
|
{
|
|
|
|
writer.writeUint32Big(idx);
|
|
|
|
|
|
|
|
atUint16 sectionCount;
|
|
|
|
if (unk4 || unk5 || extents.size())
|
|
|
|
sectionCount = 10;
|
|
|
|
else if (partResData.elsc.size())
|
|
|
|
sectionCount = 6;
|
|
|
|
else if (animIdxs.size())
|
|
|
|
sectionCount = 5;
|
2015-09-26 03:12:08 +00:00
|
|
|
else if (cmdlOverlay)
|
2015-08-15 04:12:15 +00:00
|
|
|
sectionCount = 4;
|
|
|
|
else if (effects.size())
|
|
|
|
sectionCount = 3;
|
|
|
|
else if (animAABBs.size())
|
|
|
|
sectionCount = 2;
|
|
|
|
else
|
|
|
|
sectionCount = 1;
|
|
|
|
writer.writeUint16Big(sectionCount);
|
|
|
|
|
|
|
|
writer.writeString(name);
|
|
|
|
cmdl.write(writer);
|
|
|
|
cskr.write(writer);
|
|
|
|
cinf.write(writer);
|
|
|
|
|
|
|
|
writer.writeUint32Big(animations.size());
|
|
|
|
writer.enumerate(animations);
|
|
|
|
|
|
|
|
pasDatabase.write(writer);
|
|
|
|
|
|
|
|
writer.writeUint32Big(partResData.part.size());
|
|
|
|
writer.enumerate(partResData.part);
|
|
|
|
|
|
|
|
writer.writeUint32Big(partResData.swhc.size());
|
|
|
|
writer.enumerate(partResData.swhc);
|
|
|
|
|
|
|
|
writer.writeUint32Big(partResData.unk.size());
|
|
|
|
writer.enumerate(partResData.unk);
|
|
|
|
|
|
|
|
writer.writeUint32Big(partResData.elsc.size());
|
|
|
|
writer.enumerate(partResData.elsc);
|
|
|
|
|
|
|
|
writer.writeUint32Big(partResData.spsc.size());
|
|
|
|
writer.enumerate(partResData.spsc);
|
|
|
|
|
|
|
|
writer.writeUint32Big(partResData.unk2.size());
|
|
|
|
writer.enumerate(partResData.unk2);
|
|
|
|
|
|
|
|
writer.writeUint32Big(unk1);
|
|
|
|
|
|
|
|
if (sectionCount > 1)
|
|
|
|
{
|
|
|
|
writer.writeUint32Big(animAABBs.size());
|
|
|
|
writer.enumerate(animAABBs);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 2)
|
|
|
|
{
|
|
|
|
writer.writeUint32Big(effects.size());
|
|
|
|
writer.enumerate(effects);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 3)
|
|
|
|
{
|
2015-09-26 03:12:08 +00:00
|
|
|
cmdlOverlay.write(writer);
|
2015-09-27 02:24:03 +00:00
|
|
|
cskrOverlay.write(writer);
|
2015-08-15 04:12:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 4)
|
|
|
|
{
|
|
|
|
writer.writeUint32Big(animIdxs.size());
|
|
|
|
for (atUint32 idx : animIdxs)
|
|
|
|
writer.writeUint32Big(idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 9)
|
|
|
|
{
|
|
|
|
writer.writeUint32Big(unk4);
|
|
|
|
writer.writeUByte(unk5);
|
|
|
|
writer.writeUint32Big(extents.size());
|
|
|
|
writer.enumerate(extents);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-18 04:08:45 +00:00
|
|
|
size_t ANCS::CharacterSet::CharacterInfo::binarySize(size_t __isz) const
|
|
|
|
{
|
|
|
|
atUint16 sectionCount;
|
|
|
|
if (unk4 || unk5 || extents.size())
|
|
|
|
sectionCount = 10;
|
|
|
|
else if (partResData.elsc.size())
|
|
|
|
sectionCount = 6;
|
|
|
|
else if (animIdxs.size())
|
|
|
|
sectionCount = 5;
|
|
|
|
else if (cmdlOverlay)
|
|
|
|
sectionCount = 4;
|
|
|
|
else if (effects.size())
|
|
|
|
sectionCount = 3;
|
|
|
|
else if (animAABBs.size())
|
|
|
|
sectionCount = 2;
|
|
|
|
else
|
|
|
|
sectionCount = 1;
|
|
|
|
|
|
|
|
__isz += 6;
|
|
|
|
|
|
|
|
__isz += name.size() + 1;
|
|
|
|
__isz += 12;
|
|
|
|
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, animations);
|
|
|
|
|
|
|
|
__isz = pasDatabase.binarySize(__isz);
|
|
|
|
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, partResData.part);
|
|
|
|
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, partResData.swhc);
|
|
|
|
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, partResData.unk);
|
|
|
|
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, partResData.elsc);
|
|
|
|
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, partResData.spsc);
|
|
|
|
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, partResData.unk2);
|
|
|
|
|
|
|
|
__isz += 4;
|
|
|
|
|
|
|
|
if (sectionCount > 1)
|
|
|
|
{
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, animAABBs);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 2)
|
|
|
|
{
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, effects);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 3)
|
|
|
|
__isz += 8;
|
|
|
|
|
|
|
|
if (sectionCount > 4)
|
|
|
|
__isz += 4 + animIdxs.size() * 4;
|
|
|
|
|
|
|
|
if (sectionCount > 9)
|
|
|
|
{
|
|
|
|
__isz += 9;
|
|
|
|
__isz = __EnumerateSize(__isz, extents);
|
|
|
|
}
|
|
|
|
|
|
|
|
return __isz;
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void ANCS::CharacterSet::CharacterInfo::read(athena::io::YAMLDocReader& reader)
|
2015-08-15 04:12:15 +00:00
|
|
|
{
|
|
|
|
idx = reader.readUint32("idx");
|
|
|
|
atUint16 sectionCount = reader.readUint16("sectionCount");
|
|
|
|
name = reader.readString("name");
|
|
|
|
reader.enumerate("cmdl", cmdl);
|
|
|
|
reader.enumerate("cskr", cskr);
|
|
|
|
reader.enumerate("cinf", cinf);
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("animations", animations);
|
2015-08-15 04:12:15 +00:00
|
|
|
|
|
|
|
reader.enumerate("pasDatabase", pasDatabase);
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("part", partResData.part);
|
2015-08-15 04:12:15 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("swhc", partResData.swhc);
|
2015-08-15 04:12:15 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("unk", partResData.unk);
|
2015-08-15 04:12:15 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("elsc", partResData.elsc);
|
2015-08-15 04:12:15 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("spsc", partResData.spsc);
|
2015-08-15 04:12:15 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("unk2", partResData.unk2);
|
2015-08-15 04:12:15 +00:00
|
|
|
|
|
|
|
unk1 = reader.readUint32("unk1");
|
|
|
|
|
|
|
|
animAABBs.clear();
|
|
|
|
if (sectionCount > 1)
|
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("part", animAABBs);
|
2015-08-15 04:12:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
effects.clear();
|
|
|
|
if (sectionCount > 2)
|
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("effects", effects);
|
2015-08-15 04:12:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 3)
|
|
|
|
{
|
2015-09-27 02:24:03 +00:00
|
|
|
reader.enumerate("cmdlOverlay", cmdlOverlay);
|
|
|
|
reader.enumerate("cskrOverlay", cskrOverlay);
|
2015-08-15 04:12:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
animIdxs.clear();
|
|
|
|
if (sectionCount > 4)
|
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("animIdxs", animIdxs);
|
2015-08-15 04:12:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
extents.clear();
|
|
|
|
if (sectionCount > 9)
|
|
|
|
{
|
|
|
|
unk4 = reader.readUint32("unk4");
|
|
|
|
unk5 = reader.readUByte("unk5");
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("extents", extents);
|
2015-08-15 04:12:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void ANCS::CharacterSet::CharacterInfo::write(athena::io::YAMLDocWriter& writer) const
|
2015-08-15 04:12:15 +00:00
|
|
|
{
|
|
|
|
writer.writeUint32("idx", idx);
|
|
|
|
|
|
|
|
atUint16 sectionCount;
|
|
|
|
if (unk4 || unk5 || extents.size())
|
|
|
|
sectionCount = 10;
|
|
|
|
else if (partResData.elsc.size())
|
|
|
|
sectionCount = 6;
|
|
|
|
else if (animIdxs.size())
|
|
|
|
sectionCount = 5;
|
2015-09-26 03:12:08 +00:00
|
|
|
else if (cmdlOverlay)
|
2015-08-15 04:12:15 +00:00
|
|
|
sectionCount = 4;
|
|
|
|
else if (effects.size())
|
|
|
|
sectionCount = 3;
|
|
|
|
else if (animAABBs.size())
|
|
|
|
sectionCount = 2;
|
|
|
|
else
|
|
|
|
sectionCount = 1;
|
|
|
|
writer.writeUint16("sectionCount", sectionCount);
|
|
|
|
|
|
|
|
writer.writeString("name", name);
|
|
|
|
writer.enumerate("cmdl", cmdl);
|
|
|
|
writer.enumerate("cskr", cskr);
|
|
|
|
writer.enumerate("cinf", cinf);
|
|
|
|
|
|
|
|
writer.enumerate("animations", animations);
|
|
|
|
|
|
|
|
writer.enumerate("pasDatabase", pasDatabase);
|
|
|
|
|
|
|
|
writer.enumerate("part", partResData.part);
|
|
|
|
|
|
|
|
writer.enumerate("swhc", partResData.swhc);
|
|
|
|
|
|
|
|
writer.enumerate("unk", partResData.unk);
|
|
|
|
|
|
|
|
writer.enumerate("elsc", partResData.elsc);
|
|
|
|
|
|
|
|
writer.enumerate("spsc", partResData.spsc);
|
|
|
|
|
|
|
|
writer.enumerate("unk2", partResData.unk2);
|
|
|
|
|
|
|
|
writer.writeUint32("unk1", unk1);
|
|
|
|
|
|
|
|
if (sectionCount > 1)
|
|
|
|
{
|
|
|
|
writer.enumerate("animAABBs", animAABBs);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 2)
|
|
|
|
{
|
|
|
|
writer.enumerate("effects", effects);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 3)
|
|
|
|
{
|
2015-09-27 02:24:03 +00:00
|
|
|
writer.enumerate("cmdlOverlay", cmdlOverlay);
|
|
|
|
writer.enumerate("cskrOverlay", cskrOverlay);
|
2015-08-15 04:12:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 4)
|
|
|
|
{
|
|
|
|
writer.enumerate("animIdxs", animIdxs);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 9)
|
|
|
|
{
|
|
|
|
writer.writeUint32("unk4", unk4);
|
|
|
|
writer.writeUByte("unk5", unk5);
|
|
|
|
writer.enumerate("extents", extents);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-01 00:40:21 +00:00
|
|
|
const char* ANCS::CharacterSet::CharacterInfo::DNAType()
|
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
return "urde::DNAMP2::ANCS::CharacterSet::CharacterInfo";
|
2015-10-01 00:40:21 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void ANCS::AnimationSet::read(athena::io::IStreamReader& reader)
|
2015-08-15 04:12:15 +00:00
|
|
|
{
|
|
|
|
atUint16 sectionCount = reader.readUint16Big();
|
|
|
|
|
|
|
|
atUint32 animationCount = reader.readUint32Big();
|
2016-04-06 01:44:07 +00:00
|
|
|
animations.clear();
|
|
|
|
animations.reserve(animationCount);
|
|
|
|
for (atUint32 i=0 ; i<animationCount ; ++i)
|
|
|
|
{
|
|
|
|
animations.emplace_back(m_ancsId);
|
|
|
|
animations.back().read(reader);
|
|
|
|
}
|
2015-08-15 04:12:15 +00:00
|
|
|
|
|
|
|
atUint32 transitionCount = reader.readUint32Big();
|
2016-04-06 01:44:07 +00:00
|
|
|
transitions.clear();
|
|
|
|
transitions.reserve(transitionCount);
|
|
|
|
for (atUint32 i=0 ; i<transitionCount ; ++i)
|
|
|
|
{
|
|
|
|
transitions.emplace_back(m_ancsId);
|
|
|
|
transitions.back().read(reader);
|
|
|
|
}
|
|
|
|
|
2015-08-15 04:12:15 +00:00
|
|
|
defaultTransition.read(reader);
|
|
|
|
|
|
|
|
additiveAnims.clear();
|
|
|
|
if (sectionCount > 1)
|
|
|
|
{
|
|
|
|
atUint32 additiveAnimCount = reader.readUint32Big();
|
|
|
|
reader.enumerate(additiveAnims, additiveAnimCount);
|
|
|
|
floatA = reader.readFloatBig();
|
|
|
|
floatB = reader.readFloatBig();
|
|
|
|
}
|
|
|
|
|
|
|
|
halfTransitions.clear();
|
|
|
|
if (sectionCount > 2)
|
|
|
|
{
|
2016-04-06 01:44:07 +00:00
|
|
|
atUint32 halfTransitionCount = reader.readUint32Big();
|
|
|
|
halfTransitions.clear();
|
|
|
|
halfTransitions.reserve(halfTransitionCount);
|
|
|
|
for (atUint32 i=0 ; i<halfTransitionCount ; ++i)
|
|
|
|
{
|
|
|
|
halfTransitions.emplace_back(m_ancsId);
|
|
|
|
halfTransitions.back().read(reader);
|
|
|
|
}
|
2015-08-15 04:12:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
evnts.clear();
|
|
|
|
if (sectionCount > 3)
|
|
|
|
{
|
|
|
|
atUint32 evntsCount = reader.readUint32Big();
|
|
|
|
reader.enumerate(evnts, evntsCount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void ANCS::AnimationSet::write(athena::io::IStreamWriter& writer) const
|
2015-08-15 04:12:15 +00:00
|
|
|
{
|
|
|
|
atUint16 sectionCount;
|
|
|
|
if (evnts.size())
|
|
|
|
sectionCount = 4;
|
|
|
|
else if (halfTransitions.size())
|
|
|
|
sectionCount = 3;
|
|
|
|
else if (additiveAnims.size())
|
|
|
|
sectionCount = 2;
|
|
|
|
else
|
|
|
|
sectionCount = 1;
|
|
|
|
|
|
|
|
writer.writeUint16Big(sectionCount);
|
|
|
|
|
|
|
|
writer.writeUint32Big(animations.size());
|
|
|
|
writer.enumerate(animations);
|
|
|
|
|
|
|
|
writer.writeUint32Big(transitions.size());
|
|
|
|
writer.enumerate(transitions);
|
|
|
|
defaultTransition.write(writer);
|
|
|
|
|
|
|
|
if (sectionCount > 1)
|
|
|
|
{
|
|
|
|
writer.writeUint32Big(additiveAnims.size());
|
|
|
|
writer.enumerate(additiveAnims);
|
|
|
|
writer.writeFloatBig(floatA);
|
|
|
|
writer.writeFloatBig(floatB);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 2)
|
|
|
|
{
|
|
|
|
writer.writeUint32Big(halfTransitions.size());
|
|
|
|
writer.enumerate(halfTransitions);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 3)
|
|
|
|
{
|
|
|
|
writer.writeUint32Big(evnts.size());
|
|
|
|
writer.enumerate(evnts);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-18 04:08:45 +00:00
|
|
|
size_t ANCS::AnimationSet::binarySize(size_t __isz) const
|
|
|
|
{
|
|
|
|
atUint16 sectionCount;
|
|
|
|
if (evnts.size())
|
|
|
|
sectionCount = 4;
|
|
|
|
else if (halfTransitions.size())
|
|
|
|
sectionCount = 3;
|
|
|
|
else if (additiveAnims.size())
|
|
|
|
sectionCount = 2;
|
|
|
|
else
|
|
|
|
sectionCount = 1;
|
|
|
|
|
|
|
|
__isz += 6;
|
|
|
|
__isz = __EnumerateSize(__isz, animations);
|
|
|
|
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, transitions);
|
|
|
|
__isz = defaultTransition.binarySize(__isz);
|
|
|
|
|
|
|
|
if (sectionCount > 1)
|
|
|
|
{
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, additiveAnims);
|
|
|
|
__isz += 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 2)
|
|
|
|
{
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, halfTransitions);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 3)
|
|
|
|
{
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, evnts);
|
|
|
|
}
|
|
|
|
|
|
|
|
return __isz;
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void ANCS::AnimationSet::read(athena::io::YAMLDocReader& reader)
|
2015-08-15 04:12:15 +00:00
|
|
|
{
|
|
|
|
atUint16 sectionCount = reader.readUint16("sectionCount");
|
|
|
|
|
2016-04-06 01:44:07 +00:00
|
|
|
size_t animationCount;
|
|
|
|
reader.enterSubVector("animations", animationCount);
|
|
|
|
animations.clear();
|
|
|
|
animations.reserve(animationCount);
|
|
|
|
for (size_t i=0 ; i<animationCount ; ++i)
|
|
|
|
{
|
|
|
|
animations.emplace_back(m_ancsId);
|
|
|
|
reader.enterSubRecord(nullptr);
|
|
|
|
animations.back().read(reader);
|
|
|
|
reader.leaveSubRecord();
|
|
|
|
}
|
|
|
|
reader.leaveSubVector();
|
|
|
|
|
|
|
|
size_t transitionCount;
|
|
|
|
reader.enterSubVector("transitions", transitionCount);
|
|
|
|
transitions.clear();
|
|
|
|
transitions.reserve(transitionCount);
|
|
|
|
for (size_t i=0 ; i<transitionCount ; ++i)
|
|
|
|
{
|
|
|
|
transitions.emplace_back(m_ancsId);
|
|
|
|
reader.enterSubRecord(nullptr);
|
|
|
|
transitions.back().read(reader);
|
|
|
|
reader.leaveSubRecord();
|
|
|
|
}
|
|
|
|
reader.leaveSubVector();
|
2015-08-15 04:12:15 +00:00
|
|
|
|
|
|
|
reader.enumerate("defaultTransition", defaultTransition);
|
|
|
|
|
|
|
|
additiveAnims.clear();
|
|
|
|
if (sectionCount > 1)
|
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("additiveAnims", additiveAnims);
|
2015-08-15 04:12:15 +00:00
|
|
|
floatA = reader.readFloat("floatA");
|
|
|
|
floatB = reader.readFloat("floatB");
|
|
|
|
}
|
|
|
|
|
|
|
|
halfTransitions.clear();
|
|
|
|
if (sectionCount > 2)
|
|
|
|
{
|
2016-04-06 01:44:07 +00:00
|
|
|
size_t halfTransitionCount;
|
|
|
|
reader.enterSubVector("halfTransitions", halfTransitionCount);
|
|
|
|
halfTransitions.reserve(halfTransitionCount);
|
|
|
|
for (size_t i=0 ; i<halfTransitionCount ; ++i)
|
|
|
|
{
|
|
|
|
halfTransitions.emplace_back(m_ancsId);
|
|
|
|
reader.enterSubRecord(nullptr);
|
|
|
|
halfTransitions.back().read(reader);
|
|
|
|
reader.leaveSubRecord();
|
|
|
|
}
|
|
|
|
reader.leaveSubVector();
|
2015-08-15 04:12:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
evnts.clear();
|
|
|
|
if (sectionCount > 3)
|
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("evnts", evnts);
|
2015-08-15 04:12:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void ANCS::AnimationSet::write(athena::io::YAMLDocWriter& writer) const
|
2015-08-15 04:12:15 +00:00
|
|
|
{
|
|
|
|
atUint16 sectionCount;
|
|
|
|
if (evnts.size())
|
|
|
|
sectionCount = 4;
|
|
|
|
else if (halfTransitions.size())
|
|
|
|
sectionCount = 3;
|
|
|
|
else if (additiveAnims.size())
|
|
|
|
sectionCount = 2;
|
|
|
|
else
|
|
|
|
sectionCount = 1;
|
|
|
|
|
|
|
|
writer.writeUint16("sectionCount", sectionCount);
|
|
|
|
|
|
|
|
writer.enumerate("animations", animations);
|
|
|
|
|
|
|
|
writer.enumerate("transitions", transitions);
|
|
|
|
writer.enumerate("defaultTransition", defaultTransition);
|
|
|
|
|
|
|
|
if (sectionCount > 1)
|
|
|
|
{
|
|
|
|
writer.enumerate("additiveAnims", additiveAnims);
|
|
|
|
writer.writeFloat("floatA", floatA);
|
|
|
|
writer.writeFloat("floatB", floatB);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 2)
|
|
|
|
{
|
|
|
|
writer.enumerate("halfTransitions", halfTransitions);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sectionCount > 3)
|
|
|
|
{
|
|
|
|
writer.enumerate("evnts", evnts);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-01 00:40:21 +00:00
|
|
|
const char* ANCS::AnimationSet::DNAType()
|
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
return "urde::DNAMP2::ANCS::AnimationSet";
|
2015-10-01 00:40:21 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void ANCS::AnimationSet::EVNT::read(athena::io::IStreamReader& reader)
|
2015-08-15 04:12:15 +00:00
|
|
|
{
|
|
|
|
version = reader.readUint32Big();
|
|
|
|
|
|
|
|
atUint32 loopCount = reader.readUint32Big();
|
|
|
|
reader.enumerate(loopEvents, loopCount);
|
|
|
|
|
|
|
|
uevtEvents.clear();
|
|
|
|
if (version == 2)
|
|
|
|
{
|
|
|
|
atUint32 uevtCount = reader.readUint32Big();
|
|
|
|
reader.enumerate(uevtEvents, uevtCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
atUint32 effectCount = reader.readUint32Big();
|
|
|
|
reader.enumerate(effectEvents, effectCount);
|
|
|
|
|
|
|
|
atUint32 sfxCount = reader.readUint32Big();
|
|
|
|
reader.enumerate(sfxEvents, sfxCount);
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void ANCS::AnimationSet::EVNT::write(athena::io::IStreamWriter& writer) const
|
2015-08-15 04:12:15 +00:00
|
|
|
{
|
|
|
|
writer.writeUint32Big(version);
|
|
|
|
|
|
|
|
writer.writeUint32Big(loopEvents.size());
|
|
|
|
writer.enumerate(loopEvents);
|
|
|
|
|
|
|
|
if (version == 2)
|
|
|
|
{
|
|
|
|
writer.writeUint32Big(uevtEvents.size());
|
|
|
|
writer.enumerate(uevtEvents);
|
|
|
|
}
|
|
|
|
|
|
|
|
writer.writeUint32Big(effectEvents.size());
|
|
|
|
writer.enumerate(effectEvents);
|
|
|
|
|
|
|
|
writer.writeUint32Big(sfxEvents.size());
|
|
|
|
writer.enumerate(sfxEvents);
|
|
|
|
}
|
|
|
|
|
2015-10-18 04:08:45 +00:00
|
|
|
size_t ANCS::AnimationSet::EVNT::binarySize(size_t __isz) const
|
|
|
|
{
|
|
|
|
__isz += 4;
|
|
|
|
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, loopEvents);
|
|
|
|
|
|
|
|
if (version == 2)
|
|
|
|
{
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, uevtEvents);
|
|
|
|
}
|
|
|
|
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, effectEvents);
|
|
|
|
|
|
|
|
__isz += 4;
|
|
|
|
__isz = __EnumerateSize(__isz, sfxEvents);
|
|
|
|
|
|
|
|
return __isz;
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void ANCS::AnimationSet::EVNT::read(athena::io::YAMLDocReader& reader)
|
2015-08-15 04:12:15 +00:00
|
|
|
{
|
|
|
|
version = reader.readUint32("version");
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("loopEvents", loopEvents);
|
2015-08-15 04:12:15 +00:00
|
|
|
|
|
|
|
uevtEvents.clear();
|
|
|
|
if (version == 2)
|
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("uevtEvents", uevtEvents);
|
2015-08-15 04:12:15 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("effectEvents", effectEvents);
|
2015-08-15 04:12:15 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
reader.enumerate("sfxEvents", sfxEvents);
|
2015-08-15 04:12:15 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void ANCS::AnimationSet::EVNT::write(athena::io::YAMLDocWriter& writer) const
|
2015-08-15 04:12:15 +00:00
|
|
|
{
|
|
|
|
writer.writeUint32("version", version);
|
|
|
|
|
|
|
|
writer.enumerate("loopEvents", loopEvents);
|
|
|
|
|
|
|
|
if (version == 2)
|
|
|
|
{
|
|
|
|
writer.enumerate("uevtEvents", uevtEvents);
|
|
|
|
}
|
|
|
|
|
|
|
|
writer.enumerate("effectEvents", effectEvents);
|
|
|
|
|
|
|
|
writer.enumerate("sfxEvents", sfxEvents);
|
|
|
|
}
|
|
|
|
|
2015-10-01 00:40:21 +00:00
|
|
|
const char* ANCS::AnimationSet::EVNT::DNAType()
|
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
return "urde::DNAMP2::ANCS::AnimationSet::EVNT";
|
2015-10-01 00:40:21 +00:00
|
|
|
}
|
|
|
|
|
2015-08-15 04:12:15 +00:00
|
|
|
}
|
|
|
|
}
|