]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
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 d6b70ac250c72a93e6210bc714890b903c05bcc0..4aa25c5a4fc4e2a396fc89a41af0a0b93df47098 100644 (file)
@@ -1085,7 +1085,7 @@ void CL_BeginDownloads(qboolean aborteddownload)
                                continue;
                        if (cls.signon < SIGNONS)
                                CL_KeepaliveMessage(true);
                                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]);
                        {
                                if (cl.downloadmodel_current == 1)
                                        Con_Printf("Map %s not found\n", cl.model_name[cl.downloadmodel_current]);
index 12bcad7b6f5ad6c1246aba6f9c0acd62877c3144..d32acc383aed9f5bab76746bdf8f23d0ae90c104 100644 (file)
@@ -177,6 +177,11 @@ void Mod_UnloadModel (dp_model_t *mod)
        mod->loaded = false;
 }
 
        mod->loaded = false;
 }
 
+void R_Model_Null_Draw(entity_render_t *ent)
+{
+       return;
+}
+
 /*
 ==================
 Mod_LoadModel
 /*
 ==================
 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 (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;
 
        crc = 0;
        buf = NULL;
index 7bf5e0207a972c4d37b23c5c3bfa031d2920b71b..794e3e83f2e8efad6e3633f8be452263861a3c51 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
 {
 
 typedef struct animscene_s
 {