CSkinLoader: Make use of unsigned stream helpers where applicable

Less implicit sign conversions
This commit is contained in:
Lioncash 2020-06-19 23:54:08 -04:00
parent d738ae0d45
commit 487f2ae176
1 changed files with 9 additions and 7 deletions

View File

@ -4,29 +4,31 @@
// ************ STATIC ************
std::unique_ptr<CSkin> CSkinLoader::LoadCSKR(IInputStream& rCSKR, CResourceEntry *pEntry)
{
if (!rCSKR.IsValid()) return nullptr;
if (!rCSKR.IsValid())
return nullptr;
auto pSkin = std::make_unique<CSkin>(pEntry);
// We don't support MP3/DKCR CSKR yet
if (rCSKR.PeekLong() == FOURCC('SKIN'))
return pSkin;
uint32 NumVertexGroups = rCSKR.ReadLong();
const uint32 NumVertexGroups = rCSKR.ReadULong();
pSkin->mVertGroups.resize(NumVertexGroups);
for (uint32 iGrp = 0; iGrp < NumVertexGroups; iGrp++)
for (size_t iGrp = 0; iGrp < NumVertexGroups; iGrp++)
{
CSkin::SVertGroup& rGroup = pSkin->mVertGroups[iGrp];
uint32 NumWeights = rCSKR.ReadLong();
const uint32 NumWeights = rCSKR.ReadULong();
ASSERT(NumWeights <= 4);
for (uint32 iWgt = 0; iWgt < NumWeights; iWgt++)
for (size_t iWgt = 0; iWgt < NumWeights; iWgt++)
{
rGroup.Weights.Indices[iWgt] = (uint8) rCSKR.ReadLong();
rGroup.Weights.Indices[iWgt] = static_cast<uint8>(rCSKR.ReadULong());
rGroup.Weights.Weights[iWgt] = rCSKR.ReadFloat();
}
rGroup.NumVertices = rCSKR.ReadLong();
rGroup.NumVertices = rCSKR.ReadULong();
}
return pSkin;