mirror of https://github.com/AxioDL/metaforce.git
Runtime: Correct TCastTo<CAi> to TCastTo<CPatterned>
This commit is contained in:
parent
9d5db8ea16
commit
148e9e4bd8
|
@ -1470,7 +1470,7 @@ void CStateManager::InitScriptObjects(const std::vector<TEditorId>& ids) {
|
|||
|
||||
void CStateManager::InformListeners(const zeus::CVector3f& pos, EListenNoiseType type) {
|
||||
for (CEntity* ent : GetListeningAiObjectList()) {
|
||||
if (const TCastToPtr<CAi> ai = ent) {
|
||||
if (const TCastToPtr<CPatterned> ai = ent) {
|
||||
if (!ai->GetActive()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1506,7 +1506,7 @@ void CStateManager::ApplyKnockBack(CActor& actor, const CDamageInfo& info, const
|
|||
return;
|
||||
}
|
||||
|
||||
const TCastToPtr<CAi> ai = actor;
|
||||
const TCastToPtr<CPatterned> ai = actor;
|
||||
if (!ai && hInfo->GetHP() <= 0.f) {
|
||||
if (dampedPower > hInfo->GetKnockbackResistance()) {
|
||||
if (const TCastToPtr<CPhysicsActor> physActor = actor) {
|
||||
|
@ -2219,7 +2219,7 @@ void CStateManager::MoveActors(float dt) {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (const TCastToPtr<CAi> ai = physActor) {
|
||||
if (const TCastToPtr<CPatterned> ai = physActor) {
|
||||
bool doThink = !xf94_29_cinematicPause;
|
||||
if (doThink && ai->GetAreaIdAlways() != kInvalidAreaId) {
|
||||
const CGameArea* area = x850_world->GetAreaAlways(ai->GetAreaIdAlways());
|
||||
|
@ -2311,7 +2311,7 @@ void CStateManager::Think(float dt) {
|
|||
}
|
||||
} else {
|
||||
for (CEntity* ent : GetAllObjectList()) {
|
||||
if (const TCastToPtr<CAi> ai = ent) {
|
||||
if (const TCastToPtr<CPatterned> ai = ent) {
|
||||
bool doThink = !xf94_29_cinematicPause;
|
||||
if (doThink && ai->GetAreaIdAlways() != kInvalidAreaId) {
|
||||
const CGameArea* area = x850_world->GetAreaAlways(ai->GetAreaIdAlways());
|
||||
|
|
|
@ -77,7 +77,7 @@ void CCameraManager::EnterCinematic(CStateManager& mgr) {
|
|||
} else if (const TCastToConstPtr<CWeapon> weap = ent) {
|
||||
if (weap->GetActive()) {
|
||||
if (False(weap->GetAttribField() & EProjectileAttrib::KeepInCinematic)) {
|
||||
if (TCastToConstPtr<CAi>(mgr.GetObjectById(weap->GetOwnerId())) ||
|
||||
if (TCastToConstPtr<CPatterned>(mgr.GetObjectById(weap->GetOwnerId())) ||
|
||||
TCastToConstPtr<CPlayer>(mgr.GetObjectById(weap->GetOwnerId())))
|
||||
mgr.FreeScriptObject(weap->GetUniqueId());
|
||||
}
|
||||
|
|
|
@ -1536,7 +1536,7 @@ pas::EAnimationState CBSWallHang::GetBodyStateTransition(float dt, const CBodyCo
|
|||
}
|
||||
|
||||
void CBSWallHang::FixInPlace(CBodyController& bc) {
|
||||
if (const TCastToPtr<CAi> ai = bc.GetOwner()) {
|
||||
if (const TCastToPtr<CPatterned> ai = bc.GetOwner()) {
|
||||
ai->SetConstantForce(zeus::skZero3f);
|
||||
ai->SetVelocityWR(zeus::skZero3f);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ bool CGameCameraList::IsQualified(const CEntity& ent) const { return TCastToCons
|
|||
CListeningAiList::CListeningAiList() : CObjectList(EGameObjectList::ListeningAi) {}
|
||||
|
||||
bool CListeningAiList::IsQualified(const CEntity& ent) const {
|
||||
const TCastToConstPtr<CAi> ai(ent);
|
||||
const TCastToConstPtr<CPatterned> ai(ent);
|
||||
return ai && ai->IsListening();
|
||||
}
|
||||
|
||||
|
|
|
@ -396,7 +396,7 @@ void CBabygoth::RemoveFromTeam(CStateManager& mgr) {
|
|||
|
||||
void CBabygoth::ApplySeparationBehavior(CStateManager& mgr) {
|
||||
for (CEntity* ent : mgr.GetListeningAiObjectList()) {
|
||||
if (TCastToPtr<CAi> ai = ent) {
|
||||
if (TCastToPtr<CPatterned> ai = ent) {
|
||||
if (ai.GetPtr() != this && GetAreaIdAlways() == ai->GetAreaIdAlways()) {
|
||||
zeus::CVector3f sep = x45c_steeringBehaviors.Separation(*this, ai->GetTranslation(), 15.f);
|
||||
if (!sep.isZero()) {
|
||||
|
@ -1099,7 +1099,7 @@ bool CBabygoth::Leash(CStateManager& mgr, float) {
|
|||
|
||||
bool CBabygoth::IsDestinationObstructed(const CStateManager& mgr) const {
|
||||
for (const CEntity* obj : mgr.GetListeningAiObjectList()) {
|
||||
if (const TCastToConstPtr<CAi> ai = obj) {
|
||||
if (const TCastToConstPtr<CPatterned> ai = obj) {
|
||||
if (ai->GetAreaIdAlways() == GetAreaIdAlways()) {
|
||||
if ((x8b8_backupDestPos - ai->GetTranslation()).magSquared() <= 10.f) {
|
||||
return true;
|
||||
|
|
|
@ -1104,7 +1104,7 @@ void CDrone::UpdateLasers(CStateManager& mgr, float dt) {
|
|||
CSfxManager::AddEmitter(x7cc_laserSfx, result.GetPoint(), zeus::skZero3f, true, false, 127, GetAreaIdAlways());
|
||||
}
|
||||
}
|
||||
if (id != GetUniqueId() && TCastToPtr<CAi>{mgr.ObjectById(id)}) {
|
||||
if (id != GetUniqueId() && TCastToPtr<CPatterned>{mgr.ObjectById(id)}) {
|
||||
x834_31_attackOver = true;
|
||||
float rem = GetModelData()->GetAnimationData()->GetAnimTimeRemaining("Whole Body"sv);
|
||||
UpdateAnimation(rem, mgr, true);
|
||||
|
|
|
@ -603,9 +603,9 @@ bool CMetroidPrimeEssence::sub8027e870(const zeus::CTransform& xf, CStateManager
|
|||
|
||||
void CMetroidPrimeEssence::KillAiInArea(CStateManager& mgr) {
|
||||
for (auto* ent : mgr.GetListeningAiObjectList()) {
|
||||
if (TCastToPtr<CAi> ai = ent) {
|
||||
if (TCastToPtr<CPatterned> ai = ent) {
|
||||
if (ai != this && ai->GetActive() && ai->GetAreaIdAlways() == GetAreaIdAlways()) {
|
||||
static_cast<CPatterned*>(ai.GetPtr())->MassiveDeath(mgr);
|
||||
ai->MassiveDeath(mgr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ void CMetroidPrimeEssence::KillAiInArea(CStateManager& mgr) {
|
|||
void CMetroidPrimeEssence::CountListeningAi(CStateManager& mgr) {
|
||||
x6e0_ = 0;
|
||||
for (auto* ent : mgr.GetListeningAiObjectList()) {
|
||||
if (TCastToPtr<CAi> ai = ent) {
|
||||
if (TCastToPtr<CPatterned> ai = ent) {
|
||||
if (ai != this && ai->GetActive() && ai->GetAreaIdAlways() == GetAreaIdAlways()) {
|
||||
++x6e4_;
|
||||
}
|
||||
|
|
|
@ -532,7 +532,7 @@ void CTryclops::DragBomb(CStateManager& mgr, const zeus::CTransform& xf) {
|
|||
|
||||
void CTryclops::ApplySeparation(CStateManager& mgr) {
|
||||
for (CEntity* ent : mgr.GetAiWaypointObjectList()) {
|
||||
if (TCastToPtr<CAi> ai = ent) {
|
||||
if (TCastToPtr<CPatterned> ai = ent) {
|
||||
if (ai == this || ai->GetAreaIdAlways() != GetAreaId()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -407,7 +407,7 @@ CProjectileTouchResult CGameProjectile::CanCollideWithGameObject(CActor& act, CS
|
|||
return {kInvalidUniqueId, std::nullopt};
|
||||
} else if (xf8_filter.GetExcludeList().Intersection(act.GetMaterialList())) {
|
||||
return {kInvalidUniqueId, std::nullopt};
|
||||
} else if (TCastToPtr<CAi> ai = act) {
|
||||
} else if (TCastToPtr<CPatterned> ai = act) {
|
||||
if (!ai->CanBeShot(mgr, int(xe8_projectileAttribs))) {
|
||||
return {kInvalidUniqueId, std::nullopt};
|
||||
}
|
||||
|
|
|
@ -244,7 +244,7 @@ void CScriptTrigger::Touch(CActor& act, CStateManager& mgr) {
|
|||
} else if (pl->GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed) {
|
||||
testFlags |= ETriggerFlags::DetectMorphedPlayer;
|
||||
}
|
||||
} else if (TCastToPtr<CAi>(act)) {
|
||||
} else if (TCastToPtr<CPatterned>(act)) {
|
||||
testFlags |= ETriggerFlags::DetectAI;
|
||||
} else if (TCastToPtr<CGameProjectile>(act)) {
|
||||
testFlags |= ETriggerFlags::DetectProjectiles1 | ETriggerFlags::DetectProjectiles2 |
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "Runtime/CStateManager.hpp"
|
||||
#include "Runtime/World/CPlayer.hpp"
|
||||
#include "Runtime/World/CPatterned.hpp"
|
||||
|
||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||
|
||||
|
@ -101,7 +102,7 @@ void CTeamAiMgr::SpacingSort(CStateManager& mgr, const zeus::CVector3f& pos) {
|
|||
std::sort(x58_roles.begin(), x58_roles.end(), sorter);
|
||||
float tierStagger = 4.5f;
|
||||
for (const auto& role : x58_roles) {
|
||||
if (const TCastToConstPtr<CAi> ai = mgr.ObjectById(role.GetOwnerId())) {
|
||||
if (const TCastToConstPtr<CPatterned> ai = mgr.ObjectById(role.GetOwnerId())) {
|
||||
const float length = (ai->GetBaseBoundingBox().max.y() - ai->GetBaseBoundingBox().min.y()) * 1.5f;
|
||||
if (length > tierStagger) {
|
||||
tierStagger = length;
|
||||
|
@ -112,7 +113,7 @@ void CTeamAiMgr::SpacingSort(CStateManager& mgr, const zeus::CVector3f& pos) {
|
|||
int tierTeamSize = 0;
|
||||
int maxTierTeamSize = 3;
|
||||
for (auto& role : x58_roles) {
|
||||
if (const TCastToConstPtr<CAi> ai = mgr.ObjectById(role.GetOwnerId())) {
|
||||
if (const TCastToConstPtr<CPatterned> ai = mgr.ObjectById(role.GetOwnerId())) {
|
||||
zeus::CVector3f delta = ai->GetTranslation() - pos;
|
||||
zeus::CVector3f newPos;
|
||||
if (delta.canBeNormalized()) {
|
||||
|
@ -142,7 +143,7 @@ void CTeamAiMgr::PositionTeam(CStateManager& mgr) {
|
|||
break;
|
||||
default:
|
||||
for (auto& role : x58_roles) {
|
||||
if (const TCastToConstPtr<CAi> ai = mgr.ObjectById(role.GetOwnerId())) {
|
||||
if (const TCastToConstPtr<CPatterned> ai = mgr.ObjectById(role.GetOwnerId())) {
|
||||
role.x1c_position = ai->GetOrigin(mgr, role, aimPos);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue