2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2015-08-17 23:46:41 +00:00
|
|
|
|
2019-09-23 19:00:23 +00:00
|
|
|
#include <memory>
|
|
|
|
#include <string_view>
|
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Runtime/CSimplePool.hpp"
|
|
|
|
#include "Runtime/CToken.hpp"
|
|
|
|
#include "Runtime/IFactory.hpp"
|
|
|
|
#include "Runtime/IObjFactory.hpp"
|
|
|
|
#include "Runtime/Character/CAnimationSet.hpp"
|
2022-03-16 06:33:39 +00:00
|
|
|
#include "Runtime/Character/CCharacterInfo.hpp"
|
2015-08-18 05:54:43 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2019-09-23 19:00:23 +00:00
|
|
|
class CAdditiveAnimationInfo;
|
|
|
|
class CAllFormatsAnimSource;
|
2016-04-13 06:07:23 +00:00
|
|
|
class CAnimCharacterSet;
|
2019-09-23 19:00:23 +00:00
|
|
|
class CAnimData;
|
|
|
|
class CAnimationManager;
|
2016-04-13 06:07:23 +00:00
|
|
|
class CCharLayoutInfo;
|
2019-09-23 19:00:23 +00:00
|
|
|
class CSimplePool;
|
2016-04-13 06:07:23 +00:00
|
|
|
class CTransitionDatabaseGame;
|
|
|
|
class CTransitionManager;
|
2015-08-18 05:54:43 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CCharacterFactory : public IObjFactory {
|
2015-08-18 05:54:43 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
class CDummyFactory : public IFactory {
|
|
|
|
public:
|
2019-08-09 19:46:49 +00:00
|
|
|
CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&, CObjectReference* selfRef) override;
|
|
|
|
void BuildAsync(const SObjectTag&, const CVParamTransfer&, std::unique_ptr<IObj>*,
|
|
|
|
CObjectReference* selfRef) override;
|
|
|
|
void CancelBuild(const SObjectTag&) override;
|
|
|
|
bool CanBuild(const SObjectTag&) override;
|
|
|
|
const SObjectTag* GetResourceIdByName(std::string_view) const override;
|
|
|
|
FourCC GetResourceTypeById(CAssetId id) const override;
|
2016-07-23 21:41:18 +00:00
|
|
|
|
2019-08-09 19:46:49 +00:00
|
|
|
void EnumerateResources(const std::function<bool(const SObjectTag&)>& lambda) const override;
|
|
|
|
void EnumerateNamedResources(const std::function<bool(std::string_view, const SObjectTag&)>& lambda) const override;
|
2016-09-25 01:58:20 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
u32 ResourceSize(const metaforce::SObjectTag& tag) override;
|
|
|
|
std::shared_ptr<IDvdRequest> LoadResourceAsync(const metaforce::SObjectTag& tag, void* target) override;
|
|
|
|
std::shared_ptr<IDvdRequest> LoadResourcePartAsync(const metaforce::SObjectTag& tag, u32 off, u32 size,
|
2019-08-09 19:46:49 +00:00
|
|
|
void* target) override;
|
2021-04-10 08:42:06 +00:00
|
|
|
std::unique_ptr<u8[]> LoadResourceSync(const metaforce::SObjectTag& tag) override;
|
|
|
|
std::unique_ptr<u8[]> LoadNewResourcePartSync(const metaforce::SObjectTag& tag, u32 off, u32 size) override;
|
2018-12-08 05:30:43 +00:00
|
|
|
};
|
2016-04-13 06:07:23 +00:00
|
|
|
|
|
|
|
private:
|
2018-12-08 05:30:43 +00:00
|
|
|
std::vector<CCharacterInfo> x4_charInfoDB;
|
|
|
|
std::vector<TLockedToken<CCharLayoutInfo>> x14_charLayoutInfoDB;
|
|
|
|
std::shared_ptr<CAnimSysContext> x24_sysContext;
|
|
|
|
std::shared_ptr<CAnimationManager> x28_animMgr;
|
|
|
|
std::shared_ptr<CTransitionManager> x2c_transMgr;
|
|
|
|
std::vector<TCachedToken<CAllFormatsAnimSource>> x30_animSourceDB;
|
|
|
|
std::vector<std::pair<u32, CAdditiveAnimationInfo>> x40_additiveInfo;
|
|
|
|
CAdditiveAnimationInfo x50_defaultAdditiveInfo;
|
|
|
|
std::vector<std::pair<CAssetId, CAssetId>> x58_animResources;
|
|
|
|
CAssetId x68_selfId;
|
|
|
|
CDummyFactory x6c_dummyFactory;
|
|
|
|
CSimplePool x70_cacheResPool;
|
2016-04-13 06:07:23 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
static std::vector<CCharacterInfo> GetCharacterInfoDB(const CAnimCharacterSet& ancs);
|
|
|
|
static std::vector<TLockedToken<CCharLayoutInfo>> GetCharLayoutInfoDB(CSimplePool& store,
|
|
|
|
const std::vector<CCharacterInfo>& chars);
|
2016-04-13 06:07:23 +00:00
|
|
|
|
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
CCharacterFactory(CSimplePool& store, const CAnimCharacterSet& ancs, CAssetId);
|
2016-04-13 06:07:23 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
std::unique_ptr<CAnimData> CreateCharacter(int charIdx, bool loop, const TLockedToken<CCharacterFactory>& factory,
|
2022-02-01 00:06:54 +00:00
|
|
|
int defaultAnim);
|
2018-12-08 05:30:43 +00:00
|
|
|
CAssetId GetEventResourceIdForAnimResourceId(CAssetId animId) const;
|
2016-08-16 22:49:19 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
const CCharacterInfo& GetCharInfo(int charIdx) const { return x4_charInfoDB[charIdx]; }
|
2018-12-15 06:29:41 +00:00
|
|
|
const CAdditiveAnimationInfo& FindAdditiveInfo(s32 idx) const;
|
|
|
|
bool HasAdditiveInfo(s32 idx) const;
|
2015-08-17 23:46:41 +00:00
|
|
|
};
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|