]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_weaponsystem.qc
Merge remote branch 'origin/master' into samual/mutator_ctf
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_weaponsystem.qc
index 1208766e21a99fca98117786b7391e0cb312d6f4..d2c2546d2f3e091660282b3626e6b5521996011c 100644 (file)
@@ -727,7 +727,7 @@ void Send_WeaponComplain (entity e, float wpn, string wpnname, float type)
 
 float client_hasweapon(entity cl, float wpn, float andammo, float complain)
 {
-       float weaponbit, f;
+       float f;
        entity oldself;
 
        if(time < self.hasweapon_complain_spam)
@@ -741,8 +741,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
                        sprint(self, "Invalid weapon\n");
                return FALSE;
        }
-       weaponbit = W_WeaponBit(wpn);
-       if (cl.weapons & weaponbit)
+       if (WEPSET_CONTAINS_EW(cl, wpn))
        {
                if (andammo)
                {
@@ -783,7 +782,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
        {
                // DRESK - 3/16/07
                // Report Proper Weapon Status / Modified Weapon Ownership Message
-               if(weaponsInMap & weaponbit)
+               if (WEPSET_CONTAINS_AW(weaponsInMap, wpn))
                {
                        sprint(cl, strcat("You do not have the ^2", W_Name(wpn), "\n") );
                        Send_WeaponComplain (cl, wpn, W_Name(wpn), 1);
@@ -796,7 +795,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
                                e = get_weaponinfo(wpn);
                                s = e.model2;
 
-                               for(e = world; (e = findfloat(e, weapons, weaponbit)); )
+                               for(e = world; (e = findfloat(e, weapon, wpn)); )
                                {
                                        if(e.classname == "droppedweapon")
                                                continue;
@@ -867,10 +866,15 @@ 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 = W_WeaponBit(pl.weapon);
-       pl.weapons &~= w;
-       ww = w_getbestweapon(pl);
-       pl.weapons |= w;
+       w = pl.weapon;
+       if(WEPSET_CONTAINS_EW(pl, w))
+       {
+               WEPSET_ANDNOT_EW(pl, w);
+               ww = w_getbestweapon(pl);
+               WEPSET_OR_EW(pl, w);
+       }
+       else
+               ww = w_getbestweapon(pl);
        if(ww)
                W_SwitchWeapon_Force(pl, ww);
 }
@@ -1512,7 +1516,7 @@ void W_Reload(float sent_ammo_min, float sent_ammo_amount, float sent_time, stri
 
        // now begin the reloading process
 
-       sound (self, CH_WEAPON_B, self.reload_sound, VOL_BASE, ATTN_NORM);
+       sound (self, CH_WEAPON_SINGLE, self.reload_sound, VOL_BASE, ATTN_NORM);
 
        // do not set ATTACK_FINISHED in reload code any more. This causes annoying delays if eg: You start reloading a weapon,
        // then quickly switch to another weapon and back. Reloading is canceled, but the reload delay is still there,