2016-04-16 21:49:47 +00:00
|
|
|
#ifndef __URDE_CSORTEDLISTS_HPP__
|
|
|
|
#define __URDE_CSORTEDLISTS_HPP__
|
|
|
|
|
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
#include "zeus/CAABox.hpp"
|
2017-03-24 05:30:16 +00:00
|
|
|
#include "Collision/CMaterialFilter.hpp"
|
2016-04-16 21:49:47 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
2017-01-04 04:08:30 +00:00
|
|
|
enum ESortedList
|
|
|
|
{
|
2017-03-24 05:30:16 +00:00
|
|
|
MinX,
|
|
|
|
MinY,
|
|
|
|
MinZ,
|
|
|
|
MaxX,
|
|
|
|
MaxY,
|
|
|
|
MaxZ
|
2017-01-04 04:08:30 +00:00
|
|
|
};
|
2016-04-16 21:49:47 +00:00
|
|
|
|
|
|
|
struct SSortedList
|
|
|
|
{
|
|
|
|
TUniqueId x0_ids[1024];
|
2017-03-24 05:30:16 +00:00
|
|
|
u32 x800_size;
|
2017-01-15 03:59:37 +00:00
|
|
|
void Reset() {std::fill(std::begin(x0_ids), std::end(x0_ids), kInvalidUniqueId);}
|
2016-04-16 21:49:47 +00:00
|
|
|
SSortedList() {Reset();}
|
|
|
|
};
|
|
|
|
|
2017-01-04 04:08:30 +00:00
|
|
|
class CActor;
|
2016-04-16 21:49:47 +00:00
|
|
|
class CSortedListManager
|
|
|
|
{
|
|
|
|
struct SNode
|
|
|
|
{
|
2017-03-24 05:30:16 +00:00
|
|
|
const CActor* x0_actor = nullptr;
|
2016-04-16 21:49:47 +00:00
|
|
|
zeus::CAABox x4_box = zeus::CAABox::skNullBox;
|
2017-03-24 05:30:16 +00:00
|
|
|
u16 x1c_selfIdxs[6] = {-1, -1, -1, -1, -1, -1};
|
|
|
|
TUniqueId x28_next = kInvalidUniqueId;
|
|
|
|
bool x2a_populated = false;
|
|
|
|
SNode() = default;
|
|
|
|
SNode(const CActor* act, const zeus::CAABox& aabb)
|
|
|
|
: x0_actor(act), x4_box(aabb), x2a_populated(true) {}
|
2016-04-16 21:49:47 +00:00
|
|
|
};
|
|
|
|
SNode x0_nodes[1024];
|
|
|
|
SSortedList xb000_sortedLists[6];
|
|
|
|
void Reset();
|
2017-03-24 05:30:16 +00:00
|
|
|
void AddToLinkedList(TUniqueId a, TUniqueId& b, TUniqueId& c) const;
|
2017-01-04 04:08:30 +00:00
|
|
|
void RemoveFromList(ESortedList, s16);
|
2017-03-24 05:30:16 +00:00
|
|
|
void MoveInList(ESortedList, s16);
|
|
|
|
void InsertInList(ESortedList, SNode& node);
|
|
|
|
s16 FindInListUpper(ESortedList, float) const;
|
|
|
|
s16 FindInListLower(ESortedList, float) const;
|
|
|
|
TUniqueId ConstructIntersectionArray(const zeus::CAABox&);
|
|
|
|
TUniqueId CalculateIntersections(ESortedList, ESortedList, s16, s16, s16, s16,
|
|
|
|
ESortedList, ESortedList, ESortedList, ESortedList, const zeus::CAABox&);
|
|
|
|
public:
|
|
|
|
CSortedListManager();
|
|
|
|
void BuildNearList(rstl::reserved_vector<TUniqueId, 1024>&, const zeus::CVector3f&, const zeus::CVector3f&,
|
|
|
|
float, const CMaterialFilter&, const CActor*) const;
|
|
|
|
void BuildNearList(rstl::reserved_vector<TUniqueId, 1024>&, const CActor&, const zeus::CAABox&) const;
|
|
|
|
void BuildNearList(rstl::reserved_vector<TUniqueId, 1024>&, const zeus::CAABox&,
|
|
|
|
const CMaterialFilter&, const CActor*) const;
|
2017-01-04 04:08:30 +00:00
|
|
|
void Remove(const CActor*);
|
2017-03-24 05:30:16 +00:00
|
|
|
void Move(const CActor* act, const zeus::CAABox& aabb);
|
|
|
|
void Insert(const CActor* act, const zeus::CAABox& aabb);
|
|
|
|
bool ActorInLists(const CActor* act) const;
|
2016-04-16 21:49:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CSORTEDLISTS_HPP__
|