mirror of https://github.com/AxioDL/metaforce.git
Use EntityList instead of `rstl::resverved_vector<TUniqueId, 1024>' directly
This commit is contained in:
parent
5bfe881b95
commit
0b4f15341b
|
@ -233,7 +233,7 @@ s16 CSortedListManager::CalculateIntersections(ESortedList la, ESortedList lb, s
|
|||
return headId;
|
||||
}
|
||||
|
||||
void CSortedListManager::BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& out, const zeus::CVector3f& pos,
|
||||
void CSortedListManager::BuildNearList(EntityList& out, const zeus::CVector3f& pos,
|
||||
const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter,
|
||||
const CActor* actor) {
|
||||
if (mag == 0.f) {
|
||||
|
@ -246,7 +246,7 @@ void CSortedListManager::BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEnti
|
|||
BuildNearList(out, zeus::CAABox(mins, maxs), filter, actor);
|
||||
}
|
||||
|
||||
void CSortedListManager::BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& out, const CActor& actor,
|
||||
void CSortedListManager::BuildNearList(EntityList& out, const CActor& actor,
|
||||
const zeus::CAABox& aabb) {
|
||||
const CMaterialFilter& filter = actor.GetMaterialFilter();
|
||||
s16 id = ConstructIntersectionArray(aabb);
|
||||
|
@ -262,7 +262,7 @@ void CSortedListManager::BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEnti
|
|||
}
|
||||
}
|
||||
|
||||
void CSortedListManager::BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& out, const zeus::CAABox& aabb,
|
||||
void CSortedListManager::BuildNearList(EntityList& out, const zeus::CAABox& aabb,
|
||||
const CMaterialFilter& filter, const CActor* actor) {
|
||||
s16 id = ConstructIntersectionArray(aabb);
|
||||
while (id != -1) {
|
||||
|
|
|
@ -43,10 +43,10 @@ class CSortedListManager {
|
|||
|
||||
public:
|
||||
CSortedListManager();
|
||||
void BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& out, const zeus::CVector3f& pos,
|
||||
void BuildNearList(EntityList& out, const zeus::CVector3f& pos,
|
||||
const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter, const CActor* actor);
|
||||
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,
|
||||
void BuildNearList(EntityList& out, const CActor& actor, const zeus::CAABox& aabb);
|
||||
void BuildNearList(EntityList& 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);
|
||||
|
|
|
@ -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, kMaxEntities> nearList;
|
||||
EntityList nearList;
|
||||
BuildNearList(nearList, camAABB,
|
||||
CMaterialFilter(EMaterialTypes::AIBlock, CMaterialList(), CMaterialFilter::EFilterType::Include),
|
||||
nullptr);
|
||||
|
@ -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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities>& nearList) const {
|
||||
const EntityList& 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities>& nearList,
|
||||
const EntityList& 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, kMaxEntities>& nearList,
|
||||
const EntityList& nearList,
|
||||
const CActor* damagee) const {
|
||||
const zeus::CVector3f delta = end - start;
|
||||
if (!delta.canBeNormalized()) {
|
||||
|
@ -2374,7 +2374,7 @@ void CStateManager::MoveActors(float dt) {
|
|||
|
||||
void CStateManager::CrossTouchActors() {
|
||||
std::array<bool, kMaxEntities> visits{};
|
||||
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities>& listOut, const zeus::CVector3f& v1,
|
||||
void CStateManager::BuildNearList(EntityList& listOut, const zeus::CVector3f& v1,
|
||||
const zeus::CVector3f& v2, float f1, const CMaterialFilter& filter,
|
||||
const CActor* actor) const {
|
||||
x874_sortedListManager->BuildNearList(listOut, v1, v2, f1, filter, actor);
|
||||
}
|
||||
|
||||
void CStateManager::BuildColliderList(rstl::reserved_vector<TUniqueId, kMaxEntities>& listOut, const CActor& actor,
|
||||
void CStateManager::BuildColliderList(EntityList& listOut, const CActor& actor,
|
||||
const zeus::CAABox& aabb) const {
|
||||
x874_sortedListManager->BuildNearList(listOut, actor, aabb);
|
||||
}
|
||||
|
||||
void CStateManager::BuildNearList(rstl::reserved_vector<TUniqueId, kMaxEntities>& listOut, const zeus::CAABox& aabb,
|
||||
void CStateManager::BuildNearList(EntityList& listOut, const zeus::CAABox& aabb,
|
||||
const CMaterialFilter& filter, const CActor* actor) const {
|
||||
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, kMaxEntities>& list) const {
|
||||
const EntityList& list) const {
|
||||
return CGameCollision::RayWorldIntersection(*this, idOut, pos, dir, length, filter, list);
|
||||
}
|
||||
|
||||
|
|
|
@ -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, kMaxEntities>& nearList) const;
|
||||
const EntityList& 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, kMaxEntities>& nearList, const CMaterialFilter& filter,
|
||||
const EntityList& 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, kMaxEntities>& nearList, const CActor* damagee) const;
|
||||
const EntityList& 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, kMaxEntities>& listOut, const zeus::CVector3f&, const zeus::CVector3f&,
|
||||
void BuildNearList(EntityList& listOut, const zeus::CVector3f&, const zeus::CVector3f&,
|
||||
float, const CMaterialFilter&, const CActor*) const;
|
||||
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&,
|
||||
void BuildColliderList(EntityList& listOut, const CActor&, const zeus::CAABox&) const;
|
||||
void BuildNearList(EntityList& 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, kMaxEntities>& list) const;
|
||||
const EntityList& list) const;
|
||||
void UpdateObjectInLists(CEntity&);
|
||||
TUniqueId AllocateUniqueId();
|
||||
void DeferStateTransition(EStateManagerTransition t);
|
||||
|
|
|
@ -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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities>& nearList,
|
||||
int count, float tolerance, const EntityList& 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, kMaxEntities>& nearList, float dt,
|
||||
const EntityList& 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, kMaxEntities>& nearList, float dt,
|
||||
const EntityList& 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList nearList;
|
||||
mgr.BuildColliderList(nearList, mgr.GetPlayer(), aabb);
|
||||
CAreaCollisionCache cache(aabb);
|
||||
CGameCollision::BuildAreaCollisionCache(mgr, cache);
|
||||
|
|
|
@ -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, kMaxEntities>& nearList, float dt,
|
||||
float tolerance, const EntityList& nearList, float dt,
|
||||
CStateManager& mgr);
|
||||
zeus::CVector3f AvoidGeometry(const zeus::CTransform& xf, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
|
||||
zeus::CVector3f AvoidGeometry(const zeus::CTransform& xf, const EntityList& nearList,
|
||||
float dt, CStateManager& mgr);
|
||||
zeus::CVector3f AvoidGeometryFull(const zeus::CTransform& xf, const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
|
||||
zeus::CVector3f AvoidGeometryFull(const zeus::CTransform& xf, const EntityList& nearList,
|
||||
float dt, CStateManager& mgr);
|
||||
zeus::CAABox CalculateCollidersBoundingBox(const std::vector<CCameraCollider>& colliderList,
|
||||
CStateManager& mgr) const;
|
||||
|
|
|
@ -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, kMaxEntities>* nearList) {
|
||||
const EntityList* 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, kMaxEntities> useColliderList;
|
||||
EntityList 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, kMaxEntities>& nearList,
|
||||
const CMaterialFilter& filter, EntityList& 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, kMaxEntities>& nearList, float amt, float& resolved,
|
||||
EntityList& 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, kMaxEntities>& nearList, float dt) {
|
||||
EntityList& 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, kMaxEntities>* nearList) {
|
||||
const EntityList* nearList) {
|
||||
zeus::CAABox motionVol = actor.GetMotionVolume(dt);
|
||||
rstl::reserved_vector<TUniqueId, kMaxEntities> useNearList;
|
||||
EntityList 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, kMaxEntities>& nearList,
|
||||
EntityList& nearList,
|
||||
CAreaCollisionCache& cache, const SMovementOptions& opts,
|
||||
SMoveObjectResult& result) {
|
||||
result.x6c_processedCollisions = 0;
|
||||
|
|
|
@ -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, kMaxEntities>* nearList);
|
||||
const EntityList* nearList);
|
||||
static bool ResolveUpDown(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor,
|
||||
const CMaterialFilter& filter, rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, float,
|
||||
const CMaterialFilter& filter, EntityList& nearList, float,
|
||||
float, float&, CCollisionInfoList& list);
|
||||
static bool MoveGroundColliderZ(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor,
|
||||
const CMaterialFilter& filter, rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
|
||||
const CMaterialFilter& filter, EntityList& nearList,
|
||||
float, float&, CCollisionInfoList& list, TUniqueId& idOut);
|
||||
static void MoveGroundColliderXY(CAreaCollisionCache& cache, CStateManager& mgr, CPhysicsActor& actor,
|
||||
const CMaterialFilter& filter, rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
|
||||
const CMaterialFilter& filter, EntityList& 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, kMaxEntities>* nearList);
|
||||
const EntityList* 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, kMaxEntities>& nearList,
|
||||
EntityList& nearList,
|
||||
CAreaCollisionCache& cache, const SMovementOptions& opts,
|
||||
SMoveObjectResult& result);
|
||||
};
|
||||
|
|
|
@ -226,7 +226,7 @@ bool CRagDoll::SatisfyWorldConstraints(CStateManager& mgr, int pass) {
|
|||
else
|
||||
exclude = CMaterialList(EMaterialTypes::Character, EMaterialTypes::Player);
|
||||
|
||||
rstl::reserved_vector<TUniqueId, kMaxEntities> nearList;
|
||||
EntityList nearList;
|
||||
CMaterialFilter filter = CMaterialFilter::MakeIncludeExclude(include, exclude);
|
||||
mgr.BuildNearList(nearList, aabb, filter, nullptr);
|
||||
|
||||
|
|
|
@ -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, kMaxEntities>& list,
|
||||
zeus::CVector3f CSteeringBehaviors::Alignment(const CPhysicsActor& actor, EntityList& 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, kMaxEntities>& list,
|
||||
zeus::CVector3f CSteeringBehaviors::Cohesion(const CPhysicsActor& actor, EntityList& list,
|
||||
float dampingRadius, const CStateManager& mgr) const {
|
||||
zeus::CVector3f dest;
|
||||
if (!list.empty()) {
|
||||
|
|
|
@ -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, kMaxEntities>& list,
|
||||
zeus::CVector3f Alignment(const CPhysicsActor& actor, EntityList& list,
|
||||
const CStateManager& mgr) const;
|
||||
zeus::CVector3f Cohesion(const CPhysicsActor& actor, rstl::reserved_vector<TUniqueId, kMaxEntities>& list,
|
||||
zeus::CVector3f Cohesion(const CPhysicsActor& actor, EntityList& list,
|
||||
float dampingRadius, const CStateManager& mgr) const;
|
||||
zeus::CVector2f Flee2D(const CPhysicsActor& actor, const zeus::CVector2f& v0) const;
|
||||
zeus::CVector2f Arrival2D(const CPhysicsActor& actor, const zeus::CVector2f& v0) const;
|
||||
|
|
|
@ -59,7 +59,7 @@ void CGameCollision::InitCollision() {
|
|||
}
|
||||
|
||||
void CGameCollision::MovePlayer(CStateManager& mgr, CPhysicsActor& actor, float dt,
|
||||
const rstl::reserved_vector<TUniqueId, kMaxEntities>* colliderList) {
|
||||
const EntityList* 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, kMaxEntities>* colliderList) {
|
||||
const EntityList* 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, kMaxEntities> useColliderList;
|
||||
EntityList 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, kMaxEntities>* colliderList) {
|
||||
const EntityList* 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, kMaxEntities>& nearList) {
|
||||
const EntityList& 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, kMaxEntities>& nearList,
|
||||
const EntityList& 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, kMaxEntities>& nearList) {
|
||||
const EntityList& 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, kMaxEntities>& nearList) {
|
||||
const EntityList& 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, kMaxEntities>& nearList) {
|
||||
const EntityList& 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, kMaxEntities>& nearList,
|
||||
const EntityList& 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, kMaxEntities>& nearList, TUniqueId& idOut,
|
||||
const EntityList& 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, kMaxEntities>& nearList,
|
||||
const EntityList& 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, kMaxEntities>& nearList, TUniqueId& idOut,
|
||||
const EntityList& 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, kMaxEntities>& nearList,
|
||||
const EntityList& 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, kMaxEntities>& nearList, TUniqueId& idOut,
|
||||
const EntityList& 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, kMaxEntities>& nearList, float f1,
|
||||
const EntityList& 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, kMaxEntities>& nearList) {
|
||||
const EntityList& nearList) {
|
||||
zeus::CTransform xf = actor.GetPrimitiveTransform();
|
||||
zeus::CVector3f origOrigin = xf.origin;
|
||||
zeus::CVector3f center = prim.CalculateAABox(xf).center();
|
||||
|
|
|
@ -25,9 +25,9 @@ class ICollisionFilter;
|
|||
|
||||
class CGameCollision {
|
||||
static void MovePlayer(CStateManager& mgr, CPhysicsActor& actor, float dt,
|
||||
const rstl::reserved_vector<TUniqueId, kMaxEntities>* colliderList);
|
||||
const EntityList* colliderList);
|
||||
static void MoveAndCollide(CStateManager& mgr, CPhysicsActor& actor, float dt, const ICollisionFilter& filter,
|
||||
const rstl::reserved_vector<TUniqueId, kMaxEntities>* colliderList);
|
||||
const EntityList* 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, kMaxEntities>* colliderList);
|
||||
const EntityList* 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, kMaxEntities>& nearList);
|
||||
const EntityList& nearList);
|
||||
static bool RayDynamicIntersectionBool(const CStateManager& mgr, const zeus::CVector3f& pos,
|
||||
const zeus::CVector3f& dir, const CMaterialFilter& filter,
|
||||
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList, const CActor* damagee,
|
||||
const EntityList& nearList, const CActor* damagee,
|
||||
float length);
|
||||
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, kMaxEntities>& nearList);
|
||||
const EntityList& 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, kMaxEntities>& nearList);
|
||||
const EntityList& 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, kMaxEntities>& nearList);
|
||||
const EntityList& 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, kMaxEntities>& nearList,
|
||||
const EntityList& 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, kMaxEntities>& nearList, TUniqueId& idOut,
|
||||
const EntityList& 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, kMaxEntities>& nearList,
|
||||
const EntityList& 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, kMaxEntities>& nearList, TUniqueId& idOut,
|
||||
const EntityList& nearList, TUniqueId& idOut,
|
||||
CCollisionInfoList& list, const CStateManager& mgr);
|
||||
static bool DetectDynamicCollisionMoving(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
|
||||
const rstl::reserved_vector<TUniqueId, kMaxEntities>& nearList,
|
||||
const EntityList& nearList,
|
||||
const zeus::CVector3f& vec, TUniqueId& idOut, CCollisionInfo& infoOut,
|
||||
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, kMaxEntities>& nearList,
|
||||
const CMaterialFilter& filter, const EntityList& 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, kMaxEntities>& nearList,
|
||||
const CCollisionPrimitive& prim, const EntityList& 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, kMaxEntities>& nearList);
|
||||
const CCollisionPrimitive& prim, const EntityList& nearList);
|
||||
static void AvoidStaticCollisionWithinRadius(const CStateManager& mgr, CPhysicsActor& actor, u32 iterations, float dt,
|
||||
float height, float size, float mass, float radius);
|
||||
};
|
||||
|
|
|
@ -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, kMaxEntities> nearList;
|
||||
EntityList nearList;
|
||||
CRayCastResult resD = CGameCollision::RayDynamicIntersection(
|
||||
mgr, cid, pos, zeus::skDown, x40_maxObjHeight, CMaterialFilter::skPassEverything, nearList);
|
||||
if (resD.IsValid() && resD.GetT() < height) {
|
||||
|
|
|
@ -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, kMaxEntities> nearList;
|
||||
EntityList nearList;
|
||||
mgr.BuildNearList(nearList, radarBounds,
|
||||
CMaterialFilter(CMaterialList(EMaterialTypes::Target, EMaterialTypes::RadarObject),
|
||||
CMaterialList(EMaterialTypes::ExcludeFromRadar),
|
||||
|
|
|
@ -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, kMaxEntities> nearList;
|
||||
EntityList nearList;
|
||||
mgr.BuildNearList(nearList, aabb, filter, nullptr);
|
||||
|
||||
float threatDist = 9999.f;
|
||||
|
|
|
@ -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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList nearList;
|
||||
mgr.BuildNearList(nearList, pos, backDir, x5a4_jumpBackwardDist,
|
||||
CMaterialFilter::MakeInclude({EMaterialTypes::Character}), this);
|
||||
TUniqueId bestId = kInvalidUniqueId;
|
||||
|
|
|
@ -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, kMaxEntities> nearList;
|
||||
EntityList nearList;
|
||||
mgr.BuildNearList(nearList, {pos - radius, pos + radius}, filter, nullptr);
|
||||
|
||||
for (const auto& id : nearList) {
|
||||
|
|
|
@ -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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities>& listOut, float radius, CStateManager& mgr) {
|
||||
EntityList& 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList 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);
|
||||
|
|
|
@ -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, kMaxEntities>& listOut, float radius, CStateManager& mgr);
|
||||
EntityList& listOut, float radius, CStateManager& mgr);
|
||||
virtual void SetLightEnabled(CStateManager& mgr, bool activate);
|
||||
virtual void SetVisorFlareEnabled(CStateManager& mgr, bool activate);
|
||||
virtual void UpdateVisorFlare(CStateManager& mgr);
|
||||
|
|
|
@ -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, kMaxEntities> projNearList;
|
||||
EntityList 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, kMaxEntities> charNearList;
|
||||
EntityList 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, kMaxEntities>& charNearList,
|
||||
const EntityList& charNearList,
|
||||
const zeus::CVector3f& projectilePos) const {
|
||||
const float distance = (projectilePos - GetTranslation()).magSquared();
|
||||
for (const auto& id : charNearList) {
|
||||
|
|
|
@ -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, kMaxEntities>& charNearList,
|
||||
bool IsClosestEnergyAttractor(const CStateManager& mgr, const EntityList& charNearList,
|
||||
const zeus::CVector3f& projectilePos) const;
|
||||
void ShakeCamera(CStateManager& mgr);
|
||||
};
|
||||
|
|
|
@ -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, kMaxEntities> nearList;
|
||||
EntityList nearList;
|
||||
mgr.BuildNearList(nearList, GetTranslation(), dir, 2.f, CMaterialFilter::skPassEverything, nullptr);
|
||||
|
||||
for (const auto& id : nearList) {
|
||||
|
|
|
@ -28,7 +28,7 @@ class CFireFlea : public CPatterned {
|
|||
};
|
||||
float x568_ = 1.f;
|
||||
float x56c_;
|
||||
rstl::reserved_vector<TUniqueId, kMaxEntities> x570_nearList;
|
||||
EntityList x570_nearList;
|
||||
zeus::CVector3f xd74_;
|
||||
zeus::CVector3f xd80_targetPos;
|
||||
CPathFindSearch xd8c_pathFind;
|
||||
|
|
|
@ -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, kMaxEntities> nearList;
|
||||
EntityList 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, kMaxEntities> nearList;
|
||||
EntityList nearList;
|
||||
mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude(EMaterialTypes::Projectile), this);
|
||||
for (const auto& id : nearList) {
|
||||
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(id)) {
|
||||
|
|
|
@ -1146,7 +1146,7 @@ void CIceSheegoth::AttractProjectiles(CStateManager& mgr) {
|
|||
if (!IsAlive())
|
||||
return;
|
||||
|
||||