CBodyController: Add names to parameters in interface

Makes the interface more self-documenting and allows IDEs to perform
better introspection at call sites.
This commit is contained in:
Lioncash 2020-03-25 01:36:51 -04:00
parent ab6c45c7a8
commit f875bdf024
2 changed files with 34 additions and 28 deletions

View File

@ -17,7 +17,9 @@ CBodyController::CBodyController(CActor& actor, float turnSpeed, EBodyType bodyT
x2a4_bodyStateInfo.x18_bodyController = this;
}
void CBodyController::EnableAnimation(bool e) { x0_actor.GetModelData()->GetAnimationData()->EnableAnimation(e); }
void CBodyController::EnableAnimation(bool enable) {
x0_actor.GetModelData()->GetAnimationData()->EnableAnimation(enable);
}
void CBodyController::Activate(CStateManager& mgr) {
x300_25_active = true;
@ -61,7 +63,7 @@ void CBodyController::UpdateBody(float dt, CStateManager& mgr) {
}
}
void CBodyController::SetTurnSpeed(float s) { x2fc_turnSpeed = std::max(0.f, s); }
void CBodyController::SetTurnSpeed(float speed) { x2fc_turnSpeed = std::max(0.f, speed); }
void CBodyController::Update(float dt, CStateManager& mgr) {
SetPlaybackRate(1.f);
@ -76,7 +78,7 @@ void CBodyController::Update(float dt, CStateManager& mgr) {
}
}
bool CBodyController::HasBodyState(pas::EAnimationState s) const { return GetPASDatabase().HasState(s32(s)); }
bool CBodyController::HasBodyState(pas::EAnimationState state) const { return GetPASDatabase().HasState(s32(state)); }
void CBodyController::SetCurrentAnimation(const CAnimPlaybackParms& parms, bool loop, bool noTrans) {
x0_actor.GetModelData()->GetAnimationData()->SetAnimation(parms, noTrans);
@ -88,14 +90,18 @@ float CBodyController::GetAnimTimeRemaining() const {
return x0_actor.GetModelData()->GetAnimationData()->GetAnimTimeRemaining("Whole Body");
}
void CBodyController::SetPlaybackRate(float r) { x0_actor.GetModelData()->GetAnimationData()->SetPlaybackRate(r); }
void CBodyController::SetPlaybackRate(float rate) {
x0_actor.GetModelData()->GetAnimationData()->SetPlaybackRate(rate);
}
// GX uses a HW approximation of 3/8 + 5/8 instead of 1/3 + 2/3.
const CPASDatabase& CBodyController::GetPASDatabase() const {
return x0_actor.GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase();
}
void CBodyController::MultiplyPlaybackRate(float r) { x0_actor.GetModelData()->GetAnimationData()->MultiplyPlaybackRate(r); }
void CBodyController::MultiplyPlaybackRate(float mul) {
x0_actor.GetModelData()->GetAnimationData()->MultiplyPlaybackRate(mul);
}
void CBodyController::FaceDirection(const zeus::CVector3f& v0, float dt) {
if (x300_26_frozen)
@ -201,8 +207,8 @@ float CBodyController::GetPercentageFrozen() const {
return 1.f - (x310_timeFrozen - (x308_frozenDur + x304_intoFreezeDur)) / x30c_breakoutDur;
}
void CBodyController::SetOnFire(float dur) {
x320_fireDur = dur;
void CBodyController::SetOnFire(float duration) {
x320_fireDur = duration;
x328_timeOnFire = 0.f;
if (IsFrozen())
UnFreeze();
@ -215,12 +221,12 @@ void CBodyController::DouseFlames() {
x328_timeOnFire = 0.f;
}
void CBodyController::SetElectrocuting(float dur) {
void CBodyController::SetElectrocuting(float duration) {
if (!IsElectrocuting()) {
CBCAdditiveReactionCmd reaction(pas::EAdditiveReactionType::Electrocution, 1.f, true);
x4_cmdMgr.DeliverCmd(reaction);
}
x324_electrocutionDur = dur;
x324_electrocutionDur = duration;
x32c_timeElectrocuting = 0.f;
if (IsFrozen())
UnFreeze();

View File

@ -65,39 +65,39 @@ public:
pas::ELocomotionType GetLocomotionType() const { return x2ec_locomotionType; }
CActor& GetOwner() const { return x0_actor; }
bool IsAnimationOver() const { return x300_24_animationOver; }
void EnableAnimation(bool e);
void EnableAnimation(bool enable);
bool ShouldPlayDeathAnims() const { return x300_28_playDeathAnims; }
s32 GetCurrentAnimId() const { return x2f8_curAnim; }
void Activate(CStateManager&);
void Activate(CStateManager& mgr);
CAdditiveBodyState* GetCurrentAdditiveState() { return x2a4_bodyStateInfo.GetCurrentAdditiveState(); }
void SetState(pas::EAnimationState s) { x2a4_bodyStateInfo.SetState(s); }
void Update(float, CStateManager&);
void SetState(pas::EAnimationState state) { x2a4_bodyStateInfo.SetState(state); }
void Update(float dt, CStateManager& mgr);
bool ShouldBeHurled() const { return HasBodyState(pas::EAnimationState::Hurled); }
bool HasBodyState(pas::EAnimationState s) const;
bool HasBodyState(pas::EAnimationState state) const;
pas::EFallState GetFallState() const { return x2f0_fallState; }
void SetFallState(pas::EFallState s) { x2f0_fallState = s; }
void UpdateBody(float, CStateManager&);
void SetAdditiveState(pas::EAnimationState s) { x2a4_bodyStateInfo.SetAdditiveState(s); }
void SetTurnSpeed(float s);
void SetFallState(pas::EFallState state) { x2f0_fallState = state; }
void UpdateBody(float dt, CStateManager& mgr);
void SetAdditiveState(pas::EAnimationState state) { x2a4_bodyStateInfo.SetAdditiveState(state); }
void SetTurnSpeed(float speed);
void SetCurrentAnimation(const CAnimPlaybackParms& parms, bool loop, bool noTrans);
float GetAnimTimeRemaining() const;
void SetPlaybackRate(float);
void MultiplyPlaybackRate(float);
void SetPlaybackRate(float rate);
void MultiplyPlaybackRate(float mul);
void SetDeltaRotation(const zeus::CQuaternion& q) { x2dc_rot *= q; }
void FaceDirection(const zeus::CVector3f&, float);
void FaceDirection3D(const zeus::CVector3f&, const zeus::CVector3f&, float);
void FaceDirection(const zeus::CVector3f& v0, float dt);
void FaceDirection3D(const zeus::CVector3f& v0, const zeus::CVector3f& v1, float dt);
static bool HasBodyInfo(CActor& act);
const CPASDatabase& GetPASDatabase() const;
void PlayBestAnimation(const CPASAnimParmData&, CRandom16&);
void LoopBestAnimation(const CPASAnimParmData&, CRandom16&);
void PlayBestAnimation(const CPASAnimParmData& parms, CRandom16& r);
void LoopBestAnimation(const CPASAnimParmData& parms, CRandom16& r);
void Freeze(float intoFreezeDur, float frozenDur, float breakoutDur);
void UnFreeze();
float GetPercentageFrozen() const;
void SetOnFire(float);
void SetOnFire(float duration);
void DouseFlames();
void SetElectrocuting(float dur);
void SetElectrocuting(float duration);
void DouseElectrocuting();
void UpdateFrozenInfo(float, CStateManager&);
void UpdateFrozenInfo(float dt, CStateManager& mgr);
bool HasIceBreakoutState() const;
void StopElectrocution();
void FrozenBreakout();
@ -105,7 +105,7 @@ public:
EBodyType GetBodyType() const { return x2f4_bodyType; }
bool HasBeenFrozen() const { return x300_27_hasBeenFrozen; }
float GetRestrictedFlyerMoveSpeed() const { return x330_restrictedFlyerMoveSpeed; }
void SetRestrictedFlyerMoveSpeed(float s) { x330_restrictedFlyerMoveSpeed = s; }
void SetRestrictedFlyerMoveSpeed(float speed) { x330_restrictedFlyerMoveSpeed = speed; }
bool GetActive() const { return x300_25_active; }
};
} // namespace urde