mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-11-23 05:12:05 +00:00
chore: use unsigned numeric types when applicable
This commit is contained in:
@@ -34,9 +34,9 @@ namespace BSP
|
|||||||
struct BSPSurface
|
struct BSPSurface
|
||||||
{
|
{
|
||||||
BSPMaterial material;
|
BSPMaterial material;
|
||||||
int triCount;
|
unsigned triCount;
|
||||||
int indexOfFirstVertex;
|
unsigned indexOfFirstVertex;
|
||||||
int indexOfFirstIndex;
|
unsigned indexOfFirstIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BSPWorld
|
struct BSPWorld
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace BSP
|
namespace BSP
|
||||||
{
|
{
|
||||||
constexpr int MAX_NODE_SIZE = 512; // maximum size a BSP node can be before it becomes a leaf
|
constexpr auto MAX_NODE_SIZE = 512u; // maximum size a BSP node can be before it becomes a leaf
|
||||||
|
|
||||||
BSPObject::BSPObject(
|
BSPObject::BSPObject(
|
||||||
const float xMin, const float yMin, const float zMin, const float xMax, const float yMax, const float zMax, const int objPartitionIndex)
|
const float xMin, const float yMin, const float zMin, const float xMax, const float yMax, const float zMax, const int objPartitionIndex)
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ namespace
|
|||||||
|
|
||||||
BSPSurface surface;
|
BSPSurface surface;
|
||||||
size_t partTriangleNum = meshPart.num_triangles;
|
size_t partTriangleNum = meshPart.num_triangles;
|
||||||
surface.triCount = static_cast<int>(partTriangleNum);
|
surface.triCount = static_cast<unsigned>(partTriangleNum);
|
||||||
surface.indexOfFirstVertex = static_cast<int>(vertexVec.size());
|
surface.indexOfFirstVertex = static_cast<unsigned>(vertexVec.size());
|
||||||
surface.indexOfFirstIndex = static_cast<int>(indexVec.size());
|
surface.indexOfFirstIndex = static_cast<unsigned>(indexVec.size());
|
||||||
|
|
||||||
if (mesh->materials.count == 0)
|
if (mesh->materials.count == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace BSP
|
|||||||
|
|
||||||
void ClipMapLinker::loadDynEnts(clipMap_t& clipMap) const
|
void ClipMapLinker::loadDynEnts(clipMap_t& clipMap) const
|
||||||
{
|
{
|
||||||
int dynEntCount = 0;
|
uint16_t dynEntCount = 0;
|
||||||
clipMap.originalDynEntCount = dynEntCount;
|
clipMap.originalDynEntCount = dynEntCount;
|
||||||
clipMap.dynEntCount[0] = clipMap.originalDynEntCount + 256; // the game allocs 256 empty dynents, as they may be used ingame
|
clipMap.dynEntCount[0] = clipMap.originalDynEntCount + 256; // the game allocs 256 empty dynents, as they may be used ingame
|
||||||
clipMap.dynEntCount[1] = 0;
|
clipMap.dynEntCount[1] = 0;
|
||||||
@@ -495,9 +495,9 @@ namespace BSP
|
|||||||
{
|
{
|
||||||
const auto indexOfFirstIndex = surface.indexOfFirstIndex;
|
const auto indexOfFirstIndex = surface.indexOfFirstIndex;
|
||||||
const auto indexOfFirstVertex = surface.indexOfFirstVertex;
|
const auto indexOfFirstVertex = surface.indexOfFirstVertex;
|
||||||
for (auto indexIdx = 0; indexIdx < surface.triCount * 3; indexIdx++)
|
for (auto indexIdx = 0u; indexIdx < surface.triCount * 3; indexIdx++)
|
||||||
{
|
{
|
||||||
auto triIndex = bsp.colWorld.indices[indexOfFirstIndex + indexIdx] + indexOfFirstVertex;
|
auto triIndex = static_cast<uint16_t>(bsp.colWorld.indices[indexOfFirstIndex + indexIdx] + indexOfFirstVertex);
|
||||||
triIndexVec.emplace_back(triIndex);
|
triIndexVec.emplace_back(triIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -516,11 +516,11 @@ namespace BSP
|
|||||||
// so a partition is made for each triangle which removes the physics bugs but likely makes the game run slower
|
// so a partition is made for each triangle which removes the physics bugs but likely makes the game run slower
|
||||||
const auto indexOfFirstTri = surface.indexOfFirstIndex / 3;
|
const auto indexOfFirstTri = surface.indexOfFirstIndex / 3;
|
||||||
const auto indexOfFirstVertex = surface.indexOfFirstVertex;
|
const auto indexOfFirstVertex = surface.indexOfFirstVertex;
|
||||||
for (auto triIdx = 0; triIdx < surface.triCount; triIdx++)
|
for (auto triIdx = 0u; triIdx < surface.triCount; triIdx++)
|
||||||
{
|
{
|
||||||
CollisionPartition partition;
|
CollisionPartition partition;
|
||||||
partition.triCount = 1;
|
partition.triCount = 1;
|
||||||
partition.firstTri = indexOfFirstTri + triIdx;
|
partition.firstTri = static_cast<int>(indexOfFirstTri + triIdx);
|
||||||
|
|
||||||
partition.nuinds = 3;
|
partition.nuinds = 3;
|
||||||
partition.fuind = static_cast<int>(uniqueIndicesVec.size());
|
partition.fuind = static_cast<int>(uniqueIndicesVec.size());
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace BSP
|
|||||||
gameWorldMp->path.nodeTreeCount = 0;
|
gameWorldMp->path.nodeTreeCount = 0;
|
||||||
|
|
||||||
// The game has 128 empty nodes allocated
|
// The game has 128 empty nodes allocated
|
||||||
const auto extraNodeCount = gameWorldMp->path.nodeCount + 128;
|
const auto extraNodeCount = gameWorldMp->path.nodeCount + 128u;
|
||||||
gameWorldMp->path.nodes = m_memory.Alloc<pathnode_t>(extraNodeCount);
|
gameWorldMp->path.nodes = m_memory.Alloc<pathnode_t>(extraNodeCount);
|
||||||
gameWorldMp->path.basenodes = m_memory.Alloc<pathbasenode_t>(extraNodeCount);
|
gameWorldMp->path.basenodes = m_memory.Alloc<pathbasenode_t>(extraNodeCount);
|
||||||
gameWorldMp->path.pathVis = nullptr;
|
gameWorldMp->path.pathVis = nullptr;
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ namespace BSP
|
|||||||
gfxSurface->flags = BSPEditableConstants::DEFAULT_SURFACE_FLAGS;
|
gfxSurface->flags = BSPEditableConstants::DEFAULT_SURFACE_FLAGS;
|
||||||
|
|
||||||
gfxSurface->tris.triCount = static_cast<uint16_t>(bspSurface.triCount);
|
gfxSurface->tris.triCount = static_cast<uint16_t>(bspSurface.triCount);
|
||||||
gfxSurface->tris.baseIndex = bspSurface.indexOfFirstIndex;
|
gfxSurface->tris.baseIndex = static_cast<int>(bspSurface.indexOfFirstIndex);
|
||||||
|
|
||||||
gfxSurface->tris.vertexDataOffset0 = bspSurface.indexOfFirstVertex * sizeof(GfxPackedWorldVertex);
|
gfxSurface->tris.vertexDataOffset0 = static_cast<int>(bspSurface.indexOfFirstVertex * sizeof(GfxPackedWorldVertex));
|
||||||
gfxSurface->tris.vertexDataOffset1 = 0;
|
gfxSurface->tris.vertexDataOffset1 = 0;
|
||||||
|
|
||||||
std::string surfMaterialName;
|
std::string surfMaterialName;
|
||||||
@@ -666,7 +666,7 @@ namespace BSP
|
|||||||
|
|
||||||
void GfxWorldLinker::loadDynEntData(GfxWorld& gfxWorld) const
|
void GfxWorldLinker::loadDynEntData(GfxWorld& gfxWorld) const
|
||||||
{
|
{
|
||||||
int dynEntCount = 0;
|
unsigned dynEntCount = 0u;
|
||||||
gfxWorld.dpvsDyn.dynEntClientCount[0] = dynEntCount + 256; // the game allocs 256 empty dynents, as they may be used ingame
|
gfxWorld.dpvsDyn.dynEntClientCount[0] = dynEntCount + 256; // the game allocs 256 empty dynents, as they may be used ingame
|
||||||
gfxWorld.dpvsDyn.dynEntClientCount[1] = 0;
|
gfxWorld.dpvsDyn.dynEntClientCount[1] = 0;
|
||||||
|
|
||||||
@@ -676,11 +676,11 @@ namespace BSP
|
|||||||
gfxWorld.dpvsDyn.dynEntClientWordCount[1] = 0;
|
gfxWorld.dpvsDyn.dynEntClientWordCount[1] = 0;
|
||||||
gfxWorld.dpvsDyn.usageCount = 0;
|
gfxWorld.dpvsDyn.usageCount = 0;
|
||||||
|
|
||||||
const auto dynEntCellBitsSize = gfxWorld.dpvsDyn.dynEntClientWordCount[0] * gfxWorld.dpvsPlanes.cellCount;
|
const auto dynEntCellBitsSize = gfxWorld.dpvsDyn.dynEntClientWordCount[0] * static_cast<unsigned>(gfxWorld.dpvsPlanes.cellCount);
|
||||||
gfxWorld.dpvsDyn.dynEntCellBits[0] = m_memory.Alloc<unsigned int>(dynEntCellBitsSize);
|
gfxWorld.dpvsDyn.dynEntCellBits[0] = m_memory.Alloc<unsigned int>(dynEntCellBitsSize);
|
||||||
gfxWorld.dpvsDyn.dynEntCellBits[1] = nullptr;
|
gfxWorld.dpvsDyn.dynEntCellBits[1] = nullptr;
|
||||||
|
|
||||||
const auto dynEntVisData0Size = gfxWorld.dpvsDyn.dynEntClientWordCount[0] * 32;
|
const auto dynEntVisData0Size = gfxWorld.dpvsDyn.dynEntClientWordCount[0] * 32u;
|
||||||
gfxWorld.dpvsDyn.dynEntVisData[0][0] = m_memory.Alloc<char>(dynEntVisData0Size);
|
gfxWorld.dpvsDyn.dynEntVisData[0][0] = m_memory.Alloc<char>(dynEntVisData0Size);
|
||||||
gfxWorld.dpvsDyn.dynEntVisData[0][1] = m_memory.Alloc<char>(dynEntVisData0Size);
|
gfxWorld.dpvsDyn.dynEntVisData[0][1] = m_memory.Alloc<char>(dynEntVisData0Size);
|
||||||
gfxWorld.dpvsDyn.dynEntVisData[0][2] = m_memory.Alloc<char>(dynEntVisData0Size);
|
gfxWorld.dpvsDyn.dynEntVisData[0][2] = m_memory.Alloc<char>(dynEntVisData0Size);
|
||||||
@@ -688,7 +688,7 @@ namespace BSP
|
|||||||
gfxWorld.dpvsDyn.dynEntVisData[1][1] = nullptr;
|
gfxWorld.dpvsDyn.dynEntVisData[1][1] = nullptr;
|
||||||
gfxWorld.dpvsDyn.dynEntVisData[1][2] = nullptr;
|
gfxWorld.dpvsDyn.dynEntVisData[1][2] = nullptr;
|
||||||
|
|
||||||
const auto dynEntShadowVisCount = gfxWorld.dpvsDyn.dynEntClientCount[0] * (gfxWorld.primaryLightCount - gfxWorld.sunPrimaryLightIndex - 1);
|
const auto dynEntShadowVisCount = gfxWorld.dpvsDyn.dynEntClientCount[0] * (gfxWorld.primaryLightCount - gfxWorld.sunPrimaryLightIndex - 1u);
|
||||||
gfxWorld.primaryLightDynEntShadowVis[0] = m_memory.Alloc<unsigned int>(dynEntShadowVisCount);
|
gfxWorld.primaryLightDynEntShadowVis[0] = m_memory.Alloc<unsigned int>(dynEntShadowVisCount);
|
||||||
gfxWorld.primaryLightDynEntShadowVis[1] = nullptr;
|
gfxWorld.primaryLightDynEntShadowVis[1] = nullptr;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user