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