Attempt loading of an MD2 only once; if we failed then don't bother again

This keeps my new error messages from flooding the console and log.txt
This commit is contained in:
Monster Iestyn 2016-11-03 21:06:23 +00:00
parent 2ec972af54
commit 561a0fe768
2 changed files with 6 additions and 0 deletions

View File

@ -782,6 +782,7 @@ void HWR_InitMD2(void)
md2_playermodels[s].grpatch = NULL;
md2_playermodels[s].skin = -1;
md2_playermodels[s].notfound = true;
md2_playermodels[s].error = false;
}
for (i = 0; i < NUMSPRITES; i++)
{
@ -790,6 +791,7 @@ void HWR_InitMD2(void)
md2_models[i].grpatch = NULL;
md2_models[i].skin = -1;
md2_models[i].notfound = true;
md2_models[s].error = false;
}
// read the md2.dat file
@ -1282,6 +1284,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
else
md2 = &md2_models[spr->mobj->sprite];
if (md2->error)
return; // we already failed loading this before :(
if (!md2->model)
{
//CONS_Debug(DBG_RENDER, "Loading MD2... (%s)", sprnames[spr->mobj->sprite]);
@ -1295,6 +1299,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
else
{
//CONS_Debug(DBG_RENDER, " FAILED\n");
md2->error = true; // prevent endless fail
return;
}
}

View File

@ -123,6 +123,7 @@ typedef struct
void *blendgrpatch;
boolean notfound;
INT32 skin;
boolean error;
} md2_t;
extern md2_t md2_models[NUMSPRITES];