Extended dlight support

This commit is contained in:
unknown 2022-04-08 16:49:19 -04:00
parent 33ee073d60
commit 08edd64d75
7 changed files with 232 additions and 171 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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
/*

View File

@ -2,166 +2,169 @@
/* file generated by qcc, do not modify */
typedef struct
{ int pad[28];
int self;
int other;
int world;
float time;
float frametime;
float force_retouch;
{ int pad[28];
int self;
int other;
int world;
float time;
float frametime;
float force_retouch;
string_t mapname;
float deathmatch;
float coop;
float teamplay;
float serverflags;
float rounds;
float rounds_change;
float parm1;
float parm2;
float parm3;
float parm4;
float parm5;
float parm6;
float parm7;
float parm8;
float parm9;
float parm10;
float parm11;
float parm12;
float parm13;
float parm14;
float parm15;
float parm16;
vec3_t v_forward;
vec3_t v_up;
vec3_t v_right;
float trace_allsolid;
float trace_startsolid;
float trace_fraction;
vec3_t trace_endpos;
vec3_t trace_plane_normal;
float trace_plane_dist;
int trace_ent;
float trace_inopen;
float trace_inwater;
int msg_entity;
func_t main;
func_t StartFrame;
func_t EndFrame;
func_t PlayerPreThink;
func_t PlayerPostThink;
func_t ClientKill;
func_t ClientConnect;
func_t PutClientInServer;
func_t ClientDisconnect;
func_t SetNewParms;
func_t SetChangeParms;
float deathmatch;
float coop;
float teamplay;
float serverflags;
float rounds;
float rounds_change;
float parm1;
float parm2;
float parm3;
float parm4;
float parm5;
float parm6;
float parm7;
float parm8;
float parm9;
float parm10;
float parm11;
float parm12;
float parm13;
float parm14;
float parm15;
float parm16;
vec3_t v_forward;
vec3_t v_up;
vec3_t v_right;
float trace_allsolid;
float trace_startsolid;
float trace_fraction;
vec3_t trace_endpos;
vec3_t trace_plane_normal;
float trace_plane_dist;
int trace_ent;
float trace_inopen;
float trace_inwater;
int msg_entity;
func_t main;
func_t StartFrame;
func_t EndFrame;
func_t PlayerPreThink;
func_t PlayerPostThink;
func_t ClientKill;
func_t ClientConnect;
func_t PutClientInServer;
func_t ClientDisconnect;
func_t SetNewParms;
func_t SetChangeParms;
} globalvars_t;
typedef struct
{
float modelindex;
vec3_t absmin;
vec3_t absmax;
float ltime;
float movetype;
float solid;
vec3_t origin;
vec3_t oldorigin;
vec3_t velocity;
vec3_t angles;
vec3_t avelocity;
vec3_t punchangle;
float modelindex;
vec3_t absmin;
vec3_t absmax;
float ltime;
float movetype;
float solid;
vec3_t origin;
vec3_t oldorigin;
vec3_t velocity;
vec3_t angles;
vec3_t avelocity;
vec3_t punchangle;
string_t classname;
string_t model;
float frame;
float skin;
float effects;
vec3_t mins;
vec3_t maxs;
vec3_t size;
func_t touch;
func_t use;
func_t think;
func_t blocked;
float nextthink;
int groundentity;
float health;
float points;
float kills;
float weapon;
float frame;
float skin;
float effects;
vec3_t mins;
vec3_t maxs;
vec3_t size;
func_t touch;
func_t use;
func_t think;
func_t blocked;
float nextthink;
int groundentity;
float health;
float points;
float kills;
float weapon;
string_t weaponmodel;
string_t weapon2model;
float weaponframe;
float weapon2frame;
float currentammo;
float currentmag;
float zoom;
float weaponskin;
float weapon2skin;
float primary_grenades;
float secondary_grenades;
float grenades;
float perks;
float takedamage;
int chain;
float deadflag;
vec3_t view_ofs;
float button0;
float button1;
float button2;
float button3;
float button4;
float button5;
float button6;
float button7;
float button8;
float impulse;
float fixangle;
vec3_t v_angle;
float idealpitch;
float weaponframe;
float weapon2frame;
float currentammo;
float currentmag;
float zoom;
float weaponskin;
float weapon2skin;
float primary_grenades;
float secondary_grenades;
float grenades;
float perks;
float takedamage;
int chain;
float deadflag;
vec3_t view_ofs;
float button0;
float button1;
float button2;
float button3;
float button4;
float button5;
float button6;
float button7;
float button8;
float impulse;
float fixangle;
vec3_t v_angle;
float idealpitch;
string_t netname;
int enemy;
float flags;
float colormap;
float team;
float max_health;
float teleport_time;
float armortype;
float armorvalue;
float waterlevel;
float watertype;
float ideal_yaw;
float yaw_speed;
int aiment;
int head;
int larm;
int rarm;
int goalentity;
float spawnflags;
int enemy;
float flags;
float colormap;
float team;
float max_health;
float teleport_time;
float armortype;
float armorvalue;
float waterlevel;
float watertype;
float ideal_yaw;
float yaw_speed;
int aiment;
int head;
int larm;
int rarm;
int goalentity;
float spawnflags;
string_t target;
string_t targetname;
float dmg_take;
float dmg_save;
float progress_bar;
int dmg_inflictor;
int owner;
vec3_t movedir;
float dmg_take;
float dmg_save;
float progress_bar;
int dmg_inflictor;
int owner;
vec3_t movedir;
string_t message;
float sounds;
float sounds;
string_t noise;
string_t noise1;
string_t noise2;
string_t noise3;
float x2_icon;
float insta_icon;
float x2_icon;
float insta_icon;
string_t Weapon_Name_Touch;
vec3_t ADS_Offset;
vec3_t Flash_Offset;
float Flash_Size;
float currentmag2;
float maxspeed;
float renderGrayscale;
vec3_t Flash_Offset;
float Flash_Size;
float currentmag2;
float maxspeed;
float renderGrayscale;
vec3_t colormod;
vec3_t glowmod;
float light_lev;
} entvars_t;
#define PROGHEADER_CRC 5927

View File

@ -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;

View File

@ -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;

View File

@ -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);