#include "selection.qh"
-#include "../_all.qh"
#include "weaponsystem.qh"
#include "../t_items.qh"
#include "../../common/constants.qh"
#include "../../common/util.qh"
+#include "../../common/items/item.qh"
#include "../../common/weapons/all.qh"
+#include "../../common/mutators/mutator/waypoints/waypointsprites.qh"
// switch between weapons
void Send_WeaponComplain(entity e, float wpn, float type)
{
msg_entity = e;
- WriteByte(MSG_ONE, SVC_TEMPENTITY);
- WriteByte(MSG_ONE, TE_CSQC_WEAPONCOMPLAIN);
+ WriteHeader(MSG_ONE, TE_CSQC_WEAPONCOMPLAIN);
WriteByte(MSG_ONE, wpn);
WriteByte(MSG_ONE, type);
}
{
weaponwant = stof(car(rest)); rest = cdr(rest);
wep = get_weaponinfo(weaponwant);
- wepset = WepSet_FromWeapon(weaponwant);
+ wepset = wep.m_wepset;
if(imp >= 0)
if(wep.impulse != imp)
continue;
float i, have_other = false;
for(i = WEP_FIRST; i <= WEP_LAST; ++i)
{
+ Weapon e = get_weaponinfo(i);
if(i != weaponwant)
- if((get_weaponinfo(i)).impulse == imp || imp < 0)
- if((pl.weapons & WepSet_FromWeapon(i)) || (weaponsInMap & WepSet_FromWeapon(i)))
+ if(e.impulse == imp || imp < 0)
+ if((pl.weapons & (e.m_wepset)) || (weaponsInMap & (e.m_wepset)))
have_other = true;
}
{
weaponwant = stof(car(rest)); rest = cdr(rest);
wep = get_weaponinfo(weaponwant);
- wepset = WepSet_FromWeapon(weaponwant);
+ wepset = wep.m_wepset;
if(imp >= 0)
if(wep.impulse != imp)
continue;
float i, have_other = false;
for(i = WEP_FIRST; i <= WEP_LAST; ++i)
{
+ Weapon w = get_weaponinfo(i);
if(i != weaponwant)
- if((get_weaponinfo(i)).impulse == imp || imp < 0)
- if((pl.weapons & WepSet_FromWeapon(i)) || (weaponsInMap & WepSet_FromWeapon(i)))
+ if(w.impulse == imp || imp < 0)
+ if((pl.weapons & (w.m_wepset)) || (weaponsInMap & (w.m_wepset)))
have_other = true;
}
void W_SwitchToOtherWeapon(entity pl)
{
// hack to ensure it switches to an OTHER weapon (in case the other fire mode still has ammo, we want that anyway)
- float w, ww;
- w = pl.weapon;
- if(pl.weapons & WepSet_FromWeapon(w))
+ int ww;
+ WepSet set = WepSet_FromWeapon(pl.weapon);
+ if(pl.weapons & set)
{
- pl.weapons &= ~WepSet_FromWeapon(w);
+ pl.weapons &= ~set;
ww = w_getbestweapon(pl);
- pl.weapons |= WepSet_FromWeapon(w);
+ pl.weapons |= set;
}
else
ww = w_getbestweapon(pl);
}
// previously used if exists and has ammo, (second) best otherwise
-void W_LastWeapon(void)
+void W_LastWeapon()
{SELFPARAM();
if(client_hasweapon(self, self.cnt, true, false))
W_SwitchWeapon(self.cnt);