r4918 - in trunk/data: . qcsrc/menu/nexuiz qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Oct 28 02:49:47 EDT 2008


Author: div0
Date: 2008-10-28 02:49:47 -0400 (Tue, 28 Oct 2008)
New Revision: 4918

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/mutator_reset.cfg
   trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mutators.c
   trunk/data/qcsrc/menu/nexuiz/radiobutton.c
   trunk/data/qcsrc/server/cl_weapons.qc
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/g_world.qc
   trunk/data/qcsrc/server/miscfunctions.qc
   trunk/data/qcsrc/server/t_items.qc
   trunk/data/qcsrc/server/teamplay.qc
Log:
New "weapon arena" and "weapon replace" cvars. InstaGib is back in a new form.


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2008-10-27 15:16:05 UTC (rev 4917)
+++ trunk/data/defaultNexuiz.cfg	2008-10-28 06:49:47 UTC (rev 4918)
@@ -284,8 +284,8 @@
 set g_minstagib_invis_alpha 0.05
 set g_minstagib_speed_jumpheight 1.8
 set g_minstagib_speed_moverate 1.25
-set g_rocketarena 0
 set g_vampire 0
+set g_weaponarena "0" // put in a list of weapons to enable a weapon arena mode
 set g_shocknex 0
 set g_laserguided_missile 0
 set g_midair 0
@@ -1112,6 +1112,7 @@
 
 alias allready "sv_cmd allready"
 
+// 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 "14 13 9 8 11 7 6 5 4 3 2 1 10 12" // default porto and hook as LOW priority, use the weapon key numbers otherwise
 seta cl_weaponpriority_useforcycling 0
 // impulse 200, 210, 220:
@@ -1130,22 +1131,22 @@
 
 // NOTE: this only replaces weapons on the map
 // use g_start_weapon_* to also replace the on-startup weapons!
-// example: g_weaponreplace_7 "7 11", then Nexes become MinstaNexes 50% of the times
-// set the cvars to 0 to totally disable a weapon
-set g_weaponreplace_1 ""
-set g_weaponreplace_2 ""
-set g_weaponreplace_3 ""
-set g_weaponreplace_4 ""
-set g_weaponreplace_5 ""
-set g_weaponreplace_6 ""
-set g_weaponreplace_7 ""
-set g_weaponreplace_8 ""
-set g_weaponreplace_9 ""
-set g_weaponreplace_10 ""
-set g_weaponreplace_11 ""
-set g_weaponreplace_12 ""
-set g_weaponreplace_13 ""
-set g_weaponreplace_14 ""
+// example: g_weaponreplace_nex "nex minstanex", then Nexes become MinstaNexes 50% of the times
+// set the cvars to "0" to totally disable a weapon
+set g_weaponreplace_laser ""
+set g_weaponreplace_shotgun ""
+set g_weaponreplace_uzi ""
+set g_weaponreplace_grenadelauncher ""
+set g_weaponreplace_electro ""
+set g_weaponreplace_crylink ""
+set g_weaponreplace_nex ""
+set g_weaponreplace_hagar ""
+set g_weaponreplace_rocketlauncher ""
+set g_weaponreplace_porto ""
+set g_weaponreplace_minstanex ""
+set g_weaponreplace_hook ""
+set g_weaponreplace_seeker ""
+set g_weaponreplace_hlac ""
 
 seta sv_status_privacy 1 // hide IP addresses from "status" replies shown to clients
 

Modified: trunk/data/mutator_reset.cfg
===================================================================
--- trunk/data/mutator_reset.cfg	2008-10-27 15:16:05 UTC (rev 4917)
+++ trunk/data/mutator_reset.cfg	2008-10-28 06:49:47 UTC (rev 4918)
@@ -1,14 +1,13 @@
 set g_cloaked 0
 set g_footsteps 0
 set g_grappling_hook 0
-set g_instagib 0
 set g_laserguided_missile 0
 set g_midair 0
 set g_minstagib 0
 set g_nixnex 0
 set g_nixnex_with_laser 0
 set g_norecoil 0
-set g_rocketarena 0
+set g_weaponarena 0
 set g_vampire 0
 set slowmo 1.0
 set sv_gravity 800

Modified: trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mutators.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mutators.c	2008-10-27 15:16:05 UTC (rev 4917)
+++ trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mutators.c	2008-10-28 06:49:47 UTC (rev 4918)
@@ -72,13 +72,17 @@
 	me.TR(me);
 		me.TD(me, 1, 2, e = makeNexuizRadioButton(1, "g_minstagib", string_null, "MinstaGib"));
 	me.TR(me);
+		me.TD(me, 1, 2, e = makeNexuizRadioButton(1, "g_weaponarena", "nex", "InstaGib"));
+			e.cvarOffValue = "0";
+	me.TR(me);
 		me.TD(me, 1, 2, e = makeNexuizRadioButton(1, "g_nixnex", string_null, "NixNex"));
 	me.TR(me);
 		me.TDempty(me, 0.2);
 		me.TD(me, 1, 1.8, e = makeNexuizCheckBox(1, "g_nixnex_with_laser", "with laser"));
 			setDependent(e, "g_nixnex", 1, 1);
 	me.TR(me);
-		me.TD(me, 1, 2, e = makeNexuizRadioButton(1, "g_rocketarena", string_null, "Rocket launcher arena"));
+		me.TD(me, 1, 2, e = makeNexuizRadioButton(1, "g_weaponarena", "rocketlauncher", "Rocket launcher arena"));
+			e.cvarOffValue = "0";
 
 	me.gotoRC(me, me.rows - 2, 0);
 		s = makeNexuizSlider(80, 400, 8, "sv_gravity");

Modified: trunk/data/qcsrc/menu/nexuiz/radiobutton.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/radiobutton.c	2008-10-27 15:16:05 UTC (rev 4917)
+++ trunk/data/qcsrc/menu/nexuiz/radiobutton.c	2008-10-28 06:49:47 UTC (rev 4918)
@@ -12,6 +12,7 @@
 
 	ATTRIB(NexuizRadioButton, cvarName, string, string_null)
 	ATTRIB(NexuizRadioButton, cvarValue, string, string_null)
+	ATTRIB(NexuizRadioButton, cvarOffValue, string, string_null)
 	METHOD(NexuizRadioButton, loadCvars, void(entity))
 	METHOD(NexuizRadioButton, saveCvars, void(entity))
 
@@ -92,6 +93,8 @@
 	{
 		if(me.checked)
 			cvar_set(me.cvarName, me.cvarValue);
+		else if(me.cvarOffValue)
+			cvar_set(me.cvarName, me.cvarOffValue);
 	}
 	else
 	{

Modified: trunk/data/qcsrc/server/cl_weapons.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weapons.qc	2008-10-27 15:16:05 UTC (rev 4917)
+++ trunk/data/qcsrc/server/cl_weapons.qc	2008-10-28 06:49:47 UTC (rev 4918)
@@ -214,7 +214,7 @@
 		return; // just in case
 	if (w == WEP_LASER)
 		return; // just in case
-	if (g_rocketarena)
+	if (g_weaponarena)
 		return;
 	if (g_lms)
 		return;

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2008-10-27 15:16:05 UTC (rev 4917)
+++ trunk/data/qcsrc/server/defs.qh	2008-10-28 06:49:47 UTC (rev 4918)
@@ -19,7 +19,7 @@
 float ctf_score_value(string parameter);
 
 float g_dm, g_domination, g_ctf, g_tdm, g_keyhunt, g_onslaught, g_assault, g_arena, g_lms, g_runematch, g_race;
-float g_cloaked, g_footsteps, g_jump_grunt, g_grappling_hook, g_laserguided_missile, g_midair, g_minstagib, g_nixnex, g_nixnex_with_laser, g_norecoil, g_rocketarena, g_vampire, g_minstagib_invis_alpha;
+float g_cloaked, g_footsteps, g_jump_grunt, g_grappling_hook, g_laserguided_missile, g_midair, g_minstagib, g_nixnex, g_nixnex_with_laser, g_norecoil, g_vampire, g_minstagib_invis_alpha;
 float g_warmup_limit;
 float g_warmup_allguns;
 float g_warmup_allow_timeout;

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2008-10-27 15:16:05 UTC (rev 4917)
+++ trunk/data/qcsrc/server/g_world.qc	2008-10-28 06:49:47 UTC (rev 4918)
@@ -324,8 +324,8 @@
 			s = strcat(s, ":no_pickup_items");
 		if(cvar("g_instagib"))
 			s = strcat(s, ":instagib");
-		if(cvar("g_rocketarena"))
-			s = strcat(s, ":rockerarena");
+		if(cvar_string("g_weaponarena") != "0")
+			s = strcat(s, ":", cvar_string("g_weaponarena"), " arena");
 		if(cvar("g_nixnex"))
 			s = strcat(s, ":nixnex");
 		if(cvar("g_vampire"))

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2008-10-27 15:16:05 UTC (rev 4917)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2008-10-28 06:49:47 UTC (rev 4918)
@@ -713,6 +713,8 @@
 float g_pickup_healthlarge_max;
 float g_pickup_healthmega;
 float g_pickup_healthmega_max;
+float g_weaponarena;
+string g_weaponarena_list;
 
 float start_weapons;
 float start_items;
@@ -735,7 +737,8 @@
 void readplayerstartcvars()
 {
 	entity e;
-	float i;
+	float i, j, t;
+	string s;
 
   	// initialize starting values for players
 	start_weapons = 0;
@@ -747,17 +750,54 @@
 	start_health = cvar("g_balance_health_start");
 	start_armorvalue = cvar("g_balance_armor_start");
 
-	if(g_rocketarena)
+	g_weaponarena = 0;
+	s = cvar_string("g_weaponarena");
+	if(s != "0")
 	{
-		start_weapons = WEPBIT_ROCKET_LAUNCHER;
-		weapon_action(WEP_ROCKET_LAUNCHER, WR_PRECACHE);
+		t = tokenize_sane(s);
+		g_weaponarena_list = "";
+		for(i = 0; i < t; ++i)
+		{
+			s = argv(i);
+			for(j = WEP_FIRST; j <= WEP_LAST; ++j)
+			{
+				e = get_weaponinfo(j);
+				if(e.netname == s)
+				{
+					g_weaponarena |= e.weapons;
+					weapon_action(e.weapon, WR_PRECACHE);
+					g_weaponarena_list = strcat(g_weaponarena_list, e.message, " & ");
+					break;
+				}
+			}
+			if(j > WEP_LAST)
+			{
+				print("The weapon mutator list contains an unknown weapon ", s, ". Skipped.\n");
+			}
+		}
+		g_weaponarena_list = strzone(substring(g_weaponarena_list, 0, strlen(g_weaponarena_list) - 3));
+	}
+
+	if(g_weaponarena)
+	{
+		start_weapons = g_weaponarena;
 		start_ammo_rockets = 999;
-		start_items |= IT_UNLIMITED_WEAPON_AMMO;
+		start_ammo_shells = 999;
+		start_ammo_cells = 999;
+		start_ammo_nails = 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)
 	{
@@ -814,7 +854,7 @@
 		warmup_start_armorvalue = start_armorvalue;
 		warmup_start_weapons = start_weapons;
 
-		if(!g_rocketarena && !g_nixnex && !g_minstagib)
+		if(!g_weaponarena && !g_nixnex && !g_minstagib)
 		{
 			if(cvar("g_use_ammunition"))
 			{
@@ -864,7 +904,6 @@
 	g_nixnex = cvar("g_nixnex");
 	g_nixnex_with_laser = cvar("g_nixnex_with_laser");
 	g_norecoil = cvar("g_norecoil");
-	g_rocketarena = cvar("g_rocketarena");
 	g_vampire = cvar("g_vampire");
 	sv_maxidle = cvar("sv_maxidle");
 	sv_maxidle_spectatorsareidle = cvar("sv_maxidle_spectatorsareidle");
@@ -886,8 +925,9 @@
 	g_pickup_respawntime_long = cvar("g_pickup_respawntime_long");
 	g_pickup_respawntime_powerup = cvar("g_pickup_respawntime_powerup");
 
-	if(g_minstagib) g_nixnex = g_rocketarena = 0;
-	if(g_nixnex) g_rocketarena = 0;
+	if(g_minstagib) g_nixnex = g_weaponarena = 0;
+	if(g_nixnex) g_weaponarena = 0;
+	g_weaponarena = 0;
 
 	g_pickup_shells                    = cvar("g_pickup_shells");
 	g_pickup_shells_max                = cvar("g_pickup_shells_max");

Modified: trunk/data/qcsrc/server/t_items.qc
===================================================================
--- trunk/data/qcsrc/server/t_items.qc	2008-10-27 15:16:05 UTC (rev 4917)
+++ trunk/data/qcsrc/server/t_items.qc	2008-10-28 06:49:47 UTC (rev 4918)
@@ -445,7 +445,7 @@
 
 		weaponsInMap |= weaponid;
 
-		if(g_lms || g_rocketarena)
+		if(g_lms || g_weaponarena)
 		{
 			startitem_failed = TRUE;
 			remove(self);
@@ -598,7 +598,7 @@
 	var .float ammofield;
 	string s;
 	entity oldself;
-	float i;
+	float i, j;
 
 	// set the respawntime in advance (so replaced weapons can copy it)
 	if(!self.respawntime)
@@ -612,26 +612,63 @@
 
 	if(self.classname != "droppedweapon" && self.classname != "replacedweapon")
 	{
-		s = cvar_string(strcat("g_weaponreplace_", ftos(wpn)));
+		e = get_weaponinfo(wpn);
+		s = cvar_string(strcat("g_weaponreplace_", e.netname));
+		if(s == "0")
+		{
+			remove(self);
+			startitem_failed = TRUE;
+			return;
+		}
 		t = tokenize_sane(s);
 		if(t >= 2)
 		{
 			self.team = --internalteam;
+			oldself = self;
 			for(i = 1; i < t; ++i)
 			{
-				oldself = self;
-				self = spawn();
-				copyentity(oldself, self);
-				self.classname = "replacedweapon";
-				weapon_defaultspawnfunc(stof(argv(i)));
-				self = oldself;
+				s = argv(i);
+				for(j = WEP_FIRST; j <= WEP_LAST; ++j)
+				{
+					e = get_weaponinfo(j);
+					if(e.netname == s)
+					{
+						self = spawn();
+						copyentity(oldself, self);
+						self.classname = "replacedweapon";
+						weapon_defaultspawnfunc(j);
+						break;
+					}
+				}
+				if(j > WEP_LAST)
+				{
+					print("The weapon replace list for ", oldself.classname, " contains an unknown weapon ", s, ". Skipped.\n");
+				}
 			}
+			self = oldself;
 		}
 		if(t >= 1)
-			wpn = stof(argv(0));
+		{
+			s = argv(0);
+			wpn = 0;
+			for(j = WEP_FIRST; j <= WEP_LAST; ++j)
+			{
+				e = get_weaponinfo(j);
+				if(e.netname == s)
+				{
+					wpn = i;
+					break;
+				}
+			}
+			if(j > WEP_LAST)
+			{
+				print("The weapon replace list for ", self.classname, " contains an unknown weapon ", s, ". Skipped.\n");
+			}
+		}
 		if(wpn == 0)
 		{
 			remove(self);
+			startitem_failed = TRUE;
 			return;
 		}
 	}

Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc	2008-10-27 15:16:05 UTC (rev 4917)
+++ trunk/data/qcsrc/server/teamplay.qc	2008-10-28 06:49:47 UTC (rev 4918)
@@ -407,8 +407,8 @@
 :normal
 	if(g_minstagib)
 		mutator = "^2Minstagib ^1";
-	else if(g_rocketarena)
-		mutator = "^2Rocketarena ^1";
+	else if(g_weaponarena)
+		mutator = "^2", g_weaponarena_list, " Arena ^1";
 	else if(g_nixnex)
 		mutator = "^2No Items Nexuiz ^1";
 




More information about the nexuiz-commits mailing list