return normalize(cliptoplane(p, v));
}
+#ifdef SVQC
+ int W_GunAlign(entity this, int preferred_align)
+ {
+ entity own = this.owner;
+ // using wasfreed, as we don't actually clear .gunaligns yet
+ if(!own.gunaligns[preferred_align] || wasfreed(own.gunaligns[preferred_align]) || own.gunaligns[preferred_align] == this)
+ {
+ own.gunaligns[preferred_align] = this;
+ return preferred_align; // fall back if the good one is already choosable
+ }
+
+ for(int j = 4; j > 0; --j) // start from left and try the others
+ {
+ if(!own.gunaligns[j] || wasfreed(own.gunaligns[j]) || own.gunaligns[j] == this)
+ {
+ own.gunaligns[j] = this;
+ return j;
+ }
+ }
+
+ own.gunaligns[preferred_align] = this;
+ return preferred_align; // no other choice
+ }
+#else
+ int W_GunAlign(entity this, int preferred_align)
+ {
+ // using wasfreed, as we don't actually clear gunaligns yet
+ if(!gunaligns[preferred_align] || wasfreed(gunaligns[preferred_align]) || gunaligns[preferred_align] == this)
+ {
+ gunaligns[preferred_align] = this;
+ return preferred_align; // fall back if the good one is already choosable
+ }
+
+ for(int j = 4; j > 0; --j)
+ {
+ if(!gunaligns[j] || wasfreed(gunaligns[j]) || gunaligns[j] == this)
+ {
+ gunaligns[j] = this;
+ return j;
+ }
+ }
+
+ gunaligns[preferred_align] = this;
+ return preferred_align; // no other choice
+ }
+#endif
+
+#if 0
int W_GetGunAlignment(entity player)
{
int gunalign = STAT(GUNALIGN, player);
return gunalign;
}
+#endif
vector W_CalculateSpread(vector forward, float spread, float spreadfactor, float spreadstyle)
{
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);
+int W_GunAlign(entity this, int preferred_align);
+//int W_GetGunAlignment(entity player);
float explosion_calcpush_getmultiplier(vector explosion_v, vector target_v);
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
- if(slot == 0)
+ //if(slot == 0)
this.(weaponentity).m_switchweapon = w_getbestweapon(this);
- else
- this.(weaponentity).m_switchweapon = WEP_Null;
+ //else
+ //this.(weaponentity).m_switchweapon = WEP_Null;
this.(weaponentity).weaponname = "";
this.(weaponentity).m_switchingweapon = WEP_Null;
this.cnt = -1;
this.nextthink = time;
- int s = W_GetGunAlignment(this.realowner);
+ int s = W_GunAlign(this.realowner, STAT(GUNALIGN, this.realowner));
vs = hook_shotorigin[s];
makevectors(this.realowner.v_angle);
makevectors(actor.v_angle);
- int s = W_GetGunAlignment(actor);
+ int s = W_GunAlign(actor, STAT(GUNALIGN, actor));
vs = hook_shotorigin[s];
// UGLY WORKAROUND: play this on CH_WEAPON_B so it can't cut off fire sounds