reset all models and set mod_numknown to 0 upon gamedir changes.

fixes issue described at:
http://celephais.net/board/view_thread.php?id=60452&start=825
also see http://forums.inside3d.com/viewtopic.php?f=12&t=5509


git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@942 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2014-07-30 09:33:03 +00:00
parent d0c12c25e0
commit 03d4fbd008
3 changed files with 16 additions and 0 deletions

View file

@ -195,6 +195,20 @@ void Mod_ClearAll (void)
}
}
void Mod_ResetAll (void)
{
int i;
qmodel_t *mod;
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
{
if (!mod->needload) //otherwise Mod_ClearAll() did it already
TexMgr_FreeTexturesForOwner (mod);
memset(mod, 0, sizeof(qmodel_t));
}
mod_numknown = 0;
}
/*
==================
Mod_FindName

View file

@ -449,6 +449,7 @@ typedef struct qmodel_s
void Mod_Init (void);
void Mod_ClearAll (void);
void Mod_ResetAll (void); // for gamedir changes (Host_Game_f)
qmodel_t *Mod_ForName (const char *name, qboolean crash);
void *Mod_Extradata (qmodel_t *mod); // handles caching
void Mod_TouchModel (const char *name);

View file

@ -201,6 +201,7 @@ void Host_Game_f (void)
//clear out and reload appropriate data
Cache_Flush ();
Mod_ResetAll();
if (!isDedicated)
{
TexMgr_NewGame ();