[nexuiz-commits] r6467 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Apr 9 09:26:13 EDT 2009


Author: div0
Date: 2009-04-09 09:26:12 -0400 (Thu, 09 Apr 2009)
New Revision: 6467

Modified:
   trunk/data/qcsrc/server/cl_weapons.qc
   trunk/data/qcsrc/server/miscfunctions.qc
Log:
make nixnex and weaponarena unofficially able to coexist (the weapon arena then defines the available weapons of nixnex)


Modified: trunk/data/qcsrc/server/cl_weapons.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weapons.qc	2009-04-09 12:59:06 UTC (rev 6466)
+++ trunk/data/qcsrc/server/cl_weapons.qc	2009-04-09 13:26:12 UTC (rev 6467)
@@ -389,23 +389,33 @@
 .float nixnex_lastinfotime;
 .float nixnex_nextincr;
 
+float NixNex_CanChooseWeapon(float wpn)
+{
+	entity e;
+	e = get_weaponinfo(wpn);
+	if(!e.weapons) // skip dummies
+		return FALSE;
+	if(g_weaponarena)
+	{
+		if not(g_weaponarena & e.weapons)
+			return FALSE;
+	}
+	else
+	{
+		if(wpn == WEP_LASER && g_nixnex_with_laser)
+			return FALSE;
+		if not(e.spawnflags & WEPSPAWNFLAG_NORMAL)
+			return FALSE;
+	}
+	return TRUE;
+}
 void Nixnex_ChooseNextWeapon()
 {
 	float j;
-	entity e;
-
 	RandomSelection_Init();
 	for(j = WEP_FIRST; j <= WEP_LAST; ++j)
-	{
-		if(j == WEP_LASER && g_nixnex_with_laser)
-			continue;
-		e = get_weaponinfo(j);
-		if(!e.weapons) // skip dummies
-			continue;
-		if not(e.spawnflags & WEPSPAWNFLAG_NORMAL)
-			continue;
-		RandomSelection_Add(world, j, 1, 0);
-	}
+		if(NixNex_CanChooseWeapon(j))
+			RandomSelection_Add(world, j, 1, (j != nixnex_weapon));
 	nixnex_nextweapon = RandomSelection_chosen_float;
 }
 

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2009-04-09 12:59:06 UTC (rev 6466)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2009-04-09 13:26:12 UTC (rev 6467)
@@ -744,6 +744,7 @@
 
 entity get_weaponinfo(float w);
 
+float NixNex_CanChooseWeapon(float wpn);
 void readplayerstartcvars()
 {
 	entity e;
@@ -814,8 +815,16 @@
 		g_weaponarena_list = strzone(substring(g_weaponarena_list, 0, strlen(g_weaponarena_list) - 3));
 	}
 
-	if(g_weaponarena)
+	if(g_nixnex)
 	{
+		start_weapons = 0;
+		// will be done later
+		for(i = WEP_FIRST; i <= WEP_LAST; ++i)
+			if(NixNex_CanChooseWeapon(i))
+				weapon_action(i, WR_PRECACHE);
+	}
+	else if(g_weaponarena)
+	{
 		start_weapons = g_weaponarena;
 		start_ammo_rockets = 999;
 		start_ammo_shells = 999;
@@ -824,18 +833,6 @@
 		start_ammo_fuel = 999;
 		start_items |= IT_UNLIMITED_AMMO;
 	}
-	else if(g_nixnex)
-	{
-		start_weapons = 0;
-		// will be done later
-		for(i = WEP_FIRST; i <= WEP_LAST; ++i)
-		{
-			e = get_weaponinfo(i);
-			if(!(e.weapon))
-				continue;
-			weapon_action(e.weapon, WR_PRECACHE);
-		}
-	}
 	else if(g_minstagib)
 	{
 		start_health = 100;



More information about the nexuiz-commits mailing list