#ifndef _DNAMP2_ANIM_HPP_ #define _DNAMP2_ANIM_HPP_ #include "BlenderConnection.hpp" #include "DNAMP2.hpp" #include "../DNACommon/ANIM.hpp" #include "CINF.hpp" namespace Retro { namespace DNAMP2 { struct ANIM : BigDNA { Delete expl; struct IANIM : BigDNA { Delete expl; atUint32 m_version; IANIM(atUint32 version) : m_version(version) {} std::vector>> bones; std::vector frames; std::vector channels; std::vector> chanKeys; float mainInterval = 0.0; void sendANIMToBlender(HECL::BlenderConnection::PyOutStream&, const CINF&) const; }; struct ANIM0 : IANIM { DECL_EXPLICIT_DNA ANIM0() : IANIM(0) {} struct Header : BigDNA { DECL_DNA Value duration; Value unk0; Value interval; Value unk1; Value keyCount; Value unk2; Value boneSlotCount; }; }; struct ANIM2 : IANIM { DECL_EXPLICIT_DNA ANIM2() : IANIM(2) {} struct Header : BigDNA { DECL_DNA Value scratchSize; Value unk1; Value unk2; Value duration; Value interval; Value unk3; Value unk4; Value rotDiv; Value translationMult; Value unk5; Value boneChannelCount; Value unk6; Value keyBitmapBitCount; }; struct ChannelDesc : BigDNA { Delete expl; Value id = 0; Value keyCount1 = 0; Value initRX = 0; Value qRX = 0; Value initRY = 0; Value qRY = 0; Value initRZ = 0; Value qRZ = 0; Value keyCount2 = 0; Value initTX = 0; Value qTX = 0; Value initTY = 0; Value qTY = 0; Value initTZ = 0; Value qTZ = 0; Value keyCount3 = 0; Value initSX = 0; Value qSX = 0; Value initSY = 0; Value qSY = 0; Value initSZ = 0; Value qSZ = 0; void read(Athena::io::IStreamReader& reader) { id = reader.readUByte(); keyCount1 = reader.readUint16Big(); if (keyCount1) { initRX = reader.readUint16Big(); qRX = reader.readUByte(); initRY = reader.readUint16Big(); qRY = reader.readUByte(); initRZ = reader.readUint16Big(); qRZ = reader.readUByte(); } keyCount2 = reader.readUint16Big(); if (keyCount2) { initTX = reader.readUint16Big(); qTX = reader.readUByte(); initTY = reader.readUint16Big(); qTY = reader.readUByte(); initTZ = reader.readUint16Big(); qTZ = reader.readUByte(); } keyCount3 = reader.readUint16Big(); if (keyCount3) { initSX = reader.readUint16Big(); qSX = reader.readUByte(); initSY = reader.readUint16Big(); qSY = reader.readUByte(); initSZ = reader.readUint16Big(); qSZ = reader.readUByte(); } } void write(Athena::io::IStreamWriter& writer) const { writer.writeUByte(id); writer.writeUint16Big(keyCount1); if (keyCount1) { writer.writeUint16Big(initRX); writer.writeUByte(qRX); writer.writeUint16Big(initRY); writer.writeUByte(qRY); writer.writeUint16Big(initRZ); writer.writeUByte(qRZ); } writer.writeUint16Big(keyCount2); if (keyCount2) { writer.writeUint16Big(initTX); writer.writeUByte(qTX); writer.writeUint16Big(initTY); writer.writeUByte(qTY); writer.writeUint16Big(initTZ); writer.writeUByte(qTZ); } writer.writeUint16Big(keyCount3); if (keyCount3) { writer.writeUint16Big(initSX); writer.writeUByte(qSX); writer.writeUint16Big(initSY); writer.writeUByte(qSY); writer.writeUint16Big(initSZ); writer.writeUByte(qSZ); } } }; }; std::unique_ptr m_anim; void read(Athena::io::IStreamReader& reader) { atUint32 version = reader.readUint32Big(); switch (version) { case 0: m_anim.reset(new struct ANIM0); m_anim->read(reader); break; case 2: m_anim.reset(new struct ANIM2); m_anim->read(reader); break; default: Log.report(LogVisor::FatalError, "unrecognized ANIM version"); break; } } void write(Athena::io::IStreamWriter& writer) const { writer.writeUint32Big(m_anim->m_version); m_anim->write(writer); } void sendANIMToBlender(HECL::BlenderConnection::PyOutStream& os, const CINF& cinf, bool) const { m_anim->sendANIMToBlender(os, cinf); } }; } } #endif // _DNAMP2_ANIM_HPP_