From: divverent Date: Mon, 29 Dec 2008 09:20:51 +0000 (+0000) Subject: models: add a special built-in model name "null" that does not draw and has a zero... X-Git-Tag: xonotic-v0.1.0preview~1981 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=8b091b094f8361e295450b8eb5c0d7cdf28514e5 models: add a special built-in model name "null" that does not draw and has a zero bbox git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8609 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_parse.c b/cl_parse.c index d6b70ac2..4aa25c5a 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -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]); diff --git a/model_shared.c b/model_shared.c index 12bcad7b..d32acc38 100644 --- a/model_shared.c +++ b/model_shared.c @@ -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; diff --git a/model_shared.h b/model_shared.h index 7bf5e020..794e3e83 100644 --- a/model_shared.h +++ b/model_shared.h @@ -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 {