mirror of https://github.com/AxioDL/metaforce.git
CCharacterFactory imps
This commit is contained in:
parent
8608b52774
commit
c91bfade75
|
@ -40,7 +40,7 @@ size_t ComputeBitstreamSize(size_t keyFrameCount, const std::vector<Channel>& ch
|
|||
|
||||
static inline QuantizedRot QuantizeRotation(const Value& quat, atUint32 div)
|
||||
{
|
||||
float q = M_PI / 2.0f / float(div);
|
||||
float q = M_PIF / 2.0f / float(div);
|
||||
return
|
||||
{
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ static inline QuantizedRot QuantizeRotation(const Value& quat, atUint32 div)
|
|||
|
||||
static inline Value DequantizeRotation(const QuantizedRot& v, atUint32 div)
|
||||
{
|
||||
float q = M_PI / 2.0f / float(div);
|
||||
float q = M_PIF / 2.0f / float(div);
|
||||
Value retval =
|
||||
{
|
||||
0.0f,
|
||||
|
|
|
@ -38,6 +38,7 @@ add_executable(urde WIN32 MACOSX_BUNDLE
|
|||
target_link_libraries(urde
|
||||
UrdeLocales
|
||||
UrdeIcons
|
||||
RuntimeMP1
|
||||
RuntimeCommonCharacter
|
||||
RuntimeCommonInput
|
||||
RuntimeCommonParticle
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "Runtime/Graphics/CMoviePlayer.hpp"
|
||||
#include "Runtime/Graphics/CModel.hpp"
|
||||
#include "Runtime/Particle/CGenDescription.hpp"
|
||||
#include "Runtime/Character/CAssetFactory.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -32,6 +33,7 @@ class ViewManager : public specter::IViewManager
|
|||
boo::GraphicsDataToken m_iconsToken;
|
||||
specter::Translator m_translator;
|
||||
std::unique_ptr<boo::IWindow> m_mainWindow;
|
||||
CCharacterFactoryBuilder m_test;
|
||||
|
||||
std::unique_ptr<specter::RootView> m_rootView;
|
||||
std::unique_ptr<SplashScreen> m_splash;
|
||||
|
|
|
@ -69,7 +69,7 @@ add_library(RuntimeCommon
|
|||
CPlayMovieBase.hpp
|
||||
CGameDebug.hpp CGameDebug.cpp
|
||||
rstl.hpp rstl.cpp
|
||||
GameGlobalObjects.hpp
|
||||
GameGlobalObjects.hpp GameGlobalObjects.cpp
|
||||
RetroTypes.hpp
|
||||
GCNTypes.hpp
|
||||
${PLAT_SRCS})
|
||||
|
|
|
@ -71,6 +71,7 @@ IAllocator& CMemorySys::GetGameAllocator() {return g_gameAllocator;}
|
|||
|
||||
}
|
||||
|
||||
#if 0
|
||||
void* operator new(std::size_t sz)
|
||||
{
|
||||
if (!urde::g_memoryAllocatorReady)
|
||||
|
@ -140,3 +141,5 @@ void operator delete[](void* ptr) noexcept
|
|||
}
|
||||
urde::CMemory::Free(ptr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
}
|
||||
|
||||
/* Custom new funcs */
|
||||
void* operator new(std::size_t sz, const char* funcName, const char* typeName);
|
||||
void* operator new[](std::size_t sz, const char* funcName, const char* typeName);
|
||||
//void* operator new(std::size_t sz, const char* funcName, const char* typeName);
|
||||
//void* operator new[](std::size_t sz, const char* funcName, const char* typeName);
|
||||
|
||||
#endif // __URDE_CMEMORY_HPP__
|
||||
|
|
|
@ -11,17 +11,12 @@ CSimplePool::CSimplePool(IFactory& factory)
|
|||
|
||||
CToken CSimplePool::GetObj(const SObjectTag& tag, const CVParamTransfer& paramXfer)
|
||||
{
|
||||
auto iter = std::find_if(x4_resources.begin(), x4_resources.end(),
|
||||
[&tag](std::pair<SObjectTag, CObjectReference*> pair) -> bool
|
||||
{
|
||||
return pair.first == tag;
|
||||
});
|
||||
|
||||
auto iter = x4_resources.find(tag);
|
||||
if (iter != x4_resources.end())
|
||||
return CToken(iter->second);
|
||||
|
||||
CObjectReference* ret = new CObjectReference(*this, std::unique_ptr<IObj>(), tag, paramXfer);
|
||||
x4_resources.push_back(std::make_pair<SObjectTag, CObjectReference*>((SObjectTag)tag, std::move(ret)));
|
||||
x4_resources.emplace(std::make_pair<SObjectTag, CObjectReference*>((SObjectTag)tag, std::move(ret)));
|
||||
return CToken(ret);
|
||||
}
|
||||
|
||||
|
@ -45,16 +40,18 @@ CToken CSimplePool::GetObj(const char* resourceName, const CVParamTransfer& para
|
|||
|
||||
bool CSimplePool::HasObject(const SObjectTag& tag) const
|
||||
{
|
||||
auto iter = std::find_if(x4_resources.begin(), x4_resources.end(), [&tag](std::pair<SObjectTag, CObjectReference*> pair)->bool{
|
||||
return pair.first == tag;
|
||||
});
|
||||
|
||||
return iter != x4_resources.end();
|
||||
auto iter = x4_resources.find(tag);
|
||||
if (iter != x4_resources.cend())
|
||||
return true;
|
||||
return x30_factory.CanBuild(tag);
|
||||
}
|
||||
|
||||
bool CSimplePool::ObjectIsLive(const SObjectTag&) const
|
||||
bool CSimplePool::ObjectIsLive(const SObjectTag& tag) const
|
||||
{
|
||||
return false;
|
||||
auto iter = x4_resources.find(tag);
|
||||
if (iter == x4_resources.cend())
|
||||
return false;
|
||||
return iter->second->IsLoaded();
|
||||
}
|
||||
|
||||
void CSimplePool::Flush()
|
||||
|
@ -63,9 +60,7 @@ void CSimplePool::Flush()
|
|||
|
||||
void CSimplePool::ObjectUnreferenced(const SObjectTag& tag)
|
||||
{
|
||||
auto iter = std::find_if(x4_resources.begin(), x4_resources.end(), [&tag](std::pair<SObjectTag, CObjectReference*> pair)->bool{
|
||||
return pair.first == tag;
|
||||
});
|
||||
auto iter = x4_resources.find(tag);
|
||||
if (iter != x4_resources.end())
|
||||
x4_resources.erase(iter);
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ class CObjectReference;
|
|||
class CSimplePool : public IObjectStore
|
||||
{
|
||||
protected:
|
||||
std::list<std::pair<SObjectTag, CObjectReference*>> x4_resources;
|
||||
//std::unordered_map<SObjectTag, CObjectReference*> x4_resources;
|
||||
//std::list<std::pair<SObjectTag, CObjectReference*>> x4_resources;
|
||||
std::unordered_map<SObjectTag, CObjectReference*> x4_resources;
|
||||
IFactory& x30_factory;
|
||||
CVParamTransfer x34_paramXfer;
|
||||
public:
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
const std::weak_ptr<CPlayerState>&,
|
||||
const std::weak_ptr<CWorldTransManager>&);
|
||||
|
||||
const std::shared_ptr<CPlayerState> GetPlayerState() const {return x8b8_playerState;}
|
||||
const std::shared_ptr<CPlayerState>& GetPlayerState() const {return x8b8_playerState;}
|
||||
|
||||
void GetObjectListById() const
|
||||
{
|
||||
|
|
|
@ -18,9 +18,12 @@ void CAnimData::InitializeCache()
|
|||
{
|
||||
}
|
||||
|
||||
CAnimData::CAnimData(ResId id, const CCharacterInfo& character, int a, int b, bool c,
|
||||
CAnimData::CAnimData(ResId id,
|
||||
const CCharacterInfo& character,
|
||||
int defaultAnim, int charIdx, bool loop,
|
||||
const TLockedToken<CCharLayoutInfo>& layout,
|
||||
const TToken<CSkinnedModel>& model,
|
||||
const std::experimental::optional<TToken<CMorphableSkinnedModel>>& iceModel,
|
||||
const std::weak_ptr<CAnimSysContext>& ctx,
|
||||
const std::shared_ptr<CAnimationManager>& animMgr,
|
||||
const std::shared_ptr<CTransitionManager>& transMgr,
|
||||
|
@ -33,12 +36,14 @@ CAnimData::CAnimData(ResId id, const CCharacterInfo& character, int a, int b, bo
|
|||
x100_animMgr(animMgr),
|
||||
x1d8_selfId(id),
|
||||
x1fc_transMgr(transMgr),
|
||||
x204_b(b),
|
||||
x208_a(a),
|
||||
x21c_25_loop(c),
|
||||
x204_charIdx(charIdx),
|
||||
x208_defaultAnim(defaultAnim),
|
||||
x21c_25_loop(loop),
|
||||
x220_pose(layout->GetSegIdList().GetList().size()),
|
||||
x2f8_poseBuilder(layout)
|
||||
{
|
||||
if (iceModel)
|
||||
xe4_iceModelData = *iceModel;
|
||||
}
|
||||
|
||||
ResId CAnimData::GetEventResourceIdForAnimResourceId(ResId) const
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace urde
|
|||
{
|
||||
class CCharLayoutInfo;
|
||||
class CSkinnedModel;
|
||||
class CMorphableSkinnedModel;
|
||||
class CAnimSysContext;
|
||||
class CAnimationManager;
|
||||
class CTransitionManager;
|
||||
|
@ -44,7 +45,7 @@ class CAnimData
|
|||
CCharacterInfo xc_charInfo;
|
||||
TLockedToken<CCharLayoutInfo> xcc_layoutData;
|
||||
TCachedToken<CSkinnedModel> xd8_modelData;
|
||||
// TLockedToken<CSkinnedModelWithAvgNormals> xe4_modelAvgNormalData;
|
||||
TLockedToken<CMorphableSkinnedModel> xe4_iceModelData;
|
||||
std::shared_ptr<CSkinnedModel> xf4_xrayModel;
|
||||
std::shared_ptr<CSkinnedModel> xf8_infraModel;
|
||||
std::shared_ptr<CAnimSysContext> xfc_animCtx;
|
||||
|
@ -59,8 +60,8 @@ class CAnimData
|
|||
std::shared_ptr<CTransitionManager> x1fc_transMgr;
|
||||
|
||||
float x200_ = 1.f;
|
||||
u32 x204_b;
|
||||
u16 x208_a;
|
||||
u32 x204_charIdx;
|
||||
u16 x208_defaultAnim;
|
||||
u32 x20c_passedBoolCount = 0;
|
||||
u32 x210_passedIntCount = 0;
|
||||
u32 x214_passedParticleCount = 0;
|
||||
|
@ -98,9 +99,12 @@ class CAnimData
|
|||
u32 x1044_ = 0;
|
||||
|
||||
public:
|
||||
CAnimData(ResId, const CCharacterInfo& character, int a, int b, bool c,
|
||||
CAnimData(ResId,
|
||||
const CCharacterInfo& character,
|
||||
int defaultAnim, int charIdx, bool loop,
|
||||
const TLockedToken<CCharLayoutInfo>& layout,
|
||||
const TToken<CSkinnedModel>& model,
|
||||
const std::experimental::optional<TToken<CMorphableSkinnedModel>>& iceModel,
|
||||
const std::weak_ptr<CAnimSysContext>& ctx,
|
||||
const std::shared_ptr<CAnimationManager>& animMgr,
|
||||
const std::shared_ptr<CTransitionManager>& transMgr,
|
||||
|
|
|
@ -1,6 +1,52 @@
|
|||
#include "CAssetFactory.hpp"
|
||||
#include "CAnimCharacterSet.hpp"
|
||||
#include "CCharacterFactory.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "CModelData.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CFactoryFnReturn CCharacterFactoryBuilder::CDummyFactory::Build(const SObjectTag& tag,
|
||||
const CVParamTransfer&)
|
||||
{
|
||||
TLockedToken<CAnimCharacterSet> ancs =
|
||||
g_SimplePool->GetObj({SBIG('ANCS'), tag.id});
|
||||
return TToken<CCharacterFactory>::GetIObjObjectFor(
|
||||
std::make_unique<CCharacterFactory>(*g_SimplePool, *ancs.GetObj(), tag.id));
|
||||
}
|
||||
|
||||
void CCharacterFactoryBuilder::CDummyFactory::BuildAsync(const SObjectTag& tag,
|
||||
const CVParamTransfer& parms,
|
||||
IObj** objOut)
|
||||
{
|
||||
*objOut = Build(tag, parms).release();
|
||||
}
|
||||
|
||||
void CCharacterFactoryBuilder::CDummyFactory::CancelBuild(const SObjectTag&)
|
||||
{
|
||||
}
|
||||
|
||||
bool CCharacterFactoryBuilder::CDummyFactory::CanBuild(const SObjectTag&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const SObjectTag* CCharacterFactoryBuilder::CDummyFactory::GetResourceIdByName(const char*) const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FourCC CCharacterFactoryBuilder::CDummyFactory::GetResourceTypeById(ResId id) const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
CCharacterFactoryBuilder::CCharacterFactoryBuilder() : x4_dummyStore(x0_dummyFactory) {}
|
||||
|
||||
TToken<CCharacterFactory> CCharacterFactoryBuilder::GetFactory(const CAnimRes& res)
|
||||
{
|
||||
return x4_dummyStore.GetObj({SBIG('ANCS'), res.x0_ancsId});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,21 +4,33 @@
|
|||
#include "IFactory.hpp"
|
||||
#include "IObj.hpp"
|
||||
#include "CToken.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CCharacterFactory;
|
||||
class CAnimRes;
|
||||
|
||||
class CCharacterFactoryBuilder : public IFactory
|
||||
class CCharacterFactoryBuilder
|
||||
{
|
||||
public:
|
||||
std::unique_ptr<IObj> Build(const SObjectTag&, const CVParamTransfer&) {return std::unique_ptr<IObj>();}
|
||||
void BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**) {}
|
||||
void CancelBuild(const SObjectTag&) {}
|
||||
bool CanBuild(const SObjectTag&) {return false;}
|
||||
const SObjectTag* GetResourceIdByName(const char*) const {return nullptr;}
|
||||
FourCC GetResourceTypeById(ResId id) const {return {};}
|
||||
class CDummyFactory : public IFactory
|
||||
{
|
||||
public:
|
||||
CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&);
|
||||
void BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**);
|
||||
void CancelBuild(const SObjectTag&);
|
||||
bool CanBuild(const SObjectTag&);
|
||||
const SObjectTag* GetResourceIdByName(const char*) const;
|
||||
FourCC GetResourceTypeById(ResId id) const;
|
||||
};
|
||||
|
||||
private:
|
||||
CDummyFactory x0_dummyFactory;
|
||||
CSimplePool x4_dummyStore;
|
||||
|
||||
public:
|
||||
CCharacterFactoryBuilder();
|
||||
TToken<CCharacterFactory> GetFactory(const CAnimRes& res);
|
||||
};
|
||||
|
||||
|
|
|
@ -7,17 +7,48 @@
|
|||
#include "CTransitionManager.hpp"
|
||||
#include "CRandom16.hpp"
|
||||
#include "CPrimitive.hpp"
|
||||
#include "CAnimData.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "Graphics/CSkinnedModel.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CFactoryFnReturn CCharacterFactory::CDummyFactory::Build(const SObjectTag&, const CVParamTransfer&)
|
||||
CFactoryFnReturn CCharacterFactory::CDummyFactory::Build(const SObjectTag& tag,
|
||||
const CVParamTransfer& params)
|
||||
{
|
||||
|
||||
const CCharacterInfo& charInfo =
|
||||
*static_cast<TObjOwnerParam<const CCharacterInfo*>&>(*params.GetObj()).GetParam();
|
||||
|
||||
switch (tag.type.toUint32())
|
||||
{
|
||||
case 0:
|
||||
return TToken<CSkinnedModel>::GetIObjObjectFor(
|
||||
std::make_unique<CSkinnedModel>(*g_SimplePool,
|
||||
charInfo.GetModelId(),
|
||||
charInfo.GetSkinRulesId(),
|
||||
charInfo.GetCharLayoutInfoId(),
|
||||
CSkinnedModel::EDataOwnership::One));
|
||||
case 1:
|
||||
return TToken<CSkinnedModel>::GetIObjObjectFor(
|
||||
std::make_unique<CMorphableSkinnedModel>(*g_SimplePool,
|
||||
charInfo.GetIceModelId(),
|
||||
charInfo.GetIceSkinRulesId(),
|
||||
charInfo.GetCharLayoutInfoId(),
|
||||
CSkinnedModel::EDataOwnership::One));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void CCharacterFactory::CDummyFactory::BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**)
|
||||
void CCharacterFactory::CDummyFactory::BuildAsync(const SObjectTag& tag,
|
||||
const CVParamTransfer& parms,
|
||||
IObj** objOut)
|
||||
{
|
||||
*objOut = Build(tag, parms).release();
|
||||
}
|
||||
|
||||
void CCharacterFactory::CDummyFactory::CancelBuild(const SObjectTag&)
|
||||
|
@ -36,10 +67,40 @@ const SObjectTag* CCharacterFactory::CDummyFactory::GetResourceIdByName(const ch
|
|||
|
||||
FourCC CCharacterFactory::CDummyFactory::GetResourceTypeById(ResId id) const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
ResId CCharacterFactory::GetEventResourceIdForAnimResourceId(ResId) const
|
||||
std::unique_ptr<CAnimData>
|
||||
CCharacterFactory::CreateCharacter(int charIdx, bool loop,
|
||||
const TLockedToken<CCharacterFactory>& factory,
|
||||
int defaultAnim) const
|
||||
{
|
||||
const CCharacterInfo& charInfo = x4_charInfoDB[charIdx];
|
||||
CVParamTransfer charParm(new TObjOwnerParam<const CCharacterInfo*>(&charInfo));
|
||||
|
||||
TToken<CSkinnedModel> skinnedModel =
|
||||
((CCharacterFactory*)this)->x70_cacheResPool.GetObj({FourCC(), charInfo.GetModelId()}, charParm);
|
||||
|
||||
std::experimental::optional<TToken<CMorphableSkinnedModel>> iceModel;
|
||||
if (charInfo.GetIceModelId() && charInfo.GetIceSkinRulesId())
|
||||
iceModel.emplace(((CCharacterFactory*)this)->x70_cacheResPool.GetObj({FourCC(1), charInfo.GetIceModelId()}, charParm));
|
||||
|
||||
return std::make_unique<CAnimData>(x68_selfId, charInfo, defaultAnim, charIdx, loop,
|
||||
x14_charLayoutInfoDB[charIdx], skinnedModel,
|
||||
iceModel, x24_sysContext, x28_animMgr, x2c_transMgr,
|
||||
factory);
|
||||
}
|
||||
|
||||
ResId CCharacterFactory::GetEventResourceIdForAnimResourceId(ResId id) const
|
||||
{
|
||||
auto search = std::find_if(x58_animResources.cbegin(), x58_animResources.cend(),
|
||||
[&](const std::pair<ResId, ResId>& elem) -> bool
|
||||
{
|
||||
return id == elem.first;
|
||||
});
|
||||
if (search == x58_animResources.cend())
|
||||
return -1;
|
||||
return search->second;
|
||||
}
|
||||
|
||||
std::vector<CCharacterInfo>
|
||||
|
|
|
@ -56,7 +56,9 @@ private:
|
|||
public:
|
||||
CCharacterFactory(CSimplePool& store, const CAnimCharacterSet& ancs, ResId);
|
||||
|
||||
std::unique_ptr<CAnimData> CreateCharacter(int, bool, const TLockedToken<CCharacterFactory>& factory, int) const;
|
||||
std::unique_ptr<CAnimData> CreateCharacter(int charIdx, bool loop,
|
||||
const TLockedToken<CCharacterFactory>& factory,
|
||||
int defaultAnim) const;
|
||||
ResId GetEventResourceIdForAnimResourceId(ResId animId) const;
|
||||
};
|
||||
|
||||
|
|
|
@ -41,7 +41,12 @@ private:
|
|||
public:
|
||||
CCharacterInfo(CInputStream& in);
|
||||
|
||||
ResId GetModelId() const {return x14_cmdl;}
|
||||
ResId GetSkinRulesId() const {return x18_cskr;}
|
||||
ResId GetCharLayoutInfoId() const {return x1c_cinf;}
|
||||
|
||||
ResId GetIceModelId() const {return xa8_cmdlOverlay;}
|
||||
ResId GetIceSkinRulesId() const {return xac_cskrOverlay;}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -16,13 +16,15 @@
|
|||
namespace urde
|
||||
{
|
||||
|
||||
CModelData::~CModelData() {}
|
||||
|
||||
CModelData::CModelData() {}
|
||||
CModelData CModelData::CModelDataNull() {return CModelData();}
|
||||
|
||||
CModelData::CModelData(const CStaticRes& res)
|
||||
: x0_particleScale(res.x4_particleScale)
|
||||
{
|
||||
IObjectStore& objStore = ProjectManager::g_SharedManager->objectStore();
|
||||
x1c_normalModel = objStore.GetObj({SBIG('CMDL'), res.x0_cmdlId});
|
||||
x1c_normalModel = g_SimplePool->GetObj({SBIG('CMDL'), res.x0_cmdlId});
|
||||
}
|
||||
|
||||
CModelData::CModelData(const CAnimRes& res)
|
||||
|
@ -96,19 +98,17 @@ void CModelData::SetXRayModel(const std::pair<ResId, ResId>& modelSkin)
|
|||
{
|
||||
if (modelSkin.first)
|
||||
{
|
||||
IObjectStore& objStore = ProjectManager::g_SharedManager->objectStore();
|
||||
IFactory& resFactory = ProjectManager::g_SharedManager->resourceFactoryMP1();
|
||||
if (resFactory.GetResourceTypeById(modelSkin.first) == SBIG('CMDL'))
|
||||
if (g_ResFactory->GetResourceTypeById(modelSkin.first) == SBIG('CMDL'))
|
||||
{
|
||||
if (xc_animData && modelSkin.second &&
|
||||
resFactory.GetResourceTypeById(modelSkin.second) == SBIG('CSKR'))
|
||||
g_ResFactory->GetResourceTypeById(modelSkin.second) == SBIG('CSKR'))
|
||||
{
|
||||
xc_animData->SetXRayModel(objStore.GetObj({SBIG('CMDL'), modelSkin.first}),
|
||||
objStore.GetObj({SBIG('CSKR'), modelSkin.second}));
|
||||
xc_animData->SetXRayModel(g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first}),
|
||||
g_SimplePool->GetObj({SBIG('CSKR'), modelSkin.second}));
|
||||
}
|
||||
else
|
||||
{
|
||||
x2c_xrayModel = objStore.GetObj({SBIG('CMDL'), modelSkin.first});
|
||||
x2c_xrayModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,19 +118,17 @@ void CModelData::SetInfraModel(const std::pair<ResId, ResId>& modelSkin)
|
|||
{
|
||||
if (modelSkin.first)
|
||||
{
|
||||
IObjectStore& objStore = ProjectManager::g_SharedManager->objectStore();
|
||||
IFactory& resFactory = ProjectManager::g_SharedManager->resourceFactoryMP1();
|
||||
if (resFactory.GetResourceTypeById(modelSkin.first) == SBIG('CMDL'))
|
||||
if (g_ResFactory->GetResourceTypeById(modelSkin.first) == SBIG('CMDL'))
|
||||
{
|
||||
if (xc_animData && modelSkin.second &&
|
||||
resFactory.GetResourceTypeById(modelSkin.second) == SBIG('CSKR'))
|
||||
g_ResFactory->GetResourceTypeById(modelSkin.second) == SBIG('CSKR'))
|
||||
{
|
||||
xc_animData->SetInfraModel(objStore.GetObj({SBIG('CMDL'), modelSkin.first}),
|
||||
objStore.GetObj({SBIG('CSKR'), modelSkin.second}));
|
||||
xc_animData->SetInfraModel(g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first}),
|
||||
g_SimplePool->GetObj({SBIG('CSKR'), modelSkin.second}));
|
||||
}
|
||||
else
|
||||
{
|
||||
x3c_infraModel = objStore.GetObj({SBIG('CMDL'), modelSkin.first});
|
||||
x3c_infraModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,9 @@ class CModelData
|
|||
TLockedToken<CModel> x1c_normalModel;
|
||||
TLockedToken<CModel> x2c_xrayModel;
|
||||
TLockedToken<CModel> x3c_infraModel;
|
||||
|
||||
CModelData();
|
||||
|
||||
public:
|
||||
enum class EWhichModel
|
||||
{
|
||||
|
@ -60,10 +63,11 @@ public:
|
|||
Thermal
|
||||
};
|
||||
|
||||
CModelData();
|
||||
~CModelData();
|
||||
CModelData(const CStaticRes& res);
|
||||
CModelData(const CAnimRes& res);
|
||||
CModelData CModelDataNull() {return CModelData();}
|
||||
CModelData(CModelData&&) = default;
|
||||
CModelData CModelDataNull();
|
||||
|
||||
SAdvancementDeltas GetAdvancementDeltas(const CCharAnimTime& a, const CCharAnimTime& b) const;
|
||||
void Render(const CStateManager& stateMgr, const zeus::CTransform& xf,
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#include "GameGlobalObjects.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CMemoryCardSys* g_MemoryCardSys = nullptr;
|
||||
class IFactory* g_ResFactory = nullptr;
|
||||
class CSimplePool* g_SimplePool = nullptr;
|
||||
class CCharacterFactoryBuilder* g_CharFactoryBuilder = nullptr;
|
||||
class CAiFuncMap* g_AiFuncMap = nullptr;
|
||||
class CGameState* g_GameState = nullptr;
|
||||
class CInGameTweakManagerBase* g_TweakManager = nullptr;
|
||||
class CBooRenderer* g_Renderer = nullptr;
|
||||
|
||||
DataSpec::ITweakGame* g_tweakGame = nullptr;
|
||||
DataSpec::ITweakPlayer* g_tweakPlayer = nullptr;
|
||||
DataSpec::ITweakPlayerControl* g_tweakPlayerControl = nullptr;
|
||||
|
||||
}
|
|
@ -8,7 +8,7 @@ namespace urde
|
|||
{
|
||||
|
||||
extern class CMemoryCardSys* g_MemoryCardSys;
|
||||
extern class CResFactory* g_ResFactory;
|
||||
extern class IFactory* g_ResFactory;
|
||||
extern class CSimplePool* g_SimplePool;
|
||||
extern class CCharacterFactoryBuilder* g_CharFactoryBuilder;
|
||||
extern class CAiFuncMap* g_AiFuncMap;
|
||||
|
|
|
@ -69,7 +69,7 @@ CLight::CLight(ELightType type,
|
|||
{
|
||||
case ELightType::Spot:
|
||||
{
|
||||
float cosCutoff = std::cos(cutoff * M_PI / 180.0);
|
||||
float cosCutoff = std::cos(cutoff * M_PIF / 180.f);
|
||||
x30_angleC = 0.f;
|
||||
x34_angleL = -cosCutoff / (1.0 - cosCutoff);
|
||||
x38_angleQ = 1.f / (1.0 - cosCutoff);
|
||||
|
|
|
@ -11,9 +11,22 @@ CSkinnedModel::CSkinnedModel(const TLockedToken<CModel>& model,
|
|||
|
||||
}
|
||||
|
||||
CSkinnedModel::CSkinnedModel(IObjectStore& store, ResId model,
|
||||
ResId skinRules, ResId layoutInfo,
|
||||
EDataOwnership ownership)
|
||||
{
|
||||
}
|
||||
|
||||
void CSkinnedModel::Calculate(const CPoseAsTransforms& pose,
|
||||
const std::experimental::optional<CVertexMorphEffect>&)
|
||||
{
|
||||
}
|
||||
|
||||
CMorphableSkinnedModel::CMorphableSkinnedModel(IObjectStore& store, ResId model,
|
||||
ResId skinRules, ResId layoutInfo,
|
||||
EDataOwnership ownership)
|
||||
: CSkinnedModel(store, model, skinRules, layoutInfo, ownership)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,10 +21,16 @@ class CSkinnedModel
|
|||
TLockedToken<CSkinRules> x10_skinRules;
|
||||
TLockedToken<CCharLayoutInfo> x1c_layoutInfo;
|
||||
public:
|
||||
enum class EDataOwnership
|
||||
{
|
||||
Zero,
|
||||
One
|
||||
};
|
||||
CSkinnedModel(const TLockedToken<CModel>& model,
|
||||
const TLockedToken<CSkinRules>& skinRules,
|
||||
const TLockedToken<CCharLayoutInfo>& layoutInfo);
|
||||
CSkinnedModel(IObjectStore& store, ResId model, ResId skinRules, ResId layoutInfo);
|
||||
CSkinnedModel(IObjectStore& store, ResId model, ResId skinRules,
|
||||
ResId layoutInfo, EDataOwnership ownership);
|
||||
|
||||
const TLockedToken<CModel>& GetModel() const {return x4_model;}
|
||||
const TLockedToken<CSkinRules>& GetSkinRules() const {return x10_skinRules;}
|
||||
|
@ -34,6 +40,13 @@ public:
|
|||
void Draw(const CModelFlags& drawFlags) const;
|
||||
};
|
||||
|
||||
class CMorphableSkinnedModel : public CSkinnedModel
|
||||
{
|
||||
public:
|
||||
CMorphableSkinnedModel(IObjectStore& store, ResId model, ResId skinRules,
|
||||
ResId layoutInfo, EDataOwnership ownership);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CSKINNEDMODEL_HPP__
|
||||
|
|
|
@ -30,8 +30,6 @@ template<class T>
|
|||
class TObjOwnerParam : public IVParamObj
|
||||
{
|
||||
T m_param;
|
||||
protected:
|
||||
~TObjOwnerParam() {}
|
||||
public:
|
||||
TObjOwnerParam(T&& obj) : m_param(std::move(obj)) {}
|
||||
T& GetParam() {return m_param;}
|
||||
|
|
|
@ -40,9 +40,11 @@ void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue)
|
|||
g_main->SetGameplayResult(EGameplayResult::Playing);
|
||||
break;
|
||||
}
|
||||
/* TODO: URDE handling
|
||||
CResLoader& loader = g_ResFactory->GetLoader();
|
||||
while (!loader.AreAllPaksLoaded())
|
||||
loader.AsyncIdlePakLoading();
|
||||
*/
|
||||
g_main->LoadAudio();
|
||||
g_main->RegisterResourceTweaks();
|
||||
queue.Push(std::move(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, new CFrontEndUI(queue))));
|
||||
|
|
|
@ -9,9 +9,6 @@
|
|||
|
||||
namespace urde
|
||||
{
|
||||
DataSpec::ITweakGame* g_tweakGame = nullptr;
|
||||
DataSpec::ITweakPlayer* g_tweakPlayer = nullptr;
|
||||
DataSpec::ITweakPlayerControl* g_tweakPlayerControl = nullptr;
|
||||
|
||||
namespace MP1
|
||||
{
|
||||
|
|
|
@ -42,14 +42,6 @@
|
|||
|
||||
namespace urde
|
||||
{
|
||||
CMemoryCardSys* g_MemoryCardSys = nullptr;
|
||||
CResFactory* g_ResFactory = nullptr;
|
||||
CSimplePool* g_SimplePool = nullptr;
|
||||
CCharacterFactoryBuilder* g_CharFactoryBuilder = nullptr;
|
||||
CAiFuncMap* g_AiFuncMap = nullptr;
|
||||
CGameState* g_GameState = nullptr;
|
||||
CInGameTweakManagerBase* g_TweakManager = nullptr;
|
||||
CBooRenderer* g_Renderer = nullptr;
|
||||
|
||||
namespace MP1
|
||||
{
|
||||
|
|
|
@ -858,9 +858,9 @@ void CElementGen::UpdatePSTranslationAndOrientation()
|
|||
zeus::CVector3f angles;
|
||||
psov->GetValue(x50_curFrame, angles);
|
||||
zeus::CTransform xf(x178_orientation);
|
||||
xf.rotateLocalX(angles[0] * M_PI / 180.f);
|
||||
xf.rotateLocalY(angles[1] * M_PI / 180.f);
|
||||
xf.rotateLocalZ(angles[2] * M_PI / 180.f);
|
||||
xf.rotateLocalX(angles[0] * M_PIF / 180.f);
|
||||
xf.rotateLocalY(angles[1] * M_PIF / 180.f);
|
||||
xf.rotateLocalZ(angles[2] * M_PIF / 180.f);
|
||||
SetOrientation(xf);
|
||||
}
|
||||
*/
|
||||
|
|
2
specter
2
specter
|
@ -1 +1 @@
|
|||
Subproject commit c4d0d0e8016f2d8f0772e5ad63e2ac1ed2a07915
|
||||
Subproject commit 65cdadfe16cbb63c0f7d9408e822af31b9d8dab7
|
Loading…
Reference in New Issue