+#include "selection.qh"
+#include "../_all.qh"
+
+#include "weaponsystem.qh"
+#include "../t_items.qh"
+#include "../waypointsprites.qh"
+#include "../../common/constants.qh"
+#include "../../common/util.qh"
+#include "../../common/weapons/all.qh"
+
// switch between weapons
void Send_WeaponComplain(entity e, float wpn, float type)
{
// switch between weapons
void Send_WeaponComplain(entity e, float wpn, float type)
{
play2(cl, "weapons/unavailable.wav");
Send_WeaponComplain (cl, wpn, 0);
}
play2(cl, "weapons/unavailable.wav");
Send_WeaponComplain (cl, wpn, 0);
}
}
float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, float complain, float skipmissing)
{
// We cannot tokenize in this function, as GiveItems calls this
// function. Thus we must use car/cdr.
}
float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, float complain, float skipmissing)
{
// We cannot tokenize in this function, as GiveItems calls this
// function. Thus we must use car/cdr.
- float weaponwant, first_valid, prev_valid, switchtonext, switchtolast, c;
- string rest;
+ float weaponwant, first_valid, prev_valid, switchtonext, switchtolast;
+ WepSet wepset = '0 0 0';
- if(wep.impulse != imp)
- continue;
+ if(wep.impulse != imp)
+ continue;
+
+ float i, have_other = false;
+ for(i = WEP_FIRST; i <= WEP_LAST; ++i)
+ {
+ if(i != weaponwant)
+ if((get_weaponinfo(i)).impulse == imp || imp < 0)
+ if((pl.weapons & WepSet_FromWeapon(i)) || (weaponsInMap & WepSet_FromWeapon(i)))
+ have_other = true;
+ }
- if(!(pl.weapons & WepSet_FromWeapon(weaponwant)))
- if(!((get_weaponinfo(weaponwant)).spawnflags & WEP_FLAG_NORMAL))
- if(!(weaponsInMap & WepSet_FromWeapon(weaponwant)))
- continue;
+ if(!(pl.weapons & wepset))
+ if(!(weaponsInMap & wepset))
+ if((wep.spawnflags & WEP_FLAG_MUTATORBLOCKED) || have_other)
+ continue;
- if(!skipmissing || client_hasweapon(pl, weaponwant, TRUE, FALSE))
+ if(!skipmissing || client_hasweapon(pl, weaponwant, true, false))
+ float i, have_other = false;
+ for(i = WEP_FIRST; i <= WEP_LAST; ++i)
+ {
+ if(i != weaponwant)
+ if((get_weaponinfo(i)).impulse == imp || imp < 0)
+ if((pl.weapons & WepSet_FromWeapon(i)) || (weaponsInMap & WepSet_FromWeapon(i)))
+ have_other = true;
+ }
+
- if(!(pl.weapons & WepSet_FromWeapon(weaponwant)))
- if(!((get_weaponinfo(weaponwant)).spawnflags & WEP_FLAG_NORMAL))
- if(!(weaponsInMap & WepSet_FromWeapon(weaponwant)))
- continue;
+ if(!(pl.weapons & wepset))
+ if(!(weaponsInMap & wepset))
+ if((wep.spawnflags & WEP_FLAG_MUTATORBLOCKED) || have_other)
+ continue;
- client_hasweapon(pl, weaponwant, TRUE, TRUE);
+ client_hasweapon(pl, weaponwant, true, true);
- if (client_hasweapon(self, imp, TRUE, TRUE))
+ if (client_hasweapon(self, imp, true, true))
W_SwitchWeapon_Force(self, imp);
else
self.selectweapon = imp; // update selectweapon ANYWAY
}
W_SwitchWeapon_Force(self, imp);
else
self.selectweapon = imp; // update selectweapon ANYWAY
}
- w = W_GetCycleWeapon(self, weaponorder, dir, -1, 1, TRUE);
+ w = W_GetCycleWeapon(self, weaponorder, dir, -1, 1, true);
- if(client_hasweapon(self, self.cnt, TRUE, FALSE))
+ if(client_hasweapon(self, self.cnt, true, false))