misc cleanup/fixes

This commit is contained in:
Ricardo Luís Vaz Silva 2023-06-26 16:51:17 -03:00 committed by Christoph Oelckers
parent abcc0421e4
commit a8b8de94d6

View file

@ -5183,11 +5183,6 @@ void ChangeModelNative(
auto skindata = skin != NAME_None ? LoadSkin(skinpath.GetChars(), skin.GetChars()) : FNullTextureID(); auto skindata = skin != NAME_None ? LoadSkin(skinpath.GetChars(), skin.GetChars()) : FNullTextureID();
if(!(flags & CMDL_USESURFACESKIN) && mobj->modelData->skinIDs.Size() < skinindex)
{
mobj->modelData->skinIDs.AppendFill(FNullTextureID(), skinindex - mobj->modelData->skinIDs.Size());
}
if(mobj->modelData->models.Size() == modelindex) if(mobj->modelData->models.Size() == modelindex)
{ {
@ -5216,6 +5211,7 @@ void ChangeModelNative(
{ {
mobj->modelData->models[modelindex].surfaceSkinIDs.AppendFill(FNullTextureID(), skinindex - mobj->modelData->models[modelindex].surfaceSkinIDs.Size()); mobj->modelData->models[modelindex].surfaceSkinIDs.AppendFill(FNullTextureID(), skinindex - mobj->modelData->models[modelindex].surfaceSkinIDs.Size());
} }
if(skinindex == mobj->modelData->models[modelindex].surfaceSkinIDs.Size()) if(skinindex == mobj->modelData->models[modelindex].surfaceSkinIDs.Size())
{ {
mobj->modelData->models[modelindex].surfaceSkinIDs.Push(skindata); mobj->modelData->models[modelindex].surfaceSkinIDs.Push(skindata);
@ -5225,8 +5221,8 @@ void ChangeModelNative(
mobj->modelData->models[modelindex].surfaceSkinIDs[skinindex] = skindata; mobj->modelData->models[modelindex].surfaceSkinIDs[skinindex] = skindata;
} }
} }
mobj->modelData->models[modelindex].modelID = queryModel; if(queryModel != -1) mobj->modelData->models[modelindex].modelID = queryModel;
mobj->modelData->modelFrameGenerators[modelindex] = generatorindex; if(generatorindex != -1) mobj->modelData->modelFrameGenerators[modelindex] = generatorindex;
} }
if(mobj->modelData->animationIDs.Size() == animationindex) if(mobj->modelData->animationIDs.Size() == animationindex)
@ -5240,6 +5236,11 @@ void ChangeModelNative(
if (!(flags & CMDL_USESURFACESKIN)) if (!(flags & CMDL_USESURFACESKIN))
{ {
if(mobj->modelData->skinIDs.Size() < skinindex)
{
mobj->modelData->skinIDs.AppendFill(FNullTextureID(), skinindex - mobj->modelData->skinIDs.Size());
}
if(mobj->modelData->skinIDs.Size() == skinindex) if(mobj->modelData->skinIDs.Size() == skinindex)
{ {
mobj->modelData->skinIDs.Push(skindata); mobj->modelData->skinIDs.Push(skindata);