diff --git a/Runtime/Character/CAnimData.cpp b/Runtime/Character/CAnimData.cpp index 18505188a..ea77351a2 100644 --- a/Runtime/Character/CAnimData.cpp +++ b/Runtime/Character/CAnimData.cpp @@ -97,6 +97,20 @@ CAnimData::CAnimData(CAssetId id, x1f8_animRoot = treeNode; } +void CAnimData::InitializeEffects(CStateManager& mgr, TAreaId aId, const zeus::CVector3f& scale) +{ + for (const auto& effects : xc_charInfo.GetEffectList()) + { + for (const auto& effect : effects.second) + { + x120_particleDB.CacheParticleDesc(effect.GetParticleTag()); + x120_particleDB.AddParticleEffect(effect.GetSegmentName(), effect.GetFlags(), CParticleData(), scale, mgr, + aId, true, x21c_particleLightIdx); + x120_particleDB.SetParticleEffectState(effect.GetComponentName(), false, mgr); + } + } +} + CAssetId CAnimData::GetEventResourceIdForAnimResourceId(CAssetId id) const { return x0_charFactory->GetEventResourceIdForAnimResourceId(id); diff --git a/Runtime/Character/CAnimData.hpp b/Runtime/Character/CAnimData.hpp index 5b30e50e6..925d0eb7e 100644 --- a/Runtime/Character/CAnimData.hpp +++ b/Runtime/Character/CAnimData.hpp @@ -165,6 +165,7 @@ public: const TLockedToken& charFactory, int drawInstCount); + void InitializeEffects(CStateManager&, TAreaId, const zeus::CVector3f&); CAssetId GetEventResourceIdForAnimResourceId(CAssetId) const; void AddAdditiveSegData(const CSegIdList& list, CSegStatementSet& stSet); static SAdvancementResults AdvanceAdditiveAnim(std::shared_ptr& anim, const CCharAnimTime& time); diff --git a/Runtime/Character/CCharacterInfo.hpp b/Runtime/Character/CCharacterInfo.hpp index 83dc07160..da7b5af03 100644 --- a/Runtime/Character/CCharacterInfo.hpp +++ b/Runtime/Character/CCharacterInfo.hpp @@ -12,6 +12,7 @@ namespace urde class CCharacterInfo { friend class CAnimData; + public: struct CParticleResData { @@ -21,6 +22,7 @@ public: std::vector x30_elsc; CParticleResData(CInputStream& in, u16 tableCount); }; + private: u16 x0_tableCount; std::string x4_name; @@ -43,20 +45,23 @@ public: CCharacterInfo(CInputStream& in); std::string_view GetCharacterName() const { return x4_name; } - CAssetId GetModelId() const {return x14_cmdl;} - CAssetId GetSkinRulesId() const {return x18_cskr;} - CAssetId GetCharLayoutInfoId() const {return x1c_cinf;} + CAssetId GetModelId() const { return x14_cmdl; } + CAssetId GetSkinRulesId() const { return x18_cskr; } + CAssetId GetCharLayoutInfoId() const { return x1c_cinf; } const std::vector>& GetAnimBBoxList() const { return x88_aabbs; } + const std::vector>>& GetEffectList() const + { + return x98_effects; + } - CAssetId GetIceModelId() const {return xa8_cmdlOverlay;} - CAssetId GetIceSkinRulesId() const {return xac_cskrOverlay;} + CAssetId GetIceModelId() const { return xa8_cmdlOverlay; } + CAssetId GetIceSkinRulesId() const { return xac_cskrOverlay; } - const CParticleResData& GetParticleResData() const {return x44_partRes;} + const CParticleResData& GetParticleResData() const { return x44_partRes; } u32 GetAnimationIndex(u32 idx) const { return xb0_animIdxs.at(idx); } const CPASDatabase& GetPASDatabase() const { return x30_pasDatabase; } }; - } #endif // __URDE_CCHARACTERINFO_HPP__ diff --git a/Runtime/Character/CMetaAnimBlend.cpp b/Runtime/Character/CMetaAnimBlend.cpp index 0eec79e19..1a8d1df7c 100644 --- a/Runtime/Character/CMetaAnimBlend.cpp +++ b/Runtime/Character/CMetaAnimBlend.cpp @@ -14,12 +14,15 @@ CMetaAnimBlend::CMetaAnimBlend(CInputStream& in) void CMetaAnimBlend::GetUniquePrimitives(std::set& primsOut) const { + x4_animA->GetUniquePrimitives(primsOut); + x4_animA->GetUniquePrimitives(primsOut); } std::shared_ptr CMetaAnimBlend::VGetAnimationTree(const CAnimSysContext& animSys, const CMetaAnimTreeBuildOrders& orders) const { + CMetaAnimTreeBuildOrders buildOrders = CMetaAnimTreeBuildOrders::NoSpecialOrders(); return {}; } diff --git a/Runtime/Character/CMetaAnimPhaseBlend.cpp b/Runtime/Character/CMetaAnimPhaseBlend.cpp index 473090c42..6316ec8b3 100644 --- a/Runtime/Character/CMetaAnimPhaseBlend.cpp +++ b/Runtime/Character/CMetaAnimPhaseBlend.cpp @@ -14,6 +14,8 @@ CMetaAnimPhaseBlend::CMetaAnimPhaseBlend(CInputStream& in) void CMetaAnimPhaseBlend::GetUniquePrimitives(std::set& primsOut) const { + x4_animA->GetUniquePrimitives(primsOut); + x8_animB->GetUniquePrimitives(primsOut); } std::shared_ptr diff --git a/Runtime/Character/CMetaAnimRandom.cpp b/Runtime/Character/CMetaAnimRandom.cpp index f2f471d43..29f79114c 100644 --- a/Runtime/Character/CMetaAnimRandom.cpp +++ b/Runtime/Character/CMetaAnimRandom.cpp @@ -24,6 +24,8 @@ CMetaAnimRandom::CMetaAnimRandom(CInputStream& in) void CMetaAnimRandom::GetUniquePrimitives(std::set& primsOut) const { + for (const auto& pair : x4_randomData) + pair.first->GetUniquePrimitives(primsOut); } std::shared_ptr diff --git a/Runtime/Character/CParticleDatabase.cpp b/Runtime/Character/CParticleDatabase.cpp index 16ebfe130..a649f07ea 100644 --- a/Runtime/Character/CParticleDatabase.cpp +++ b/Runtime/Character/CParticleDatabase.cpp @@ -16,6 +16,11 @@ CParticleDatabase::CParticleDatabase() xb4_25_drawingEnds = false; } +void CParticleDatabase::CacheParticleDesc(const SObjectTag &tag) +{ + +} + void CParticleDatabase::CacheParticleDesc(const CCharacterInfo::CParticleResData& desc) { for (CAssetId id : desc.x0_part) diff --git a/Runtime/Character/CParticleDatabase.hpp b/Runtime/Character/CParticleDatabase.hpp index 09b2abf8f..a9594fa56 100644 --- a/Runtime/Character/CParticleDatabase.hpp +++ b/Runtime/Character/CParticleDatabase.hpp @@ -47,6 +47,7 @@ class CParticleDatabase std::map>& map, bool deleteIfDone); public: CParticleDatabase(); + void CacheParticleDesc(const SObjectTag& tag); void CacheParticleDesc(const CCharacterInfo::CParticleResData& desc); void SetModulationColorAllActiveEffects(const zeus::CColor& color); void SuspendAllActiveEffects(CStateManager& stateMgr); diff --git a/Runtime/Character/IMetaAnim.hpp b/Runtime/Character/IMetaAnim.hpp index 8db81c4e6..d1469d57a 100644 --- a/Runtime/Character/IMetaAnim.hpp +++ b/Runtime/Character/IMetaAnim.hpp @@ -55,7 +55,13 @@ struct CMetaAnimTreeBuildOrders std::experimental::optional x0_; std::experimental::optional x44_; static CMetaAnimTreeBuildOrders NoSpecialOrders() { return {}; } - void PreAdvanceForAll(const CPreAdvanceIndicator& ind) { x44_.emplace(ind); } + static CMetaAnimTreeBuildOrders PreAdvanceForAll(const CPreAdvanceIndicator& ind) + { + CMetaAnimTreeBuildOrders ret; + ret.x0_.emplace(ind); + ret.x44_.emplace(ind); + return ret; + } }; class IMetaAnim diff --git a/Runtime/World/CActor.cpp b/Runtime/World/CActor.cpp index 195be6b12..6d906b1c6 100644 --- a/Runtime/World/CActor.cpp +++ b/Runtime/World/CActor.cpp @@ -55,17 +55,15 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana if (HasModelData() && x64_modelData->AnimationData()) { TAreaId aid = GetAreaId(); - // x64_modelData->AnimationData()->sub_8002AE6C(mgr, aid, x64_modelData->x0_particleScale); + x64_modelData->AnimationData()->InitializeEffects(mgr, aid, x64_modelData->GetScale()); } } break; case EScriptObjectMessage::Deleted: // 34 { RemoveEmitter(); -#if 0 if (HasModelData() && x64_modelData->AnimationData() && x64_modelData->GetNormalModel()) - x64_modelData->AnimationData()->GetParticleDB().GetActiveParticleLightIds(mgr); -#endif + x64_modelData->AnimationData()->GetParticleDB().DeleteAllLights(mgr); } break; case EScriptObjectMessage::InitializedInArea: // 35 diff --git a/hecl b/hecl index 2bfe803bf..f4dd74c50 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 2bfe803bf63aa17af34adac7c7b317dc8c646467 +Subproject commit f4dd74c50be1f6e557f72986dea84d27f10a3819