#pragma once #include "IFactory.hpp" #include "IObjFactory.hpp" #include "CToken.hpp" #include "CSimplePool.hpp" #include "CAnimationSet.hpp" namespace urde { class CSimplePool; class CAnimCharacterSet; class CCharacterInfo; class CCharLayoutInfo; class CAdditiveAnimationInfo; class CTransitionDatabaseGame; class CAnimationManager; class CTransitionManager; class CAllFormatsAnimSource; class CAnimData; class CCharacterFactory : public IObjFactory { public: class CDummyFactory : public IFactory { public: CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&, CObjectReference* selfRef) override; void BuildAsync(const SObjectTag&, const CVParamTransfer&, std::unique_ptr*, 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; void EnumerateResources(const std::function& lambda) const override; void EnumerateNamedResources(const std::function& lambda) const override; u32 ResourceSize(const urde::SObjectTag& tag) override; std::shared_ptr LoadResourceAsync(const urde::SObjectTag& tag, void* target) override; std::shared_ptr LoadResourcePartAsync(const urde::SObjectTag& tag, u32 off, u32 size, void* target) override; std::unique_ptr LoadResourceSync(const urde::SObjectTag& tag) override; std::unique_ptr LoadNewResourcePartSync(const urde::SObjectTag& tag, u32 off, u32 size) override; }; private: std::vector x4_charInfoDB; std::vector> x14_charLayoutInfoDB; std::shared_ptr x24_sysContext; std::shared_ptr x28_animMgr; std::shared_ptr x2c_transMgr; std::vector> x30_animSourceDB; std::vector> x40_additiveInfo; CAdditiveAnimationInfo x50_defaultAdditiveInfo; std::vector> x58_animResources; CAssetId x68_selfId; CDummyFactory x6c_dummyFactory; CSimplePool x70_cacheResPool; static std::vector GetCharacterInfoDB(const CAnimCharacterSet& ancs); static std::vector> GetCharLayoutInfoDB(CSimplePool& store, const std::vector& chars); public: CCharacterFactory(CSimplePool& store, const CAnimCharacterSet& ancs, CAssetId); std::unique_ptr CreateCharacter(int charIdx, bool loop, const TLockedToken& factory, int defaultAnim, int drawInsts) const; CAssetId GetEventResourceIdForAnimResourceId(CAssetId animId) const; const CCharacterInfo& GetCharInfo(int charIdx) const { return x4_charInfoDB[charIdx]; } const CAdditiveAnimationInfo& FindAdditiveInfo(s32 idx) const; bool HasAdditiveInfo(s32 idx) const; }; } // namespace urde