mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 06:41:41 +00:00
- fixed initialization of model frames
Replaced loop arrays initialization and obvious comments with something more readable, I hope https://forum.zdoom.org/viewtopic.php?t=72523
This commit is contained in:
parent
adad028b33
commit
e0f07d7088
1 changed files with 11 additions and 18 deletions
|
@ -413,25 +413,18 @@ static void ParseModelDefLump(int Lump)
|
||||||
{
|
{
|
||||||
smf.modelsAmount = MIN_MODELS;
|
smf.modelsAmount = MIN_MODELS;
|
||||||
}
|
}
|
||||||
//Allocate TArrays
|
|
||||||
smf.modelIDs.Alloc(smf.modelsAmount);
|
const auto initArray = [](auto& array, const unsigned count, const auto value)
|
||||||
smf.skinIDs.Alloc(smf.modelsAmount);
|
|
||||||
smf.surfaceskinIDs.Alloc(smf.modelsAmount * MD3_MAX_SURFACES);
|
|
||||||
smf.modelframes.Alloc(smf.modelsAmount);
|
|
||||||
//Make sure all modelIDs are -1 by default
|
|
||||||
for (auto& modelID : smf.modelIDs)
|
|
||||||
{
|
{
|
||||||
modelID = -1;
|
array.Alloc(count);
|
||||||
}
|
std::fill(array.begin(), array.end(), value);
|
||||||
//Make sure no TArray elements of type FTextureID are null. These elements will have a textureid (FTextureID.texnum) of 0.
|
};
|
||||||
for (auto& skinID : smf.skinIDs)
|
|
||||||
{
|
initArray(smf.modelIDs, smf.modelsAmount, -1);
|
||||||
skinID = FTextureID(FNullTextureID());
|
initArray(smf.skinIDs, smf.modelsAmount, FNullTextureID());
|
||||||
}
|
initArray(smf.surfaceskinIDs, smf.modelsAmount * MD3_MAX_SURFACES, FNullTextureID());
|
||||||
for (auto& surfaceskinID : smf.surfaceskinIDs)
|
initArray(smf.modelframes, smf.modelsAmount, 0);
|
||||||
{
|
|
||||||
surfaceskinID = FTextureID(FNullTextureID());
|
|
||||||
}
|
|
||||||
sc.RestorePos(scPos);
|
sc.RestorePos(scPos);
|
||||||
sc.MustGetStringName("{");
|
sc.MustGetStringName("{");
|
||||||
while (!sc.CheckString("}"))
|
while (!sc.CheckString("}"))
|
||||||
|
|
Loading…
Reference in a new issue