Short trajectory indicator for grenades

This commit is contained in:
Simon 2019-12-10 22:47:57 +00:00
parent 78942eaeaf
commit f2913a9375
3 changed files with 23 additions and 7 deletions

View file

@ -515,8 +515,11 @@ CL_ParseLaserSight
*/
void CL_ParseLaserSight ()
{
int weapon = MSG_ReadByte(&net_message);
//Set end time so laser is drawn
cl_lasersight.ent.flags = RF_LASERSIGHT;
cl_lasersight.ent.frame = weapon; // Used to indicate the weapon
cl_lasersight.endtime = cl.time+250;
}
@ -543,7 +546,7 @@ void CL_UpdateLaserSightOrigins ()
SetWeapon6DOF(0, cl.refdef.vieworg, gunorigin, gunangles);
gunorigin[2] += 1; // just add a little bit
AngleVectors(gunangles, forward, right, NULL);
VectorMA(gunorigin, 8192, forward, end);
VectorMA(gunorigin, (float)(cl_lasersight.ent.frame != 6 ? 4096.0 : 6.0), forward, end);
trace_t tr = CL_Trace(gunorigin, end, 1,
CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_DEADMONSTER);
VectorCopy(gunorigin, cl_lasersight.ent.origin);

View file

@ -1782,7 +1782,7 @@ RI_SetPalette(const unsigned char *palette)
*/
void R_DrawLaserSight( entity_t *e )
{
#define NUM_LASER_SIGHT_SEGS 3
#define NUM_LASER_SIGHT_SEGS 8
int i;
float r, g, b;
@ -1812,7 +1812,7 @@ void R_DrawLaserSight( entity_t *e )
return;
PerpendicularVector( perpvec, normalized_direction );
VectorScale( perpvec, 0.15, perpvec );
VectorScale( perpvec, 0.1, perpvec );
for ( i = 0; i < 6; i++ )
{
@ -1825,11 +1825,15 @@ void R_DrawLaserSight( entity_t *e )
glEnable( GL_BLEND );
glDepthMask( GL_FALSE );
r = 1.0;
g = 0;
b = 0;
if (e->frame == 6)
{
//grenade "pointer"
glColor4f( 0, 0, 1, 1.0 );
} else {
glColor4f( 1, 0, 0, 1.0 );
}
glColor4f( r, g, b, 1.0 );
for ( i = 0; i < NUM_BEAM_SEGS; i++ )
{

View file

@ -540,6 +540,7 @@ Weapon_Generic(edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST,
{
gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_LASER_SIGHT);
gi.WriteByte (ent->client->pers.weapon->weapmodel);
gi.multicast (ent->s.origin, MULTICAST_PHS);
}
@ -734,6 +735,14 @@ Weapon_Grenade(edict_t *ent)
if (ent->client->weaponstate == WEAPON_READY)
{
//Laser sight - always as a short pointer for grenade
if (vr_lasersight->value != 0.0f) {
gi.WriteByte(svc_temp_entity);
gi.WriteByte(TE_LASER_SIGHT);
gi.WriteByte(ent->client->pers.weapon->weapmodel);
gi.multicast(ent->s.origin, MULTICAST_PHS);
}
if (((ent->client->latched_buttons |
ent->client->buttons) & BUTTON_ATTACK))
{