2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 22:27:43 +00:00

More AnimSourceReader imps

This commit is contained in:
Jack Andersen
2016-04-11 20:15:32 -10:00
parent faacffba77
commit 41f482daeb
24 changed files with 650 additions and 58 deletions

View File

@@ -1,5 +1,7 @@
#include "CAllFormatsAnimSource.hpp"
#include "logvisor/logvisor.hpp"
#include "CSimplePool.hpp"
#include "CAnimSourceReader.hpp"
namespace urde
{
@@ -24,9 +26,36 @@ CAnimFormatUnion::CAnimFormatUnion(CInputStream& in, IObjectStore& store)
SubConstruct(x4_storage, x0_format, in, store);
}
CAnimFormatUnion::~CAnimFormatUnion()
{
switch (x0_format)
{
case EAnimFormat::Uncompressed:
reinterpret_cast<CAnimSource*>(x4_storage)->~CAnimSource();
default: break;
}
}
std::shared_ptr<CAnimSourceReaderBase>
CAllFormatsAnimSource::GetNewReader(const TLockedToken<CAllFormatsAnimSource>& tok,
const CCharAnimTime& startTime)
{
return std::make_shared<CAnimSourceReader>(tok, startTime);
}
CAllFormatsAnimSource::CAllFormatsAnimSource(CInputStream& in,
IObjectStore& store,
const SObjectTag& tag)
: CAnimFormatUnion(in, store), x74_tag(tag) {}
CFactoryFnReturn AnimSourceFactory(const SObjectTag& tag, CInputStream& in,
const CVParamTransfer& params)
{
CSimplePool* sp = static_cast<CSimplePool*>(
static_cast<TObjOwnerParam<IObjectStore*>*>(
params.GetObj())->GetParam());
return TToken<CAllFormatsAnimSource>::GetIObjObjectFor(
std::make_unique<CAllFormatsAnimSource>(in, *sp, tag));
}
}