WEAPON_GAUSS: Fix missing ammo deduction for primary fire, add a decal

for first-impact under high-energy mode.
This commit is contained in:
Marco Cawthorne 2021-09-16 17:50:47 +02:00
parent c8a493fb00
commit ca2c886d8e
Signed by: eukara
GPG key ID: C196CD8BA993248A
2 changed files with 13 additions and 0 deletions

11
src/shared/fx_gaussbeam.qc Executable file → Normal file
View file

@ -135,6 +135,9 @@ FX_GaussBeam(vector vecPos, vector vecAngle, int numBeams, entity eOwner)
vector vecSrc;
vector vecEndPos;
vector vecDir;
vector vecFirstImpact;
int totalBeams = numBeams;
makevectors(vecAngle);
vecDir = v_forward;
vecSrc = vecPos;
@ -143,6 +146,10 @@ FX_GaussBeam(vector vecPos, vector vecAngle, int numBeams, entity eOwner)
trailparticles(TRAIL_GAUSSBEAM, eOwner, vecSrc + (v_right * 8) + (v_up * -12), trace_endpos);
FX_GaussBeam_Piece(trace_endpos, vecDir * -1);
/* Decals_Place modifies trace_* globals, so cache */
if (totalBeams > 1)
vecFirstImpact = trace_endpos;
vecDir = v_forward;
while (numBeams > 0) {
float n;
@ -164,6 +171,10 @@ FX_GaussBeam(vector vecPos, vector vecAngle, int numBeams, entity eOwner)
break;
}
}
/* higher energy means the first impact will leave a hole as well */
if (totalBeams > 1)
Decals_Place(vecFirstImpact, "{gaussshot1");
#endif
}

View file

@ -172,6 +172,8 @@ void w_gauss_primary(void)
FX_GaussBeam(Weapons_GetCameraPos(), input_angles, 0, pl);
#endif
pl.ammo_uranium -= 2;
if (self.flags & FL_CROUCHING)
Animation_PlayerTop(pl, ANIM_CR_SHOOTGAUSS, 0.43f);
else