mirror of https://github.com/AxioDL/metaforce.git
CBodyState: Eliminate usages of const_cast
This is clearly modifying the command, so we should allow for modifying of command instances if necessary.
This commit is contained in:
parent
1fb28a03a3
commit
71e3fb1817
|
@ -1120,12 +1120,14 @@ pas::EAnimationState CBSHurled::GetBodyStateTransition(float dt, CBodyController
|
|||
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::NextState)) {
|
||||
return pas::EAnimationState::LieOnGround;
|
||||
}
|
||||
|
||||
if (x18_curTime > 0.25f) {
|
||||
if (const auto* cmd = static_cast<const CBCHurledCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled))) {
|
||||
const_cast<CBCHurledCmd*>(cmd)->SetSkipLaunchState(true);
|
||||
if (auto* cmd = static_cast<CBCHurledCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled))) {
|
||||
cmd->SetSkipLaunchState(true);
|
||||
return pas::EAnimationState::Hurled;
|
||||
}
|
||||
}
|
||||
|
||||
return pas::EAnimationState::Invalid;
|
||||
}
|
||||
|
||||
|
|
|
@ -452,11 +452,20 @@ public:
|
|||
void BlendSteeringCmds();
|
||||
void Reset();
|
||||
void ClearLocomotionCmds();
|
||||
const CBodyStateCmd* GetCmd(EBodyStateCmd cmd) const {
|
||||
if (xb4_deliveredCmdMask & (1 << int(cmd)))
|
||||
return x40_commandTable[int(cmd)];
|
||||
|
||||
CBodyStateCmd* GetCmd(EBodyStateCmd cmd) {
|
||||
if ((xb4_deliveredCmdMask & (1U << u32(cmd))) != 0) {
|
||||
return x40_commandTable[size_t(cmd)];
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
const CBodyStateCmd* GetCmd(EBodyStateCmd cmd) const {
|
||||
if ((xb4_deliveredCmdMask & (1U << u32(cmd))) != 0) {
|
||||
return x40_commandTable[size_t(cmd)];
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const zeus::CVector3f& GetMoveVector() const { return x0_move; }
|
||||
const zeus::CVector3f& GetFaceVector() const { return xc_face; }
|
||||
const zeus::CVector3f& GetTargetVector() const { return x18_target; }
|
||||
|
|
Loading…
Reference in New Issue