Make sure model fields are 0-filled, to avoid issues with models that are reloaded (eg when the user replaces them with a different type of model/etc.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6238 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2022-05-28 17:58:21 +00:00
parent b8b77e2a1d
commit 9824304aa5

View file

@ -1086,6 +1086,9 @@ static void Mod_LoadModelWorker (void *ctx, void *data, size_t a, size_t b)
char ext[8];
int basedepth;
//clear out any old state.
memset(&mod->loadstate+1, 0, sizeof(*mod) - (qintptr_t)(&((model_t*)NULL)->loadstate+1));
if (!*mod->publicname)
{
mod->type = mod_dummy;
@ -1114,8 +1117,6 @@ static void Mod_LoadModelWorker (void *ctx, void *data, size_t a, size_t b)
//
// load the file
//
mod->maxlod = 0;
mod->lightmaps.first = 0;
// set necessary engine flags for loading purposes
if (!strcmp(mod->publicname, "progs/player.mdl"))
mod->engineflags |= MDLF_PLAYER | MDLF_DOCRC;