diff --git a/DataSpec/DNACommon/ANIM.cpp b/DataSpec/DNACommon/ANIM.cpp index eab50ea45..0dfe8ec16 100644 --- a/DataSpec/DNACommon/ANIM.cpp +++ b/DataSpec/DNACommon/ANIM.cpp @@ -40,7 +40,7 @@ size_t ComputeBitstreamSize(size_t keyFrameCount, const std::vector& 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, diff --git a/Editor/CMakeLists.txt b/Editor/CMakeLists.txt index 983d72738..3479f07c1 100644 --- a/Editor/CMakeLists.txt +++ b/Editor/CMakeLists.txt @@ -38,6 +38,7 @@ add_executable(urde WIN32 MACOSX_BUNDLE target_link_libraries(urde UrdeLocales UrdeIcons + RuntimeMP1 RuntimeCommonCharacter RuntimeCommonInput RuntimeCommonParticle diff --git a/Editor/ViewManager.hpp b/Editor/ViewManager.hpp index 1950b3ab5..e2711fdb3 100644 --- a/Editor/ViewManager.hpp +++ b/Editor/ViewManager.hpp @@ -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 m_mainWindow; + CCharacterFactoryBuilder m_test; std::unique_ptr m_rootView; std::unique_ptr m_splash; diff --git a/Runtime/CMakeLists.txt b/Runtime/CMakeLists.txt index dd8c75146..97f747460 100644 --- a/Runtime/CMakeLists.txt +++ b/Runtime/CMakeLists.txt @@ -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}) diff --git a/Runtime/CMemory.cpp b/Runtime/CMemory.cpp index e44b9c897..22f4aa763 100644 --- a/Runtime/CMemory.cpp +++ b/Runtime/CMemory.cpp @@ -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 diff --git a/Runtime/CMemory.hpp b/Runtime/CMemory.hpp index f78c731a2..6c5e28308 100644 --- a/Runtime/CMemory.hpp +++ b/Runtime/CMemory.hpp @@ -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__ diff --git a/Runtime/CSimplePool.cpp b/Runtime/CSimplePool.cpp index 07fb49293..b86d8ead3 100644 --- a/Runtime/CSimplePool.cpp +++ b/Runtime/CSimplePool.cpp @@ -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 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(), tag, paramXfer); - x4_resources.push_back(std::make_pair((SObjectTag)tag, std::move(ret))); + x4_resources.emplace(std::make_pair((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 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 pair)->bool{ - return pair.first == tag; - }); + auto iter = x4_resources.find(tag); if (iter != x4_resources.end()) x4_resources.erase(iter); } diff --git a/Runtime/CSimplePool.hpp b/Runtime/CSimplePool.hpp index 6ad910fb8..77e9f660c 100644 --- a/Runtime/CSimplePool.hpp +++ b/Runtime/CSimplePool.hpp @@ -14,8 +14,8 @@ class CObjectReference; class CSimplePool : public IObjectStore { protected: - std::list> x4_resources; - //std::unordered_map x4_resources; + //std::list> x4_resources; + std::unordered_map x4_resources; IFactory& x30_factory; CVParamTransfer x34_paramXfer; public: diff --git a/Runtime/CStateManager.hpp b/Runtime/CStateManager.hpp index 25b8ce961..e2093451d 100644 --- a/Runtime/CStateManager.hpp +++ b/Runtime/CStateManager.hpp @@ -21,7 +21,7 @@ public: const std::weak_ptr&, const std::weak_ptr&); - const std::shared_ptr GetPlayerState() const {return x8b8_playerState;} + const std::shared_ptr& GetPlayerState() const {return x8b8_playerState;} void GetObjectListById() const { diff --git a/Runtime/Character/CAnimData.cpp b/Runtime/Character/CAnimData.cpp index 8c6fa43b2..db27de545 100644 --- a/Runtime/Character/CAnimData.cpp +++ b/Runtime/Character/CAnimData.cpp @@ -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& layout, const TToken& model, + const std::experimental::optional>& iceModel, const std::weak_ptr& ctx, const std::shared_ptr& animMgr, const std::shared_ptr& 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 diff --git a/Runtime/Character/CAnimData.hpp b/Runtime/Character/CAnimData.hpp index 9dd6906c7..fb2be8c2e 100644 --- a/Runtime/Character/CAnimData.hpp +++ b/Runtime/Character/CAnimData.hpp @@ -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 xcc_layoutData; TCachedToken xd8_modelData; - // TLockedToken xe4_modelAvgNormalData; + TLockedToken xe4_iceModelData; std::shared_ptr xf4_xrayModel; std::shared_ptr xf8_infraModel; std::shared_ptr xfc_animCtx; @@ -59,8 +60,8 @@ class CAnimData std::shared_ptr 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& layout, const TToken& model, + const std::experimental::optional>& iceModel, const std::weak_ptr& ctx, const std::shared_ptr& animMgr, const std::shared_ptr& transMgr, diff --git a/Runtime/Character/CAssetFactory.cpp b/Runtime/Character/CAssetFactory.cpp index b11b1f639..d4b0cdb3e 100644 --- a/Runtime/Character/CAssetFactory.cpp +++ b/Runtime/Character/CAssetFactory.cpp @@ -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 ancs = + g_SimplePool->GetObj({SBIG('ANCS'), tag.id}); + return TToken::GetIObjObjectFor( + std::make_unique(*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 CCharacterFactoryBuilder::GetFactory(const CAnimRes& res) +{ + return x4_dummyStore.GetObj({SBIG('ANCS'), res.x0_ancsId}); +} + } diff --git a/Runtime/Character/CAssetFactory.hpp b/Runtime/Character/CAssetFactory.hpp index c6cc0e99d..f3c2454ad 100644 --- a/Runtime/Character/CAssetFactory.hpp +++ b/Runtime/Character/CAssetFactory.hpp @@ -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 Build(const SObjectTag&, const CVParamTransfer&) {return std::unique_ptr();} - 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 GetFactory(const CAnimRes& res); }; diff --git a/Runtime/Character/CCharacterFactory.cpp b/Runtime/Character/CCharacterFactory.cpp index 6e8150cce..94fd08de0 100644 --- a/Runtime/Character/CCharacterFactory.cpp +++ b/Runtime/Character/CCharacterFactory.cpp @@ -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&>(*params.GetObj()).GetParam(); + + switch (tag.type.toUint32()) + { + case 0: + return TToken::GetIObjObjectFor( + std::make_unique(*g_SimplePool, + charInfo.GetModelId(), + charInfo.GetSkinRulesId(), + charInfo.GetCharLayoutInfoId(), + CSkinnedModel::EDataOwnership::One)); + case 1: + return TToken::GetIObjObjectFor( + std::make_unique(*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 +CCharacterFactory::CreateCharacter(int charIdx, bool loop, + const TLockedToken& factory, + int defaultAnim) const { + const CCharacterInfo& charInfo = x4_charInfoDB[charIdx]; + CVParamTransfer charParm(new TObjOwnerParam(&charInfo)); + + TToken skinnedModel = + ((CCharacterFactory*)this)->x70_cacheResPool.GetObj({FourCC(), charInfo.GetModelId()}, charParm); + + std::experimental::optional> iceModel; + if (charInfo.GetIceModelId() && charInfo.GetIceSkinRulesId()) + iceModel.emplace(((CCharacterFactory*)this)->x70_cacheResPool.GetObj({FourCC(1), charInfo.GetIceModelId()}, charParm)); + + return std::make_unique(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& elem) -> bool + { + return id == elem.first; + }); + if (search == x58_animResources.cend()) + return -1; + return search->second; } std::vector diff --git a/Runtime/Character/CCharacterFactory.hpp b/Runtime/Character/CCharacterFactory.hpp index 667d5492e..cb6dfe6d3 100644 --- a/Runtime/Character/CCharacterFactory.hpp +++ b/Runtime/Character/CCharacterFactory.hpp @@ -56,7 +56,9 @@ private: public: CCharacterFactory(CSimplePool& store, const CAnimCharacterSet& ancs, ResId); - std::unique_ptr CreateCharacter(int, bool, const TLockedToken& factory, int) const; + std::unique_ptr CreateCharacter(int charIdx, bool loop, + const TLockedToken& factory, + int defaultAnim) const; ResId GetEventResourceIdForAnimResourceId(ResId animId) const; }; diff --git a/Runtime/Character/CCharacterInfo.hpp b/Runtime/Character/CCharacterInfo.hpp index 613d7dbfd..76a87c54b 100644 --- a/Runtime/Character/CCharacterInfo.hpp +++ b/Runtime/Character/CCharacterInfo.hpp @@ -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;} }; } diff --git a/Runtime/Character/CModelData.cpp b/Runtime/Character/CModelData.cpp index b26c78d61..1f7622233 100644 --- a/Runtime/Character/CModelData.cpp +++ b/Runtime/Character/CModelData.cpp @@ -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& 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& 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}); } } } diff --git a/Runtime/Character/CModelData.hpp b/Runtime/Character/CModelData.hpp index a7eb40069..3a9ba8d6a 100644 --- a/Runtime/Character/CModelData.hpp +++ b/Runtime/Character/CModelData.hpp @@ -52,6 +52,9 @@ class CModelData TLockedToken x1c_normalModel; TLockedToken x2c_xrayModel; TLockedToken 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, diff --git a/Runtime/GameGlobalObjects.cpp b/Runtime/GameGlobalObjects.cpp new file mode 100644 index 000000000..ae7745865 --- /dev/null +++ b/Runtime/GameGlobalObjects.cpp @@ -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; + +} diff --git a/Runtime/GameGlobalObjects.hpp b/Runtime/GameGlobalObjects.hpp index 2db97f524..e049acc1f 100644 --- a/Runtime/GameGlobalObjects.hpp +++ b/Runtime/GameGlobalObjects.hpp @@ -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; diff --git a/Runtime/Graphics/CLight.cpp b/Runtime/Graphics/CLight.cpp index c6cb4e265..6bed10356 100644 --- a/Runtime/Graphics/CLight.cpp +++ b/Runtime/Graphics/CLight.cpp @@ -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); diff --git a/Runtime/Graphics/CSkinnedModel.cpp b/Runtime/Graphics/CSkinnedModel.cpp index b512e65c0..8ee25a475 100644 --- a/Runtime/Graphics/CSkinnedModel.cpp +++ b/Runtime/Graphics/CSkinnedModel.cpp @@ -11,9 +11,22 @@ CSkinnedModel::CSkinnedModel(const TLockedToken& model, } +CSkinnedModel::CSkinnedModel(IObjectStore& store, ResId model, + ResId skinRules, ResId layoutInfo, + EDataOwnership ownership) +{ +} + void CSkinnedModel::Calculate(const CPoseAsTransforms& pose, const std::experimental::optional&) { } +CMorphableSkinnedModel::CMorphableSkinnedModel(IObjectStore& store, ResId model, + ResId skinRules, ResId layoutInfo, + EDataOwnership ownership) +: CSkinnedModel(store, model, skinRules, layoutInfo, ownership) +{ +} + } diff --git a/Runtime/Graphics/CSkinnedModel.hpp b/Runtime/Graphics/CSkinnedModel.hpp index f03236a0a..303838e79 100644 --- a/Runtime/Graphics/CSkinnedModel.hpp +++ b/Runtime/Graphics/CSkinnedModel.hpp @@ -21,10 +21,16 @@ class CSkinnedModel TLockedToken x10_skinRules; TLockedToken x1c_layoutInfo; public: + enum class EDataOwnership + { + Zero, + One + }; CSkinnedModel(const TLockedToken& model, const TLockedToken& skinRules, const TLockedToken& layoutInfo); - CSkinnedModel(IObjectStore& store, ResId model, ResId skinRules, ResId layoutInfo); + CSkinnedModel(IObjectStore& store, ResId model, ResId skinRules, + ResId layoutInfo, EDataOwnership ownership); const TLockedToken& GetModel() const {return x4_model;} const TLockedToken& 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__ diff --git a/Runtime/IVParamObj.hpp b/Runtime/IVParamObj.hpp index b7e3b95a9..b51a2ef17 100644 --- a/Runtime/IVParamObj.hpp +++ b/Runtime/IVParamObj.hpp @@ -30,8 +30,6 @@ template class TObjOwnerParam : public IVParamObj { T m_param; -protected: - ~TObjOwnerParam() {} public: TObjOwnerParam(T&& obj) : m_param(std::move(obj)) {} T& GetParam() {return m_param;} diff --git a/Runtime/MP1/CMainFlow.cpp b/Runtime/MP1/CMainFlow.cpp index 0618f9697..38d76f0e0 100644 --- a/Runtime/MP1/CMainFlow.cpp +++ b/Runtime/MP1/CMainFlow.cpp @@ -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)))); diff --git a/Runtime/MP1/CTweaks.cpp b/Runtime/MP1/CTweaks.cpp index df9fbe502..141024aaa 100644 --- a/Runtime/MP1/CTweaks.cpp +++ b/Runtime/MP1/CTweaks.cpp @@ -9,9 +9,6 @@ namespace urde { -DataSpec::ITweakGame* g_tweakGame = nullptr; -DataSpec::ITweakPlayer* g_tweakPlayer = nullptr; -DataSpec::ITweakPlayerControl* g_tweakPlayerControl = nullptr; namespace MP1 { diff --git a/Runtime/MP1/MP1.cpp b/Runtime/MP1/MP1.cpp index 33484784d..5cb7d3fd6 100644 --- a/Runtime/MP1/MP1.cpp +++ b/Runtime/MP1/MP1.cpp @@ -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 { diff --git a/Runtime/Particle/CElementGen.cpp b/Runtime/Particle/CElementGen.cpp index 49f88349a..981c76f6e 100644 --- a/Runtime/Particle/CElementGen.cpp +++ b/Runtime/Particle/CElementGen.cpp @@ -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); } */ diff --git a/specter b/specter index c4d0d0e80..65cdadfe1 160000 --- a/specter +++ b/specter @@ -1 +1 @@ -Subproject commit c4d0d0e8016f2d8f0772e5ad63e2ac1ed2a07915 +Subproject commit 65cdadfe16cbb63c0f7d9408e822af31b9d8dab7