Recast: light formatting improvements

Keep the style consistent with the rest.
This commit is contained in:
Kawe Mazidjatari 2024-07-02 14:13:05 +02:00
parent 105e48693a
commit 97204c20dc
5 changed files with 29 additions and 27 deletions

View File

@ -468,6 +468,7 @@ void duDebugDrawNavMeshPoly(duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef re
duAppendArc(dd, con->pos[0],con->pos[1],con->pos[2], con->pos[3],con->pos[4],con->pos[5], 0.25f,
(con->flags & DT_OFFMESH_CON_BIDIR) ? 30.0f : 0.0f, 30.0f, c);
// Reference positions.
drawOffMeshConnectionRefPosition(dd, con);
dd->end();

View File

@ -70,13 +70,13 @@ static const int DT_VERTS_PER_POLYGON = 6;
///
/// A magic number used to detect compatibility of navigation tile data.
static const int DT_NAVMESH_MAGIC = 'D' << 24 | 'N' << 16 | 'A' << 8 | 'V';
static const int DT_NAVMESH_MAGIC = 'D'<<24 | 'N'<<16 | 'A'<<8 | 'V';
/// A version number used to detect compatibility of navigation tile data.
static const int DT_NAVMESH_VERSION = 16;
/// A magic number used to detect the compatibility of navigation tile states.
static const int DT_NAVMESH_STATE_MAGIC = 'D' << 24 | 'N' << 16 | 'M' << 8 | 'S';
static const int DT_NAVMESH_STATE_MAGIC = 'D'<<24 | 'N'<<16 | 'M'<<8 | 'S';
/// A version number used to detect compatibility of navigation tile states.
static const int DT_NAVMESH_STATE_VERSION = 1;
@ -583,9 +583,9 @@ public:
inline dtPolyRef encodePolyId(unsigned int salt, unsigned int it, unsigned int ip) const
{
#ifdef DT_POLYREF64
return ((dtPolyRef)salt << (DT_POLY_BITS + DT_TILE_BITS)) | ((dtPolyRef)it << DT_POLY_BITS) | (dtPolyRef)ip;
return ((dtPolyRef)salt << (DT_POLY_BITS+DT_TILE_BITS)) | ((dtPolyRef)it << DT_POLY_BITS) | (dtPolyRef)ip;
#else
return ((dtPolyRef)salt << (m_polyBits + m_tileBits)) | ((dtPolyRef)it << m_polyBits) | (dtPolyRef)ip;
return ((dtPolyRef)salt << (m_polyBits+m_tileBits)) | ((dtPolyRef)it << m_polyBits) | (dtPolyRef)ip;
#endif
}
@ -599,17 +599,17 @@ public:
inline void decodePolyId(dtPolyRef ref, unsigned int& salt, unsigned int& it, unsigned int& ip) const
{
#ifdef DT_POLYREF64
const dtPolyRef saltMask = ((dtPolyRef)1 << DT_SALT_BITS) - 1;
const dtPolyRef tileMask = ((dtPolyRef)1 << DT_TILE_BITS) - 1;
const dtPolyRef polyMask = ((dtPolyRef)1 << DT_POLY_BITS) - 1;
salt = (unsigned int)((ref >> (DT_POLY_BITS + DT_TILE_BITS)) & saltMask);
const dtPolyRef saltMask = ((dtPolyRef)1<<DT_SALT_BITS)-1;
const dtPolyRef tileMask = ((dtPolyRef)1<<DT_TILE_BITS)-1;
const dtPolyRef polyMask = ((dtPolyRef)1<<DT_POLY_BITS)-1;
salt = (unsigned int)((ref >> (DT_POLY_BITS+DT_TILE_BITS)) & saltMask);
it = (unsigned int)((ref >> DT_POLY_BITS) & tileMask);
ip = (unsigned int)(ref & polyMask);
#else
const dtPolyRef saltMask = ((dtPolyRef)1 << m_saltBits) - 1;
const dtPolyRef tileMask = ((dtPolyRef)1 << m_tileBits) - 1;
const dtPolyRef polyMask = ((dtPolyRef)1 << m_polyBits) - 1;
salt = (unsigned int)((ref >> (m_polyBits + m_tileBits)) & saltMask);
const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;
const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
salt = (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
it = (unsigned int)((ref >> m_polyBits) & tileMask);
ip = (unsigned int)(ref & polyMask);
#endif
@ -622,11 +622,11 @@ public:
inline unsigned int decodePolyIdSalt(dtPolyRef ref) const
{
#ifdef DT_POLYREF64
const dtPolyRef saltMask = ((dtPolyRef)1 << DT_SALT_BITS) - 1;
return (unsigned int)((ref >> (DT_POLY_BITS + DT_TILE_BITS)) & saltMask);
const dtPolyRef saltMask = ((dtPolyRef)1<<DT_SALT_BITS)-1;
return (unsigned int)((ref >> (DT_POLY_BITS+DT_TILE_BITS)) & saltMask);
#else
const dtPolyRef saltMask = ((dtPolyRef)1 << m_saltBits) - 1;
return (unsigned int)((ref >> (m_polyBits + m_tileBits)) & saltMask);
const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;
return (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
#endif
}
@ -637,10 +637,10 @@ public:
inline unsigned int decodePolyIdTile(dtPolyRef ref) const
{
#ifdef DT_POLYREF64
const dtPolyRef tileMask = ((dtPolyRef)1 << DT_TILE_BITS) - 1;
const dtPolyRef tileMask = ((dtPolyRef)1<<DT_TILE_BITS)-1;
return (unsigned int)((ref >> DT_POLY_BITS) & tileMask);
#else
const dtPolyRef tileMask = ((dtPolyRef)1 << m_tileBits) - 1;
const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
return (unsigned int)((ref >> m_polyBits) & tileMask);
#endif
}
@ -652,10 +652,10 @@ public:
inline unsigned int decodePolyIdPoly(dtPolyRef ref) const
{
#ifdef DT_POLYREF64
const dtPolyRef polyMask = ((dtPolyRef)1 << DT_POLY_BITS) - 1;
const dtPolyRef polyMask = ((dtPolyRef)1<<DT_POLY_BITS)-1;
return (unsigned int)(ref & polyMask);
#else
const dtPolyRef polyMask = ((dtPolyRef)1 << m_polyBits) - 1;
const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
return (unsigned int)(ref & polyMask);
#endif
}

View File

@ -574,6 +574,7 @@ private:
};
dtQueryData m_query; ///< Sliced query state.
class dtNodePool* m_tinyNodePool; ///< Pointer to small node pool.
class dtNodePool* m_nodePool; ///< Pointer to node pool.
class dtNodeQueue* m_openList; ///< Pointer to open list queue.

View File

@ -1604,8 +1604,8 @@ dtStatus dtNavMesh::getPolyArea(dtPolyRef ref, unsigned char* resultArea) const
float dtCalcOffMeshRefYaw(const float* spos, const float* epos)
{
float dx = epos[0] - spos[0];
float dy = epos[1] - spos[1];
float dx = epos[0]-spos[0];
float dy = epos[1]-spos[1];
// Amos: yaw on original r2 sp navs' seem to be of range [180, -180], might need to multiply this with (180.0f/DT_PI).
float yaw = dtMathAtan2f(dy, dx);
@ -1614,10 +1614,10 @@ float dtCalcOffMeshRefYaw(const float* spos, const float* epos)
void dtCalcOffMeshRefPos(const float* spos, float yaw, float offset, float* res)
{
float dx = offset * dtMathCosf(yaw);
float dy = offset * dtMathSinf(yaw);
float dx = offset*dtMathCosf(yaw);
float dy = offset*dtMathSinf(yaw);
res[0] = spos[0] + dx;
res[1] = spos[1] + dy;
res[0] = spos[0]+dx;
res[1] = spos[1]+dy;
res[2] = spos[2];
}

View File

@ -1550,7 +1550,7 @@ static dtStatus removeVertex(dtTileCachePolyMesh& mesh, const unsigned short rem
}
// Remove vertex.
for (int i = (int)rem; i < mesh.nverts - 1; ++i)
for (int i = (int)rem; i < mesh.nverts-1; ++i)
{
mesh.verts[i*3+0] = mesh.verts[(i+1)*3+0];
mesh.verts[i*3+1] = mesh.verts[(i+1)*3+1];