mirror of https://github.com/AxioDL/metaforce.git
CSortedLists: Add names to all function prototypes
More self-documenting and allows parameter inspection in IDEs to function nicer.
This commit is contained in:
parent
eecd03428d
commit
0a366855bc
|
@ -116,19 +116,19 @@ void CSortedListManager::InsertInList(ESortedList list, SNode& node) {
|
||||||
++sl.x800_size;
|
++sl.x800_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
s16 CSortedListManager::FindInListUpper(ESortedList list, float val) const {
|
s16 CSortedListManager::FindInListUpper(ESortedList list, float value) const {
|
||||||
const auto listIndex = static_cast<size_t>(list);
|
const auto listIndex = static_cast<size_t>(list);
|
||||||
const SSortedList& sl = xb000_sortedLists[listIndex];
|
const SSortedList& sl = xb000_sortedLists[listIndex];
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
for (int i = sl.x800_size; i > 0;) {
|
for (int i = sl.x800_size; i > 0;) {
|
||||||
/* Binary search cycle to find index */
|
// Binary search cycle to find index
|
||||||
if (!(val < AccessElement(x0_nodes, AccessElement(sl.x0_ids, idx + i / 2)).x4_box[listIndex])) {
|
if (!(value < AccessElement(x0_nodes, AccessElement(sl.x0_ids, idx + i / 2)).x4_box[listIndex])) {
|
||||||
/* Upper */
|
// Upper
|
||||||
idx = idx + i / 2 + 1;
|
idx = idx + i / 2 + 1;
|
||||||
i = i - i / 2 - 1;
|
i = i - i / 2 - 1;
|
||||||
} else {
|
} else {
|
||||||
/* Lower */
|
// Lower
|
||||||
i /= 2;
|
i /= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,19 +136,19 @@ s16 CSortedListManager::FindInListUpper(ESortedList list, float val) const {
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
s16 CSortedListManager::FindInListLower(ESortedList list, float val) const {
|
s16 CSortedListManager::FindInListLower(ESortedList list, float value) const {
|
||||||
const auto listIndex = static_cast<size_t>(list);
|
const auto listIndex = static_cast<size_t>(list);
|
||||||
const SSortedList& sl = xb000_sortedLists[listIndex];
|
const SSortedList& sl = xb000_sortedLists[listIndex];
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
for (int i = sl.x800_size; i > 0;) {
|
for (int i = sl.x800_size; i > 0;) {
|
||||||
/* Binary search cycle to find index */
|
// Binary search cycle to find index
|
||||||
if (AccessElement(x0_nodes, AccessElement(sl.x0_ids, idx + i / 2)).x4_box[listIndex] < val) {
|
if (AccessElement(x0_nodes, AccessElement(sl.x0_ids, idx + i / 2)).x4_box[listIndex] < value) {
|
||||||
/* Upper */
|
// Upper
|
||||||
idx = idx + i / 2 + 1;
|
idx = idx + i / 2 + 1;
|
||||||
i = i - i / 2 - 1;
|
i = i - i / 2 - 1;
|
||||||
} else {
|
} else {
|
||||||
/* Lower */
|
// Lower
|
||||||
i /= 2;
|
i /= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,10 +273,11 @@ void CSortedListManager::BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& o
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSortedListManager::Remove(const CActor* act) {
|
void CSortedListManager::Remove(const CActor* actor) {
|
||||||
SNode& node = AccessElement(x0_nodes, act->GetUniqueId().Value());
|
SNode& node = AccessElement(x0_nodes, actor->GetUniqueId().Value());
|
||||||
if (!node.x2a_populated)
|
if (!node.x2a_populated) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
RemoveFromList(ESortedList::MinX, node.x1c_selfIdxs[0]);
|
RemoveFromList(ESortedList::MinX, node.x1c_selfIdxs[0]);
|
||||||
RemoveFromList(ESortedList::MaxX, node.x1c_selfIdxs[3]);
|
RemoveFromList(ESortedList::MaxX, node.x1c_selfIdxs[3]);
|
||||||
|
@ -287,8 +288,8 @@ void CSortedListManager::Remove(const CActor* act) {
|
||||||
node.x2a_populated = false;
|
node.x2a_populated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSortedListManager::Move(const CActor* act, const zeus::CAABox& aabb) {
|
void CSortedListManager::Move(const CActor* actor, const zeus::CAABox& aabb) {
|
||||||
SNode& node = AccessElement(x0_nodes, act->GetUniqueId().Value());
|
SNode& node = AccessElement(x0_nodes, actor->GetUniqueId().Value());
|
||||||
node.x4_box = aabb;
|
node.x4_box = aabb;
|
||||||
|
|
||||||
MoveInList(ESortedList::MinX, node.x1c_selfIdxs[0]);
|
MoveInList(ESortedList::MinX, node.x1c_selfIdxs[0]);
|
||||||
|
@ -299,14 +300,14 @@ void CSortedListManager::Move(const CActor* act, const zeus::CAABox& aabb) {
|
||||||
MoveInList(ESortedList::MaxZ, node.x1c_selfIdxs[5]);
|
MoveInList(ESortedList::MaxZ, node.x1c_selfIdxs[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSortedListManager::Insert(const CActor* act, const zeus::CAABox& aabb) {
|
void CSortedListManager::Insert(const CActor* actor, const zeus::CAABox& aabb) {
|
||||||
SNode& node = AccessElement(x0_nodes, act->GetUniqueId().Value());
|
SNode& node = AccessElement(x0_nodes, actor->GetUniqueId().Value());
|
||||||
if (node.x2a_populated) {
|
if (node.x2a_populated) {
|
||||||
Move(act, aabb);
|
Move(actor, aabb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SNode newNode(act, aabb);
|
SNode newNode(actor, aabb);
|
||||||
InsertInList(ESortedList::MinX, newNode);
|
InsertInList(ESortedList::MinX, newNode);
|
||||||
InsertInList(ESortedList::MaxX, newNode);
|
InsertInList(ESortedList::MaxX, newNode);
|
||||||
InsertInList(ESortedList::MinY, newNode);
|
InsertInList(ESortedList::MinY, newNode);
|
||||||
|
@ -316,10 +317,11 @@ void CSortedListManager::Insert(const CActor* act, const zeus::CAABox& aabb) {
|
||||||
node = newNode;
|
node = newNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSortedListManager::ActorInLists(const CActor* act) const {
|
bool CSortedListManager::ActorInLists(const CActor* actor) const {
|
||||||
if (!act)
|
if (!actor) {
|
||||||
return false;
|
return false;
|
||||||
const SNode& node = AccessElement(x0_nodes, act->GetUniqueId().Value());
|
}
|
||||||
|
const SNode& node = AccessElement(x0_nodes, actor->GetUniqueId().Value());
|
||||||
return node.x2a_populated;
|
return node.x2a_populated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,27 +31,27 @@ class CSortedListManager {
|
||||||
std::array<SNode, 1024> x0_nodes;
|
std::array<SNode, 1024> x0_nodes;
|
||||||
std::array<SSortedList, 6> xb000_sortedLists;
|
std::array<SSortedList, 6> xb000_sortedLists;
|
||||||
void Reset();
|
void Reset();
|
||||||
void AddToLinkedList(s16 a, s16& b, s16& c);
|
void AddToLinkedList(s16 nodeId, s16& headId, s16& tailId);
|
||||||
void RemoveFromList(ESortedList, s16);
|
void RemoveFromList(ESortedList list, s16 idx);
|
||||||
void MoveInList(ESortedList, s16);
|
void MoveInList(ESortedList list, s16 idx);
|
||||||
void InsertInList(ESortedList, SNode& node);
|
void InsertInList(ESortedList list, SNode& node);
|
||||||
s16 FindInListUpper(ESortedList, float) const;
|
s16 FindInListUpper(ESortedList list, float value) const;
|
||||||
s16 FindInListLower(ESortedList, float) const;
|
s16 FindInListLower(ESortedList list, float value) const;
|
||||||
s16 ConstructIntersectionArray(const zeus::CAABox&);
|
s16 ConstructIntersectionArray(const zeus::CAABox& aabb);
|
||||||
s16 CalculateIntersections(ESortedList, ESortedList, s16, s16, s16, s16, ESortedList, ESortedList, ESortedList,
|
s16 CalculateIntersections(ESortedList la, ESortedList lb, s16 a, s16 b, s16 c, s16 d, ESortedList slA,
|
||||||
ESortedList, const zeus::CAABox&);
|
ESortedList slB, ESortedList slC, ESortedList slD, const zeus::CAABox& aabb);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSortedListManager();
|
CSortedListManager();
|
||||||
void BuildNearList(rstl::reserved_vector<TUniqueId, 1024>&, const zeus::CVector3f&, const zeus::CVector3f&, float,
|
void BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& out, const zeus::CVector3f& pos,
|
||||||
const CMaterialFilter&, const CActor*) const;
|
const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter, const CActor* actor) const;
|
||||||
void BuildNearList(rstl::reserved_vector<TUniqueId, 1024>&, const CActor&, const zeus::CAABox&) const;
|
void BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& out, const CActor& actor, const zeus::CAABox& aabb) const;
|
||||||
void BuildNearList(rstl::reserved_vector<TUniqueId, 1024>&, const zeus::CAABox&, const CMaterialFilter&,
|
void BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& out, const zeus::CAABox& aabb,
|
||||||
const CActor*) const;
|
const CMaterialFilter& filter, const CActor* actor) const;
|
||||||
void Remove(const CActor*);
|
void Remove(const CActor* actor);
|
||||||
void Move(const CActor* act, const zeus::CAABox& aabb);
|
void Move(const CActor* actor, const zeus::CAABox& aabb);
|
||||||
void Insert(const CActor* act, const zeus::CAABox& aabb);
|
void Insert(const CActor* actor, const zeus::CAABox& aabb);
|
||||||
bool ActorInLists(const CActor* act) const;
|
bool ActorInLists(const CActor* actor) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace urde
|
} // namespace urde
|
||||||
|
|
Loading…
Reference in New Issue