WEAPON_EGON: Make the beam visible across the network.

This commit is contained in:
Marco Cawthorne 2021-08-29 18:23:52 +02:00
parent 94523a060f
commit 4635b900c6
3 changed files with 26 additions and 5 deletions

View File

@ -162,11 +162,24 @@ Player_DestroyWeaponModel(entity pp)
}
void
Player_PreDraw(base_player pl, int thirdperson)
Player_PreDraw(base_player pp, int thirdperson)
{
player pl = (player)pp;
/* Handle the flashlights... */
Player_Flashlight(pl);
if (thirdperson && pl.gflags & GF_EGONBEAM) {
vector src;
vector endpos;
makevectors(pl.v_angle);
src = pl.origin;
endpos = pl.origin + (v_forward * 1024);
traceline(src, endpos, MOVE_NORMAL, pl);
w_egon_beamfx(gettaginfo(pl.p_model, 10), trace_endpos, pl);
}
pl.Physics_SetViewParms();
Animation_PlayerUpdate((player)pl);
Animation_TimerUpdate((player)pl, clframetime);

View File

@ -17,7 +17,7 @@
/* game flags */
#define GF_SEMI_TOGGLED (1<<0)
#define GF_FLASHLIGHT (1<<1)
#define GF_UNUSED3 (1<<2)
#define GF_EGONBEAM (1<<2)
#define GF_UNUSED4 (1<<3)
#define GF_UNUSED5 (1<<4)
#define GF_UNUSED6 (1<<5)

View File

@ -26,6 +26,13 @@ Egon/Gluon-Gun Weapon
#ifdef CLIENT
var float TRAIL_EGONBEAM;
void
w_egon_beamfx(vector vecPos, vector vecEndPos, entity eOwner)
{
dynamiclight_add(vecPos + v_forward * -16, 128, [0.5, 0.5, 1.0]);
trailparticles(TRAIL_EGONBEAM, eOwner, vecPos, vecEndPos);
}
#define FXGAUSS_BEAMCOLOR [1,0.5,0]
class FXEgon:CBaseFX
{
@ -65,9 +72,7 @@ FXEgon::Draw(void)
makevectors(input_angles);
endpos = src + v_forward * 1024;
traceline(src, endpos, FALSE, pl);
dynamiclight_add(trace_endpos + v_forward * -16, 128, [0.5, 0.5, 1.0]);
trailparticles(TRAIL_EGONBEAM, pl, gunpos, trace_endpos);
w_egon_beamfx(gunpos, endpos, pl);
setorigin(this, trace_endpos + v_forward * -16);
setmodel(this, "sprites/xspark1.spr");
@ -195,6 +200,7 @@ void w_egon_primary(void)
#endif
pl.ammo_uranium--;
pl.gflags |= GF_EGONBEAM;
if (pl.mode_tempstate == 0) {
#ifdef SERVER
@ -243,6 +249,8 @@ void w_egon_release(void)
Weapons_ViewPunchAngle([-2,0,0]);
}
pl.gflags &= ~GF_EGONBEAM;
#ifndef SERVER
if (Weapons_GetAnimation() == EGON_ALTFIRECYCLE) {
Weapons_ViewAnimation(EGON_ALTFIREOFF);