mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-01-18 14:31:52 +00:00
use engineflags instead of constant strcmp checks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2053 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
2d44c7b2c9
commit
789c9b0ee6
7 changed files with 55 additions and 40 deletions
|
@ -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)
|
||||
// {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
//============================================================================
|
||||
/*
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue