Rename _countof to sizeOfArray (#921)

This commit is contained in:
Christian Semmler
2024-05-14 10:35:22 -04:00
committed by GitHub
parent 95ed90aacb
commit e32e06321a
20 changed files with 89 additions and 89 deletions

View File

@@ -5,7 +5,7 @@ DECOMP_SIZE_ASSERT(LegoUnknown, 0x50)
// FUNCTION: LEGO1 0x1009a0f0
LegoUnknown::LegoUnknown()
{
for (LegoS32 i = 0; i < _countof(m_unk0x00); i++) {
for (LegoS32 i = 0; i < sizeOfArray(m_unk0x00); i++) {
m_unk0x00[i].Clear();
}
}

View File

@@ -108,21 +108,21 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
}
if (numVerts > 0) {
vertices = new float[numVerts][_countof(*vertices)];
vertices = new float[numVerts][sizeOfArray(*vertices)];
if (p_storage->Read(vertices, numVerts * sizeof(*vertices)) != SUCCESS) {
goto done;
}
}
if (numNormals > 0) {
normals = new float[numNormals][_countof(*normals)];
normals = new float[numNormals][sizeOfArray(*normals)];
if (p_storage->Read(normals, numNormals * sizeof(*normals)) != SUCCESS) {
goto done;
}
}
if (numTextureVertices > 0) {
textureVertices = new float[numTextureVertices][_countof(*textureVertices)];
textureVertices = new float[numTextureVertices][sizeOfArray(*textureVertices)];
if (p_storage->Read(textureVertices, numTextureVertices * sizeof(*textureVertices)) != SUCCESS) {
goto done;
}
@@ -143,7 +143,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
goto done;
}
polyIndices = new LegoU32[numPolys & MAXWORD][_countof(*polyIndices)];
polyIndices = new LegoU32[numPolys & MAXWORD][sizeOfArray(*polyIndices)];
if (p_storage->Read(polyIndices, (numPolys & MAXWORD) * sizeof(*polyIndices)) != SUCCESS) {
goto done;
}
@@ -153,7 +153,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
}
if (numTextureIndices > 0) {
textureIndices = new LegoU32[numPolys & MAXWORD][_countof(*textureIndices)];
textureIndices = new LegoU32[numPolys & MAXWORD][sizeOfArray(*textureIndices)];
if (p_storage->Read(textureIndices, (numPolys & MAXWORD) * sizeof(*textureIndices)) != SUCCESS) {
goto done;
}
@@ -212,7 +212,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
if (textureName != NULL) {
if (mesh->GetUnknown0x21()) {
LegoROI::FUN_100a9cf0(textureName, paletteEntries, _countof(paletteEntries));
LegoROI::FUN_100a9cf0(textureName, paletteEntries, sizeOfArray(paletteEntries));
}
textureInfo = p_textureContainer->Get(mesh->GetTextureName());

View File

@@ -609,7 +609,7 @@ LegoBool LegoROI::FUN_100a9bf0(const LegoChar* p_param, float& p_red, float& p_g
// FUNCTION: LEGO1 0x100a9c50
LegoBool LegoROI::ColorAliasLookup(const LegoChar* p_param, float& p_red, float& p_green, float& p_blue, float& p_alpha)
{
for (MxU32 i = 0; i < _countof(g_roiColorAliases); i++) {
for (MxU32 i = 0; i < sizeOfArray(g_roiColorAliases); i++) {
if (strcmpi(g_roiColorAliases[i].m_name, p_param) == 0) {
p_red = g_roiColorAliases[i].m_red / 255.0;
p_green = g_roiColorAliases[i].m_green / 255.0;