mirror of https://github.com/AxioDL/metaforce.git
CKnockBackController: Make CalculateExtraHurlVelocity() a const member function
This doesn't modify internal member state, so it can be marked const While we're at it we can also invert the conditional to unindent the main calculation.
This commit is contained in:
parent
b55d1e4c77
commit
58040eb53d
|
@ -473,10 +473,12 @@ void CKnockBackController::ValidateState(const CPatterned& parent) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float CKnockBackController::CalculateExtraHurlVelocity(CStateManager& mgr, float magnitude, float kbResistance) {
|
float CKnockBackController::CalculateExtraHurlVelocity(CStateManager& mgr, float magnitude, float kbResistance) const {
|
||||||
if (magnitude > kbResistance)
|
if (magnitude <= kbResistance) {
|
||||||
return (1.1f - 0.2f * mgr.GetActiveRandom()->Float()) * 2.f * (magnitude - kbResistance);
|
|
||||||
return 0.f;
|
return 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (1.1f - 0.2f * mgr.GetActiveRandom()->Float()) * 2.f * (magnitude - kbResistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKnockBackController::DoKnockBackAnimation(const zeus::CVector3f& backVec, CStateManager& mgr, CPatterned& parent,
|
void CKnockBackController::DoKnockBackAnimation(const zeus::CVector3f& backVec, CStateManager& mgr, CPatterned& parent,
|
||||||
|
|
|
@ -101,7 +101,7 @@ private:
|
||||||
bool TickDeferredTimer(float dt);
|
bool TickDeferredTimer(float dt);
|
||||||
EKnockBackCharacterState GetKnockBackCharacterState(const CPatterned& parent) const;
|
EKnockBackCharacterState GetKnockBackCharacterState(const CPatterned& parent) const;
|
||||||
void ValidateState(const CPatterned& parent);
|
void ValidateState(const CPatterned& parent);
|
||||||
float CalculateExtraHurlVelocity(CStateManager& mgr, float magnitude, float kbResistance);
|
float CalculateExtraHurlVelocity(CStateManager& mgr, float magnitude, float kbResistance) const;
|
||||||
void DoKnockBackAnimation(const zeus::CVector3f& backVec, CStateManager& mgr, CPatterned& parent, float magnitude);
|
void DoKnockBackAnimation(const zeus::CVector3f& backVec, CStateManager& mgr, CPatterned& parent, float magnitude);
|
||||||
void ResetKnockBackImpulse(const CPatterned& parent, const zeus::CVector3f& backVec, float magnitude);
|
void ResetKnockBackImpulse(const CPatterned& parent, const zeus::CVector3f& backVec, float magnitude);
|
||||||
void DoDeferredKnockBack(CStateManager& mgr, CPatterned& parent);
|
void DoDeferredKnockBack(CStateManager& mgr, CPatterned& parent);
|
||||||
|
|
Loading…
Reference in New Issue