]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/selection.qc
Add a wrapper for networked cvars and attach them to the client rather than the clien...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / selection.qc
index 5dd3073e9f0fe57b800b0ba19376e3a159942e81..09f5e65ca14349aa7da3fc37f7d5b68638779647 100644 (file)
@@ -283,7 +283,7 @@ bool W_SwitchWeapon(entity this, Weapon w, .entity weaponentity)
                        return false;
                }
        }
-       else if(!weaponLocked(this) && CS(this).cvar_cl_weapon_switch_reload)
+       else if(!weaponLocked(this) && CS_CVAR(this).cvar_cl_weapon_switch_reload)
        {
                entity actor = this;
                w.wr_reload(w, actor, weaponentity);
@@ -294,7 +294,7 @@ bool W_SwitchWeapon(entity this, Weapon w, .entity weaponentity)
 
 void W_SwitchWeapon_TryOthers(entity this, Weapon w, .entity weaponentity)
 {
-       if(!W_SwitchWeapon(this, w, weaponentity) && CS(this).cvar_cl_weapon_switch_fallback_to_impulse)
+       if(!W_SwitchWeapon(this, w, weaponentity) && CS_CVAR(this).cvar_cl_weapon_switch_fallback_to_impulse)
                W_NextWeaponOnImpulse(this, w.impulse, weaponentity);
 }
 
@@ -309,7 +309,7 @@ void W_CycleWeapon(entity this, string weaponorder, float dir, .entity weaponent
 void W_NextWeaponOnImpulse(entity this, float imp, .entity weaponentity)
 {
        float w;
-       w = W_GetCycleWeapon(this, CS(this).cvar_cl_weaponpriority, +1, imp, 1, (CS(this).cvar_cl_weaponimpulsemode == 0), weaponentity);
+       w = W_GetCycleWeapon(this, CS_CVAR(this).cvar_cl_weaponpriority, +1, imp, 1, (CS_CVAR(this).cvar_cl_weaponimpulsemode == 0), weaponentity);
        if(w > 0)
                W_SwitchWeapon(this, REGISTRY_GET(Weapons, w), weaponentity);
 }
@@ -320,9 +320,9 @@ void W_NextWeapon(entity this, int list, .entity weaponentity)
        if(list == 0)
                W_CycleWeapon(this, weaponorder_byid, -1, weaponentity);
        else if(list == 1)
-               W_CycleWeapon(this, CS(this).weaponorder_byimpulse, -1, weaponentity);
+               W_CycleWeapon(this, CS_CVAR(this).weaponorder_byimpulse, -1, weaponentity);
        else if(list == 2)
-               W_CycleWeapon(this, CS(this).cvar_cl_weaponpriority, -1, weaponentity);
+               W_CycleWeapon(this, CS_CVAR(this).cvar_cl_weaponpriority, -1, weaponentity);
 }
 
 // prev weapon
@@ -331,9 +331,9 @@ void W_PreviousWeapon(entity this, float list, .entity weaponentity)
        if(list == 0)
                W_CycleWeapon(this, weaponorder_byid, +1, weaponentity);
        else if(list == 1)
-               W_CycleWeapon(this, CS(this).weaponorder_byimpulse, +1, weaponentity);
+               W_CycleWeapon(this, CS_CVAR(this).weaponorder_byimpulse, +1, weaponentity);
        else if(list == 2)
-               W_CycleWeapon(this, CS(this).cvar_cl_weaponpriority, +1, weaponentity);
+               W_CycleWeapon(this, CS_CVAR(this).cvar_cl_weaponpriority, +1, weaponentity);
 }
 
 // previously used if exists and has ammo, (second) best otherwise