From 06b673dc8418d95f2b97862b08387f6079e54a92 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Wed, 14 Aug 2024 11:34:07 +0200 Subject: [PATCH] Recast: rename constant A more descriptive and correct name. --- src/game/shared/ai_utility_shared.cpp | 6 +++--- src/naveditor/Editor.cpp | 4 ++-- .../recast/DebugUtils/Source/DetourDebugDraw.cpp | 4 ++-- .../recast/Detour/Include/DetourNavMesh.h | 16 ++++++++-------- .../Detour/Source/DetourNavMeshBuilder.cpp | 14 +++++++------- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/game/shared/ai_utility_shared.cpp b/src/game/shared/ai_utility_shared.cpp index 8d7457a8..f48f23b4 100644 --- a/src/game/shared/ai_utility_shared.cpp +++ b/src/game/shared/ai_utility_shared.cpp @@ -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); } diff --git a/src/naveditor/Editor.cpp b/src/naveditor/Editor.cpp index a21a2fc5..f6fa4a4f 100644 --- a/src/naveditor/Editor.cpp +++ b/src/naveditor/Editor.cpp @@ -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) diff --git a/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp b/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp index c933f698..1675d4ec 100644 --- a/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp +++ b/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp @@ -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); } diff --git a/src/thirdparty/recast/Detour/Include/DetourNavMesh.h b/src/thirdparty/recast/Detour/Include/DetourNavMesh.h index f580666c..ababb3ba 100644 --- a/src/thirdparty/recast/Detour/Include/DetourNavMesh.h +++ b/src/thirdparty/recast/Detour/Include/DetourNavMesh.h @@ -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. diff --git a/src/thirdparty/recast/Detour/Source/DetourNavMeshBuilder.cpp b/src/thirdparty/recast/Detour/Source/DetourNavMeshBuilder.cpp index 2c2fe677..709a0b26 100644 --- a/src/thirdparty/recast/Detour/Source/DetourNavMeshBuilder.cpp +++ b/src/thirdparty/recast/Detour/Source/DetourNavMeshBuilder.cpp @@ -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);