From 1f1fd33511055b6fbca7cc13d508180d56695a9a Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 18 Dec 2007 08:45:02 +0000 Subject: [PATCH] moved Mod_LoadQ3Shaders() call from CL_BeginDownloads to Mod_LoadModel (but only when isworldmodel is true, which indicates a level change) this fixes a bug where downloaded maps have missing shaders on the first load, and also fixes a crash introduced by res on dedicated servers git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7818 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_parse.c | 7 ------- model_shared.c | 6 ++++++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cl_parse.c b/cl_parse.c index 0cb0133e..bf0ba3ee 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -528,9 +528,6 @@ static void QW_CL_RequestNextDownload(void) cls.qw_downloadtype = dl_none; - // parse the Q3 shader files - Mod_LoadQ3Shaders(); - // touch all of the precached models that are still loaded so we can free // anything that isn't needed if (!sv.active) @@ -997,10 +994,6 @@ void CL_BeginDownloads(qboolean aborteddownload) { // loading models - // parse the Q3 shader files - if (cl.loadmodel_current < 2) - Mod_LoadQ3Shaders(); - for (;cl.loadmodel_current < cl.loadmodel_total;cl.loadmodel_current++) { if (cl.model_precache[cl.loadmodel_current] && cl.model_precache[cl.loadmodel_current]->Draw) diff --git a/model_shared.c b/model_shared.c index d341e172..c376d4af 100644 --- a/model_shared.c +++ b/model_shared.c @@ -245,6 +245,12 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean checkdisk, qboolea VectorSet(mod->rotatedmins, -mod->radius, -mod->radius, -mod->radius); VectorSet(mod->rotatedmaxs, mod->radius, mod->radius, mod->radius); + // if we're loading a worldmodel, then this is a level change, and we + // should reload all q3 shaders to make sure they are current (which will + // also be used by any other models loaded after this world model) + if (mod->isworldmodel) + Mod_LoadQ3Shaders(); + if (buf) { char *bufend = (char *)buf + filesize; -- 2.39.2