// switch between weapons
-void Send_WeaponComplain(entity e, float wpn, string wpnname, float type)
+void Send_WeaponComplain(entity e, float wpn, float type)
{
msg_entity = e;
WriteByte(MSG_ONE, SVC_TEMPENTITY);
WriteByte(MSG_ONE, TE_CSQC_WEAPONCOMPLAIN);
WriteByte(MSG_ONE, wpn);
- WriteString(MSG_ONE, wpnname);
WriteByte(MSG_ONE, type);
}
if(time < self.hasweapon_complain_spam)
complain = 0;
+
+ if(wpn == WEP_HOOK && !g_grappling_hook && autocvar_g_nades && !((cl.weapons | weaponsInMap) & WepSet_FromWeapon(wpn)))
+ complain = 0;
+
if(complain)
self.hasweapon_complain_spam = time + 0.2;
sprint(self, "Invalid weapon\n");
return FALSE;
}
- if (WEPSET_CONTAINS_EW(cl, wpn))
+ if (cl.weapons & WepSet_FromWeapon(wpn))
{
if (andammo)
{
if(IS_REAL_CLIENT(cl))
{
play2(cl, "weapons/unavailable.wav");
- Send_WeaponComplain (cl, wpn, W_Name(wpn), 0);
+ Send_WeaponComplain (cl, wpn, 0);
}
return FALSE;
}
{
// DRESK - 3/16/07
// Report Proper Weapon Status / Modified Weapon Ownership Message
- if (WEPSET_CONTAINS_AW(weaponsInMap, wpn))
+ if (weaponsInMap & WepSet_FromWeapon(wpn))
{
- Send_WeaponComplain(cl, wpn, W_Name(wpn), 1);
+ Send_WeaponComplain(cl, wpn, 1);
if(autocvar_g_showweaponspawns)
{
entity e;
- string s;
-
- e = get_weaponinfo(wpn);
- s = e.model2;
for(e = world; (e = findfloat(e, weapon, wpn)); )
{
- if(e.classname == "droppedweapon")
+ if(e.classname == "droppedweapon" && autocvar_g_showweaponspawns < 2)
continue;
- if not(e.flags & FL_ITEM)
+ if(!(e.flags & FL_ITEM))
continue;
WaypointSprite_Spawn(
- s,
+ (get_weaponinfo(wpn)).wpmodel,
1, 0,
- world, e.origin,
+ world, e.origin + ('0 0 1' * e.maxs_z) * 1.2,
self, 0,
world, enemy,
0,
}
else
{
- Send_WeaponComplain (cl, wpn, W_Name(wpn), 2);
+ Send_WeaponComplain (cl, wpn, 2);
}
play2(cl, "weapons/unavailable.wav");
// function. Thus we must use car/cdr.
float weaponwant, first_valid, prev_valid, switchtonext, switchtolast, c;
string rest;
+ WepSet wepset = '0 0 0';
switchtonext = switchtolast = 0;
first_valid = prev_valid = 0;
float weaponcur;
+ entity wep;
if(skipmissing || pl.selectweapon == 0)
weaponcur = pl.switchweapon;
while(rest != "")
{
weaponwant = stof(car(rest)); rest = cdr(rest);
+ wep = get_weaponinfo(weaponwant);
+ wepset = WepSet_FromWeapon(weaponwant);
if(imp >= 0)
- if((get_weaponinfo(weaponwant)).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;
+ }
+
+ // skip weapons we don't own that aren't normal and aren't in the map
+ if(!(pl.weapons & wepset))
+ if(!(weaponsInMap & wepset))
+ if((wep.spawnflags & WEP_FLAG_MUTATORBLOCKED) || have_other)
+ continue;
++c;
while(rest != "")
{
weaponwant = stof(car(rest)); rest = cdr(rest);
+ wep = get_weaponinfo(weaponwant);
+ wepset = WepSet_FromWeapon(weaponwant);
if(imp >= 0)
- if((get_weaponinfo(weaponwant)).impulse != imp)
+ 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;
+ }
+
+ // skip weapons we don't own that aren't normal and aren't in the map
+ if(!(pl.weapons & wepset))
+ if(!(weaponsInMap & wepset))
+ if((wep.spawnflags & WEP_FLAG_MUTATORBLOCKED) || have_other)
+ continue;
+
--c;
if(c == 0)
{
// 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(WEPSET_CONTAINS_EW(pl, w))
+ if(pl.weapons & WepSet_FromWeapon(w))
{
- WEPSET_ANDNOT_EW(pl, w);
+ pl.weapons &= ~WepSet_FromWeapon(w);
ww = w_getbestweapon(pl);
- WEPSET_OR_EW(pl, w);
+ pl.weapons |= WepSet_FromWeapon(w);
}
else
ww = w_getbestweapon(pl);