From 148e9e4bd86dbe14cf1bd948920fea649fb7b17e Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 16 Aug 2022 17:48:26 -0400 Subject: [PATCH] Runtime: Correct TCastTo to TCastTo --- Runtime/CStateManager.cpp | 8 ++++---- Runtime/Camera/CCameraManager.cpp | 2 +- Runtime/Character/CBodyState.cpp | 2 +- Runtime/GameObjectLists.cpp | 2 +- Runtime/MP1/World/CBabygoth.cpp | 4 ++-- Runtime/MP1/World/CDrone.cpp | 2 +- Runtime/MP1/World/CMetroidPrimeEssence.cpp | 6 +++--- Runtime/MP1/World/CTryclops.cpp | 2 +- Runtime/Weapon/CGameProjectile.cpp | 2 +- Runtime/World/CScriptTrigger.cpp | 2 +- Runtime/World/CTeamAiMgr.cpp | 7 ++++--- 11 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index e2c5ab245..657c66325 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -1470,7 +1470,7 @@ void CStateManager::InitScriptObjects(const std::vector& ids) { void CStateManager::InformListeners(const zeus::CVector3f& pos, EListenNoiseType type) { for (CEntity* ent : GetListeningAiObjectList()) { - if (const TCastToPtr ai = ent) { + if (const TCastToPtr ai = ent) { if (!ai->GetActive()) { continue; } @@ -1506,7 +1506,7 @@ void CStateManager::ApplyKnockBack(CActor& actor, const CDamageInfo& info, const return; } - const TCastToPtr ai = actor; + const TCastToPtr ai = actor; if (!ai && hInfo->GetHP() <= 0.f) { if (dampedPower > hInfo->GetKnockbackResistance()) { if (const TCastToPtr physActor = actor) { @@ -2219,7 +2219,7 @@ void CStateManager::MoveActors(float dt) { continue; } - if (const TCastToPtr ai = physActor) { + if (const TCastToPtr 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 ai = ent) { + if (const TCastToPtr ai = ent) { bool doThink = !xf94_29_cinematicPause; if (doThink && ai->GetAreaIdAlways() != kInvalidAreaId) { const CGameArea* area = x850_world->GetAreaAlways(ai->GetAreaIdAlways()); diff --git a/Runtime/Camera/CCameraManager.cpp b/Runtime/Camera/CCameraManager.cpp index 3b132059b..98a2cb88f 100644 --- a/Runtime/Camera/CCameraManager.cpp +++ b/Runtime/Camera/CCameraManager.cpp @@ -77,7 +77,7 @@ void CCameraManager::EnterCinematic(CStateManager& mgr) { } else if (const TCastToConstPtr weap = ent) { if (weap->GetActive()) { if (False(weap->GetAttribField() & EProjectileAttrib::KeepInCinematic)) { - if (TCastToConstPtr(mgr.GetObjectById(weap->GetOwnerId())) || + if (TCastToConstPtr(mgr.GetObjectById(weap->GetOwnerId())) || TCastToConstPtr(mgr.GetObjectById(weap->GetOwnerId()))) mgr.FreeScriptObject(weap->GetUniqueId()); } diff --git a/Runtime/Character/CBodyState.cpp b/Runtime/Character/CBodyState.cpp index 47c769c7c..966051130 100644 --- a/Runtime/Character/CBodyState.cpp +++ b/Runtime/Character/CBodyState.cpp @@ -1536,7 +1536,7 @@ pas::EAnimationState CBSWallHang::GetBodyStateTransition(float dt, const CBodyCo } void CBSWallHang::FixInPlace(CBodyController& bc) { - if (const TCastToPtr ai = bc.GetOwner()) { + if (const TCastToPtr ai = bc.GetOwner()) { ai->SetConstantForce(zeus::skZero3f); ai->SetVelocityWR(zeus::skZero3f); } diff --git a/Runtime/GameObjectLists.cpp b/Runtime/GameObjectLists.cpp index 80b56f0e5..0fdd515c0 100644 --- a/Runtime/GameObjectLists.cpp +++ b/Runtime/GameObjectLists.cpp @@ -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 ai(ent); + const TCastToConstPtr ai(ent); return ai && ai->IsListening(); } diff --git a/Runtime/MP1/World/CBabygoth.cpp b/Runtime/MP1/World/CBabygoth.cpp index c6ba9101c..ec7a6a10c 100644 --- a/Runtime/MP1/World/CBabygoth.cpp +++ b/Runtime/MP1/World/CBabygoth.cpp @@ -396,7 +396,7 @@ void CBabygoth::RemoveFromTeam(CStateManager& mgr) { void CBabygoth::ApplySeparationBehavior(CStateManager& mgr) { for (CEntity* ent : mgr.GetListeningAiObjectList()) { - if (TCastToPtr ai = ent) { + if (TCastToPtr 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 ai = obj) { + if (const TCastToConstPtr ai = obj) { if (ai->GetAreaIdAlways() == GetAreaIdAlways()) { if ((x8b8_backupDestPos - ai->GetTranslation()).magSquared() <= 10.f) { return true; diff --git a/Runtime/MP1/World/CDrone.cpp b/Runtime/MP1/World/CDrone.cpp index e2732532d..59c6de351 100644 --- a/Runtime/MP1/World/CDrone.cpp +++ b/Runtime/MP1/World/CDrone.cpp @@ -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{mgr.ObjectById(id)}) { + if (id != GetUniqueId() && TCastToPtr{mgr.ObjectById(id)}) { x834_31_attackOver = true; float rem = GetModelData()->GetAnimationData()->GetAnimTimeRemaining("Whole Body"sv); UpdateAnimation(rem, mgr, true); diff --git a/Runtime/MP1/World/CMetroidPrimeEssence.cpp b/Runtime/MP1/World/CMetroidPrimeEssence.cpp index 420ff1c77..b4d4c97a6 100644 --- a/Runtime/MP1/World/CMetroidPrimeEssence.cpp +++ b/Runtime/MP1/World/CMetroidPrimeEssence.cpp @@ -603,9 +603,9 @@ bool CMetroidPrimeEssence::sub8027e870(const zeus::CTransform& xf, CStateManager void CMetroidPrimeEssence::KillAiInArea(CStateManager& mgr) { for (auto* ent : mgr.GetListeningAiObjectList()) { - if (TCastToPtr ai = ent) { + if (TCastToPtr ai = ent) { if (ai != this && ai->GetActive() && ai->GetAreaIdAlways() == GetAreaIdAlways()) { - static_cast(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 ai = ent) { + if (TCastToPtr ai = ent) { if (ai != this && ai->GetActive() && ai->GetAreaIdAlways() == GetAreaIdAlways()) { ++x6e4_; } diff --git a/Runtime/MP1/World/CTryclops.cpp b/Runtime/MP1/World/CTryclops.cpp index 5d875b546..bb190efec 100644 --- a/Runtime/MP1/World/CTryclops.cpp +++ b/Runtime/MP1/World/CTryclops.cpp @@ -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 ai = ent) { + if (TCastToPtr ai = ent) { if (ai == this || ai->GetAreaIdAlways() != GetAreaId()) { continue; } diff --git a/Runtime/Weapon/CGameProjectile.cpp b/Runtime/Weapon/CGameProjectile.cpp index 19772e133..e89ed6e5a 100644 --- a/Runtime/Weapon/CGameProjectile.cpp +++ b/Runtime/Weapon/CGameProjectile.cpp @@ -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 ai = act) { + } else if (TCastToPtr ai = act) { if (!ai->CanBeShot(mgr, int(xe8_projectileAttribs))) { return {kInvalidUniqueId, std::nullopt}; } diff --git a/Runtime/World/CScriptTrigger.cpp b/Runtime/World/CScriptTrigger.cpp index c9522576f..92d916d80 100644 --- a/Runtime/World/CScriptTrigger.cpp +++ b/Runtime/World/CScriptTrigger.cpp @@ -244,7 +244,7 @@ void CScriptTrigger::Touch(CActor& act, CStateManager& mgr) { } else if (pl->GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed) { testFlags |= ETriggerFlags::DetectMorphedPlayer; } - } else if (TCastToPtr(act)) { + } else if (TCastToPtr(act)) { testFlags |= ETriggerFlags::DetectAI; } else if (TCastToPtr(act)) { testFlags |= ETriggerFlags::DetectProjectiles1 | ETriggerFlags::DetectProjectiles2 | diff --git a/Runtime/World/CTeamAiMgr.cpp b/Runtime/World/CTeamAiMgr.cpp index 852e3e407..bd9f26690 100644 --- a/Runtime/World/CTeamAiMgr.cpp +++ b/Runtime/World/CTeamAiMgr.cpp @@ -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 ai = mgr.ObjectById(role.GetOwnerId())) { + if (const TCastToConstPtr 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 ai = mgr.ObjectById(role.GetOwnerId())) { + if (const TCastToConstPtr 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 ai = mgr.ObjectById(role.GetOwnerId())) { + if (const TCastToConstPtr ai = mgr.ObjectById(role.GetOwnerId())) { role.x1c_position = ai->GetOrigin(mgr, role, aimPos); } }