CBodyState: Mark reference parameters as const where applicable

Makes the parameters explicit about whether or not they're modified.
This commit is contained in:
Lioncash 2020-04-05 03:10:32 -04:00
parent 9ddb726155
commit 1fb28a03a3
2 changed files with 38 additions and 38 deletions

View File

@ -38,7 +38,7 @@ void CBSAttack::Start(CBodyController& bc, CStateManager& mgr) {
x34_curTime = 0.f; x34_curTime = 0.f;
} }
pas::EAnimationState CBSAttack::GetBodyStateTransition(float dt, CBodyController& bc) { pas::EAnimationState CBSAttack::GetBodyStateTransition(float dt, const CBodyController& bc) {
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) {
return pas::EAnimationState::Hurled; return pas::EAnimationState::Hurled;
} }
@ -79,7 +79,7 @@ pas::EAnimationState CBSAttack::GetBodyStateTransition(float dt, CBodyController
return pas::EAnimationState::Invalid; return pas::EAnimationState::Invalid;
} }
void CBSAttack::UpdatePhysicsActor(CBodyController& bc, float dt) { void CBSAttack::UpdatePhysicsActor(const CBodyController& bc, float dt) {
if (x20_targetPos.isZero()) { if (x20_targetPos.isZero()) {
return; return;
} }
@ -143,7 +143,7 @@ void CBSProjectileAttack::Start(CBodyController& bc, CStateManager& mgr) {
} }
} }
pas::EAnimationState CBSProjectileAttack::GetBodyStateTransition(float dt, CBodyController& bc) { pas::EAnimationState CBSProjectileAttack::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) {
return pas::EAnimationState::Hurled; return pas::EAnimationState::Hurled;
} }
@ -233,7 +233,7 @@ void CBSFall::Start(CBodyController& bc, CStateManager& mgr) {
xc_fallState = pas::EFallState(knockdownState->GetAnimParmData(best.second, 3).GetEnumValue()); xc_fallState = pas::EFallState(knockdownState->GetAnimParmData(best.second, 3).GetEnumValue());
} }
pas::EAnimationState CBSFall::GetBodyStateTransition(float dt, CBodyController& bc) { pas::EAnimationState CBSFall::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (bc.IsAnimationOver()) { if (bc.IsAnimationOver()) {
return pas::EAnimationState::LieOnGround; return pas::EAnimationState::LieOnGround;
} }
@ -269,7 +269,7 @@ void CBSGetup::Start(CBodyController& bc, CStateManager& mgr) {
} }
} }
pas::EAnimationState CBSGetup::GetBodyStateTransition(float dt, CBodyController& bc) const { pas::EAnimationState CBSGetup::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) {
return pas::EAnimationState::Hurled; return pas::EAnimationState::Hurled;
} }
@ -319,7 +319,7 @@ void CBSKnockBack::Start(CBodyController& bc, CStateManager& mgr) {
x4_curTime = 0.f; x4_curTime = 0.f;
} }
pas::EAnimationState CBSKnockBack::GetBodyStateTransition(float dt, CBodyController& bc) const { pas::EAnimationState CBSKnockBack::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) {
return pas::EAnimationState::Hurled; return pas::EAnimationState::Hurled;
} }
@ -367,7 +367,7 @@ void CBSLieOnGround::Start(CBodyController& bc, CStateManager& mgr) {
} }
} }
pas::EAnimationState CBSLieOnGround::GetBodyStateTransition(float dt, CBodyController& bc) const { pas::EAnimationState CBSLieOnGround::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Die)) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Die)) {
return pas::EAnimationState::Death; return pas::EAnimationState::Death;
} }
@ -393,7 +393,7 @@ void CBSStep::Start(CBodyController& bc, CStateManager& mgr) {
bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom());
} }
pas::EAnimationState CBSStep::GetBodyStateTransition(float dt, CBodyController& bc) const { pas::EAnimationState CBSStep::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) {
return pas::EAnimationState::Hurled; return pas::EAnimationState::Hurled;
} }
@ -464,7 +464,7 @@ void CBSTurn::Start(CBodyController& bc, CStateManager& mgr) {
} }
} }
bool CBSTurn::FacingDest(CBodyController& bc) const { bool CBSTurn::FacingDest(const CBodyController& bc) const {
const zeus::CVector3f& lookDir = bc.GetOwner().GetTransform().basis[1]; const zeus::CVector3f& lookDir = bc.GetOwner().GetTransform().basis[1];
const zeus::CVector2f lookDir2d(lookDir.toVec2f()); const zeus::CVector2f lookDir2d(lookDir.toVec2f());
const zeus::CVector2f leftDir(lookDir2d.y(), -lookDir2d.x()); const zeus::CVector2f leftDir(lookDir2d.y(), -lookDir2d.x());
@ -600,7 +600,7 @@ void CBSLoopAttack::Start(CBodyController& bc, CStateManager& mgr) {
} }
} }
pas::EAnimationState CBSLoopAttack::GetBodyStateTransition(float dt, CBodyController& bc) const { pas::EAnimationState CBSLoopAttack::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) {
return pas::EAnimationState::Hurled; return pas::EAnimationState::Hurled;
} }
@ -710,7 +710,7 @@ void CBSLoopReaction::Start(CBodyController& bc, CStateManager& mgr) {
} }
} }
pas::EAnimationState CBSLoopReaction::GetBodyStateTransition(float dt, CBodyController& bc) const { pas::EAnimationState CBSLoopReaction::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) {
return pas::EAnimationState::Hurled; return pas::EAnimationState::Hurled;
} }
@ -833,7 +833,7 @@ void CBSGroundHit::Start(CBodyController& bc, CStateManager& mgr) {
xc_fallState = pas::EFallState(groundHitState->GetAnimParmData(best.second, 3).GetEnumValue()); xc_fallState = pas::EFallState(groundHitState->GetAnimParmData(best.second, 3).GetEnumValue());
} }
pas::EAnimationState CBSGroundHit::GetBodyStateTransition(float dt, CBodyController& bc) const { pas::EAnimationState CBSGroundHit::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (!bc.IsAnimationOver()) { if (!bc.IsAnimationOver()) {
return pas::EAnimationState::Invalid; return pas::EAnimationState::Invalid;
} }
@ -877,7 +877,7 @@ void CBSGenerate::Start(CBodyController& bc, CStateManager& mgr) {
} }
} }
pas::EAnimationState CBSGenerate::GetBodyStateTransition(float dt, CBodyController& bc) const { pas::EAnimationState CBSGenerate::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) {
return pas::EAnimationState::Hurled; return pas::EAnimationState::Hurled;
} }
@ -925,7 +925,7 @@ void CBSJump::Start(CBodyController& bc, CStateManager& mgr) {
} }
} }
pas::EAnimationState CBSJump::GetBodyStateTransition(float dt, CBodyController& bc) const { pas::EAnimationState CBSJump::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) {
return pas::EAnimationState::Hurled; return pas::EAnimationState::Hurled;
} }
@ -1304,7 +1304,7 @@ void CBSSlide::Start(CBodyController& bc, CStateManager& mgr) {
} }
} }
pas::EAnimationState CBSSlide::GetBodyStateTransition(float dt, CBodyController& bc) const { pas::EAnimationState CBSSlide::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) {
return pas::EAnimationState::Hurled; return pas::EAnimationState::Hurled;
} }
@ -1339,7 +1339,7 @@ void CBSTaunt::Start(CBodyController& bc, CStateManager& mgr) {
bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom());
} }
pas::EAnimationState CBSTaunt::GetBodyStateTransition(float dt, CBodyController& bc) const { pas::EAnimationState CBSTaunt::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) {
return pas::EAnimationState::Hurled; return pas::EAnimationState::Hurled;
} }
@ -1378,7 +1378,7 @@ void CBSScripted::Start(CBodyController& bc, CStateManager& mgr) {
bc.SetCurrentAnimation(playParms, cmd->IsLooped(), false); bc.SetCurrentAnimation(playParms, cmd->IsLooped(), false);
} }
pas::EAnimationState CBSScripted::GetBodyStateTransition(float dt, CBodyController& bc) const { pas::EAnimationState CBSScripted::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) {
return pas::EAnimationState::Hurled; return pas::EAnimationState::Hurled;
} }
@ -1437,7 +1437,7 @@ void CBSCover::Start(CBodyController& bc, CStateManager& mgr) {
} }
} }
pas::EAnimationState CBSCover::GetBodyStateTransition(float dt, CBodyController& bc) const { pas::EAnimationState CBSCover::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) {
return pas::EAnimationState::Hurled; return pas::EAnimationState::Hurled;
} }
@ -1511,7 +1511,7 @@ void CBSWallHang::Start(CBodyController& bc, CStateManager& mgr) {
bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom());
} }
pas::EAnimationState CBSWallHang::GetBodyStateTransition(float dt, CBodyController& bc) const { pas::EAnimationState CBSWallHang::GetBodyStateTransition(float dt, const CBodyController& bc) const {
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) {
return pas::EAnimationState::Hurled; return pas::EAnimationState::Hurled;
} }

View File

@ -33,8 +33,8 @@ class CBSAttack : public CBodyState {
float x2c_alignTargetPosStartTime = -1.f; float x2c_alignTargetPosStartTime = -1.f;
float x30_alignTargetPosTime = -1.f; float x30_alignTargetPosTime = -1.f;
float x34_curTime = 0.f; float x34_curTime = 0.f;
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc);
void UpdatePhysicsActor(CBodyController& bc, float dt); void UpdatePhysicsActor(const CBodyController& bc, float dt);
public: public:
bool CanShoot() const override { return false; } bool CanShoot() const override { return false; }
@ -44,7 +44,7 @@ public:
}; };
class CBSProjectileAttack : public CBodyState { class CBSProjectileAttack : public CBodyState {
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
public: public:
bool CanShoot() const override { return true; } bool CanShoot() const override { return true; }
@ -69,7 +69,7 @@ class CBSFall : public CBodyState {
float x4_rotateSpeed = 0.f; float x4_rotateSpeed = 0.f;
float x8_remTime = 0.f; float x8_remTime = 0.f;
pas::EFallState xc_fallState = pas::EFallState::Invalid; pas::EFallState xc_fallState = pas::EFallState::Invalid;
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
public: public:
void Start(CBodyController& bc, CStateManager& mgr) override; void Start(CBodyController& bc, CStateManager& mgr) override;
@ -79,7 +79,7 @@ public:
class CBSGetup : public CBodyState { class CBSGetup : public CBodyState {
pas::EFallState x4_fallState = pas::EFallState::Invalid; pas::EFallState x4_fallState = pas::EFallState::Invalid;
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
public: public:
void Start(CBodyController& bc, CStateManager& mgr) override; void Start(CBodyController& bc, CStateManager& mgr) override;
@ -91,7 +91,7 @@ class CBSKnockBack : public CBodyState {
float x4_curTime = 0.f; float x4_curTime = 0.f;
float x8_rotateSpeed = 0.f; float x8_rotateSpeed = 0.f;
float xc_remTime = 0.f; float xc_remTime = 0.f;
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
public: public:
bool IsMoving() const override { return true; } bool IsMoving() const override { return true; }
@ -102,7 +102,7 @@ public:
class CBSLieOnGround : public CBodyState { class CBSLieOnGround : public CBodyState {
bool x4_24_hasGroundHit : 1; bool x4_24_hasGroundHit : 1;
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
public: public:
explicit CBSLieOnGround(CActor& actor); explicit CBSLieOnGround(CActor& actor);
@ -112,7 +112,7 @@ public:
}; };
class CBSStep : public CBodyState { class CBSStep : public CBodyState {
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
public: public:
bool IsMoving() const override { return true; } bool IsMoving() const override { return true; }
@ -127,7 +127,7 @@ protected:
float x4_rotateSpeed = 0.f; float x4_rotateSpeed = 0.f;
zeus::CVector2f x8_dest; zeus::CVector2f x8_dest;
pas::ETurnDirection x10_turnDir = pas::ETurnDirection::Invalid; pas::ETurnDirection x10_turnDir = pas::ETurnDirection::Invalid;
bool FacingDest(CBodyController& bc) const; bool FacingDest(const CBodyController& bc) const;
public: public:
bool CanShoot() const override { return true; } bool CanShoot() const override { return true; }
@ -148,7 +148,7 @@ class CBSLoopAttack : public CBodyState {
pas::ELoopAttackType x8_loopAttackType = pas::ELoopAttackType::Invalid; pas::ELoopAttackType x8_loopAttackType = pas::ELoopAttackType::Invalid;
bool xc_24_waitForAnimOver : 1; bool xc_24_waitForAnimOver : 1;
bool xc_25_advance : 1; bool xc_25_advance : 1;
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
public: public:
CBSLoopAttack() { CBSLoopAttack() {
@ -165,7 +165,7 @@ class CBSLoopReaction : public CBodyState {
pas::ELoopState x4_state = pas::ELoopState::Invalid; pas::ELoopState x4_state = pas::ELoopState::Invalid;
pas::EReactionType x8_reactionType = pas::EReactionType::Invalid; pas::EReactionType x8_reactionType = pas::EReactionType::Invalid;
bool xc_24_loopHit : 1; bool xc_24_loopHit : 1;
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
bool PlayExitAnimation(CBodyController& bc, CStateManager& mgr) const; bool PlayExitAnimation(CBodyController& bc, CStateManager& mgr) const;
public: public:
@ -179,7 +179,7 @@ class CBSGroundHit : public CBodyState {
float x4_rotateSpeed = 0.f; float x4_rotateSpeed = 0.f;
float x8_remTime = 0.f; float x8_remTime = 0.f;
pas::EFallState xc_fallState = pas::EFallState::Invalid; pas::EFallState xc_fallState = pas::EFallState::Invalid;
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
public: public:
void Start(CBodyController& bc, CStateManager& mgr) override; void Start(CBodyController& bc, CStateManager& mgr) override;
@ -188,7 +188,7 @@ public:
}; };
class CBSGenerate : public CBodyState { class CBSGenerate : public CBodyState {
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
public: public:
void Start(CBodyController& bc, CStateManager& mgr) override; void Start(CBodyController& bc, CStateManager& mgr) override;
@ -212,7 +212,7 @@ class CBSJump : public CBodyState {
}; };
u32 _dummy = 0; u32 _dummy = 0;
}; };
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
bool CheckForWallJump(CBodyController& bc, CStateManager& mgr); bool CheckForWallJump(CBodyController& bc, CStateManager& mgr);
void CheckForLand(CBodyController& bc, CStateManager& mgr); void CheckForLand(CBodyController& bc, CStateManager& mgr);
void PlayJumpLoop(CStateManager& mgr, CBodyController& bc); void PlayJumpLoop(CStateManager& mgr, CBodyController& bc);
@ -257,7 +257,7 @@ public:
class CBSSlide : public CBodyState { class CBSSlide : public CBodyState {
float x4_rotateSpeed = 0.f; float x4_rotateSpeed = 0.f;
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
public: public:
bool ApplyHeadTracking() const override { return false; } bool ApplyHeadTracking() const override { return false; }
@ -268,7 +268,7 @@ public:
}; };
class CBSTaunt : public CBodyState { class CBSTaunt : public CBodyState {
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
public: public:
void Start(CBodyController& bc, CStateManager& mgr) override; void Start(CBodyController& bc, CStateManager& mgr) override;
@ -285,7 +285,7 @@ class CBSScripted : public CBodyState {
u32 _dummy = 0; u32 _dummy = 0;
}; };
float x8_remTime = 0.f; float x8_remTime = 0.f;
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
public: public:
bool ApplyHeadTracking() const override { return false; } bool ApplyHeadTracking() const override { return false; }
@ -298,7 +298,7 @@ class CBSCover : public CBodyState {
pas::ECoverState x4_state = pas::ECoverState::Invalid; pas::ECoverState x4_state = pas::ECoverState::Invalid;
pas::ECoverDirection x8_coverDirection = pas::ECoverDirection::Invalid; pas::ECoverDirection x8_coverDirection = pas::ECoverDirection::Invalid;
bool xc_needsExit = false; bool xc_needsExit = false;
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
public: public:
bool ApplyHeadTracking() const override { return false; } bool ApplyHeadTracking() const override { return false; }
@ -320,7 +320,7 @@ class CBSWallHang : public CBodyState {
}; };
u32 _dummy = 0; u32 _dummy = 0;
}; };
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
void FixInPlace(CBodyController& bc); void FixInPlace(CBodyController& bc);
bool CheckForLand(CBodyController& bc, CStateManager& mgr); bool CheckForLand(CBodyController& bc, CStateManager& mgr);
bool CheckForWall(CBodyController& bc, CStateManager& mgr); bool CheckForWall(CBodyController& bc, CStateManager& mgr);