]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_shared.c
reduced r_shadow_glossintensity from 2 to 1 by default
[xonotic/darkplaces.git] / model_shared.c
index ad05c4e496f1b6ab1947df4f7270371b56730081..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;
@@ -381,7 +391,7 @@ static void Mod_Print(void)
        Con_Print("Loaded models:\n");
        for (i = 0, mod = mod_known;i < mod_numknown;i++, mod++)
                if (mod->name[0])
-                       Con_Printf("%4iK %s\n", mod->mempool ? (mod->mempool->totalsize + 1023) / 1024 : 0, mod->name);
+                       Con_Printf("%4iK %s\n", mod->mempool ? (int)((mod->mempool->totalsize + 1023) / 1024) : 0, mod->name);
 }
 
 /*
@@ -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))