mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-08 11:20:23 -05:00
09432ee7f4
* Initial Linux/GCC support commit * Add instructins for linux in the README * apply suggestions by @Erotemic and @Emill * Fix python 3.10 symlink line * Fix func_80041E80 type mismatch (#3) Type mismatch functions.h:664 * Makefile: clean OTRExporter/libultraship/ZAPDTR with distclean and fix CXX_FILES * Makefile: find C/CXX_FILES automatically * Makefile: remove ugly conditions in find commands * cleanup _MSC_VER usage * fix Windows build * cleanup extraction scripts * fix Windows build * Fix Windows path separator issue * fix rumble support for linux * use glew-cmake in dockerfile * add pulseaudio backend * fix ZAPDTR linkage * Check for "soh.elf" in directory (#6) hide second button if `soh.exe` or `soh.elf` is present * Fix hardcoded segment addresses (#5) * fix condition * hack lus -> soh dep for ZAPDTR Co-authored-by: sholdee <102821812+sholdee@users.noreply.github.com> Co-authored-by: qurious-pixel <62252937+qurious-pixel@users.noreply.github.com> Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>
71 lines
2.0 KiB
C++
71 lines
2.0 KiB
C++
#include "AnimationExporter.h"
|
|
#include <Animation.h>
|
|
|
|
void OTRExporter_Animation::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
|
|
{
|
|
ZAnimation* anim = (ZAnimation*)res;
|
|
|
|
WriteHeader(res, outPath, writer, Ship::ResourceType::Animation);
|
|
|
|
ZNormalAnimation* normalAnim = dynamic_cast<ZNormalAnimation*>(anim);
|
|
ZCurveAnimation* curveAnim = dynamic_cast<ZCurveAnimation*>(anim);
|
|
ZLinkAnimation* linkAnim = dynamic_cast<ZLinkAnimation*>(anim);
|
|
if (linkAnim != nullptr)
|
|
{
|
|
writer->Write((uint32_t)Ship::AnimationType::Link);
|
|
writer->Write((uint16_t)linkAnim->frameCount);
|
|
writer->Write((uint32_t)linkAnim->segmentAddress);
|
|
}
|
|
else if (curveAnim != nullptr)
|
|
{
|
|
writer->Write((uint32_t)Ship::AnimationType::Curve);
|
|
writer->Write((uint16_t)curveAnim->frameCount);
|
|
|
|
writer->Write((uint32_t)curveAnim->refIndexArr.size());
|
|
|
|
for (auto val : curveAnim->refIndexArr)
|
|
writer->Write(val);
|
|
|
|
writer->Write((uint32_t)curveAnim->transformDataArr.size());
|
|
|
|
for (auto val : curveAnim->transformDataArr)
|
|
{
|
|
writer->Write(val.unk_00);
|
|
writer->Write(val.unk_02);
|
|
writer->Write(val.unk_04);
|
|
writer->Write(val.unk_06);
|
|
writer->Write(val.unk_08);
|
|
}
|
|
|
|
writer->Write((uint32_t)curveAnim->copyValuesArr.size());
|
|
|
|
for (auto val : curveAnim->copyValuesArr)
|
|
writer->Write(val);
|
|
}
|
|
else if (normalAnim != nullptr)
|
|
{
|
|
writer->Write((uint32_t)Ship::AnimationType::Normal);
|
|
writer->Write((uint16_t)normalAnim->frameCount);
|
|
|
|
writer->Write((uint32_t)normalAnim->rotationValues.size());
|
|
|
|
for (size_t i = 0; i < normalAnim->rotationValues.size(); i++)
|
|
writer->Write(normalAnim->rotationValues[i]);
|
|
|
|
writer->Write((uint32_t)normalAnim->rotationIndices.size());
|
|
|
|
for (size_t i = 0; i < normalAnim->rotationIndices.size(); i++)
|
|
{
|
|
writer->Write(normalAnim->rotationIndices[i].x);
|
|
writer->Write(normalAnim->rotationIndices[i].y);
|
|
writer->Write(normalAnim->rotationIndices[i].z);
|
|
}
|
|
|
|
writer->Write(normalAnim->limit);
|
|
}
|
|
else
|
|
{
|
|
writer->Write((uint32_t)Ship::AnimationType::Legacy);
|
|
}
|
|
}
|