models: add a special built-in model name "null" that does not draw and has a zero...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 29 Dec 2008 09:20:51 +0000 (09:20 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 29 Dec 2008 09:20:51 +0000 (09:20 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8609 d7cf8633-e32d-0410-b094-e92efae38249

cl_parse.c
model_shared.c
model_shared.h

index d6b70ac..4aa25c5 100644 (file)
@@ -1085,7 +1085,7 @@ void CL_BeginDownloads(qboolean aborteddownload)
                                continue;
                        if (cls.signon < SIGNONS)
                                CL_KeepaliveMessage(true);
-                       if (!FS_FileExists(cl.model_name[cl.downloadmodel_current]))
+                       if (strcmp(cl.model_name[cl.downloadmodel_current], "null") && !FS_FileExists(cl.model_name[cl.downloadmodel_current]))
                        {
                                if (cl.downloadmodel_current == 1)
                                        Con_Printf("Map %s not found\n", cl.model_name[cl.downloadmodel_current]);
index 12bcad7..d32acc3 100644 (file)
@@ -177,6 +177,11 @@ void Mod_UnloadModel (dp_model_t *mod)
        mod->loaded = false;
 }
 
+void R_Model_Null_Draw(entity_render_t *ent)
+{
+       return;
+}
+
 /*
 ==================
 Mod_LoadModel
@@ -195,6 +200,38 @@ dp_model_t *Mod_LoadModel(dp_model_t *mod, qboolean crash, qboolean checkdisk, q
 
        if (mod->name[0] == '*') // submodel
                return mod;
+       
+       if (!strcmp(mod->name, "null"))
+       {
+               if (mod->loaded || mod->mempool)
+                       Mod_UnloadModel(mod);
+
+               if (developer_loading.integer)
+                       Con_Printf("loading model %s\n", mod->name);
+
+               mod->isworldmodel = isworldmodel;
+               mod->used = true;
+               mod->crc = -1;
+               mod->loaded = false;
+
+               VectorClear(mod->normalmins);
+               VectorClear(mod->normalmaxs);
+               VectorClear(mod->yawmins);
+               VectorClear(mod->yawmaxs);
+               VectorClear(mod->rotatedmins);
+               VectorClear(mod->rotatedmaxs);
+
+               mod->modeldatatypestring = "null";
+               mod->type = mod_null;
+               mod->Draw = R_Model_Null_Draw;
+               mod->numframes = 2;
+               mod->numskins = 1;
+
+               // no fatal errors occurred, so this model is ready to use.
+               mod->loaded = true;
+
+               return mod;
+       }
 
        crc = 0;
        buf = NULL;
index 7bf5e02..794e3e8 100644 (file)
@@ -30,7 +30,7 @@ m*_t structures are in-memory
 
 */
 
-typedef enum modtype_e {mod_invalid, mod_brushq1, mod_sprite, mod_alias, mod_brushq2, mod_brushq3} modtype_t;
+typedef enum modtype_e {mod_invalid, mod_brushq1, mod_sprite, mod_alias, mod_brushq2, mod_brushq3, mod_null} modtype_t;
 
 typedef struct animscene_s
 {