2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CCHARACTERFACTORY_HPP__
|
|
|
|
#define __URDE_CCHARACTERFACTORY_HPP__
|
2015-08-17 23:46:41 +00:00
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#include "IFactory.hpp"
|
|
|
|
#include "IObjFactory.hpp"
|
|
|
|
#include "CToken.hpp"
|
|
|
|
#include "CSimplePool.hpp"
|
|
|
|
#include "CAnimationSet.hpp"
|
2015-08-18 05:54:43 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-08-18 05:54:43 +00:00
|
|
|
{
|
2016-04-13 06:07:23 +00:00
|
|
|
class CSimplePool;
|
|
|
|
class CAnimCharacterSet;
|
|
|
|
class CCharacterInfo;
|
|
|
|
class CCharLayoutInfo;
|
|
|
|
class CAdditiveAnimationInfo;
|
|
|
|
class CTransitionDatabaseGame;
|
|
|
|
class CAnimationManager;
|
|
|
|
class CTransitionManager;
|
|
|
|
class CAllFormatsAnimSource;
|
2016-04-14 21:42:47 +00:00
|
|
|
class CAnimData;
|
2015-08-18 05:54:43 +00:00
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
class CCharacterFactory : public IObjFactory
|
2015-08-18 05:54:43 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
class CDummyFactory : public IFactory
|
|
|
|
{
|
2016-04-13 06:07:23 +00:00
|
|
|
public:
|
2016-09-02 19:32:57 +00:00
|
|
|
CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&, CObjectReference* selfRef);
|
2017-10-26 10:09:51 +00:00
|
|
|
void BuildAsync(const SObjectTag&, const CVParamTransfer&, std::unique_ptr<IObj>*, CObjectReference* selfRef);
|
2016-04-13 06:07:23 +00:00
|
|
|
void CancelBuild(const SObjectTag&);
|
|
|
|
bool CanBuild(const SObjectTag&);
|
|
|
|
const SObjectTag* GetResourceIdByName(const char*) const;
|
2017-08-13 05:26:14 +00:00
|
|
|
FourCC GetResourceTypeById(CAssetId id) const;
|
2016-07-23 21:41:18 +00:00
|
|
|
|
2016-09-25 01:58:20 +00:00
|
|
|
void EnumerateResources(const std::function<bool(const SObjectTag&)>& lambda) const;
|
|
|
|
void EnumerateNamedResources(const std::function<bool(const std::string&, const SObjectTag&)>& lambda) const;
|
|
|
|
|
2016-07-23 21:41:18 +00:00
|
|
|
u32 ResourceSize(const urde::SObjectTag& tag);
|
2017-10-27 10:10:32 +00:00
|
|
|
std::shared_ptr<IDvdRequest> LoadResourceAsync(const urde::SObjectTag& tag, void* target);
|
2017-11-05 02:08:05 +00:00
|
|
|
std::shared_ptr<IDvdRequest> LoadResourcePartAsync(const urde::SObjectTag& tag, u32 off, u32 size, void* target);
|
2016-07-23 21:41:18 +00:00
|
|
|
std::unique_ptr<u8[]> LoadResourceSync(const urde::SObjectTag& tag);
|
2017-11-05 02:08:05 +00:00
|
|
|
std::unique_ptr<u8[]> LoadNewResourcePartSync(const urde::SObjectTag& tag, u32 off, u32 size);
|
2015-08-18 05:54:43 +00:00
|
|
|
};
|
2016-04-13 06:07:23 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
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;
|
2017-08-13 05:26:14 +00:00
|
|
|
std::vector<std::pair<CAssetId, CAssetId>> x58_animResources;
|
|
|
|
CAssetId x68_selfId;
|
2016-04-13 06:07:23 +00:00
|
|
|
CDummyFactory x6c_dummyFactory;
|
|
|
|
CSimplePool x70_cacheResPool;
|
|
|
|
|
|
|
|
static std::vector<CCharacterInfo> GetCharacterInfoDB(const CAnimCharacterSet& ancs);
|
|
|
|
static std::vector<TLockedToken<CCharLayoutInfo>>
|
|
|
|
GetCharLayoutInfoDB(CSimplePool& store,
|
|
|
|
const std::vector<CCharacterInfo>& chars);
|
|
|
|
|
|
|
|
public:
|
2017-08-13 05:26:14 +00:00
|
|
|
CCharacterFactory(CSimplePool& store, const CAnimCharacterSet& ancs, CAssetId);
|
2016-04-13 06:07:23 +00:00
|
|
|
|
2016-04-15 03:02:21 +00:00
|
|
|
std::unique_ptr<CAnimData> CreateCharacter(int charIdx, bool loop,
|
|
|
|
const TLockedToken<CCharacterFactory>& factory,
|
2016-09-12 04:53:28 +00:00
|
|
|
int defaultAnim, int drawInsts) const;
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId GetEventResourceIdForAnimResourceId(CAssetId animId) const;
|
2016-08-16 22:49:19 +00:00
|
|
|
|
|
|
|
const CCharacterInfo& GetCharInfo(int charIdx) const { return x4_charInfoDB[charIdx]; }
|
2017-03-01 06:02:54 +00:00
|
|
|
const CAdditiveAnimationInfo& FindAdditiveInfo(u32 idx) const;
|
2017-07-11 07:17:03 +00:00
|
|
|
bool HasAdditiveInfo(u32 idx) const;
|
2015-08-17 23:46:41 +00:00
|
|
|
};
|
|
|
|
|
2015-08-18 05:54:43 +00:00
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_CCHARACTERFACTORY_HPP__
|