mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-13 07:21:31 +00:00
Quad/pentagram dlights for 2021 rerelease
This commit is contained in:
parent
6cf0547d01
commit
065c158254
4 changed files with 61 additions and 3 deletions
|
@ -548,6 +548,26 @@ void CL_RelinkEntities (void)
|
||||||
dl->radius = 200 + (rand()&31);
|
dl->radius = 200 + (rand()&31);
|
||||||
dl->die = cl.time + 0.001;
|
dl->die = cl.time + 0.001;
|
||||||
}
|
}
|
||||||
|
if (ent->effects & EF_QEX_QUADLIGHT)
|
||||||
|
{
|
||||||
|
dl = CL_AllocDlight (i);
|
||||||
|
VectorCopy (ent->origin, dl->origin);
|
||||||
|
dl->radius = 200 + (rand()&31);
|
||||||
|
dl->die = cl.time + 0.001;
|
||||||
|
dl->color[0] = 0.25f;
|
||||||
|
dl->color[1] = 0.25f;
|
||||||
|
dl->color[2] = 1.0f;
|
||||||
|
}
|
||||||
|
if (ent->effects & EF_QEX_PENTALIGHT)
|
||||||
|
{
|
||||||
|
dl = CL_AllocDlight (i);
|
||||||
|
VectorCopy (ent->origin, dl->origin);
|
||||||
|
dl->radius = 200 + (rand()&31);
|
||||||
|
dl->die = cl.time + 0.001;
|
||||||
|
dl->color[0] = 1.0f;
|
||||||
|
dl->color[1] = 0.25f;
|
||||||
|
dl->color[2] = 0.25f;
|
||||||
|
}
|
||||||
|
|
||||||
if (ent->model->flags & EF_GIB)
|
if (ent->model->flags & EF_GIB)
|
||||||
R_RocketTrail (oldorg, ent->origin, 2);
|
R_RocketTrail (oldorg, ent->origin, 2);
|
||||||
|
|
|
@ -39,6 +39,9 @@ m*_t structures are in-memory
|
||||||
#define EF_MUZZLEFLASH 2
|
#define EF_MUZZLEFLASH 2
|
||||||
#define EF_BRIGHTLIGHT 4
|
#define EF_BRIGHTLIGHT 4
|
||||||
#define EF_DIMLIGHT 8
|
#define EF_DIMLIGHT 8
|
||||||
|
#define EF_QEX_QUADLIGHT 16 // 2021 rerelease
|
||||||
|
#define EF_QEX_PENTALIGHT 32 // 2021 rerelease
|
||||||
|
#define EF_QEX_CANDLELIGHT 64 // 2021 rerelease
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -35,6 +35,7 @@ static ddef_t *pr_fielddefs;
|
||||||
static ddef_t *pr_globaldefs;
|
static ddef_t *pr_globaldefs;
|
||||||
|
|
||||||
qboolean pr_alpha_supported; //johnfitz
|
qboolean pr_alpha_supported; //johnfitz
|
||||||
|
int pr_effects_mask; // only enable 2021 rerelease quad/penta dlights when applicable
|
||||||
|
|
||||||
dstatement_t *pr_statements;
|
dstatement_t *pr_statements;
|
||||||
globalvars_t *pr_global_struct;
|
globalvars_t *pr_global_struct;
|
||||||
|
@ -1041,6 +1042,37 @@ void ED_LoadFromFile (const char *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
===============
|
||||||
|
PR_HasGlobal
|
||||||
|
===============
|
||||||
|
*/
|
||||||
|
static qboolean PR_HasGlobal (const char *name, float value)
|
||||||
|
{
|
||||||
|
ddef_t *g = ED_FindGlobal (name);
|
||||||
|
return g && (g->type & ~DEF_SAVEGLOBAL) == ev_float && G_FLOAT (g->ofs) == value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
===============
|
||||||
|
PR_FindSupportedEffects
|
||||||
|
|
||||||
|
Checks for the presence of Quake 2021 release effects flags and returns a mask
|
||||||
|
with the correspondings bits either on or off depending on the result, in order
|
||||||
|
to avoid conflicts (e.g. Arcane Dimensions uses bit 32 for its explosions)
|
||||||
|
===============
|
||||||
|
*/
|
||||||
|
static int PR_FindSupportedEffects (void)
|
||||||
|
{
|
||||||
|
qboolean isqex =
|
||||||
|
PR_HasGlobal ("EF_QUADLIGHT", EF_QEX_QUADLIGHT) &&
|
||||||
|
(PR_HasGlobal ("EF_PENTLIGHT", EF_QEX_PENTALIGHT) || PR_HasGlobal ("EF_PENTALIGHT", EF_QEX_PENTALIGHT))
|
||||||
|
;
|
||||||
|
return isqex ? -1 : -1 & ~(EF_QEX_QUADLIGHT|EF_QEX_PENTALIGHT|EF_QEX_CANDLELIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
PR_LoadProgs
|
PR_LoadProgs
|
||||||
|
@ -1145,6 +1177,8 @@ void PR_LoadProgs (void)
|
||||||
// properly aligned
|
// properly aligned
|
||||||
pr_edict_size += sizeof(void *) - 1;
|
pr_edict_size += sizeof(void *) - 1;
|
||||||
pr_edict_size &= ~(sizeof(void *) - 1);
|
pr_edict_size &= ~(sizeof(void *) - 1);
|
||||||
|
|
||||||
|
pr_effects_mask = PR_FindSupportedEffects ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ static char localmodels[MAX_MODELS][8]; // inline model names for precache
|
||||||
int sv_protocol = PROTOCOL_FITZQUAKE; //johnfitz
|
int sv_protocol = PROTOCOL_FITZQUAKE; //johnfitz
|
||||||
|
|
||||||
extern qboolean pr_alpha_supported; //johnfitz
|
extern qboolean pr_alpha_supported; //johnfitz
|
||||||
|
extern int pr_effects_mask;
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
@ -644,7 +645,7 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
||||||
if (ent->baseline.frame != ent->v.frame)
|
if (ent->baseline.frame != ent->v.frame)
|
||||||
bits |= U_FRAME;
|
bits |= U_FRAME;
|
||||||
|
|
||||||
if (ent->baseline.effects != ent->v.effects)
|
if ((ent->baseline.effects ^ (int)ent->v.effects) & pr_effects_mask)
|
||||||
bits |= U_EFFECTS;
|
bits |= U_EFFECTS;
|
||||||
|
|
||||||
if (ent->baseline.modelindex != ent->v.modelindex)
|
if (ent->baseline.modelindex != ent->v.modelindex)
|
||||||
|
@ -661,7 +662,7 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
//don't send invisible entities unless they have effects
|
//don't send invisible entities unless they have effects
|
||||||
if (ent->alpha == ENTALPHA_ZERO && !ent->v.effects)
|
if (ent->alpha == ENTALPHA_ZERO && !((int)ent->v.effects & pr_effects_mask))
|
||||||
continue;
|
continue;
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
|
||||||
|
@ -713,7 +714,7 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
||||||
if (bits & U_SKIN)
|
if (bits & U_SKIN)
|
||||||
MSG_WriteByte (msg, ent->v.skin);
|
MSG_WriteByte (msg, ent->v.skin);
|
||||||
if (bits & U_EFFECTS)
|
if (bits & U_EFFECTS)
|
||||||
MSG_WriteByte (msg, ent->v.effects);
|
MSG_WriteByte (msg, (int)ent->v.effects & pr_effects_mask);
|
||||||
if (bits & U_ORIGIN1)
|
if (bits & U_ORIGIN1)
|
||||||
MSG_WriteCoord (msg, ent->v.origin[0], sv.protocolflags);
|
MSG_WriteCoord (msg, ent->v.origin[0], sv.protocolflags);
|
||||||
if (bits & U_ANGLE1)
|
if (bits & U_ANGLE1)
|
||||||
|
|
Loading…
Reference in a new issue