diff --git a/engine/client/r_efrag.c b/engine/client/r_efrag.c index 839b14387..73d481ba7 100644 --- a/engine/client/r_efrag.c +++ b/engine/client/r_efrag.c @@ -265,16 +265,8 @@ void R_StoreEfrags (efrag_t **ppefrag) pent = pefrag->entity; clmodel = pent->model; - //if ( (!strcmp(clmodel->name, "progs/flame.mdl")) || (!strcmp(clmodel->name, "progs/flame2.mdl")) && (r_drawflame.value == 0) && (gl_part_flame.value == 0) ) - //if ( strcmp(clmodel->name, "progs/flame.mdl") || strcmp(clmodel->name, "progs/flame2.mdl") && (r_drawflame.value == 0) && (gl_part_flame.value == 0) ) - //{ - // break; - //} - - if ( (strcmp(clmodel->name, "progs/flame.mdl")) || (strcmp(clmodel->name, "progs/flame2.mdl")) && (!r_drawflame.value) ) - { - return; - } + if ((!r_drawflame.value) && (clmodel->engineflags & MDLF_FLAME)) + break; // switch (clmodel->type) // { diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index 21d52e0e3..3f6aca9e2 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -206,8 +206,7 @@ void Mod_DoCRC(model_t *mod, char *buffer, int buffersize) { #ifndef SERVERONLY //we've got to have this bit - if (!strcmp(loadmodel->name, "progs/player.mdl") || - !strcmp(loadmodel->name, "progs/eyes.mdl")) + if (loadmodel->engineflags & MDLF_DOCRC) { unsigned short crc; qbyte *p; @@ -220,13 +219,13 @@ void Mod_DoCRC(model_t *mod, char *buffer, int buffersize) sprintf(st, "%d", (int) crc); Info_SetValueForKey (cls.userinfo, - !strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name, + (loadmodel->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name, st, MAX_INFO_STRING); if (cls.state >= ca_connected) { CL_SendClientCommand(true, "setinfo %s %d", - !strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name, + (loadmodel->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name, (int)crc); } } @@ -1711,7 +1710,7 @@ void R_DrawGAliasModel (entity_t *e) //MORE HUGE HACKS! WHEN WILL THEY CEASE! // clamp lighting so it doesn't overbright as much // ZOID: never allow players to go totally black - if (!strcmp(clmodel->name, "progs/player.mdl")) + if (clmodel->engineflags & MDLF_PLAYER) { float fb = r_fullbrightSkins.value; if (fb > cls.allow_fbskins) @@ -2615,7 +2614,7 @@ void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius) mesh_t mesh; vec3_t lightorg; - if (!strcmp (clmodel->name, "progs/flame2.mdl")) + if (clmodel->engineflags & MDLF_FLAME) return; if (!strncmp (clmodel->name, "progs/bolt", 10)) return; diff --git a/engine/gl/gl_hlmdl.c b/engine/gl/gl_hlmdl.c index 25a2a6533..06ea3595f 100644 --- a/engine/gl/gl_hlmdl.c +++ b/engine/gl/gl_hlmdl.c @@ -93,8 +93,8 @@ void Mod_LoadHLModel (model_t *mod, void *buffer) //checksum the model - if (!strcmp(mod->name, "progs/player.mdl") || - !strcmp(mod->name, "progs/eyes.mdl")) { + if (mod->engineflags & MDLF_DOCRC) + { unsigned short crc; qbyte *p; int len; @@ -106,13 +106,13 @@ void Mod_LoadHLModel (model_t *mod, void *buffer) sprintf(st, "%d", (int) crc); Info_SetValueForKey (cls.userinfo, - !strcmp(mod->name, "progs/player.mdl") ? pmodel_name : emodel_name, + (mod->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name, st, MAX_INFO_STRING); if (cls.state >= ca_connected) { CL_SendClientCommand(true, "setinfo %s %d", - !strcmp(mod->name, "progs/player.mdl") ? pmodel_name : emodel_name, + (mod->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name, (int)crc); } } diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index 6deb3f0fa..9a34ecd71 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -514,6 +514,14 @@ couldntload: // fill it in // + // set necessary engine flags for loading purposes + if (!strcmp(mod->name, "progs/player.mdl")) + mod->engineflags |= MDLF_PLAYER | MDLF_DOCRC; + else if (!strcmp(mod->name, "progs/flame.mdl") || !strcmp(mod->name, "progs/flame2.mdl")) + mod->engineflags |= MDLF_FLAME; + else if (!strcmp(mod->name, "progs/eyes.mdl")) + mod->engineflags |= MDLF_DOCRC; + // call the apropriate loader mod->needload = false; diff --git a/engine/gl/gl_model.h b/engine/gl/gl_model.h index a9d3e09c2..1073ebe41 100644 --- a/engine/gl/gl_model.h +++ b/engine/gl/gl_model.h @@ -799,9 +799,12 @@ typedef struct model_s } model_t; -#define MDLF_ENGULPHS 0x1 // particle effect engulphs model (don't draw) -#define MDLF_NODEFAULTTRAIL 0x2 -#define MDLF_RGBLIGHTING 0x4 +#define MDLF_ENGULPHS 0x01 // particle effect engulphs model (don't draw) +#define MDLF_NODEFAULTTRAIL 0x02 +#define MDLF_RGBLIGHTING 0x04 +#define MDLF_PLAYER 0x08 // players have specific lighting values +#define MDLF_FLAME 0x10 // can be excluded with r_drawflame +#define MDLF_DOCRC 0x20 // model needs CRC built //============================================================================ /* diff --git a/engine/server/svmodel.c b/engine/server/svmodel.c index a420ad930..bc7c3069e 100644 --- a/engine/server/svmodel.c +++ b/engine/server/svmodel.c @@ -270,9 +270,13 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash) // call the apropriate loader mod->needload = false; - - - + // set necessary engine flags for loading purposes + if (!strcmp(mod->name, "progs/player.mdl")) + { + mod->engineflags |= MDLF_PLAYER | MDLF_DOCRC; + } + else if (!strcmp(mod->name, "progs/eyes.mdl")) + mod->engineflags |= MDLF_DOCRC; switch (LittleLong(*(unsigned *)buf)) { diff --git a/engine/sw/sw_model.c b/engine/sw/sw_model.c index e0b73a1c6..f98a0d61d 100644 --- a/engine/sw/sw_model.c +++ b/engine/sw/sw_model.c @@ -357,6 +357,17 @@ model_t *SWMod_LoadModel (model_t *mod, qboolean crash) // fill it in // + // set necessary engine flags for loading purposes + if (!strcmp(mod->name, "progs/player.mdl")) + { + mod->engineflags |= MDLF_PLAYER | MDLF_DOCRC; + } + else if (!strcmp(mod->name, "progs/flame.mdl") || !strcmp(mod->name, "progs/flame2.mdl")) + mod->engineflags |= MDLF_FLAME; + else if (!strcmp(mod->name, "progs/eyes.mdl")) + mod->engineflags |= MDLF_DOCRC; + + // call the apropriate loader mod->needload = false; @@ -2259,8 +2270,8 @@ void SWMod_LoadAliasModel (model_t *mod, void *buffer) int skinsize; int start, end, total; - if (!strcmp(loadmodel->name, "progs/player.mdl") || - !strcmp(loadmodel->name, "progs/eyes.mdl")) { + if (loadmodel->engineflags & MDLF_DOCRC) + { unsigned short crc; qbyte *p; int len; @@ -2272,13 +2283,13 @@ void SWMod_LoadAliasModel (model_t *mod, void *buffer) sprintf(st, "%d", (int) crc); Info_SetValueForKey (cls.userinfo, - !strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name, + (loadmodel->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name, st, MAX_INFO_STRING); if (cls.state >= ca_connected) { CL_SendClientCommand(true, "setinfo %s %d", - !strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name, + (loadmodel->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name, (int)crc); } } @@ -2536,10 +2547,8 @@ void SWMod_LoadAlias2Model (model_t *mod, void *buffer) vec3_t mins, maxs; - - - if (!strcmp(loadmodel->name, "progs/player.mdl") || - !strcmp(loadmodel->name, "progs/eyes.mdl")) { + if (loadmodel->engineflags & MDLF_DOCRC) + { unsigned short crc; qbyte *p; int len; @@ -2551,13 +2560,13 @@ void SWMod_LoadAlias2Model (model_t *mod, void *buffer) sprintf(st, "%d", (int) crc); Info_SetValueForKey (cls.userinfo, - !strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name, + (loadmodel->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name, st, MAX_INFO_STRING); if (cls.state >= ca_connected) { CL_SendClientCommand(true, "setinfo %s %d", - !strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name, + (loadmodel->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name, (int)crc); } } @@ -2931,8 +2940,8 @@ void SWMod_LoadAlias3Model (model_t *mod, void *buffer) vec3_t mins, maxs; - if (!strcmp(loadmodel->name, "progs/player.mdl") || - !strcmp(loadmodel->name, "progs/eyes.mdl")) { + if (loadmodel->engineflags & MDLF_DOCRC) + { unsigned short crc; qbyte *p; int len; @@ -2944,13 +2953,13 @@ void SWMod_LoadAlias3Model (model_t *mod, void *buffer) sprintf(st, "%d", (int) crc); Info_SetValueForKey (cls.userinfo, - !strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name, + (loadmodel->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name, st, MAX_INFO_STRING); if (cls.state >= ca_connected) { CL_SendClientCommand(true, "setinfo %s %d", - !strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name, + (loadmodel->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name, (int)crc); } }