Fix vid_reload+purecsqc killing the csqc.

This commit is contained in:
Shpoike 2023-03-27 18:20:18 +01:00
parent cae062b142
commit 8c8a4eaf0e

View file

@ -1811,6 +1811,8 @@ TRACE(("dbg: R_ApplyRenderer: starting on client state\n"));
#endif
if (cl.worldmodel)
{
int wmidx = 0;
model_t *oldwm = cl.worldmodel;
cl.worldmodel = NULL;
CL_ClearEntityLists(); //shouldn't really be needed, but we're paranoid
@ -1823,6 +1825,9 @@ TRACE(("dbg: R_ApplyRenderer: reloading ALL models\n"));
TRACE(("dbg: R_ApplyRenderer: reloading model %s\n", cl.model_name[i]));
if (oldwm == cl.model_precache[i])
wmidx = i;
#ifdef Q2CLIENT //skip vweps
if (cls.protocol == CP_QUAKE2 && *cl.model_name[i] == '#')
cl.model_precache[i] = NULL;
@ -1850,14 +1855,19 @@ TRACE(("dbg: R_ApplyRenderer: reloading ALL models\n"));
if (!cl.model_csqcname[i][0])
break;
if (oldwm == cl.model_csqcprecache[i])
wmidx = -i;
cl.model_csqcprecache[i] = NULL;
TRACE(("dbg: R_ApplyRenderer: reloading csqc model %s\n", cl.model_csqcname[i]));
cl.model_csqcprecache[i] = Mod_ForName (Mod_FixName(cl.model_csqcname[i], cl.model_name[1]), MLV_SILENT);
}
#endif
//fixme: worldmodel could be ssqc or csqc.
cl.worldmodel = cl.model_precache[1];
if (wmidx < 0)
cl.worldmodel = cl.model_csqcprecache[-wmidx];
else
#endif
cl.worldmodel = cl.model_precache[wmidx];
if (cl.worldmodel && cl.worldmodel->loadstate == MLS_LOADING)
COM_WorkerPartialSync(cl.worldmodel, &cl.worldmodel->loadstate, MLS_LOADING);