metaforce/Runtime/Character/CAssetFactory.cpp

67 lines
2.9 KiB
C++
Raw Normal View History

#include "CAssetFactory.hpp"
2016-04-15 03:02:21 +00:00
#include "CAnimCharacterSet.hpp"
#include "CCharacterFactory.hpp"
#include "GameGlobalObjects.hpp"
#include "CModelData.hpp"
2016-08-23 03:12:50 +00:00
#include "Character/CCharLayoutInfo.hpp"
2018-12-08 05:30:43 +00:00
namespace urde {
2016-04-15 03:02:21 +00:00
2018-12-08 05:30:43 +00:00
CFactoryFnReturn CCharacterFactoryBuilder::CDummyFactory::Build(const SObjectTag& tag, const CVParamTransfer&,
CObjectReference* selfRef) {
TLockedToken<CAnimCharacterSet> ancs = g_SimplePool->GetObj({SBIG('ANCS'), tag.id});
return TToken<CCharacterFactory>::GetIObjObjectFor(
std::make_unique<CCharacterFactory>(*g_SimplePool, *ancs.GetObj(), tag.id));
2016-04-15 03:02:21 +00:00
}
2018-12-08 05:30:43 +00:00
void CCharacterFactoryBuilder::CDummyFactory::BuildAsync(const SObjectTag& tag, const CVParamTransfer& parms,
std::unique_ptr<IObj>* objOut, CObjectReference* selfRef) {
*objOut = Build(tag, parms, selfRef);
2016-04-15 03:02:21 +00:00
}
2018-12-08 05:30:43 +00:00
void CCharacterFactoryBuilder::CDummyFactory::CancelBuild(const SObjectTag&) {}
2016-04-15 03:02:21 +00:00
2018-12-08 05:30:43 +00:00
bool CCharacterFactoryBuilder::CDummyFactory::CanBuild(const SObjectTag&) { return true; }
2016-04-15 03:02:21 +00:00
2018-12-08 05:30:43 +00:00
const SObjectTag* CCharacterFactoryBuilder::CDummyFactory::GetResourceIdByName(std::string_view) const {
return nullptr;
2016-04-15 03:02:21 +00:00
}
2018-12-08 05:30:43 +00:00
FourCC CCharacterFactoryBuilder::CDummyFactory::GetResourceTypeById(CAssetId id) const { return {}; }
2016-09-25 01:58:20 +00:00
void CCharacterFactoryBuilder::CDummyFactory::EnumerateResources(
2018-12-08 05:30:43 +00:00
const std::function<bool(const SObjectTag&)>& lambda) const {}
2016-09-25 01:58:20 +00:00
void CCharacterFactoryBuilder::CDummyFactory::EnumerateNamedResources(
2018-12-08 05:30:43 +00:00
const std::function<bool(std::string_view, const SObjectTag&)>& lambda) const {}
2016-09-25 01:58:20 +00:00
2018-12-08 05:30:43 +00:00
u32 CCharacterFactoryBuilder::CDummyFactory::ResourceSize(const urde::SObjectTag& tag) { return 0; }
2017-10-27 10:10:32 +00:00
std::shared_ptr<IDvdRequest> CCharacterFactoryBuilder::CDummyFactory::LoadResourceAsync(const urde::SObjectTag& tag,
2018-12-08 05:30:43 +00:00
void* target) {
return {};
}
2017-10-27 10:10:32 +00:00
std::shared_ptr<IDvdRequest> CCharacterFactoryBuilder::CDummyFactory::LoadResourcePartAsync(const urde::SObjectTag& tag,
2017-11-05 02:08:05 +00:00
u32 off, u32 size,
2018-12-08 05:30:43 +00:00
void* target) {
return {};
}
2018-12-08 05:30:43 +00:00
std::unique_ptr<u8[]> CCharacterFactoryBuilder::CDummyFactory::LoadResourceSync(const urde::SObjectTag& tag) {
return {};
}
2017-11-05 02:08:05 +00:00
std::unique_ptr<u8[]> CCharacterFactoryBuilder::CDummyFactory::LoadNewResourcePartSync(const urde::SObjectTag& tag,
2018-12-08 05:30:43 +00:00
u32 off, u32 size) {
return {};
}
2016-04-15 03:02:21 +00:00
CCharacterFactoryBuilder::CCharacterFactoryBuilder() : x4_dummyStore(x0_dummyFactory) {}
2018-12-08 05:30:43 +00:00
TToken<CCharacterFactory> CCharacterFactoryBuilder::GetFactory(const CAnimRes& res) {
return x4_dummyStore.GetObj({SBIG('ANCS'), res.GetId()});
2016-04-15 03:02:21 +00:00
}
2018-12-08 05:30:43 +00:00
} // namespace urde