mirror of https://github.com/AxioDL/metaforce.git
CKnockBackController: Make use of const references where applicable
In many cases the CPatterned& parameter is only used for read-only querying. We can make this explicit in the interface.
This commit is contained in:
parent
49cc019699
commit
b55d1e4c77
|
@ -407,7 +407,7 @@ EKnockBackCharacterState CKnockBackController::GetKnockBackCharacterState(const
|
|||
return parent.IsAlive() ? EKnockBackCharacterState::Alive : EKnockBackCharacterState::Dead;
|
||||
}
|
||||
|
||||
void CKnockBackController::ValidateState(CPatterned& parent) {
|
||||
void CKnockBackController::ValidateState(const CPatterned& parent) {
|
||||
if (x4_activeParms.x0_animState < x18_minAnimState)
|
||||
x4_activeParms.x0_animState = x18_minAnimState;
|
||||
else if (x4_activeParms.x0_animState > x1c_maxAnimState)
|
||||
|
@ -518,7 +518,8 @@ void CKnockBackController::DoKnockBackAnimation(const zeus::CVector3f& backVec,
|
|||
}
|
||||
}
|
||||
|
||||
void CKnockBackController::ResetKnockBackImpulse(CPatterned& parent, const zeus::CVector3f& backVec, float magnitude) {
|
||||
void CKnockBackController::ResetKnockBackImpulse(const CPatterned& parent, const zeus::CVector3f& backVec,
|
||||
float magnitude) {
|
||||
if (x81_24_autoResetImpulse && x4_activeParms.x0_animState == EKnockBackAnimationState::KnockBack &&
|
||||
x4_activeParms.x4_animFollowup != EKnockBackAnimationFollowUp::Freeze) {
|
||||
x50_impulseDir = backVec.canBeNormalized() ? backVec.normalized() : -parent.GetTransform().basis[1];
|
||||
|
@ -609,16 +610,18 @@ EKnockBackWeaponType CKnockBackController::GetKnockBackWeaponType(const CDamageI
|
|||
}
|
||||
}
|
||||
|
||||
void CKnockBackController::SelectDamageState(CPatterned& parent, const CDamageInfo& info, EWeaponType wType,
|
||||
void CKnockBackController::SelectDamageState(const CPatterned& parent, const CDamageInfo& info, EWeaponType wType,
|
||||
EKnockBackType type) {
|
||||
|
||||
x4_activeParms = KnockBackParms();
|
||||
EKnockBackWeaponType weaponType = GetKnockBackWeaponType(info, wType, type);
|
||||
if (weaponType != EKnockBackWeaponType::Invalid) {
|
||||
x4_activeParms =
|
||||
KnockBackParmsTable[size_t(x0_variant)][size_t(weaponType)][size_t(GetKnockBackCharacterState(parent))];
|
||||
ValidateState(parent);
|
||||
|
||||
const EKnockBackWeaponType weaponType = GetKnockBackWeaponType(info, wType, type);
|
||||
if (weaponType == EKnockBackWeaponType::Invalid) {
|
||||
return;
|
||||
}
|
||||
|
||||
x4_activeParms =
|
||||
KnockBackParmsTable[size_t(x0_variant)][size_t(weaponType)][size_t(GetKnockBackCharacterState(parent))];
|
||||
ValidateState(parent);
|
||||
}
|
||||
|
||||
void CKnockBackController::KnockBack(const zeus::CVector3f& backVec, CStateManager& mgr, CPatterned& parent,
|
||||
|
|
|
@ -100,13 +100,13 @@ private:
|
|||
void ApplyImpulse(float dt, CPatterned& parent);
|
||||
bool TickDeferredTimer(float dt);
|
||||
EKnockBackCharacterState GetKnockBackCharacterState(const CPatterned& parent) const;
|
||||
void ValidateState(CPatterned& parent);
|
||||
void ValidateState(const CPatterned& parent);
|
||||
float CalculateExtraHurlVelocity(CStateManager& mgr, float magnitude, float kbResistance);
|
||||
void DoKnockBackAnimation(const zeus::CVector3f& backVec, CStateManager& mgr, CPatterned& parent, float magnitude);
|
||||
void ResetKnockBackImpulse(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);
|
||||
EKnockBackWeaponType GetKnockBackWeaponType(const CDamageInfo& info, EWeaponType wType, EKnockBackType type);
|
||||
void SelectDamageState(CPatterned& parent, const CDamageInfo& info, EWeaponType wType, EKnockBackType type);
|
||||
void SelectDamageState(const CPatterned& parent, const CDamageInfo& info, EWeaponType wType, EKnockBackType type);
|
||||
|
||||
public:
|
||||
explicit CKnockBackController(EKnockBackVariant variant);
|
||||
|
|
Loading…
Reference in New Issue