Merge pull request #1099 from BjossiAlfreds/cvar-cl_laseralpha

Added cvar cl_laseralpha and documentation in cvarlist
This commit is contained in:
Yamagi 2024-04-01 09:12:03 +02:00 committed by GitHub
commit 5a642c4205
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 29 additions and 2 deletions

View file

@ -120,6 +120,11 @@ Set `0` by default.
* **cl_kickangles**: If set to `0` angle kicks (weapon recoil, damage
hits and the like) are ignored. Cheat-protected. Defaults to `1`.
* **cl_laseralpha**: Controls how see-through laserbeams are.
The value ranges from 0.0 to 1.0, from completely invisible to
completely opaque. So higher value means better visibility.
Defaults to `0.3`.
* **cl_limitsparksounds**: If set to `1` the number of sound generated
when shooting into power screen and power shields is limited to 16.
This works around global volume drops in some OpenAL implementations

View file

@ -139,8 +139,17 @@ CL_AddPacketEntities(frame_t *frame)
/* tweak the color of beams */
if (renderfx & RF_BEAM)
{
ent.alpha = cl_laseralpha->value;
if (ent.alpha < 0.0f)
{
ent.alpha = 0.0f;
}
else if (ent.alpha > 1.0f)
{
ent.alpha = 1.0f;
}
/* the four beam colors are encoded in 32 bits of skinnum (hack) */
ent.alpha = 0.30f;
ent.skinnum = (s1->skinnum >> ((randk() % 4) * 8)) & 0xff;
ent.model = NULL;
}

View file

@ -50,6 +50,7 @@ cvar_t *cl_add_lights;
cvar_t *cl_add_entities;
cvar_t *cl_add_blend;
cvar_t *cl_kickangles;
cvar_t *cl_laseralpha;
cvar_t *cl_shownet;
cvar_t *cl_showmiss;
@ -515,6 +516,7 @@ CL_InitLocal(void)
cl_predict = Cvar_Get("cl_predict", "1", 0);
cl_showfps = Cvar_Get("cl_showfps", "0", CVAR_ARCHIVE);
cl_showspeed = Cvar_Get("cl_showspeed", "0", CVAR_ARCHIVE);
cl_laseralpha = Cvar_Get("cl_laseralpha", "0.3", 0);
cl_upspeed = Cvar_Get("cl_upspeed", "200", 0);
cl_forwardspeed = Cvar_Get("cl_forwardspeed", "200", 0);

View file

@ -492,10 +492,20 @@ CL_ParseLaser(int colors)
{
if (l->endtime < cl.time)
{
float alpha = cl_laseralpha->value;
if (alpha < 0.0f)
{
alpha = 0.0f;
}
else if (alpha > 1.0f)
{
alpha = 1.0f;
}
l->ent.flags = RF_TRANSLUCENT | RF_BEAM;
VectorCopy(start, l->ent.origin);
VectorCopy(end, l->ent.oldorigin);
l->ent.alpha = 0.30f;
l->ent.alpha = alpha;
l->ent.skinnum = (colors >> ((randk() % 4) * 8)) & 0xff;
l->ent.model = NULL;
l->ent.frame = 4;

View file

@ -316,6 +316,7 @@ extern cvar_t *vid_renderer;
extern cvar_t *cl_kickangles;
extern cvar_t *cl_r1q2_lightstyle;
extern cvar_t *cl_limitsparksounds;
extern cvar_t *cl_laseralpha;
typedef struct
{