From: havoc Date: Sun, 21 Jan 2007 11:53:08 +0000 (+0000) Subject: added some comments in Mod_LoadModel X-Git-Tag: xonotic-v0.1.0preview~3693 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e581d6e0937cda49a65ef6086bd9c3c94a44351f;p=xonotic%2Fdarkplaces.git added some comments in Mod_LoadModel git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6713 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/model_shared.c b/model_shared.c index a613449e..5e8d7f1d 100644 --- a/model_shared.c +++ b/model_shared.c @@ -154,8 +154,16 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean checkdisk, qboolea crc = 0; buf = NULL; + + // even if the model is loaded it still may need reloading... + + // if the model is a worldmodel and is being referred to as a + // non-worldmodel here, then it needs reloading to get rid of the + // submodels if (mod->isworldmodel != isworldmodel) mod->loaded = false; + + // if it is not loaded or checkdisk is true we need to calculate the crc if (!mod->loaded || checkdisk) { if (checkdisk && mod->loaded) @@ -164,13 +172,15 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean checkdisk, qboolea if (buf) { crc = CRC_Block((unsigned char *)buf, filesize); + // we need to reload the model if the crc does not match if (mod->crc != crc) mod->loaded = false; } } + + // if the model is already loaded and checks passed, just return if (mod->loaded) { - // already loaded if (buf) Mem_Free(buf); return mod;