De-hardcode max entity count

This commit is contained in:
Phillip Stephens 2021-06-06 16:53:41 -07:00
parent 89378700f7
commit 5f1aed51cb
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
64 changed files with 246 additions and 238 deletions

View File

@ -27,7 +27,7 @@ class CObjectList {
s16 next = -1;
s16 prev = -1;
};
std::array<SObjectListEntry, 1024> x0_list; // was an rstl::prereserved_vector
std::array<SObjectListEntry, kMaxEntities> x0_list; // was an rstl::reserved_vector
EGameObjectList x2004_listEnum;
s16 x2008_firstId = -1;
u16 x200a_count = 0;

View File

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

View File

@ -11,7 +11,7 @@ namespace metaforce {
enum class ESortedList { MinX, MinY, MinZ, MaxX, MaxY, MaxZ };
struct SSortedList {
std::array<s16, 1024> x0_ids;
std::array<s16, kMaxEntities> x0_ids;
u32 x800_size = 0;
void Reset() { x0_ids.fill(-1); }
SSortedList() { Reset(); }
@ -28,7 +28,7 @@ class CSortedListManager {
SNode() = default;
SNode(const CActor* act, const zeus::CAABox& aabb) : x0_actor(act), x4_box(aabb), x2a_populated(true) {}
};
std::array<SNode, 1024> x0_nodes;
std::array<SNode, kMaxEntities> x0_nodes;
std::array<SSortedList, 6> xb000_sortedLists;
void Reset();
void AddToLinkedList(s16 nodeId, s16& headId, s16& tailId);
@ -43,10 +43,10 @@ class CSortedListManager {
public:
CSortedListManager();
void BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& out, const zeus::CVector3f& pos,
void BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& out, const zeus::CVector3f& pos,
const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter, const CActor* actor);
void BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& out, const CActor& actor, const zeus::CAABox& aabb);
void BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& out, const zeus::CAABox& aabb,
void BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& out, const CActor& actor, const zeus::CAABox& aabb);
void BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& out, const zeus::CAABox& aabb,
const CMaterialFilter& filter, const CActor* actor);
void Remove(const CActor* actor);
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();
zeus::CAABox camAABB(camTranslation, camTranslation);
camAABB.accumulateBounds(x84c_player->GetTranslation());
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
BuildNearList(nearList, camAABB,
CMaterialFilter(EMaterialTypes::AIBlock, CMaterialList(), CMaterialFilter::EFilterType::Include),
nullptr);
@ -811,7 +811,7 @@ void CStateManager::DrawWorld() {
bool morphingPlayerVisible = false;
int thermalActorCount = 0;
std::array<CActor*, 1024> thermalActorArr;
std::array<CActor*, kMaxEntities> thermalActorArr;
for (int i = 0; i < areaCount; ++i) {
const CGameArea& area = *areaArr[i];
CPVSVisSet& pvs = pvsArr[i];
@ -1696,7 +1696,7 @@ void CStateManager::ApplyDamageToWorld(TUniqueId damager, const CActor& actor, c
bomb = True(weapon->GetAttribField() & (EProjectileAttrib::Bombs | EProjectileAttrib::PowerBombs));
}
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
BuildNearList(nearList, aabb, filter, &actor);
for (const auto& id : nearList) {
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,
const CDamageInfo& info, const CMaterialFilter& filter) {
const zeus::CAABox aabb(damager.GetTranslation() - info.GetRadius(), damager.GetTranslation() + info.GetRadius());
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
BuildNearList(nearList, aabb, filter, nullptr);
for (const auto& id : nearList) {
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,
const rstl::reserved_vector<TUniqueId, 1024>& nearList) const {
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList) const {
const CHealthInfo* hInfo = const_cast<CActor&>(damagee).HealthInfo(const_cast<CStateManager&>(*this));
if (hInfo == nullptr) {
return false;
@ -1846,20 +1846,20 @@ bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CV
zeus::CVector3f delta = end - start;
const float mag = delta.magnitude();
delta = delta / mag;
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
BuildNearList(nearList, start, delta, mag, filter, damagee);
return RayCollideWorldInternal(start, end, filter, nearList, damagee);
}
bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
const CMaterialFilter& filter, const CActor* damagee) const {
return RayCollideWorldInternal(start, end, filter, nearList, damagee);
}
bool CStateManager::RayCollideWorldInternal(const zeus::CVector3f& start, const zeus::CVector3f& end,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
const CActor* damagee) const {
const zeus::CVector3f delta = end - start;
if (!delta.canBeNormalized()) {
@ -2373,8 +2373,8 @@ void CStateManager::MoveActors(float dt) {
}
void CStateManager::CrossTouchActors() {
std::array<bool, 1024> visits{};
rstl::reserved_vector<TUniqueId, 1024> nearList;
std::array<bool, kMaxEntities> visits{};
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
for (CEntity* ent : GetActorObjectList()) {
if (ent == nullptr) {
@ -2681,18 +2681,18 @@ void CStateManager::AreaLoaded(TAreaId aid) {
x880_envFxManager->AreaLoaded();
}
void CStateManager::BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& listOut, const zeus::CVector3f& v1,
void CStateManager::BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& listOut, const zeus::CVector3f& v1,
const zeus::CVector3f& v2, float f1, const CMaterialFilter& filter,
const CActor* actor) const {
x874_sortedListManager->BuildNearList(listOut, v1, v2, f1, filter, actor);
}
void CStateManager::BuildColliderList(rstl::reserved_vector<TUniqueId, 1024>& listOut, const CActor& actor,
void CStateManager::BuildColliderList(rstl::reserved_vector<TUniqueId, kMaxEntities>& listOut, const CActor& actor,
const zeus::CAABox& aabb) const {
x874_sortedListManager->BuildNearList(listOut, actor, aabb);
}
void CStateManager::BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& listOut, const zeus::CAABox& aabb,
void CStateManager::BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& listOut, const zeus::CAABox& aabb,
const CMaterialFilter& filter, const CActor* actor) const {
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,
const zeus::CVector3f& dir, float length,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& list) const {
const rstl::reserved_vector<TUniqueId, kMaxEntities>& list) const {
return CGameCollision::RayWorldIntersection(*this, idOut, pos, dir, length, filter, list);
}

View File

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

View File

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

View File

@ -212,11 +212,11 @@ private:
int numObscured) const;
zeus::CVector3f ApplyColliders();
void UpdateColliders(const zeus::CTransform& xf, std::vector<CCameraCollider>& colliderList, int& it, int count,
float tolerance, const rstl::reserved_vector<TUniqueId, 1024>& nearList, float dt,
float tolerance, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, float dt,
CStateManager& mgr);
zeus::CVector3f AvoidGeometry(const zeus::CTransform& xf, const rstl::reserved_vector<TUniqueId, 1024>& nearList,
zeus::CVector3f AvoidGeometry(const zeus::CTransform& xf, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
float dt, CStateManager& mgr);
zeus::CVector3f AvoidGeometryFull(const zeus::CTransform& xf, const rstl::reserved_vector<TUniqueId, 1024>& nearList,
zeus::CVector3f AvoidGeometryFull(const zeus::CTransform& xf, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
float dt, CStateManager& mgr);
zeus::CAABox CalculateCollidersBoundingBox(const std::vector<CCameraCollider>& colliderList,
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,
const rstl::reserved_vector<TUniqueId, 1024>* nearList) {
const rstl::reserved_vector<TUniqueId, kMaxEntities>* nearList) {
CMotionState oldState = actor.GetMotionState();
CMotionState newState = actor.PredictMotion_Internal(dt);
float deltaMag = newState.x0_translation.magnitude();
TUniqueId idDetect = kInvalidUniqueId;
CCollisionInfoList collisionList;
zeus::CAABox motionVol = actor.GetMotionVolume(dt);
rstl::reserved_vector<TUniqueId, 1024> useColliderList;
rstl::reserved_vector<TUniqueId, kMaxEntities> useColliderList;
if (nearList != nullptr) {
useColliderList = *nearList;
}
@ -114,7 +114,7 @@ void CGroundMovement::MoveGroundCollider(CStateManager& mgr, CPhysicsActor& acto
}
bool CGroundMovement::ResolveUpDown(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor,
const CMaterialFilter& filter, rstl::reserved_vector<TUniqueId, 1024>& nearList,
const CMaterialFilter& filter, rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
float stepUp, float stepDown, float& fOut, CCollisionInfoList& list) {
float zextent = stepDown;
if (list.GetCount() <= 0) {
@ -178,7 +178,7 @@ bool CGroundMovement::ResolveUpDown(CAreaCollisionCache& cache, CStateManager& m
bool CGroundMovement::MoveGroundColliderZ(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor,
const CMaterialFilter& filter,
rstl::reserved_vector<TUniqueId, 1024>& nearList, float amt, float& resolved,
rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, float amt, float& resolved,
CCollisionInfoList& list, TUniqueId& idOut) {
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,
const CMaterialFilter& filter,
rstl::reserved_vector<TUniqueId, 1024>& nearList, float dt) {
rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, float dt) {
bool didCollide = false;
bool isPlayer = actor.GetMaterialList().HasMaterial(EMaterialTypes::Player);
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,
const rstl::reserved_vector<TUniqueId, 1024>* nearList) {
const rstl::reserved_vector<TUniqueId, kMaxEntities>* nearList) {
zeus::CAABox motionVol = actor.GetMotionVolume(dt);
rstl::reserved_vector<TUniqueId, 1024> useNearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> useNearList;
if (nearList != nullptr) {
useNearList = *nearList;
} else {
@ -638,7 +638,7 @@ static bool RemovePositiveZComponentFromNormal(zeus::CVector3f& vec) {
}
CMaterialList CGroundMovement::MoveObjectAnalytical(CStateManager& mgr, CPhysicsActor& actor, float dt,
rstl::reserved_vector<TUniqueId, 1024>& nearList,
rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
CAreaCollisionCache& cache, const SMovementOptions& opts,
SMoveObjectResult& result) {
result.x6c_processedCollisions = 0;

View File

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

View File

@ -226,7 +226,7 @@ bool CRagDoll::SatisfyWorldConstraints(CStateManager& mgr, int pass) {
else
exclude = CMaterialList(EMaterialTypes::Character, EMaterialTypes::Player);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
CMaterialFilter filter = CMaterialFilter::MakeIncludeExclude(include, exclude);
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();
}
zeus::CVector3f CSteeringBehaviors::Alignment(const CPhysicsActor& actor, rstl::reserved_vector<TUniqueId, 1024>& list,
zeus::CVector3f CSteeringBehaviors::Alignment(const CPhysicsActor& actor, rstl::reserved_vector<TUniqueId, kMaxEntities>& list,
const CStateManager& mgr) const {
zeus::CVector3f align;
@ -71,7 +71,7 @@ zeus::CVector3f CSteeringBehaviors::Alignment(const CPhysicsActor& actor, rstl::
return align * (diff / M_PIF);
}
zeus::CVector3f CSteeringBehaviors::Cohesion(const CPhysicsActor& actor, rstl::reserved_vector<TUniqueId, 1024>& list,
zeus::CVector3f CSteeringBehaviors::Cohesion(const CPhysicsActor& actor, rstl::reserved_vector<TUniqueId, kMaxEntities>& list,
float dampingRadius, const CStateManager& mgr) const {
zeus::CVector3f dest;
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 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 Alignment(const CPhysicsActor& actor, rstl::reserved_vector<TUniqueId, 1024>& list,
zeus::CVector3f Alignment(const CPhysicsActor& actor, rstl::reserved_vector<TUniqueId, kMaxEntities>& list,
const CStateManager& mgr) const;
zeus::CVector3f Cohesion(const CPhysicsActor& actor, rstl::reserved_vector<TUniqueId, 1024>& list,
zeus::CVector3f Cohesion(const CPhysicsActor& actor, rstl::reserved_vector<TUniqueId, kMaxEntities>& list,
float dampingRadius, const CStateManager& mgr) const;
zeus::CVector2f Flee2D(const CPhysicsActor& actor, const zeus::CVector2f& v0) const;
zeus::CVector2f Arrival2D(const CPhysicsActor& actor, const zeus::CVector2f& v0) const;

View File

@ -23,8 +23,8 @@ class CPreAdvanceIndicator {
/*
u32 x10_;
u32 x14_;
u32 x18_;
u32 x1c_;
u32 x18_fireTime;
u32 x1c_damageDelay;
u32 x20_;
u32 x24_;
u32 x28_;

View File

@ -59,7 +59,7 @@ void CGameCollision::InitCollision() {
}
void CGameCollision::MovePlayer(CStateManager& mgr, CPhysicsActor& actor, float dt,
const rstl::reserved_vector<TUniqueId, 1024>* colliderList) {
const rstl::reserved_vector<TUniqueId, kMaxEntities>* colliderList) {
actor.SetAngularEnabled(true);
actor.AddMotionState(actor.PredictAngularMotion(dt));
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,
const rstl::reserved_vector<TUniqueId, 1024>* colliderList) {
const rstl::reserved_vector<TUniqueId, kMaxEntities>* colliderList) {
bool isPlayer = actor.GetMaterialList().HasMaterial(EMaterialTypes::Player);
bool r28 = false;
bool r27 = false;
@ -94,7 +94,7 @@ void CGameCollision::MoveAndCollide(CStateManager& mgr, CPhysicsActor& actor, fl
float m3 = 0.001f / actor.GetCollisionAccuracyModifier();
zeus::CAABox motionVol = actor.GetMotionVolume(dt);
rstl::reserved_vector<TUniqueId, 1024> useColliderList;
rstl::reserved_vector<TUniqueId, kMaxEntities> useColliderList;
if (colliderList)
useColliderList = *colliderList;
else
@ -196,7 +196,7 @@ zeus::CVector3f CGameCollision::GetActorRelativeVelocities(const CPhysicsActor&
}
void CGameCollision::Move(CStateManager& mgr, CPhysicsActor& actor, float dt,
const rstl::reserved_vector<TUniqueId, 1024>* colliderList) {
const rstl::reserved_vector<TUniqueId, kMaxEntities>* colliderList) {
if (!actor.IsMovable())
return;
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,
const zeus::CVector3f& pos, const zeus::CVector3f& dir,
float length, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList) {
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList) {
CRayCastResult ret;
float bestT = length;
if (bestT <= 0.f) {
@ -323,7 +323,7 @@ CRayCastResult CGameCollision::RayDynamicIntersection(const CStateManager& mgr,
bool CGameCollision::RayDynamicIntersectionBool(const CStateManager& mgr, const zeus::CVector3f& pos,
const zeus::CVector3f& dir, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
const CActor* damagee, float length) {
if (length <= 0.f) {
length = 100000.f;
@ -350,7 +350,7 @@ bool CGameCollision::RayDynamicIntersectionBool(const CStateManager& mgr, const
CRayCastResult CGameCollision::RayWorldIntersection(const CStateManager& mgr, TUniqueId& idOut,
const zeus::CVector3f& pos, const zeus::CVector3f& dir, float mag,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList) {
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList) {
CRayCastResult staticRes = RayStaticIntersection(mgr, pos, dir, mag, filter);
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,
const zeus::CTransform& xf, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList) {
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList) {
if (!filter.GetExcludeList().HasMaterial(EMaterialTypes::NoStaticCollision) &&
DetectStaticCollisionBoolean(mgr, prim, xf, filter)) {
return true;
@ -419,7 +419,7 @@ bool CGameCollision::DetectCollisionBoolean(const CStateManager& mgr, const CCol
bool CGameCollision::DetectCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList) {
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList) {
if (!filter.GetExcludeList().HasMaterial(EMaterialTypes::NoStaticCollision) &&
DetectStaticCollisionBoolean_Cached(mgr, cache, prim, xf, filter)) {
return true;
@ -501,7 +501,7 @@ bool CGameCollision::DetectStaticCollisionBoolean_Cached(const CStateManager& mg
}
bool CGameCollision::DetectDynamicCollisionBoolean(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
const CStateManager& mgr) {
for (const auto& id : nearList) {
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,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList, TUniqueId& idOut,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, TUniqueId& idOut,
CCollisionInfoList& infoList) {
idOut = kInvalidUniqueId;
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,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
const zeus::CVector3f& dir, TUniqueId& idOut,
CCollisionInfo& infoOut, double& d) {
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,
const rstl::reserved_vector<TUniqueId, 1024>& nearList, TUniqueId& idOut,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, TUniqueId& idOut,
CCollisionInfoList& list, const CStateManager& mgr) {
for (const auto& id : nearList) {
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,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
const zeus::CVector3f& dir, TUniqueId& idOut, CCollisionInfo& infoOut,
double& dOut, const CStateManager& mgr) {
bool ret = false;
@ -729,7 +729,7 @@ bool CGameCollision::DetectDynamicCollisionMoving(const CCollisionPrimitive& pri
bool CGameCollision::DetectCollision(const CStateManager& mgr, const CCollisionPrimitive& prim,
const zeus::CTransform& xf, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList, TUniqueId& idOut,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, TUniqueId& idOut,
CCollisionInfoList& infoOut) {
bool ret = false;
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,
const CCollisionPrimitive& prim,
const rstl::reserved_vector<TUniqueId, 1024>& nearList, float f1,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, float f1,
u32 failsafeTicks) {
actor.MoveCollisionPrimitive(zeus::skZero3f);
if (f1 > 0.5f) {
@ -943,7 +943,7 @@ void CGameCollision::CollisionFailsafe(const CStateManager& mgr, CAreaCollisionC
std::optional<zeus::CVector3f>
CGameCollision::FindNonIntersectingVector(const CStateManager& mgr, CAreaCollisionCache& cache, CPhysicsActor& actor,
const CCollisionPrimitive& prim,
const rstl::reserved_vector<TUniqueId, 1024>& nearList) {
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList) {
zeus::CTransform xf = actor.GetPrimitiveTransform();
zeus::CVector3f origOrigin = xf.origin;
zeus::CVector3f center = prim.CalculateAABox(xf).center();

View File

@ -25,9 +25,9 @@ class ICollisionFilter;
class CGameCollision {
static void MovePlayer(CStateManager& mgr, CPhysicsActor& actor, float dt,
const rstl::reserved_vector<TUniqueId, 1024>* colliderList);
const rstl::reserved_vector<TUniqueId, kMaxEntities>* colliderList);
static void MoveAndCollide(CStateManager& mgr, CPhysicsActor& actor, float dt, const ICollisionFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>* colliderList);
const rstl::reserved_vector<TUniqueId, kMaxEntities>* colliderList);
static zeus::CVector3f GetActorRelativeVelocities(const CPhysicsActor& act0, const CPhysicsActor* act1);
public:
@ -39,7 +39,7 @@ public:
static bool NullCollisionCollider(const CInternalCollisionStructure&, CCollisionInfoList&) { return false; }
static void InitCollision();
static void Move(CStateManager& mgr, CPhysicsActor& actor, float dt,
const rstl::reserved_vector<TUniqueId, 1024>* colliderList);
const rstl::reserved_vector<TUniqueId, kMaxEntities>* colliderList);
static bool CanBlock(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);
static CRayCastResult RayDynamicIntersection(const CStateManager& mgr, TUniqueId& idOut, const zeus::CVector3f& pos,
const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList);
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList);
static bool RayDynamicIntersectionBool(const CStateManager& mgr, const zeus::CVector3f& pos,
const zeus::CVector3f& dir, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList, const CActor* damagee,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const CActor* damagee,
float length);
static CRayCastResult RayWorldIntersection(const CStateManager& mgr, TUniqueId& idOut, const zeus::CVector3f& pos,
const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList);
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList);
static bool RayStaticIntersectionArea(const CGameArea& area, const zeus::CVector3f& pos, const zeus::CVector3f& dir,
float mag, const CMaterialFilter& filter);
static void BuildAreaCollisionCache(const CStateManager& mgr, CAreaCollisionCache& cache);
static float GetMinExtentForCollisionPrimitive(const CCollisionPrimitive& prim);
static bool DetectCollisionBoolean(const CStateManager& mgr, const CCollisionPrimitive& prim,
const zeus::CTransform& xf, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList);
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList);
static bool DetectCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList);
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList);
static bool DetectStaticCollisionBoolean(const CStateManager& mgr, const CCollisionPrimitive& prim,
const zeus::CTransform& xf, const CMaterialFilter& filter);
static bool DetectStaticCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter);
static bool DetectDynamicCollisionBoolean(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
const CStateManager& mgr);
static bool DetectCollision_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList, TUniqueId& idOut,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, TUniqueId& idOut,
CCollisionInfoList& infoList);
static bool DetectCollision_Cached_Moving(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
const zeus::CVector3f& vec, TUniqueId& idOut, CCollisionInfo& infoOut,
double&);
static bool DetectStaticCollision(const CStateManager& mgr, const CCollisionPrimitive& prim,
@ -99,14 +99,14 @@ public:
const CMaterialFilter& filter, const zeus::CVector3f& vec,
CCollisionInfo& infoOut, double& d);
static bool DetectDynamicCollision(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, 1024>& nearList, TUniqueId& idOut,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, TUniqueId& idOut,
CCollisionInfoList& list, const CStateManager& mgr);
static bool DetectDynamicCollisionMoving(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
const zeus::CVector3f& vec, TUniqueId& idOut, CCollisionInfo& infoOut,
double& d, const CStateManager& mgr);
static bool DetectCollision(const CStateManager& mgr, const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter, const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const CMaterialFilter& filter, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
TUniqueId& idOut, CCollisionInfoList& infoOut);
static void MakeCollisionCallbacks(CStateManager& mgr, CPhysicsActor& actor, TUniqueId id,
const CCollisionInfoList& list);
@ -117,11 +117,11 @@ public:
static void CollideWithStaticBodyNoRot(CPhysicsActor& a0, const CMaterialList& m0, const CMaterialList& m1,
const zeus::CUnitVector3f& normal, float restitution, bool);
static void CollisionFailsafe(const CStateManager& mgr, CAreaCollisionCache& cache, CPhysicsActor& actor,
const CCollisionPrimitive& prim, const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const CCollisionPrimitive& prim, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
float, u32 failsafeTicks);
static std::optional<zeus::CVector3f>
FindNonIntersectingVector(const CStateManager& mgr, CAreaCollisionCache& cache, CPhysicsActor& actor,
const CCollisionPrimitive& prim, const rstl::reserved_vector<TUniqueId, 1024>& nearList);
const CCollisionPrimitive& prim, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList);
static void AvoidStaticCollisionWithinRadius(const CStateManager& mgr, CPhysicsActor& actor, u32 iterations, float dt,
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) {
TUniqueId cid = kInvalidUniqueId;
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
CRayCastResult resD = CGameCollision::RayDynamicIntersection(
mgr, cid, pos, zeus::skDown, x40_maxObjHeight, CMaterialFilter::skPassEverything, nearList);
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().y() + drawParms.x78_xyRadius, player.GetTranslation().z() + drawParms.x7c_zRadius);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, radarBounds,
CMaterialFilter(CMaterialList(EMaterialTypes::Target, EMaterialTypes::RadarObject),
CMaterialList(EMaterialTypes::ExcludeFromRadar),

View File

@ -18,7 +18,7 @@ void ClearIniSettings();
namespace metaforce {
std::array<ImGuiEntityEntry, 1024> ImGuiConsole::entities;
std::array<ImGuiEntityEntry, kMaxEntities> ImGuiConsole::entities;
std::set<TUniqueId> ImGuiConsole::inspectingEntities;
ImGuiPlayerLoadouts ImGuiConsole::loadouts;
@ -246,7 +246,7 @@ void ImGuiConsole::ShowInspectWindow(bool* isOpen) {
if (ImGui::Begin("Inspect", isOpen)) {
CObjectList& list = g_StateManager->GetAllObjectList();
ImGui::Text("Objects: %d / 1024", list.size());
ImGui::Text("Objects: %d / %d", list.size(), kMaxEntities);
ImGui::SameLine();
if (ImGui::SmallButton("Deselect all")) {
for (auto* const ent : list) {
@ -710,17 +710,7 @@ void ImGuiConsole::ShowDebugOverlay() {
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing |
ImGuiWindowFlags_NoNav;
if (m_debugOverlayCorner != -1) {
const ImGuiViewport* viewport = ImGui::GetMainViewport();
ImVec2 workPos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any!
ImVec2 workSize = viewport->WorkSize;
ImVec2 windowPos;
ImVec2 windowPosPivot;
constexpr float padding = 10.0f;
windowPos.x = (m_debugOverlayCorner & 1) != 0 ? (workPos.x + workSize.x - padding) : (workPos.x + padding);
windowPos.y = (m_debugOverlayCorner & 2) != 0 ? (workPos.y + workSize.y - padding) : (workPos.y + padding);
windowPosPivot.x = (m_debugOverlayCorner & 1) != 0 ? 1.0f : 0.0f;
windowPosPivot.y = (m_debugOverlayCorner & 2) != 0 ? 1.0f : 0.0f;
ImGui::SetNextWindowPos(windowPos, ImGuiCond_Always, windowPosPivot);
SetOverlayWindowLocation(m_debugOverlayCorner);
windowFlags |= ImGuiWindowFlags_NoMove;
}
ImGui::SetNextWindowBgAlpha(0.65f);

View File

@ -34,7 +34,7 @@ struct ImGuiEntityEntry {
class ImGuiConsole {
public:
static std::set<TUniqueId> inspectingEntities;
static std::array<ImGuiEntityEntry, 1024> entities;
static std::array<ImGuiEntityEntry, kMaxEntities> entities;
static ImGuiPlayerLoadouts loadouts;
ImGuiConsole(hecl::CVarManager& cvarMgr, hecl::CVarCommons& cvarCommons)

View File

@ -442,7 +442,7 @@ IMGUI_ENTITY_INSPECT(CScriptDistanceFog, CEntity, ScriptDistanceFog, {})
IMGUI_ENTITY_INSPECT(CScriptDockAreaChange, CEntity, ScriptDockAreaChange, {})
IMGUI_ENTITY_INSPECT(CScriptGenerator, CEntity, ScriptGenerator, {
int count = x34_spawnCount;
if (ImGui::SliderInt("Spawn Count", &count, 0, 1024)) {
if (ImGui::SliderInt("Spawn Count", &count, 0, kMaxEntities)) {
x34_spawnCount = count;
}
BITFIELD_CHECKBOX("Don't Reuse Followers", x38_24_noReuseFollowers);

View File

@ -533,7 +533,7 @@ void CSamusHud::UpdateThreatAssessment(float dt, const CStateManager& mgr) {
zeus::CAABox aabb;
aabb.accumulateBounds(player.GetTranslation() - g_tweakGui->GetThreatRange());
aabb.accumulateBounds(player.GetTranslation() + g_tweakGui->GetThreatRange());
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, aabb, filter, nullptr);
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) {
x568_stateProg = 4;
} else if (x68_material.HasMaterial(EMaterialTypes::Solid) && x5a8_animTimeRem > 0.f) {
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, zeus::CAABox(GetTranslation() - 5.f, GetTranslation() + 5.f),
CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), this);
if (!nearList.empty()) {
@ -889,7 +889,7 @@ bool CBeetle::ShouldDoubleSnap(CStateManager& mgr, float arg) {
targetPos = role->GetTeamPosition();
zeus::CVector3f delta = targetPos - GetTranslation();
if (delta.magSquared() > dist * dist && GetTransform().basis[1].dot(delta.normalized()) > 0.98f) {
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, GetTranslation(), GetTransform().basis[1], x5a0_headbuttDist,
CMaterialFilter::MakeInclude({EMaterialTypes::Character}), this);
TUniqueId bestId = kInvalidUniqueId;
@ -915,7 +915,7 @@ bool CBeetle::ShouldJumpBack(CStateManager& mgr, float arg) {
zeus::CVector3f backDir = -GetTransform().basis[1];
const auto& aabb = GetBaseBoundingBox();
zeus::CVector3f pos = GetTranslation() + zeus::CVector3f(0.f, 0.f, (aabb.max.z() - aabb.min.z()) * 0.5f);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, pos, backDir, x5a4_jumpBackwardDist,
CMaterialFilter::MakeInclude({EMaterialTypes::Character}), this);
TUniqueId bestId = kInvalidUniqueId;

View File

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

View File

@ -191,7 +191,7 @@ void CDrone::Think(float dt, CStateManager& mgr) {
if (IsAlive() && x835_25_) {
zeus::CAABox box = GetBoundingBox();
box.accumulateBounds(GetTranslation() + 20.f * zeus::skDown);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, GetBoundingBox(), CMaterialFilter::MakeInclude({EMaterialTypes::Trigger}), this);
for (TUniqueId id : nearList) {
if (const TCastToConstPtr<CScriptWater> water = mgr.GetObjectById(id)) {
@ -468,7 +468,7 @@ void CDrone::Patrol(CStateManager& mgr, EStateMsg msg, float dt) {
SetLightEnabled(mgr, true);
x834_25_ = true;
} else if (msg == EStateMsg::Update) {
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
BuildNearList(EMaterialTypes::Character, EMaterialTypes::Player, nearList, 5.f, mgr);
if (!nearList.empty()) {
zeus::CVector3f sep = x45c_steeringBehaviors.Separation(
@ -878,7 +878,7 @@ bool CDrone::ShouldFire(CStateManager& mgr, float arg) {
}
bool CDrone::HearShot(CStateManager& mgr, float arg) {
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
BuildNearList(EMaterialTypes::Projectile, EMaterialTypes::Player, nearList, 10.f, mgr);
return std::any_of(nearList.begin(), nearList.end(), [&mgr](TUniqueId 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; }
void CDrone::BuildNearList(EMaterialTypes includeMat, EMaterialTypes excludeMat,
rstl::reserved_vector<TUniqueId, 1024>& listOut, float radius, CStateManager& mgr) {
rstl::reserved_vector<TUniqueId, kMaxEntities>& listOut, float radius, CStateManager& mgr) {
const zeus::CVector3f pos = GetTranslation();
mgr.BuildNearList(listOut, zeus::CAABox(pos - radius, pos + radius),
CMaterialFilter::MakeIncludeExclude({includeMat}, {excludeMat}), nullptr);
@ -1004,7 +1004,7 @@ void CDrone::FireProjectile(CStateManager& mgr, const zeus::CTransform& xf, cons
void CDrone::StrafeFromCompanions(CStateManager& mgr) {
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Step)
return;
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
BuildNearList(EMaterialTypes::Character, EMaterialTypes::Player, nearList, x61c_, mgr);
if (nearList.empty())
return;
@ -1054,7 +1054,7 @@ void CDrone::UpdateScanner(CStateManager& mgr, float dt) {
zeus::CVector3f vec =
GetTransform().rotate(zeus::CVector3f(0.5f * std::cos(x5d8_), 1.f, 0.5f * std::sin(2.05f * x5d8_)).normalized());
TUniqueId id;
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
nearList.push_back(mgr.GetPlayer().GetUniqueId());
auto res = mgr.RayWorldIntersection(
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;
box.accumulateBounds(GetTranslation() + 1000.f * vec);
box.accumulateBounds(GetTranslation());
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, box, matFilter, nullptr);
TUniqueId id;
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) {
constexpr auto matFilter =
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::ProjectilePassthrough});
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, xf.origin, xf.frontVector(), 100000.f, matFilter, this);
TUniqueId id;
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;
CPathFindSearch* GetSearchPath() override;
virtual void BuildNearList(EMaterialTypes includeMat, EMaterialTypes excludeMat,
rstl::reserved_vector<TUniqueId, 1024>& listOut, float radius, CStateManager& mgr);
rstl::reserved_vector<TUniqueId, kMaxEntities>& listOut, float radius, CStateManager& mgr);
virtual void SetLightEnabled(CStateManager& mgr, bool activate);
virtual void SetVisorFlareEnabled(CStateManager& mgr, bool activate);
virtual void UpdateVisorFlare(CStateManager& mgr);

View File

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

View File

@ -239,7 +239,7 @@ private:
void UpdateHealthInfo(CStateManager& mgr);
void ExtendTouchBounds(const CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 7>& uids,
const zeus::CVector3f& vec) const;
bool IsClosestEnergyAttractor(const CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 1024>& charNearList,
bool IsClosestEnergyAttractor(const CStateManager& mgr, const rstl::reserved_vector<TUniqueId, kMaxEntities>& charNearList,
const zeus::CVector3f& projectilePos) const;
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 {
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, GetTranslation(), dir, 2.f, CMaterialFilter::skPassEverything, nullptr);
for (const auto& id : nearList) {

View File

@ -28,7 +28,7 @@ class CFireFlea : public CPatterned {
};
float x568_ = 1.f;
float x56c_;
rstl::reserved_vector<TUniqueId, 1024> x570_nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> x570_nearList;
zeus::CVector3f xd74_;
zeus::CVector3f xd80_targetPos;
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) {
const zeus::CVector3f& origin = GetTranslation();
const zeus::CAABox box(origin - 8.f, origin + 8.f);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude(EMaterialTypes::Character), this);
zeus::CVector3f ret;
@ -561,7 +561,7 @@ void CFlyingPirate::CheckForProjectiles(CStateManager& mgr) {
const zeus::CAABox box(playerPos - 5.f, playerPos + 5.f);
x6a0_30_ = false;
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude(EMaterialTypes::Projectile), this);
for (const auto& id : nearList) {
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(id)) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -389,10 +389,10 @@ void CParasite::UpdatePFDestination(CStateManager& mgr) {
void CParasite::DoFlockingBehavior(CStateManager& mgr) {
zeus::CVector3f upVec = x34_transform.basis[2];
rstl::reserved_vector<TUniqueId, 1024> parasiteList;
rstl::reserved_vector<TUniqueId, kMaxEntities> parasiteList;
zeus::CAABox aabb(GetTranslation() - x6e4_parasiteSearchRadius, GetTranslation() + x6e4_parasiteSearchRadius);
if ((x5d4_thinkCounter % 6) == 0) {
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
static constexpr CMaterialFilter filter = CMaterialFilter::MakeInclude(EMaterialTypes::Character);
CParasite* closestParasite = nullptr;
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,
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::skZero3f);
mgr.GetPlayer().GetMorphBall()->SetAsProjectile();
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, GetBoundingBox(), CMaterialFilter::MakeInclude({EMaterialTypes::Bomb}), this);
for (TUniqueId id : nearList) {
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);
RotateToOR(quat, arg);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, 1024> filteredNearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> filteredNearList;
mgr.BuildColliderList(nearList, *this, GetMotionVolume(arg));
for (const auto& id : nearList) {
if (!IsRider(id) && !IsSlave(id)) {

View File

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

View File

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

View File

@ -385,7 +385,7 @@ bool CTryclops::InMaxRange(CStateManager& mgr, float) {
return true;
}
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
float dectRange = x3bc_detectionRange * x3bc_detectionRange;
float dectRangeHeight = x3c0_detectionHeightRange * x3c0_detectionHeightRange;
@ -637,7 +637,7 @@ bool CTryclops::sub8025dbd0(CStateManager& mgr) {
constexpr CMaterialList matList{EMaterialTypes::Player, EMaterialTypes::Solid};
const CCollidableSphere colSphere{zeus::CSphere{GetTranslation() + zeus::CVector3f{0.f, 0.f, ballRadius}, ballRadius},
matList};
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildColliderList(nearList, player, colSphere.CalculateLocalAABox());
constexpr auto matFilter = CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::Player});
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) {
zeus::CVector3f delta = aimPos - xf.origin;
if (delta.canBeNormalized()) {
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
TUniqueId bestId = kInvalidUniqueId;
CRayCastResult res = mgr.RayWorldIntersection(bestId, xf.origin, delta.normalized(), delta.magnitude(),
CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), nearList);
@ -360,7 +360,7 @@ bool CWarWasp::PathToHiveIsClear(CStateManager& mgr) const {
zeus::CVector3f delta = x3a0_latestLeashPosition - GetTranslation();
if (GetTransform().basis[1].dot(delta) > 0.f) {
zeus::CAABox aabb(GetTranslation() - 10.f, GetTranslation() + 10.f);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, aabb, CMaterialFilter::MakeInclude({EMaterialTypes::Character}), nullptr);
float deltaMagSq = delta.magSquared();
for (TUniqueId id : nearList) {
@ -1140,7 +1140,7 @@ bool CWarWasp::ShouldFire(CStateManager& mgr, float arg) {
bool CWarWasp::ShouldDodge(CStateManager& mgr, float arg) {
zeus::CAABox aabb(GetTranslation() - 7.5f, GetTranslation() + 7.5f);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, aabb, CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), nullptr);
for (TUniqueId id : nearList) {
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(id)) {

View File

@ -21,8 +21,17 @@
#undef max
using namespace std::literals;
namespace metaforce {
using kUniqueIdType = u16;
static constexpr int kMaxEntities = 1024;
constexpr kUniqueIdType kUniqueIdSize = sizeof(u16);
constexpr kUniqueIdType kUniqueIdBits = kUniqueIdSize * 8;
constexpr kUniqueIdType kUniqueIdMax = UINT16_MAX;
constexpr kUniqueIdType kUniqueIdVersionMax = 64;
constexpr kUniqueIdType kUniqueIdVersionMask = kUniqueIdVersionMax - 1;
constexpr kUniqueIdType kUniqueIdValueMask = kMaxEntities - 1;
constexpr kUniqueIdType kUniqueIdValueBits = 10;
constexpr kUniqueIdType kUniqueIdVersionBits = 6;
using FourCC = hecl::FourCC;
@ -73,7 +82,9 @@ struct TEditorId {
[[nodiscard]] constexpr u8 LayerNum() const noexcept { return u8((id >> 26) & 0x3f); }
[[nodiscard]] constexpr u16 AreaNum() const noexcept { return u16((id >> 16) & 0x3ff); }
[[nodiscard]] constexpr u16 Id() const noexcept { return u16(id & 0xffff); }
[[nodiscard]] constexpr bool operator<(TEditorId other) const noexcept { return (id & 0x3ffffff) < (other.id & 0x3ffffff); }
[[nodiscard]] constexpr bool operator<(TEditorId other) const noexcept {
return (id & 0x3ffffff) < (other.id & 0x3ffffff);
}
[[nodiscard]] constexpr bool operator==(TEditorId other) const noexcept {
return (id & 0x3ffffff) == (other.id & 0x3ffffff);
}
@ -83,12 +94,15 @@ struct TEditorId {
#define kInvalidEditorId TEditorId()
struct TUniqueId {
u16 id = UINT16_MAX;
kUniqueIdType id = kUniqueIdMax;
constexpr TUniqueId() noexcept = default;
constexpr TUniqueId(u16 value, u16 version) noexcept : id(value | (version << 10)) {}
[[nodiscard]] constexpr u16 Version() const noexcept { return u16((id >> 10) & 0x3f); }
[[nodiscard]] constexpr u16 Value() const noexcept { return u16(id & 0x3ff); }
constexpr TUniqueId(kUniqueIdType value, kUniqueIdType version) noexcept
: id(value | (version << kUniqueIdValueBits)) {}
[[nodiscard]] constexpr kUniqueIdType Version() const noexcept {
return kUniqueIdType((id >> kUniqueIdValueBits) & kUniqueIdVersionMask);
}
[[nodiscard]] constexpr kUniqueIdType Value() const noexcept { return kUniqueIdType(id & kUniqueIdValueMask); }
[[nodiscard]] constexpr bool operator<(TUniqueId other) const noexcept { return id < other.id; }
[[nodiscard]] constexpr bool operator==(TUniqueId other) const noexcept { return id == other.id; }
[[nodiscard]] constexpr bool operator!=(TUniqueId other) const noexcept { return !operator==(other); }
@ -144,7 +158,7 @@ public:
this->pop_back();
this->insert(this->begin(), t);
}
}
}
[[nodiscard]] std::optional<T> GetAverage() const {
if (this->empty()) {
@ -182,28 +196,32 @@ struct hash<metaforce::CAssetId> {
FMT_CUSTOM_FORMATTER(metaforce::CAssetId, "{:08X}", obj.Value())
FMT_CUSTOM_FORMATTER(metaforce::TEditorId, "{:08X}", obj.id)
static_assert(sizeof(metaforce::kUniqueIdType) == sizeof(u16),
"TUniqueId size does not match expected size! Update TUniqueId format string!");
FMT_CUSTOM_FORMATTER(metaforce::TUniqueId, "{:04X}", obj.id)
FMT_CUSTOM_FORMATTER(metaforce::SObjectTag, "{} {}", obj.type, obj.id)
FMT_CUSTOM_FORMATTER(zeus::CVector3f, "({} {} {})", float(obj.x()), float(obj.y()), float(obj.z()))
FMT_CUSTOM_FORMATTER(zeus::CVector2f, "({} {})", float(obj.x()), float(obj.y()))
FMT_CUSTOM_FORMATTER(zeus::CMatrix3f, "\n({} {} {})"
"\n({} {} {})"
"\n({} {} {})",
float(obj[0][0]), float(obj[1][0]), float(obj[2][0]),
float(obj[0][1]), float(obj[1][1]), float(obj[2][1]),
float(obj[0][2]), float(obj[1][2]), float(obj[2][2]))
FMT_CUSTOM_FORMATTER(zeus::CMatrix4f, "\n({} {} {} {})"
"\n({} {} {} {})"
"\n({} {} {} {})"
"\n({} {} {} {})",
float(obj[0][0]), float(obj[1][0]), float(obj[2][0]), float(obj[3][0]),
float(obj[0][1]), float(obj[1][1]), float(obj[2][1]), float(obj[3][1]),
float(obj[0][2]), float(obj[1][2]), float(obj[2][2]), float(obj[3][2]),
float(obj[0][3]), float(obj[1][3]), float(obj[2][3]), float(obj[3][3]))
FMT_CUSTOM_FORMATTER(zeus::CTransform, "\n({} {} {} {})"
"\n({} {} {} {})"
"\n({} {} {} {})",
FMT_CUSTOM_FORMATTER(zeus::CMatrix3f,
"\n({} {} {})"
"\n({} {} {})"
"\n({} {} {})",
float(obj[0][0]), float(obj[1][0]), float(obj[2][0]), float(obj[0][1]), float(obj[1][1]),
float(obj[2][1]), float(obj[0][2]), float(obj[1][2]), float(obj[2][2]))
FMT_CUSTOM_FORMATTER(zeus::CMatrix4f,
"\n({} {} {} {})"
"\n({} {} {} {})"
"\n({} {} {} {})"
"\n({} {} {} {})",
float(obj[0][0]), float(obj[1][0]), float(obj[2][0]), float(obj[3][0]), float(obj[0][1]),
float(obj[1][1]), float(obj[2][1]), float(obj[3][1]), float(obj[0][2]), float(obj[1][2]),
float(obj[2][2]), float(obj[3][2]), float(obj[0][3]), float(obj[1][3]), float(obj[2][3]),
float(obj[3][3]))
FMT_CUSTOM_FORMATTER(zeus::CTransform,
"\n({} {} {} {})"
"\n({} {} {} {})"
"\n({} {} {} {})",
float(obj.basis[0][0]), float(obj.basis[1][0]), float(obj.basis[2][0]), float(obj.origin[0]),
float(obj.basis[0][1]), float(obj.basis[1][1]), float(obj.basis[2][1]), float(obj.origin[1]),
float(obj.basis[0][2]), float(obj.basis[1][2]), float(obj.basis[2][2]), float(obj.origin[2]))

View File

@ -71,7 +71,7 @@ void CBeamProjectile::UpdateFx(const zeus::CTransform& xf, float dt, CStateManag
zeus::CVector3f{x2f4_beamRadius, x304_beamLength, x2f4_beamRadius});
x36c_ = zeus::CAABox(zeus::CVector3f{-x2f4_beamRadius, 0.f, -x2f4_beamRadius},
zeus::CVector3f{x2f4_beamRadius, x300_intBeamLength, x2f4_beamRadius}).getTransformedAABox(xf);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, x36c_, CMaterialFilter::MakeExclude({EMaterialTypes::ProjectilePassthrough}), nullptr);
TUniqueId collideId = kInvalidUniqueId;
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 ret;
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, aabb, CMaterialFilter::skPassEverything, this);
const auto& colPoints = x34c_flameWarp.GetCollisionPoints();

View File

@ -216,7 +216,7 @@ CRayCastResult CGameProjectile::DoCollisionCheck(TUniqueId& idOut, CStateManager
CRayCastResult res;
if (x2e4_24_active) {
zeus::CVector3f posDelta = x34_transform.origin - x298_previousPos;
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, GetProjectileBounds(),
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,
const zeus::CVector3f& end, float mag,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
CStateManager& mgr) {
x2d0_touchResults.clear();
idOut = kInvalidUniqueId;

View File

@ -76,7 +76,7 @@ public:
void ApplyDamageToActors(CStateManager& mgr, const CDamageInfo& dInfo);
void FluidFXThink(EFluidState state, CScriptWater& water, CStateManager& mgr) override;
CRayCastResult RayCollisionCheckWithWorld(TUniqueId& idOut, const zeus::CVector3f& start, const zeus::CVector3f& end,
float mag, const rstl::reserved_vector<TUniqueId, 1024>& nearList,
float mag, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
CStateManager& mgr);
CProjectileTouchResult CanCollideWith(CActor& act, 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) {
x300_wasPointAdded = false;
bool any_particle_collisions = false;
rstl::reserved_vector<TUniqueId, 1024> near_list_cache;
rstl::reserved_vector<TUniqueId, kMaxEntities> near_list_cache;
// rstl::reserved_vector<rstl::reserved_vector<, ?>, ?> unk_rstl_vec; // inner vectors of size 0x90c, never used
// though
CCollisionInfoList cached_cinfo;
@ -665,7 +665,7 @@ int CNewFlameThrower::SortAndFindOverlappingPoints(Cube const& box) {
}
bool CNewFlameThrower::FindCollisionInNearList(CStateManager& mgr,
rstl::reserved_vector<TUniqueId, 1024> const& near_list,
rstl::reserved_vector<TUniqueId, kMaxEntities> const& near_list,
CCollisionPrimitive const& coll, TUniqueId& first_coll_out,
CCollisionInfoList& collisions) {
for (TUniqueId const& cur_uid : near_list) {

View File

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

View File

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

View File

@ -176,7 +176,7 @@ void CEnvFxManager::CalculateSnowForces(const CVectorFixed8_8& zVec,
}
}
void CEnvFxManager::BuildBlockObjectList(rstl::reserved_vector<TUniqueId, 1024>& list, CStateManager& mgr) {
void CEnvFxManager::BuildBlockObjectList(rstl::reserved_vector<TUniqueId, kMaxEntities>& list, CStateManager& mgr) {
for (CEntity* ent : mgr.GetAllObjectList()) {
const TCastToConstPtr<CScriptTrigger> trig = ent;
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());
x2c_lastBlockedGridIdx = -1;
x24_enableSplash = false;
rstl::reserved_vector<TUniqueId, 1024> blockList;
rstl::reserved_vector<TUniqueId, kMaxEntities> blockList;
bool blockListBuilt = false;
int blockedGrids = 0;
for (int i = 0; i < x50_grids.size(); ++i) {

View File

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

View File

@ -207,12 +207,12 @@ public:
std::vector<CWorldLight> x80_lightsB;
std::vector<CLight> x90_gfxLightsB;
std::unique_ptr<CPVSAreaSet> xa0_pvs;
u32 xa4_elemCount = 1024;
u32 xa4_elemCount = kMaxEntities;
struct MapEntry {
s16 x0_id = -1;
TUniqueId x4_uid = kInvalidUniqueId;
};
std::array<MapEntry, 1024> xa8_pvsEntityMap;
std::array<MapEntry, kMaxEntities> xa8_pvsEntityMap;
u32 x10a8_pvsVersion = 0;
TLockedToken<CPFArea> x10ac_pathToken;
// bool x10b8_ = 0; optional flag for CToken

View File

@ -759,7 +759,7 @@ bool CMorphBall::FindClosestSpiderBallWaypoint(CStateManager& mgr, const zeus::C
zeus::CTransform& surfaceTransform) const {
bool ret = false;
const zeus::CAABox aabb(ballCenter - 2.1f, ballCenter + 2.1f);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, aabb, CMaterialFilter::skPassEverything, nullptr);
float minDist = 2.1f;
@ -1926,7 +1926,7 @@ bool CMorphBall::BallCloseToCollision(const CStateManager& mgr, float dist, cons
const CCollidableSphere sphere(
zeus::CSphere(x0_player.GetTranslation() + zeus::CVector3f(0.f, 0.f, GetBallRadius()), dist), playerOrSolid);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildColliderList(nearList, x0_player, sphere.CalculateLocalAABox());
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;
CGraphics::SetOrtho(-vpX, vpX, vpY, -vpY, 0.f, vpZ);
rstl::reserved_vector<TUniqueId, 1024> nearItems;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearItems;
mgr.BuildNearList(nearItems, aabb, CMaterialFilter::skPassEverything, &player);
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 {
CMaterialFilter filter = CMaterialFilter::MakeInclude(EMaterialTypes::Character);
zeus::CVector3f delta = p1 - p0;
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
bool ret = false;
if (delta.canBeNormalized()) {
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);
CAreaCollisionCache cache(expandedBounds);
CGameCollision::BuildAreaCollisionCache(mgr, cache);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildColliderList(nearList, *this, expandedBounds);
const std::optional<zeus::CVector3f> nonIntVec =
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);
const CCollidableSphere prim(
zeus::CSphere(GetCollisionPrimitive()->CalculateAABox(x34_transform).center(), 4.25f), primMaterial);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildColliderList(nearList, *this, prim.CalculateLocalAABox());
if (CGameCollision::DetectStaticCollisionBoolean(mgr, prim, zeus::CTransform(), filter)) {
touchingPhazon = true;
@ -2942,7 +2942,7 @@ u16 CPlayer::GetMaterialSoundUnderPlayer(const CStateManager& mgr, const u16* ta
u16 ret = defId;
zeus::CAABox aabb = GetBoundingBox();
aabb.accumulateBounds(x34_transform.origin + zeus::skDown);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, aabb, SolidMaterialFilter, nullptr);
TUniqueId collideId = kInvalidUniqueId;
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 {
constexpr CMaterialFilter solidFilter = CMaterialFilter::MakeInclude({EMaterialTypes::Solid});
const zeus::CAABox aabb(x2d8_fpBounds.min - 1.f + pos, x2d8_fpBounds.max + 1.f + pos);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildColliderList(nearList, *this, aabb);
const CCollidableAABox colAABB({GetBaseBoundingBox().min + pos, GetBaseBoundingBox().max + pos}, {});
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))) {
const float eyeToAimMag = eyeToAim.magnitude();
if (eyeToAimMag <= g_tweakPlayer->GetAimMaxDistance()) {
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
TUniqueId intersectId = kInvalidUniqueId;
eyeToAim.normalize();
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(),
g_tweakPlayer->GetAimBoxHeight(), dist);
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, aabb, CMaterialFilter::MakeInclude({EMaterialTypes::Target}), this);
return CheckEnemiesAgainstOrbitZone(nearList, EPlayerZoneInfo::Targeting, EPlayerZoneType::Ellipse, mgr);
}
@ -4240,7 +4240,7 @@ const zeus::CTransform& CPlayer::GetFirstPersonCameraTransform(const CStateManag
return mgr.GetCameraManager()->GetFirstPersonCamera()->GetGunFollowTransform();
}
TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const rstl::reserved_vector<TUniqueId, 1024>& list,
TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const rstl::reserved_vector<TUniqueId, kMaxEntities>& list,
EPlayerZoneInfo info, EPlayerZoneType zone, CStateManager& mgr) const {
const zeus::CVector3f eyePos = GetEyePosition();
float minEyeToAimMag = 10000.f;
@ -4263,7 +4263,7 @@ TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const rstl::reserved_vector<TUni
const float eyeToAimMag = eyeToAim.magnitude();
if (eyeToAimMag <= g_tweakPlayer->GetAimMaxDistance()) {
if (minEyeToAimMag - eyeToAimMag > g_tweakPlayer->GetAimThresholdDistance()) {
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
TUniqueId intersectId = kInvalidUniqueId;
eyeToAim.normalize();
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 posInBoxMagSq = posInBoxLeft * posInBoxLeft + posInBoxTop * posInBoxTop;
if (posInBoxMagSq < minPosInBoxMagSq) {
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
TUniqueId intersectId = kInvalidUniqueId;
eyeToAim.normalize();
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
? CMaterialFilter::MakeInclude({EMaterialTypes::Scannable})
: CMaterialFilter::MakeInclude({EMaterialTypes::Orbit});
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, nearAABB, filter, nullptr);
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 (mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::GrappleBeam) &&
eyeToOrbitMag < minEyeToOrbitMag && eyeToOrbitMag < g_tweakPlayer->GetOrbitDistanceMax()) {
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
TUniqueId intersectId = kInvalidUniqueId;
eyeToOrbit.normalize();
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() &&
mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::Scan) {
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
TUniqueId idOut = kInvalidUniqueId;
eyeToOrbit.normalize();
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 posInBoxMagSq = posInBoxLeft * posInBoxLeft + posInBoxTop * posInBoxTop;
if (posInBoxMagSq < minPosInBoxMagSq) {
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
TUniqueId idOut = kInvalidUniqueId;
eyeToOrbit.normalize();
mgr.BuildNearList(nearList, eyePos, eyeToOrbit, eyeToOrbitMag, OccluderFilter, act.GetPtr());
@ -4478,7 +4478,7 @@ TUniqueId CPlayer::FindBestOrbitableObject(const std::vector<TUniqueId>& ids, EP
return bestId;
}
void CPlayer::FindOrbitableObjects(const rstl::reserved_vector<TUniqueId, 1024>& nearObjects,
void CPlayer::FindOrbitableObjects(const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearObjects,
std::vector<TUniqueId>& listOut, EPlayerZoneInfo zone, EPlayerZoneType type,
CStateManager& mgr, bool onScreenTest) const {
const CFirstPersonCamera* fpCam = mgr.GetCameraManager()->GetFirstPersonCamera();
@ -5012,7 +5012,7 @@ CPlayer::EOrbitValidationResult CPlayer::ValidateCurrentOrbitTargetId(CStateMana
TUniqueId bestId = kInvalidUniqueId;
const zeus::CVector3f eyeToOrbit = act->GetOrbitPosition(mgr) - eyePos;
if (eyeToOrbit.canBeNormalized()) {
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, eyePos, eyeToOrbit.normalized(), eyeToOrbit.magnitude(), OccluderFilter,
act.GetPtr());
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});
const zeus::CAABox aabb(x2d8_fpBounds.min - zeus::CVector3f(1.f) + GetTranslation(),
x2d8_fpBounds.max + zeus::CVector3f(1.f) + GetTranslation());
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildColliderList(nearList, *this, aabb);
const zeus::CAABox& baseAABB = GetBaseBoundingBox();
pos = zeus::skZero3f;

View File

@ -485,12 +485,12 @@ public:
bool ValidateObjectForMode(TUniqueId uid, CStateManager& mgr) const;
TUniqueId FindAimTargetId(CStateManager& mgr) const;
TUniqueId GetAimTarget() const { return x3f4_aimTarget; }
TUniqueId CheckEnemiesAgainstOrbitZone(const rstl::reserved_vector<TUniqueId, 1024>& list, EPlayerZoneInfo info,
TUniqueId CheckEnemiesAgainstOrbitZone(const rstl::reserved_vector<TUniqueId, kMaxEntities>& list, EPlayerZoneInfo info,
EPlayerZoneType zone, CStateManager& mgr) const;
TUniqueId FindOrbitTargetId(CStateManager& mgr) const;
void UpdateOrbitableObjects(CStateManager& mgr);
TUniqueId FindBestOrbitableObject(const std::vector<TUniqueId>& ids, EPlayerZoneInfo info, CStateManager& mgr) const;
void FindOrbitableObjects(const rstl::reserved_vector<TUniqueId, 1024>& nearObjects, std::vector<TUniqueId>& listOut,
void FindOrbitableObjects(const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearObjects, std::vector<TUniqueId>& listOut,
EPlayerZoneInfo zone, EPlayerZoneType type, CStateManager& mgr, bool onScreenTest) const;
bool WithinOrbitScreenBox(const zeus::CVector3f& screenCoords, EPlayerZoneInfo zone, EPlayerZoneType type) 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) {
rstl::reserved_vector<TUniqueId, 1024> waypointIds;
rstl::reserved_vector<TUniqueId, kMaxEntities> waypointIds;
CObjectList& objectList = mgr.GetAllObjectList();
for (CEntity* ent : objectList) {
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;
const float mag = dir.magnitude();
dir = dir / mag;
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
constexpr auto filter = CMaterialFilter::MakeIncludeExclude(
{EMaterialTypes::Solid}, {EMaterialTypes::Player, EMaterialTypes::CollisionActor});
mgr.BuildNearList(nearList, muzzlePos, dir, mag, filter, gun.GetPtr());

View File

@ -55,7 +55,7 @@ CScriptPlatform::CScriptPlatform(TUniqueId uid, std::string_view name, const CEn
void CScriptPlatform::Accept(IVisitor& visitor) { visitor.Visit(this); }
void CScriptPlatform::DragSlave(CStateManager& mgr, rstl::reserved_vector<u16, 1024>& draggedSet, CActor* actor,
void CScriptPlatform::DragSlave(CStateManager& mgr, rstl::reserved_vector<u16, kMaxEntities>& draggedSet, CActor* actor,
const zeus::CVector3f& delta) {
if (std::find(draggedSet.begin(), draggedSet.end(), actor->GetUniqueId().Value()) != draggedSet.end()) {
return;
@ -70,7 +70,7 @@ void CScriptPlatform::DragSlave(CStateManager& mgr, rstl::reserved_vector<u16, 1
}
}
void CScriptPlatform::DragSlaves(CStateManager& mgr, rstl::reserved_vector<u16, 1024>& draggedSet,
void CScriptPlatform::DragSlaves(CStateManager& mgr, rstl::reserved_vector<u16, kMaxEntities>& draggedSet,
const zeus::CVector3f& delta) {
for (SRiders& rider : x328_slavesStatic) {
if (const TCastToPtr<CActor> act = mgr.ObjectById(rider.x0_uid)) {
@ -114,7 +114,7 @@ void CScriptPlatform::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C
x25a_targetWaypoint = GetNext(x258_currentWaypoint, mgr);
mgr.SendScriptMsg(wp, GetUniqueId(), EScriptObjectMessage::Arrived);
if (!x328_slavesStatic.empty() || !x338_slavesDynamic.empty()) {
rstl::reserved_vector<u16, 1024> draggedSet;
rstl::reserved_vector<u16, kMaxEntities> draggedSet;
DragSlaves(mgr, draggedSet, x270_dragDelta);
}
x270_dragDelta = zeus::skZero3f;
@ -204,9 +204,9 @@ void CScriptPlatform::MoveRiders(CStateManager& mgr, float dt, bool active, std:
}
}
rstl::reserved_vector<TUniqueId, 1024>
rstl::reserved_vector<TUniqueId, kMaxEntities>
CScriptPlatform::BuildNearListFromRiders(CStateManager& mgr, const std::vector<SRiders>& movedRiders) {
rstl::reserved_vector<TUniqueId, 1024> ret;
rstl::reserved_vector<TUniqueId, kMaxEntities> ret;
for (const SRiders& rider : movedRiders) {
if (const TCastToConstPtr<CActor> act = mgr.ObjectById(rider.x0_uid)) {
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);
x356_27_squishedRider = false;
if (!collidedRiders.empty()) {
rstl::reserved_vector<TUniqueId, 1024> nearList = BuildNearListFromRiders(mgr, collidedRiders);
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList = BuildNearListFromRiders(mgr, collidedRiders);
if (CGameCollision::DetectDynamicCollisionBoolean(*GetCollisionPrimitive(), GetPrimitiveTransform(), nearList,
mgr)) {
SetMotionState(mState);
@ -273,7 +273,7 @@ void CScriptPlatform::Think(float dt, CStateManager& mgr) {
}
if (!x328_slavesStatic.empty() || !x338_slavesDynamic.empty()) {
rstl::reserved_vector<u16, 1024> draggedSet;
rstl::reserved_vector<u16, kMaxEntities> draggedSet;
DragSlaves(mgr, draggedSet, x270_dragDelta);
}
@ -508,9 +508,9 @@ zeus::CQuaternion CScriptPlatform::Move(float dt, CStateManager& mgr) {
MoveToWR(GetTranslation() + x270_dragDelta, dt);
}
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildColliderList(nearList, *this, GetMotionVolume(dt));
rstl::reserved_vector<TUniqueId, 1024> nonRiders;
rstl::reserved_vector<TUniqueId, kMaxEntities> nonRiders;
for (TUniqueId id : nearList) {
if (!IsRider(id) && !IsSlave(id)) {
nonRiders.push_back(id);

View File

@ -62,15 +62,15 @@ class CScriptPlatform : public CPhysicsActor {
bool x356_30_disableXrayAlpha : 1 = false;
bool x356_31_xrayFog : 1 = true;
void DragSlave(CStateManager& mgr, rstl::reserved_vector<u16, 1024>& draggedSet, CActor* actor,
void DragSlave(CStateManager& mgr, rstl::reserved_vector<u16, kMaxEntities>& draggedSet, CActor* actor,
const zeus::CVector3f& delta);
void DragSlaves(CStateManager& mgr, rstl::reserved_vector<u16, 1024>& draggedSet, const zeus::CVector3f& delta);
void DragSlaves(CStateManager& mgr, rstl::reserved_vector<u16, kMaxEntities>& draggedSet, const zeus::CVector3f& delta);
static void DecayRiders(std::vector<SRiders>& riders, float dt, CStateManager& mgr);
static void MoveRiders(CStateManager& mgr, float dt, bool active, std::vector<SRiders>& riders,
std::vector<SRiders>& collidedRiders, const zeus::CTransform& oldXf,
const zeus::CTransform& newXf, const zeus::CVector3f& dragDelta,
const zeus::CQuaternion& rotDelta);
static rstl::reserved_vector<TUniqueId, 1024> BuildNearListFromRiders(CStateManager& mgr,
static rstl::reserved_vector<TUniqueId, kMaxEntities> BuildNearListFromRiders(CStateManager& mgr,
const std::vector<SRiders>& movedRiders);
std::optional<CAABoxShader> m_boxFilter;

View File

@ -831,7 +831,7 @@ void CScriptSpecialFunction::ThinkObjectFollowObject(float, CStateManager& mgr)
void CScriptSpecialFunction::ThinkChaffTarget(float dt, CStateManager& mgr) {
const zeus::CAABox box(5.f - GetTranslation(), 5.f + GetTranslation());
rstl::reserved_vector<TUniqueId, 1024> nearList;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), nullptr);
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 camDiff = pos - camPos;
const float mag = (camDiff.magnitude());
rstl::reserved_vector<TUniqueId, 1024> nearVec;
rstl::reserved_vector<TUniqueId, kMaxEntities> nearVec;
mgr.BuildNearList(nearVec, camPos, camDiff * (1.f / mag), mag,
CMaterialFilter::MakeInclude({EMaterialTypes::Occluder}), act);
TUniqueId id;