r5196 - in trunk/data/qcsrc: common menu/nexuiz

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Dec 12 10:51:05 EST 2008


Author: div0
Date: 2008-12-12 10:51:04 -0500 (Fri, 12 Dec 2008)
New Revision: 5196

Modified:
   trunk/data/qcsrc/common/items.qc
   trunk/data/qcsrc/common/util.qc
   trunk/data/qcsrc/common/util.qh
   trunk/data/qcsrc/menu/nexuiz/weaponslist.c
Log:
weapon priority lists: allow the impulse numbers (230...) as an alternative way to specify a weapon


Modified: trunk/data/qcsrc/common/items.qc
===================================================================
--- trunk/data/qcsrc/common/items.qc	2008-12-12 13:20:37 UTC (rev 5195)
+++ trunk/data/qcsrc/common/items.qc	2008-12-12 15:51:04 UTC (rev 5196)
@@ -81,7 +81,7 @@
 }
 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

Modified: trunk/data/qcsrc/common/util.qc
===================================================================
--- trunk/data/qcsrc/common/util.qc	2008-12-12 13:20:37 UTC (rev 5195)
+++ trunk/data/qcsrc/common/util.qc	2008-12-12 15:51:04 UTC (rev 5196)
@@ -641,7 +641,7 @@
 }
 #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 @@
 	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)

Modified: trunk/data/qcsrc/common/util.qh
===================================================================
--- trunk/data/qcsrc/common/util.qh	2008-12-12 13:20:37 UTC (rev 5195)
+++ trunk/data/qcsrc/common/util.qh	2008-12-12 15:51:04 UTC (rev 5196)
@@ -74,7 +74,7 @@
 #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);

Modified: trunk/data/qcsrc/menu/nexuiz/weaponslist.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/weaponslist.c	2008-12-12 13:20:37 UTC (rev 5195)
+++ trunk/data/qcsrc/menu/nexuiz/weaponslist.c	2008-12-12 15:51:04 UTC (rev 5196)
@@ -34,7 +34,7 @@
 	// 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");




More information about the nexuiz-commits mailing list