alias -zoom -button4
alias +crouch +button5
alias -crouch -button5
-alias weapnext "_weapnext_${_supports_weaponpriority}${cl_weaponpriority_useforcycling}"
-alias _weapnext_00 "impulse 10"
-alias _weapnext_01 "impulse 10"
-alias _weapnext_10 "impulse 10"
-alias _weapnext_11 "impulse 15"
+alias weapnext "_weapnext_${cl_weaponpriority_useforcycling}"
+alias _weapnext_0 "impulse 18"
+alias _weapnext_1 "impulse 15"
+alias _weapnext_2 "impulse 10"
alias weaplast "impulse 11"
-alias weapprev "_weapprev_${_supports_weaponpriority}${cl_weaponpriority_useforcycling}"
-alias _weapprev_00 "impulse 12"
-alias _weapprev_01 "impulse 12"
-alias _weapprev_10 "impulse 12"
-alias _weapprev_11 "impulse 16"
-set _supports_weaponpriority 0 "set to 1 by csqc if supported, and to 0 on disconnect"
+alias weapprev "_weapprev_${cl_weaponpriority_useforcycling}"
+alias _weapprev_0 "impulse 19"
+alias _weapprev_1 "impulse 16"
+alias _weapprev_2 "impulse 12"
alias weapbest "impulse 13"
alias reload "impulse 20"
// note: these cvars use weapon NUMBERS. Use the menu to edit this cvar, or look the numbers up in qcsrc/common/constants.qh.
seta cl_weaponpriority "minstanex rocketlauncher nex grenadelauncher fireball hlac hagar seeker crylink campingrifle uzi electro tuba shotgun laser hook porto" "weapon priority list"
-seta cl_weaponpriority_useforcycling 0 "when set, weapon cycling by the mouse wheel makes use of the weapon priority list"
+seta cl_weaponpriority_useforcycling 0 "when set, weapon cycling by the mouse wheel makes use of the weapon priority list (the special value 2 uses the weapon ID list for cycling)"
seta cl_weaponpriority0 "rocketlauncher grenadelauncher hagar seeker fireball" "use impulse 200 for prev gun from this list, 210 for best gun, 220 for next gun. Default value: explosives"
seta cl_weaponpriority1 "minstanex nex crylink hlac electro laser" "use impulse 201 for prev gun from this list, 211 for best gun, 221 for next gun. Default value: energy"
seta cl_weaponpriority2 "minstanex nex campingrifle" "use impulse 202 for prev gun from this list, 212 for best gun, 222 for next gun. Default value: hitscan exact"
GetTeam(COLOR_SPECTATOR, true); // add specs first
- cvar_clientsettemp("_supports_weaponpriority", "1");
-
RegisterWeapons();
WaypointSprite_Load();
#define PARTICLES_USECOLOR 2
vector particles_colormin, particles_colormax;
void(float effectindex, entity own, vector org_from, vector org_to, vector dir_from, vector dir_to, float countmultiplier, float flags) boxparticles = #502;
+string(string format, ...) sprintf = #627;
weaponorder[j] = h;
}
+string weaponorder_cmp_str;
float weaponorder_cmp(float i, float j, entity pass)
{
- float d;
- d = mod(weaponorder[i].impulse + 9, 10) - mod(weaponorder[j].impulse + 9, 10);
- if(d)
- return d;
- d = weaponorder[i].weapon - weaponorder[j].weapon;
- return d;
+ float ai, aj;
+ ai = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[i].weapon), 0);
+ aj = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[j].weapon), 0);
+ return aj - ai; // the string is in REVERSE order (higher prio at the right is what we want, but higher prio first is the string)
}
void HUD_WeaponIcons(void)
++weapon_cnt;
}
}
+
+ // TODO make this configurable
+ weaponorder_cmp_str = strcat(" ", weaponorder_byimpulse, " ");
heapsort(weapon_cnt, weaponorder_swap, weaponorder_cmp, world);
HUD_Panel_DrawBg(id, pos, mySize, 0);
dummy_weapon_info.model2 = "";
float i;
- weaponpriority_hudselector_0 = "";
+ weaponorder_byid = "";
for(i = 24; i >= 1; --i)
if(weapon_info[i-1])
- weaponpriority_hudselector_0 = strcat(weaponpriority_hudselector_0, " ", ftos(i));
+ weaponorder_byid = strcat(weaponorder_byid, " ", ftos(i));
float imp;
- weaponpriority_hudselector_1 = "";
+ weaponorder_byimpulse = "";
for(i = 1; i <= 24; ++i)
{
wi = weapon_info[i-1];
if(wi && wi.impulse == 0)
- weaponpriority_hudselector_1 = strcat(weaponpriority_hudselector_1, " ", ftos(i));
+ weaponorder_byimpulse = strcat(weaponorder_byimpulse, " ", ftos(i));
}
for(imp = 9; imp > 0; --imp)
for(i = 1; i <= 24; ++i)
{
wi = weapon_info[i-1];
if(wi && wi.impulse == imp)
- weaponpriority_hudselector_1 = strcat(weaponpriority_hudselector_1, " ", ftos(i));
+ weaponorder_byimpulse = strcat(weaponorder_byimpulse, " ", ftos(i));
}
- weaponpriority_hudselector_0 = strzone(substring(weaponpriority_hudselector_0, 1, strlen(weaponpriority_hudselector_0) - 1));
- weaponpriority_hudselector_1 = strzone(substring(weaponpriority_hudselector_1, 1, strlen(weaponpriority_hudselector_1) - 1));
+ weaponorder_byid = strzone(substring(weaponorder_byid, 1, strlen(weaponorder_byid) - 1));
+ weaponorder_byimpulse = strzone(substring(weaponorder_byimpulse, 1, strlen(weaponorder_byimpulse) - 1));
}
entity get_weaponinfo(float id)
{
float IT_UNLIMITED_AMMO = 3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO;
// variables:
-string weaponpriority_hudselector_0;
-string weaponpriority_hudselector_1;
+string weaponorder_byid;
+string weaponorder_byimpulse;
// functions:
entity get_weaponinfo(float id);
void W_NextWeapon(float list)
{
if(list == 0)
- W_CycleWeapon(weaponpriority_hudselector_0, -1);
+ W_CycleWeapon(weaponorder_byid, -1);
else if(list == 1)
- W_CycleWeapon(weaponpriority_hudselector_1, -1);
+ W_CycleWeapon(weaponorder_byimpulse, -1);
else if(list == 2)
W_CycleWeapon(self.cvar_cl_weaponpriority, -1);
}
void W_PreviousWeapon(float list)
{
if(list == 0)
- W_CycleWeapon(weaponpriority_hudselector_0, +1);
+ W_CycleWeapon(weaponorder_byid, +1);
else if(list == 1)
- W_CycleWeapon(weaponpriority_hudselector_1, +1);
+ W_CycleWeapon(weaponorder_byimpulse, +1);
else if(list == 2)
W_CycleWeapon(self.cvar_cl_weaponpriority, +1);
}