10 a = explosion_v * (explosion_v - target_v);
16 a /= (explosion_v * explosion_v);
23 vector explosion_calcpush(
vector explosion_v,
float explosion_m,
vector target_v,
float target_m,
float elasticity)
38 target_m + explosion_m
55 m = 1 / ((1 + 0) * speedfactor - 1);
57 v = explosion_calcpush(explosion_f * speedfactor, m, target_v, 1, 0);
60 LOG_INFOF(
"MASS: %f\nv: %v -> %v\nENERGY BEFORE == %f + %f = %f\nENERGY AFTER >= %f",
62 target_v, target_v + v,
63 target_v * target_v, m * explosion_f * speedfactor * explosion_f * speedfactor, target_v * target_v + m * explosion_f * speedfactor * explosion_f * speedfactor,
64 (target_v + v) * (target_v + v));
77 return v - (v * p) * p;
83 D = q*q/4.0 + p*p*p/27.0;
87 a = 1.0/3.0 * acos(-q/2.0 *
sqrt(-27.0/(p*p*p)));
88 u =
sqrt(-4.0/3.0 * p);
106 return (u >= v) ?
vec3(v, v, u) :
vec3(u, v, v);
114 return vec3(a, a, a);
124 q = (27*a*a*d - 9*a*b*c + 2*b*b*b);
126 v = (v - b *
'1 1 1') * (1.0 / (3.0 * a));
128 v +=
'1 0 -1' * (v.z - v.x);
141 return this.m_gunalign;
145 if(preferred_align < 1 || preferred_align > 4)
148 for(
int j = 4; j > 1; --j)
154 if(own.(weaponentity).m_gunalign == j)
156 if(own.(weaponentity).m_gunalign == preferred_align)
157 taken |=
BIT(preferred_align);
160 if(!(taken &
BIT(preferred_align)))
161 return preferred_align;
162 if(!(taken &
BIT(j)))
166 return preferred_align;
171 return this.m_gunalign > 0 ? this.m_gunalign : preferred_align;
176 int W_GetGunAlignment(
entity player)
178 int gunalign = STAT(GUNALIGN, player);
179 if(gunalign < 1 || gunalign > 4)
192 spread *= spreadfactor;
213 sigma = spread * 0.89442719099991587855;
215 v2 =
cross(forward, v1);
223 return normalize(forward + (v1 * dx + v2 * dy) * r * sigma);
227 sigma = spread * 0.44721359549996;
237 sigma = spread * 0.44721359549996;
246 sigma = spread * 1.154700538379252;
248 v2 =
cross(forward, v1);
256 return normalize(forward + (v1 * dx + v2 * dy) * r * sigma);
260 sigma = spread * 1.095445115010332;
262 v2 =
cross(forward, v1);
271 return normalize(forward + (v1 * dx + v2 * dy) * r * sigma);
275 sigma = spread * 1.224744871391589;
277 v2 =
cross(forward, v1);
286 return normalize(forward + (v1 * dx + v2 * dy) * r * sigma);
289 error(
"g_projectiles_spread_style must be 0 (sphere), 1 (flattened sphere), 2 (circle), 3 (gauss 3D), 4 (gauss plane), 5 (linear falloff), 6 (quadratic falloff), 7 (stronger falloff)!");
vector W_CalculateSpread(vector forward, float spread, float spreadfactor, float spreadstyle)
vector damage_explosion_calcpush(vector explosion_f, vector target_v, float speedfactor)
ERASEABLE float gsl_ran_gaussian(float sigma)
vector cliptoplane(vector v, vector p)
vector findperpendicular(vector v)
vector solve_cubic_pq(float p, float q)
int W_GunAlign(entity this, int preferred_align)
vector solve_cubic_abcd(float a, float b, float c, float d)
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
float explosion_calcpush_getmultiplier(vector explosion_v, vector target_v)
const int MAX_WEAPONSLOTS
vector(float skel, float bonenum) _skel_get_boneabs_hidden
entity weaponentities[MAX_WEAPONSLOTS]