]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added some comments in Mod_LoadModel
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 21 Jan 2007 11:53:08 +0000 (11:53 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 21 Jan 2007 11:53:08 +0000 (11:53 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6713 d7cf8633-e32d-0410-b094-e92efae38249

model_shared.c

index a613449eb92d80caf06203a777c32b61a91c0e5a..5e8d7f1dfc8d35111384671e48639951c2ca6e14 100644 (file)
@@ -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;