Shipwright/OTRExporter/OTRExporter/SkeletonExporter.cpp
Nicholas Estelami c80f9fbd57
Added support for multiple game versions (#107)
* WIP Multiversion support

* GC PAL Non-MQ support complete

* Updated OtrGui to handle different game versions

* Added version file

* Added new extract mode to ZAPD and optimized OTR gen time

* Fixed bug causing crash

* Further optimized OTRExporter, saving around ~20 seconds.

* ZAPD is now multi-threaded.

* Fixed merge issue

* Fixed memory leak and fog issue on pause screen.

* Additional fog fixes.

Co-authored-by: Jack Walker <7463599+Jack-Walker@users.noreply.github.com>
2022-03-31 19:42:44 -04:00

40 lines
1.1 KiB
C++

#include "SkeletonExporter.h"
#include <Resource.h>
#include <Globals.h>
#include "DisplayListExporter.h"
void OTRExporter_Skeleton::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZSkeleton* skel = (ZSkeleton*)res;
WriteHeader(res, outPath, writer, Ship::ResourceType::Skeleton);
writer->Write((uint8_t)skel->type);
writer->Write((uint8_t)skel->limbType);
writer->Write((uint32_t)skel->limbCount);
writer->Write((uint32_t)skel->dListCount);
writer->Write((uint8_t)skel->limbsTable.limbType);
writer->Write((uint32_t)skel->limbsTable.count);
for (size_t i = 0; i < skel->limbsTable.count; i++)
{
Declaration* skelDecl = skel->parent->GetDeclarationRanged(GETSEGOFFSET(skel->limbsTable.limbsAddresses[i]));
std::string name;
bool foundDecl = Globals::Instance->GetSegmentedPtrName(skel->limbsTable.limbsAddresses[i], skel->parent, "", name, res->parent->workerID);
if (foundDecl)
{
if (name.at(0) == '&')
name.erase(0, 1);
writer->Write(OTRExporter_DisplayList::GetPathToRes(res, name));
}
else
{
writer->Write("");
}
}
}