Merge remote-tracking branch 'yquake2/master'

This commit is contained in:
Denis Pauk 2024-04-01 23:22:25 +03:00
commit 80a4282ec7
6 changed files with 32 additions and 15 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;
@ -517,6 +518,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
{

View file

@ -581,19 +581,9 @@ double sqrt(double x);
vec_t
VectorLength(const vec3_t v)
{
int i;
float length;
length = 0;
for (i = 0; i < 3; i++)
{
length += v[i] * v[i];
}
length = (float)sqrt(length);
return length;
return sqrtf((v[0] * v[0]) +
(v[1] * v[1]) +
(v[2] * v[2]));
}
void