Update models_md3.cpp

This commit is contained in:
Chernoskill 2021-03-06 11:26:31 +01:00 committed by GitHub
parent 72787c2c4c
commit 4e583772d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -307,7 +307,7 @@ void FMD3Model::AddSkins(uint8_t *hitlist)
for (unsigned i = 0; i < Surfaces.Size(); i++)
{
int ssIndex = i + curMDLIndex * MD3_MAX_SURFACES;
if (curSpriteMDLFrame->surfaceskinIDs[ssIndex].isValid())
if (curSpriteMDLFrame && curSpriteMDLFrame->surfaceskinIDs[ssIndex].isValid())
{
hitlist[curSpriteMDLFrame->surfaceskinIDs[ssIndex].GetIndex()] |= FTextureManager::HIT_Flat;
}
@ -357,6 +357,8 @@ void FMD3Model::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int f
// Note: Each surface may have a different skin.
FGameTexture *surfaceSkin = skin;
if (!surfaceSkin)
{
if (curSpriteMDLFrame)
{
int ssIndex = i + curMDLIndex * MD3_MAX_SURFACES;
if (curSpriteMDLFrame->surfaceskinIDs[ssIndex].isValid())
@ -367,6 +369,7 @@ void FMD3Model::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int f
{
surfaceSkin = TexMan.GetGameTexture(surf->Skins[0], true);
}
}
if (!surfaceSkin)
{