From 31b183c9c1beaa0f0d17312ef5a1cbcb9fc6a864 Mon Sep 17 00:00:00 2001 From: div0 Date: Fri, 12 Dec 2008 15:51:04 +0000 Subject: [PATCH] weapon priority lists: allow the impulse numbers (230...) as an alternative way to specify a weapon git-svn-id: svn://svn.icculus.org/nexuiz/trunk@5196 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/common/items.qc | 2 +- data/qcsrc/common/util.qc | 15 ++++++++++++--- data/qcsrc/common/util.qh | 2 +- data/qcsrc/menu/nexuiz/weaponslist.c | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/data/qcsrc/common/items.qc b/data/qcsrc/common/items.qc index 88e25980d..2f96d6cdd 100644 --- a/data/qcsrc/common/items.qc +++ b/data/qcsrc/common/items.qc @@ -81,7 +81,7 @@ entity get_weaponinfo(float id) } string W_FixWeaponOrder(string order, float complete) { - return fixPriorityList(order, WEP_FIRST, WEP_LAST, complete); + return fixPriorityList(order, WEP_FIRST, WEP_LAST, 230 - WEP_FIRST, complete); } #ifdef SVQC diff --git a/data/qcsrc/common/util.qc b/data/qcsrc/common/util.qc index 80bc4516c..a31260251 100644 --- a/data/qcsrc/common/util.qc +++ b/data/qcsrc/common/util.qc @@ -641,7 +641,7 @@ void fixedmakevectors(vector a) } #endif -string fixPriorityList(string order, float from, float to, float complete) +string fixPriorityList(string order, float from, float to, float subtract, float complete) { string neworder; float i, n, w; @@ -650,8 +650,17 @@ string fixPriorityList(string order, float from, float to, float complete) for(i = 0; i < n; ++i) { w = stof(argv(i)); - if(w >= from && w <= to && w == floor(w)) - neworder = strcat(neworder, ftos(w), " "); + if(w == floor(w)) + { + if(w >= from && w <= to) + neworder = strcat(neworder, ftos(w), " "); + else + { + w -= subtract; + if(w >= from && w <= to) + neworder = strcat(neworder, ftos(w), " "); + } + } } if(complete) diff --git a/data/qcsrc/common/util.qh b/data/qcsrc/common/util.qh index 045f2fd5e..5bdafc32e 100644 --- a/data/qcsrc/common/util.qh +++ b/data/qcsrc/common/util.qh @@ -74,7 +74,7 @@ void fixedmakevectors(vector a); #define fixedvectoangles vectoangles #endif -string fixPriorityList(string pl, float from, float to, float complete); +string fixPriorityList(string pl, float from, float to, float subtract, float complete); string swapInPriorityList(string order, float i, float j); float cvar_value_issafe(string s); diff --git a/data/qcsrc/menu/nexuiz/weaponslist.c b/data/qcsrc/menu/nexuiz/weaponslist.c index df4aaf838..de1fd87b1 100644 --- a/data/qcsrc/menu/nexuiz/weaponslist.c +++ b/data/qcsrc/menu/nexuiz/weaponslist.c @@ -34,7 +34,7 @@ void drawNexuizWeaponsList(entity me) // read in cvar? string s, t; s = cvar_string("cl_weaponpriority"); - t = fixPriorityList(s, WEP_FIRST, WEP_LAST, 1); + t = W_FixWeaponOrder(s, 1); if(t != s) { print("AUTOFIXED\n"); -- 2.39.2