Recast: rename constant

A more descriptive and correct name.
This commit is contained in:
Kawe Mazidjatari 2024-08-14 11:34:07 +02:00
parent 97ceae59e6
commit 06b673dc84
5 changed files with 22 additions and 22 deletions

View File

@ -388,7 +388,7 @@ void CAI_Utility::DrawNavMeshPolys(const dtNavMesh* pMesh,
{
const dtPoly* pPoly = &pTile->polys[j];
Color col = pPoly->groupId == DT_STRAY_POLY_GROUP
Color col = pPoly->groupId == DT_UNLINKED_POLY_GROUP
? Color(220, 120, 0, 255)
: Color(0, 200, 220, 255);
@ -507,7 +507,7 @@ void CAI_Utility::DrawNavMeshPolyBoundaries(const dtNavMesh* pMesh,
}
else
{
col = pPoly->groupId == DT_STRAY_POLY_GROUP
col = pPoly->groupId == DT_UNLINKED_POLY_GROUP
? Color(32, 24, 0, 255)
: Color(0, 48, 64, 255);
}
@ -517,7 +517,7 @@ void CAI_Utility::DrawNavMeshPolyBoundaries(const dtNavMesh* pMesh,
if (pPoly->neis[e] != 0)
continue;
col = pPoly->groupId == DT_STRAY_POLY_GROUP
col = pPoly->groupId == DT_UNLINKED_POLY_GROUP
? Color(255, 20, 10, 255)
: Color(20, 140, 255, 255);
}

View File

@ -659,7 +659,7 @@ void Editor::connectTileTraverseLinks(dtMeshTile* const baseTile, const bool lin
{
dtPoly* const basePoly = &baseTile->polys[i];
if (basePoly->groupId == DT_STRAY_POLY_GROUP)
if (basePoly->groupId == DT_UNLINKED_POLY_GROUP)
continue;
for (int j = 0; j < basePoly->vertCount; ++j)
@ -701,7 +701,7 @@ void Editor::connectTileTraverseLinks(dtMeshTile* const baseTile, const bool lin
{
dtPoly* const landPoly = &landTile->polys[m];
if (landPoly->groupId == DT_STRAY_POLY_GROUP)
if (landPoly->groupId == DT_UNLINKED_POLY_GROUP)
continue;
for (int n = 0; n < landPoly->vertCount; ++n)

View File

@ -24,14 +24,14 @@
static unsigned int getPolySurfaceColor(const dtPoly* poly, duDebugDraw* dd, const unsigned int alpha)
{
return poly->groupId == DT_STRAY_POLY_GROUP
return poly->groupId == DT_UNLINKED_POLY_GROUP
? duTransCol(duRGBA(240,20,10,255), alpha)
: duTransCol(dd->areaToCol(poly->getArea()), alpha);
}
static unsigned int getPolyBoundaryColor(const dtPoly* poly, const bool inner)
{
return poly->groupId == DT_STRAY_POLY_GROUP
return poly->groupId == DT_UNLINKED_POLY_GROUP
? inner ? duRGBA(32,24,0,32) : duRGBA(32,24,0,220)
: inner ? duRGBA(0,24,32,32) : duRGBA(0,24,32,220);
}

View File

@ -69,20 +69,20 @@ static const int DT_VERTS_PER_POLYGON = 6;
/// A value that indicates that this poly hasn't been assigned to a group yet.
static const unsigned short DT_NULL_POLY_GROUP = 0;
/// A poly group that holds all unconnected stray polys (not linked to anything).
/// A poly group that holds all unconnected polys (not linked to anything).
/// These are considered 'trash' by the game engine; see [r5apex_ds + CA88B2].
/// For reference, Titanfall 2 single player NavMeshes also marked everything unconnected as '1'.
static const unsigned short DT_STRAY_POLY_GROUP = 1;
static const unsigned short DT_UNLINKED_POLY_GROUP = 1;
/// The first non-reserved poly group; DT_STRAY_POLY_GROUP and below are reserved.
/// The first non-reserved poly group; #DT_UNLINKED_POLY_GROUP and below are reserved.
static const unsigned short DT_FIRST_USABLE_POLY_GROUP = 2;
/// The minimum required number of poly groups for static pathing logic to work.
/// (E.g. if we have 2 poly groups, group id 1 (DT_STRAY_POLY_GROUP), and group
/// id 2, then 1 is never reachable as its considered 'trash' by design, and 2
/// is always reachable as that's the only group id. If group id 3 is involved
/// then code can use the static patching logic to quickly query if we are even
/// on the same (or connected) poly island before trying to compute a path).
/// (E.g. if we have 2 poly groups, group id 1 (#DT_UNLINKED_POLY_GROUP), and
/// group id 2, then 1 is never reachable as its considered 'trash' by design,
/// and 2 is always reachable as that's the only group id. If group id 3 is
/// involved then code can use the static patching logic to quickly query if we
/// are even on the same (or connected) poly island before trying to compute a path).
static const int DT_MIN_POLY_GROUP_COUNT = 3;
/// The cached poly surface area quantization factor.

View File

@ -254,7 +254,7 @@ bool dtCreateDisjointPolyGroups(dtNavMesh* nav, dtDisjointSet& disjoint)
// Reserve the first poly groups
// 0 = DT_NULL_POLY_GROUP.
// 1 = DT_STRAY_POLY_GROUP.
// 1 = DT_UNLINKED_POLY_GROUP.
disjoint.init(DT_FIRST_USABLE_POLY_GROUP);
// Clear all labels.
@ -267,7 +267,7 @@ bool dtCreateDisjointPolyGroups(dtNavMesh* nav, dtDisjointSet& disjoint)
{
dtPoly& poly = tile->polys[j];
if (poly.groupId != DT_STRAY_POLY_GROUP)
if (poly.groupId != DT_UNLINKED_POLY_GROUP)
poly.groupId = DT_NULL_POLY_GROUP;
#if DT_NAVMESH_SET_VERSION >= 7
@ -341,7 +341,7 @@ bool dtCreateDisjointPolyGroups(dtNavMesh* nav, dtDisjointSet& disjoint)
for (int j = 0; j < pcount; j++)
{
dtPoly& poly = tile->polys[j];
if (poly.groupId != DT_STRAY_POLY_GROUP)
if (poly.groupId != DT_UNLINKED_POLY_GROUP)
{
const int id = disjoint.find(poly.groupId);
poly.groupId = (unsigned short)id;
@ -368,7 +368,7 @@ bool dtUpdateDisjointPolyGroups(dtNavMesh* nav, dtDisjointSet& disjoint)
// This poly isn't connected to anything, mark it so the game
// won't consider this poly in path generation.
if (poly.firstLink == DT_NULL_LINK)
poly.groupId = DT_STRAY_POLY_GROUP;
poly.groupId = DT_UNLINKED_POLY_GROUP;
}
}
@ -385,7 +385,7 @@ bool dtUpdateDisjointPolyGroups(dtNavMesh* nav, dtDisjointSet& disjoint)
{
dtPoly& poly = tile->polys[j];
unsigned short oldId = poly.groupId;
if (oldId != DT_STRAY_POLY_GROUP && groupMap.find(oldId) == groupMap.end())
if (oldId != DT_UNLINKED_POLY_GROUP && groupMap.find(oldId) == groupMap.end())
groupMap[oldId] = (unsigned short)disjoint.insertNew();
}
}
@ -399,7 +399,7 @@ bool dtUpdateDisjointPolyGroups(dtNavMesh* nav, dtDisjointSet& disjoint)
for (int j = 0; j < pcount; j++)
{
dtPoly& poly = tile->polys[j];
if (poly.groupId != DT_STRAY_POLY_GROUP)
if (poly.groupId != DT_UNLINKED_POLY_GROUP)
poly.groupId = groupMap[poly.groupId];
}
}
@ -484,7 +484,7 @@ bool dtUpdateDisjointPolyGroups(dtNavMesh* nav, dtDisjointSet& disjoint)
}
rdAssert(landPoly->getType() != DT_POLYTYPE_OFFMESH_CONNECTION);
rdAssert(landPoly->groupId != DT_STRAY_POLY_GROUP);
rdAssert(landPoly->groupId != DT_UNLINKED_POLY_GROUP);
if (poly.groupId != landPoly->groupId)
disjoint.setUnion(poly.groupId, landPoly->groupId);