seta cl_weaponpriority7 "" "use impulse 207 for prev gun from this list, 217 for best gun, 227 for next gun"
seta cl_weaponpriority8 "" "use impulse 208 for prev gun from this list, 218 for best gun, 228 for next gun"
seta cl_weaponpriority9 "" "use impulse 209 for prev gun from this list, 219 for best gun, 229 for next gun"
+seta cl_weaponimpulsemode 0 "0: only cycle between currently usable weapons in weapon priority order; 1: cycle between all possible weapons on a key in weapon priority order"
seta sv_status_privacy 1 "hide IP addresses from \"status\" replies shown to clients"
{
if (client_hasweapon(self, imp, TRUE, TRUE))
W_SwitchWeapon_Force(self, imp);
+ else
+ self.selectweapon = imp; // update selectweapon ANYWAY
}
else
{
};
.float weaponcomplainindex;
-float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, float complain)
+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.
string rest;
switchtonext = switchtolast = 0;
first_valid = prev_valid = 0;
+ float weaponcur;
+
+ if(skipmissing || pl.selectweapon == 0)
+ weaponcur = pl.switchweapon;
+ else
+ weaponcur = pl.selectweapon;
if(dir == 0)
switchtonext = 1;
++c;
- if(client_hasweapon(pl, weaponwant, TRUE, FALSE))
+ if(!skipmissing || client_hasweapon(pl, weaponwant, TRUE, FALSE))
{
if(switchtonext)
return weaponwant;
if(!first_valid)
first_valid = weaponwant;
- if(weaponwant == pl.switchweapon)
+ if(weaponwant == weaponcur)
{
if(dir >= 0)
switchtonext = 1;
void W_CycleWeapon(string weaponorder, float dir)
{
float w;
- w = W_GetCycleWeapon(self, weaponorder, dir, -1, 1);
+ w = W_GetCycleWeapon(self, weaponorder, dir, -1, 1, TRUE);
if(w > 0)
W_SwitchWeapon(w);
}
void W_NextWeaponOnImpulse(float imp)
{
float w;
- w = W_GetCycleWeapon(self, self.cvar_cl_weaponpriority, +1, imp, 1);
+ w = W_GetCycleWeapon(self, self.cvar_cl_weaponpriority, +1, imp, 1, (self.cvar_cl_weaponimpulsemode == 0));
if(w > 0)
W_SwitchWeapon(w);
}
float w_getbestweapon(entity e)
{
- return W_GetCycleWeapon(e, e.cvar_cl_weaponpriority, 0, -1, 0);
+ return W_GetCycleWeapon(e, e.cvar_cl_weaponpriority, 0, -1, FALSE, TRUE);
};
// generic weapons table
GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[7], "cl_weaponpriority7", W_FixWeaponOrder_AllowIncomplete);
GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[8], "cl_weaponpriority8", W_FixWeaponOrder_AllowIncomplete);
GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[9], "cl_weaponpriority9", W_FixWeaponOrder_AllowIncomplete);
+ GetCvars_handleFloat(s, f, cvar_cl_weaponimpulsemode, "cl_weaponimpulsemode");
GetCvars_handleFloat(s, f, cvar_cl_autotaunt, "cl_autotaunt");
GetCvars_handleFloat(s, f, cvar_cl_noantilag, "cl_noantilag");
GetCvars_handleFloat(s, f, cvar_cl_voice_directional, "cl_voice_directional");