mirror of https://github.com/AxioDL/metaforce.git
CAnimPlaybackParms: Make class constexpr constructible
Allows for removal of some trivial runtime initializers.
This commit is contained in:
parent
1b42bda711
commit
1fff540102
|
@ -20,10 +20,10 @@ class CAnimPlaybackParms {
|
|||
const zeus::CVector3f* x24_objectScale = nullptr;
|
||||
|
||||
public:
|
||||
CAnimPlaybackParms() = default;
|
||||
CAnimPlaybackParms(s32 animA, s32 animB, float blendWeight, bool animating)
|
||||
constexpr CAnimPlaybackParms() = default;
|
||||
constexpr CAnimPlaybackParms(s32 animA, s32 animB, float blendWeight, bool animating)
|
||||
: x0_animA(animA), x4_animB(animB), x8_blendWeight(blendWeight), xc_animating(animating) {}
|
||||
CAnimPlaybackParms(s32 anim, const zeus::CQuaternion* deltaOrient, const zeus::CVector3f* targetPos,
|
||||
constexpr CAnimPlaybackParms(s32 anim, const zeus::CQuaternion* deltaOrient, const zeus::CVector3f* targetPos,
|
||||
const zeus::CTransform* xf, const zeus::CVector3f* scale, bool useLocator)
|
||||
: x0_animA(anim)
|
||||
, x14_targetPos(targetPos)
|
||||
|
@ -31,17 +31,18 @@ public:
|
|||
, x1c_deltaOrient(deltaOrient)
|
||||
, x20_objectXf(xf)
|
||||
, x24_objectScale(scale) {}
|
||||
const zeus::CTransform* GetObjectXform() const { return x20_objectXf; }
|
||||
const zeus::CQuaternion* GetDeltaOrient() const { return x1c_deltaOrient; }
|
||||
const zeus::CVector3f* GetTargetPos() const { return x14_targetPos; }
|
||||
bool GetIsUseLocator() const { return x18_useLocator; }
|
||||
const zeus::CVector3f* GetObjectScale() const { return x24_objectScale; }
|
||||
s32 GetAnimationId() const { return x0_animA; }
|
||||
s32 GetSecondAnimationId() const { return x4_animB; }
|
||||
float GetBlendFactor() const { return x8_blendWeight; }
|
||||
void SetAnimationId(s32 id) { x0_animA = id; }
|
||||
void SetSecondAnimationId(s32 id) { x4_animB = id; }
|
||||
void SetBlendFactor(float f) { x8_blendWeight = f; }
|
||||
bool GetIsPlayAnimation() const { return xc_animating; }
|
||||
|
||||
constexpr const zeus::CTransform* GetObjectXform() const { return x20_objectXf; }
|
||||
constexpr const zeus::CQuaternion* GetDeltaOrient() const { return x1c_deltaOrient; }
|
||||
constexpr const zeus::CVector3f* GetTargetPos() const { return x14_targetPos; }
|
||||
constexpr bool GetIsUseLocator() const { return x18_useLocator; }
|
||||
constexpr const zeus::CVector3f* GetObjectScale() const { return x24_objectScale; }
|
||||
constexpr s32 GetAnimationId() const { return x0_animA; }
|
||||
constexpr s32 GetSecondAnimationId() const { return x4_animB; }
|
||||
constexpr float GetBlendFactor() const { return x8_blendWeight; }
|
||||
constexpr void SetAnimationId(s32 id) { x0_animA = id; }
|
||||
constexpr void SetSecondAnimationId(s32 id) { x4_animB = id; }
|
||||
constexpr void SetBlendFactor(float f) { x8_blendWeight = f; }
|
||||
constexpr bool GetIsPlayAnimation() const { return xc_animating; }
|
||||
};
|
||||
} // namespace urde
|
||||
|
|
|
@ -156,7 +156,7 @@ bool CSamusDoll::IsLoaded() const {
|
|||
CModelData CSamusDoll::BuildSuitModelData1(CPlayerState::EPlayerSuit suit) {
|
||||
CModelData ret(CAnimRes(g_ResFactory->GetResourceIdByName("ANCS_ItemScreenSamus")->id, Character1Idxs[size_t(suit)],
|
||||
zeus::skOne3f, 2, true));
|
||||
CAnimPlaybackParms parms(2, -1, 1.f, true);
|
||||
constexpr CAnimPlaybackParms parms(2, -1, 1.f, true);
|
||||
ret.GetAnimationData()->SetAnimation(parms, false);
|
||||
return ret;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ CModelData CSamusDoll::BuildSuitModelData1(CPlayerState::EPlayerSuit suit) {
|
|||
CModelData CSamusDoll::BuildSuitModelDataBoots(CPlayerState::EPlayerSuit suit) {
|
||||
CModelData ret(CAnimRes(g_ResFactory->GetResourceIdByName("ANCS_ItemScreenSamus")->id,
|
||||
CharacterBootsIdxs[size_t(suit)], zeus::skOne3f, 2, true));
|
||||
CAnimPlaybackParms parms(2, -1, 1.f, true);
|
||||
constexpr CAnimPlaybackParms parms(2, -1, 1.f, true);
|
||||
ret.GetAnimationData()->SetAnimation(parms, false);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ CSamusFaceReflection::CSamusFaceReflection(CStateManager& stateMgr)
|
|||
: x0_modelData(CAnimRes(g_ResFactory->GetResourceIdByName("ACS_SamusFace")->id, 0, zeus::skOne3f, 0, true))
|
||||
, x4c_lights(std::make_unique<CActorLights>(8, zeus::skZero3f, 4, 4, false, false, false, 0.1f)) {
|
||||
x60_lookDir = zeus::skForward;
|
||||
CAnimPlaybackParms parms(0, -1, 1.f, true);
|
||||
constexpr CAnimPlaybackParms parms(0, -1, 1.f, true);
|
||||
x0_modelData.GetAnimationData()->SetAnimation(parms, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -131,35 +131,35 @@ void CGrappleArm::SetAnimState(EArmState state) {
|
|||
switch (state) {
|
||||
case EArmState::IntoGrapple: {
|
||||
ResetAuxParams(true);
|
||||
CAnimPlaybackParms parms(0, -1, 1.f, true);
|
||||
constexpr CAnimPlaybackParms parms(0, -1, 1.f, true);
|
||||
x0_grappleArmModel->GetAnimationData()->SetAnimation(parms, false);
|
||||
x3b2_25_beamActive = false;
|
||||
x3b2_24_active = true;
|
||||
break;
|
||||
}
|
||||
case EArmState::IntoGrappleIdle: {
|
||||
CAnimPlaybackParms parms(1, -1, 1.f, true);
|
||||
constexpr CAnimPlaybackParms parms(1, -1, 1.f, true);
|
||||
x0_grappleArmModel->GetAnimationData()->EnableLooping(true);
|
||||
x0_grappleArmModel->GetAnimationData()->SetAnimation(parms, false);
|
||||
break;
|
||||
}
|
||||
case EArmState::FireGrapple: {
|
||||
CAnimPlaybackParms parms(2, -1, 1.f, true);
|
||||
constexpr CAnimPlaybackParms parms(2, -1, 1.f, true);
|
||||
x0_grappleArmModel->GetAnimationData()->SetAnimation(parms, false);
|
||||
break;
|
||||
}
|
||||
case EArmState::ConnectGrapple: {
|
||||
CAnimPlaybackParms parms(3, -1, 1.f, true);
|
||||
constexpr CAnimPlaybackParms parms(3, -1, 1.f, true);
|
||||
x0_grappleArmModel->GetAnimationData()->SetAnimation(parms, false);
|
||||
break;
|
||||
}
|
||||
case EArmState::Connected: {
|
||||
CAnimPlaybackParms parms(3, -1, 1.f, true);
|
||||
constexpr CAnimPlaybackParms parms(3, -1, 1.f, true);
|
||||
x0_grappleArmModel->GetAnimationData()->SetAnimation(parms, false);
|
||||
break;
|
||||
}
|
||||
case EArmState::OutOfGrapple: {
|
||||
CAnimPlaybackParms parms(4, -1, 1.f, true);
|
||||
constexpr CAnimPlaybackParms parms(4, -1, 1.f, true);
|
||||
x0_grappleArmModel->GetAnimationData()->SetAnimation(parms, false);
|
||||
DisconnectGrappleBeam();
|
||||
break;
|
||||
|
|
|
@ -1129,7 +1129,7 @@ void CMorphBall::EnterMorphBallState(CStateManager& mgr) {
|
|||
x1c20_tireFactor = 0.f;
|
||||
UpdateEffects(0.f, mgr);
|
||||
x187c_spiderBallState = ESpiderBallState::Inactive;
|
||||
CAnimPlaybackParms parms(0, -1, 1.f, true);
|
||||
constexpr CAnimPlaybackParms parms(0, -1, 1.f, true);
|
||||
x58_ballModel->GetAnimationData()->SetAnimation(parms, false);
|
||||
x1e20_ballAnimIdx = 0;
|
||||
StopEffects();
|
||||
|
@ -1288,7 +1288,7 @@ void CMorphBall::ComputeBoostBallMovement(const CFinalInput& input, CStateManage
|
|||
if (ControlMapper::GetDigitalInput(ControlMapper::ECommands::JumpOrBoost, input) &&
|
||||
x187c_spiderBallState != ESpiderBallState::Active) {
|
||||
if (x1e20_ballAnimIdx == 0) {
|
||||
CAnimPlaybackParms parms(1, -1, 1.f, true);
|
||||
constexpr CAnimPlaybackParms parms(1, -1, 1.f, true);
|
||||
x58_ballModel->GetAnimationData()->SetAnimation(parms, false);
|
||||
x1e20_ballAnimIdx = 1;
|
||||
x1e24_boostSfxHandle = CSfxManager::SfxStart(SFXsam_ball_charge_lp, 1.f, 0.f, true, 0x7f, true, kInvalidAreaId);
|
||||
|
@ -1298,7 +1298,7 @@ void CMorphBall::ComputeBoostBallMovement(const CFinalInput& input, CStateManage
|
|||
x1de8_boostChargeTime = g_tweakBall->GetBoostBallMaxChargeTime();
|
||||
} else {
|
||||
if (x1e20_ballAnimIdx == 1) {
|
||||
CAnimPlaybackParms parms(0, -1, 1.f, true);
|
||||
constexpr CAnimPlaybackParms parms(0, -1, 1.f, true);
|
||||
x58_ballModel->GetAnimationData()->SetAnimation(parms, false);
|
||||
x1e20_ballAnimIdx = 0;
|
||||
CSfxManager::RemoveEmitter(x1e24_boostSfxHandle);
|
||||
|
@ -1399,7 +1399,7 @@ void CMorphBall::CancelBoosting() {
|
|||
x1de8_boostChargeTime = 0.f;
|
||||
x1df4_boostDrainTime = 0.f;
|
||||
if (x1e20_ballAnimIdx == 1) {
|
||||
CAnimPlaybackParms parms(0, -1, 1.f, true);
|
||||
constexpr CAnimPlaybackParms parms(0, -1, 1.f, true);
|
||||
x58_ballModel->GetAnimationData()->SetAnimation(parms, false);
|
||||
x1e20_ballAnimIdx = 0;
|
||||
CSfxManager::SfxStop(x1e24_boostSfxHandle);
|
||||
|
|
|
@ -5859,7 +5859,7 @@ void CPlayer::SetHudDisable(float staticTimer, float outSpeed, float inSpeed) {
|
|||
}
|
||||
|
||||
void CPlayer::SetIntoBallReadyAnimation(CStateManager& mgr) {
|
||||
const CAnimPlaybackParms parms(2, -1, 1.f, true);
|
||||
constexpr CAnimPlaybackParms parms(2, -1, 1.f, true);
|
||||
x64_modelData->GetAnimationData()->SetAnimation(parms, false);
|
||||
x64_modelData->GetAnimationData()->EnableLooping(false);
|
||||
x64_modelData->AdvanceAnimation(0.f, mgr, kInvalidAreaId, true);
|
||||
|
|
Loading…
Reference in New Issue