seta cl_weaponpriority "vaporizer vortex fireball mortar machinegun hagar rifle arc electro devastator crylink minelayer shotgun hlac tuba blaster porto seeker hook" "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 "devastator mortar 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 "vaporizer vortex crylink hlac arc electro blaster shockwave" "use impulse 201 for prev gun from this list, 211 for best gun, 221 for next gun. Default value: energy"
-seta cl_weaponpriority2 "vaporizer vortex rifle" "use impulse 202 for prev gun from this list, 212 for best gun, 222 for next gun. Default value: hitscan exact"
-seta cl_weaponpriority3 "vaporizer vortex rifle machinegun shotgun" "use impulse 203 for prev gun from this list, 213 for best gun, 223 for next gun. Default value: hitscan all"
-seta cl_weaponpriority4 "mortar minelayer hlac hagar crylink seeker shotgun" "use impulse 204 for prev gun from this list, 214 for best gun, 224 for next gun. Default value: spam weapons"
-seta cl_weaponpriority5 "blaster shockwave hook porto" "use impulse 205 for prev gun from this list, 215 for best gun, 225 for next gun. Default value: weapons for moving"
-seta cl_weaponpriority6 "" "use impulse 206 for prev gun from this list, 216 for best gun, 226 for next gun"
-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_weaponpriority0 "devastator mortar hagar seeker fireball" "use weapon_priority_0_prev for prev gun from this list, weapon_priority_0_best for best gun, weapon_priority_0_next for next gun. Default value: explosives"
+seta cl_weaponpriority1 "vaporizer vortex crylink hlac arc electro blaster shockwave" "use weapon_priority_1_prev for prev gun from this list, weapon_priority_1_best for best gun, weapon_priority_1_next for next gun. Default value: energy"
+seta cl_weaponpriority2 "vaporizer vortex rifle" "use weapon_priority_2_prev for prev gun from this list, weapon_priority_2_best for best gun, weapon_priority_2_next for next gun. Default value: hitscan exact"
+seta cl_weaponpriority3 "vaporizer vortex rifle machinegun shotgun" "use weapon_priority_3_prev for prev gun from this list, weapon_priority_3_best for best gun, weapon_priority_3_next for next gun. Default value: hitscan all"
+seta cl_weaponpriority4 "mortar minelayer hlac hagar crylink seeker shotgun" "use weapon_priority_4_prev for prev gun from this list, weapon_priority_4_best for best gun, weapon_priority_4_next for next gun. Default value: spam weapons"
+seta cl_weaponpriority5 "blaster shockwave hook porto" "use weapon_priority_5_prev for prev gun from this list, weapon_priority_5_best for best gun, weapon_priority_5_next for next gun. Default value: weapons for moving"
+seta cl_weaponpriority6 "" "use weapon_priority_6_prev for prev gun from this list, weapon_priority_6_best for best gun, weapon_priority_6_next for next gun"
+seta cl_weaponpriority7 "" "use weapon_priority_7_prev for prev gun from this list, weapon_priority_7_best for best gun, weapon_priority_7_next for next gun"
+seta cl_weaponpriority8 "" "use weapon_priority_8_prev for prev gun from this list, weapon_priority_8_best for best gun, weapon_priority_8_next for next gun"
+seta cl_weaponpriority9 "" "use weapon_priority_9_prev for prev gun from this list, weapon_priority_9_best for best gun, weapon_priority_9_next 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"
set g_maplist_allow_hidden 0 "allow hidden maps to be, e.g., voted for and in the maplist"
SHUTDOWN(legacy_##alias) { IMPULSE_ALIAS(alias, "impulse " #id); }
#define X(slot, imp) \
- REGISTER_IMPULSE(weapon_group_##slot, imp) LEGACY_IMPULSE(weapon_group_##slot, imp, "impulse " #imp)
+ REGISTER_IMPULSE(weapon_group_##slot, imp) \
+ LEGACY_IMPULSE(weapon_group_##slot, imp, "impulse " #imp)
X(1, 1)
X(2, 2)
X(3, 3)
X(0, 14)
#undef X
+#define X(slot, dir, imp) \
+ REGISTER_IMPULSE(weapon_priority_##slot##_##dir, imp) \
+ LEGACY_IMPULSE(weapon_priority_##slot##_##dir, imp, "impulse " #imp)
+X(0, prev, 200)
+X(1, prev, 201)
+X(2, prev, 202)
+X(3, prev, 203)
+X(4, prev, 204)
+X(5, prev, 205)
+X(6, prev, 206)
+X(7, prev, 207)
+X(8, prev, 208)
+X(9, prev, 209)
+
+X(0, best, 210)
+X(1, best, 211)
+X(2, best, 212)
+X(3, best, 213)
+X(4, best, 214)
+X(5, best, 215)
+X(6, best, 216)
+X(7, best, 217)
+X(8, best, 218)
+X(9, best, 219)
+
+X(0, next, 220)
+X(1, next, 221)
+X(2, next, 222)
+X(3, next, 223)
+X(4, next, 224)
+X(5, next, 225)
+X(6, next, 226)
+X(7, next, 227)
+X(8, next, 228)
+X(9, next, 229)
+#undef X
+
REGISTER_IMPULSE(weapon_next_byid, 10)
LEGACY_IMPULSE(_weapnext_2, 10, "weapon_next_byid")
if (imp <= WEP_IMPULSE_END)
localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", it.netname, imp));
else
- LOG_TRACEF(_("Impulse limit exceeded, weapon will not be directly accessible: %s\n"), it.netname);
+ LOG_TRACEF("Impulse limit exceeded, weapon will not be directly accessible: %s\n", it.netname);
));
#ifdef CSQC
FOREACH(Weapons, true, LAMBDA(it.wr_init(it)));
X(0, 14)
#undef X
+// custom order weapon cycling
+
+#define X(slot, dir, imp) \
+ IMPULSE(weapon_priority_##slot##_##dir, imp) \
+ { \
+ if (this.vehicle) return; \
+ if (this.deadflag != DEAD_NO) return; \
+ noref int prev = -1; \
+ noref int best = 0; \
+ noref int next = +1; \
+ W_CycleWeapon(this.cvar_cl_weaponpriorities[slot], dir); \
+ }
+X(0, prev, 200)
+X(1, prev, 201)
+X(2, prev, 202)
+X(3, prev, 203)
+X(4, prev, 204)
+X(5, prev, 205)
+X(6, prev, 206)
+X(7, prev, 207)
+X(8, prev, 208)
+X(9, prev, 209)
+
+X(0, best, 210)
+X(1, best, 211)
+X(2, best, 212)
+X(3, best, 213)
+X(4, best, 214)
+X(5, best, 215)
+X(6, best, 216)
+X(7, best, 217)
+X(8, best, 218)
+X(9, best, 219)
+
+X(0, next, 220)
+X(1, next, 221)
+X(2, next, 222)
+X(3, next, 223)
+X(4, next, 224)
+X(5, next, 225)
+X(6, next, 226)
+X(7, next, 227)
+X(8, next, 228)
+X(9, next, 229)
+#undef X
+
IMPULSE(weapon_next_byid, 10)
{
if (this.vehicle) return;
// allow only weapon change impulses when not in round time
if (round_handler_IsActive() && !round_handler_IsRoundStarted())
- if (imp == 17 || (imp >= 20 && imp < 200) || imp > 253) return;
+ {
+ #define X(id) case IMP_##id.impulse:
+ switch (imp)
+ {
+ case WEP_IMPULSE_BEGIN <= imp && imp <= WEP_IMPULSE_END:
+ X(weapon_group_0)
+ X(weapon_group_1)
+ X(weapon_group_2)
+ X(weapon_group_3)
+ X(weapon_group_4)
+ X(weapon_group_5)
+ X(weapon_group_6)
+ X(weapon_group_7)
+ X(weapon_group_8)
+ X(weapon_group_9)
+ X(weapon_next_byid)
+ X(weapon_prev_byid)
+ X(weapon_next_bygroup)
+ X(weapon_prev_bygroup)
+ X(weapon_next_bypriority)
+ X(weapon_prev_bypriority)
+ X(weapon_last)
+ X(weapon_best)
+ X(weapon_reload)
+ X(weapon_priority_0_prev)
+ X(weapon_priority_1_prev)
+ X(weapon_priority_2_prev)
+ X(weapon_priority_3_prev)
+ X(weapon_priority_4_prev)
+ X(weapon_priority_5_prev)
+ X(weapon_priority_6_prev)
+ X(weapon_priority_7_prev)
+ X(weapon_priority_8_prev)
+ X(weapon_priority_9_prev)
+ X(weapon_priority_0_next)
+ X(weapon_priority_1_next)
+ X(weapon_priority_2_next)
+ X(weapon_priority_3_next)
+ X(weapon_priority_4_next)
+ X(weapon_priority_5_next)
+ X(weapon_priority_6_next)
+ X(weapon_priority_7_next)
+ X(weapon_priority_8_next)
+ X(weapon_priority_9_next)
+ X(weapon_priority_0_best)
+ X(weapon_priority_1_best)
+ X(weapon_priority_2_best)
+ X(weapon_priority_3_best)
+ X(weapon_priority_4_best)
+ X(weapon_priority_5_best)
+ X(weapon_priority_6_best)
+ X(weapon_priority_7_best)
+ X(weapon_priority_8_best)
+ X(weapon_priority_9_best)
+ break;
+ default: return;
+ }
+#undef X
+ }
if (vehicle_impulse(this, imp)) return;
return;
});
- if (imp >= 200 && imp <= 229)
- {
- if (!this.vehicle && this.deadflag == DEAD_NO)
- {
- // custom order weapon cycling
- int i = imp % 10;
- int m = (imp - (210 + i)); // <0 for prev, =0 for best, >0 for next
- W_CycleWeapon(this.(cvar_cl_weaponpriorities[i]), m);
- }
- // else // don't retry, as this can break weaplast bind
- // this.impulse = imp; // retry in next frame
- }
- else if (imp >= WEP_IMPULSE_BEGIN && imp <= WEP_IMPULSE_END)
+ if (imp >= WEP_IMPULSE_BEGIN && imp <= WEP_IMPULSE_END)
{
if (!this.vehicle && this.deadflag == DEAD_NO) W_SwitchWeapon(imp - WEP_IMPULSE_BEGIN + WEP_FIRST);
- // else // don't retry, as this can break weaplast bind
- // this.impulse = imp; // retry in next frame
}
}