Use EntityList instead of `rstl::resverved_vector<TUniqueId, 1024>' directly

This commit is contained in:
Phillip Stephens 2021-06-06 17:07:45 -07:00
parent 5bfe881b95
commit 0b4f15341b
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
58 changed files with 184 additions and 183 deletions

View File

@ -233,7 +233,7 @@ s16 CSortedListManager::CalculateIntersections(ESortedList la, ESortedList lb, s
return headId; return headId;
} }
void CSortedListManager::BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& out, const zeus::CVector3f& pos, void CSortedListManager::BuildNearList(EntityList& out, const zeus::CVector3f& pos,
const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter, const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter,
const CActor* actor) { const CActor* actor) {
if (mag == 0.f) { if (mag == 0.f) {
@ -246,7 +246,7 @@ void CSortedListManager::BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEnti
BuildNearList(out, zeus::CAABox(mins, maxs), filter, actor); BuildNearList(out, zeus::CAABox(mins, maxs), filter, actor);
} }
void CSortedListManager::BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& out, const CActor& actor, void CSortedListManager::BuildNearList(EntityList& out, const CActor& actor,
const zeus::CAABox& aabb) { const zeus::CAABox& aabb) {
const CMaterialFilter& filter = actor.GetMaterialFilter(); const CMaterialFilter& filter = actor.GetMaterialFilter();
s16 id = ConstructIntersectionArray(aabb); s16 id = ConstructIntersectionArray(aabb);
@ -262,7 +262,7 @@ void CSortedListManager::BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEnti
} }
} }
void CSortedListManager::BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& out, const zeus::CAABox& aabb, void CSortedListManager::BuildNearList(EntityList& out, const zeus::CAABox& aabb,
const CMaterialFilter& filter, const CActor* actor) { const CMaterialFilter& filter, const CActor* actor) {
s16 id = ConstructIntersectionArray(aabb); s16 id = ConstructIntersectionArray(aabb);
while (id != -1) { while (id != -1) {

View File

@ -43,10 +43,10 @@ class CSortedListManager {
public: public:
CSortedListManager(); CSortedListManager();
void BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& out, const zeus::CVector3f& pos, void BuildNearList(EntityList& out, const zeus::CVector3f& pos,
const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter, const CActor* actor); const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter, const CActor* actor);
void BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& out, const CActor& actor, const zeus::CAABox& aabb); void BuildNearList(EntityList& out, const CActor& actor, const zeus::CAABox& aabb);
void BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& out, const zeus::CAABox& aabb, void BuildNearList(EntityList& out, const zeus::CAABox& aabb,
const CMaterialFilter& filter, const CActor* actor); const CMaterialFilter& filter, const CActor* actor);
void Remove(const CActor* actor); void Remove(const CActor* actor);
void Move(const CActor* actor, const zeus::CAABox& aabb); void Move(const CActor* actor, const zeus::CAABox& aabb);

View File

@ -374,7 +374,7 @@ TAreaId CStateManager::GetVisAreaId() const {
const zeus::CVector3f& camTranslation = ballCam->GetTranslation(); const zeus::CVector3f& camTranslation = ballCam->GetTranslation();
zeus::CAABox camAABB(camTranslation, camTranslation); zeus::CAABox camAABB(camTranslation, camTranslation);
camAABB.accumulateBounds(x84c_player->GetTranslation()); camAABB.accumulateBounds(x84c_player->GetTranslation());
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
BuildNearList(nearList, camAABB, BuildNearList(nearList, camAABB,
CMaterialFilter(EMaterialTypes::AIBlock, CMaterialList(), CMaterialFilter::EFilterType::Include), CMaterialFilter(EMaterialTypes::AIBlock, CMaterialList(), CMaterialFilter::EFilterType::Include),
nullptr); nullptr);
@ -1696,7 +1696,7 @@ void CStateManager::ApplyDamageToWorld(TUniqueId damager, const CActor& actor, c
bomb = True(weapon->GetAttribField() & (EProjectileAttrib::Bombs | EProjectileAttrib::PowerBombs)); bomb = True(weapon->GetAttribField() & (EProjectileAttrib::Bombs | EProjectileAttrib::PowerBombs));
} }
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
BuildNearList(nearList, aabb, filter, &actor); BuildNearList(nearList, aabb, filter, &actor);
for (const auto& id : nearList) { for (const auto& id : nearList) {
CEntity* ent = ObjectById(id); CEntity* ent = ObjectById(id);
@ -1735,7 +1735,7 @@ void CStateManager::ApplyDamageToWorld(TUniqueId damager, const CActor& actor, c
void CStateManager::ProcessRadiusDamage(const CActor& damager, CActor& damagee, TUniqueId senderId, void CStateManager::ProcessRadiusDamage(const CActor& damager, CActor& damagee, TUniqueId senderId,
const CDamageInfo& info, const CMaterialFilter& filter) { const CDamageInfo& info, const CMaterialFilter& filter) {
const zeus::CAABox aabb(damager.GetTranslation() - info.GetRadius(), damager.GetTranslation() + info.GetRadius()); const zeus::CAABox aabb(damager.GetTranslation() - info.GetRadius(), damager.GetTranslation() + info.GetRadius());
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
BuildNearList(nearList, aabb, filter, nullptr); BuildNearList(nearList, aabb, filter, nullptr);
for (const auto& id : nearList) { for (const auto& id : nearList) {
CEntity* ent = ObjectById(id); CEntity* ent = ObjectById(id);
@ -1797,7 +1797,7 @@ void CStateManager::ApplyRadiusDamage(const CActor& a1, const zeus::CVector3f& p
} }
bool CStateManager::TestRayDamage(const zeus::CVector3f& pos, const CActor& damagee, bool CStateManager::TestRayDamage(const zeus::CVector3f& pos, const CActor& damagee,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList) const { const EntityList& nearList) const {
const CHealthInfo* hInfo = const_cast<CActor&>(damagee).HealthInfo(const_cast<CStateManager&>(*this)); const CHealthInfo* hInfo = const_cast<CActor&>(damagee).HealthInfo(const_cast<CStateManager&>(*this));
if (hInfo == nullptr) { if (hInfo == nullptr) {
return false; return false;
@ -1846,20 +1846,20 @@ bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CV
zeus::CVector3f delta = end - start; zeus::CVector3f delta = end - start;
const float mag = delta.magnitude(); const float mag = delta.magnitude();
delta = delta / mag; delta = delta / mag;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
BuildNearList(nearList, start, delta, mag, filter, damagee); BuildNearList(nearList, start, delta, mag, filter, damagee);
return RayCollideWorldInternal(start, end, filter, nearList, damagee); return RayCollideWorldInternal(start, end, filter, nearList, damagee);
} }
bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end, bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const EntityList& nearList,
const CMaterialFilter& filter, const CActor* damagee) const { const CMaterialFilter& filter, const CActor* damagee) const {
return RayCollideWorldInternal(start, end, filter, nearList, damagee); return RayCollideWorldInternal(start, end, filter, nearList, damagee);
} }
bool CStateManager::RayCollideWorldInternal(const zeus::CVector3f& start, const zeus::CVector3f& end, bool CStateManager::RayCollideWorldInternal(const zeus::CVector3f& start, const zeus::CVector3f& end,
const CMaterialFilter& filter, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const EntityList& nearList,
const CActor* damagee) const { const CActor* damagee) const {
const zeus::CVector3f delta = end - start; const zeus::CVector3f delta = end - start;
if (!delta.canBeNormalized()) { if (!delta.canBeNormalized()) {
@ -2374,7 +2374,7 @@ void CStateManager::MoveActors(float dt) {
void CStateManager::CrossTouchActors() { void CStateManager::CrossTouchActors() {
std::array<bool, kMaxEntities> visits{}; std::array<bool, kMaxEntities> visits{};
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
for (CEntity* ent : GetActorObjectList()) { for (CEntity* ent : GetActorObjectList()) {
if (ent == nullptr) { if (ent == nullptr) {
@ -2681,18 +2681,18 @@ void CStateManager::AreaLoaded(TAreaId aid) {
x880_envFxManager->AreaLoaded(); x880_envFxManager->AreaLoaded();
} }
void CStateManager::BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& listOut, const zeus::CVector3f& v1, void CStateManager::BuildNearList(EntityList& listOut, const zeus::CVector3f& v1,
const zeus::CVector3f& v2, float f1, const CMaterialFilter& filter, const zeus::CVector3f& v2, float f1, const CMaterialFilter& filter,
const CActor* actor) const { const CActor* actor) const {
x874_sortedListManager->BuildNearList(listOut, v1, v2, f1, filter, actor); x874_sortedListManager->BuildNearList(listOut, v1, v2, f1, filter, actor);
} }
void CStateManager::BuildColliderList(rstl::reserved_vector<TUniqueId, kMaxEntities>& listOut, const CActor& actor, void CStateManager::BuildColliderList(EntityList& listOut, const CActor& actor,
const zeus::CAABox& aabb) const { const zeus::CAABox& aabb) const {
x874_sortedListManager->BuildNearList(listOut, actor, aabb); x874_sortedListManager->BuildNearList(listOut, actor, aabb);
} }
void CStateManager::BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& listOut, const zeus::CAABox& aabb, void CStateManager::BuildNearList(EntityList& listOut, const zeus::CAABox& aabb,
const CMaterialFilter& filter, const CActor* actor) const { const CMaterialFilter& filter, const CActor* actor) const {
x874_sortedListManager->BuildNearList(listOut, aabb, filter, actor); x874_sortedListManager->BuildNearList(listOut, aabb, filter, actor);
} }
@ -2800,7 +2800,7 @@ CRayCastResult CStateManager::RayStaticIntersection(const zeus::CVector3f& pos,
CRayCastResult CStateManager::RayWorldIntersection(TUniqueId& idOut, const zeus::CVector3f& pos, CRayCastResult CStateManager::RayWorldIntersection(TUniqueId& idOut, const zeus::CVector3f& pos,
const zeus::CVector3f& dir, float length, const zeus::CVector3f& dir, float length,
const CMaterialFilter& filter, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& list) const { const EntityList& list) const {
return CGameCollision::RayWorldIntersection(*this, idOut, pos, dir, length, filter, list); return CGameCollision::RayWorldIntersection(*this, idOut, pos, dir, length, filter, list);
} }

View File

@ -298,14 +298,14 @@ public:
void ProcessRadiusDamage(const CActor&, CActor&, TUniqueId senderId, const CDamageInfo& info, const CMaterialFilter&); void ProcessRadiusDamage(const CActor&, CActor&, TUniqueId senderId, const CDamageInfo& info, const CMaterialFilter&);
void ApplyRadiusDamage(const CActor&, const zeus::CVector3f&, CActor&, const CDamageInfo& info); void ApplyRadiusDamage(const CActor&, const zeus::CVector3f&, CActor&, const CDamageInfo& info);
bool TestRayDamage(const zeus::CVector3f& pos, const CActor& damagee, bool TestRayDamage(const zeus::CVector3f& pos, const CActor& damagee,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList) const; const EntityList& nearList) const;
bool RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end, const CMaterialFilter& filter, bool RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end, const CMaterialFilter& filter,
const CActor* damagee) const; const CActor* damagee) const;
bool RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end, bool RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const CMaterialFilter& filter, const EntityList& nearList, const CMaterialFilter& filter,
const CActor* damagee) const; const CActor* damagee) const;
bool RayCollideWorldInternal(const zeus::CVector3f& start, const zeus::CVector3f& end, const CMaterialFilter& filter, bool RayCollideWorldInternal(const zeus::CVector3f& start, const zeus::CVector3f& end, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const CActor* damagee) const; const EntityList& nearList, const CActor* damagee) const;
bool MultiRayCollideWorld(const zeus::CMRay& ray, const CMaterialFilter& filter) const; bool MultiRayCollideWorld(const zeus::CMRay& ray, const CMaterialFilter& filter) const;
void TestBombHittingWater(const CActor& damager, const zeus::CVector3f& pos, CActor& damagee); void TestBombHittingWater(const CActor& damager, const zeus::CVector3f& pos, CActor& damagee);
bool ApplyLocalDamage(const zeus::CVector3f&, const zeus::CVector3f&, CActor&, float, const CWeaponMode&); bool ApplyLocalDamage(const zeus::CVector3f&, const zeus::CVector3f&, CActor&, float, const CWeaponMode&);
@ -344,10 +344,10 @@ public:
void AreaUnloaded(TAreaId); void AreaUnloaded(TAreaId);
void PrepareAreaUnload(TAreaId); void PrepareAreaUnload(TAreaId);
void AreaLoaded(TAreaId); void AreaLoaded(TAreaId);
void BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& listOut, const zeus::CVector3f&, const zeus::CVector3f&, void BuildNearList(EntityList& listOut, const zeus::CVector3f&, const zeus::CVector3f&,
float, const CMaterialFilter&, const CActor*) const; float, const CMaterialFilter&, const CActor*) const;
void BuildColliderList(rstl::reserved_vector<TUniqueId, kMaxEntities>& listOut, const CActor&, const zeus::CAABox&) const; void BuildColliderList(EntityList& listOut, const CActor&, const zeus::CAABox&) const;
void BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& listOut, const zeus::CAABox&, const CMaterialFilter&, void BuildNearList(EntityList& listOut, const zeus::CAABox&, const CMaterialFilter&,
const CActor*) const; const CActor*) const;
void UpdateActorInSortedLists(CActor&); void UpdateActorInSortedLists(CActor&);
void UpdateSortedLists(); void UpdateSortedLists();
@ -358,7 +358,7 @@ public:
const CMaterialFilter& filter) const; const CMaterialFilter& filter) const;
CRayCastResult RayWorldIntersection(TUniqueId& idOut, const zeus::CVector3f& pos, const zeus::CVector3f& dir, CRayCastResult RayWorldIntersection(TUniqueId& idOut, const zeus::CVector3f& pos, const zeus::CVector3f& dir,
float length, const CMaterialFilter& filter, float length, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& list) const; const EntityList& list) const;
void UpdateObjectInLists(CEntity&); void UpdateObjectInLists(CEntity&);
TUniqueId AllocateUniqueId(); TUniqueId AllocateUniqueId();
void DeferStateTransition(EStateManagerTransition t); void DeferStateTransition(EStateManagerTransition t);

View File

@ -266,7 +266,7 @@ constexpr CMaterialFilter BallCameraFilter = CMaterialFilter::MakeIncludeExclude
void CBallCamera::BuildSplineNav(CStateManager& mgr) { void CBallCamera::BuildSplineNav(CStateManager& mgr) {
zeus::CVector3f ballPos = mgr.GetPlayer().GetBallPosition(); zeus::CVector3f ballPos = mgr.GetPlayer().GetBallPosition();
TUniqueId intersectId = kInvalidUniqueId; TUniqueId intersectId = kInvalidUniqueId;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
CRayCastResult result = CRayCastResult result =
mgr.RayWorldIntersection(intersectId, ballPos, zeus::skDown, 20.f, BallCameraFilter, nearList); mgr.RayWorldIntersection(intersectId, ballPos, zeus::skDown, 20.f, BallCameraFilter, nearList);
float downFactor = result.IsValid() ? zeus::clamp(0.f, result.GetT() / 20.f, 1.f) : 1.f; float downFactor = result.IsValid() ? zeus::clamp(0.f, result.GetT() / 20.f, 1.f) : 1.f;
@ -325,7 +325,7 @@ void CBallCamera::BuildSplineArc(CStateManager& mgr) {
delta = rot.transform(delta); delta = rot.transform(delta);
zeus::CVector3f pt1 = halfwayPoint + delta; zeus::CVector3f pt1 = halfwayPoint + delta;
TUniqueId intersectId = kInvalidUniqueId; TUniqueId intersectId = kInvalidUniqueId;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
CRayCastResult result = CRayCastResult result =
mgr.RayWorldIntersection(intersectId, pt1, -delta.normalized(), delta.magnitude(), BallCameraFilter, nearList); mgr.RayWorldIntersection(intersectId, pt1, -delta.normalized(), delta.magnitude(), BallCameraFilter, nearList);
if (result.IsValid()) { if (result.IsValid()) {
@ -529,7 +529,7 @@ void CBallCamera::CheckFailsafe(float dt, CStateManager& mgr) {
zeus::CVector3f camToBall = ballPos - GetTranslation(); zeus::CVector3f camToBall = ballPos - GetTranslation();
float camToBallMag = camToBall.magnitude(); float camToBallMag = camToBall.magnitude();
camToBall.normalize(); camToBall.normalize();
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, GetTranslation(), camToBall, camToBallMag, BallCameraFilter, nullptr); mgr.BuildNearList(nearList, GetTranslation(), camToBall, camToBallMag, BallCameraFilter, nullptr);
CRayCastResult result = mgr.RayWorldIntersection(x368_obscuringObjectId, GetTranslation(), camToBall, camToBallMag, CRayCastResult result = mgr.RayWorldIntersection(x368_obscuringObjectId, GetTranslation(), camToBall, camToBallMag,
BallCameraFilter, nearList); BallCameraFilter, nearList);
@ -984,7 +984,7 @@ zeus::CVector3f CBallCamera::ApplyColliders() {
} }
void CBallCamera::UpdateColliders(const zeus::CTransform& xf, std::vector<CCameraCollider>& colliderList, int& it, void CBallCamera::UpdateColliders(const zeus::CTransform& xf, std::vector<CCameraCollider>& colliderList, int& it,
int count, float tolerance, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, int count, float tolerance, const EntityList& nearList,
float dt, CStateManager& mgr) { float dt, CStateManager& mgr) {
if (it < colliderList.size()) { if (it < colliderList.size()) {
x310_idealLookVec = {0.f, g_tweakBall->GetBallCameraOffset().y(), g_tweakPlayer->GetPlayerBallHalfExtent()}; x310_idealLookVec = {0.f, g_tweakBall->GetBallCameraOffset().y(), g_tweakPlayer->GetPlayerBallHalfExtent()};
@ -1033,7 +1033,7 @@ void CBallCamera::UpdateColliders(const zeus::CTransform& xf, std::vector<CCamer
} }
zeus::CVector3f CBallCamera::AvoidGeometry(const zeus::CTransform& xf, zeus::CVector3f CBallCamera::AvoidGeometry(const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, float dt, const EntityList& nearList, float dt,
CStateManager& mgr) { CStateManager& mgr) {
switch (x328_avoidGeomCycle) { switch (x328_avoidGeomCycle) {
case 0: case 0:
@ -1059,7 +1059,7 @@ zeus::CVector3f CBallCamera::AvoidGeometry(const zeus::CTransform& xf,
} }
zeus::CVector3f CBallCamera::AvoidGeometryFull(const zeus::CTransform& xf, zeus::CVector3f CBallCamera::AvoidGeometryFull(const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, float dt, const EntityList& nearList, float dt,
CStateManager& mgr) { CStateManager& mgr) {
UpdateColliders(xf, x264_smallColliders, x2d0_smallColliderIt, x264_smallColliders.size(), 4.f, nearList, dt, mgr); UpdateColliders(xf, x264_smallColliders, x2d0_smallColliderIt, x264_smallColliders.size(), 4.f, nearList, dt, mgr);
UpdateColliders(xf, x274_mediumColliders, x2d4_mediumColliderIt, x274_mediumColliders.size(), 4.f, nearList, dt, mgr); UpdateColliders(xf, x274_mediumColliders, x2d4_mediumColliderIt, x274_mediumColliders.size(), 4.f, nearList, dt, mgr);
@ -1153,7 +1153,7 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr) {
} }
} }
x334_collidersAABB = CalculateCollidersBoundingBox(x284_largeColliders, mgr); x334_collidersAABB = CalculateCollidersBoundingBox(x284_largeColliders, mgr);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, x334_collidersAABB, BallCameraFilter, mgr.BuildNearList(nearList, x334_collidersAABB, BallCameraFilter,
TCastToConstPtr<CActor>(mgr.GetObjectById(x46c_collisionActorId)).GetPtr()); TCastToConstPtr<CActor>(mgr.GetObjectById(x46c_collisionActorId)).GetPtr());
if (!x18c_31_clearLOS && x368_obscuringObjectId == kInvalidUniqueId) { if (!x18c_31_clearLOS && x368_obscuringObjectId == kInvalidUniqueId) {
@ -1549,7 +1549,7 @@ zeus::CVector3f CBallCamera::GetFailsafeSplinePoint(const std::vector<zeus::CVec
bool CBallCamera::CheckFailsafeFromMorphBallState(CStateManager& mgr) const { bool CBallCamera::CheckFailsafeFromMorphBallState(CStateManager& mgr) const {
TUniqueId xbb8 = kInvalidUniqueId; TUniqueId xbb8 = kInvalidUniqueId;
float curT = 0.f; float curT = 0.f;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
rstl::reserved_vector<CRayCastResult, 6> resultsA; rstl::reserved_vector<CRayCastResult, 6> resultsA;
rstl::reserved_vector<CRayCastResult, 6> resultsB; rstl::reserved_vector<CRayCastResult, 6> resultsB;
while (curT < 6.f) { while (curT < 6.f) {
@ -1584,7 +1584,7 @@ bool CBallCamera::CheckFailsafeFromMorphBallState(CStateManager& mgr) const {
} }
bool CBallCamera::SplineIntersectTest(CMaterialList& intersectMat, CStateManager& mgr) const { bool CBallCamera::SplineIntersectTest(CMaterialList& intersectMat, CStateManager& mgr) const {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
TUniqueId xe38 = kInvalidUniqueId; TUniqueId xe38 = kInvalidUniqueId;
rstl::reserved_vector<CRayCastResult, 12> xacc; rstl::reserved_vector<CRayCastResult, 12> xacc;
rstl::reserved_vector<CRayCastResult, 12> xd10; rstl::reserved_vector<CRayCastResult, 12> xd10;
@ -1731,7 +1731,7 @@ zeus::CVector3f CBallCamera::FindDesiredPosition(float distance, float elevation
zeus::CAABox x13ac(ballPos - distance, ballPos + distance); zeus::CAABox x13ac(ballPos - distance, ballPos + distance);
x13ac.min.z() = float(ballPos.z()); x13ac.min.z() = float(ballPos.z());
x13ac.max.z() = elev + ballPos.z(); x13ac.max.z() = elev + ballPos.z();
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, x13ac, BallCameraFilter, mgr.BuildNearList(nearList, x13ac, BallCameraFilter,
TCastToConstPtr<CActor>(mgr.GetObjectById(x46c_collisionActorId)).GetPtr()); TCastToConstPtr<CActor>(mgr.GetObjectById(x46c_collisionActorId)).GetPtr());
zeus::CQuaternion rotNeg; zeus::CQuaternion rotNeg;
@ -1803,7 +1803,7 @@ zeus::CVector3f CBallCamera::FindDesiredPosition(float distance, float elevation
zeus::CAABox findBounds(ballPos - distance, ballPos + distance); zeus::CAABox findBounds(ballPos - distance, ballPos + distance);
findBounds.min.z() = float(ballPos.z()); findBounds.min.z() = float(ballPos.z());
findBounds.max.z() = elev + ballPos.z(); findBounds.max.z() = elev + ballPos.z();
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, findBounds, BallCameraFilter, mgr.BuildNearList(nearList, findBounds, BallCameraFilter,
TCastToConstPtr<CActor>(mgr.GetObjectById(x46c_collisionActorId)).GetPtr()); TCastToConstPtr<CActor>(mgr.GetObjectById(x46c_collisionActorId)).GetPtr());
zeus::CQuaternion rotNeg2; zeus::CQuaternion rotNeg2;
@ -1858,7 +1858,7 @@ bool CBallCamera::DetectCollision(const zeus::CVector3f& from, const zeus::CVect
aabb.accumulateBounds(from); aabb.accumulateBounds(from);
aabb.accumulateBounds(to); aabb.accumulateBounds(to);
aabb = zeus::CAABox(aabb.min - margin, aabb.max + margin); aabb = zeus::CAABox(aabb.min - margin, aabb.max + margin);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildColliderList(nearList, mgr.GetPlayer(), aabb); mgr.BuildColliderList(nearList, mgr.GetPlayer(), aabb);
CAreaCollisionCache cache(aabb); CAreaCollisionCache cache(aabb);
CGameCollision::BuildAreaCollisionCache(mgr, cache); CGameCollision::BuildAreaCollisionCache(mgr, cache);
@ -1978,7 +1978,7 @@ bool CBallCamera::CheckTransitionLineOfSight(const zeus::CVector3f& eyePos, cons
aabb.accumulateBounds(eyePos); aabb.accumulateBounds(eyePos);
aabb.accumulateBounds(behindPos); aabb.accumulateBounds(behindPos);
aabb = zeus::CAABox(aabb.min - margin, aabb.max + margin); aabb = zeus::CAABox(aabb.min - margin, aabb.max + margin);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildColliderList(nearList, mgr.GetPlayer(), aabb); mgr.BuildColliderList(nearList, mgr.GetPlayer(), aabb);
CAreaCollisionCache cache(aabb); CAreaCollisionCache cache(aabb);
CGameCollision::BuildAreaCollisionCache(mgr, cache); CGameCollision::BuildAreaCollisionCache(mgr, cache);

View File

@ -212,11 +212,11 @@ private:
int numObscured) const; int numObscured) const;
zeus::CVector3f ApplyColliders(); zeus::CVector3f ApplyColliders();
void UpdateColliders(const zeus::CTransform& xf, std::vector<CCameraCollider>& colliderList, int& it, int count, void UpdateColliders(const zeus::CTransform& xf, std::vector<CCameraCollider>& colliderList, int& it, int count,
float tolerance, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, float dt, float tolerance, const EntityList& nearList, float dt,
CStateManager& mgr); CStateManager& mgr);
zeus::CVector3f AvoidGeometry(const zeus::CTransform& xf, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, zeus::CVector3f AvoidGeometry(const zeus::CTransform& xf, const EntityList& nearList,
float dt, CStateManager& mgr); float dt, CStateManager& mgr);
zeus::CVector3f AvoidGeometryFull(const zeus::CTransform& xf, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, zeus::CVector3f AvoidGeometryFull(const zeus::CTransform& xf, const EntityList& nearList,
float dt, CStateManager& mgr); float dt, CStateManager& mgr);
zeus::CAABox CalculateCollidersBoundingBox(const std::vector<CCameraCollider>& colliderList, zeus::CAABox CalculateCollidersBoundingBox(const std::vector<CCameraCollider>& colliderList,
CStateManager& mgr) const; CStateManager& mgr) const;

View File

@ -38,14 +38,14 @@ void CGroundMovement::CheckFalling(CPhysicsActor& actor, CStateManager& mgr, flo
} }
void CGroundMovement::MoveGroundCollider(CStateManager& mgr, CPhysicsActor& actor, float dt, void CGroundMovement::MoveGroundCollider(CStateManager& mgr, CPhysicsActor& actor, float dt,
const rstl::reserved_vector<TUniqueId, kMaxEntities>* nearList) { const EntityList* nearList) {
CMotionState oldState = actor.GetMotionState(); CMotionState oldState = actor.GetMotionState();
CMotionState newState = actor.PredictMotion_Internal(dt); CMotionState newState = actor.PredictMotion_Internal(dt);
float deltaMag = newState.x0_translation.magnitude(); float deltaMag = newState.x0_translation.magnitude();
TUniqueId idDetect = kInvalidUniqueId; TUniqueId idDetect = kInvalidUniqueId;
CCollisionInfoList collisionList; CCollisionInfoList collisionList;
zeus::CAABox motionVol = actor.GetMotionVolume(dt); zeus::CAABox motionVol = actor.GetMotionVolume(dt);
rstl::reserved_vector<TUniqueId, kMaxEntities> useColliderList; EntityList useColliderList;
if (nearList != nullptr) { if (nearList != nullptr) {
useColliderList = *nearList; useColliderList = *nearList;
} }
@ -114,7 +114,7 @@ void CGroundMovement::MoveGroundCollider(CStateManager& mgr, CPhysicsActor& acto
} }
bool CGroundMovement::ResolveUpDown(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor, bool CGroundMovement::ResolveUpDown(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor,
const CMaterialFilter& filter, rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const CMaterialFilter& filter, EntityList& nearList,
float stepUp, float stepDown, float& fOut, CCollisionInfoList& list) { float stepUp, float stepDown, float& fOut, CCollisionInfoList& list) {
float zextent = stepDown; float zextent = stepDown;
if (list.GetCount() <= 0) { if (list.GetCount() <= 0) {
@ -178,7 +178,7 @@ bool CGroundMovement::ResolveUpDown(CAreaCollisionCache& cache, CStateManager& m
bool CGroundMovement::MoveGroundColliderZ(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor, bool CGroundMovement::MoveGroundColliderZ(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor,
const CMaterialFilter& filter, const CMaterialFilter& filter,
rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, float amt, float& resolved, EntityList& nearList, float amt, float& resolved,
CCollisionInfoList& list, TUniqueId& idOut) { CCollisionInfoList& list, TUniqueId& idOut) {
actor.MoveCollisionPrimitive({0.f, 0.f, amt}); actor.MoveCollisionPrimitive({0.f, 0.f, amt});
@ -238,7 +238,7 @@ bool CGroundMovement::MoveGroundColliderZ(CAreaCollisionCache& cache, CStateMana
void CGroundMovement::MoveGroundColliderXY(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor, void CGroundMovement::MoveGroundColliderXY(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor,
const CMaterialFilter& filter, const CMaterialFilter& filter,
rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, float dt) { EntityList& nearList, float dt) {
bool didCollide = false; bool didCollide = false;
bool isPlayer = actor.GetMaterialList().HasMaterial(EMaterialTypes::Player); bool isPlayer = actor.GetMaterialList().HasMaterial(EMaterialTypes::Player);
float remDt = dt; float remDt = dt;
@ -335,9 +335,9 @@ zeus::CVector3f CGroundMovement::CollisionDamping(const zeus::CVector3f& vel, co
} }
void CGroundMovement::MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor& actor, float dt, void CGroundMovement::MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor& actor, float dt,
const rstl::reserved_vector<TUniqueId, kMaxEntities>* nearList) { const EntityList* nearList) {
zeus::CAABox motionVol = actor.GetMotionVolume(dt); zeus::CAABox motionVol = actor.GetMotionVolume(dt);
rstl::reserved_vector<TUniqueId, kMaxEntities> useNearList; EntityList useNearList;
if (nearList != nullptr) { if (nearList != nullptr) {
useNearList = *nearList; useNearList = *nearList;
} else { } else {
@ -638,7 +638,7 @@ static bool RemovePositiveZComponentFromNormal(zeus::CVector3f& vec) {
} }
CMaterialList CGroundMovement::MoveObjectAnalytical(CStateManager& mgr, CPhysicsActor& actor, float dt, CMaterialList CGroundMovement::MoveObjectAnalytical(CStateManager& mgr, CPhysicsActor& actor, float dt,
rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, EntityList& nearList,
CAreaCollisionCache& cache, const SMovementOptions& opts, CAreaCollisionCache& cache, const SMovementOptions& opts,
SMoveObjectResult& result) { SMoveObjectResult& result) {
result.x6c_processedCollisions = 0; result.x6c_processedCollisions = 0;

View File

@ -47,24 +47,24 @@ public:
static void CheckFalling(CPhysicsActor& actor, CStateManager& mgr, float); static void CheckFalling(CPhysicsActor& actor, CStateManager& mgr, float);
static void MoveGroundCollider(CStateManager& mgr, CPhysicsActor& actor, float dt, static void MoveGroundCollider(CStateManager& mgr, CPhysicsActor& actor, float dt,
const rstl::reserved_vector<TUniqueId, kMaxEntities>* nearList); const EntityList* nearList);
static bool ResolveUpDown(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor, static bool ResolveUpDown(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor,
const CMaterialFilter& filter, rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, float, const CMaterialFilter& filter, EntityList& nearList, float,
float, float&, CCollisionInfoList& list); float, float&, CCollisionInfoList& list);
static bool MoveGroundColliderZ(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor, static bool MoveGroundColliderZ(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor,
const CMaterialFilter& filter, rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const CMaterialFilter& filter, EntityList& nearList,
float, float&, CCollisionInfoList& list, TUniqueId& idOut); float, float&, CCollisionInfoList& list, TUniqueId& idOut);
static void MoveGroundColliderXY(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor, static void MoveGroundColliderXY(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor,
const CMaterialFilter& filter, rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const CMaterialFilter& filter, EntityList& nearList,
float); float);
static zeus::CVector3f CollisionDamping(const zeus::CVector3f& a, const zeus::CVector3f& b, const zeus::CVector3f& c, static zeus::CVector3f CollisionDamping(const zeus::CVector3f& a, const zeus::CVector3f& b, const zeus::CVector3f& c,
float d, float e); float d, float e);
static void MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor& actor, float, static void MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor& actor, float,
const rstl::reserved_vector<TUniqueId, kMaxEntities>* nearList); const EntityList* nearList);
static bool RemoveNormalComponent(const zeus::CVector3f&, const zeus::CVector3f&, zeus::CVector3f&, float&); static bool RemoveNormalComponent(const zeus::CVector3f&, const zeus::CVector3f&, zeus::CVector3f&, float&);
static bool RemoveNormalComponent(const zeus::CVector3f& a, zeus::CVector3f& b); static bool RemoveNormalComponent(const zeus::CVector3f& a, zeus::CVector3f& b);
static CMaterialList MoveObjectAnalytical(CStateManager& mgr, CPhysicsActor& actor, float, static CMaterialList MoveObjectAnalytical(CStateManager& mgr, CPhysicsActor& actor, float,
rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, EntityList& nearList,
CAreaCollisionCache& cache, const SMovementOptions& opts, CAreaCollisionCache& cache, const SMovementOptions& opts,
SMoveObjectResult& result); SMoveObjectResult& result);
}; };

View File

@ -226,7 +226,7 @@ bool CRagDoll::SatisfyWorldConstraints(CStateManager& mgr, int pass) {
else else
exclude = CMaterialList(EMaterialTypes::Character, EMaterialTypes::Player); exclude = CMaterialList(EMaterialTypes::Character, EMaterialTypes::Player);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
CMaterialFilter filter = CMaterialFilter::MakeIncludeExclude(include, exclude); CMaterialFilter filter = CMaterialFilter::MakeIncludeExclude(include, exclude);
mgr.BuildNearList(nearList, aabb, filter, nullptr); mgr.BuildNearList(nearList, aabb, filter, nullptr);

View File

@ -55,7 +55,7 @@ zeus::CVector3f CSteeringBehaviors::Separation(const CPhysicsActor& actor, const
return (1.f - (posDiff.magSquared() / (separation * separation))) * posDiff.normalized(); return (1.f - (posDiff.magSquared() / (separation * separation))) * posDiff.normalized();
} }
zeus::CVector3f CSteeringBehaviors::Alignment(const CPhysicsActor& actor, rstl::reserved_vector<TUniqueId, kMaxEntities>& list, zeus::CVector3f CSteeringBehaviors::Alignment(const CPhysicsActor& actor, EntityList& list,
const CStateManager& mgr) const { const CStateManager& mgr) const {
zeus::CVector3f align; zeus::CVector3f align;
@ -71,7 +71,7 @@ zeus::CVector3f CSteeringBehaviors::Alignment(const CPhysicsActor& actor, rstl::
return align * (diff / M_PIF); return align * (diff / M_PIF);
} }
zeus::CVector3f CSteeringBehaviors::Cohesion(const CPhysicsActor& actor, rstl::reserved_vector<TUniqueId, kMaxEntities>& list, zeus::CVector3f CSteeringBehaviors::Cohesion(const CPhysicsActor& actor, EntityList& list,
float dampingRadius, const CStateManager& mgr) const { float dampingRadius, const CStateManager& mgr) const {
zeus::CVector3f dest; zeus::CVector3f dest;
if (!list.empty()) { if (!list.empty()) {

View File

@ -19,9 +19,9 @@ public:
zeus::CVector3f Arrival(const CPhysicsActor& actor, const zeus::CVector3f& dest, float dampingRadius) const; zeus::CVector3f Arrival(const CPhysicsActor& actor, const zeus::CVector3f& dest, float dampingRadius) const;
zeus::CVector3f Pursuit(const CPhysicsActor& actor, const zeus::CVector3f& v0, const zeus::CVector3f& v1) const; zeus::CVector3f Pursuit(const CPhysicsActor& actor, const zeus::CVector3f& v0, const zeus::CVector3f& v1) const;
zeus::CVector3f Separation(const CPhysicsActor& actor, const zeus::CVector3f& pos, float separation) const; zeus::CVector3f Separation(const CPhysicsActor& actor, const zeus::CVector3f& pos, float separation) const;
zeus::CVector3f Alignment(const CPhysicsActor& actor, rstl::reserved_vector<TUniqueId, kMaxEntities>& list, zeus::CVector3f Alignment(const CPhysicsActor& actor, EntityList& list,
const CStateManager& mgr) const; const CStateManager& mgr) const;
zeus::CVector3f Cohesion(const CPhysicsActor& actor, rstl::reserved_vector<TUniqueId, kMaxEntities>& list, zeus::CVector3f Cohesion(const CPhysicsActor& actor, EntityList& list,
float dampingRadius, const CStateManager& mgr) const; float dampingRadius, const CStateManager& mgr) const;
zeus::CVector2f Flee2D(const CPhysicsActor& actor, const zeus::CVector2f& v0) const; zeus::CVector2f Flee2D(const CPhysicsActor& actor, const zeus::CVector2f& v0) const;
zeus::CVector2f Arrival2D(const CPhysicsActor& actor, const zeus::CVector2f& v0) const; zeus::CVector2f Arrival2D(const CPhysicsActor& actor, const zeus::CVector2f& v0) const;

View File

@ -59,7 +59,7 @@ void CGameCollision::InitCollision() {
} }
void CGameCollision::MovePlayer(CStateManager& mgr, CPhysicsActor& actor, float dt, void CGameCollision::MovePlayer(CStateManager& mgr, CPhysicsActor& actor, float dt,
const rstl::reserved_vector<TUniqueId, kMaxEntities>* colliderList) { const EntityList* colliderList) {
actor.SetAngularEnabled(true); actor.SetAngularEnabled(true);
actor.AddMotionState(actor.PredictAngularMotion(dt)); actor.AddMotionState(actor.PredictAngularMotion(dt));
if (!actor.IsUseStandardCollider()) { if (!actor.IsUseStandardCollider()) {
@ -77,7 +77,7 @@ void CGameCollision::MovePlayer(CStateManager& mgr, CPhysicsActor& actor, float
} }
void CGameCollision::MoveAndCollide(CStateManager& mgr, CPhysicsActor& actor, float dt, const ICollisionFilter& filter, void CGameCollision::MoveAndCollide(CStateManager& mgr, CPhysicsActor& actor, float dt, const ICollisionFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>* colliderList) { const EntityList* colliderList) {
bool isPlayer = actor.GetMaterialList().HasMaterial(EMaterialTypes::Player); bool isPlayer = actor.GetMaterialList().HasMaterial(EMaterialTypes::Player);
bool r28 = false; bool r28 = false;
bool r27 = false; bool r27 = false;
@ -94,7 +94,7 @@ void CGameCollision::MoveAndCollide(CStateManager& mgr, CPhysicsActor& actor, fl
float m3 = 0.001f / actor.GetCollisionAccuracyModifier(); float m3 = 0.001f / actor.GetCollisionAccuracyModifier();
zeus::CAABox motionVol = actor.GetMotionVolume(dt); zeus::CAABox motionVol = actor.GetMotionVolume(dt);
rstl::reserved_vector<TUniqueId, kMaxEntities> useColliderList; EntityList useColliderList;
if (colliderList) if (colliderList)
useColliderList = *colliderList; useColliderList = *colliderList;
else else
@ -196,7 +196,7 @@ zeus::CVector3f CGameCollision::GetActorRelativeVelocities(const CPhysicsActor&
} }
void CGameCollision::Move(CStateManager& mgr, CPhysicsActor& actor, float dt, void CGameCollision::Move(CStateManager& mgr, CPhysicsActor& actor, float dt,
const rstl::reserved_vector<TUniqueId, kMaxEntities>* colliderList) { const EntityList* colliderList) {
if (!actor.IsMovable()) if (!actor.IsMovable())
return; return;
if (actor.GetMaterialList().HasMaterial(EMaterialTypes::GroundCollider) || actor.WillMove(mgr)) { if (actor.GetMaterialList().HasMaterial(EMaterialTypes::GroundCollider) || actor.WillMove(mgr)) {
@ -297,7 +297,7 @@ bool CGameCollision::RayStaticIntersectionBool(const CStateManager& mgr, const z
CRayCastResult CGameCollision::RayDynamicIntersection(const CStateManager& mgr, TUniqueId& idOut, CRayCastResult CGameCollision::RayDynamicIntersection(const CStateManager& mgr, TUniqueId& idOut,
const zeus::CVector3f& pos, const zeus::CVector3f& dir, const zeus::CVector3f& pos, const zeus::CVector3f& dir,
float length, const CMaterialFilter& filter, float length, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList) { const EntityList& nearList) {
CRayCastResult ret; CRayCastResult ret;
float bestT = length; float bestT = length;
if (bestT <= 0.f) { if (bestT <= 0.f) {
@ -323,7 +323,7 @@ CRayCastResult CGameCollision::RayDynamicIntersection(const CStateManager& mgr,
bool CGameCollision::RayDynamicIntersectionBool(const CStateManager& mgr, const zeus::CVector3f& pos, bool CGameCollision::RayDynamicIntersectionBool(const CStateManager& mgr, const zeus::CVector3f& pos,
const zeus::CVector3f& dir, const CMaterialFilter& filter, const zeus::CVector3f& dir, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const EntityList& nearList,
const CActor* damagee, float length) { const CActor* damagee, float length) {
if (length <= 0.f) { if (length <= 0.f) {
length = 100000.f; length = 100000.f;
@ -350,7 +350,7 @@ bool CGameCollision::RayDynamicIntersectionBool(const CStateManager& mgr, const
CRayCastResult CGameCollision::RayWorldIntersection(const CStateManager& mgr, TUniqueId& idOut, CRayCastResult CGameCollision::RayWorldIntersection(const CStateManager& mgr, TUniqueId& idOut,
const zeus::CVector3f& pos, const zeus::CVector3f& dir, float mag, const zeus::CVector3f& pos, const zeus::CVector3f& dir, float mag,
const CMaterialFilter& filter, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList) { const EntityList& nearList) {
CRayCastResult staticRes = RayStaticIntersection(mgr, pos, dir, mag, filter); CRayCastResult staticRes = RayStaticIntersection(mgr, pos, dir, mag, filter);
CRayCastResult dynamicRes = RayDynamicIntersection(mgr, idOut, pos, dir, mag, filter, nearList); CRayCastResult dynamicRes = RayDynamicIntersection(mgr, idOut, pos, dir, mag, filter, nearList);
@ -405,7 +405,7 @@ float CGameCollision::GetMinExtentForCollisionPrimitive(const CCollisionPrimitiv
bool CGameCollision::DetectCollisionBoolean(const CStateManager& mgr, const CCollisionPrimitive& prim, bool CGameCollision::DetectCollisionBoolean(const CStateManager& mgr, const CCollisionPrimitive& prim,
const zeus::CTransform& xf, const CMaterialFilter& filter, const zeus::CTransform& xf, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList) { const EntityList& nearList) {
if (!filter.GetExcludeList().HasMaterial(EMaterialTypes::NoStaticCollision) && if (!filter.GetExcludeList().HasMaterial(EMaterialTypes::NoStaticCollision) &&
DetectStaticCollisionBoolean(mgr, prim, xf, filter)) { DetectStaticCollisionBoolean(mgr, prim, xf, filter)) {
return true; return true;
@ -419,7 +419,7 @@ bool CGameCollision::DetectCollisionBoolean(const CStateManager& mgr, const CCol
bool CGameCollision::DetectCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache, bool CGameCollision::DetectCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf, const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList) { const EntityList& nearList) {
if (!filter.GetExcludeList().HasMaterial(EMaterialTypes::NoStaticCollision) && if (!filter.GetExcludeList().HasMaterial(EMaterialTypes::NoStaticCollision) &&
DetectStaticCollisionBoolean_Cached(mgr, cache, prim, xf, filter)) { DetectStaticCollisionBoolean_Cached(mgr, cache, prim, xf, filter)) {
return true; return true;
@ -501,7 +501,7 @@ bool CGameCollision::DetectStaticCollisionBoolean_Cached(const CStateManager& mg
} }
bool CGameCollision::DetectDynamicCollisionBoolean(const CCollisionPrimitive& prim, const zeus::CTransform& xf, bool CGameCollision::DetectDynamicCollisionBoolean(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const EntityList& nearList,
const CStateManager& mgr) { const CStateManager& mgr) {
for (const auto& id : nearList) { for (const auto& id : nearList) {
if (const TCastToConstPtr<CPhysicsActor> actor = mgr.GetObjectById(id)) { if (const TCastToConstPtr<CPhysicsActor> actor = mgr.GetObjectById(id)) {
@ -520,7 +520,7 @@ bool CGameCollision::DetectDynamicCollisionBoolean(const CCollisionPrimitive& pr
bool CGameCollision::DetectCollision_Cached(const CStateManager& mgr, CAreaCollisionCache& cache, bool CGameCollision::DetectCollision_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf, const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, TUniqueId& idOut, const EntityList& nearList, TUniqueId& idOut,
CCollisionInfoList& infoList) { CCollisionInfoList& infoList) {
idOut = kInvalidUniqueId; idOut = kInvalidUniqueId;
bool ret = false; bool ret = false;
@ -542,7 +542,7 @@ bool CGameCollision::DetectCollision_Cached(const CStateManager& mgr, CAreaColli
bool CGameCollision::DetectCollision_Cached_Moving(const CStateManager& mgr, CAreaCollisionCache& cache, bool CGameCollision::DetectCollision_Cached_Moving(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf, const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const EntityList& nearList,
const zeus::CVector3f& dir, TUniqueId& idOut, const zeus::CVector3f& dir, TUniqueId& idOut,
CCollisionInfo& infoOut, double& d) { CCollisionInfo& infoOut, double& d) {
bool ret = false; bool ret = false;
@ -686,7 +686,7 @@ bool CGameCollision::DetectStaticCollision_Cached_Moving(const CStateManager& mg
} }
bool CGameCollision::DetectDynamicCollision(const CCollisionPrimitive& prim, const zeus::CTransform& xf, bool CGameCollision::DetectDynamicCollision(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, TUniqueId& idOut, const EntityList& nearList, TUniqueId& idOut,
CCollisionInfoList& list, const CStateManager& mgr) { CCollisionInfoList& list, const CStateManager& mgr) {
for (const auto& id : nearList) { for (const auto& id : nearList) {
if (const TCastToConstPtr<CPhysicsActor> actor = mgr.GetObjectById(id)) { if (const TCastToConstPtr<CPhysicsActor> actor = mgr.GetObjectById(id)) {
@ -704,7 +704,7 @@ bool CGameCollision::DetectDynamicCollision(const CCollisionPrimitive& prim, con
} }
bool CGameCollision::DetectDynamicCollisionMoving(const CCollisionPrimitive& prim, const zeus::CTransform& xf, bool CGameCollision::DetectDynamicCollisionMoving(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const EntityList& nearList,
const zeus::CVector3f& dir, TUniqueId& idOut, CCollisionInfo& infoOut, const zeus::CVector3f& dir, TUniqueId& idOut, CCollisionInfo& infoOut,
double& dOut, const CStateManager& mgr) { double& dOut, const CStateManager& mgr) {
bool ret = false; bool ret = false;
@ -729,7 +729,7 @@ bool CGameCollision::DetectDynamicCollisionMoving(const CCollisionPrimitive& pri
bool CGameCollision::DetectCollision(const CStateManager& mgr, const CCollisionPrimitive& prim, bool CGameCollision::DetectCollision(const CStateManager& mgr, const CCollisionPrimitive& prim,
const zeus::CTransform& xf, const CMaterialFilter& filter, const zeus::CTransform& xf, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, TUniqueId& idOut, const EntityList& nearList, TUniqueId& idOut,
CCollisionInfoList& infoOut) { CCollisionInfoList& infoOut) {
bool ret = false; bool ret = false;
CMaterialList exclude = filter.ExcludeList(); CMaterialList exclude = filter.ExcludeList();
@ -894,7 +894,7 @@ void CGameCollision::CollideWithStaticBodyNoRot(CPhysicsActor& a0, const CMateri
void CGameCollision::CollisionFailsafe(const CStateManager& mgr, CAreaCollisionCache& cache, CPhysicsActor& actor, void CGameCollision::CollisionFailsafe(const CStateManager& mgr, CAreaCollisionCache& cache, CPhysicsActor& actor,
const CCollisionPrimitive& prim, const CCollisionPrimitive& prim,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, float f1, const EntityList& nearList, float f1,
u32 failsafeTicks) { u32 failsafeTicks) {
actor.MoveCollisionPrimitive(zeus::skZero3f); actor.MoveCollisionPrimitive(zeus::skZero3f);
if (f1 > 0.5f) { if (f1 > 0.5f) {
@ -943,7 +943,7 @@ void CGameCollision::CollisionFailsafe(const CStateManager& mgr, CAreaCollisionC
std::optional<zeus::CVector3f> std::optional<zeus::CVector3f>
CGameCollision::FindNonIntersectingVector(const CStateManager& mgr, CAreaCollisionCache& cache, CPhysicsActor& actor, CGameCollision::FindNonIntersectingVector(const CStateManager& mgr, CAreaCollisionCache& cache, CPhysicsActor& actor,
const CCollisionPrimitive& prim, const CCollisionPrimitive& prim,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList) { const EntityList& nearList) {
zeus::CTransform xf = actor.GetPrimitiveTransform(); zeus::CTransform xf = actor.GetPrimitiveTransform();
zeus::CVector3f origOrigin = xf.origin; zeus::CVector3f origOrigin = xf.origin;
zeus::CVector3f center = prim.CalculateAABox(xf).center(); zeus::CVector3f center = prim.CalculateAABox(xf).center();

View File

@ -25,9 +25,9 @@ class ICollisionFilter;
class CGameCollision { class CGameCollision {
static void MovePlayer(CStateManager& mgr, CPhysicsActor& actor, float dt, static void MovePlayer(CStateManager& mgr, CPhysicsActor& actor, float dt,
const rstl::reserved_vector<TUniqueId, kMaxEntities>* colliderList); const EntityList* colliderList);
static void MoveAndCollide(CStateManager& mgr, CPhysicsActor& actor, float dt, const ICollisionFilter& filter, static void MoveAndCollide(CStateManager& mgr, CPhysicsActor& actor, float dt, const ICollisionFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>* colliderList); const EntityList* colliderList);
static zeus::CVector3f GetActorRelativeVelocities(const CPhysicsActor& act0, const CPhysicsActor* act1); static zeus::CVector3f GetActorRelativeVelocities(const CPhysicsActor& act0, const CPhysicsActor* act1);
public: public:
@ -39,7 +39,7 @@ public:
static bool NullCollisionCollider(const CInternalCollisionStructure&, CCollisionInfoList&) { return false; } static bool NullCollisionCollider(const CInternalCollisionStructure&, CCollisionInfoList&) { return false; }
static void InitCollision(); static void InitCollision();
static void Move(CStateManager& mgr, CPhysicsActor& actor, float dt, static void Move(CStateManager& mgr, CPhysicsActor& actor, float dt,
const rstl::reserved_vector<TUniqueId, kMaxEntities>* colliderList); const EntityList* colliderList);
static bool CanBlock(const CMaterialList&, const zeus::CUnitVector3f&); static bool CanBlock(const CMaterialList&, const zeus::CUnitVector3f&);
static bool IsFloor(const CMaterialList&, const zeus::CUnitVector3f&); static bool IsFloor(const CMaterialList&, const zeus::CUnitVector3f&);
@ -50,42 +50,42 @@ public:
const zeus::CVector3f& dir, float length, const CMaterialFilter& filter); const zeus::CVector3f& dir, float length, const CMaterialFilter& filter);
static CRayCastResult RayDynamicIntersection(const CStateManager& mgr, TUniqueId& idOut, const zeus::CVector3f& pos, static CRayCastResult RayDynamicIntersection(const CStateManager& mgr, TUniqueId& idOut, const zeus::CVector3f& pos,
const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter, const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList); const EntityList& nearList);
static bool RayDynamicIntersectionBool(const CStateManager& mgr, const zeus::CVector3f& pos, static bool RayDynamicIntersectionBool(const CStateManager& mgr, const zeus::CVector3f& pos,
const zeus::CVector3f& dir, const CMaterialFilter& filter, const zeus::CVector3f& dir, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const CActor* damagee, const EntityList& nearList, const CActor* damagee,
float length); float length);
static CRayCastResult RayWorldIntersection(const CStateManager& mgr, TUniqueId& idOut, const zeus::CVector3f& pos, static CRayCastResult RayWorldIntersection(const CStateManager& mgr, TUniqueId& idOut, const zeus::CVector3f& pos,
const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter, const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList); const EntityList& nearList);
static bool RayStaticIntersectionArea(const CGameArea& area, const zeus::CVector3f& pos, const zeus::CVector3f& dir, static bool RayStaticIntersectionArea(const CGameArea& area, const zeus::CVector3f& pos, const zeus::CVector3f& dir,
float mag, const CMaterialFilter& filter); float mag, const CMaterialFilter& filter);
static void BuildAreaCollisionCache(const CStateManager& mgr, CAreaCollisionCache& cache); static void BuildAreaCollisionCache(const CStateManager& mgr, CAreaCollisionCache& cache);
static float GetMinExtentForCollisionPrimitive(const CCollisionPrimitive& prim); static float GetMinExtentForCollisionPrimitive(const CCollisionPrimitive& prim);
static bool DetectCollisionBoolean(const CStateManager& mgr, const CCollisionPrimitive& prim, static bool DetectCollisionBoolean(const CStateManager& mgr, const CCollisionPrimitive& prim,
const zeus::CTransform& xf, const CMaterialFilter& filter, const zeus::CTransform& xf, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList); const EntityList& nearList);
static bool DetectCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache, static bool DetectCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf, const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList); const EntityList& nearList);
static bool DetectStaticCollisionBoolean(const CStateManager& mgr, const CCollisionPrimitive& prim, static bool DetectStaticCollisionBoolean(const CStateManager& mgr, const CCollisionPrimitive& prim,
const zeus::CTransform& xf, const CMaterialFilter& filter); const zeus::CTransform& xf, const CMaterialFilter& filter);
static bool DetectStaticCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache, static bool DetectStaticCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf, const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter); const CMaterialFilter& filter);
static bool DetectDynamicCollisionBoolean(const CCollisionPrimitive& prim, const zeus::CTransform& xf, static bool DetectDynamicCollisionBoolean(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const EntityList& nearList,
const CStateManager& mgr); const CStateManager& mgr);
static bool DetectCollision_Cached(const CStateManager& mgr, CAreaCollisionCache& cache, static bool DetectCollision_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf, const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, TUniqueId& idOut, const EntityList& nearList, TUniqueId& idOut,
CCollisionInfoList& infoList); CCollisionInfoList& infoList);
static bool DetectCollision_Cached_Moving(const CStateManager& mgr, CAreaCollisionCache& cache, static bool DetectCollision_Cached_Moving(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf, const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const EntityList& nearList,
const zeus::CVector3f& vec, TUniqueId& idOut, CCollisionInfo& infoOut, const zeus::CVector3f& vec, TUniqueId& idOut, CCollisionInfo& infoOut,
double&); double&);
static bool DetectStaticCollision(const CStateManager& mgr, const CCollisionPrimitive& prim, static bool DetectStaticCollision(const CStateManager& mgr, const CCollisionPrimitive& prim,
@ -99,14 +99,14 @@ public:
const CMaterialFilter& filter, const zeus::CVector3f& vec, const CMaterialFilter& filter, const zeus::CVector3f& vec,
CCollisionInfo& infoOut, double& d); CCollisionInfo& infoOut, double& d);
static bool DetectDynamicCollision(const CCollisionPrimitive& prim, const zeus::CTransform& xf, static bool DetectDynamicCollision(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, TUniqueId& idOut, const EntityList& nearList, TUniqueId& idOut,
CCollisionInfoList& list, const CStateManager& mgr); CCollisionInfoList& list, const CStateManager& mgr);
static bool DetectDynamicCollisionMoving(const CCollisionPrimitive& prim, const zeus::CTransform& xf, static bool DetectDynamicCollisionMoving(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const EntityList& nearList,
const zeus::CVector3f& vec, TUniqueId& idOut, CCollisionInfo& infoOut, const zeus::CVector3f& vec, TUniqueId& idOut, CCollisionInfo& infoOut,
double& d, const CStateManager& mgr); double& d, const CStateManager& mgr);
static bool DetectCollision(const CStateManager& mgr, const CCollisionPrimitive& prim, const zeus::CTransform& xf, static bool DetectCollision(const CStateManager& mgr, const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const CMaterialFilter& filter, const EntityList& nearList,
TUniqueId& idOut, CCollisionInfoList& infoOut); TUniqueId& idOut, CCollisionInfoList& infoOut);
static void MakeCollisionCallbacks(CStateManager& mgr, CPhysicsActor& actor, TUniqueId id, static void MakeCollisionCallbacks(CStateManager& mgr, CPhysicsActor& actor, TUniqueId id,
const CCollisionInfoList& list); const CCollisionInfoList& list);
@ -117,11 +117,11 @@ public:
static void CollideWithStaticBodyNoRot(CPhysicsActor& a0, const CMaterialList& m0, const CMaterialList& m1, static void CollideWithStaticBodyNoRot(CPhysicsActor& a0, const CMaterialList& m0, const CMaterialList& m1,
const zeus::CUnitVector3f& normal, float restitution, bool); const zeus::CUnitVector3f& normal, float restitution, bool);
static void CollisionFailsafe(const CStateManager& mgr, CAreaCollisionCache& cache, CPhysicsActor& actor, static void CollisionFailsafe(const CStateManager& mgr, CAreaCollisionCache& cache, CPhysicsActor& actor,
const CCollisionPrimitive& prim, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const CCollisionPrimitive& prim, const EntityList& nearList,
float, u32 failsafeTicks); float, u32 failsafeTicks);
static std::optional<zeus::CVector3f> static std::optional<zeus::CVector3f>
FindNonIntersectingVector(const CStateManager& mgr, CAreaCollisionCache& cache, CPhysicsActor& actor, FindNonIntersectingVector(const CStateManager& mgr, CAreaCollisionCache& cache, CPhysicsActor& actor,
const CCollisionPrimitive& prim, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList); const CCollisionPrimitive& prim, const EntityList& nearList);
static void AvoidStaticCollisionWithinRadius(const CStateManager& mgr, CPhysicsActor& actor, u32 iterations, float dt, static void AvoidStaticCollisionWithinRadius(const CStateManager& mgr, CPhysicsActor& actor, u32 iterations, float dt,
float height, float size, float mass, float radius); float height, float size, float mass, float radius);
}; };

View File

@ -58,7 +58,7 @@ void CSimpleShadow::Calculate(const zeus::CAABox& aabb, const zeus::CTransform&
if (height > 0.1f + halfHeight) { if (height > 0.1f + halfHeight) {
TUniqueId cid = kInvalidUniqueId; TUniqueId cid = kInvalidUniqueId;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
CRayCastResult resD = CGameCollision::RayDynamicIntersection( CRayCastResult resD = CGameCollision::RayDynamicIntersection(
mgr, cid, pos, zeus::skDown, x40_maxObjHeight, CMaterialFilter::skPassEverything, nearList); mgr, cid, pos, zeus::skDown, x40_maxObjHeight, CMaterialFilter::skPassEverything, nearList);
if (resD.IsValid() && resD.GetT() < height) { if (resD.IsValid() && resD.GetT() < height) {

View File

@ -128,7 +128,7 @@ void CHudRadarInterface::Draw(const CStateManager& mgr, float alpha) {
player.GetTranslation().z() - drawParms.x7c_zRadius, player.GetTranslation().x() + drawParms.x78_xyRadius, player.GetTranslation().z() - drawParms.x7c_zRadius, player.GetTranslation().x() + drawParms.x78_xyRadius,
player.GetTranslation().y() + drawParms.x78_xyRadius, player.GetTranslation().z() + drawParms.x7c_zRadius); player.GetTranslation().y() + drawParms.x78_xyRadius, player.GetTranslation().z() + drawParms.x7c_zRadius);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, radarBounds, mgr.BuildNearList(nearList, radarBounds,
CMaterialFilter(CMaterialList(EMaterialTypes::Target, EMaterialTypes::RadarObject), CMaterialFilter(CMaterialList(EMaterialTypes::Target, EMaterialTypes::RadarObject),
CMaterialList(EMaterialTypes::ExcludeFromRadar), CMaterialList(EMaterialTypes::ExcludeFromRadar),

View File

@ -533,7 +533,7 @@ void CSamusHud::UpdateThreatAssessment(float dt, const CStateManager& mgr) {
zeus::CAABox aabb; zeus::CAABox aabb;
aabb.accumulateBounds(player.GetTranslation() - g_tweakGui->GetThreatRange()); aabb.accumulateBounds(player.GetTranslation() - g_tweakGui->GetThreatRange());
aabb.accumulateBounds(player.GetTranslation() + g_tweakGui->GetThreatRange()); aabb.accumulateBounds(player.GetTranslation() + g_tweakGui->GetThreatRange());
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, aabb, filter, nullptr); mgr.BuildNearList(nearList, aabb, filter, nullptr);
float threatDist = 9999.f; float threatDist = 9999.f;

View File

@ -443,7 +443,7 @@ void CBeetle::Generate(CStateManager& mgr, EStateMsg msg, float dt) {
if (x450_bodyController->GetCurrentStateId() != pas::EAnimationState::Generate) { if (x450_bodyController->GetCurrentStateId() != pas::EAnimationState::Generate) {
x568_stateProg = 4; x568_stateProg = 4;
} else if (x68_material.HasMaterial(EMaterialTypes::Solid) && x5a8_animTimeRem > 0.f) { } else if (x68_material.HasMaterial(EMaterialTypes::Solid) && x5a8_animTimeRem > 0.f) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, zeus::CAABox(GetTranslation() - 5.f, GetTranslation() + 5.f), mgr.BuildNearList(nearList, zeus::CAABox(GetTranslation() - 5.f, GetTranslation() + 5.f),
CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), this); CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), this);
if (!nearList.empty()) { if (!nearList.empty()) {
@ -889,7 +889,7 @@ bool CBeetle::ShouldDoubleSnap(CStateManager& mgr, float arg) {
targetPos = role->GetTeamPosition(); targetPos = role->GetTeamPosition();
zeus::CVector3f delta = targetPos - GetTranslation(); zeus::CVector3f delta = targetPos - GetTranslation();
if (delta.magSquared() > dist * dist && GetTransform().basis[1].dot(delta.normalized()) > 0.98f) { if (delta.magSquared() > dist * dist && GetTransform().basis[1].dot(delta.normalized()) > 0.98f) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, GetTranslation(), GetTransform().basis[1], x5a0_headbuttDist, mgr.BuildNearList(nearList, GetTranslation(), GetTransform().basis[1], x5a0_headbuttDist,
CMaterialFilter::MakeInclude({EMaterialTypes::Character}), this); CMaterialFilter::MakeInclude({EMaterialTypes::Character}), this);
TUniqueId bestId = kInvalidUniqueId; TUniqueId bestId = kInvalidUniqueId;
@ -915,7 +915,7 @@ bool CBeetle::ShouldJumpBack(CStateManager& mgr, float arg) {
zeus::CVector3f backDir = -GetTransform().basis[1]; zeus::CVector3f backDir = -GetTransform().basis[1];
const auto& aabb = GetBaseBoundingBox(); const auto& aabb = GetBaseBoundingBox();
zeus::CVector3f pos = GetTranslation() + zeus::CVector3f(0.f, 0.f, (aabb.max.z() - aabb.min.z()) * 0.5f); zeus::CVector3f pos = GetTranslation() + zeus::CVector3f(0.f, 0.f, (aabb.max.z() - aabb.min.z()) * 0.5f);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, pos, backDir, x5a4_jumpBackwardDist, mgr.BuildNearList(nearList, pos, backDir, x5a4_jumpBackwardDist,
CMaterialFilter::MakeInclude({EMaterialTypes::Character}), this); CMaterialFilter::MakeInclude({EMaterialTypes::Character}), this);
TUniqueId bestId = kInvalidUniqueId; TUniqueId bestId = kInvalidUniqueId;

View File

@ -177,7 +177,7 @@ void CBouncyGrenade::Explode(CStateManager& mgr, TUniqueId uid) {
if (radius > 1.f) { if (radius > 1.f) {
const zeus::CVector3f& pos = GetTranslation(); const zeus::CVector3f& pos = GetTranslation();
const CMaterialFilter filter = CMaterialFilter::MakeInclude({EMaterialTypes::Player, EMaterialTypes::Character}); const CMaterialFilter filter = CMaterialFilter::MakeInclude({EMaterialTypes::Player, EMaterialTypes::Character});
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, {pos - radius, pos + radius}, filter, nullptr); mgr.BuildNearList(nearList, {pos - radius, pos + radius}, filter, nullptr);
for (const auto& id : nearList) { for (const auto& id : nearList) {

View File

@ -191,7 +191,7 @@ void CDrone::Think(float dt, CStateManager& mgr) {
if (IsAlive() && x835_25_) { if (IsAlive() && x835_25_) {
zeus::CAABox box = GetBoundingBox(); zeus::CAABox box = GetBoundingBox();
box.accumulateBounds(GetTranslation() + 20.f * zeus::skDown); box.accumulateBounds(GetTranslation() + 20.f * zeus::skDown);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, GetBoundingBox(), CMaterialFilter::MakeInclude({EMaterialTypes::Trigger}), this); mgr.BuildNearList(nearList, GetBoundingBox(), CMaterialFilter::MakeInclude({EMaterialTypes::Trigger}), this);
for (TUniqueId id : nearList) { for (TUniqueId id : nearList) {
if (const TCastToConstPtr<CScriptWater> water = mgr.GetObjectById(id)) { if (const TCastToConstPtr<CScriptWater> water = mgr.GetObjectById(id)) {
@ -468,7 +468,7 @@ void CDrone::Patrol(CStateManager& mgr, EStateMsg msg, float dt) {
SetLightEnabled(mgr, true); SetLightEnabled(mgr, true);
x834_25_ = true; x834_25_ = true;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
BuildNearList(EMaterialTypes::Character, EMaterialTypes::Player, nearList, 5.f, mgr); BuildNearList(EMaterialTypes::Character, EMaterialTypes::Player, nearList, 5.f, mgr);
if (!nearList.empty()) { if (!nearList.empty()) {
zeus::CVector3f sep = x45c_steeringBehaviors.Separation( zeus::CVector3f sep = x45c_steeringBehaviors.Separation(
@ -878,7 +878,7 @@ bool CDrone::ShouldFire(CStateManager& mgr, float arg) {
} }
bool CDrone::HearShot(CStateManager& mgr, float arg) { bool CDrone::HearShot(CStateManager& mgr, float arg) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
BuildNearList(EMaterialTypes::Projectile, EMaterialTypes::Player, nearList, 10.f, mgr); BuildNearList(EMaterialTypes::Projectile, EMaterialTypes::Player, nearList, 10.f, mgr);
return std::any_of(nearList.begin(), nearList.end(), [&mgr](TUniqueId uid) { return std::any_of(nearList.begin(), nearList.end(), [&mgr](TUniqueId uid) {
if (TCastToConstPtr<CWeapon> wp = mgr.GetObjectById(uid)) if (TCastToConstPtr<CWeapon> wp = mgr.GetObjectById(uid))
@ -914,7 +914,7 @@ void CDrone::Burn(float duration, float damage) {
CPathFindSearch* CDrone::GetSearchPath() { return &x6b0_pathFind; } CPathFindSearch* CDrone::GetSearchPath() { return &x6b0_pathFind; }
void CDrone::BuildNearList(EMaterialTypes includeMat, EMaterialTypes excludeMat, void CDrone::BuildNearList(EMaterialTypes includeMat, EMaterialTypes excludeMat,
rstl::reserved_vector<TUniqueId, kMaxEntities>& listOut, float radius, CStateManager& mgr) { EntityList& listOut, float radius, CStateManager& mgr) {
const zeus::CVector3f pos = GetTranslation(); const zeus::CVector3f pos = GetTranslation();
mgr.BuildNearList(listOut, zeus::CAABox(pos - radius, pos + radius), mgr.BuildNearList(listOut, zeus::CAABox(pos - radius, pos + radius),
CMaterialFilter::MakeIncludeExclude({includeMat}, {excludeMat}), nullptr); CMaterialFilter::MakeIncludeExclude({includeMat}, {excludeMat}), nullptr);
@ -1004,7 +1004,7 @@ void CDrone::FireProjectile(CStateManager& mgr, const zeus::CTransform& xf, cons
void CDrone::StrafeFromCompanions(CStateManager& mgr) { void CDrone::StrafeFromCompanions(CStateManager& mgr) {
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Step) if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Step)
return; return;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
BuildNearList(EMaterialTypes::Character, EMaterialTypes::Player, nearList, x61c_, mgr); BuildNearList(EMaterialTypes::Character, EMaterialTypes::Player, nearList, x61c_, mgr);
if (nearList.empty()) if (nearList.empty())
return; return;
@ -1054,7 +1054,7 @@ void CDrone::UpdateScanner(CStateManager& mgr, float dt) {
zeus::CVector3f vec = zeus::CVector3f vec =
GetTransform().rotate(zeus::CVector3f(0.5f * std::cos(x5d8_), 1.f, 0.5f * std::sin(2.05f * x5d8_)).normalized()); GetTransform().rotate(zeus::CVector3f(0.5f * std::cos(x5d8_), 1.f, 0.5f * std::sin(2.05f * x5d8_)).normalized());
TUniqueId id; TUniqueId id;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
nearList.push_back(mgr.GetPlayer().GetUniqueId()); nearList.push_back(mgr.GetPlayer().GetUniqueId());
auto res = mgr.RayWorldIntersection( auto res = mgr.RayWorldIntersection(
id, GetLctrTransform("Beacon_LCTR"sv).origin + (0.2f * vec), vec, 10000.f, id, GetLctrTransform("Beacon_LCTR"sv).origin + (0.2f * vec), vec, 10000.f,
@ -1082,7 +1082,7 @@ void CDrone::UpdateLasers(CStateManager& mgr, float dt) {
auto box = zeus::skInvertedBox; auto box = zeus::skInvertedBox;
box.accumulateBounds(GetTranslation() + 1000.f * vec); box.accumulateBounds(GetTranslation() + 1000.f * vec);
box.accumulateBounds(GetTranslation()); box.accumulateBounds(GetTranslation());
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, box, matFilter, nullptr); mgr.BuildNearList(nearList, box, matFilter, nullptr);
TUniqueId id; TUniqueId id;
const auto result = mgr.RayWorldIntersection(id, beaconXf.origin + 2.f * vec, vec, 10000.f, matFilter, nearList); const auto result = mgr.RayWorldIntersection(id, beaconXf.origin + 2.f * vec, vec, 10000.f, matFilter, nearList);
@ -1144,7 +1144,7 @@ void CDrone::sub_80165984(CStateManager& mgr, const zeus::CTransform& xf) {
void CDrone::sub_801656d4(const zeus::CTransform& xf, CStateManager& mgr) { void CDrone::sub_801656d4(const zeus::CTransform& xf, CStateManager& mgr) {
constexpr auto matFilter = constexpr auto matFilter =
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::ProjectilePassthrough}); CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::ProjectilePassthrough});
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, xf.origin, xf.frontVector(), 100000.f, matFilter, this); mgr.BuildNearList(nearList, xf.origin, xf.frontVector(), 100000.f, matFilter, this);
TUniqueId id; TUniqueId id;
const auto result = mgr.RayWorldIntersection(id, xf.origin, xf.frontVector(), 100000.f, matFilter, nearList); const auto result = mgr.RayWorldIntersection(id, xf.origin, xf.frontVector(), 100000.f, matFilter, nearList);

View File

@ -169,7 +169,7 @@ public:
void Dead(CStateManager& mgr, EStateMsg msg, float arg) override; void Dead(CStateManager& mgr, EStateMsg msg, float arg) override;
CPathFindSearch* GetSearchPath() override; CPathFindSearch* GetSearchPath() override;
virtual void BuildNearList(EMaterialTypes includeMat, EMaterialTypes excludeMat, virtual void BuildNearList(EMaterialTypes includeMat, EMaterialTypes excludeMat,
rstl::reserved_vector<TUniqueId, kMaxEntities>& listOut, float radius, CStateManager& mgr); EntityList& listOut, float radius, CStateManager& mgr);
virtual void SetLightEnabled(CStateManager& mgr, bool activate); virtual void SetLightEnabled(CStateManager& mgr, bool activate);
virtual void SetVisorFlareEnabled(CStateManager& mgr, bool activate); virtual void SetVisorFlareEnabled(CStateManager& mgr, bool activate);
virtual void UpdateVisorFlare(CStateManager& mgr); virtual void UpdateVisorFlare(CStateManager& mgr);

View File

@ -989,14 +989,14 @@ void CElitePirate::AttractProjectiles(CStateManager& mgr) {
float radius = x5d8_data.GetProjectileAttractionRadius(); float radius = x5d8_data.GetProjectileAttractionRadius();
const zeus::CVector3f actorPos = actor->GetTranslation(); const zeus::CVector3f actorPos = actor->GetTranslation();
const zeus::CVector3f pos = GetTranslation(); const zeus::CVector3f pos = GetTranslation();
rstl::reserved_vector<TUniqueId, kMaxEntities> projNearList; EntityList projNearList;
const zeus::CAABox aabb{pos - radius, pos + radius}; const zeus::CAABox aabb{pos - radius, pos + radius};
mgr.BuildNearList(projNearList, aabb, CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), nullptr); mgr.BuildNearList(projNearList, aabb, CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), nullptr);
if (projNearList.empty()) { if (projNearList.empty()) {
return; return;
} }
rstl::reserved_vector<TUniqueId, kMaxEntities> charNearList; EntityList charNearList;
mgr.BuildNearList(charNearList, aabb, CMaterialFilter::MakeInclude({EMaterialTypes::Character}), nullptr); mgr.BuildNearList(charNearList, aabb, CMaterialFilter::MakeInclude({EMaterialTypes::Character}), nullptr);
for (const auto& projId : projNearList) { for (const auto& projId : projNearList) {
TCastToPtr<CGameProjectile> projectile = mgr.ObjectById(projId); TCastToPtr<CGameProjectile> projectile = mgr.ObjectById(projId);
@ -1157,7 +1157,7 @@ bool CElitePirate::ShouldCallForBackupFromLauncher(const CStateManager& mgr, TUn
} }
bool CElitePirate::IsClosestEnergyAttractor(const CStateManager& mgr, bool CElitePirate::IsClosestEnergyAttractor(const CStateManager& mgr,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& charNearList, const EntityList& charNearList,
const zeus::CVector3f& projectilePos) const { const zeus::CVector3f& projectilePos) const {
const float distance = (projectilePos - GetTranslation()).magSquared(); const float distance = (projectilePos - GetTranslation()).magSquared();
for (const auto& id : charNearList) { for (const auto& id : charNearList) {

View File

@ -239,7 +239,7 @@ private:
void UpdateHealthInfo(CStateManager& mgr); void UpdateHealthInfo(CStateManager& mgr);
void ExtendTouchBounds(const CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 7>& uids, void ExtendTouchBounds(const CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 7>& uids,
const zeus::CVector3f& vec) const; const zeus::CVector3f& vec) const;
bool IsClosestEnergyAttractor(const CStateManager& mgr, const rstl::reserved_vector<TUniqueId, kMaxEntities>& charNearList, bool IsClosestEnergyAttractor(const CStateManager& mgr, const EntityList& charNearList,
const zeus::CVector3f& projectilePos) const; const zeus::CVector3f& projectilePos) const;
void ShakeCamera(CStateManager& mgr); void ShakeCamera(CStateManager& mgr);
}; };

View File

@ -172,7 +172,7 @@ zeus::CVector3f CFireFlea::FindSafeRoute(CStateManager& mgr, const zeus::CVector
} }
bool CFireFlea::CheckNearWater(const CStateManager& mgr, const zeus::CVector3f& dir) const { bool CFireFlea::CheckNearWater(const CStateManager& mgr, const zeus::CVector3f& dir) const {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, GetTranslation(), dir, 2.f, CMaterialFilter::skPassEverything, nullptr); mgr.BuildNearList(nearList, GetTranslation(), dir, 2.f, CMaterialFilter::skPassEverything, nullptr);
for (const auto& id : nearList) { for (const auto& id : nearList) {

View File

@ -28,7 +28,7 @@ class CFireFlea : public CPatterned {
}; };
float x568_ = 1.f; float x568_ = 1.f;
float x56c_; float x56c_;
rstl::reserved_vector<TUniqueId, kMaxEntities> x570_nearList; EntityList x570_nearList;
zeus::CVector3f xd74_; zeus::CVector3f xd74_;
zeus::CVector3f xd80_targetPos; zeus::CVector3f xd80_targetPos;
CPathFindSearch xd8c_pathFind; CPathFindSearch xd8c_pathFind;

View File

@ -496,7 +496,7 @@ bool CFlyingPirate::Attacked(CStateManager& mgr, float arg) { return x854_ < (ar
zeus::CVector3f CFlyingPirate::AvoidActors(CStateManager& mgr) { zeus::CVector3f CFlyingPirate::AvoidActors(CStateManager& mgr) {
const zeus::CVector3f& origin = GetTranslation(); const zeus::CVector3f& origin = GetTranslation();
const zeus::CAABox box(origin - 8.f, origin + 8.f); const zeus::CAABox box(origin - 8.f, origin + 8.f);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude(EMaterialTypes::Character), this); mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude(EMaterialTypes::Character), this);
zeus::CVector3f ret; zeus::CVector3f ret;
@ -561,7 +561,7 @@ void CFlyingPirate::CheckForProjectiles(CStateManager& mgr) {
const zeus::CAABox box(playerPos - 5.f, playerPos + 5.f); const zeus::CAABox box(playerPos - 5.f, playerPos + 5.f);
x6a0_30_ = false; x6a0_30_ = false;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude(EMaterialTypes::Projectile), this); mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude(EMaterialTypes::Projectile), this);
for (const auto& id : nearList) { for (const auto& id : nearList) {
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(id)) { if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(id)) {

View File

@ -1146,7 +1146,7 @@ void CIceSheegoth::AttractProjectiles(CStateManager& mgr) {
if (!IsAlive()) if (!IsAlive())
return; return;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearProjectiles; EntityList nearProjectiles;
zeus::CAABox attractionBounds = zeus::CAABox attractionBounds =
zeus::CAABox{GetTranslation() - x56c_sheegothData.Get_x14(), GetTranslation() + x56c_sheegothData.Get_x14()}; zeus::CAABox{GetTranslation() - x56c_sheegothData.Get_x14(), GetTranslation() + x56c_sheegothData.Get_x14()};
mgr.BuildNearList(nearProjectiles, attractionBounds, CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), mgr.BuildNearList(nearProjectiles, attractionBounds, CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}),
@ -1156,7 +1156,7 @@ void CIceSheegoth::AttractProjectiles(CStateManager& mgr) {
return; return;
zeus::CVector3f attractionPos = GetEnergyAttractionPos(mgr); zeus::CVector3f attractionPos = GetEnergyAttractionPos(mgr);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearCharacters; EntityList nearCharacters;
mgr.BuildNearList(nearCharacters, attractionBounds, CMaterialFilter::MakeInclude({EMaterialTypes::Character}), mgr.BuildNearList(nearCharacters, attractionBounds, CMaterialFilter::MakeInclude({EMaterialTypes::Character}),
nullptr); nullptr);
@ -1494,7 +1494,7 @@ bool CIceSheegoth::ShouldAttractProjectile(const CGameProjectile& proj, CStateMa
return false; return false;
} }
bool CIceSheegoth::IsClosestSheegoth(CStateManager& mgr, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, bool CIceSheegoth::IsClosestSheegoth(CStateManager& mgr, const EntityList& nearList,
const zeus::CVector3f& projectileOffset) const { const zeus::CVector3f& projectileOffset) const {
zeus::CVector3f diff = projectileOffset - GetTranslation(); zeus::CVector3f diff = projectileOffset - GetTranslation();
const float diffMag = diff.magSquared(); const float diffMag = diff.magSquared();

View File

@ -186,7 +186,7 @@ class CIceSheegoth : public CPatterned {
void UpdateAttackPosition(CStateManager& mgr, zeus::CVector3f& attackPos); void UpdateAttackPosition(CStateManager& mgr, zeus::CVector3f& attackPos);
zeus::CVector3f GetEnergyAttractionPos(CStateManager& mgr) const; zeus::CVector3f GetEnergyAttractionPos(CStateManager& mgr) const;
bool ShouldAttractProjectile(const CGameProjectile& proj, CStateManager& mgr) const; bool ShouldAttractProjectile(const CGameProjectile& proj, CStateManager& mgr) const;
bool IsClosestSheegoth(CStateManager& mgr, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, bool IsClosestSheegoth(CStateManager& mgr, const EntityList& nearList,
const zeus::CVector3f& projectileOffset) const; const zeus::CVector3f& projectileOffset) const;
public: public:

View File

@ -243,7 +243,7 @@ void CMetroid::SelectTarget(CStateManager& mgr, EStateMsg msg, float arg) {
x7b0_attackTarget = player.GetUniqueId(); x7b0_attackTarget = player.GetUniqueId();
if (!x450_bodyController->HasBeenFrozen()) { if (!x450_bodyController->HasBeenFrozen()) {
float range = std::max(x3bc_detectionRange, std::sqrt(playerDistSq)); float range = std::max(x3bc_detectionRange, std::sqrt(playerDistSq));
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, zeus::CAABox{pos - range, pos + range}, mgr.BuildNearList(nearList, zeus::CAABox{pos - range, pos + range},
CMaterialFilter::MakeInclude({EMaterialTypes::Character}), nullptr); CMaterialFilter::MakeInclude({EMaterialTypes::Character}), nullptr);
CSpacePirate* closestPirate = nullptr; CSpacePirate* closestPirate = nullptr;
@ -440,7 +440,7 @@ void CMetroid::RestoreSolidCollision(CStateManager& mgr) {
CMaterialFilter::MakeInclude({EMaterialTypes::Solid, EMaterialTypes::Player, EMaterialTypes::Character}); CMaterialFilter::MakeInclude({EMaterialTypes::Solid, EMaterialTypes::Player, EMaterialTypes::Character});
float radius = x808_loopAttackDistance * GetModelData()->GetScale().y(); float radius = x808_loopAttackDistance * GetModelData()->GetScale().y();
const zeus::CAABox box{pos - radius, pos + radius}; const zeus::CAABox box{pos - radius, pos + radius};
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, box, nearFilter, this); mgr.BuildNearList(nearList, box, nearFilter, this);
if (!CGameCollision::DetectDynamicCollisionBoolean(x6a0_collisionPrimitive, GetTransform(), nearList, mgr)) { if (!CGameCollision::DetectDynamicCollisionBoolean(x6a0_collisionPrimitive, GetTransform(), nearList, mgr)) {
x9bf_31_restoreCharacterCollision = false; x9bf_31_restoreCharacterCollision = false;
@ -1309,7 +1309,7 @@ bool CMetroid::ShouldDodge(CStateManager& mgr, float arg) {
return false; return false;
} }
const auto& xf = GetTransform(); const auto& xf = GetTransform();
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, zeus::CAABox{xf.origin - 9.f, xf.origin + 9.f}, mgr.BuildNearList(nearList, zeus::CAABox{xf.origin - 9.f, xf.origin + 9.f},
CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), nullptr); CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), nullptr);
if (nearList.empty()) { if (nearList.empty()) {

View File

@ -569,7 +569,7 @@ void CMetroidPrimeEssence::sub8027d824(CStateManager& mgr) {
} }
bool CMetroidPrimeEssence::sub8027e870(const zeus::CTransform& xf, CStateManager& mgr) { bool CMetroidPrimeEssence::sub8027e870(const zeus::CTransform& xf, CStateManager& mgr) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, {xf.origin - 2.f, xf.origin + 2.f}, CMaterialFilter::MakeInclude(EMaterialTypes::AIBlock), mgr.BuildNearList(nearList, {xf.origin - 2.f, xf.origin + 2.f}, CMaterialFilter::MakeInclude(EMaterialTypes::AIBlock),
this); this);

View File

@ -1564,7 +1564,7 @@ void CMetroidPrimeExo::UpdatePlasmaProjectile(float dt, CStateManager& mgr) {
zeus::CVector3f CMetroidPrimeExo::GetTargetVector(CStateManager& mgr) { zeus::CVector3f CMetroidPrimeExo::GetTargetVector(CStateManager& mgr) {
constexpr auto MatFilter = CMaterialFilter::MakeIncludeExclude( constexpr auto MatFilter = CMaterialFilter::MakeIncludeExclude(
{EMaterialTypes::Solid}, {EMaterialTypes::Character, EMaterialTypes::Player, EMaterialTypes::Projectile}); {EMaterialTypes::Solid}, {EMaterialTypes::Character, EMaterialTypes::Player, EMaterialTypes::Projectile});
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, GetTranslation(), zeus::skDown, 150.f, MatFilter, this); mgr.BuildNearList(nearList, GetTranslation(), zeus::skDown, 150.f, MatFilter, this);
TUniqueId uid = kInvalidUniqueId; TUniqueId uid = kInvalidUniqueId;

View File

@ -389,10 +389,10 @@ void CParasite::UpdatePFDestination(CStateManager& mgr) {
void CParasite::DoFlockingBehavior(CStateManager& mgr) { void CParasite::DoFlockingBehavior(CStateManager& mgr) {
zeus::CVector3f upVec = x34_transform.basis[2]; zeus::CVector3f upVec = x34_transform.basis[2];
rstl::reserved_vector<TUniqueId, kMaxEntities> parasiteList; EntityList parasiteList;
zeus::CAABox aabb(GetTranslation() - x6e4_parasiteSearchRadius, GetTranslation() + x6e4_parasiteSearchRadius); zeus::CAABox aabb(GetTranslation() - x6e4_parasiteSearchRadius, GetTranslation() + x6e4_parasiteSearchRadius);
if ((x5d4_thinkCounter % 6) == 0) { if ((x5d4_thinkCounter % 6) == 0) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
static constexpr CMaterialFilter filter = CMaterialFilter::MakeInclude(EMaterialTypes::Character); static constexpr CMaterialFilter filter = CMaterialFilter::MakeInclude(EMaterialTypes::Character);
CParasite* closestParasite = nullptr; CParasite* closestParasite = nullptr;
float minDistSq = 2.f + x6e8_parasiteSeparationDist * x6e8_parasiteSeparationDist; float minDistSq = 2.f + x6e8_parasiteSeparationDist * x6e8_parasiteSeparationDist;

View File

@ -144,7 +144,7 @@ void CPuddleToadGamma::ShootPlayer(CStateManager& mgr, float speed) {
mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), x570_playerShootDamage, mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), x570_playerShootDamage,
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::skZero3f); CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::skZero3f);
mgr.GetPlayer().GetMorphBall()->SetAsProjectile(); mgr.GetPlayer().GetMorphBall()->SetAsProjectile();
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, GetBoundingBox(), CMaterialFilter::MakeInclude({EMaterialTypes::Bomb}), this); mgr.BuildNearList(nearList, GetBoundingBox(), CMaterialFilter::MakeInclude({EMaterialTypes::Bomb}), this);
for (TUniqueId id : nearList) { for (TUniqueId id : nearList) {
if (TCastToPtr<CBomb> bomb = mgr.ObjectById(id)) { if (TCastToPtr<CBomb> bomb = mgr.ObjectById(id)) {

View File

@ -167,8 +167,8 @@ zeus::CQuaternion CRipperControlledPlatform::Move(float arg, CStateManager& mgr)
const auto quat = zeus::CQuaternion::fromAxisAngle({0.0f, 0.0f, 1.0f}, zRot); const auto quat = zeus::CQuaternion::fromAxisAngle({0.0f, 0.0f, 1.0f}, zRot);
RotateToOR(quat, arg); RotateToOR(quat, arg);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> filteredNearList; EntityList filteredNearList;
mgr.BuildColliderList(nearList, *this, GetMotionVolume(arg)); mgr.BuildColliderList(nearList, *this, GetMotionVolume(arg));
for (const auto& id : nearList) { for (const auto& id : nearList) {
if (!IsRider(id) && !IsSlave(id)) { if (!IsRider(id) && !IsSlave(id)) {

View File

@ -52,7 +52,7 @@ private:
float x168_timeSinceHitPlayer = 0.f; float x168_timeSinceHitPlayer = 0.f;
bool x16c_hitPlayerInAir = false; bool x16c_hitPlayerInAir = false;
bool x16d_hitPlayer = false; bool x16d_hitPlayer = false;
rstl::reserved_vector<TUniqueId, kMaxEntities> x170_hitIds; EntityList x170_hitIds;
std::optional<TToken<CElectricDescription>> x974_electricDesc; std::optional<TToken<CElectricDescription>> x974_electricDesc;
TUniqueId x980_id2 = kInvalidUniqueId; TUniqueId x980_id2 = kInvalidUniqueId;

View File

@ -736,7 +736,7 @@ void CSpacePirate::CheckForProjectiles(CStateManager& mgr) {
if (x637_26_hearPlayerFire) { if (x637_26_hearPlayerFire) {
zeus::CVector3f aimPos = mgr.GetPlayer().GetAimPosition(mgr, 0.f); zeus::CVector3f aimPos = mgr.GetPlayer().GetAimPosition(mgr, 0.f);
zeus::CAABox aabb(aimPos - 5.f, aimPos + 5.f); zeus::CAABox aabb(aimPos - 5.f, aimPos + 5.f);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, aabb, CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), nullptr); mgr.BuildNearList(nearList, aabb, CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), nullptr);
for (TUniqueId id : nearList) { for (TUniqueId id : nearList) {
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(id)) { if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(id)) {
@ -2545,7 +2545,7 @@ bool CSpacePirate::HasTargetingPoint(CStateManager& mgr, float arg) {
x7c0_targetId = mgr.GetPlayer().GetUniqueId(); x7c0_targetId = mgr.GetPlayer().GetUniqueId();
float margin = x568_pirateData.x8_SearchRadius * 1.f; float margin = x568_pirateData.x8_SearchRadius * 1.f;
zeus::CAABox nearAABB(GetTranslation() - margin, GetTranslation() + margin); zeus::CAABox nearAABB(GetTranslation() - margin, GetTranslation() + margin);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, nearAABB, CMaterialFilter::MakeExclude({EMaterialTypes::Solid}), nullptr); mgr.BuildNearList(nearList, nearAABB, CMaterialFilter::MakeExclude({EMaterialTypes::Solid}), nullptr);
for (TUniqueId id : nearList) { for (TUniqueId id : nearList) {
if (TCastToConstPtr<CScriptTargetingPoint> tp = mgr.GetObjectById(id)) { if (TCastToConstPtr<CScriptTargetingPoint> tp = mgr.GetObjectById(id)) {

View File

@ -385,7 +385,7 @@ bool CTryclops::InMaxRange(CStateManager& mgr, float) {
return true; return true;
} }
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
float dectRange = x3bc_detectionRange * x3bc_detectionRange; float dectRange = x3bc_detectionRange * x3bc_detectionRange;
float dectRangeHeight = x3c0_detectionHeightRange * x3c0_detectionHeightRange; float dectRangeHeight = x3c0_detectionHeightRange * x3c0_detectionHeightRange;
@ -637,7 +637,7 @@ bool CTryclops::sub8025dbd0(CStateManager& mgr) {
constexpr CMaterialList matList{EMaterialTypes::Player, EMaterialTypes::Solid}; constexpr CMaterialList matList{EMaterialTypes::Player, EMaterialTypes::Solid};
const CCollidableSphere colSphere{zeus::CSphere{GetTranslation() + zeus::CVector3f{0.f, 0.f, ballRadius}, ballRadius}, const CCollidableSphere colSphere{zeus::CSphere{GetTranslation() + zeus::CVector3f{0.f, 0.f, ballRadius}, ballRadius},
matList}; matList};
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildColliderList(nearList, player, colSphere.CalculateLocalAABox()); mgr.BuildColliderList(nearList, player, colSphere.CalculateLocalAABox());
constexpr auto matFilter = CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::Player}); constexpr auto matFilter = CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::Player});
const zeus::CTransform skIdentity4f{}; // TODO move to zeus & make constexpr const zeus::CTransform skIdentity4f{}; // TODO move to zeus & make constexpr

View File

@ -143,7 +143,7 @@ void CWarWasp::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EU
if (mgr.GetPlayer().GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed) { if (mgr.GetPlayer().GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed) {
zeus::CVector3f delta = aimPos - xf.origin; zeus::CVector3f delta = aimPos - xf.origin;
if (delta.canBeNormalized()) { if (delta.canBeNormalized()) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
TUniqueId bestId = kInvalidUniqueId; TUniqueId bestId = kInvalidUniqueId;
CRayCastResult res = mgr.RayWorldIntersection(bestId, xf.origin, delta.normalized(), delta.magnitude(), CRayCastResult res = mgr.RayWorldIntersection(bestId, xf.origin, delta.normalized(), delta.magnitude(),
CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), nearList); CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), nearList);
@ -360,7 +360,7 @@ bool CWarWasp::PathToHiveIsClear(CStateManager& mgr) const {
zeus::CVector3f delta = x3a0_latestLeashPosition - GetTranslation(); zeus::CVector3f delta = x3a0_latestLeashPosition - GetTranslation();
if (GetTransform().basis[1].dot(delta) > 0.f) { if (GetTransform().basis[1].dot(delta) > 0.f) {
zeus::CAABox aabb(GetTranslation() - 10.f, GetTranslation() + 10.f); zeus::CAABox aabb(GetTranslation() - 10.f, GetTranslation() + 10.f);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, aabb, CMaterialFilter::MakeInclude({EMaterialTypes::Character}), nullptr); mgr.BuildNearList(nearList, aabb, CMaterialFilter::MakeInclude({EMaterialTypes::Character}), nullptr);
float deltaMagSq = delta.magSquared(); float deltaMagSq = delta.magSquared();
for (TUniqueId id : nearList) { for (TUniqueId id : nearList) {
@ -1140,7 +1140,7 @@ bool CWarWasp::ShouldFire(CStateManager& mgr, float arg) {
bool CWarWasp::ShouldDodge(CStateManager& mgr, float arg) { bool CWarWasp::ShouldDodge(CStateManager& mgr, float arg) {
zeus::CAABox aabb(GetTranslation() - 7.5f, GetTranslation() + 7.5f); zeus::CAABox aabb(GetTranslation() - 7.5f, GetTranslation() + 7.5f);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, aabb, CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), nullptr); mgr.BuildNearList(nearList, aabb, CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), nullptr);
for (TUniqueId id : nearList) { for (TUniqueId id : nearList) {
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(id)) { if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(id)) {

View File

@ -109,6 +109,7 @@ struct TUniqueId {
}; };
#define kInvalidUniqueId TUniqueId() #define kInvalidUniqueId TUniqueId()
using EntityList = rstl::reserved_vector<TUniqueId, kMaxEntities>;
using TAreaId = s32; using TAreaId = s32;

View File

@ -71,7 +71,7 @@ void CBeamProjectile::UpdateFx(const zeus::CTransform& xf, float dt, CStateManag
zeus::CVector3f{x2f4_beamRadius, x304_beamLength, x2f4_beamRadius}); zeus::CVector3f{x2f4_beamRadius, x304_beamLength, x2f4_beamRadius});
x36c_ = zeus::CAABox(zeus::CVector3f{-x2f4_beamRadius, 0.f, -x2f4_beamRadius}, x36c_ = zeus::CAABox(zeus::CVector3f{-x2f4_beamRadius, 0.f, -x2f4_beamRadius},
zeus::CVector3f{x2f4_beamRadius, x300_intBeamLength, x2f4_beamRadius}).getTransformedAABox(xf); zeus::CVector3f{x2f4_beamRadius, x300_intBeamLength, x2f4_beamRadius}).getTransformedAABox(xf);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, x36c_, CMaterialFilter::MakeExclude({EMaterialTypes::ProjectilePassthrough}), nullptr); mgr.BuildNearList(nearList, x36c_, CMaterialFilter::MakeExclude({EMaterialTypes::ProjectilePassthrough}), nullptr);
TUniqueId collideId = kInvalidUniqueId; TUniqueId collideId = kInvalidUniqueId;
CRayCastResult res = RayCollisionCheckWithWorld(collideId, x298_previousPos, beamEnd, x300_intBeamLength, nearList, mgr); CRayCastResult res = RayCollisionCheckWithWorld(collideId, x298_previousPos, beamEnd, x300_intBeamLength, nearList, mgr);

View File

@ -132,7 +132,7 @@ void CFlameThrower::UpdateFlameState(float dt, CStateManager& mgr) {
CRayCastResult CFlameThrower::DoCollisionCheck(TUniqueId& idOut, const zeus::CAABox& aabb, CStateManager& mgr) { CRayCastResult CFlameThrower::DoCollisionCheck(TUniqueId& idOut, const zeus::CAABox& aabb, CStateManager& mgr) {
CRayCastResult ret; CRayCastResult ret;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, aabb, CMaterialFilter::skPassEverything, this); mgr.BuildNearList(nearList, aabb, CMaterialFilter::skPassEverything, this);
const auto& colPoints = x34c_flameWarp.GetCollisionPoints(); const auto& colPoints = x34c_flameWarp.GetCollisionPoints();

View File

@ -216,7 +216,7 @@ CRayCastResult CGameProjectile::DoCollisionCheck(TUniqueId& idOut, CStateManager
CRayCastResult res; CRayCastResult res;
if (x2e4_24_active) { if (x2e4_24_active) {
zeus::CVector3f posDelta = x34_transform.origin - x298_previousPos; zeus::CVector3f posDelta = x34_transform.origin - x298_previousPos;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, GetProjectileBounds(), mgr.BuildNearList(nearList, GetProjectileBounds(),
CMaterialFilter::MakeExclude(EMaterialTypes::ProjectilePassthrough), this); CMaterialFilter::MakeExclude(EMaterialTypes::ProjectilePassthrough), this);
@ -257,7 +257,7 @@ void CGameProjectile::FluidFXThink(EFluidState state, CScriptWater& water, CStat
CRayCastResult CGameProjectile::RayCollisionCheckWithWorld(TUniqueId& idOut, const zeus::CVector3f& start, CRayCastResult CGameProjectile::RayCollisionCheckWithWorld(TUniqueId& idOut, const zeus::CVector3f& start,
const zeus::CVector3f& end, float mag, const zeus::CVector3f& end, float mag,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const EntityList& nearList,
CStateManager& mgr) { CStateManager& mgr) {
x2d0_touchResults.clear(); x2d0_touchResults.clear();
idOut = kInvalidUniqueId; idOut = kInvalidUniqueId;

View File

@ -76,7 +76,7 @@ public:
void ApplyDamageToActors(CStateManager& mgr, const CDamageInfo& dInfo); void ApplyDamageToActors(CStateManager& mgr, const CDamageInfo& dInfo);
void FluidFXThink(EFluidState state, CScriptWater& water, CStateManager& mgr) override; void FluidFXThink(EFluidState state, CScriptWater& water, CStateManager& mgr) override;
CRayCastResult RayCollisionCheckWithWorld(TUniqueId& idOut, const zeus::CVector3f& start, const zeus::CVector3f& end, CRayCastResult RayCollisionCheckWithWorld(TUniqueId& idOut, const zeus::CVector3f& start, const zeus::CVector3f& end,
float mag, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, float mag, const EntityList& nearList,
CStateManager& mgr); CStateManager& mgr);
CProjectileTouchResult CanCollideWith(CActor& act, CStateManager& mgr) const; CProjectileTouchResult CanCollideWith(CActor& act, CStateManager& mgr) const;
CProjectileTouchResult CanCollideWithComplexCollision(const CActor& act, const CStateManager& mgr) const; CProjectileTouchResult CanCollideWithComplexCollision(const CActor& act, const CStateManager& mgr) const;

View File

@ -430,7 +430,7 @@ bool CNewFlameThrower::UpdateParticleCollisions(float dt, CStateManager& mgr,
rstl::reserved_vector<Cube, 32>& collisions_out) { rstl::reserved_vector<Cube, 32>& collisions_out) {
x300_wasPointAdded = false; x300_wasPointAdded = false;
bool any_particle_collisions = false; bool any_particle_collisions = false;
rstl::reserved_vector<TUniqueId, kMaxEntities> near_list_cache; EntityList near_list_cache;
// rstl::reserved_vector<rstl::reserved_vector<, ?>, ?> unk_rstl_vec; // inner vectors of size 0x90c, never used // rstl::reserved_vector<rstl::reserved_vector<, ?>, ?> unk_rstl_vec; // inner vectors of size 0x90c, never used
// though // though
CCollisionInfoList cached_cinfo; CCollisionInfoList cached_cinfo;
@ -665,7 +665,7 @@ int CNewFlameThrower::SortAndFindOverlappingPoints(Cube const& box) {
} }
bool CNewFlameThrower::FindCollisionInNearList(CStateManager& mgr, bool CNewFlameThrower::FindCollisionInNearList(CStateManager& mgr,
rstl::reserved_vector<TUniqueId, kMaxEntities> const& near_list, EntityList const& near_list,
CCollisionPrimitive const& coll, TUniqueId& first_coll_out, CCollisionPrimitive const& coll, TUniqueId& first_coll_out,
CCollisionInfoList& collisions) { CCollisionInfoList& collisions) {
for (TUniqueId const& cur_uid : near_list) { for (TUniqueId const& cur_uid : near_list) {

View File

@ -77,7 +77,7 @@ class CNewFlameThrower : public CGameProjectile {
bool CanDamageActor(CActor &hit_actor, CStateManager &mgr); bool CanDamageActor(CActor &hit_actor, CStateManager &mgr);
void AddContactPoint(CCollisionInfo const& cinfo, u32 time); void AddContactPoint(CCollisionInfo const& cinfo, u32 time);
int SortAndFindOverlappingPoints(Cube const& box); int SortAndFindOverlappingPoints(Cube const& box);
bool FindCollisionInNearList(CStateManager &mgr, rstl::reserved_vector<TUniqueId, kMaxEntities> const &near_list, bool FindCollisionInNearList(CStateManager &mgr, EntityList const &near_list,
CCollisionPrimitive const& coll, TUniqueId &first_coll_out, CCollisionPrimitive const& coll, TUniqueId &first_coll_out,
CCollisionInfoList& collisions); CCollisionInfoList& collisions);
void DecrementContactPointTimers(); void DecrementContactPointTimers();

View File

@ -1943,7 +1943,7 @@ void CPlayerGun::Update(float grappleSwingT, float cameraBobT, float dt, CStateM
if (player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed && if (player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed &&
!mgr.GetCameraManager()->IsInCinematicCamera()) { !mgr.GetCameraManager()->IsInCinematicCamera()) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
zeus::CAABox aabb = x72c_currentBeam->GetBounds().getTransformedAABox(x4a8_gunWorldXf); zeus::CAABox aabb = x72c_currentBeam->GetBounds().getTransformedAABox(x4a8_gunWorldXf);
mgr.BuildNearList(nearList, aabb, sAimFilter, &player); mgr.BuildNearList(nearList, aabb, sAimFilter, &player);
TUniqueId bestId = kInvalidUniqueId; TUniqueId bestId = kInvalidUniqueId;

View File

@ -176,7 +176,7 @@ void CEnvFxManager::CalculateSnowForces(const CVectorFixed8_8& zVec,
} }
} }
void CEnvFxManager::BuildBlockObjectList(rstl::reserved_vector<TUniqueId, kMaxEntities>& list, CStateManager& mgr) { void CEnvFxManager::BuildBlockObjectList(EntityList& list, CStateManager& mgr) {
for (CEntity* ent : mgr.GetAllObjectList()) { for (CEntity* ent : mgr.GetAllObjectList()) {
const TCastToConstPtr<CScriptTrigger> trig = ent; const TCastToConstPtr<CScriptTrigger> trig = ent;
if (trig && True(trig->GetTriggerFlags() & ETriggerFlags::BlockEnvironmentalEffects)) { if (trig && True(trig->GetTriggerFlags() & ETriggerFlags::BlockEnvironmentalEffects)) {
@ -197,7 +197,7 @@ void CEnvFxManager::UpdateBlockedGrids(CStateManager& mgr, EEnvFxType type, cons
zeus::CVector2i localPlayerPos((invXf * playerPos * 256.f).toVec2f()); zeus::CVector2i localPlayerPos((invXf * playerPos * 256.f).toVec2f());
x2c_lastBlockedGridIdx = -1; x2c_lastBlockedGridIdx = -1;
x24_enableSplash = false; x24_enableSplash = false;
rstl::reserved_vector<TUniqueId, kMaxEntities> blockList; EntityList blockList;
bool blockListBuilt = false; bool blockListBuilt = false;
int blockedGrids = 0; int blockedGrids = 0;
for (int i = 0; i < x50_grids.size(); ++i) { for (int i = 0; i < x50_grids.size(); ++i) {

View File

@ -123,7 +123,7 @@ class CEnvFxManager {
void MoveWrapCells(s32, s32); void MoveWrapCells(s32, s32);
void CalculateSnowForces(const CVectorFixed8_8& zVec, rstl::reserved_vector<CVectorFixed8_8, 256>& snowForces, void CalculateSnowForces(const CVectorFixed8_8& zVec, rstl::reserved_vector<CVectorFixed8_8, 256>& snowForces,
EEnvFxType type, const zeus::CVector3f& oopbtws, float dt); EEnvFxType type, const zeus::CVector3f& oopbtws, float dt);
static void BuildBlockObjectList(rstl::reserved_vector<TUniqueId, kMaxEntities>& list, CStateManager& mgr); static void BuildBlockObjectList(EntityList& list, CStateManager& mgr);
void UpdateBlockedGrids(CStateManager& mgr, EEnvFxType type, const zeus::CTransform& camXf, void UpdateBlockedGrids(CStateManager& mgr, EEnvFxType type, const zeus::CTransform& camXf,
const zeus::CTransform& xf, const zeus::CTransform& invXf); const zeus::CTransform& xf, const zeus::CTransform& invXf);
void CreateNewParticles(EEnvFxType type); void CreateNewParticles(EEnvFxType type);

View File

@ -759,7 +759,7 @@ bool CMorphBall::FindClosestSpiderBallWaypoint(CStateManager& mgr, const zeus::C
zeus::CTransform& surfaceTransform) const { zeus::CTransform& surfaceTransform) const {
bool ret = false; bool ret = false;
const zeus::CAABox aabb(ballCenter - 2.1f, ballCenter + 2.1f); const zeus::CAABox aabb(ballCenter - 2.1f, ballCenter + 2.1f);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, aabb, CMaterialFilter::skPassEverything, nullptr); mgr.BuildNearList(nearList, aabb, CMaterialFilter::skPassEverything, nullptr);
float minDist = 2.1f; float minDist = 2.1f;
@ -1926,7 +1926,7 @@ bool CMorphBall::BallCloseToCollision(const CStateManager& mgr, float dist, cons
const CCollidableSphere sphere( const CCollidableSphere sphere(
zeus::CSphere(x0_player.GetTranslation() + zeus::CVector3f(0.f, 0.f, GetBallRadius()), dist), playerOrSolid); zeus::CSphere(x0_player.GetTranslation() + zeus::CVector3f(0.f, 0.f, GetBallRadius()), dist), playerOrSolid);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildColliderList(nearList, x0_player, sphere.CalculateLocalAABox()); mgr.BuildColliderList(nearList, x0_player, sphere.CalculateLocalAABox());
if (CGameCollision::DetectStaticCollisionBoolean(mgr, sphere, zeus::CTransform(), filter)) { if (CGameCollision::DetectStaticCollisionBoolean(mgr, sphere, zeus::CTransform(), filter)) {

View File

@ -51,7 +51,7 @@ void CMorphBallShadow::RenderIdBuffer(const zeus::CAABox& aabb, const CStateMana
float vpZ = (aabb.max.z() - aabb.min.z()) + FLT_EPSILON; float vpZ = (aabb.max.z() - aabb.min.z()) + FLT_EPSILON;
CGraphics::SetOrtho(-vpX, vpX, vpY, -vpY, 0.f, vpZ); CGraphics::SetOrtho(-vpX, vpX, vpY, -vpY, 0.f, vpZ);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearItems; EntityList nearItems;
mgr.BuildNearList(nearItems, aabb, CMaterialFilter::skPassEverything, &player); mgr.BuildNearList(nearItems, aabb, CMaterialFilter::skPassEverything, &player);
CGraphics::SetViewPointMatrix(viewMtx); CGraphics::SetViewPointMatrix(viewMtx);

View File

@ -1344,7 +1344,7 @@ pas::EStepDirection CPatterned::GetStepDirection(const zeus::CVector3f& moveVec)
bool CPatterned::IsPatternObstructed(CStateManager& mgr, const zeus::CVector3f& p0, const zeus::CVector3f& p1) const { bool CPatterned::IsPatternObstructed(CStateManager& mgr, const zeus::CVector3f& p0, const zeus::CVector3f& p1) const {
CMaterialFilter filter = CMaterialFilter::MakeInclude(EMaterialTypes::Character); CMaterialFilter filter = CMaterialFilter::MakeInclude(EMaterialTypes::Character);
zeus::CVector3f delta = p1 - p0; zeus::CVector3f delta = p1 - p0;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
bool ret = false; bool ret = false;
if (delta.canBeNormalized()) { if (delta.canBeNormalized()) {
zeus::CVector3f deltaNorm = delta.normalized(); zeus::CVector3f deltaNorm = delta.normalized();

View File

@ -1839,7 +1839,7 @@ void CPlayer::ProcessInput(const CFinalInput& input, CStateManager& mgr) {
const zeus::CAABox expandedBounds(testBounds.min - 3.f, testBounds.max + 3.f); const zeus::CAABox expandedBounds(testBounds.min - 3.f, testBounds.max + 3.f);
CAreaCollisionCache cache(expandedBounds); CAreaCollisionCache cache(expandedBounds);
CGameCollision::BuildAreaCollisionCache(mgr, cache); CGameCollision::BuildAreaCollisionCache(mgr, cache);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildColliderList(nearList, *this, expandedBounds); mgr.BuildColliderList(nearList, *this, expandedBounds);
const std::optional<zeus::CVector3f> nonIntVec = const std::optional<zeus::CVector3f> nonIntVec =
CGameCollision::FindNonIntersectingVector(mgr, cache, *this, tmpBox, nearList); CGameCollision::FindNonIntersectingVector(mgr, cache, *this, tmpBox, nearList);
@ -2285,7 +2285,7 @@ void CPlayer::UpdatePhazonDamage(float dt, CStateManager& mgr) {
constexpr CMaterialList primMaterial(EMaterialTypes::Player, EMaterialTypes::Solid); constexpr CMaterialList primMaterial(EMaterialTypes::Player, EMaterialTypes::Solid);
const CCollidableSphere prim( const CCollidableSphere prim(
zeus::CSphere(GetCollisionPrimitive()->CalculateAABox(x34_transform).center(), 4.25f), primMaterial); zeus::CSphere(GetCollisionPrimitive()->CalculateAABox(x34_transform).center(), 4.25f), primMaterial);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildColliderList(nearList, *this, prim.CalculateLocalAABox()); mgr.BuildColliderList(nearList, *this, prim.CalculateLocalAABox());
if (CGameCollision::DetectStaticCollisionBoolean(mgr, prim, zeus::CTransform(), filter)) { if (CGameCollision::DetectStaticCollisionBoolean(mgr, prim, zeus::CTransform(), filter)) {
touchingPhazon = true; touchingPhazon = true;
@ -2942,7 +2942,7 @@ u16 CPlayer::GetMaterialSoundUnderPlayer(const CStateManager& mgr, const u16* ta
u16 ret = defId; u16 ret = defId;
zeus::CAABox aabb = GetBoundingBox(); zeus::CAABox aabb = GetBoundingBox();
aabb.accumulateBounds(x34_transform.origin + zeus::skDown); aabb.accumulateBounds(x34_transform.origin + zeus::skDown);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, aabb, SolidMaterialFilter, nullptr); mgr.BuildNearList(nearList, aabb, SolidMaterialFilter, nullptr);
TUniqueId collideId = kInvalidUniqueId; TUniqueId collideId = kInvalidUniqueId;
const CRayCastResult result = const CRayCastResult result =
@ -3611,7 +3611,7 @@ void CPlayer::ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, f
bool CPlayer::ValidateFPPosition(const zeus::CVector3f& pos, const CStateManager& mgr) const { bool CPlayer::ValidateFPPosition(const zeus::CVector3f& pos, const CStateManager& mgr) const {
constexpr CMaterialFilter solidFilter = CMaterialFilter::MakeInclude({EMaterialTypes::Solid}); constexpr CMaterialFilter solidFilter = CMaterialFilter::MakeInclude({EMaterialTypes::Solid});
const zeus::CAABox aabb(x2d8_fpBounds.min - 1.f + pos, x2d8_fpBounds.max + 1.f + pos); const zeus::CAABox aabb(x2d8_fpBounds.min - 1.f + pos, x2d8_fpBounds.max + 1.f + pos);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildColliderList(nearList, *this, aabb); mgr.BuildColliderList(nearList, *this, aabb);
const CCollidableAABox colAABB({GetBaseBoundingBox().min + pos, GetBaseBoundingBox().max + pos}, {}); const CCollidableAABox colAABB({GetBaseBoundingBox().min + pos, GetBaseBoundingBox().max + pos}, {});
return !CGameCollision::DetectCollisionBoolean(mgr, colAABB, zeus::CTransform(), solidFilter, nearList); return !CGameCollision::DetectCollisionBoolean(mgr, colAABB, zeus::CTransform(), solidFilter, nearList);
@ -4147,7 +4147,7 @@ bool CPlayer::ValidateAimTargetId(TUniqueId uid, CStateManager& mgr) {
WithinOrbitScreenBox(posInBox, EPlayerZoneInfo::Targeting, x334_orbitType))) { WithinOrbitScreenBox(posInBox, EPlayerZoneInfo::Targeting, x334_orbitType))) {
const float eyeToAimMag = eyeToAim.magnitude(); const float eyeToAimMag = eyeToAim.magnitude();
if (eyeToAimMag <= g_tweakPlayer->GetAimMaxDistance()) { if (eyeToAimMag <= g_tweakPlayer->GetAimMaxDistance()) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
TUniqueId intersectId = kInvalidUniqueId; TUniqueId intersectId = kInvalidUniqueId;
eyeToAim.normalize(); eyeToAim.normalize();
mgr.BuildNearList(nearList, eyePos, eyeToAim, eyeToAimMag, OccluderFilter, act); mgr.BuildNearList(nearList, eyePos, eyeToAim, eyeToAimMag, OccluderFilter, act);
@ -4231,7 +4231,7 @@ TUniqueId CPlayer::FindAimTargetId(CStateManager& mgr) const {
} }
const zeus::CAABox aabb = BuildNearListBox(true, GetFirstPersonCameraTransform(mgr), g_tweakPlayer->GetAimBoxWidth(), const zeus::CAABox aabb = BuildNearListBox(true, GetFirstPersonCameraTransform(mgr), g_tweakPlayer->GetAimBoxWidth(),
g_tweakPlayer->GetAimBoxHeight(), dist); g_tweakPlayer->GetAimBoxHeight(), dist);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, aabb, CMaterialFilter::MakeInclude({EMaterialTypes::Target}), this); mgr.BuildNearList(nearList, aabb, CMaterialFilter::MakeInclude({EMaterialTypes::Target}), this);
return CheckEnemiesAgainstOrbitZone(nearList, EPlayerZoneInfo::Targeting, EPlayerZoneType::Ellipse, mgr); return CheckEnemiesAgainstOrbitZone(nearList, EPlayerZoneInfo::Targeting, EPlayerZoneType::Ellipse, mgr);
} }
@ -4240,7 +4240,7 @@ const zeus::CTransform& CPlayer::GetFirstPersonCameraTransform(const CStateManag
return mgr.GetCameraManager()->GetFirstPersonCamera()->GetGunFollowTransform(); return mgr.GetCameraManager()->GetFirstPersonCamera()->GetGunFollowTransform();
} }
TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const rstl::reserved_vector<TUniqueId, kMaxEntities>& list, TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const EntityList& list,
EPlayerZoneInfo info, EPlayerZoneType zone, CStateManager& mgr) const { EPlayerZoneInfo info, EPlayerZoneType zone, CStateManager& mgr) const {
const zeus::CVector3f eyePos = GetEyePosition(); const zeus::CVector3f eyePos = GetEyePosition();
float minEyeToAimMag = 10000.f; float minEyeToAimMag = 10000.f;
@ -4263,7 +4263,7 @@ TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const rstl::reserved_vector<TUni
const float eyeToAimMag = eyeToAim.magnitude(); const float eyeToAimMag = eyeToAim.magnitude();
if (eyeToAimMag <= g_tweakPlayer->GetAimMaxDistance()) { if (eyeToAimMag <= g_tweakPlayer->GetAimMaxDistance()) {
if (minEyeToAimMag - eyeToAimMag > g_tweakPlayer->GetAimThresholdDistance()) { if (minEyeToAimMag - eyeToAimMag > g_tweakPlayer->GetAimThresholdDistance()) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
TUniqueId intersectId = kInvalidUniqueId; TUniqueId intersectId = kInvalidUniqueId;
eyeToAim.normalize(); eyeToAim.normalize();
mgr.BuildNearList(nearList, eyePos, eyeToAim, eyeToAimMag, OccluderFilter, act); mgr.BuildNearList(nearList, eyePos, eyeToAim, eyeToAimMag, OccluderFilter, act);
@ -4282,7 +4282,7 @@ TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const rstl::reserved_vector<TUni
const float posInBoxTop = posInBox.y() - boxTop; const float posInBoxTop = posInBox.y() - boxTop;
const float posInBoxMagSq = posInBoxLeft * posInBoxLeft + posInBoxTop * posInBoxTop; const float posInBoxMagSq = posInBoxLeft * posInBoxLeft + posInBoxTop * posInBoxTop;
if (posInBoxMagSq < minPosInBoxMagSq) { if (posInBoxMagSq < minPosInBoxMagSq) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
TUniqueId intersectId = kInvalidUniqueId; TUniqueId intersectId = kInvalidUniqueId;
eyeToAim.normalize(); eyeToAim.normalize();
mgr.BuildNearList(nearList, eyePos, eyeToAim, eyeToAimMag, OccluderFilter, act); mgr.BuildNearList(nearList, eyePos, eyeToAim, eyeToAimMag, OccluderFilter, act);
@ -4328,7 +4328,7 @@ void CPlayer::UpdateOrbitableObjects(CStateManager& mgr) {
const CMaterialFilter filter = mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan const CMaterialFilter filter = mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan
? CMaterialFilter::MakeInclude({EMaterialTypes::Scannable}) ? CMaterialFilter::MakeInclude({EMaterialTypes::Scannable})
: CMaterialFilter::MakeInclude({EMaterialTypes::Orbit}); : CMaterialFilter::MakeInclude({EMaterialTypes::Orbit});
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, nearAABB, filter, nullptr); mgr.BuildNearList(nearList, nearAABB, filter, nullptr);
FindOrbitableObjects(nearList, x344_nearbyOrbitObjects, x330_orbitZoneMode, EPlayerZoneType::Always, mgr, true); FindOrbitableObjects(nearList, x344_nearbyOrbitObjects, x330_orbitZoneMode, EPlayerZoneType::Always, mgr, true);
@ -4361,7 +4361,7 @@ TUniqueId CPlayer::FindBestOrbitableObject(const std::vector<TUniqueId>& ids, EP
if (x310_orbitTargetId != point->GetUniqueId()) { if (x310_orbitTargetId != point->GetUniqueId()) {
if (mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::GrappleBeam) && if (mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::GrappleBeam) &&
eyeToOrbitMag < minEyeToOrbitMag && eyeToOrbitMag < g_tweakPlayer->GetOrbitDistanceMax()) { eyeToOrbitMag < minEyeToOrbitMag && eyeToOrbitMag < g_tweakPlayer->GetOrbitDistanceMax()) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
TUniqueId intersectId = kInvalidUniqueId; TUniqueId intersectId = kInvalidUniqueId;
eyeToOrbit.normalize(); eyeToOrbit.normalize();
mgr.BuildNearList(nearList, eyePos, eyeToOrbit, eyeToOrbitMag, OccluderFilter, act.GetPtr()); mgr.BuildNearList(nearList, eyePos, eyeToOrbit, eyeToOrbitMag, OccluderFilter, act.GetPtr());
@ -4393,7 +4393,7 @@ TUniqueId CPlayer::FindBestOrbitableObject(const std::vector<TUniqueId>& ids, EP
if (minEyeToOrbitMag - eyeToOrbitMag > g_tweakPlayer->GetOrbitDistanceThreshold() && if (minEyeToOrbitMag - eyeToOrbitMag > g_tweakPlayer->GetOrbitDistanceThreshold() &&
mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::Scan) { mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::Scan) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
TUniqueId idOut = kInvalidUniqueId; TUniqueId idOut = kInvalidUniqueId;
eyeToOrbit.normalize(); eyeToOrbit.normalize();
mgr.BuildNearList(nearList, eyePos, eyeToOrbit, eyeToOrbitMag, OccluderFilter, act.GetPtr()); mgr.BuildNearList(nearList, eyePos, eyeToOrbit, eyeToOrbitMag, OccluderFilter, act.GetPtr());
@ -4436,7 +4436,7 @@ TUniqueId CPlayer::FindBestOrbitableObject(const std::vector<TUniqueId>& ids, EP
const float posInBoxTop = orbitPosScreen.y() - boxTop; const float posInBoxTop = orbitPosScreen.y() - boxTop;
const float posInBoxMagSq = posInBoxLeft * posInBoxLeft + posInBoxTop * posInBoxTop; const float posInBoxMagSq = posInBoxLeft * posInBoxLeft + posInBoxTop * posInBoxTop;
if (posInBoxMagSq < minPosInBoxMagSq) { if (posInBoxMagSq < minPosInBoxMagSq) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
TUniqueId idOut = kInvalidUniqueId; TUniqueId idOut = kInvalidUniqueId;
eyeToOrbit.normalize(); eyeToOrbit.normalize();
mgr.BuildNearList(nearList, eyePos, eyeToOrbit, eyeToOrbitMag, OccluderFilter, act.GetPtr()); mgr.BuildNearList(nearList, eyePos, eyeToOrbit, eyeToOrbitMag, OccluderFilter, act.GetPtr());
@ -4478,7 +4478,7 @@ TUniqueId CPlayer::FindBestOrbitableObject(const std::vector<TUniqueId>& ids, EP
return bestId; return bestId;
} }
void CPlayer::FindOrbitableObjects(const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearObjects, void CPlayer::FindOrbitableObjects(const EntityList& nearObjects,
std::vector<TUniqueId>& listOut, EPlayerZoneInfo zone, EPlayerZoneType type, std::vector<TUniqueId>& listOut, EPlayerZoneInfo zone, EPlayerZoneType type,
CStateManager& mgr, bool onScreenTest) const { CStateManager& mgr, bool onScreenTest) const {
const CFirstPersonCamera* fpCam = mgr.GetCameraManager()->GetFirstPersonCamera(); const CFirstPersonCamera* fpCam = mgr.GetCameraManager()->GetFirstPersonCamera();
@ -5012,7 +5012,7 @@ CPlayer::EOrbitValidationResult CPlayer::ValidateCurrentOrbitTargetId(CStateMana
TUniqueId bestId = kInvalidUniqueId; TUniqueId bestId = kInvalidUniqueId;
const zeus::CVector3f eyeToOrbit = act->GetOrbitPosition(mgr) - eyePos; const zeus::CVector3f eyeToOrbit = act->GetOrbitPosition(mgr) - eyePos;
if (eyeToOrbit.canBeNormalized()) { if (eyeToOrbit.canBeNormalized()) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, eyePos, eyeToOrbit.normalized(), eyeToOrbit.magnitude(), OccluderFilter, mgr.BuildNearList(nearList, eyePos, eyeToOrbit.normalized(), eyeToOrbit.magnitude(), OccluderFilter,
act.GetPtr()); act.GetPtr());
for (auto it = nearList.begin(); it != nearList.end();) { for (auto it = nearList.begin(); it != nearList.end();) {
@ -5814,7 +5814,7 @@ bool CPlayer::CanLeaveMorphBallState(CStateManager& mgr, zeus::CVector3f& pos) c
constexpr CMaterialFilter filter = CMaterialFilter::MakeInclude({EMaterialTypes::Solid}); constexpr CMaterialFilter filter = CMaterialFilter::MakeInclude({EMaterialTypes::Solid});
const zeus::CAABox aabb(x2d8_fpBounds.min - zeus::CVector3f(1.f) + GetTranslation(), const zeus::CAABox aabb(x2d8_fpBounds.min - zeus::CVector3f(1.f) + GetTranslation(),
x2d8_fpBounds.max + zeus::CVector3f(1.f) + GetTranslation()); x2d8_fpBounds.max + zeus::CVector3f(1.f) + GetTranslation());
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildColliderList(nearList, *this, aabb); mgr.BuildColliderList(nearList, *this, aabb);
const zeus::CAABox& baseAABB = GetBaseBoundingBox(); const zeus::CAABox& baseAABB = GetBaseBoundingBox();
pos = zeus::skZero3f; pos = zeus::skZero3f;

View File

@ -485,12 +485,12 @@ public:
bool ValidateObjectForMode(TUniqueId uid, CStateManager& mgr) const; bool ValidateObjectForMode(TUniqueId uid, CStateManager& mgr) const;
TUniqueId FindAimTargetId(CStateManager& mgr) const; TUniqueId FindAimTargetId(CStateManager& mgr) const;
TUniqueId GetAimTarget() const { return x3f4_aimTarget; } TUniqueId GetAimTarget() const { return x3f4_aimTarget; }
TUniqueId CheckEnemiesAgainstOrbitZone(const rstl::reserved_vector<TUniqueId, kMaxEntities>& list, EPlayerZoneInfo info, TUniqueId CheckEnemiesAgainstOrbitZone(const EntityList& list, EPlayerZoneInfo info,
EPlayerZoneType zone, CStateManager& mgr) const; EPlayerZoneType zone, CStateManager& mgr) const;
TUniqueId FindOrbitTargetId(CStateManager& mgr) const; TUniqueId FindOrbitTargetId(CStateManager& mgr) const;
void UpdateOrbitableObjects(CStateManager& mgr); void UpdateOrbitableObjects(CStateManager& mgr);
TUniqueId FindBestOrbitableObject(const std::vector<TUniqueId>& ids, EPlayerZoneInfo info, CStateManager& mgr) const; TUniqueId FindBestOrbitableObject(const std::vector<TUniqueId>& ids, EPlayerZoneInfo info, CStateManager& mgr) const;
void FindOrbitableObjects(const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearObjects, std::vector<TUniqueId>& listOut, void FindOrbitableObjects(const EntityList& nearObjects, std::vector<TUniqueId>& listOut,
EPlayerZoneInfo zone, EPlayerZoneType type, CStateManager& mgr, bool onScreenTest) const; EPlayerZoneInfo zone, EPlayerZoneType type, CStateManager& mgr, bool onScreenTest) const;
bool WithinOrbitScreenBox(const zeus::CVector3f& screenCoords, EPlayerZoneInfo zone, EPlayerZoneType type) const; bool WithinOrbitScreenBox(const zeus::CVector3f& screenCoords, EPlayerZoneInfo zone, EPlayerZoneType type) const;
bool WithinOrbitScreenEllipse(const zeus::CVector3f& screenCoords, EPlayerZoneInfo zone) const; bool WithinOrbitScreenEllipse(const zeus::CVector3f& screenCoords, EPlayerZoneInfo zone) const;

View File

@ -125,7 +125,7 @@ void CScriptActorRotate::UpdateActors(bool next, CStateManager& mgr) {
} }
void CScriptActorRotate::UpdateSpiderBallWaypoints(CStateManager& mgr) { void CScriptActorRotate::UpdateSpiderBallWaypoints(CStateManager& mgr) {
rstl::reserved_vector<TUniqueId, kMaxEntities> waypointIds; EntityList waypointIds;
CObjectList& objectList = mgr.GetAllObjectList(); CObjectList& objectList = mgr.GetAllObjectList();
for (CEntity* ent : objectList) { for (CEntity* ent : objectList) {
if (const TCastToPtr<CScriptSpiderBallWaypoint> wp = ent) { if (const TCastToPtr<CScriptSpiderBallWaypoint> wp = ent) {

View File

@ -984,7 +984,7 @@ bool CScriptGunTurret::LineOfSightTest(CStateManager& mgr) const {
zeus::CVector3f dir = mgr.GetPlayer().GetAimPosition(mgr, 0.f) - muzzlePos; zeus::CVector3f dir = mgr.GetPlayer().GetAimPosition(mgr, 0.f) - muzzlePos;
const float mag = dir.magnitude(); const float mag = dir.magnitude();
dir = dir / mag; dir = dir / mag;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
constexpr auto filter = CMaterialFilter::MakeIncludeExclude( constexpr auto filter = CMaterialFilter::MakeIncludeExclude(
{EMaterialTypes::Solid}, {EMaterialTypes::Player, EMaterialTypes::CollisionActor}); {EMaterialTypes::Solid}, {EMaterialTypes::Player, EMaterialTypes::CollisionActor});
mgr.BuildNearList(nearList, muzzlePos, dir, mag, filter, gun.GetPtr()); mgr.BuildNearList(nearList, muzzlePos, dir, mag, filter, gun.GetPtr());

View File

@ -204,9 +204,9 @@ void CScriptPlatform::MoveRiders(CStateManager& mgr, float dt, bool active, std:
} }
} }
rstl::reserved_vector<TUniqueId, kMaxEntities> EntityList
CScriptPlatform::BuildNearListFromRiders(CStateManager& mgr, const std::vector<SRiders>& movedRiders) { CScriptPlatform::BuildNearListFromRiders(CStateManager& mgr, const std::vector<SRiders>& movedRiders) {
rstl::reserved_vector<TUniqueId, kMaxEntities> ret; EntityList ret;
for (const SRiders& rider : movedRiders) { for (const SRiders& rider : movedRiders) {
if (const TCastToConstPtr<CActor> act = mgr.ObjectById(rider.x0_uid)) { if (const TCastToConstPtr<CActor> act = mgr.ObjectById(rider.x0_uid)) {
ret.push_back(act->GetUniqueId()); ret.push_back(act->GetUniqueId());
@ -238,7 +238,7 @@ void CScriptPlatform::PreThink(float dt, CStateManager& mgr) {
MoveRiders(mgr, dt, GetActive(), x318_riders, collidedRiders, oldXf, x34_transform, x270_dragDelta, x27c_rotDelta); MoveRiders(mgr, dt, GetActive(), x318_riders, collidedRiders, oldXf, x34_transform, x270_dragDelta, x27c_rotDelta);
x356_27_squishedRider = false; x356_27_squishedRider = false;
if (!collidedRiders.empty()) { if (!collidedRiders.empty()) {
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList = BuildNearListFromRiders(mgr, collidedRiders); EntityList nearList = BuildNearListFromRiders(mgr, collidedRiders);
if (CGameCollision::DetectDynamicCollisionBoolean(*GetCollisionPrimitive(), GetPrimitiveTransform(), nearList, if (CGameCollision::DetectDynamicCollisionBoolean(*GetCollisionPrimitive(), GetPrimitiveTransform(), nearList,
mgr)) { mgr)) {
SetMotionState(mState); SetMotionState(mState);
@ -508,9 +508,9 @@ zeus::CQuaternion CScriptPlatform::Move(float dt, CStateManager& mgr) {
MoveToWR(GetTranslation() + x270_dragDelta, dt); MoveToWR(GetTranslation() + x270_dragDelta, dt);
} }
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildColliderList(nearList, *this, GetMotionVolume(dt)); mgr.BuildColliderList(nearList, *this, GetMotionVolume(dt));
rstl::reserved_vector<TUniqueId, kMaxEntities> nonRiders; EntityList nonRiders;
for (TUniqueId id : nearList) { for (TUniqueId id : nearList) {
if (!IsRider(id) && !IsSlave(id)) { if (!IsRider(id) && !IsSlave(id)) {
nonRiders.push_back(id); nonRiders.push_back(id);

View File

@ -70,7 +70,7 @@ class CScriptPlatform : public CPhysicsActor {
std::vector<SRiders>& collidedRiders, const zeus::CTransform& oldXf, std::vector<SRiders>& collidedRiders, const zeus::CTransform& oldXf,
const zeus::CTransform& newXf, const zeus::CVector3f& dragDelta, const zeus::CTransform& newXf, const zeus::CVector3f& dragDelta,
const zeus::CQuaternion& rotDelta); const zeus::CQuaternion& rotDelta);
static rstl::reserved_vector<TUniqueId, kMaxEntities> BuildNearListFromRiders(CStateManager& mgr, static EntityList BuildNearListFromRiders(CStateManager& mgr,
const std::vector<SRiders>& movedRiders); const std::vector<SRiders>& movedRiders);
std::optional<CAABoxShader> m_boxFilter; std::optional<CAABoxShader> m_boxFilter;

View File

@ -831,7 +831,7 @@ void CScriptSpecialFunction::ThinkObjectFollowObject(float, CStateManager& mgr)
void CScriptSpecialFunction::ThinkChaffTarget(float dt, CStateManager& mgr) { void CScriptSpecialFunction::ThinkChaffTarget(float dt, CStateManager& mgr) {
const zeus::CAABox box(5.f - GetTranslation(), 5.f + GetTranslation()); const zeus::CAABox box(5.f - GetTranslation(), 5.f + GetTranslation());
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList; EntityList nearList;
mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), nullptr); mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), nullptr);
CCameraFilterPassPoly& filter = mgr.GetCameraFilterPass(7); CCameraFilterPassPoly& filter = mgr.GetCameraFilterPass(7);

View File

@ -46,7 +46,7 @@ void CVisorFlare::Update(float dt, const zeus::CVector3f& pos, const CActor* act
zeus::CVector3f camPos = mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTranslation(); zeus::CVector3f camPos = mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTranslation();
zeus::CVector3f camDiff = pos - camPos; zeus::CVector3f camDiff = pos - camPos;
const float mag = (camDiff.magnitude()); const float mag = (camDiff.magnitude());
rstl::reserved_vector<TUniqueId, kMaxEntities> nearVec; EntityList nearVec;
mgr.BuildNearList(nearVec, camPos, camDiff * (1.f / mag), mag, mgr.BuildNearList(nearVec, camPos, camDiff * (1.f / mag), mag,
CMaterialFilter::MakeInclude({EMaterialTypes::Occluder}), act); CMaterialFilter::MakeInclude({EMaterialTypes::Occluder}), act);
TUniqueId id; TUniqueId id;