mirror of https://github.com/AxioDL/metaforce.git
CFlaahgra: CalculateFallDirection fixes & renaming
This commit is contained in:
parent
31e2bd6e24
commit
161a287ae3
|
@ -587,20 +587,23 @@ void CFlaahgra::sub801ae980(CStateManager& mgr) {
|
||||||
++x788_;
|
++x788_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlaahgra::sub801ade80() {
|
void CFlaahgra::CalculateFallDirection() {
|
||||||
x894_ = (x7ac_ == 0 ? -GetTransform().basis[0] : GetTransform().basis[0]);
|
const auto front = GetTransform().frontVector();
|
||||||
|
const auto right = x7ac_ ? GetTransform().rightVector() : -GetTransform().rightVector();
|
||||||
|
x894_fallDirection = right;
|
||||||
|
|
||||||
const rstl::reserved_vector<zeus::CVector3f, 4>& vec = (x7ac_ == 0 ? x860_ : x82c_);
|
const rstl::reserved_vector<zeus::CVector3f, 4>& vec = x7ac_ ? x82c_ : x860_;
|
||||||
|
|
||||||
float curDist = FLT_MIN;
|
float curDist = FLT_MIN;
|
||||||
for (const zeus::CVector3f& v : vec) {
|
for (const zeus::CVector3f& v : vec) {
|
||||||
if (v.magSquared() < 0.f)
|
if (right.dot(v) <= 0.f) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
float dist = GetTransform().basis[1].dot(v);
|
float dist = front.dot(v);
|
||||||
if (dist > curDist) {
|
if (curDist < dist) {
|
||||||
|
x894_fallDirection = v;
|
||||||
curDist = dist;
|
curDist = dist;
|
||||||
x894_ = v;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -938,7 +941,7 @@ void CFlaahgra::Faint(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||||
if (x568_ == 0) {
|
if (x568_ == 0) {
|
||||||
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Fall) {
|
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Fall) {
|
||||||
x568_ = 2;
|
x568_ = 2;
|
||||||
sub801ade80();
|
CalculateFallDirection();
|
||||||
UpdateHeadDamageVulnerability(mgr, true);
|
UpdateHeadDamageVulnerability(mgr, true);
|
||||||
} else {
|
} else {
|
||||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||||
|
@ -950,7 +953,7 @@ void CFlaahgra::Faint(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||||
if (x7d4_ >= x56c_.xc_)
|
if (x7d4_ >= x56c_.xc_)
|
||||||
x568_ = 4;
|
x568_ = 4;
|
||||||
} else {
|
} else {
|
||||||
x450_bodyController->FaceDirection(x894_, arg);
|
x450_bodyController->FaceDirection(x894_fallDirection, arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (msg == EStateMsg::Deactivate) {
|
} else if (msg == EStateMsg::Deactivate) {
|
||||||
|
|
|
@ -130,7 +130,7 @@ class CFlaahgra : public CPatterned {
|
||||||
zeus::CVector3f x820_;
|
zeus::CVector3f x820_;
|
||||||
rstl::reserved_vector<zeus::CVector3f, 4> x82c_;
|
rstl::reserved_vector<zeus::CVector3f, 4> x82c_;
|
||||||
rstl::reserved_vector<zeus::CVector3f, 4> x860_;
|
rstl::reserved_vector<zeus::CVector3f, 4> x860_;
|
||||||
zeus::CVector3f x894_;
|
zeus::CVector3f x894_fallDirection;
|
||||||
zeus::CVector3f x8a0_;
|
zeus::CVector3f x8a0_;
|
||||||
CAnimRes x8ac_;
|
CAnimRes x8ac_;
|
||||||
std::optional<TToken<CDependencyGroup>> x8c8_depGroup;
|
std::optional<TToken<CDependencyGroup>> x8c8_depGroup;
|
||||||
|
@ -178,7 +178,7 @@ class CFlaahgra : public CPatterned {
|
||||||
zeus::CVector3f GetAttackTargetPos(const CStateManager& mgr) const;
|
zeus::CVector3f GetAttackTargetPos(const CStateManager& mgr) const;
|
||||||
void RattlePlayer(CStateManager& mgr, const zeus::CVector3f& vec);
|
void RattlePlayer(CStateManager& mgr, const zeus::CVector3f& vec);
|
||||||
bool sub801e4f8() const { return x7a8_ == 0 || x7a8_ == 1; }
|
bool sub801e4f8() const { return x7a8_ == 0 || x7a8_ == 1; }
|
||||||
void sub801ade80();
|
void CalculateFallDirection();
|
||||||
void UpdateHeadDamageVulnerability(CStateManager&, bool);
|
void UpdateHeadDamageVulnerability(CStateManager&, bool);
|
||||||
|
|
||||||
u32 sub801ae828(const CStateManager&) const;
|
u32 sub801ae828(const CStateManager&) const;
|
||||||
|
|
Loading…
Reference in New Issue