From 4e7693bae604eeb256439dd5b620e851d83b1ec4 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 2 Apr 2023 17:25:18 +0200 Subject: [PATCH] /W4: Fix name shadowing warnings --- r5dev/game/shared/ai_utility_shared.cpp | 22 +++++------ r5dev/mathlib/mathlib_base.cpp | 51 +++++++++++++++---------- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/r5dev/game/shared/ai_utility_shared.cpp b/r5dev/game/shared/ai_utility_shared.cpp index 5e619ac5..b5fcbf7a 100644 --- a/r5dev/game/shared/ai_utility_shared.cpp +++ b/r5dev/game/shared/ai_utility_shared.cpp @@ -375,28 +375,28 @@ void CAI_Utility::DrawNavMeshPolyBoundaries(dtNavMesh* pMesh) const if (!IsTileWithinRange(pTile, vCamera, flCameraRange)) continue; - for (int i = 0; i < pTile->header->polyCount; ++i) + for (int j = 0; j < pTile->header->polyCount; ++j) { - const dtPoly* pPoly = &pTile->polys[i]; + const dtPoly* pPoly = &pTile->polys[j]; if (pPoly->getType() == DT_POLYTYPE_OFFMESH_CONNECTION) continue; - const dtPolyDetail* pd = &pTile->detailMeshes[i]; + const dtPolyDetail* pd = &pTile->detailMeshes[j]; - for (int j = 0, nj = static_cast<int>(pPoly->vertCount); j < nj; ++j) + for (int e = 0, ne = static_cast<int>(pPoly->vertCount); e < ne; ++e) { if (bDrawInner) { - if (pPoly->neis[j] == 0) + if (pPoly->neis[e] == 0) continue; - if (pPoly->neis[j] & DT_EXT_LINK) + if (pPoly->neis[e] & DT_EXT_LINK) { bool bCon = false; for (unsigned int k = pPoly->firstLink; k != DT_NULL_LINK; k = pTile->links[k].next) { - if (pTile->links[k].edge == j) + if (pTile->links[k].edge == e) { bCon = true; break; @@ -412,16 +412,16 @@ void CAI_Utility::DrawNavMeshPolyBoundaries(dtNavMesh* pMesh) const } else { - if (pPoly->neis[j] != 0) + if (pPoly->neis[e] != 0) continue; } - const float* v0 = &pTile->verts[pPoly->verts[j] * 3]; - const float* v1 = &pTile->verts[pPoly->verts[(j + 1) % nj] * 3]; + const float* v0 = &pTile->verts[pPoly->verts[e] * 3]; + const float* v1 = &pTile->verts[pPoly->verts[(e + 1) % ne] * 3]; // Draw detail mesh edges which align with the actual poly edge. // This is really slow. - for (int k = 0, e = pd->triCount; k < e; ++k) + for (int k = 0, ke = pd->triCount; k < ke; ++k) { const unsigned char* t = &pTile->detailTris[(pd->triBase + k) * 4]; const float* tv[3]; diff --git a/r5dev/mathlib/mathlib_base.cpp b/r5dev/mathlib/mathlib_base.cpp index 447fa4fb..d535f97c 100644 --- a/r5dev/mathlib/mathlib_base.cpp +++ b/r5dev/mathlib/mathlib_base.cpp @@ -3368,6 +3368,13 @@ void Cubic_Spline( Assert(&output != &p3); Assert(&output != &p4); +#ifdef NDEBUG + NOTE_UNUSED(p1); + NOTE_UNUSED(p2); + NOTE_UNUSED(p3); + NOTE_UNUSED(p4); +#endif // NDEBUG + output.Init(); Vector3D a, b, c, d; @@ -3503,6 +3510,10 @@ void Parabolic_Spline( Assert(&output != &p3); Assert(&output != &p4); +#ifdef NDEBUG + NOTE_UNUSED(p4); +#endif // NDEBUG + output.Init(); Vector3D a, b, c, d; @@ -4035,7 +4046,7 @@ bool CalcLineToLineIntersectionSegment( volatile static char const* pDebugString; #endif -void MathLib_Init(float gamma, float texGamma, float brightness, int overbright, bool bAllow3DNow, bool bAllowSSE, bool bAllowSSE2, bool bAllowMMX) +void MathLib_Init(float gamma, float texGamma, float brightness, int overbright) { if (s_bMathlibInitialized) return; @@ -5397,9 +5408,9 @@ void Frustum_t::CreatePerspectiveFrustumFLU(const Vector3D& vOrigin, const Vecto const Vector3D& vLeft, const Vector3D& vUp, float flZNear, float flZFar, float flFovX, float flAspect) { - VPlane planes[FRUSTUM_NUMPLANES]; - GeneratePerspectiveFrustumFLU(vOrigin, vForward, vLeft, vUp, flZNear, flZFar, flFovX, flAspect, planes); - SetPlanes(planes); + VPlane frustumPlanes[FRUSTUM_NUMPLANES]; + GeneratePerspectiveFrustumFLU(vOrigin, vForward, vLeft, vUp, flZNear, flZFar, flFovX, flAspect, frustumPlanes); + SetPlanes(frustumPlanes); } //#ifndef YUP_ACTIVE @@ -5416,19 +5427,19 @@ void Frustum_t::CreatePerspectiveFrustum(const Vector3D& origin, const Vector3D& // Version that accepts angles instead of vectors void Frustum_t::CreatePerspectiveFrustum(const Vector3D& origin, const QAngle& angles, float flZNear, float flZFar, float flFovX, float flAspectRatio) { - VPlane planes[FRUSTUM_NUMPLANES]; + VPlane frustumPlanes[FRUSTUM_NUMPLANES]; Vector3D vecForward, vecLeft, vecUp; AngleVectorsFLU(angles, &vecForward, &vecLeft, &vecUp); - GeneratePerspectiveFrustumFLU(origin, vecForward, vecLeft, vecUp, flZNear, flZFar, flFovX, flAspectRatio, planes); - SetPlanes(planes); + GeneratePerspectiveFrustumFLU(origin, vecForward, vecLeft, vecUp, flZNear, flZFar, flFovX, flAspectRatio, frustumPlanes); + SetPlanes(frustumPlanes); } // Generate a frustum based on orthographic parameters void Frustum_t::CreateOrthoFrustumFLU(const Vector3D& origin, const Vector3D& forward, const Vector3D& vLeft, const Vector3D& up, float flLeft, float flRight, float flBottom, float flTop, float flZNear, float flZFar) { - VPlane planes[FRUSTUM_NUMPLANES]; - GenerateOrthoFrustumFLU(origin, forward, vLeft, up, flLeft, flRight, flBottom, flTop, flZNear, flZFar, planes); - SetPlanes(planes); + VPlane frustumPlanes[FRUSTUM_NUMPLANES]; + GenerateOrthoFrustumFLU(origin, forward, vLeft, up, flLeft, flRight, flBottom, flTop, flZNear, flZFar, frustumPlanes); + SetPlanes(frustumPlanes); } //#ifndef YUP_ACTIVE @@ -5448,41 +5459,41 @@ void Frustum_t::CreateOrthoFrustum(const Vector3D& origin, const Vector3D& forwa // 0--1 bool Frustum_t::GetCorners(Vector3D* pPoints) const { - VPlane planes[FRUSTUM_NUMPLANES]; - GetPlanes(planes); + VPlane frustumPlanes[FRUSTUM_NUMPLANES]; + GetPlanes(frustumPlanes); // Near face // Bottom Left - if (!PlaneIntersection(planes[FRUSTUM_NEARZ], planes[FRUSTUM_LEFT], planes[FRUSTUM_BOTTOM], pPoints[0])) + if (!PlaneIntersection(frustumPlanes[FRUSTUM_NEARZ], frustumPlanes[FRUSTUM_LEFT], frustumPlanes[FRUSTUM_BOTTOM], pPoints[0])) return false; // Bottom right - if (!PlaneIntersection(planes[FRUSTUM_NEARZ], planes[FRUSTUM_RIGHT], planes[FRUSTUM_BOTTOM], pPoints[1])) + if (!PlaneIntersection(frustumPlanes[FRUSTUM_NEARZ], frustumPlanes[FRUSTUM_RIGHT], frustumPlanes[FRUSTUM_BOTTOM], pPoints[1])) return false; // Upper Left - if (!PlaneIntersection(planes[FRUSTUM_NEARZ], planes[FRUSTUM_LEFT], planes[FRUSTUM_TOP], pPoints[2])) + if (!PlaneIntersection(frustumPlanes[FRUSTUM_NEARZ], frustumPlanes[FRUSTUM_LEFT], frustumPlanes[FRUSTUM_TOP], pPoints[2])) return false; // Upper right - if (!PlaneIntersection(planes[FRUSTUM_NEARZ], planes[FRUSTUM_RIGHT], planes[FRUSTUM_TOP], pPoints[3])) + if (!PlaneIntersection(frustumPlanes[FRUSTUM_NEARZ], frustumPlanes[FRUSTUM_RIGHT], frustumPlanes[FRUSTUM_TOP], pPoints[3])) return false; // Far face // Bottom Left - if (!PlaneIntersection(planes[FRUSTUM_FARZ], planes[FRUSTUM_LEFT], planes[FRUSTUM_BOTTOM], pPoints[4])) + if (!PlaneIntersection(frustumPlanes[FRUSTUM_FARZ], frustumPlanes[FRUSTUM_LEFT], frustumPlanes[FRUSTUM_BOTTOM], pPoints[4])) return false; // Bottom right - if (!PlaneIntersection(planes[FRUSTUM_FARZ], planes[FRUSTUM_RIGHT], planes[FRUSTUM_BOTTOM], pPoints[5])) + if (!PlaneIntersection(frustumPlanes[FRUSTUM_FARZ], frustumPlanes[FRUSTUM_RIGHT], frustumPlanes[FRUSTUM_BOTTOM], pPoints[5])) return false; // Upper Left - if (!PlaneIntersection(planes[FRUSTUM_FARZ], planes[FRUSTUM_LEFT], planes[FRUSTUM_TOP], pPoints[6])) + if (!PlaneIntersection(frustumPlanes[FRUSTUM_FARZ], frustumPlanes[FRUSTUM_LEFT], frustumPlanes[FRUSTUM_TOP], pPoints[6])) return false; // Upper right - if (!PlaneIntersection(planes[FRUSTUM_FARZ], planes[FRUSTUM_RIGHT], planes[FRUSTUM_TOP], pPoints[7])) + if (!PlaneIntersection(frustumPlanes[FRUSTUM_FARZ], frustumPlanes[FRUSTUM_RIGHT], frustumPlanes[FRUSTUM_TOP], pPoints[7])) return false;