mirror of https://github.com/AxioDL/metaforce.git
[MetroidPrimeExo] More implementations, and minor bug fix
This commit is contained in:
parent
22d0343a5f
commit
01ee9a83b4
|
@ -124,25 +124,7 @@ std::array<std::array<s32, 3>, 14> skSomeMeleeValues{{
|
|||
{{0, 0, 0}},
|
||||
}};
|
||||
|
||||
std::array<s32, 17> skSomeValues1{{
|
||||
7,
|
||||
5,
|
||||
18,
|
||||
18,
|
||||
18,
|
||||
18,
|
||||
18,
|
||||
18,
|
||||
18,
|
||||
7,
|
||||
5,
|
||||
7,
|
||||
17,
|
||||
18,
|
||||
9,
|
||||
2,
|
||||
11,
|
||||
}};
|
||||
std::array<s32, 17> skSomeValues1{{7, 5, 18, 18, 18, 18, 18, 18, 18, 7, 5, 7, 17, 18, 9, 2, 11}};
|
||||
|
||||
std::array<std::array<pas::ELocomotionType, 3>, 14> skSomeValues2{{
|
||||
{{pas::ELocomotionType::Invalid, pas::ELocomotionType::Invalid, pas::ELocomotionType::Invalid}},
|
||||
|
@ -344,13 +326,13 @@ void CMetroidPrimeExo::Think(float dt, CStateManager& mgr) {
|
|||
UpdateColorChange(dt, mgr);
|
||||
UpdateHeadAnimation(dt);
|
||||
UpdatePlasmaProjectile(dt, mgr);
|
||||
sub80274e6c(dt, mgr);
|
||||
UpdateParticles(dt, mgr);
|
||||
UpdateEnergyBalls(dt, mgr);
|
||||
UpdatePhysicsDummy(mgr);
|
||||
UpdateContactDamage(mgr);
|
||||
UpdateTimers(dt);
|
||||
UpdateSfxEmitter(dt, mgr);
|
||||
sub80275e54(dt, mgr);
|
||||
UpdateElectricEffect(dt, mgr);
|
||||
}
|
||||
|
||||
void CMetroidPrimeExo::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId other, CStateManager& mgr) {
|
||||
|
@ -452,7 +434,9 @@ bool CMetroidPrimeExo::CanRenderUnsorted(const CStateManager& mgr) const {
|
|||
return mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::XRay;
|
||||
}
|
||||
|
||||
void CMetroidPrimeExo::Touch(CActor& act, CStateManager& mgr) { CPatterned::Touch(act, mgr); }
|
||||
void CMetroidPrimeExo::Touch(CActor& act, CStateManager& mgr) {
|
||||
// Empty
|
||||
}
|
||||
|
||||
void CMetroidPrimeExo::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) {
|
||||
if (type == EUserEventType::ScreenShake) {
|
||||
|
@ -560,6 +544,8 @@ void CMetroidPrimeExo::TurnAround(CStateManager& mgr, EStateMsg msg, float arg)
|
|||
x32c_animState = EAnimState::Ready;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::Step, &CPatterned::TryStep, 3);
|
||||
x450_bodyController->SetLocomotionType(skLocomotions[x1078_]);
|
||||
x1078_ = 1;
|
||||
zeus::CVector3f vec = sub8027464c(mgr);
|
||||
if ((vec - GetTranslation()).normalized().dot(mgr.GetPlayer().GetTranslation() - GetTranslation()) < 15.f) {
|
||||
sub802747b8(arg, mgr, vec);
|
||||
|
@ -936,7 +922,24 @@ u32 CMetroidPrimeExo::CountEnergyBalls(CStateManager& mgr) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void CMetroidPrimeExo::sub80273d38(CStateManager& mgr) {}
|
||||
void CMetroidPrimeExo::DeactivatePatrolObjects(CStateManager& mgr) {
|
||||
const TCastToConstPtr<CMetroidPrimeRelay> relay = mgr.GetObjectById(x568_relayId);
|
||||
x1058_.clear();
|
||||
if (relay) {
|
||||
for(const auto& conn : relay->GetConnectionList()) {
|
||||
if (conn.x0_state != EScriptObjectState::Patrol) {
|
||||
continue;
|
||||
}
|
||||
if (auto* ent = mgr.ObjectById(mgr.GetIdForScript(conn.x8_objId))) {
|
||||
ent->AcceptScriptMsg(EScriptObjectMessage::Deactivate, GetUniqueId(), mgr);
|
||||
x1058_.push_back(conn.x8_objId);
|
||||
if (x1058_.size() >= 4) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMetroidPrimeExo::UpdatePhysicsDummy(CStateManager& mgr) {
|
||||
if (TCastToPtr<CPhysicsActor> physAct = mgr.ObjectById(xeac_)) {
|
||||
|
@ -1015,9 +1018,61 @@ void CMetroidPrimeExo::sub802747b8(float f1, CStateManager& mgr, const zeus::CVe
|
|||
}
|
||||
|
||||
void CMetroidPrimeExo::sub802749e8(float f1, float f2, float f3, const zeus::CVector3f& vec1,
|
||||
const zeus::CVector3f& vec2) {}
|
||||
const zeus::CVector3f& vec2, s32 idx) {
|
||||
auto diffVec = vec2 - vec1;
|
||||
const float dist = diffVec.magnitude();
|
||||
const auto& elemGen = xfec_[idx];
|
||||
const auto& swooshGen = x1000_[idx];
|
||||
|
||||
void CMetroidPrimeExo::sub80274e6c(float f1, CStateManager& mgr) {
|
||||
if (!zeus::close_enough(diffVec, zeus::skZero3f)) {
|
||||
zeus::CVector3f v1 = vec1;
|
||||
auto lookAtXf = zeus::lookAt(zeus::skZero3f, diffVec);
|
||||
elemGen->SetParticleEmission(true);
|
||||
s32 count = static_cast<s32>(2.f * dist + 1.f);
|
||||
for (s32 i = 0; i < count; ++i) {
|
||||
float dVar14 = i * static_cast<int>(1.f / static_cast<float>(count));
|
||||
float dVar11 = f1 * (dVar14 * std::cos(static_cast<float>(i) + f3));
|
||||
float fVar15 = static_cast<float>(std::sin(i));
|
||||
const auto v = (i < 1) ? zeus::skZero3f : lookAtXf * zeus::CVector3f{dVar11, 0.f, f2 * (dVar14 * fVar15)};
|
||||
elemGen->SetTranslation(v1 + v);
|
||||
elemGen->ForceParticleCreation(1);
|
||||
v1 += v1 + diffVec;
|
||||
}
|
||||
|
||||
elemGen->SetParticleEmission(false);
|
||||
|
||||
auto& swooshes = swooshGen->GetSwooshes();
|
||||
count = swooshes.size() - 1;
|
||||
v1 = vec1;
|
||||
float fVar14 = vec1.x();
|
||||
float fVar1 = vec1.y();
|
||||
float fVar2 = vec1.z();
|
||||
float fVar3 = swooshes[count].x30_irot;
|
||||
float dVar12 = 1.f / static_cast<float>(count);
|
||||
diffVec = diffVec * dVar12;
|
||||
for (s32 i = 0; i <= count; ++i) {
|
||||
float vec1Z = fVar3;
|
||||
float dVar13 = fVar2;
|
||||
float vec1X = fVar1;
|
||||
float vec1Y = fVar14;
|
||||
float dVar9 = static_cast<float>(i) * dVar12;
|
||||
fVar14 = std::cos(static_cast<float>(i) + f3);
|
||||
float dVar11 = f1 * (dVar9 * fVar14);
|
||||
fVar14 = std::sin(i);
|
||||
const auto v = (i < 1) ? zeus::skZero3f : lookAtXf * zeus::CVector3f{dVar11, 0.f, f2 * (dVar9 * fVar14)};
|
||||
|
||||
swooshes[i].xc_translation = {vec1Y + v.x(), vec1X + fVar14, dVar13 + fVar1};
|
||||
swooshes[i].x38_orientation = lookAtXf;
|
||||
fVar3 = swooshes[i].x30_irot;
|
||||
fVar14 = vec1Y + diffVec.x();
|
||||
fVar1 = vec1X + diffVec.y();
|
||||
swooshes[i].x30_irot = vec1Z;
|
||||
fVar2 = dVar13 + diffVec.z();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMetroidPrimeExo::UpdateParticles(float f1, CStateManager& mgr) {
|
||||
if (GetBodyController()->GetPercentageFrozen() > 0.f && x1054_24_) {
|
||||
sub802755ac(mgr, false);
|
||||
x1054_25_ = true;
|
||||
|
@ -1040,7 +1095,7 @@ void CMetroidPrimeExo::sub80274e6c(float f1, CStateManager& mgr) {
|
|||
float dVar12 = 1.f - dVar13;
|
||||
float tmp = zeus::clamp(0.f, 0.5f + (x102c_[i] / 0.3f), 1.f);
|
||||
zeus::CVector3f local_154 = off * dVar12 + (xf.origin * dVar13);
|
||||
sub802749e8(2.f * tmp, 0.5f * tmp, x1038_[i], xf.origin, local_154);
|
||||
sub802749e8(2.f * tmp, 0.5f * tmp, x1038_[i], xf.origin, local_154, i);
|
||||
if (tmp <= 0.f) {
|
||||
if (mgr.RayCollideWorld(xf.origin, local_154,
|
||||
CMaterialFilter::MakeIncludeExclude(
|
||||
|
@ -1055,7 +1110,7 @@ void CMetroidPrimeExo::sub80274e6c(float f1, CStateManager& mgr) {
|
|||
} else if (CParticleSwoosh::GetAliveParticleSystemCount() != 0) {
|
||||
float tmp1 = zeus::clamp(0.f, 3.f * (x102c_[i] / 0.3f) - 2.f, 1.f);
|
||||
float tmp2 = zeus::clamp(0.f, 0.5f + (x102c_[i] / 0.3f), 1.f);
|
||||
sub802749e8(tmp2, tmp2, x1038_[i], xf.origin, xf.origin * (1.f - tmp1) + (off * tmp1));
|
||||
sub802749e8(tmp2, tmp2, x1038_[i], xf.origin, xf.origin * (1.f - tmp1) + (off * tmp1), i);
|
||||
x1000_[i]->Update(f1);
|
||||
}
|
||||
xfec_[i]->Update(f1);
|
||||
|
@ -1261,7 +1316,7 @@ pas::ELocomotionType CMetroidPrimeExo::sub80275e14(int w1) { return skSomeValues
|
|||
|
||||
u32 CMetroidPrimeExo::sub80275e34(int w1) const { return skSomeMeleeValues[w1][x1078_]; }
|
||||
|
||||
void CMetroidPrimeExo::sub80275e54(float dt, CStateManager& mgr) {
|
||||
void CMetroidPrimeExo::UpdateElectricEffect(float dt, CStateManager& mgr) {
|
||||
if (!xfac_) {
|
||||
return;
|
||||
}
|
||||
|
@ -1484,7 +1539,7 @@ void CMetroidPrimeExo::UpdateRelay(CStateManager& mgr, TAreaId areaId) {
|
|||
}
|
||||
|
||||
sub80276754(mgr);
|
||||
sub80273d38(mgr);
|
||||
DeactivatePatrolObjects(mgr);
|
||||
}
|
||||
|
||||
bool CMetroidPrimeExo::IsRelayValid(CStateManager& mgr, TAreaId aid) {
|
||||
|
|
|
@ -182,6 +182,7 @@ class CMetroidPrimeExo : public CPatterned {
|
|||
bool x1054_25_ : 1 = false;
|
||||
bool x1054_26_ : 1 = false;
|
||||
bool x1054_27_ : 1 = false;
|
||||
rstl::reserved_vector<TEditorId, 4> x1058_;
|
||||
rstl::reserved_vector<TUniqueId, 2> x106c_energyBallIds;
|
||||
float x1074_ = 0.f;
|
||||
s32 x1078_ = -1;
|
||||
|
@ -203,7 +204,7 @@ class CMetroidPrimeExo : public CPatterned {
|
|||
void sub802738d4(CStateManager& mgr);
|
||||
void UpdateEnergyBalls(float dt, CStateManager& mgr);
|
||||
u32 CountEnergyBalls(CStateManager& mgr);
|
||||
void sub80273d38(CStateManager& mgr);
|
||||
void DeactivatePatrolObjects(CStateManager& mgr);
|
||||
void UpdatePhysicsDummy(CStateManager& mgr);
|
||||
void sub80274054(CStateManager& mgr);
|
||||
void sub802740cc(CStateManager& mgr);
|
||||
|
@ -213,8 +214,8 @@ class CMetroidPrimeExo : public CPatterned {
|
|||
zeus::CVector3f sub8027464c(CStateManager& mgr);
|
||||
void CreateHUDBillBoard(CStateManager& mgr);
|
||||
void sub802747b8(float f1, CStateManager& mgr, const zeus::CVector3f& vec);
|
||||
void sub802749e8(float f1, float f2, float f3, const zeus::CVector3f& vec1, const zeus::CVector3f& vec2);
|
||||
void sub80274e6c(float f1, CStateManager& mgr);
|
||||
void sub802749e8(float f1, float f2, float f3, const zeus::CVector3f& vec1, const zeus::CVector3f& vec2, s32 idx);
|
||||
void UpdateParticles(float f1, CStateManager& mgr);
|
||||
void sub802755ac(CStateManager& mgr, bool b1);
|
||||
void EnableHeadOrbitAndTarget(CStateManager& mgr);
|
||||
void DisableHeadOrbitAndTarget(CStateManager& mgr);
|
||||
|
@ -227,7 +228,7 @@ class CMetroidPrimeExo : public CPatterned {
|
|||
bool sub80275d68(int w1);
|
||||
pas::ELocomotionType sub80275e14(int w1);
|
||||
u32 sub80275e34(int w1) const;
|
||||
void sub80275e54(float f1, CStateManager& mgr);
|
||||
void UpdateElectricEffect(float dt, CStateManager& mgr);
|
||||
void UpdateSfxEmitter(float f1, CStateManager& mgr);
|
||||
void sub80276204(CStateManager& mgr, bool b1);
|
||||
void sub8027639c(CStateManager& mgr, bool b1);
|
||||
|
|
Loading…
Reference in New Issue