mirror of
https://github.com/nzp-team/quakespasm.git
synced 2024-11-10 06:32:03 +00:00
Extended dlight support
This commit is contained in:
parent
33ee073d60
commit
08edd64d75
7 changed files with 232 additions and 171 deletions
|
@ -513,9 +513,6 @@ void CL_RelinkEntities (void)
|
|||
if (ent->model->flags & EF_ROTATE)
|
||||
ent->angles[1] = bobjrotate;
|
||||
|
||||
if (ent->effects & EF_BRIGHTFIELD)
|
||||
R_EntityParticles (ent);
|
||||
|
||||
if (ent->effects & EF_MUZZLEFLASH)
|
||||
{
|
||||
if (i == cl.viewentity /*&& qmb_initialized && r_part_muzzleflash.value*/)
|
||||
|
@ -570,6 +567,10 @@ void CL_RelinkEntities (void)
|
|||
dl->die = cl.time + 0.001;
|
||||
}
|
||||
|
||||
//
|
||||
// Perk Machine Lights
|
||||
//
|
||||
|
||||
if (ent->effects & EF_BLUELIGHT)
|
||||
{
|
||||
dl = CL_AllocDlight (i);
|
||||
|
@ -586,7 +587,6 @@ void CL_RelinkEntities (void)
|
|||
dl = CL_AllocDlight (i);
|
||||
VectorCopy (ent->origin, dl->origin);
|
||||
dl->die = cl.time + 0.001;
|
||||
dl->radius = 100;
|
||||
dl->color[0] = 2;
|
||||
dl->color[1] = 0.25;
|
||||
dl->color[2] = 0.25;
|
||||
|
@ -603,27 +603,6 @@ void CL_RelinkEntities (void)
|
|||
dl->color[2] = 0;
|
||||
}
|
||||
|
||||
if (ent->effects & EF_GREENLIGHT)
|
||||
{
|
||||
dl = CL_AllocDlight (i);
|
||||
VectorCopy (ent->origin, dl->origin);
|
||||
dl->die = cl.time + 0.001;
|
||||
dl->radius = 100;
|
||||
dl->color[0] = 0.25;
|
||||
dl->color[1] = 2;
|
||||
dl->color[2] = 0.25;
|
||||
}
|
||||
if (ent->effects & EF_ORANGELIGHT)
|
||||
{
|
||||
dl = CL_AllocDlight (i);
|
||||
VectorCopy (ent->origin, dl->origin);
|
||||
dl->die = cl.time + 0.001;
|
||||
dl->radius = 100;
|
||||
dl->color[0] = 2;
|
||||
dl->color[1] = 1;
|
||||
dl->color[2] = 0;
|
||||
}
|
||||
|
||||
if (ent->effects & EF_GREENLIGHT)
|
||||
{
|
||||
dl = CL_AllocDlight (i);
|
||||
|
@ -646,6 +625,55 @@ void CL_RelinkEntities (void)
|
|||
dl->color[2] = 2;
|
||||
}
|
||||
|
||||
if (ent->effects & EF_CYANLIGHT)
|
||||
{
|
||||
dl = CL_AllocDlight (i);
|
||||
VectorCopy (ent->origin, dl->origin);
|
||||
dl->die = cl.time + 0.001;
|
||||
dl->radius = 100;
|
||||
dl->color[0] = 0.765;
|
||||
dl->color[1] = 1.40;
|
||||
dl->color[2] = 1.95;
|
||||
}
|
||||
|
||||
if (ent->effects & EF_PINKLIGHT)
|
||||
{
|
||||
dl = CL_AllocDlight (i);
|
||||
VectorCopy (ent->origin, dl->origin);
|
||||
dl->die = cl.time + 0.001;
|
||||
|
||||
if (ent->light_lev != 0)
|
||||
dl->radius = ent->light_lev;
|
||||
else
|
||||
dl->radius = 100;
|
||||
|
||||
dl->color[0] = 2.37;
|
||||
dl->color[1] = 1.35;
|
||||
dl->color[2] = 1.35;
|
||||
}
|
||||
|
||||
if (ent->effects & EF_LIMELIGHT)
|
||||
{
|
||||
dl = CL_AllocDlight (i);
|
||||
VectorCopy (ent->origin, dl->origin);
|
||||
dl->die = cl.time + 0.001;
|
||||
dl->radius = 100;
|
||||
dl->color[0] = 1;
|
||||
dl->color[1] = 2;
|
||||
dl->color[2] = 1;
|
||||
}
|
||||
|
||||
if (ent->effects & EF_YELLOWLIGHT)
|
||||
{
|
||||
dl = CL_AllocDlight (i);
|
||||
VectorCopy (ent->origin, dl->origin);
|
||||
dl->die = cl.time + 0.001;
|
||||
dl->radius = 100;
|
||||
dl->color[0] = 2;
|
||||
dl->color[1] = 2;
|
||||
dl->color[2] = 1;
|
||||
}
|
||||
|
||||
// naievil -- fixme
|
||||
/*
|
||||
if (ent->effects & EF_RAYGREEN)
|
||||
|
|
|
@ -589,6 +589,11 @@ void CL_ParseUpdate (int bits)
|
|||
ent->lerpflags &= ~LERP_MOVESTEP;
|
||||
//johnfitz
|
||||
|
||||
// NZP START
|
||||
if (bits & U_LIGHTLEVEL)
|
||||
ent->light_lev = MSG_ReadByte();
|
||||
// NZP END
|
||||
|
||||
//johnfitz -- PROTOCOL_FITZQUAKE and PROTOCOL_NEHAHRA
|
||||
if (cl.protocol == PROTOCOL_FITZQUAKE || cl.protocol == PROTOCOL_RMQ)
|
||||
{
|
||||
|
@ -685,6 +690,7 @@ void CL_ParseBaseline (entity_t *ent, int version) //johnfitz -- added argument
|
|||
|
||||
ent->baseline.colormap = MSG_ReadByte();
|
||||
ent->baseline.skin = MSG_ReadByte();
|
||||
ent->baseline.light_lev = MSG_ReadByte();
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
ent->baseline.origin[i] = MSG_ReadCoord (cl.protocolflags);
|
||||
|
|
|
@ -42,15 +42,15 @@ m*_t structures are in-memory
|
|||
#define EF_REDLIGHT 8
|
||||
#define EF_ORANGELIGHT 16
|
||||
#define EF_GREENLIGHT 32
|
||||
#define EF_LIGHT 64
|
||||
#define EF_PINKLIGHT 64 // formerly EF_LIGHT
|
||||
#define EF_NODRAW 128
|
||||
#define EF_BRIGHTFIELD 256
|
||||
#define EF_LIMELIGHT 256 // formerly EF_BRIGHTFIELD
|
||||
#define EF_FULLBRIGHT 512
|
||||
#define EF_DARKLIGHT 1024
|
||||
#define EF_DARKFIELD 2048
|
||||
#define EF_CYANLIGHT 1024 // formerly EF_DARKLIGHT
|
||||
#define EF_YELLOWLIGHT 2048 // formerly EF_DARKFIELD
|
||||
#define EF_PURPLELIGHT 4096
|
||||
#define EF_RAYRED 8196 // red trail for porter x2
|
||||
#define EF_RAYGREEN 16384 // gree trail for ray gun
|
||||
#define EF_RAYGREEN 16384 // green trail for ray gun
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -162,6 +162,9 @@ typedef struct
|
|||
float currentmag2;
|
||||
float maxspeed;
|
||||
float renderGrayscale;
|
||||
vec3_t colormod;
|
||||
vec3_t glowmod;
|
||||
float light_lev;
|
||||
} entvars_t;
|
||||
|
||||
#define PROGHEADER_CRC 5927
|
||||
|
|
|
@ -73,6 +73,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define U_TRANS (1<<15)
|
||||
//johnfitz
|
||||
|
||||
// NZP START
|
||||
#define U_LIGHTLEVEL (1<<24)
|
||||
// NZP END
|
||||
|
||||
#define SU_VIEWHEIGHT (1<<0)
|
||||
#define SU_IDEALPITCH (1<<1)
|
||||
#define SU_PUNCH1 (1<<2)
|
||||
|
@ -127,6 +131,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define B_ALPHA (1<<2) // 1 byte, uses ENTALPHA_ENCODE, not sent if ENTALPHA_DEFAULT
|
||||
//johnfitz
|
||||
|
||||
// NZP START
|
||||
#define B_LIGHTLEVEL (1<<3)
|
||||
// NZP END
|
||||
|
||||
//johnfitz -- PROTOCOL_FITZQUAKE -- alpha encoding
|
||||
#define ENTALPHA_DEFAULT 0 //entity's alpha is "default" (i.e. water obeys r_wateralpha) -- must be zero so zeroed out memory works
|
||||
#define ENTALPHA_ZERO 1 //entity is invisible (lowest possible alpha)
|
||||
|
@ -246,6 +254,7 @@ typedef struct
|
|||
unsigned char colormap; //johnfitz -- was int
|
||||
unsigned char skin; //johnfitz -- was int
|
||||
unsigned char alpha; //johnfitz -- added
|
||||
unsigned char light_lev;
|
||||
int effects;
|
||||
} entity_state_t;
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ typedef struct entity_s
|
|||
|
||||
int dlightframe; // dynamic lighting
|
||||
int dlightbits;
|
||||
float light_lev;
|
||||
|
||||
// FIXME: could turn these into a union
|
||||
int trivial_accept;
|
||||
|
|
|
@ -648,6 +648,9 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
|||
if (ent->baseline.modelindex != ent->v.modelindex)
|
||||
bits |= U_MODEL;
|
||||
|
||||
if (ent->baseline.light_lev != ent->v.light_lev)
|
||||
bits |= U_LIGHTLEVEL;
|
||||
|
||||
//johnfitz -- alpha
|
||||
if (pr_alpha_supported)
|
||||
{
|
||||
|
@ -725,6 +728,11 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
|||
if (bits & U_ANGLE3)
|
||||
MSG_WriteAngle(msg, ent->v.angles[2], sv.protocolflags);
|
||||
|
||||
// NZP START
|
||||
if (bits & U_LIGHTLEVEL)
|
||||
MSG_WriteByte(msg, ent->v.light_lev);
|
||||
// NZP END
|
||||
|
||||
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||
if (bits & U_ALPHA)
|
||||
MSG_WriteByte(msg, ent->alpha);
|
||||
|
@ -1184,12 +1192,14 @@ void SV_CreateBaseline (void)
|
|||
svent->baseline.colormap = entnum;
|
||||
svent->baseline.modelindex = SV_ModelIndex("models/player.mdl");
|
||||
svent->baseline.alpha = ENTALPHA_DEFAULT; //johnfitz -- alpha support
|
||||
svent->baseline.light_lev = 0; // motolegacy -- light level support
|
||||
}
|
||||
else
|
||||
{
|
||||
svent->baseline.colormap = 0;
|
||||
svent->baseline.modelindex = SV_ModelIndex(PR_GetString(svent->v.model));
|
||||
svent->baseline.alpha = svent->alpha; //johnfitz -- alpha support
|
||||
svent->baseline.light_lev = 0; // motolegacy -- light level support
|
||||
}
|
||||
|
||||
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||
|
@ -1201,6 +1211,7 @@ void SV_CreateBaseline (void)
|
|||
if (svent->baseline.frame & 0xFF00)
|
||||
svent->baseline.frame = 0;
|
||||
svent->baseline.alpha = ENTALPHA_DEFAULT;
|
||||
svent->baseline.light_lev = 0;
|
||||
}
|
||||
else //decide which extra data needs to be sent
|
||||
{
|
||||
|
@ -1210,6 +1221,8 @@ void SV_CreateBaseline (void)
|
|||
bits |= B_LARGEFRAME;
|
||||
if (svent->baseline.alpha != ENTALPHA_DEFAULT)
|
||||
bits |= B_ALPHA;
|
||||
if (svent->baseline.light_lev != 0)
|
||||
bits |= B_LIGHTLEVEL;
|
||||
}
|
||||
//johnfitz
|
||||
|
||||
|
@ -1242,6 +1255,7 @@ void SV_CreateBaseline (void)
|
|||
|
||||
MSG_WriteByte (&sv.signon, svent->baseline.colormap);
|
||||
MSG_WriteByte (&sv.signon, svent->baseline.skin);
|
||||
MSG_WriteByte (&sv.signon, svent->baseline.light_lev);
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
MSG_WriteCoord(&sv.signon, svent->baseline.origin[i], sv.protocolflags);
|
||||
|
|
Loading…
Reference in a new issue