mirror of https://github.com/AxioDL/metaforce.git
CAnimData: std::move constructor arguments where applicable
Same behavior, but allows calling code to move into the respective parameters now.
This commit is contained in:
parent
79565d7f52
commit
e289643742
|
@ -40,19 +40,19 @@ void CAnimData::FreeCache() {}
|
||||||
void CAnimData::InitializeCache() {}
|
void CAnimData::InitializeCache() {}
|
||||||
|
|
||||||
CAnimData::CAnimData(CAssetId id, const CCharacterInfo& character, int defaultAnim, int charIdx, bool loop,
|
CAnimData::CAnimData(CAssetId id, const CCharacterInfo& character, int defaultAnim, int charIdx, bool loop,
|
||||||
const TLockedToken<CCharLayoutInfo>& layout, const TToken<CSkinnedModel>& model,
|
TLockedToken<CCharLayoutInfo> layout, TToken<CSkinnedModel> model,
|
||||||
const std::optional<TToken<CMorphableSkinnedModel>>& iceModel,
|
const std::optional<TToken<CMorphableSkinnedModel>>& iceModel,
|
||||||
const std::weak_ptr<CAnimSysContext>& ctx, const std::shared_ptr<CAnimationManager>& animMgr,
|
const std::weak_ptr<CAnimSysContext>& ctx, std::shared_ptr<CAnimationManager> animMgr,
|
||||||
const std::shared_ptr<CTransitionManager>& transMgr,
|
std::shared_ptr<CTransitionManager> transMgr, TLockedToken<CCharacterFactory> charFactory,
|
||||||
const TLockedToken<CCharacterFactory>& charFactory, int drawInstCount)
|
int drawInstCount)
|
||||||
: x0_charFactory(charFactory)
|
: x0_charFactory(std::move(charFactory))
|
||||||
, xc_charInfo(character)
|
, xc_charInfo(character)
|
||||||
, xcc_layoutData(layout)
|
, xcc_layoutData(std::move(layout))
|
||||||
, xd8_modelData(model)
|
, xd8_modelData(std::move(model))
|
||||||
, xfc_animCtx(ctx.lock())
|
, xfc_animCtx(ctx.lock())
|
||||||
, x100_animMgr(animMgr)
|
, x100_animMgr(std::move(animMgr))
|
||||||
, x1d8_selfId(id)
|
, x1d8_selfId(id)
|
||||||
, x1fc_transMgr(transMgr)
|
, x1fc_transMgr(std::move(transMgr))
|
||||||
, x204_charIdx(charIdx)
|
, x204_charIdx(charIdx)
|
||||||
, x208_defaultAnim(defaultAnim)
|
, x208_defaultAnim(defaultAnim)
|
||||||
, x224_pose(layout->GetSegIdList().GetList().size())
|
, x224_pose(layout->GetSegIdList().GetList().size())
|
||||||
|
@ -82,10 +82,11 @@ CAnimData::CAnimData(CAssetId id, const CCharacterInfo& character, int defaultAn
|
||||||
character.GetCharacterName());
|
character.GetCharacterName());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<CAnimTreeNode> treeNode = GetAnimationManager()->GetAnimationTree(
|
auto treeNode = GetAnimationManager()->GetAnimationTree(character.GetAnimationIndex(defaultAnim),
|
||||||
character.GetAnimationIndex(defaultAnim), CMetaAnimTreeBuildOrders::NoSpecialOrders());
|
CMetaAnimTreeBuildOrders::NoSpecialOrders());
|
||||||
if (treeNode != x1f8_animRoot)
|
if (treeNode != x1f8_animRoot) {
|
||||||
x1f8_animRoot = treeNode;
|
x1f8_animRoot = std::move(treeNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAnimData::SetParticleEffectState(std::string_view effectName, bool active, CStateManager& mgr) {
|
void CAnimData::SetParticleEffectState(std::string_view effectName, bool active, CStateManager& mgr) {
|
||||||
|
|
|
@ -155,11 +155,10 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAnimData(CAssetId, const CCharacterInfo& character, int defaultAnim, int charIdx, bool loop,
|
CAnimData(CAssetId, const CCharacterInfo& character, int defaultAnim, int charIdx, bool loop,
|
||||||
const TLockedToken<CCharLayoutInfo>& layout, const TToken<CSkinnedModel>& model,
|
TLockedToken<CCharLayoutInfo> layout, TToken<CSkinnedModel> model,
|
||||||
const std::optional<TToken<CMorphableSkinnedModel>>& iceModel,
|
const std::optional<TToken<CMorphableSkinnedModel>>& iceModel, const std::weak_ptr<CAnimSysContext>& ctx,
|
||||||
const std::weak_ptr<CAnimSysContext>& ctx, const std::shared_ptr<CAnimationManager>& animMgr,
|
std::shared_ptr<CAnimationManager> animMgr, std::shared_ptr<CTransitionManager> transMgr,
|
||||||
const std::shared_ptr<CTransitionManager>& transMgr, const TLockedToken<CCharacterFactory>& charFactory,
|
TLockedToken<CCharacterFactory> charFactory, int drawInstCount);
|
||||||
int drawInstCount);
|
|
||||||
|
|
||||||
void SetParticleEffectState(std::string_view effectName, bool active, CStateManager& mgr);
|
void SetParticleEffectState(std::string_view effectName, bool active, CStateManager& mgr);
|
||||||
void InitializeEffects(CStateManager&, TAreaId, const zeus::CVector3f&);
|
void InitializeEffects(CStateManager&, TAreaId, const zeus::CVector3f&);
|
||||||
|
|
|
@ -78,19 +78,20 @@ std::unique_ptr<CAnimData> CCharacterFactory::CreateCharacter(int charIdx, bool
|
||||||
const TLockedToken<CCharacterFactory>& factory,
|
const TLockedToken<CCharacterFactory>& factory,
|
||||||
int defaultAnim, int drawInsts) const {
|
int defaultAnim, int drawInsts) const {
|
||||||
const CCharacterInfo& charInfo = x4_charInfoDB[charIdx];
|
const CCharacterInfo& charInfo = x4_charInfoDB[charIdx];
|
||||||
CVParamTransfer charParm(new TObjOwnerParam<const CCharacterInfo*>(&charInfo));
|
const CVParamTransfer charParm(new TObjOwnerParam<const CCharacterInfo*>(&charInfo));
|
||||||
|
|
||||||
TToken<CSkinnedModel> skinnedModel = const_cast<CCharacterFactory*>(this)->x70_cacheResPool.GetObj(
|
TToken<CSkinnedModel> skinnedModel = const_cast<CCharacterFactory*>(this)->x70_cacheResPool.GetObj(
|
||||||
{FourCC(drawInsts << 16), charInfo.GetModelId()}, charParm);
|
{FourCC(drawInsts << 16), charInfo.GetModelId()}, charParm);
|
||||||
|
|
||||||
std::optional<TToken<CMorphableSkinnedModel>> iceModel;
|
std::optional<TToken<CMorphableSkinnedModel>> iceModel;
|
||||||
if (charInfo.GetIceModelId().IsValid() && charInfo.GetIceSkinRulesId().IsValid())
|
if (charInfo.GetIceModelId().IsValid() && charInfo.GetIceSkinRulesId().IsValid()) {
|
||||||
iceModel.emplace(const_cast<CCharacterFactory*>(this)->x70_cacheResPool.GetObj(
|
iceModel.emplace(const_cast<CCharacterFactory*>(this)->x70_cacheResPool.GetObj(
|
||||||
{FourCC((drawInsts << 16) | 1), charInfo.GetIceModelId()}, charParm));
|
{FourCC((drawInsts << 16) | 1), charInfo.GetIceModelId()}, charParm));
|
||||||
|
}
|
||||||
|
|
||||||
return std::make_unique<CAnimData>(x68_selfId, charInfo, defaultAnim, charIdx, loop, x14_charLayoutInfoDB[charIdx],
|
return std::make_unique<CAnimData>(x68_selfId, charInfo, defaultAnim, charIdx, loop, x14_charLayoutInfoDB[charIdx],
|
||||||
skinnedModel, iceModel, x24_sysContext, x28_animMgr, x2c_transMgr, factory,
|
std::move(skinnedModel), iceModel, x24_sysContext, x28_animMgr, x2c_transMgr,
|
||||||
drawInsts);
|
factory, drawInsts);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAssetId CCharacterFactory::GetEventResourceIdForAnimResourceId(CAssetId id) const {
|
CAssetId CCharacterFactory::GetEventResourceIdForAnimResourceId(CAssetId id) const {
|
||||||
|
|
Loading…
Reference in New Issue