2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 15:44:56 +00:00

De-hardcode max entity count

This commit is contained in:
2021-06-06 16:53:41 -07:00
parent 89378700f7
commit 5f1aed51cb
64 changed files with 246 additions and 238 deletions

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;