From 9824304aa54de85a6a2ad3c45a6a4b10e97d28fe Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 28 May 2022 17:58:21 +0000 Subject: [PATCH] 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 --- engine/gl/gl_model.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index 967032581..265be5a13 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -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;