]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_shared.c
fixed support of progs.dat files with important global and field names removed, such...
[xonotic/darkplaces.git] / model_shared.c
index a613449eb92d80caf06203a777c32b61a91c0e5a..1edb3fb44504470b95c0e976a8eb59beebb65d3b 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;
@@ -990,6 +1000,7 @@ int Mod_LoadSkinFrame(skinframe_t *skinframe, const char *basename, int texturef
 {
        imageskin_t s;
        memset(skinframe, 0, sizeof(*skinframe));
+       skinframe->base = r_texture_notexture;
        if (cls.state == ca_dedicated)
                return false;
        if (!image_loadskin(&s, basename))