r2433 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue May 1 04:13:49 EDT 2007


Author: div0
Date: 2007-05-01 04:13:40 -0400 (Tue, 01 May 2007)
New Revision: 2433

Modified:
   trunk/data/qcsrc/server/ctf.qc
   trunk/data/qcsrc/server/domination.qc
   trunk/data/qcsrc/server/g_damage.qc
   trunk/data/qcsrc/server/havocbot_roles.qc
   trunk/data/qcsrc/server/miscfunctions.qc
   trunk/data/qcsrc/server/teamplay.qc
Log:
changed hardcoded team numbers to COLOR_TEAMn. Not tested yet!


Modified: trunk/data/qcsrc/server/ctf.qc
===================================================================
--- trunk/data/qcsrc/server/ctf.qc	2007-04-30 23:38:29 UTC (rev 2432)
+++ trunk/data/qcsrc/server/ctf.qc	2007-05-01 08:13:40 UTC (rev 2433)
@@ -234,7 +234,7 @@
 		other.next_take_time = time + 1;
 	}
 	if (self.cnt == FLAG_BASE)
-	if (other.team == 5 || other.team == 14) // only red and blue team can steal flags
+	if (other.team == COLOR_TEAM1 || other.team == COLOR_TEAM2) // only red and blue team can steal flags
 	if (other.team != self.team)
 	if (!other.flagcarried)
 	{
@@ -268,11 +268,11 @@
 	if (self.cnt == FLAG_DROPPED)
 	{
 		self.flags = FL_ITEM; // clear FL_ONGROUND and any other junk
-		if (other.team == self.team || (other.team != 5 && other.team != 14))
+		if (other.team == self.team || (other.team != COLOR_TEAM1 && other.team != COLOR_TEAM2))
 		{
 			// return flag
 			bprint(other.netname, "^7 returned the ", self.netname, "\n");
-			if (other.team == 5 || other.team == 14)
+			if (other.team == COLOR_TEAM1 || other.team == COLOR_TEAM2)
 				UpdateFrags(other, cvar("g_ctf_flagscore_return"));
 			else
 				UpdateFrags(other, cvar("g_ctf_flagscore_return_rogue"));
@@ -315,7 +315,7 @@
 */
 void() info_player_team1 =
 {
-	self.team = 5; // red
+	self.team = COLOR_TEAM1; // red
 	info_player_deathmatch();
 };
 //self.team = 4;self.classname = "info_player_start";info_player_start();};
@@ -330,7 +330,7 @@
 */
 void() info_player_team2 =
 {
-	self.team = 14; // blue
+	self.team = COLOR_TEAM2; // blue
 	info_player_deathmatch();
 };
 //self.team = 13;self.classname = "info_player_start";info_player_start();};
@@ -345,7 +345,7 @@
 */
 void() info_player_team3 =
 {
-	self.team = 10; // purple
+	self.team = COLOR_TEAM3; // purple
 	info_player_deathmatch();
 };
 
@@ -360,7 +360,7 @@
 */
 void() info_player_team4 =
 {
-	self.team = 13; // yellow
+	self.team = COLOR_TEAM4; // yellow
 	info_player_deathmatch();
 };
 
@@ -400,7 +400,7 @@
 	//	cvar_set("teamplay", "3");
 
 	self.classname = "item_flag_team1";
-	self.team = 5; // color 4 team (red)
+	self.team = COLOR_TEAM1; // color 4 team (red)
 	self.items = IT_KEY2; // gold key (redish enough)
 	self.netname = "^1RED^7 flag";
 	self.target = "###item###";
@@ -456,7 +456,7 @@
 	//	cvar_set("teamplay", "3");
 
 	self.classname = "item_flag_team2";
-	self.team = 14; // color 13 team (blue)
+	self.team = COLOR_TEAM2; // color 13 team (blue)
 	self.items = IT_KEY1; // silver key (bluish enough)
 	self.netname = "^4BLUE^7 flag";
 	self.target = "###item###";
@@ -549,8 +549,8 @@
 
 	numteams = 2;//cvar("g_ctf_default_teams");
 
-	ctf_spawnteam("Red", 4);
-	ctf_spawnteam("Blue", 13);
+	ctf_spawnteam("Red", COLOR_TEAM1 - 1);
+	ctf_spawnteam("Blue", COLOR_TEAM2 - 1);
 };
 
 void() ctf_delayedinit =
@@ -574,8 +574,8 @@
 {
 	if (flag) {
 		local float shift;
-		if (flag.team == 5) shift = IT_RED_FLAG_TAKEN;
-		else if (flag.team == 14) shift = IT_BLUE_FLAG_TAKEN;
+		if (flag.team == COLOR_TEAM1) shift = IT_RED_FLAG_TAKEN;
+		else if (flag.team == COLOR_TEAM2) shift = IT_BLUE_FLAG_TAKEN;
 		else shift = 0;
 
 		local float status;

Modified: trunk/data/qcsrc/server/domination.qc
===================================================================
--- trunk/data/qcsrc/server/domination.qc	2007-04-30 23:38:29 UTC (rev 2432)
+++ trunk/data/qcsrc/server/domination.qc	2007-05-01 08:13:40 UTC (rev 2433)
@@ -544,12 +544,12 @@
 
 	numteams = cvar("g_domination_default_teams");
 	// LordHavoc: edit this if you want to change defaults
-	dom_spawnteam("Red", 4, "models/domination/dom_red.md3", 0, "domination/claim.wav", "", "Red team has captured a control point");
-	dom_spawnteam("Blue", 13, "models/domination/dom_blue.md3", 0, "domination/claim.wav", "", "Blue team has captured a control point");
+	dom_spawnteam("Red", COLOR_TEAM1-1, "models/domination/dom_red.md3", 0, "domination/claim.wav", "", "Red team has captured a control point");
+	dom_spawnteam("Blue", COLOR_TEAM2-1, "models/domination/dom_blue.md3", 0, "domination/claim.wav", "", "Blue team has captured a control point");
 	if(numteams > 2)
-		dom_spawnteam("Pink", 9, "models/domination/dom_pink.md3", 0, "domination/claim.wav", "", "Pink team has captured a control point");
+		dom_spawnteam("Pink", COLOR_TEAM3-1, "models/domination/dom_pink.md3", 0, "domination/claim.wav", "", "Pink team has captured a control point");
 	if(numteams > 3)
-		dom_spawnteam("Yellow", 12, "models/domination/dom_yellow.md3", 0, "domination/claim.wav", "", "Yellow team has captured a control point");
+		dom_spawnteam("Yellow", COLOR_TEAM4-1, "models/domination/dom_yellow.md3", 0, "domination/claim.wav", "", "Yellow team has captured a control point");
 	dom_spawnteam("", 0, "models/domination/dom_unclaimed.md3", 0, "", "", "");
 };
 

Modified: trunk/data/qcsrc/server/g_damage.qc
===================================================================
--- trunk/data/qcsrc/server/g_damage.qc	2007-04-30 23:38:29 UTC (rev 2432)
+++ trunk/data/qcsrc/server/g_damage.qc	2007-05-01 08:13:40 UTC (rev 2433)
@@ -96,7 +96,7 @@
 
 void Obituary (entity attacker, entity targ, float deathtype)
 {
-	string	s, a, m;
+	string	s, a;
 
 	if (targ.classname == "player" || targ.classname == "corpse")
 	{
@@ -110,29 +110,11 @@
 		{
 			if (deathtype == DEATH_TEAMCHANGE)
 			{
-				m = "You are now on: ";
-				if (targ.team == 5)
-					m = strcat(m, "^1Red Team");
-				else if (targ.team == 14)
-					m = strcat(m, "^4Blue Team");
-				else if (targ.team == 10)
-					m = strcat(m, "^6Pink Team");
-				else if (targ.team == 13)
-					m = strcat(m, "^3Yellow Team");
-				centerprint(targ, m);
+				centerprint(targ, strcat("You are now on: ", ColoredTeamName(targ.team)));
 			}
 			else if (deathtype == DEATH_AUTOTEAMCHANGE)
 			{
-				m = "You have been moved into a different team to improve team balance\nYou are now on: ";
-				if (targ.team == 5)
-					m = strcat(m, "^1Red Team");
-				else if (targ.team == 14)
-					m = strcat(m, "^4Blue Team");
-				else if (targ.team == 10)
-					m = strcat(m, "^6Pink Team");
-				else if (targ.team == 13)
-					m = strcat(m, "^3Yellow Team");
-				centerprint(targ, m);
+				centerprint(targ, strcat("You have been moved into a different team to improve team balance\nYou are now on: ", ColoredTeamName(targ.team)));
 				return;
 			}
 			else if (deathtype == DEATH_CAMP)

Modified: trunk/data/qcsrc/server/havocbot_roles.qc
===================================================================
--- trunk/data/qcsrc/server/havocbot_roles.qc	2007-04-30 23:38:29 UTC (rev 2432)
+++ trunk/data/qcsrc/server/havocbot_roles.qc	2007-05-01 08:13:40 UTC (rev 2433)
@@ -126,7 +126,7 @@
 void(float ratingscale) havocbot_goalrating_ctf_ourflag =
 {
 	local entity head;
-	if (self.team == 5) // red
+	if (self.team == COLOR_TEAM1) // red
 		head = find(world, classname, "item_flag_team1"); // red flag
 	else // blue
 		head = find(world, classname, "item_flag_team2"); // blue flag
@@ -136,7 +136,7 @@
 void(float ratingscale) havocbot_goalrating_ctf_enemyflag =
 {
 	local entity head;
-	if (self.team == 5) // red
+	if (self.team == COLOR_TEAM1) // red
 		head = find(world, classname, "item_flag_team2"); // blue flag
 	else // blue
 		head = find(world, classname, "item_flag_team1"); // red flag
@@ -151,7 +151,7 @@
 void(float ratingscale) havocbot_goalrating_ctf_ourstolenflag =
 {
 	local entity head;
-	if (self.team == 5) // red
+	if (self.team == COLOR_TEAM1) // red
 		head = find(world, classname, "item_flag_team1"); // red flag
 	else // blue
 		head = find(world, classname, "item_flag_team2"); // blue flag
@@ -234,7 +234,7 @@
 		return;
 	}
 	// check our flag
-	if (self.team == 5) // red
+	if (self.team == COLOR_TEAM1) // red
 		f = find(world, classname, "item_flag_team1");
 	else // blue
 		f = find(world, classname, "item_flag_team2");
@@ -284,7 +284,7 @@
 		return;
 	}
 	// check our flag
-	if (self.team == 5) // red
+	if (self.team == COLOR_TEAM1) // red
 		f = find(world, classname, "item_flag_team1");
 	else // blue
 		f = find(world, classname, "item_flag_team2");
@@ -325,7 +325,7 @@
 		return;
 	}
 	// check our flag
-	if (self.team == 5) // red
+	if (self.team == COLOR_TEAM1) // red
 		f = find(world, classname, "item_flag_team1");
 	else // blue
 		f = find(world, classname, "item_flag_team2");
@@ -385,7 +385,7 @@
 		return;
 	}
 	// check our flag
-	if (self.team == 5) // red
+	if (self.team == COLOR_TEAM1) // red
 		f = find(world, classname, "item_flag_team1");
 	else // blue
 		f = find(world, classname, "item_flag_team2");
@@ -453,7 +453,7 @@
 {
 	local float r;
 	dprint("choose CTF role...\n");
-	if (self.team == 13)
+	if (self.team == COLOR_TEAM3 || self.team == COLOR_TEAM4)
 		self.havocbot_role = havocbot_role_ctf_rogue;
 	else
 	{

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2007-04-30 23:38:29 UTC (rev 2432)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2007-05-01 08:13:40 UTC (rev 2433)
@@ -1,4 +1,5 @@
 void() info_player_deathmatch; // needed for the other spawnpoints
+string ColoredTeamName(float t);
 
 void move_out_of_solid_expand(entity e, vector by)
 {

Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc	2007-04-30 23:38:29 UTC (rev 2432)
+++ trunk/data/qcsrc/server/teamplay.qc	2007-05-01 08:13:40 UTC (rev 2433)
@@ -968,7 +968,6 @@
 	float smallestteam, smallestteam_count, steam;
 	float lowest_bot_score, lowest_player_score;
 	entity head, lowest_bot, lowest_player, selected;
-	string m;
 
 	smallestteam = 0;
 	smallestteam_count = 999999999;
@@ -1101,17 +1100,8 @@
 	SetPlayerTeam(selected, smallestteam, source_team, FALSE);
 
 	if(selected.deadflag == DEAD_NO)
-			Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE, selected.origin, '0 0 0');
-	m = "You have been moved into a different team to improve team balance\nYou are now on: ";
-	if (selected.team == 5)
-		m = strcat(m, "^1Red Team");
-	else if (selected.team == 14)
-		m = strcat(m, "^4Blue Team");
-	else if (selected.team == 10)
-		m = strcat(m, "^6Pink Team");
-	else if (selected.team == 13)
-		m = strcat(m, "^3Yellow Team");
-	centerprint(selected, m);
+		Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE, selected.origin, '0 0 0');
+	centerprint(selected, strcat("You have been moved into a different team to improve team balance\nYou are now on: ", ColoredTeamName(selected.team)));
 }
 
 float lastRebalanceInfo;
@@ -1262,8 +1252,8 @@
 
 	numteams = cvar("g_tdm_teams");
 
-	tdm_spawnteam("Red", 4);
-	tdm_spawnteam("Blue", 13);
+	tdm_spawnteam("Red", COLOR_TEAM1-1);
+	tdm_spawnteam("Blue", COLOR_TEAM2-1);
 };
 
 void() tdm_delayedinit =




More information about the nexuiz-commits mailing list