metaforce/DataSpec/DNAMP1/EVNT.cpp

97 lines
2.2 KiB
C++
Raw Normal View History

2015-08-15 04:12:15 +00:00
#include "EVNT.hpp"
2017-12-29 08:08:12 +00:00
namespace DataSpec::DNAMP1
2015-08-15 04:12:15 +00:00
{
2016-03-04 23:04:53 +00:00
void EVNT::read(athena::io::IStreamReader& reader)
2015-08-15 04:12:15 +00:00
{
version = reader.readUint32Big();
atUint32 loopCount = reader.readUint32Big();
reader.enumerate(boolPOINodes, loopCount);
2015-08-15 04:12:15 +00:00
int32POINodes.clear();
2016-01-19 05:32:34 +00:00
atUint32 uevtCount = reader.readUint32Big();
reader.enumerate(int32POINodes, uevtCount);
2015-08-15 04:12:15 +00:00
atUint32 effectCount = reader.readUint32Big();
reader.enumerate(particlePOINodes, effectCount);
2015-08-15 04:12:15 +00:00
2016-01-19 05:32:34 +00:00
if (version == 2)
{
atUint32 sfxCount = reader.readUint32Big();
reader.enumerate(soundPOINodes, sfxCount);
2016-01-19 05:32:34 +00:00
}
2015-08-15 04:12:15 +00:00
}
2016-03-04 23:04:53 +00:00
void EVNT::write(athena::io::IStreamWriter& writer) const
2015-08-15 04:12:15 +00:00
{
writer.writeUint32Big(version);
writer.writeUint32Big(boolPOINodes.size());
writer.enumerate(boolPOINodes);
2015-08-15 04:12:15 +00:00
writer.writeUint32Big(int32POINodes.size());
writer.enumerate(int32POINodes);
2015-08-15 04:12:15 +00:00
writer.writeUint32Big(particlePOINodes.size());
writer.enumerate(particlePOINodes);
2015-08-15 04:12:15 +00:00
2016-01-19 05:32:34 +00:00
if (version == 2)
{
writer.writeUint32Big(soundPOINodes.size());
writer.enumerate(soundPOINodes);
2016-01-19 05:32:34 +00:00
}
2015-08-15 04:12:15 +00:00
}
2016-03-04 23:04:53 +00:00
void EVNT::read(athena::io::YAMLDocReader& reader)
2015-08-15 04:12:15 +00:00
{
version = reader.readUint32("version");
reader.enumerate("boolPOINodes", boolPOINodes);
2015-08-15 04:12:15 +00:00
int32POINodes.clear();
reader.enumerate("int32POINodes", int32POINodes);
2015-08-15 04:12:15 +00:00
reader.enumerate("particlePOINodes", particlePOINodes);
2015-08-15 04:12:15 +00:00
2016-01-19 05:32:34 +00:00
if (version == 2)
{
reader.enumerate("soundPOINodes", soundPOINodes);
2016-01-19 05:32:34 +00:00
}
2015-08-15 04:12:15 +00:00
}
2016-03-04 23:04:53 +00:00
void EVNT::write(athena::io::YAMLDocWriter& writer) const
2015-08-15 04:12:15 +00:00
{
writer.writeUint32("version", version);
writer.enumerate("boolPOINodes", boolPOINodes);
2015-08-15 04:12:15 +00:00
writer.enumerate("int32POINodes", int32POINodes);
2016-01-19 05:32:34 +00:00
writer.enumerate("particlePOINodes", particlePOINodes);
2016-01-19 05:32:34 +00:00
2015-08-15 04:12:15 +00:00
if (version == 2)
{
writer.enumerate("soundPOINodes", soundPOINodes);
2015-08-15 04:12:15 +00:00
}
2016-01-19 05:32:34 +00:00
}
2015-08-15 04:12:15 +00:00
2016-01-19 05:32:34 +00:00
const char* EVNT::DNAType()
{
2016-03-04 23:04:53 +00:00
return "urde::DNAMP1::EVNT";
2016-01-19 05:32:34 +00:00
}
size_t EVNT::binarySize(size_t __isz) const
{
__isz = __EnumerateSize(__isz, boolPOINodes);
__isz = __EnumerateSize(__isz, int32POINodes);
__isz = __EnumerateSize(__isz, particlePOINodes);
2016-01-19 05:32:34 +00:00
if (version == 2)
__isz = __EnumerateSize(__isz, soundPOINodes);
2015-08-15 04:12:15 +00:00
2016-01-19 05:32:34 +00:00
return __isz + (version == 2 ? 20 : 16);
2015-08-15 04:12:15 +00:00
}
}