CMetroid: Add EGammaType

This commit is contained in:
Luke Street 2020-05-08 05:22:12 -04:00
parent ac30616efb
commit 78b364a445
2 changed files with 24 additions and 17 deletions

View File

@ -9,35 +9,35 @@
namespace urde::MP1 { namespace urde::MP1 {
namespace { namespace {
constexpr CDamageVulnerability CDamageVulnerability_80571c64{ constexpr CDamageVulnerability skGammaRedDamageVulnerability{
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Immune, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Immune,
EVulnerability::Deflect, EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::None, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::None,
}; };
constexpr CDamageVulnerability CDamageVulnerability_80571e6c{ constexpr CDamageVulnerability skGammaWhiteDamageVulnerability{
EVulnerability::Deflect, EVulnerability::Immune, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Immune, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::None, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::None,
}; };
constexpr CDamageVulnerability CDamageVulnerability_80571ed4{ constexpr CDamageVulnerability skGammaPurpleDamageVulnerability{
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Immune, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Immune, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::None, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::None,
}; };
constexpr CDamageVulnerability CDamageVulnerability_80571f3c{ constexpr CDamageVulnerability skGammaOrangeDamageVulnerability{
EVulnerability::Immune, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Immune, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::None, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EDeflectType::None,
}; };
constexpr CDamageVulnerability CDamageVulnerability_80571fa4{ constexpr CDamageVulnerability skNormalDamageVulnerability{
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Normal, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
@ -69,7 +69,7 @@ CMetroid::CMetroid(TUniqueId uid, std::string_view name, EFlavorType flavor, con
, x56c_data(metroidData) , x56c_data(metroidData)
, x6a0_collisionPrimitive(zeus::CSphere{zeus::skZero3f, 0.9f * GetModelData()->GetScale().y()}, GetMaterialList()) , x6a0_collisionPrimitive(zeus::CSphere{zeus::skZero3f, 0.9f * GetModelData()->GetScale().y()}, GetMaterialList())
, x6c0_pathFindSearch(nullptr, 3, pInfo.GetPathfindingIndex(), 1.f, 1.f) , x6c0_pathFindSearch(nullptr, 3, pInfo.GetPathfindingIndex(), 1.f, 1.f)
, x7cc_animParmsidx(flavor == EFlavorType::Two ? 0 : 1) , x7cc_gammaType(flavor == EFlavorType::Two ? EGammaType::Red : EGammaType::Normal)
, x7d0_scale1(GetModelData()->GetScale()) , x7d0_scale1(GetModelData()->GetScale())
, x7dc_scale2(GetModelData()->GetScale()) , x7dc_scale2(GetModelData()->GetScale())
, x7e8_scale3(GetModelData()->GetScale()) , x7e8_scale3(GetModelData()->GetScale())
@ -161,7 +161,7 @@ const CDamageVulnerability* CMetroid::GetDamageVulnerability() const {
if (x9c0_24_) { if (x9c0_24_) {
return &x56c_data.GetEnergyDrainVulnerability(); return &x56c_data.GetEnergyDrainVulnerability();
} }
return &CDamageVulnerability_80571fa4; return &skNormalDamageVulnerability;
} }
if (x9bf_25_ && !x450_bodyController->IsFrozen()) { if (x9bf_25_ && !x450_bodyController->IsFrozen()) {
return &x56c_data.GetEnergyDrainVulnerability(); return &x56c_data.GetEnergyDrainVulnerability();
@ -170,17 +170,17 @@ const CDamageVulnerability* CMetroid::GetDamageVulnerability() const {
return &x56c_data.GetFrozenVulnerability(); return &x56c_data.GetFrozenVulnerability();
} }
if (x3fc_flavor == CPatterned::EFlavorType::Two) { if (x3fc_flavor == CPatterned::EFlavorType::Two) {
if (x7cc_animParmsidx == 1) { if (x7cc_gammaType == EGammaType::Red) {
return &CDamageVulnerability_80571c64; return &skGammaRedDamageVulnerability;
} }
if (x7cc_animParmsidx == 2) { if (x7cc_gammaType == EGammaType::White) {
return &CDamageVulnerability_80571e6c; return &skGammaWhiteDamageVulnerability;
} }
if (x7cc_animParmsidx == 3) { if (x7cc_gammaType == EGammaType::Purple) {
return &CDamageVulnerability_80571ed4; return &skGammaPurpleDamageVulnerability;
} }
if (x7cc_animParmsidx == 4) { if (x7cc_gammaType == EGammaType::Orange) {
return &CDamageVulnerability_80571f3c; return &skGammaOrangeDamageVulnerability;
} }
} }
return CAi::GetDamageVulnerability(); return CAi::GetDamageVulnerability();

View File

@ -64,7 +64,14 @@ private:
Two, Two,
Three, Three,
} x7c8_ = EUnknown::Zero; } x7c8_ = EUnknown::Zero;
int x7cc_animParmsidx; enum class EGammaType {
Invalid = -1,
Normal,
Red,
White,
Purple,
Orange,
} x7cc_gammaType;
zeus::CVector3f x7d0_scale1; zeus::CVector3f x7d0_scale1;
zeus::CVector3f x7dc_scale2; zeus::CVector3f x7dc_scale2;
zeus::CVector3f x7e8_scale3; zeus::CVector3f x7e8_scale3;
@ -163,7 +170,7 @@ private:
bool IsHunterAttacking(CStateManager& mgr); bool IsHunterAttacking(CStateManager& mgr);
bool IsAttackInProgress(CStateManager& mgr); bool IsAttackInProgress(CStateManager& mgr);
void ComputeSuckPiratePosRot(CStateManager& mgr, zeus::CVector3f& outVec, zeus::CQuaternion& outQuat); void ComputeSuckPiratePosRot(CStateManager& mgr, zeus::CVector3f& outVec, zeus::CQuaternion& outQuat);
int GetRandomAnimParmsIdx(CStateManager& mgr, int prevIdx); EGammaType GetRandomGammaType(CStateManager& mgr, EGammaType previous);
void SpawnGammaMetroid(CStateManager& mgr); void SpawnGammaMetroid(CStateManager& mgr);
bool ShouldSpawnGammaMetroid(); bool ShouldSpawnGammaMetroid();
void ComputeSuckPlayerPosRot(CStateManager& mgr, zeus::CVector3f& outVec, zeus::CQuaternion& outQuat); void ComputeSuckPlayerPosRot(CStateManager& mgr, zeus::CVector3f& outVec, zeus::CQuaternion& outQuat);