string tex;
vector rgb;
float t;
- int s;
vector vs;
float intensity, offset;
InterpolateOrigin_Do();
- s = autocvar_cl_gunalign;
- if(s != 1 && s != 2 && s != 4)
- s = 3; // default value
- --s;
+ int s = W_GetGunAlignment(world);
+
switch(self.HookType)
{
default:
return normalize(cliptoplane(p, v));
}
+int W_GetGunAlignment(entity player)
+{
+#ifdef SVQC
+ int gunalign = player.cvar_cl_gunalign;
+#else
+ int gunalign = autocvar_cl_gunalign;
+#endif
+ if(gunalign != 1 && gunalign != 2 && gunalign != 4)
+ gunalign = 3; // default value
+ --gunalign;
+
+ return gunalign;
+}
+
vector W_CalculateSpread(vector forward, float spread, float spreadfactor, float spreadstyle)
{
float sigma;
#define CALCULATIONS_H
vector damage_explosion_calcpush(vector explosion_f, vector target_v, float speedfactor);
vector W_CalculateSpread(vector forward, float spread, float spreadfactor, float spreadstyle);
+int W_GetGunAlignment(entity player);
#endif
if(isnew)
{
- // calculate shot origin offset from gun alignment
- int gunalign = autocvar_cl_gunalign;
- if(gunalign != 1 && gunalign != 2 && gunalign != 4)
- gunalign = 3; // default value
- --gunalign;
+ int gunalign = W_GetGunAlignment(world);
self.beam_shotorigin = arc_shotorigin[gunalign];
self.nextthink = time;
- int s = self.realowner.cvar_cl_gunalign;
- if(s != 1 && s != 2 && s != 4)
- s = 3; // default value
- --s;
+ int s = W_GetGunAlignment(self.realowner);
vs = hook_shotorigin[s];
makevectors(self.realowner.v_angle);
makevectors(self.v_angle);
- int s = self.cvar_cl_gunalign;
- if(s != 1 && s != 2 && s != 4)
- s = 3; // default value
- --s;
+ int s = W_GetGunAlignment(self);
vs = hook_shotorigin[s];
// UGLY WORKAROUND: play this on CH_WEAPON_B so it can't cut off fire sounds