From 4f7b440a76d348e4e31ac5211a833847e60bf049 Mon Sep 17 00:00:00 2001
From: Samual Lenks <samual@xonotic.org>
Date: Mon, 1 Oct 2012 23:22:25 -0400
Subject: [PATCH] Create separate file for common team functions/declarations

---
 qcsrc/client/Main.qc                        |  14 +--
 qcsrc/client/View.qc                        |   2 +-
 qcsrc/client/csqcmodel_hooks.qc             |   2 +-
 qcsrc/client/hook.qc                        |   8 +-
 qcsrc/client/hud.qc                         |  40 +++----
 qcsrc/client/main.qh                        |  10 --
 qcsrc/client/miscfunctions.qc               |  16 +--
 qcsrc/client/progs.src                      |   1 +
 qcsrc/client/scoreboard.qc                  |  22 ++--
 qcsrc/client/shownames.qc                   |   2 +-
 qcsrc/client/teamplay.qc                    |  38 +++----
 qcsrc/client/tturrets.qc                    |   8 +-
 qcsrc/client/waypointsprites.qc             |   2 +-
 qcsrc/common/notifications.qc               |  25 ++---
 qcsrc/server/arena.qc                       |  24 ++---
 qcsrc/server/assault.qc                     |  32 +++---
 qcsrc/server/attic/ctf.qc                   |  48 ++++-----
 qcsrc/server/attic/nexball.qc               |  16 +--
 qcsrc/server/bot/bot.qc                     |  16 +--
 qcsrc/server/bot/havocbot/role_onslaught.qc |   4 +-
 qcsrc/server/cl_client.qc                   |  26 ++---
 qcsrc/server/cl_player.qc                   |   2 +-
 qcsrc/server/command/cmd.qc                 |   8 +-
 qcsrc/server/command/sv_cmd.qc              |  14 +--
 qcsrc/server/constants.qh                   |   9 +-
 qcsrc/server/domination.qc                  |  24 ++---
 qcsrc/server/g_damage.qc                    |   4 +-
 qcsrc/server/g_world.qc                     |  62 +++++------
 qcsrc/server/miscfunctions.qc               |  79 --------------
 qcsrc/server/mutators/gamemode_ctf.qc       |  20 ++--
 qcsrc/server/mutators/gamemode_ctf.qh       |   2 +-
 qcsrc/server/mutators/gamemode_freezetag.qc |  22 ++--
 qcsrc/server/mutators/gamemode_keyhunt.qc   |  24 ++---
 qcsrc/server/mutators/gamemode_nexball.qc   |  16 +--
 qcsrc/server/mutators/gamemode_onslaught.qc | 112 ++++++++++----------
 qcsrc/server/mutators/mutator_superspec.qc  |   4 +-
 qcsrc/server/progs.src                      |   1 +
 qcsrc/server/scores.qc                      |   8 +-
 qcsrc/server/teamplay.qc                    |  96 ++++++++---------
 qcsrc/server/w_minstanex.qc                 |   8 +-
 qcsrc/server/w_tuba.qc                      |   2 +-
 41 files changed, 378 insertions(+), 495 deletions(-)

diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc
index 368ff47852..87d278a718 100644
--- a/qcsrc/client/Main.qc
+++ b/qcsrc/client/Main.qc
@@ -149,7 +149,7 @@ void CSQC_Init(void)
 	teams = Sort_Spawn();
 	players = Sort_Spawn();
 
-	GetTeam(COLOR_SPECTATOR, true); // add specs first
+	GetTeam(FL_SPECTATOR, true); // add specs first
 
 	// needs to be done so early because of the constants they create
 	CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
@@ -261,16 +261,16 @@ float SetTeam(entity o, float Team)
 		switch(Team)
 		{
 			case -1:
-			case COLOR_TEAM1:
-			case COLOR_TEAM2:
-			case COLOR_TEAM3:
-			case COLOR_TEAM4:
+			case FL_TEAM_1:
+			case FL_TEAM_2:
+			case FL_TEAM_3:
+			case FL_TEAM_4:
 				break;
 			default:
 				if(GetTeam(Team, false) == world)
 				{
 					print(sprintf(_("trying to switch to unsupported team %d\n"), Team));
-					Team = COLOR_SPECTATOR;
+					Team = FL_SPECTATOR;
 				}
 				break;
 		}
@@ -286,7 +286,7 @@ float SetTeam(entity o, float Team)
 				if(GetTeam(Team, false) == world)
 				{
 					print(sprintf(_("trying to switch to unsupported team %d\n"), Team));
-					Team = COLOR_SPECTATOR;
+					Team = FL_SPECTATOR;
 				}
 				break;
 		}
diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc
index 46d116cbd7..2380e941f6 100644
--- a/qcsrc/client/View.qc
+++ b/qcsrc/client/View.qc
@@ -240,7 +240,7 @@ float EnemyHitCheck()
 	if(teamplay)
 		if(t == myteam)
 			return SHOTTYPE_HITTEAM;
-	if(t == COLOR_SPECTATOR)
+	if(t == FL_SPECTATOR)
 		return SHOTTYPE_HITWORLD;
 	return SHOTTYPE_HITENEMY;
 }
diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc
index 9c87d13add..e7988cb5ad 100644
--- a/qcsrc/client/csqcmodel_hooks.qc
+++ b/qcsrc/client/csqcmodel_hooks.qc
@@ -218,7 +218,7 @@ void CSQCPlayer_ForceModel_Apply(float islocalplayer)
 		entity tm;
 
 		for(tm = teams.sort_next; tm; tm = tm.sort_next)
-			if(tm.team != COLOR_SPECTATOR)
+			if(tm.team != FL_SPECTATOR)
 				++teams_count;
 
 		if(autocvar_cl_forcemyplayercolors)
diff --git a/qcsrc/client/hook.qc b/qcsrc/client/hook.qc
index 641d50d634..609a06bbca 100644
--- a/qcsrc/client/hook.qc
+++ b/qcsrc/client/hook.qc
@@ -129,22 +129,22 @@ void Draw_GrapplingHook()
 		case ENT_CLIENT_HOOK:
 			intensity = 1;
 			offset = 0;
-			if(t == COLOR_TEAM1)
+			if(t == FL_TEAM_1)
 			{
 				tex = "particles/hook_red";
 				rgb = '1 .3 .3';
 			}
-			else if(t == COLOR_TEAM2)
+			else if(t == FL_TEAM_2)
 			{
 				tex = "particles/hook_blue";
 				rgb = '.3 .3 1';
 			}
-			else if(t == COLOR_TEAM3)
+			else if(t == FL_TEAM_3)
 			{
 				tex = "particles/hook_yellow";
 				rgb = '1 1 .3';
 			}
-			else if(t == COLOR_TEAM4)
+			else if(t == FL_TEAM_4)
 			{
 				tex = "particles/hook_pink";
 				rgb = '1 .3 1';
diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc
index 4ceae02028..60bfec04b4 100644
--- a/qcsrc/client/hud.qc
+++ b/qcsrc/client/hud.qc
@@ -2451,7 +2451,7 @@ void HUD_Radar(void)
 	for(tm = world; (tm = find(tm, classname, "entcs_receiver")); )
 	{
 		color2 = GetPlayerColor(tm.sv_entnum);
-		//if(color == COLOR_SPECTATOR || color == color2)
+		//if(color == FL_SPECTATOR || color == color2)
 			draw_teamradar_player(tm.origin, tm.angles, GetTeamRGB(color2));
 	}
 	draw_teamradar_player(view_origin, view_angles, '1 1 1');
@@ -2534,7 +2534,7 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count)
 		// show team scores in the first line
 		float score_size = mySize_x / team_count;
 		for(tm = teams.sort_next; tm; tm = tm.sort_next) {
-			if(tm.team == COLOR_SPECTATOR)
+			if(tm.team == FL_SPECTATOR)
 				continue;
 			if (tm.team == myteam)
 				drawfill(pos + eX * score_size * i, eX * score_size + eY * fontsize_y, '1 1 1', highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
@@ -2550,14 +2550,14 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count)
 	do
 	for (pl = players.sort_next; pl && i<entries; pl = pl.sort_next)
 	{
-		if ((team_count && pl.team != tm.team) || pl.team == COLOR_SPECTATOR)
+		if ((team_count && pl.team != tm.team) || pl.team == FL_SPECTATOR)
 			continue;
 
 		if (i == entries-1 && !me_printed && pl != me)
 		if (autocvar_hud_panel_score_rankings == 1 && spectatee_status != -1)
 		{
 			for (pl = me.sort_next; pl; pl = pl.sort_next)
-				if (pl.team != COLOR_SPECTATOR)
+				if (pl.team != FL_SPECTATOR)
 					break;
 
 			if (pl)
@@ -2582,7 +2582,7 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count)
 		pos_y += fontsize_y;
 		++i;
 	}
-	while (i<entries && team_count && (tm = tm.sort_next) && (tm.team != COLOR_SPECTATOR || (tm = tm.sort_next)));
+	while (i<entries && team_count && (tm = tm.sort_next) && (tm.team != FL_SPECTATOR || (tm = tm.sort_next)));
 }
 
 void HUD_Score(void)
@@ -2703,7 +2703,7 @@ void HUD_Score(void)
 		vector score_pos, score_size; //for scores other than myteam
 		if (spectatee_status == -1 || autocvar_hud_panel_score_rankings)
 		{
-			for(tm = teams.sort_next; tm, tm.team != COLOR_SPECTATOR; tm = tm.sort_next)
+			for(tm = teams.sort_next; tm, tm.team != FL_SPECTATOR; tm = tm.sort_next)
 				++scores_count;
 			if (autocvar_hud_panel_score_rankings)
 			{
@@ -2741,7 +2741,7 @@ void HUD_Score(void)
 		max_fragcount = -99;
 		draw_beginBoldFont();
 		for(tm = teams.sort_next; tm; tm = tm.sort_next) {
-			if(tm.team == COLOR_SPECTATOR)
+			if(tm.team == FL_SPECTATOR)
 				continue;
 			score = tm.(teamscores[ts_primary]);
 			if(autocvar__hud_configure)
@@ -3184,7 +3184,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
 		case 2: red_icon = "flag_red_lost"; break;
 		case 3: red_icon = "flag_red_carrying"; red_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;
 		default:
-			if((stat_items & IT_CTF_SHIELDED) && (myteam == COLOR_TEAM2))
+			if((stat_items & IT_CTF_SHIELDED) && (myteam == FL_TEAM_2))
 				red_icon = "flag_red_shielded";
 			else
 				red_icon = string_null;
@@ -3197,7 +3197,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
 		default:
 			if(redflag == 3)
 				red_icon_prevstatus = "flag_red_carrying"; // make it more visible
-			else if((stat_items & IT_CTF_SHIELDED) && (myteam == COLOR_TEAM2))
+			else if((stat_items & IT_CTF_SHIELDED) && (myteam == FL_TEAM_2))
 				red_icon_prevstatus = "flag_red_shielded";
 			else
 				red_icon_prevstatus = string_null;
@@ -3212,7 +3212,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
 		case 2: blue_icon = "flag_blue_lost"; break;
 		case 3: blue_icon = "flag_blue_carrying"; blue_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;
 		default:
-			if((stat_items & IT_CTF_SHIELDED) && (myteam == COLOR_TEAM1))
+			if((stat_items & IT_CTF_SHIELDED) && (myteam == FL_TEAM_1))
 				blue_icon = "flag_blue_shielded";
 			else
 				blue_icon = string_null;
@@ -3225,7 +3225,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
 		default:
 			if(blueflag == 3)
 				blue_icon_prevstatus = "flag_blue_carrying"; // make it more visible
-			else if((stat_items & IT_CTF_SHIELDED) && (myteam == COLOR_TEAM1))
+			else if((stat_items & IT_CTF_SHIELDED) && (myteam == FL_TEAM_1))
 				blue_icon_prevstatus = "flag_blue_shielded";
 			else
 				blue_icon_prevstatus = string_null;
@@ -3233,7 +3233,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
 	}
 
 	if(mySize_x > mySize_y) {
-		if (myteam == COLOR_TEAM1) { // always draw own flag on left
+		if (myteam == FL_TEAM_1) { // always draw own flag on left
 			redflag_pos = pos;
 			blueflag_pos = pos + eX * 0.5 * mySize_x;
 		} else {
@@ -3242,7 +3242,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
 		}
 		flag_size = eX * 0.5 * mySize_x + eY * mySize_y;
 	} else {
-		if (myteam == COLOR_TEAM1) { // always draw own flag on left
+		if (myteam == FL_TEAM_1) { // always draw own flag on left
 			redflag_pos = pos;
 			blueflag_pos = pos + eY * 0.5 * mySize_y;
 		} else {
@@ -3356,16 +3356,16 @@ void HUD_Mod_KH(vector pos, vector mySize)
 		{
 			switch(keyteam)
 			{
-				case COLOR_TEAM1:
+				case FL_TEAM_1:
 					drawpic_aspect_skin(pa, "kh_redarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% theAlpha key
 					break;
-				case COLOR_TEAM2:
+				case FL_TEAM_2:
 					drawpic_aspect_skin(pa, "kh_bluearrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% theAlpha key
 					break;
-				case COLOR_TEAM3:
+				case FL_TEAM_3:
 					drawpic_aspect_skin(pa, "kh_yellowarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% theAlpha key
 					break;
-				case COLOR_TEAM4:
+				case FL_TEAM_4:
 					drawpic_aspect_skin(pa, "kh_pinkarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% theAlpha key
 					break;
 				default:
@@ -3703,7 +3703,7 @@ void HUD_Mod_Dom(vector myPos, vector mySize)
 	entity tm;
 	float teams_count;
 	for(tm = teams.sort_next; tm; tm = tm.sort_next)
-		if(tm.team != COLOR_SPECTATOR)
+		if(tm.team != FL_SPECTATOR)
 			++teams_count;
 
 	float layout = autocvar_hud_panel_modicons_dom_layout;
@@ -4162,7 +4162,7 @@ void HUD_InfoMessages(void)
 			{
 				for(; tm.sort_next; tm = tm.sort_next)
 				{
-					if(!tm.team_size || tm.team == COLOR_SPECTATOR)
+					if(!tm.team_size || tm.team == FL_SPECTATOR)
 						continue;
 					if(!ts_min) ts_min = tm.team_size;
 					else ts_min = min(ts_min, tm.team_size);
@@ -4174,7 +4174,7 @@ void HUD_InfoMessages(void)
 					s = strcat(blinkcolor, _("Teamnumbers are unbalanced!"));
 					tm = GetTeam(myteam, false);
 					if (tm)
-					if (tm.team != COLOR_SPECTATOR)
+					if (tm.team != FL_SPECTATOR)
 					if (tm.team_size == ts_max)
 						s = strcat(s, sprintf(_(" Press ^3%s%s to adjust"), getcommandkey("team menu", "menu_showteamselect"), blinkcolor));
 					drawInfoMessage(s)
diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh
index 43e7b64995..474e919f42 100644
--- a/qcsrc/client/main.qh
+++ b/qcsrc/client/main.qh
@@ -40,16 +40,6 @@ float gametype;
 //.float ctf_state;
 //.float health;
 
-// Constants
-const float COLOR_TEAM_RED = 64;
-const float COLOR_TEAM_BLUE = 208;
-
-const float COLOR_TEAM1       = 4;  // red
-const float COLOR_TEAM2       = 13; // blue
-const float COLOR_TEAM3       = 12; // yellow
-const float COLOR_TEAM4       = 9; // pink
-const float COLOR_SPECTATOR = 1337;
-
 #define FONT_DEFAULT 0
 #define FONT_USER 8
 
diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc
index 72bb9c5c40..ff43b29d20 100644
--- a/qcsrc/client/miscfunctions.qc
+++ b/qcsrc/client/miscfunctions.qc
@@ -110,7 +110,7 @@ entity GetTeam(float Team, float add)
 {
 	float num;
 	entity tm;
-	num = (Team == COLOR_SPECTATOR) ? 16 : Team;
+	num = (Team == FL_SPECTATOR) ? 16 : Team;
 	if(teamslots[num])
 		return teamslots[num];
 	if not(add)
@@ -166,20 +166,6 @@ string ColorTranslateRGB(string s)
 		return s;
 }
 
-string Team_ColorCode(float teamid)
-{
-    if (teamid == COLOR_TEAM1)
-        return "^1";
-    else if (teamid == COLOR_TEAM2)
-        return "^4";
-    else if (teamid == COLOR_TEAM3)
-        return "^3";
-    else if (teamid == COLOR_TEAM4)
-        return "^6";
-    else
-        return "^7";
-}
-
 // decolorizes and team colors the player name when needed
 string playername(string thename, float teamid)
 {
diff --git a/qcsrc/client/progs.src b/qcsrc/client/progs.src
index 4e7aca7f63..7ea864d5d0 100644
--- a/qcsrc/client/progs.src
+++ b/qcsrc/client/progs.src
@@ -14,6 +14,7 @@ Defs.qc
 ../warpzonelib/common.qh
 ../warpzonelib/client.qh
 
+../common/teams.qh
 ../common/util.qh
 ../common/items.qh
 ../common/deathtypes.qh
diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc
index 48a7217fc7..417f97e0df 100644
--- a/qcsrc/client/scoreboard.qc
+++ b/qcsrc/client/scoreboard.qc
@@ -136,16 +136,16 @@ float HUD_ComparePlayerScores(entity left, entity right)
 	vr = GetPlayerColor(right.sv_entnum);
 
 	if(!left.gotscores)
-		vl = COLOR_SPECTATOR;
+		vl = FL_SPECTATOR;
 	if(!right.gotscores)
-		vr = COLOR_SPECTATOR;
+		vr = FL_SPECTATOR;
 
 	if(vl > vr)
 		return true;
 	if(vl < vr)
 		return false;
 
-	if(vl == COLOR_SPECTATOR)
+	if(vl == FL_SPECTATOR)
 	{
 		// FIRST the one with scores (spectators), THEN the ones without (downloaders)
 		// no other sorting
@@ -201,9 +201,9 @@ float HUD_CompareTeamScores(entity left, entity right)
 {
 	float vl, vr;
 
-	if(left.team == COLOR_SPECTATOR)
+	if(left.team == FL_SPECTATOR)
 		return 1;
-	if(right.team == COLOR_SPECTATOR)
+	if(right.team == FL_SPECTATOR)
 		return 0;
 
 	vl = left.teamscores[ts_primary];
@@ -663,7 +663,7 @@ void HUD_PrintScoreboardItem(vector pos, entity pl, float is_self, float pl_numb
 	string str;
 	float i, field;
 	float is_spec;
-	is_spec = (GetPlayerColor(pl.sv_entnum) == COLOR_SPECTATOR);
+	is_spec = (GetPlayerColor(pl.sv_entnum) == FL_SPECTATOR);
 
 	if((rgb == '1 1 1') && (!is_spec)) {
 		rgb_x = autocvar_scoreboard_color_bg_r + 0.5;
@@ -907,7 +907,7 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
 	else
 		for(pl = players.sort_next; pl; pl = pl.sort_next)
 		{
-			if(pl.team == COLOR_SPECTATOR)
+			if(pl.team == FL_SPECTATOR)
 				continue;
 			HUD_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localnum), i);
 			pos_y += 1.25 * hud_fontsize_y;
@@ -1124,7 +1124,7 @@ vector HUD_DrawScoreboardRankings(vector pos, entity pl,  vector rgb, vector bg_
 		return pos;
 
 	float is_spec;
-	is_spec = (GetPlayerColor(pl.sv_entnum) == COLOR_SPECTATOR);
+	is_spec = (GetPlayerColor(pl.sv_entnum) == FL_SPECTATOR);
 	vector hl_rgb;
 	hl_rgb_x = autocvar_scoreboard_color_bg_r + 0.5;
 	hl_rgb_y = autocvar_scoreboard_color_bg_g + 0.5;
@@ -1241,7 +1241,7 @@ void HUD_DrawScoreboard()
 		team_score_baseoffset = eY * (2 * autocvar_scoreboard_border_thickness + hud_fontsize_y) - eX * (autocvar_scoreboard_border_thickness + hud_fontsize_x * 0.25);
 		for(tm = teams.sort_next; tm; tm = tm.sort_next)
 		{
-			if(tm.team == COLOR_SPECTATOR)
+			if(tm.team == FL_SPECTATOR)
 				continue;
 
 			draw_beginBoldFont();
@@ -1267,7 +1267,7 @@ void HUD_DrawScoreboard()
 
 		for(tm = teams.sort_next; tm; tm = tm.sort_next)
 		{
-			if(tm.team == COLOR_SPECTATOR)
+			if(tm.team == FL_SPECTATOR)
 				continue;
 
 			pos = HUD_Scoreboard_MakeTable(pos, tm, rgb, bg_size);
@@ -1304,7 +1304,7 @@ void HUD_DrawScoreboard()
 	tmp = pos;
 	for(pl = players.sort_next; pl; pl = pl.sort_next)
 	{
-		if(pl.team != COLOR_SPECTATOR)
+		if(pl.team != FL_SPECTATOR)
 			continue;
 		pos_y += 1.25 * hud_fontsize_y;
 		HUD_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localnum), specs);
diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc
index 5309c555e6..3d404b5e41 100644
--- a/qcsrc/client/shownames.qc
+++ b/qcsrc/client/shownames.qc
@@ -187,7 +187,7 @@ void Draw_ShowNames_All()
 	{
 		float t;
 		t = GetPlayerColor(i);
-		if(t == COLOR_SPECTATOR)
+		if(t == FL_SPECTATOR)
 			continue;
 
 		entity e;
diff --git a/qcsrc/client/teamplay.qc b/qcsrc/client/teamplay.qc
index 80d89318f4..058b699ba1 100644
--- a/qcsrc/client/teamplay.qc
+++ b/qcsrc/client/teamplay.qc
@@ -2,10 +2,10 @@ float TeamByColor(float color)
 {
 	switch(color)
 	{
-	case COLOR_TEAM1: return 0;
-	case COLOR_TEAM2: return 1;
-	case COLOR_TEAM3: return 2;
-	case COLOR_TEAM4: return 3;
+	case FL_TEAM_1: return 0;
+	case FL_TEAM_2: return 1;
+	case FL_TEAM_3: return 2;
+	case FL_TEAM_4: return 3;
 	default: return 0;
 	}
 }
@@ -13,11 +13,11 @@ float ColorByTeam(float i)
 {
 	switch(i)
 	{
-	case 0: return COLOR_TEAM1;
-	case 1: return COLOR_TEAM2;
-	case 2: return COLOR_TEAM3;
-	case 3: return COLOR_TEAM4;
-	default: return COLOR_TEAM1;
+	case 0: return FL_TEAM_1;
+	case 1: return FL_TEAM_2;
+	case 2: return FL_TEAM_3;
+	case 3: return FL_TEAM_4;
+	default: return FL_TEAM_1;
 	}
 }
 
@@ -32,9 +32,9 @@ float GetPlayerColorForce(float i)
 float GetPlayerColor(float i)
 {
 	if not(playerslots[i].gotscores) // unconnected
-		return COLOR_SPECTATOR;
+		return FL_SPECTATOR;
 	else if(stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR)
-		return COLOR_SPECTATOR;
+		return FL_SPECTATOR;
 	else
 		return GetPlayerColorForce(i);
 }
@@ -49,10 +49,10 @@ vector GetTeamRGB(float color)
 	switch(color)
 	{
 	default: return '1 1 1';
-	case COLOR_TEAM1: return '1 0 0'; // red
-	case COLOR_TEAM2: return '0 0 1'; // blue
-	case COLOR_TEAM3: return '1 1 0'; // yellow
-	case COLOR_TEAM4: return '1 0 1'; // pink
+	case FL_TEAM_1: return '1 0 0'; // red
+	case FL_TEAM_2: return '0 0 1'; // blue
+	case FL_TEAM_3: return '1 1 0'; // yellow
+	case FL_TEAM_4: return '1 0 1'; // pink
 	}
 }
 
@@ -61,9 +61,9 @@ string GetTeamName(float color)
 	switch(color)
 	{
 	default: return _("Spectators");
-	case COLOR_TEAM1: return _("Red Team");
-	case COLOR_TEAM2: return _("Blue Team");
-	case COLOR_TEAM3: return _("Yellow Team");
-	case COLOR_TEAM4: return _("Pink Team");
+	case FL_TEAM_1: return _("Red Team");
+	case FL_TEAM_2: return _("Blue Team");
+	case FL_TEAM_3: return _("Yellow Team");
+	case FL_TEAM_4: return _("Pink Team");
 	}
 }
diff --git a/qcsrc/client/tturrets.qc b/qcsrc/client/tturrets.qc
index 272a246102..01553891f1 100644
--- a/qcsrc/client/tturrets.qc
+++ b/qcsrc/client/tturrets.qc
@@ -163,22 +163,22 @@ void turret_changeteam()
 { 	
 	switch(self.team - 1)
 	{
-        case COLOR_TEAM1: // Red
+        case FL_TEAM_1: // Red
             self.glowmod = '2 0 0';
             self.teamradar_color = '1 0 0';
             break;
 
-        case COLOR_TEAM2: // Blue
+        case FL_TEAM_2: // Blue
             self.glowmod = '0 0 2';
             self.teamradar_color = '0 0 1';
             break;
 
-        case COLOR_TEAM3: // Yellow
+        case FL_TEAM_3: // Yellow
             self.glowmod = '1 1 0';
             self.teamradar_color = '1 1 0';
             break;
 
-        case COLOR_TEAM4: // Pink
+        case FL_TEAM_4: // Pink
             self.glowmod = '1 0 1';
             self.teamradar_color = '1 0 1';
             break;
diff --git a/qcsrc/client/waypointsprites.qc b/qcsrc/client/waypointsprites.qc
index d3d57aba9e..9cac6bf6eb 100644
--- a/qcsrc/client/waypointsprites.qc
+++ b/qcsrc/client/waypointsprites.qc
@@ -423,7 +423,7 @@ void Draw_WaypointSprite()
 				spriteimage = self.netname;
 			break;
 		case SPRITERULE_TEAMPLAY:
-			if(t == COLOR_SPECTATOR + 1)
+			if(t == FL_SPECTATOR + 1)
 				spriteimage = self.netname3;
 			else if(self.team == t)
 				spriteimage = self.netname2;
diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc
index e8491da845..caca75999c 100644
--- a/qcsrc/common/notifications.qc
+++ b/qcsrc/common/notifications.qc
@@ -36,15 +36,6 @@ var float autocvar_notification_ctf_pickup_enemy_verbose = TRUE;
 #define ADD_CSQC_AUTOCVAR(name)
 #endif
 
-string team_name_red = _("Red");
-string team_name_blue = _("Blue");
-string team_name_yellow = _("Yellow");
-string team_name_pink = _("Pink");
-string team_color_red = "^1";
-string team_color_blue = "^4";
-string team_color_yellow = "";
-string team_color_pink = "";
-
 
 // ====================================
 //  Notifications List and Information
@@ -89,13 +80,13 @@ string team_color_pink = "";
 // weaponorder[f1].netname
 
 #define MULTITEAM_INFO(prefix,teams,strnum,flnum,args,hudargs,icon,normal,gentle) \
-	MSG_INFO_NOTIF(prefix##RED, strnum, flnum, args, hudargs, sprintf(icon, strtolower(team_name_red)), TCR(normal, team_color_red, strtoupper(team_name_red)), TCR(gentle, team_color_red, strtoupper(team_name_red))) \
-	MSG_INFO_NOTIF(prefix##BLUE, strnum, flnum, args, hudargs, sprintf(icon, strtolower(team_name_blue)), TCR(normal, team_color_blue, strtoupper(team_name_blue)), TCR(gentle, team_color_blue, strtoupper(team_name_blue))) \
+	MSG_INFO_NOTIF(prefix##RED, strnum, flnum, args, hudargs, sprintf(icon, strtolower(STR_TEAM_1)), TCR(normal, COL_TEAM_1, strtoupper(STR_TEAM_1)), TCR(gentle, COL_TEAM_1, strtoupper(STR_TEAM_1))) \
+	MSG_INFO_NOTIF(prefix##BLUE, strnum, flnum, args, hudargs, sprintf(icon, strtolower(STR_TEAM_2)), TCR(normal, COL_TEAM_2, strtoupper(STR_TEAM_2)), TCR(gentle, COL_TEAM_2, strtoupper(STR_TEAM_2))) \
 	#if teams >= 3 \
-		MSG_INFO_NOTIF(prefix##YELLOW, strnum, flnum, args, hudargs, sprintf(icon, strtolower(team_name_yellow)), TCR(normal, team_color_yellow, strtoupper(team_name_yellow)), TCR(gentle, team_color_yellow, strtoupper(team_name_yellow))) \
+		MSG_INFO_NOTIF(prefix##YELLOW, strnum, flnum, args, hudargs, sprintf(icon, strtolower(STR_TEAM_3)), TCR(normal, COL_TEAM_3, strtoupper(STR_TEAM_3)), TCR(gentle, COL_TEAM_3, strtoupper(STR_TEAM_3))) \
 	#endif \
 	#if teams >= 4 \
-		MSG_INFO_NOTIF(prefix##PINK, strnum, flnum, args, hudargs, sprintf(icon, strtolower(team_name_pink)), TCR(normal, team_color_pink, strtoupper(team_name_pink)), TCR(gentle, team_color_pink, strtoupper(team_name_pink))) \
+		MSG_INFO_NOTIF(prefix##PINK, strnum, flnum, args, hudargs, sprintf(icon, strtolower(STR_TEAM_4)), TCR(normal, COL_TEAM_4, strtoupper(STR_TEAM_4)), TCR(gentle, COL_TEAM_4, strtoupper(STR_TEAM_4))) \
 	#endif
 #define MSG_INFO_NOTIFICATIONS \
 	MSG_INFO_NOTIF(INFO_EMPTY,							0, 0, NO_STR_ARG, XPND2("", ""),					"", "", "") \
@@ -116,13 +107,13 @@ string team_color_pink = "";
 	#undef MSG_INFO_NOTIF
 
 #define MULTITEAM_CENTER(prefix,teams,strnum,flnum,args,cpid,durcnt,normal,gentle) \
-	MSG_CENTER_NOTIF(prefix##RED, strnum, flnum, args, cpid, durcnt, TCR(normal, team_color_red, strtoupper(team_name_red)), TCR(gentle, team_color_red, strtoupper(team_name_red))) \
-	MSG_CENTER_NOTIF(prefix##BLUE, strnum, flnum, args, cpid, durcnt, TCR(normal, team_color_blue, strtoupper(team_name_blue)), TCR(gentle, team_color_blue, strtoupper(team_name_blue))) \
+	MSG_CENTER_NOTIF(prefix##RED, strnum, flnum, args, cpid, durcnt, TCR(normal, COL_TEAM_1, strtoupper(STR_TEAM_1)), TCR(gentle, COL_TEAM_1, strtoupper(STR_TEAM_1))) \
+	MSG_CENTER_NOTIF(prefix##BLUE, strnum, flnum, args, cpid, durcnt, TCR(normal, COL_TEAM_2, strtoupper(STR_TEAM_2)), TCR(gentle, COL_TEAM_2, strtoupper(STR_TEAM_2))) \
 	#if teams >= 3 \
-		MSG_CENTER_NOTIF(prefix##YELLOW, strnum, flnum, args, cpid, durcnt, TCR(normal, team_color_yellow, strtoupper(team_name_yellow)), TCR(gentle, team_color_yellow, strtoupper(team_name_yellow))) \
+		MSG_CENTER_NOTIF(prefix##YELLOW, strnum, flnum, args, cpid, durcnt, TCR(normal, COL_TEAM_3, strtoupper(STR_TEAM_3)), TCR(gentle, COL_TEAM_3, strtoupper(STR_TEAM_3))) \
 	#endif \
 	#if teams >= 4 \
-		MSG_CENTER_NOTIF(prefix##PINK, strnum, flnum, args, cpid, durcnt, TCR(normal, team_color_pink, strtoupper(team_name_pink)), TCR(gentle, team_color_pink, strtoupper(team_name_pink))) \
+		MSG_CENTER_NOTIF(prefix##PINK, strnum, flnum, args, cpid, durcnt, TCR(normal, COL_TEAM_4, strtoupper(STR_TEAM_4)), TCR(gentle, COL_TEAM_4, strtoupper(STR_TEAM_4))) \
 	#endif
 #define MSG_CENTER_NOTIFICATIONS \
 	MSG_CENTER_NOTIF(CENTER_EMPTY,							0, 0, NO_STR_ARG,				NO_CPID,				XPND2(0, 0), "", "") \
diff --git a/qcsrc/server/arena.qc b/qcsrc/server/arena.qc
index ef81fd92ba..bb52a4ae25 100644
--- a/qcsrc/server/arena.qc
+++ b/qcsrc/server/arena.qc
@@ -293,22 +293,22 @@ void count_players()
 	// count amount of players in each team
 	total_players = red_players = blue_players = yellow_players = pink_players = 0;
 	FOR_EACH_PLAYER(self) {
-		if (self.team == COLOR_TEAM1)
+		if (self.team == FL_TEAM_1)
 		{
 			red_players += 1;
 			total_players += 1;
 		}
-		else if (self.team == COLOR_TEAM2)
+		else if (self.team == FL_TEAM_2)
 		{
 			blue_players += 1;
 			total_players += 1;
 		}
-		else if (self.team == COLOR_TEAM3)
+		else if (self.team == FL_TEAM_3)
 		{
 			yellow_players += 1;
 			total_players += 1;
 		}
-		else if (self.team == COLOR_TEAM4)
+		else if (self.team == FL_TEAM_4)
 		{
 			pink_players += 1;
 			total_players += 1;
@@ -322,12 +322,12 @@ void count_alive_players()
 	if(g_ca)
 	{
 		FOR_EACH_PLAYER(self) {
-			if (self.team == COLOR_TEAM1 && self.health >= 1)
+			if (self.team == FL_TEAM_1 && self.health >= 1)
 			{
 				redalive += 1;
 				totalalive += 1;
 			}
-			else if (self.team == COLOR_TEAM2 && self.health >= 1)
+			else if (self.team == FL_TEAM_2 && self.health >= 1)
 			{
 				bluealive += 1;
 				totalalive += 1;
@@ -342,22 +342,22 @@ void count_alive_players()
 	{
 		// count amount of alive players in each team
 		FOR_EACH_PLAYER(self) {
-			if (self.team == COLOR_TEAM1 && self.freezetag_frozen == 0 && self.health >= 1)
+			if (self.team == FL_TEAM_1 && self.freezetag_frozen == 0 && self.health >= 1)
 			{
 				redalive += 1;
 				totalalive += 1;
 			}
-			else if (self.team == COLOR_TEAM2 && self.freezetag_frozen == 0 && self.health >= 1)
+			else if (self.team == FL_TEAM_2 && self.freezetag_frozen == 0 && self.health >= 1)
 			{
 				bluealive += 1;
 				totalalive += 1;
 			}
-			else if (self.team == COLOR_TEAM3 && self.freezetag_frozen == 0 && self.health >= 1)
+			else if (self.team == FL_TEAM_3 && self.freezetag_frozen == 0 && self.health >= 1)
 			{
 				yellowalive += 1;
 				totalalive += 1;
 			}
-			else if (self.team == COLOR_TEAM4 && self.freezetag_frozen == 0 && self.health >= 1)
+			else if (self.team == FL_TEAM_4 && self.freezetag_frozen == 0 && self.health >= 1)
 			{
 				pinkalive += 1;
 				totalalive += 1;
@@ -400,12 +400,12 @@ void Spawnqueue_Check()
 				if(redalive) {
 					play2all("ctf/red_capture.wav");
 					FOR_EACH_CLIENT(self) centerprint(self, "^1RED ^7team wins the round");
-					TeamScore_AddToTeam(COLOR_TEAM1, ST_SCORE, +1);
+					TeamScore_AddToTeam(FL_TEAM_1, ST_SCORE, +1);
 				}
 				else if(bluealive) {
 					play2all("ctf/blue_capture.wav");
 					FOR_EACH_CLIENT(self) centerprint(self, "^4BLUE ^7team wins the round");
-					TeamScore_AddToTeam(COLOR_TEAM2, ST_SCORE, +1);
+					TeamScore_AddToTeam(FL_TEAM_2, ST_SCORE, +1);
 				}
 				else
 					FOR_EACH_CLIENT(self) centerprint(self, "^7Round tied");
diff --git a/qcsrc/server/assault.qc b/qcsrc/server/assault.qc
index 2562dca3df..b4ac4a1eea 100644
--- a/qcsrc/server/assault.qc
+++ b/qcsrc/server/assault.qc
@@ -9,7 +9,7 @@ void spawnfunc_info_player_attacker() {
 		remove(self);
 		return;
 	}
-	self.team = COLOR_TEAM1; // red, gets swapped every round
+	self.team = FL_TEAM_1; // red, gets swapped every round
 	spawnfunc_info_player_deathmatch();
 }
 
@@ -19,7 +19,7 @@ void spawnfunc_info_player_defender() {
 		remove(self);
 		return;
 	}
-	self.team = COLOR_TEAM2; // blue, gets swapped every round
+	self.team = FL_TEAM_2; // blue, gets swapped every round
 	spawnfunc_info_player_deathmatch();
 }
 
@@ -216,10 +216,10 @@ void spawnfunc_func_assault_destructible() {
 	}
 	self.spawnflags = 3;
 	self.classname = "func_assault_destructible";
-	if(assault_attacker_team == COLOR_TEAM1) {
-		self.team = COLOR_TEAM2;
+	if(assault_attacker_team == FL_TEAM_1) {
+		self.team = FL_TEAM_2;
 	} else {
-		self.team = COLOR_TEAM1;
+		self.team = FL_TEAM_1;
 	}
 	spawnfunc_func_breakable();
 }
@@ -289,10 +289,10 @@ void assault_roundstart_use() {
 	ent = find(world, classname, "turret_main");
 	while(ent) {
 		// Swap turret teams
-		if(ent.team == COLOR_TEAM1)
-			ent.team = COLOR_TEAM2;
+		if(ent.team == FL_TEAM_1)
+			ent.team = FL_TEAM_2;
 		else
-			ent.team = COLOR_TEAM1;
+			ent.team = FL_TEAM_1;
 
 		self = ent;
 
@@ -313,7 +313,7 @@ void spawnfunc_target_assault_roundstart() {
 		remove(self);
 		return;
 	}
-	assault_attacker_team = COLOR_TEAM1;
+	assault_attacker_team = FL_TEAM_1;
 	self.classname = "target_assault_roundstart";
 	self.use = assault_roundstart_use;
 	self.reset2 = assault_roundstart_use;
@@ -351,10 +351,10 @@ void assault_new_round()
 	self.winning = self.winning + 1;
 
 	// swap attacker/defender roles
-	if(assault_attacker_team == COLOR_TEAM1) {
-		assault_attacker_team = COLOR_TEAM2;
+	if(assault_attacker_team == FL_TEAM_1) {
+		assault_attacker_team = FL_TEAM_2;
 	} else {
-		assault_attacker_team = COLOR_TEAM1;
+		assault_attacker_team = FL_TEAM_1;
 	}
 
 
@@ -363,10 +363,10 @@ void assault_new_round()
 	{
 		if(clienttype(ent) == CLIENTTYPE_NOTACLIENT)
 		{
-			if(ent.team_saved == COLOR_TEAM1)
-				ent.team_saved = COLOR_TEAM2;
-			else if(ent.team_saved == COLOR_TEAM2)
-				ent.team_saved = COLOR_TEAM1;
+			if(ent.team_saved == FL_TEAM_1)
+				ent.team_saved = FL_TEAM_2;
+			else if(ent.team_saved == FL_TEAM_2)
+				ent.team_saved = FL_TEAM_1;
 		}
 	}
 
diff --git a/qcsrc/server/attic/ctf.qc b/qcsrc/server/attic/ctf.qc
index d65d866ca6..9d514da5ac 100644
--- a/qcsrc/server/attic/ctf.qc
+++ b/qcsrc/server/attic/ctf.qc
@@ -127,10 +127,10 @@ void ctf_flag_spawnstuff()
 	self.nearestwaypointtimeout = 0; // activate waypointing again
 	self.basewaypoint = self.nearestwaypoint;
 
-	if(self.team == COLOR_TEAM1)
-		WaypointSprite_SpawnFixed("redbase", self.origin + '0 0 61', self, sprite, RADARICON_FLAG, colormapPaletteColor(COLOR_TEAM1 - 1, FALSE));
+	if(self.team == FL_TEAM_1)
+		WaypointSprite_SpawnFixed("redbase", self.origin + '0 0 61', self, sprite, RADARICON_FLAG, colormapPaletteColor(FL_TEAM_1 - 1, FALSE));
 	else
-		WaypointSprite_SpawnFixed("bluebase", self.origin + '0 0 61', self, sprite, RADARICON_FLAG, colormapPaletteColor(COLOR_TEAM2 - 1, FALSE));
+		WaypointSprite_SpawnFixed("bluebase", self.origin + '0 0 61', self, sprite, RADARICON_FLAG, colormapPaletteColor(FL_TEAM_2 - 1, FALSE));
 }
 
 float ctf_score_value(string parameter)
@@ -290,7 +290,7 @@ void DropFlag(entity e, entity penalty_receiver, entity attacker)
 	ctf_captureshield_update(p, 0); // shield only
 	e.playerid = attacker.playerid;
 	e.ctf_droptime = time;
-	WaypointSprite_Spawn("flagdropped", 0, 0, e, '0 0 1' * 61, world, COLOR_TEAM1 + COLOR_TEAM2 - e.team, e, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAG, '0 1 1');
+	WaypointSprite_Spawn("flagdropped", 0, 0, e, '0 0 1' * 61, world, FL_TEAM_1 + FL_TEAM_2 - e.team, e, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAG, '0 1 1');
 	WaypointSprite_Ping(e.waypointsprite_attachedforcarrier);
 	
 	if(p.waypointsprite_attachedforcarrier)
@@ -494,11 +494,11 @@ void FlagTouch()
 		UpdateFrags(other, ctf_score_value("score_capture"));
 
 		if (autocvar_g_ctf_flag_capture_effects) {
-			if (other.team == COLOR_TEAM1) { // red team scores effect
+			if (other.team == FL_TEAM_1) { // red team scores effect
 				pointparticles(particleeffectnum("red_ground_quake"), self.origin, '0 0 0', 1);
 				flag_cap_ring_spawn(self.origin);
 			}
-			if (other.team == COLOR_TEAM2) { // blue team scores effect
+			if (other.team == FL_TEAM_2) { // blue team scores effect
 				pointparticles(particleeffectnum("blue_ground_quake"), self.origin, '0 0 0', 1);
 				flag_cap_ring_spawn(self.origin);
 			}
@@ -513,7 +513,7 @@ void FlagTouch()
 		other.next_take_time = time + 1;
 	}
 	if (self.cnt == FLAG_BASE)
-	if (other.team == COLOR_TEAM1 || other.team == COLOR_TEAM2) // only red and blue team can steal flags
+	if (other.team == FL_TEAM_1 || other.team == FL_TEAM_2) // only red and blue team can steal flags
 	if (other.team != self.team)
 	if (!other.flagcarried)
 	if (!other.ctf_captureshielded)
@@ -563,7 +563,7 @@ void FlagTouch()
 	if (self.cnt == FLAG_DROPPED)
 	{
 		self.flags = FL_ITEM | FL_NOTARGET; // clear FL_ONGROUND and any other junk
-		if (other.team == self.team || (other.team != COLOR_TEAM1 && other.team != COLOR_TEAM2))
+		if (other.team == self.team || (other.team != FL_TEAM_1 && other.team != FL_TEAM_2))
 		{
 			// return flag
 			Send_KillNotification (other.netname, self.netname, "", INFO_RETURNFLAG, MSG_INFO);
@@ -578,22 +578,22 @@ void FlagTouch()
 				}
 
 			// punish the team who was last carrying it
-			if(self.team == COLOR_TEAM1)
-				TeamScore_AddToTeam(COLOR_TEAM2, ST_SCORE, -ctf_score_value("penalty_returned"));
+			if(self.team == FL_TEAM_1)
+				TeamScore_AddToTeam(FL_TEAM_2, ST_SCORE, -ctf_score_value("penalty_returned"));
 			else
-				TeamScore_AddToTeam(COLOR_TEAM1, ST_SCORE, -ctf_score_value("penalty_returned"));
+				TeamScore_AddToTeam(FL_TEAM_1, ST_SCORE, -ctf_score_value("penalty_returned"));
 
 			// reward the player who returned it
 			if(other.playerid == self.playerid) // is this the guy who killed the FC last?
 			{
-				if (other.team == COLOR_TEAM1 || other.team == COLOR_TEAM2)
+				if (other.team == FL_TEAM_1 || other.team == FL_TEAM_2)
 					UpdateFrags(other, ctf_score_value("score_return_by_killer"));
 				else
 					UpdateFrags(other, ctf_score_value("score_return_rogue_by_killer"));
 			}
 			else
 			{
-				if (other.team == COLOR_TEAM1 || other.team == COLOR_TEAM2)
+				if (other.team == FL_TEAM_1 || other.team == FL_TEAM_2)
 					UpdateFrags(other, ctf_score_value("score_return"));
 				else
 					UpdateFrags(other, ctf_score_value("score_return_rogue"));
@@ -663,7 +663,7 @@ void spawnfunc_info_player_team1()
 		remove(self);
 		return;
 	}
-	self.team = COLOR_TEAM1; // red
+	self.team = FL_TEAM_1; // red
 	spawnfunc_info_player_deathmatch();
 }
 //self.team = 4;self.classname = "info_player_start";spawnfunc_info_player_start();}
@@ -683,7 +683,7 @@ void spawnfunc_info_player_team2()
 		remove(self);
 		return;
 	}
-	self.team = COLOR_TEAM2; // blue
+	self.team = FL_TEAM_2; // blue
 	spawnfunc_info_player_deathmatch();
 }
 //self.team = 13;self.classname = "info_player_start";spawnfunc_info_player_start();}
@@ -703,7 +703,7 @@ void spawnfunc_info_player_team3()
 		remove(self);
 		return;
 	}
-	self.team = COLOR_TEAM3; // yellow
+	self.team = FL_TEAM_3; // yellow
 	spawnfunc_info_player_deathmatch();
 }
 
@@ -723,7 +723,7 @@ void spawnfunc_info_player_team4()
 		remove(self);
 		return;
 	}
-	self.team = COLOR_TEAM4; // purple
+	self.team = FL_TEAM_4; // purple
 	spawnfunc_info_player_deathmatch();
 }
 
@@ -741,11 +741,11 @@ void item_flag_postspawn()
 	// Flag Glow Trail Support
 	if(autocvar_g_ctf_flag_glowtrails)
 	{ // Provide Flag Glow Trail
-		if(self.team == COLOR_TEAM1)
+		if(self.team == FL_TEAM_1)
 			// Red
 			self.glow_color = 251;
 		else
-		if(self.team == COLOR_TEAM2)
+		if(self.team == FL_TEAM_2)
 			// Blue
 			self.glow_color = 210;
 
@@ -802,7 +802,7 @@ void spawnfunc_item_flag_team1()
 	ctf_worldflaglist = self;
 
 	self.classname = "item_flag_team";
-	self.team = COLOR_TEAM1; // color 4 team (red)
+	self.team = FL_TEAM_1; // color 4 team (red)
 	self.items = IT_KEY2; // gold key (redish enough)
 	self.netname = "^1RED^7 flag";
 	self.target = "###item###";
@@ -901,7 +901,7 @@ void spawnfunc_item_flag_team2()
 	ctf_worldflaglist = self;
 
 	self.classname = "item_flag_team";
-	self.team = COLOR_TEAM2; // color 13 team (blue)
+	self.team = FL_TEAM_2; // color 13 team (blue)
 	self.items = IT_KEY1; // silver key (bluish enough)
 	self.netname = "^4BLUE^7 flag";
 	self.target = "###item###";
@@ -1002,8 +1002,8 @@ void ctf_spawnteams()
 
 	numteams = 2;//cvar("g_ctf_default_teams");
 
-	ctf_spawnteam("Red", COLOR_TEAM1 - 1);
-	ctf_spawnteam("Blue", COLOR_TEAM2 - 1);
+	ctf_spawnteam("Red", FL_TEAM_1 - 1);
+	ctf_spawnteam("Blue", FL_TEAM_2 - 1);
 }
 
 void ctf_delayedinit()
@@ -1089,7 +1089,7 @@ void ctf_setstatus()
 entity ctf_team_has_commander(float cteam)
 {
 	entity pl;
-	if(cteam != COLOR_TEAM1 || cteam != COLOR_TEAM2)
+	if(cteam != FL_TEAM_1 || cteam != FL_TEAM_2)
 		return world;
 
 	FOR_EACH_REALPLAYER(pl) {
diff --git a/qcsrc/server/attic/nexball.qc b/qcsrc/server/attic/nexball.qc
index d3f4b55f4a..ee0c13b87d 100644
--- a/qcsrc/server/attic/nexball.qc
+++ b/qcsrc/server/attic/nexball.qc
@@ -427,10 +427,10 @@ void nb_spawnteams (void)
 	{
 		switch(e.team)
 		{
-			case COLOR_TEAM1: if(!t_r) { nb_spawnteam ("Red", e.team-1)   ; t_r = 1; } break;
-			case COLOR_TEAM2: if(!t_b) { nb_spawnteam ("Blue", e.team-1)  ; t_b = 1; } break;
-			case COLOR_TEAM3: if(!t_y) { nb_spawnteam ("Yellow", e.team-1); t_y = 1; } break;
-			case COLOR_TEAM4: if(!t_p) { nb_spawnteam ("Pink", e.team-1)  ; t_p = 1; } break;
+			case FL_TEAM_1: if(!t_r) { nb_spawnteam ("Red", e.team-1)   ; t_r = 1; } break;
+			case FL_TEAM_2: if(!t_b) { nb_spawnteam ("Blue", e.team-1)  ; t_b = 1; } break;
+			case FL_TEAM_3: if(!t_y) { nb_spawnteam ("Yellow", e.team-1); t_y = 1; } break;
+			case FL_TEAM_4: if(!t_p) { nb_spawnteam ("Pink", e.team-1)  ; t_p = 1; } break;
 		}
 	}
 }
@@ -541,22 +541,22 @@ void SpawnGoal (void)
 
 void spawnfunc_nexball_redgoal (void)
 {
-	self.team = COLOR_TEAM1;
+	self.team = FL_TEAM_1;
 	SpawnGoal();
 }
 void spawnfunc_nexball_bluegoal (void)
 {
-	self.team = COLOR_TEAM2;
+	self.team = FL_TEAM_2;
 	SpawnGoal();
 }
 void spawnfunc_nexball_yellowgoal (void)
 {
-	self.team = COLOR_TEAM3;
+	self.team = FL_TEAM_3;
 	SpawnGoal();
 }
 void spawnfunc_nexball_pinkgoal (void)
 {
-	self.team = COLOR_TEAM4;
+	self.team = FL_TEAM_4;
 	SpawnGoal();
 }
 
diff --git a/qcsrc/server/bot/bot.qc b/qcsrc/server/bot/bot.qc
index 3e1cae313f..bdcfe864e4 100644
--- a/qcsrc/server/bot/bot.qc
+++ b/qcsrc/server/bot/bot.qc
@@ -399,13 +399,13 @@ void bot_clientconnect()
 		bot_setnameandstuff();
 
 	if(self.bot_forced_team==1)
-		self.team = COLOR_TEAM1;
+		self.team = FL_TEAM_1;
 	else if(self.bot_forced_team==2)
-		self.team = COLOR_TEAM2;
+		self.team = FL_TEAM_2;
 	else if(self.bot_forced_team==3)
-		self.team = COLOR_TEAM3;
+		self.team = FL_TEAM_3;
 	else if(self.bot_forced_team==4)
-		self.team = COLOR_TEAM4;
+		self.team = FL_TEAM_4;
 	else
 		JoinBestTeam(self, FALSE, TRUE);
 
@@ -426,13 +426,13 @@ void bot_removefromlargestteam()
 	bestcount = 0;
 	while (head)
 	{
-		if(head.team == COLOR_TEAM1)
+		if(head.team == FL_TEAM_1)
 			thiscount = c1;
-		else if(head.team == COLOR_TEAM2)
+		else if(head.team == FL_TEAM_2)
 			thiscount = c2;
-		else if(head.team == COLOR_TEAM3)
+		else if(head.team == FL_TEAM_3)
 			thiscount = c3;
-		else if(head.team == COLOR_TEAM4)
+		else if(head.team == FL_TEAM_4)
 			thiscount = c4;
 		else
 			thiscount = 0;
diff --git a/qcsrc/server/bot/havocbot/role_onslaught.qc b/qcsrc/server/bot/havocbot/role_onslaught.qc
index b17697d2f8..f63ddbdc22 100644
--- a/qcsrc/server/bot/havocbot/role_onslaught.qc
+++ b/qcsrc/server/bot/havocbot/role_onslaught.qc
@@ -127,12 +127,12 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
 			continue;
 
 		// Ignore owned controlpoints
-		if(self.team == COLOR_TEAM1)
+		if(self.team == FL_TEAM_1)
 		{
 			if( (cp2.isgenneighbor_blue || cp2.iscpneighbor_blue) && !(cp2.isgenneighbor_red || cp2.iscpneighbor_red) )
 				continue;
 		}
-		else if(self.team == COLOR_TEAM2)
+		else if(self.team == FL_TEAM_2)
 		{
 			if( (cp2.isgenneighbor_red || cp2.iscpneighbor_red) && !(cp2.isgenneighbor_blue || cp2.iscpneighbor_blue) )
 				continue;
diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc
index 72302d26eb..8512f57dfb 100644
--- a/qcsrc/server/cl_client.qc
+++ b/qcsrc/server/cl_client.qc
@@ -554,7 +554,7 @@ void FixPlayermodel()
 		if(teamplay)
 		{
 			string s;
-			s = Team_ColorNameLowerCase(self.team);
+			s = Team_ColorName_Lower(self.team);
 			if(s != "neutral")
 			{
 				defaultmodel = cvar_string(strcat("sv_defaultplayermodel_", s));
@@ -1401,30 +1401,30 @@ void ClientConnect (void)
 		{
 			switch(autocvar_g_campaign_forceteam)
 			{
-				case 1: self.team_forced = COLOR_TEAM1; break;
-				case 2: self.team_forced = COLOR_TEAM2; break;
-				case 3: self.team_forced = COLOR_TEAM3; break;
-				case 4: self.team_forced = COLOR_TEAM4; break;
+				case 1: self.team_forced = FL_TEAM_1; break;
+				case 2: self.team_forced = FL_TEAM_2; break;
+				case 3: self.team_forced = FL_TEAM_3; break;
+				case 4: self.team_forced = FL_TEAM_4; break;
 				default: self.team_forced = 0;
 			}
 		}
 	}
 	else if(PlayerInIDList(self, autocvar_g_forced_team_red))
-		self.team_forced = COLOR_TEAM1;
+		self.team_forced = FL_TEAM_1;
 	else if(PlayerInIDList(self, autocvar_g_forced_team_blue))
-		self.team_forced = COLOR_TEAM2;
+		self.team_forced = FL_TEAM_2;
 	else if(PlayerInIDList(self, autocvar_g_forced_team_yellow))
-		self.team_forced = COLOR_TEAM3;
+		self.team_forced = FL_TEAM_3;
 	else if(PlayerInIDList(self, autocvar_g_forced_team_pink))
-		self.team_forced = COLOR_TEAM4;
+		self.team_forced = FL_TEAM_4;
 	else if(autocvar_g_forced_team_otherwise == "red")
-		self.team_forced = COLOR_TEAM1;
+		self.team_forced = FL_TEAM_1;
 	else if(autocvar_g_forced_team_otherwise == "blue")
-		self.team_forced = COLOR_TEAM2;
+		self.team_forced = FL_TEAM_2;
 	else if(autocvar_g_forced_team_otherwise == "yellow")
-		self.team_forced = COLOR_TEAM3;
+		self.team_forced = FL_TEAM_3;
 	else if(autocvar_g_forced_team_otherwise == "pink")
-		self.team_forced = COLOR_TEAM4;
+		self.team_forced = FL_TEAM_4;
 	else if(autocvar_g_forced_team_otherwise == "spectate")
 		self.team_forced = -1;
 	else if(autocvar_g_forced_team_otherwise == "spectator")
diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc
index 4b5bca748c..f7c206091f 100644
--- a/qcsrc/server/cl_player.qc
+++ b/qcsrc/server/cl_player.qc
@@ -1423,7 +1423,7 @@ void MoveToTeam(entity client, float team_colour, float type, float show_message
 	LogTeamchange(client.playerid, client.team, type);
 
 	if not(show_message & 1) // admin message
-		sprint(client, strcat("\{1}\{13}^3", admin_name(), "^7: You have been moved to the ", Team_ColorNameLowerCase(team_colour), " team\n"));  // send a chat message
+		sprint(client, strcat("\{1}\{13}^3", admin_name(), "^7: You have been moved to the ", Team_ColorName_Lower(team_colour), " team\n"));  // send a chat message
 
 	bprint(strcat(client.netname, " joined the ", ColoredTeamName(client.team), "\n"));
 }
diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc
index 530646afd2..eba74cd386 100644
--- a/qcsrc/server/command/cmd.qc
+++ b/qcsrc/server/command/cmd.qc
@@ -284,10 +284,10 @@ void ClientCommand_selectteam(float request, float argc)
 								
 								switch(argv(1))
 								{
-									case "red": selection = COLOR_TEAM1; break;
-									case "blue": selection = COLOR_TEAM2; break;
-									case "yellow": selection = COLOR_TEAM3; break;
-									case "pink": selection = COLOR_TEAM4; break;
+									case "red": selection = FL_TEAM_1; break;
+									case "blue": selection = FL_TEAM_2; break;
+									case "yellow": selection = FL_TEAM_3; break;
+									case "pink": selection = FL_TEAM_4; break;
 									case "auto": selection = (-1); break;
 									
 									default: selection = 0; break;
diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc
index b2bf9d9b97..c289334f25 100644
--- a/qcsrc/server/command/sv_cmd.qc
+++ b/qcsrc/server/command/sv_cmd.qc
@@ -966,7 +966,7 @@ void GameCommand_moveplayer(float request, float argc)
 								client.team_forced = 0;
 
 								// find the team to move the player to
-								team_color = ColourToNumber(destination);
+								team_color = Team_ColorToNumber(destination);
 								if(team_color == client.team) // already on the destination team
 								{
 									// keep the forcing undone
@@ -975,7 +975,7 @@ void GameCommand_moveplayer(float request, float argc)
 								} 
 								else if(team_color == 0)  // auto team
 								{
-									team_color = NumberToTeamNumber(FindSmallestTeam(client, FALSE));
+									team_color = Team_NumberToTeam(FindSmallestTeam(client, FALSE));
 								}
 								else
 								{
@@ -986,10 +986,10 @@ void GameCommand_moveplayer(float request, float argc)
 								// Check to see if the destination team is even available
 								switch(team_color) 
 								{
-									case COLOR_TEAM1: if(c1 == -1) { print("Sorry, can't move player to red team if it doesn't exist.\n"); return; } break;
-									case COLOR_TEAM2: if(c2 == -1) { print("Sorry, can't move player to blue team if it doesn't exist.\n"); return; } break;
-									case COLOR_TEAM3: if(c3 == -1) { print("Sorry, can't move player to yellow team if it doesn't exist.\n"); return; } break;
-									case COLOR_TEAM4: if(c4 == -1) { print("Sorry, can't move player to pink team if it doesn't exist.\n"); return; } break;
+									case FL_TEAM_1: if(c1 == -1) { print("Sorry, can't move player to red team if it doesn't exist.\n"); return; } break;
+									case FL_TEAM_2: if(c2 == -1) { print("Sorry, can't move player to blue team if it doesn't exist.\n"); return; } break;
+									case FL_TEAM_3: if(c3 == -1) { print("Sorry, can't move player to yellow team if it doesn't exist.\n"); return; } break;
+									case FL_TEAM_4: if(c4 == -1) { print("Sorry, can't move player to pink team if it doesn't exist.\n"); return; } break;
 									
 									default: print("Sorry, can't move player here if team ", destination, " doesn't exist.\n"); return;
 								}
@@ -1298,7 +1298,7 @@ void GameCommand_shuffleteams(float request)
 					x = (t_players / t_teams);
 					x = ((i == 1) ? ceil(x) : floor(x));
 					
-					team_color = NumberToTeamNumber(i);
+					team_color = Team_NumberToTeam(i);
 					
 					// sort through the random list of players made earlier 
 					for(z = 1; z <= maxclients; ++z)
diff --git a/qcsrc/server/constants.qh b/qcsrc/server/constants.qh
index aec1e3256b..522bb2ffca 100644
--- a/qcsrc/server/constants.qh
+++ b/qcsrc/server/constants.qh
@@ -106,6 +106,7 @@ float	TE_KNIGHTSPIKE				= 8;
 float	TE_LIGHTNING3				= 9;
 float	TE_LAVASPLASH				= 10;
 float	TE_TELEPORT				= 11;
+float TE_BEAM					= 13;		// grappling hook
 
 float	UPDATE_GENERAL				= 0;
 float	UPDATE_STATIC				= 1;
@@ -139,14 +140,6 @@ float	MSG_ENTITY				= 5; // csqc
 
 //float	POWERUP_INVINCIBLE_TAKEDAMAGE		= 0.2; // received damage multiplier for invincible powerup
 
-
-float TE_BEAM					= 13;		// grappling hook
-
-float COLOR_TEAM1	= 5;  // red
-float COLOR_TEAM2	= 14; // blue
-float COLOR_TEAM3	= 13; // yellow
-float COLOR_TEAM4	= 10; // pink
-
 float NUM_PLAYERSKINS_TEAMPLAY = 3;
 
 float ASSAULT_VALUE_INACTIVE = 1000;
diff --git a/qcsrc/server/domination.qc b/qcsrc/server/domination.qc
index 0a2fe02b66..2599b13518 100644
--- a/qcsrc/server/domination.qc
+++ b/qcsrc/server/domination.qc
@@ -131,16 +131,16 @@ void dompoint_captured ()
 
 	switch(self.goalentity.team)
 	{
-		case COLOR_TEAM1:
+		case FL_TEAM_1:
 			WaypointSprite_UpdateSprites(self.sprite, "dom-red", "", "");
 			break;
-		case COLOR_TEAM2:
+		case FL_TEAM_2:
 			WaypointSprite_UpdateSprites(self.sprite, "dom-blue", "", "");
 			break;
-		case COLOR_TEAM3:
+		case FL_TEAM_3:
 			WaypointSprite_UpdateSprites(self.sprite, "dom-yellow", "", "");
 			break;
-		case COLOR_TEAM4:
+		case FL_TEAM_4:
 			WaypointSprite_UpdateSprites(self.sprite, "dom-pink", "", "");
 	}
 
@@ -157,16 +157,16 @@ void dompoint_captured ()
 			wait_time = head.wait;
 		switch(head.goalentity.team)
 		{
-			case COLOR_TEAM1:
+			case FL_TEAM_1:
 				pps_red += points/wait_time;
 				break;
-			case COLOR_TEAM2:
+			case FL_TEAM_2:
 				pps_blue += points/wait_time;
 				break;
-			case COLOR_TEAM3:
+			case FL_TEAM_3:
 				pps_yellow += points/wait_time;
 				break;
-			case COLOR_TEAM4:
+			case FL_TEAM_4:
 				pps_pink += points/wait_time;
 		}
 		total_pps += points/wait_time;
@@ -469,12 +469,12 @@ void dom_spawnteams()
 	else
 		numteams = autocvar_g_domination_teams_override;
 	// LordHavoc: edit this if you want to change defaults
-	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");
+	dom_spawnteam("Red", FL_TEAM_1-1, "models/domination/dom_red.md3", 0, "domination/claim.wav", "", "Red team has captured a control point");
+	dom_spawnteam("Blue", FL_TEAM_2-1, "models/domination/dom_blue.md3", 0, "domination/claim.wav", "", "Blue team has captured a control point");
 	if(numteams > 2)
-		dom_spawnteam("Yellow", COLOR_TEAM3-1, "models/domination/dom_yellow.md3", 0, "domination/claim.wav", "", "Yellow team has captured a control point");
+		dom_spawnteam("Yellow", FL_TEAM_3-1, "models/domination/dom_yellow.md3", 0, "domination/claim.wav", "", "Yellow team has captured a control point");
 	if(numteams > 3)
-		dom_spawnteam("Pink", COLOR_TEAM4-1, "models/domination/dom_pink.md3", 0, "domination/claim.wav", "", "Pink team has captured a control point");
+		dom_spawnteam("Pink", FL_TEAM_4-1, "models/domination/dom_pink.md3", 0, "domination/claim.wav", "", "Pink team has captured a control point");
 	dom_spawnteam("", 0, "models/domination/dom_unclaimed.md3", 0, "", "", "");
 }
 
diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc
index b2a0e99e3b..b32424d37d 100644
--- a/qcsrc/server/g_damage.qc
+++ b/qcsrc/server/g_damage.qc
@@ -349,7 +349,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
 			s2 = ((targ.killcount > 2) ? ftos(targ.killcount) : "");
 				
 			//if(teamplay && deathtype == DEATH_MIRRORDAMAGE)
-			//	{ deathtype = ((attacker.team == COLOR_TEAM1) ? KILL_TEAM_SUICIDE_RED : KILL_TEAM_SUICIDE_BLUE); }
+			//	{ deathtype = ((attacker.team == FL_TEAM_1) ? KILL_TEAM_SUICIDE_RED : KILL_TEAM_SUICIDE_BLUE); }
 
 			Obituary_Notification(world, s1, s2, "", deathtype);
 			//Send_KillNotification(s, s2, ftos(w), deathtype, MSG_SUICIDE);
@@ -358,7 +358,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
 		{
 			if(!IsDifferentTeam(attacker, targ))
 			{
-				//type = ((attacker.team == COLOR_TEAM1) ? KILL_TEAM_FRAG_RED : KILL_TEAM_FRAG_BLUE);
+				//type = ((attacker.team == FL_TEAM_1) ? KILL_TEAM_FRAG_RED : KILL_TEAM_FRAG_BLUE);
 
 				GiveFrags(attacker, targ, -1, deathtype);
 
diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc
index f7982cf881..b5ae693cb8 100644
--- a/qcsrc/server/g_world.qc
+++ b/qcsrc/server/g_world.qc
@@ -1758,10 +1758,10 @@ float WinningCondition_Onslaught()
 	{
 		if (head.health > 0)
 		{
-			if (head.team == COLOR_TEAM1) t1 = 1;
-			if (head.team == COLOR_TEAM2) t2 = 1;
-			if (head.team == COLOR_TEAM3) t3 = 1;
-			if (head.team == COLOR_TEAM4) t4 = 1;
+			if (head.team == FL_TEAM_1) t1 = 1;
+			if (head.team == FL_TEAM_2) t2 = 1;
+			if (head.team == FL_TEAM_3) t3 = 1;
+			if (head.team == FL_TEAM_4) t4 = 1;
 		}
 		head = find(head, classname, "onslaught_generator");
 	}
@@ -1769,10 +1769,10 @@ float WinningCondition_Onslaught()
 	{
 		// game over, only one team remains (or none)
 		ClearWinners();
-		if (t1) SetWinners(team, COLOR_TEAM1);
-		if (t2) SetWinners(team, COLOR_TEAM2);
-		if (t3) SetWinners(team, COLOR_TEAM3);
-		if (t4) SetWinners(team, COLOR_TEAM4);
+		if (t1) SetWinners(team, FL_TEAM_1);
+		if (t2) SetWinners(team, FL_TEAM_2);
+		if (t3) SetWinners(team, FL_TEAM_3);
+		if (t4) SetWinners(team, FL_TEAM_4);
 		dprint("Have a winner, ending game.\n");
 		return WINNING_YES;
 	}
@@ -1810,13 +1810,13 @@ float WinningCondition_Assault()
 
 	status = WINNING_NO;
 	// as the timelimit has not yet passed just assume the defending team will win
-	if(assault_attacker_team == COLOR_TEAM1)
+	if(assault_attacker_team == FL_TEAM_1)
 	{
-		SetWinners(team, COLOR_TEAM2);
+		SetWinners(team, FL_TEAM_2);
 	}
 	else
 	{
-		SetWinners(team, COLOR_TEAM1);
+		SetWinners(team, FL_TEAM_1);
 	}
 
 	entity ent;
@@ -1942,10 +1942,10 @@ float WinningCondition_Scores(float limit, float leadlimit)
 
 	if(teamplay)
 	{
-		team1_score = TeamScore_GetCompareValue(COLOR_TEAM1);
-		team2_score = TeamScore_GetCompareValue(COLOR_TEAM2);
-		team3_score = TeamScore_GetCompareValue(COLOR_TEAM3);
-		team4_score = TeamScore_GetCompareValue(COLOR_TEAM4);
+		team1_score = TeamScore_GetCompareValue(FL_TEAM_1);
+		team2_score = TeamScore_GetCompareValue(FL_TEAM_2);
+		team3_score = TeamScore_GetCompareValue(FL_TEAM_3);
+		team4_score = TeamScore_GetCompareValue(FL_TEAM_4);
 	}
 
 	ClearWinners();
@@ -2062,25 +2062,25 @@ float WinningCondition_RanOutOfSpawns()
 
 	FOR_EACH_PLAYER(head) if(head.deadflag == DEAD_NO)
 	{
-		if(head.team == COLOR_TEAM1)
+		if(head.team == FL_TEAM_1)
 			team1_score = 1;
-		else if(head.team == COLOR_TEAM2)
+		else if(head.team == FL_TEAM_2)
 			team2_score = 1;
-		else if(head.team == COLOR_TEAM3)
+		else if(head.team == FL_TEAM_3)
 			team3_score = 1;
-		else if(head.team == COLOR_TEAM4)
+		else if(head.team == FL_TEAM_4)
 			team4_score = 1;
 	}
 
 	for(head = world; (head = find(head, classname, "info_player_deathmatch")) != world; )
 	{
-		if(head.team == COLOR_TEAM1)
+		if(head.team == FL_TEAM_1)
 			team1_score = 1;
-		else if(head.team == COLOR_TEAM2)
+		else if(head.team == FL_TEAM_2)
 			team2_score = 1;
-		else if(head.team == COLOR_TEAM3)
+		else if(head.team == FL_TEAM_3)
 			team3_score = 1;
-		else if(head.team == COLOR_TEAM4)
+		else if(head.team == FL_TEAM_4)
 			team4_score = 1;
 	}
 
@@ -2094,20 +2094,20 @@ float WinningCondition_RanOutOfSpawns()
 	{
 		float t, i;
 		if(team1_score)
-			t = COLOR_TEAM1;
+			t = FL_TEAM_1;
 		else if(team2_score)
-			t = COLOR_TEAM2;
+			t = FL_TEAM_2;
 		else if(team3_score)
-			t = COLOR_TEAM3;
+			t = FL_TEAM_3;
 		else // if(team4_score)
-			t = COLOR_TEAM4;
+			t = FL_TEAM_4;
 		CheckAllowedTeams(world);
 		for(i = 0; i < MAX_TEAMSCORE; ++i)
 		{
-			if(t != COLOR_TEAM1) if(c1 >= 0) TeamScore_AddToTeam(COLOR_TEAM1, i, -1000);
-			if(t != COLOR_TEAM2) if(c2 >= 0) TeamScore_AddToTeam(COLOR_TEAM2, i, -1000);
-			if(t != COLOR_TEAM3) if(c3 >= 0) TeamScore_AddToTeam(COLOR_TEAM3, i, -1000);
-			if(t != COLOR_TEAM4) if(c4 >= 0) TeamScore_AddToTeam(COLOR_TEAM4, i, -1000);
+			if(t != FL_TEAM_1) if(c1 >= 0) TeamScore_AddToTeam(FL_TEAM_1, i, -1000);
+			if(t != FL_TEAM_2) if(c2 >= 0) TeamScore_AddToTeam(FL_TEAM_2, i, -1000);
+			if(t != FL_TEAM_3) if(c3 >= 0) TeamScore_AddToTeam(FL_TEAM_3, i, -1000);
+			if(t != FL_TEAM_4) if(c4 >= 0) TeamScore_AddToTeam(FL_TEAM_4, i, -1000);
 		}
 
 		AddWinners(team, t);
diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc
index 08b06f5138..593d57d403 100644
--- a/qcsrc/server/miscfunctions.qc
+++ b/qcsrc/server/miscfunctions.qc
@@ -611,85 +611,6 @@ void backtrace(string msg)
     cvar_set("prvm_backtraceforwarnings", ftos(war));
 }
 
-string Team_ColorCode(float teamid)
-{
-    if (teamid == COLOR_TEAM1)
-        return "^1";
-    else if (teamid == COLOR_TEAM2)
-        return "^4";
-    else if (teamid == COLOR_TEAM3)
-        return "^3";
-    else if (teamid == COLOR_TEAM4)
-        return "^6";
-    else
-        return "^7";
-}
-
-string Team_ColorName(float t)
-{
-    // fixme: Search for team entities and get their .netname's!
-    if (t == COLOR_TEAM1)
-        return "Red";
-    if (t == COLOR_TEAM2)
-        return "Blue";
-    if (t == COLOR_TEAM3)
-        return "Yellow";
-    if (t == COLOR_TEAM4)
-        return "Pink";
-    return "Neutral";
-}
-
-string Team_ColorNameLowerCase(float t)
-{
-    // fixme: Search for team entities and get their .netname's!
-    if (t == COLOR_TEAM1)
-        return "red";
-    if (t == COLOR_TEAM2)
-        return "blue";
-    if (t == COLOR_TEAM3)
-        return "yellow";
-    if (t == COLOR_TEAM4)
-        return "pink";
-    return "neutral";
-}
-
-float ColourToNumber(string team_colour)
-{
-	if (team_colour == "red")
-		return COLOR_TEAM1;
-
-	if (team_colour == "blue")
-		return COLOR_TEAM2;
-
-	if (team_colour == "yellow")
-		return COLOR_TEAM3;
-
-	if (team_colour == "pink")
-		return COLOR_TEAM4;
-
-	if (team_colour == "auto")
-		return 0;
-
-	return -1;
-}
-
-float NumberToTeamNumber(float number)
-{
-	if (number == 1)
-		return COLOR_TEAM1;
-
-	if (number == 2)
-		return COLOR_TEAM2;
-
-	if (number == 3)
-		return COLOR_TEAM3;
-
-	if (number == 4)
-		return COLOR_TEAM4;
-
-	return -1;
-}
-
 // decolorizes and team colors the player name when needed
 string playername(entity p)
 {
diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc
index 911c3dee23..6c713e7aad 100644
--- a/qcsrc/server/mutators/gamemode_ctf.qc
+++ b/qcsrc/server/mutators/gamemode_ctf.qc
@@ -605,8 +605,8 @@ void ctf_CheckStalemate(void)
 			
 			switch(tmp_entity.team)
 			{
-				case COLOR_TEAM1: ++stale_red_flags; break;
-				case COLOR_TEAM2: ++stale_blue_flags; break;
+				case FL_TEAM_1: ++stale_red_flags; break;
+				case FL_TEAM_2: ++stale_blue_flags; break;
 			}
 		}
 	}
@@ -932,7 +932,7 @@ void ctf_DelayedFlagSetup(void) // called after a flag is placed on a map by ctf
 	self.bot_basewaypoint = self.nearestwaypoint;
 
 	// waypointsprites
-	WaypointSprite_SpawnFixed(((self.team == COLOR_TEAM1) ? "redbase" : "bluebase"), self.origin + FLAG_WAYPOINT_OFFSET, self, wps_flagbase, RADARICON_FLAG, colormapPaletteColor(self.team - 1, FALSE));
+	WaypointSprite_SpawnFixed(((self.team == FL_TEAM_1) ? "redbase" : "bluebase"), self.origin + FLAG_WAYPOINT_OFFSET, self, wps_flagbase, RADARICON_FLAG, colormapPaletteColor(self.team - 1, FALSE));
 	WaypointSprite_UpdateTeamRadar(self.wps_flagbase, RADARICON_FLAG, colormapPaletteColor(self.team - 1, FALSE));
 
 	// captureshield setup
@@ -952,7 +952,7 @@ void ctf_FlagSetup(float teamnumber, entity flag) // called when spawning a flag
 	setattachment(flag, world, "");	
 
 	flag.netname = ((teamnumber) ? "^1REPLACETHIS^7" : "^4REPLACETHIS^7"); // ((teamnumber) ? "^1RED^7 flag" : "^4BLUE^7 flag");
-	flag.team = ((teamnumber) ? COLOR_TEAM1 : COLOR_TEAM2); // COLOR_TEAM1: color 4 team (red) - COLOR_TEAM2: color 13 team (blue)
+	flag.team = ((teamnumber) ? FL_TEAM_1 : FL_TEAM_2); // FL_TEAM_1: color 4 team (red) - FL_TEAM_2: color 13 team (blue)
 	flag.items = ((teamnumber) ? IT_KEY2 : IT_KEY1); // IT_KEY2: gold key (redish enough) - IT_KEY1: silver key (bluish enough)
 	flag.classname = "item_flag_team";
 	flag.target = "###item###"; // wut?
@@ -2029,7 +2029,7 @@ void spawnfunc_info_player_team1()
 {
 	if(g_assault) { remove(self); return; }
 	
-	self.team = COLOR_TEAM1; // red
+	self.team = FL_TEAM_1; // red
 	spawnfunc_info_player_deathmatch();
 }
 
@@ -2041,7 +2041,7 @@ void spawnfunc_info_player_team2()
 {
 	if(g_assault) { remove(self); return; }
 	
-	self.team = COLOR_TEAM2; // blue
+	self.team = FL_TEAM_2; // blue
 	spawnfunc_info_player_deathmatch();
 }
 
@@ -2052,7 +2052,7 @@ void spawnfunc_info_player_team3()
 {
 	if(g_assault) { remove(self); return; }
 	
-	self.team = COLOR_TEAM3; // yellow
+	self.team = FL_TEAM_3; // yellow
 	spawnfunc_info_player_deathmatch();
 }
 
@@ -2064,7 +2064,7 @@ void spawnfunc_info_player_team4()
 {
 	if(g_assault) { remove(self); return; }
 	
-	self.team = COLOR_TEAM4; // purple
+	self.team = FL_TEAM_4; // purple
 	spawnfunc_info_player_deathmatch();
 }
 
@@ -2166,8 +2166,8 @@ void ctf_DelayedInit() // Do this check with a delay so we can wait for teams to
 	if(find(world, classname, "ctf_team") == world)
 	{
 		print("No ""ctf_team"" entities found on this map, creating them anyway.\n");
-		ctf_SpawnTeam("Red", COLOR_TEAM1 - 1);
-		ctf_SpawnTeam("Blue", COLOR_TEAM2 - 1);
+		ctf_SpawnTeam("Red", FL_TEAM_1 - 1);
+		ctf_SpawnTeam("Blue", FL_TEAM_2 - 1);
 	}
 	
 	ctf_ScoreRules();
diff --git a/qcsrc/server/mutators/gamemode_ctf.qh b/qcsrc/server/mutators/gamemode_ctf.qh
index bb64ee9eae..8e067caf01 100644
--- a/qcsrc/server/mutators/gamemode_ctf.qh
+++ b/qcsrc/server/mutators/gamemode_ctf.qh
@@ -132,7 +132,7 @@ float havocbot_ctf_middlepoint_radius;
 void havocbot_role_ctf_setrole(entity bot, float role);
 
 // client notification stuff
-#define RED_OR_BLUE(ent,prefix) ((ent.team == COLOR_TEAM1) ? prefix##RED : prefix##BLUE)
+#define RED_OR_BLUE(ent,prefix) ((ent.team == FL_TEAM_1) ? prefix##RED : prefix##BLUE)
 .float CAPTURE_VERBOSE;
 .float PICKUP_TEAM_VERBOSE;
 .float PICKUP_ENEMY_VERBOSE;
diff --git a/qcsrc/server/mutators/gamemode_freezetag.qc b/qcsrc/server/mutators/gamemode_freezetag.qc
index aedfd6364c..505ba51cb0 100644
--- a/qcsrc/server/mutators/gamemode_freezetag.qc
+++ b/qcsrc/server/mutators/gamemode_freezetag.qc
@@ -36,11 +36,11 @@ void freezetag_CheckWinner()
 
 	if(winner != world) // just in case a winner wasn't found
 	{
-		if(winner.team == COLOR_TEAM1)
+		if(winner.team == FL_TEAM_1)
 			teamname = "^1Red Team";
-		else if(winner.team == COLOR_TEAM2)
+		else if(winner.team == FL_TEAM_2)
 			teamname = "^4Blue Team";
-		else if(winner.team == COLOR_TEAM3)
+		else if(winner.team == FL_TEAM_3)
 			teamname = "^3Yellow Team";
 		else
 			teamname = "^6Pink Team";
@@ -242,13 +242,13 @@ MUTATOR_HOOKFUNCTION(freezetag_RemovePlayer)
 {
 	if(self.freezetag_frozen == 0 && self.health >= 1)
 	{
-		if(self.team == COLOR_TEAM1)
+		if(self.team == FL_TEAM_1)
 			--redalive;
-		else if(self.team == COLOR_TEAM2)
+		else if(self.team == FL_TEAM_2)
 			--bluealive;
-		else if(self.team == COLOR_TEAM3)
+		else if(self.team == FL_TEAM_3)
 			--yellowalive;
-		else if(self.team == COLOR_TEAM4)
+		else if(self.team == FL_TEAM_4)
 			--pinkalive;
 		--totalalive;
 	}
@@ -265,13 +265,13 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerDies)
 {
 	if(self.freezetag_frozen == 0)
 	{
-		if(self.team == COLOR_TEAM1)
+		if(self.team == FL_TEAM_1)
 			--redalive;
-		else if(self.team == COLOR_TEAM2)
+		else if(self.team == FL_TEAM_2)
 			--bluealive;
-		else if(self.team == COLOR_TEAM3)
+		else if(self.team == FL_TEAM_3)
 			--yellowalive;
-		else if(self.team == COLOR_TEAM4)
+		else if(self.team == FL_TEAM_4)
 			--pinkalive;
 		--totalalive;
 
diff --git a/qcsrc/server/mutators/gamemode_keyhunt.qc b/qcsrc/server/mutators/gamemode_keyhunt.qc
index 58d732d7f7..bcf42bbed4 100644
--- a/qcsrc/server/mutators/gamemode_keyhunt.qc
+++ b/qcsrc/server/mutators/gamemode_keyhunt.qc
@@ -40,10 +40,10 @@ float kh_keystatus[17];
 
 float kh_Team_ByID(float t)
 {
-	if(t == 0) return COLOR_TEAM1;
-	if(t == 1) return COLOR_TEAM2;
-	if(t == 2) return COLOR_TEAM3;
-	if(t == 3) return COLOR_TEAM4;
+	if(t == 0) return FL_TEAM_1;
+	if(t == 1) return FL_TEAM_2;
+	if(t == 2) return FL_TEAM_3;
+	if(t == 3) return FL_TEAM_4;
 	return 0;
 }
 
@@ -361,13 +361,13 @@ void kh_Key_AssignTo(entity key, entity player)  // runs every time a key is pic
 			WaypointSprite_AttachCarrier("", player, RADARICON_FLAGCARRIER, colormapPaletteColor(player.team - 1, 0));
 			player.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = kh_KeyCarrier_waypointsprite_visible_for_player;
 			WaypointSprite_UpdateRule(player.waypointsprite_attachedforcarrier, player.team, SPRITERULE_TEAMPLAY);
-			if(player.team == COLOR_TEAM1)
+			if(player.team == FL_TEAM_1)
 				WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, "keycarrier-red", "keycarrier-friend", "keycarrier-red");
-			else if(player.team == COLOR_TEAM2)
+			else if(player.team == FL_TEAM_2)
 				WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, "keycarrier-blue", "keycarrier-friend", "keycarrier-blue");
-			else if(player.team == COLOR_TEAM3)
+			else if(player.team == FL_TEAM_3)
 				WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, "keycarrier-yellow", "keycarrier-friend", "keycarrier-yellow");
-			else if(player.team == COLOR_TEAM4)
+			else if(player.team == FL_TEAM_4)
 				WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, "keycarrier-pink", "keycarrier-friend", "keycarrier-pink");
 			if(!kh_no_radar_circles)
 				WaypointSprite_Ping(player.waypointsprite_attachedforcarrier);
@@ -753,16 +753,16 @@ void kh_Key_Spawn(entity initial_owner, float angle, float i)  // runs every tim
 
 	switch(initial_owner.team)
 	{
-		case COLOR_TEAM1:
+		case FL_TEAM_1:
 			key.netname = "^1red key";
 			break;
-		case COLOR_TEAM2:
+		case FL_TEAM_2:
 			key.netname = "^4blue key";
 			break;
-		case COLOR_TEAM3:
+		case FL_TEAM_3:
 			key.netname = "^3yellow key";
 			break;
-		case COLOR_TEAM4:
+		case FL_TEAM_4:
 			key.netname = "^6pink key";
 			break;
 		default:
diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc
index 808d1a29b3..433d781fb9 100644
--- a/qcsrc/server/mutators/gamemode_nexball.qc
+++ b/qcsrc/server/mutators/gamemode_nexball.qc
@@ -424,28 +424,28 @@ void nb_spawnteams(void)
 	{
 		switch(e.team)
 		{
-		case COLOR_TEAM1:
+		case FL_TEAM_1:
 			if(!t_r)
 			{
 				nb_spawnteam("Red", e.team-1)   ;
 				t_r = 1;
 			}
 			break;
-		case COLOR_TEAM2:
+		case FL_TEAM_2:
 			if(!t_b)
 			{
 				nb_spawnteam("Blue", e.team-1)  ;
 				t_b = 1;
 			}
 			break;
-		case COLOR_TEAM3:
+		case FL_TEAM_3:
 			if(!t_y)
 			{
 				nb_spawnteam("Yellow", e.team-1);
 				t_y = 1;
 			}
 			break;
-		case COLOR_TEAM4:
+		case FL_TEAM_4:
 			if(!t_p)
 			{
 				nb_spawnteam("Pink", e.team-1)  ;
@@ -575,22 +575,22 @@ void SpawnGoal(void)
 
 void spawnfunc_nexball_redgoal(void)
 {
-	self.team = COLOR_TEAM1;
+	self.team = FL_TEAM_1;
 	SpawnGoal();
 }
 void spawnfunc_nexball_bluegoal(void)
 {
-	self.team = COLOR_TEAM2;
+	self.team = FL_TEAM_2;
 	SpawnGoal();
 }
 void spawnfunc_nexball_yellowgoal(void)
 {
-	self.team = COLOR_TEAM3;
+	self.team = FL_TEAM_3;
 	SpawnGoal();
 }
 void spawnfunc_nexball_pinkgoal(void)
 {
-	self.team = COLOR_TEAM4;
+	self.team = FL_TEAM_4;
 	SpawnGoal();
 }
 
diff --git a/qcsrc/server/mutators/gamemode_onslaught.qc b/qcsrc/server/mutators/gamemode_onslaught.qc
index 060447c39e..70479625aa 100644
--- a/qcsrc/server/mutators/gamemode_onslaught.qc
+++ b/qcsrc/server/mutators/gamemode_onslaught.qc
@@ -163,16 +163,16 @@ void onslaught_updatelinks()
 			}
 			if(l.goalentity.classname == "onslaught_generator")
 			{
-				if(l.goalentity.team == COLOR_TEAM1)
+				if(l.goalentity.team == FL_TEAM_1)
 					l.enemy.isgenneighbor_red = TRUE;
-				else if(l.goalentity.team == COLOR_TEAM2)
+				else if(l.goalentity.team == FL_TEAM_2)
 					l.enemy.isgenneighbor_blue = TRUE;
 			}
 			else
 			{
-				if(l.goalentity.team == COLOR_TEAM1)
+				if(l.goalentity.team == FL_TEAM_1)
 					l.enemy.iscpneighbor_red = TRUE;
-				else if(l.goalentity.team == COLOR_TEAM2)
+				else if(l.goalentity.team == FL_TEAM_2)
 					l.enemy.iscpneighbor_blue = TRUE;
 			}
 		}
@@ -185,16 +185,16 @@ void onslaught_updatelinks()
 			}
 			if(l.enemy.classname == "onslaught_generator")
 			{
-				if(l.enemy.team == COLOR_TEAM1)
+				if(l.enemy.team == FL_TEAM_1)
 					l.goalentity.isgenneighbor_red = TRUE;
-				else if(l.enemy.team == COLOR_TEAM2)
+				else if(l.enemy.team == FL_TEAM_2)
 					l.goalentity.isgenneighbor_blue = TRUE;
 			}
 			else
 			{
-				if(l.enemy.team == COLOR_TEAM1)
+				if(l.enemy.team == FL_TEAM_1)
 					l.goalentity.iscpneighbor_red = TRUE;
-				else if(l.enemy.team == COLOR_TEAM2)
+				else if(l.enemy.team == FL_TEAM_2)
 					l.goalentity.iscpneighbor_blue = TRUE;
 			}
 		}
@@ -254,10 +254,10 @@ void onslaught_updatelinks()
 	{
 		if (l.iscaptured)
 		{
-			if (l.team == COLOR_TEAM1) t1 = 1;
-			if (l.team == COLOR_TEAM2) t2 = 1;
-			if (l.team == COLOR_TEAM3) t3 = 1;
-			if (l.team == COLOR_TEAM4) t4 = 1;
+			if (l.team == FL_TEAM_1) t1 = 1;
+			if (l.team == FL_TEAM_2) t2 = 1;
+			if (l.team == FL_TEAM_3) t3 = 1;
+			if (l.team == FL_TEAM_4) t4 = 1;
 		}
 		onslaught_generator_updatesprite(l);
 		l = l.chain;
@@ -271,14 +271,14 @@ void onslaught_updatelinks()
 
 float onslaught_controlpoint_can_be_linked(entity cp, float t)
 {
-	if(t == COLOR_TEAM1)
+	if(t == FL_TEAM_1)
 	{
 		if(cp.isgenneighbor_red)
 			return 2;
 		if(cp.iscpneighbor_red)
 			return 1;
 	}
-	else if(t == COLOR_TEAM2)
+	else if(t == FL_TEAM_2)
 	{
 		if(cp.isgenneighbor_blue)
 			return 2;
@@ -354,7 +354,7 @@ float onslaught_controlpoint_attackable(entity cp, float t)
 		// if there's already an icon built, nothing happens
 		if(cp.team == t)
 		{
-			a = onslaught_controlpoint_can_be_linked(cp, COLOR_TEAM1 + COLOR_TEAM2 - t);
+			a = onslaught_controlpoint_can_be_linked(cp, FL_TEAM_1 + FL_TEAM_2 - t);
 			if(a) // attackable by enemy?
 				return -2; // EMERGENCY!
 			return -1;
@@ -371,7 +371,7 @@ float onslaught_controlpoint_attackable(entity cp, float t)
 		// free point
 		if(onslaught_controlpoint_can_be_linked(cp, t))
 		{
-			a = onslaught_controlpoint_can_be_linked(cp, COLOR_TEAM1 + COLOR_TEAM2 - t);
+			a = onslaught_controlpoint_can_be_linked(cp, FL_TEAM_1 + FL_TEAM_2 - t);
 			if(a == 2)
 				return 4; // GET THIS ONE NOW!
 			else
@@ -706,16 +706,16 @@ string onslaught_generator_waypointsprite_for_team(entity e, float t)
 {
 	if(t == e.team)
 	{
-		if(e.team == COLOR_TEAM1)
+		if(e.team == FL_TEAM_1)
 			return "ons-gen-red";
-		else if(e.team == COLOR_TEAM2)
+		else if(e.team == FL_TEAM_2)
 			return "ons-gen-blue";
 	}
 	if(e.isshielded)
 		return "ons-gen-shielded";
-	if(e.team == COLOR_TEAM1)
+	if(e.team == FL_TEAM_1)
 		return "ons-gen-red";
-	else if(e.team == COLOR_TEAM2)
+	else if(e.team == FL_TEAM_2)
 		return "ons-gen-blue";
 	return "";
 }
@@ -723,8 +723,8 @@ string onslaught_generator_waypointsprite_for_team(entity e, float t)
 void onslaught_generator_updatesprite(entity e)
 {
 	string s1, s2, s3;
-	s1 = onslaught_generator_waypointsprite_for_team(e, COLOR_TEAM1);
-	s2 = onslaught_generator_waypointsprite_for_team(e, COLOR_TEAM2);
+	s1 = onslaught_generator_waypointsprite_for_team(e, FL_TEAM_1);
+	s2 = onslaught_generator_waypointsprite_for_team(e, FL_TEAM_2);
 	s3 = onslaught_generator_waypointsprite_for_team(e, -1);
 	WaypointSprite_UpdateSprites(e.sprite, s1, s2, s3);
 
@@ -734,14 +734,14 @@ void onslaught_generator_updatesprite(entity e)
 		e.lastshielded = e.isshielded;
 		if(e.lastshielded)
 		{
-			if(e.team == COLOR_TEAM1 || e.team == COLOR_TEAM2)
+			if(e.team == FL_TEAM_1 || e.team == FL_TEAM_2)
 				WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(e.team - 1, FALSE));
 			else
 				WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.5 0.5 0.5');
 		}
 		else
 		{
-			if(e.team == COLOR_TEAM1 || e.team == COLOR_TEAM2)
+			if(e.team == FL_TEAM_1 || e.team == FL_TEAM_2)
 				WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(e.team - 1, FALSE));
 			else
 				WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.75 0.75 0.75');
@@ -758,25 +758,25 @@ string onslaught_controlpoint_waypointsprite_for_team(entity e, float t)
 		a = onslaught_controlpoint_attackable(e, t);
 		if(a == 3 || a == 4) // ATTACK/TOUCH THIS ONE NOW
 		{
-			if(e.team == COLOR_TEAM1)
+			if(e.team == FL_TEAM_1)
 				return "ons-cp-atck-red";
-			else if(e.team == COLOR_TEAM2)
+			else if(e.team == FL_TEAM_2)
 				return "ons-cp-atck-blue";
 			else
 				return "ons-cp-atck-neut";
 		}
 		else if(a == -2) // DEFEND THIS ONE NOW
 		{
-			if(e.team == COLOR_TEAM1)
+			if(e.team == FL_TEAM_1)
 				return "ons-cp-dfnd-red";
-			else if(e.team == COLOR_TEAM2)
+			else if(e.team == FL_TEAM_2)
 				return "ons-cp-dfnd-blue";
 		}
 		else if(e.team == t || a == -1 || a == 1) // own point, or fire at it
 		{
-			if(e.team == COLOR_TEAM1)
+			if(e.team == FL_TEAM_1)
 				return "ons-cp-red";
-			else if(e.team == COLOR_TEAM2)
+			else if(e.team == FL_TEAM_2)
 				return "ons-cp-blue";
 		}
 		else if(a == 2) // touch it
@@ -784,9 +784,9 @@ string onslaught_controlpoint_waypointsprite_for_team(entity e, float t)
 	}
 	else
 	{
-		if(e.team == COLOR_TEAM1)
+		if(e.team == FL_TEAM_1)
 			return "ons-cp-red";
-		else if(e.team == COLOR_TEAM2)
+		else if(e.team == FL_TEAM_2)
 			return "ons-cp-blue";
 		else
 			return "ons-cp-neut";
@@ -797,13 +797,13 @@ string onslaught_controlpoint_waypointsprite_for_team(entity e, float t)
 void onslaught_controlpoint_updatesprite(entity e)
 {
 	string s1, s2, s3;
-	s1 = onslaught_controlpoint_waypointsprite_for_team(e, COLOR_TEAM1);
-	s2 = onslaught_controlpoint_waypointsprite_for_team(e, COLOR_TEAM2);
+	s1 = onslaught_controlpoint_waypointsprite_for_team(e, FL_TEAM_1);
+	s2 = onslaught_controlpoint_waypointsprite_for_team(e, FL_TEAM_2);
 	s3 = onslaught_controlpoint_waypointsprite_for_team(e, -1);
 	WaypointSprite_UpdateSprites(e.sprite, s1, s2, s3);
 
 	float sh;
-	sh = !(onslaught_controlpoint_can_be_linked(e, COLOR_TEAM1) || onslaught_controlpoint_can_be_linked(e, COLOR_TEAM2));
+	sh = !(onslaught_controlpoint_can_be_linked(e, FL_TEAM_1) || onslaught_controlpoint_can_be_linked(e, FL_TEAM_2));
 
 	if(e.lastteam != e.team + 2 || e.lastshielded != sh || e.iscaptured != e.lastcaptured)
 	{
@@ -821,14 +821,14 @@ void onslaught_controlpoint_updatesprite(entity e)
 		}
 		if(e.lastshielded)
 		{
-			if(e.team == COLOR_TEAM1 || e.team == COLOR_TEAM2)
+			if(e.team == FL_TEAM_1 || e.team == FL_TEAM_2)
 				WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(e.team - 1, FALSE));
 			else
 				WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.5 0.5 0.5');
 		}
 		else
 		{
-			if(e.team == COLOR_TEAM1 || e.team == COLOR_TEAM2)
+			if(e.team == FL_TEAM_1 || e.team == FL_TEAM_2)
 				WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(e.team - 1, FALSE));
 			else
 				WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.75 0.75 0.75');
@@ -910,10 +910,10 @@ void spawnfunc_onslaught_generator()
 	if (!self.team)
 		objerror("team must be set");
 	
-	if(self.team == COLOR_TEAM1)
+	if(self.team == FL_TEAM_1)
         ons_red_generator = self;
 
-	if(self.team == COLOR_TEAM2)
+	if(self.team == FL_TEAM_2)
         ons_blue_generator = self;
         
 	self.team_saved = self.team;
@@ -948,7 +948,7 @@ void spawnfunc_onslaught_generator()
 	InitializeEntity(self, onslaught_generator_delayed, INITPRIO_LAST);
 
 	WaypointSprite_SpawnFixed(string_null, self.origin + '0 0 128', self, sprite, RADARICON_NONE, '0 0 0');
-	WaypointSprite_UpdateRule(self.sprite, COLOR_TEAM2, SPRITERULE_TEAMPLAY);
+	WaypointSprite_UpdateRule(self.sprite, FL_TEAM_2, SPRITERULE_TEAMPLAY);
 	WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health);
 	WaypointSprite_UpdateHealth(self.sprite, self.health);
 
@@ -988,7 +988,7 @@ void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float
 	if (attacker.classname == "player")
 	{
 		nag = FALSE;
-		if(self.team == COLOR_TEAM1)
+		if(self.team == FL_TEAM_1)
 		{
 			if(time - ons_notification_time_team1 > 10)
 			{
@@ -996,7 +996,7 @@ void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float
 				ons_notification_time_team1 = time;
 			}
 		}
-		else if(self.team == COLOR_TEAM2)
+		else if(self.team == FL_TEAM_2)
 		{
 			if(time - ons_notification_time_team2 > 10)
 			{
@@ -1438,7 +1438,7 @@ void spawnfunc_onslaught_controlpoint()
 	waypoint_spawnforitem(self);
 
 	WaypointSprite_SpawnFixed(string_null, self.origin + '0 0 128', self, sprite, RADARICON_NONE, '0 0 0');
-	WaypointSprite_UpdateRule(self.sprite, COLOR_TEAM2, SPRITERULE_TEAMPLAY);
+	WaypointSprite_UpdateRule(self.sprite, FL_TEAM_2, SPRITERULE_TEAMPLAY);
 
 	onslaught_updatelinks();
 	
@@ -1476,28 +1476,28 @@ void onslaught_link_checkupdate()
 	redpower = bluepower = 0;
 	if(self.goalentity.islinked)
 	{
-		if(self.goalentity.team == COLOR_TEAM1)
+		if(self.goalentity.team == FL_TEAM_1)
 			redpower = 1;
-		else if(self.goalentity.team == COLOR_TEAM2)
+		else if(self.goalentity.team == FL_TEAM_2)
 			bluepower = 1;
 	}
 	if(self.enemy.islinked)
 	{
-		if(self.enemy.team == COLOR_TEAM1)
+		if(self.enemy.team == FL_TEAM_1)
 			redpower = 2;
-		else if(self.enemy.team == COLOR_TEAM2)
+		else if(self.enemy.team == FL_TEAM_2)
 			bluepower = 2;
 	}
 
 	float cc;
 	if(redpower == 1 && bluepower == 2)
-		cc = (COLOR_TEAM1 - 1) * 0x01 + (COLOR_TEAM2 - 1) * 0x10;
+		cc = (FL_TEAM_1 - 1) * 0x01 + (FL_TEAM_2 - 1) * 0x10;
 	else if(redpower == 2 && bluepower == 1)
-		cc = (COLOR_TEAM1 - 1) * 0x10 + (COLOR_TEAM2 - 1) * 0x01;
+		cc = (FL_TEAM_1 - 1) * 0x10 + (FL_TEAM_2 - 1) * 0x01;
 	else if(redpower)
-		cc = (COLOR_TEAM1 - 1) * 0x11;
+		cc = (FL_TEAM_1 - 1) * 0x11;
 	else if(bluepower)
-		cc = (COLOR_TEAM2 - 1) * 0x11;
+		cc = (FL_TEAM_2 - 1) * 0x11;
 	else
 		cc = 0;
 
@@ -1569,10 +1569,10 @@ MUTATOR_HOOKFUNCTION(ons_Spawn_Score)
     
 	RandomSelection_Init();
 	
-	if(self.team == COLOR_TEAM1)
+	if(self.team == FL_TEAM_1)
         RandomSelection_Add(ons_red_generator, 0, string_null, 1, 1);
 	
-	if(self.team == COLOR_TEAM2)
+	if(self.team == FL_TEAM_2)
         RandomSelection_Add(ons_blue_generator, 0, string_null, 1, 1);
 	
 	entity _cp = findchain(classname, "onslaught_controlpoint"):
@@ -1611,7 +1611,7 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn)
     
 	RandomSelection_Init();
     
-	if(self.team == COLOR_TEAM1)
+	if(self.team == FL_TEAM_1)
 	{
 	    if(!_close_to_home)
             _trg_gen = ons_blue_generator;
@@ -1619,7 +1619,7 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn)
             _trg_gen  = ons_red_generator;        
 	}
 	
-	if(self.team == COLOR_TEAM2)
+	if(self.team == FL_TEAM_2)
 	{
 	    if(_close_to_home)
             _trg_gen = ons_blue_generator;
@@ -1664,7 +1664,7 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn)
         if(!autocvar_g_onslaught_spawn_at_generator)
             return 0;
         
-        _trg_gen = ((self.team == COLOR_TEAM1) ? ons_red_generator : ons_blue_generator);
+        _trg_gen = ((self.team == FL_TEAM_1) ? ons_red_generator : ons_blue_generator);
         
         for(i = 0; i < 10; ++i)
         {
diff --git a/qcsrc/server/mutators/mutator_superspec.qc b/qcsrc/server/mutators/mutator_superspec.qc
index 8b6bf05a20..1a7263c909 100644
--- a/qcsrc/server/mutators/mutator_superspec.qc
+++ b/qcsrc/server/mutators/mutator_superspec.qc
@@ -392,9 +392,9 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
 		if(cmd_argc == 2)
 		{
 			if(argv(1) == "red")
-				_team = COLOR_TEAM1;
+				_team = FL_TEAM_1;
 			else
-				_team = COLOR_TEAM2;
+				_team = FL_TEAM_2;
 		}
 
 		FOR_EACH_PLAYER(_player)
diff --git a/qcsrc/server/progs.src b/qcsrc/server/progs.src
index e78c3d9797..cce6849266 100644
--- a/qcsrc/server/progs.src
+++ b/qcsrc/server/progs.src
@@ -13,6 +13,7 @@ sys-post.qh
 ../warpzonelib/server.qh
 
 ../common/constants.qh
+../common/teams.qh
 ../common/util.qh
 ../common/items.qh
 ../common/deathtypes.qh
diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc
index 102dd6a33e..19d613b079 100644
--- a/qcsrc/server/scores.qc
+++ b/qcsrc/server/scores.qc
@@ -200,13 +200,13 @@ void ScoreInfo_Init(float teams)
 		Net_LinkEntity(scores_initialized, FALSE, 0, ScoreInfo_SendEntity);
 	}
 	if(teams >= 1)
-		TeamScore_Spawn(COLOR_TEAM1, "Red");
+		TeamScore_Spawn(FL_TEAM_1, "Red");
 	if(teams >= 2)
-		TeamScore_Spawn(COLOR_TEAM2, "Blue");
+		TeamScore_Spawn(FL_TEAM_2, "Blue");
 	if(teams >= 3)
-		TeamScore_Spawn(COLOR_TEAM3, "Yellow");
+		TeamScore_Spawn(FL_TEAM_3, "Yellow");
 	if(teams >= 4)
-		TeamScore_Spawn(COLOR_TEAM4, "Pink");
+		TeamScore_Spawn(FL_TEAM_4, "Pink");
 }
 
 /*
diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc
index b8f2f3ac87..be6f34a6e0 100644
--- a/qcsrc/server/teamplay.qc
+++ b/qcsrc/server/teamplay.qc
@@ -17,13 +17,13 @@ vector TeamColor(float teem)
 {
 	switch(teem)
 	{
-		case COLOR_TEAM1:
+		case FL_TEAM_1:
 			return '1 0.0625 0.0625';
-		case COLOR_TEAM2:
+		case FL_TEAM_2:
 			return '0.0625 0.0625 1';
-		case COLOR_TEAM3:
+		case FL_TEAM_3:
 			return '1 1 0.0625';
-		case COLOR_TEAM4:
+		case FL_TEAM_4:
 			return '1 0.0625 1';
 		default:
 			return '1 1 1';
@@ -417,13 +417,13 @@ void SetPlayerTeam(entity pl, float t, float s, float noprint)
 	float _color;
 
 	if(t == 4)
-		_color = COLOR_TEAM4 - 1;
+		_color = FL_TEAM_4 - 1;
 	else if(t == 3)
-		_color = COLOR_TEAM3 - 1;
+		_color = FL_TEAM_3 - 1;
 	else if(t == 2)
-		_color = COLOR_TEAM2 - 1;
+		_color = FL_TEAM_2 - 1;
 	else
-		_color = COLOR_TEAM1 - 1;
+		_color = FL_TEAM_1 - 1;
 
 	SetPlayerColors(pl,_color);
 
@@ -453,10 +453,10 @@ void CheckAllowedTeams (entity for_whom)
 		head = findchain(classname, "onslaught_generator");
 		while (head)
 		{
-			if (head.team == COLOR_TEAM1) c1 = 0;
-			if (head.team == COLOR_TEAM2) c2 = 0;
-			if (head.team == COLOR_TEAM3) c3 = 0;
-			if (head.team == COLOR_TEAM4) c4 = 0;
+			if (head.team == FL_TEAM_1) c1 = 0;
+			if (head.team == FL_TEAM_2) c2 = 0;
+			if (head.team == FL_TEAM_3) c3 = 0;
+			if (head.team == FL_TEAM_4) c4 = 0;
 			head = head.chain;
 		}
 	}
@@ -498,13 +498,13 @@ void CheckAllowedTeams (entity for_whom)
 		{
 			if(!(g_domination && head.netname == ""))
 			{
-				if(head.team == COLOR_TEAM1)
+				if(head.team == FL_TEAM_1)
 					c1 = 0;
-				else if(head.team == COLOR_TEAM2)
+				else if(head.team == FL_TEAM_2)
 					c2 = 0;
-				else if(head.team == COLOR_TEAM3)
+				else if(head.team == FL_TEAM_3)
 					c3 = 0;
-				else if(head.team == COLOR_TEAM4)
+				else if(head.team == FL_TEAM_4)
 					c4 = 0;
 			}
 			head = find(head, classname, teament_name);
@@ -534,13 +534,13 @@ void CheckAllowedTeams (entity for_whom)
 	}
 
 	// if player has a forced team, ONLY allow that one
-	if(self.team_forced == COLOR_TEAM1 && c1 >= 0)
+	if(self.team_forced == FL_TEAM_1 && c1 >= 0)
 		c2 = c3 = c4 = -1;
-	else if(self.team_forced == COLOR_TEAM2 && c2 >= 0)
+	else if(self.team_forced == FL_TEAM_2 && c2 >= 0)
 		c1 = c3 = c4 = -1;
-	else if(self.team_forced == COLOR_TEAM3 && c3 >= 0)
+	else if(self.team_forced == FL_TEAM_3 && c3 >= 0)
 		c1 = c2 = c4 = -1;
-	else if(self.team_forced == COLOR_TEAM4 && c4 >= 0)
+	else if(self.team_forced == FL_TEAM_4 && c4 >= 0)
 		c1 = c2 = c3 = -1;
 }
 
@@ -577,7 +577,7 @@ void GetTeamCounts(entity ignore)
 				bvalue = value;
 			else
 				bvalue = 0;
-			if(t == COLOR_TEAM1)
+			if(t == FL_TEAM_1)
 			{
 				if(c1 >= 0)
 				{
@@ -585,7 +585,7 @@ void GetTeamCounts(entity ignore)
 					cb1 = cb1 + bvalue;
 				}
 			}
-			if(t == COLOR_TEAM2)
+			if(t == FL_TEAM_2)
 			{
 				if(c2 >= 0)
 				{
@@ -593,7 +593,7 @@ void GetTeamCounts(entity ignore)
 					cb2 = cb2 + bvalue;
 				}
 			}
-			if(t == COLOR_TEAM3)
+			if(t == FL_TEAM_3)
 			{
 				if(c3 >= 0)
 				{
@@ -601,7 +601,7 @@ void GetTeamCounts(entity ignore)
 					cb3 = cb3 + bvalue;
 				}
 			}
-			if(t == COLOR_TEAM4)
+			if(t == FL_TEAM_4)
 			{
 				if(c4 >= 0)
 				{
@@ -770,13 +770,13 @@ float JoinBestTeam(entity pl, float only_return_best, float forcebestteam)
 	// if he's not on a valid team, then let other code put him on the smallest team
 	if(!forcebestteam)
 	{
-		if(     c1 >= 0 && pl.team == COLOR_TEAM1)
+		if(     c1 >= 0 && pl.team == FL_TEAM_1)
 			selectedteam = pl.team;
-		else if(c2 >= 0 && pl.team == COLOR_TEAM2)
+		else if(c2 >= 0 && pl.team == FL_TEAM_2)
 			selectedteam = pl.team;
-		else if(c3 >= 0 && pl.team == COLOR_TEAM3)
+		else if(c3 >= 0 && pl.team == FL_TEAM_3)
 			selectedteam = pl.team;
-		else if(c4 >= 0 && pl.team == COLOR_TEAM4)
+		else if(c4 >= 0 && pl.team == FL_TEAM_4)
 			selectedteam = pl.team;
 		else
 			selectedteam = -1;
@@ -803,19 +803,19 @@ float JoinBestTeam(entity pl, float only_return_best, float forcebestteam)
 		TeamchangeFrags(self);
 		if(smallest == 1)
 		{
-			SetPlayerColors(pl, COLOR_TEAM1 - 1);
+			SetPlayerColors(pl, FL_TEAM_1 - 1);
 		}
 		else if(smallest == 2)
 		{
-			SetPlayerColors(pl, COLOR_TEAM2 - 1);
+			SetPlayerColors(pl, FL_TEAM_2 - 1);
 		}
 		else if(smallest == 3)
 		{
-			SetPlayerColors(pl, COLOR_TEAM3 - 1);
+			SetPlayerColors(pl, FL_TEAM_3 - 1);
 		}
 		else if(smallest == 4)
 		{
-			SetPlayerColors(pl, COLOR_TEAM4 - 1);
+			SetPlayerColors(pl, FL_TEAM_4 - 1);
 		}
 		else
 		{
@@ -845,21 +845,21 @@ void SV_ChangeTeam(float _color)
 	scolor = self.clientcolors & 0x0F;
 	dcolor = _color & 0x0F;
 
-	if(scolor == COLOR_TEAM1 - 1)
+	if(scolor == FL_TEAM_1 - 1)
 		steam = 1;
-	else if(scolor == COLOR_TEAM2 - 1)
+	else if(scolor == FL_TEAM_2 - 1)
 		steam = 2;
-	else if(scolor == COLOR_TEAM3 - 1)
+	else if(scolor == FL_TEAM_3 - 1)
 		steam = 3;
-	else // if(scolor == COLOR_TEAM4 - 1)
+	else // if(scolor == FL_TEAM_4 - 1)
 		steam = 4;
-	if(dcolor == COLOR_TEAM1 - 1)
+	if(dcolor == FL_TEAM_1 - 1)
 		dteam = 1;
-	else if(dcolor == COLOR_TEAM2 - 1)
+	else if(dcolor == FL_TEAM_2 - 1)
 		dteam = 2;
-	else if(dcolor == COLOR_TEAM3 - 1)
+	else if(dcolor == FL_TEAM_3 - 1)
 		dteam = 3;
-	else // if(dcolor == COLOR_TEAM4 - 1)
+	else // if(dcolor == FL_TEAM_4 - 1)
 		dteam = 4;
 
 	CheckAllowedTeams(self);
@@ -948,13 +948,13 @@ void ShufflePlayerOutOfTeam (float source_team)
 	}
 
 	if(source_team == 1)
-		steam = COLOR_TEAM1;
+		steam = FL_TEAM_1;
 	else if(source_team == 2)
-		steam = COLOR_TEAM2;
+		steam = FL_TEAM_2;
 	else if(source_team == 3)
-		steam = COLOR_TEAM3;
+		steam = FL_TEAM_3;
 	else // if(source_team == 4)
-		steam = COLOR_TEAM4;
+		steam = FL_TEAM_4;
 
 	lowest_bot = world;
 	lowest_bot_score = 999999999;
@@ -1073,12 +1073,12 @@ void tdm_spawnteams()
 		numteams = autocvar_g_tdm_teams;
 	numteams = bound(2, numteams, 4);
 
-	tdm_spawnteam("Red", COLOR_TEAM1-1);
-	tdm_spawnteam("Blue", COLOR_TEAM2-1);
+	tdm_spawnteam("Red", FL_TEAM_1-1);
+	tdm_spawnteam("Blue", FL_TEAM_2-1);
 	if(numteams >= 3)
-		tdm_spawnteam("Yellow", COLOR_TEAM3-1);
+		tdm_spawnteam("Yellow", FL_TEAM_3-1);
 	if(numteams >= 4)
-		tdm_spawnteam("Pink", COLOR_TEAM4-1);
+		tdm_spawnteam("Pink", FL_TEAM_4-1);
 }
 
 void tdm_delayedinit()
diff --git a/qcsrc/server/w_minstanex.qc b/qcsrc/server/w_minstanex.qc
index 1f1137e4b8..7a94299eb2 100644
--- a/qcsrc/server/w_minstanex.qc
+++ b/qcsrc/server/w_minstanex.qc
@@ -50,25 +50,25 @@ void W_MinstaNex_Attack (void)
 	{
 	    switch(self.team)
 	    {
-            case COLOR_TEAM1:   // Red
+            case FL_TEAM_1:   // Red
                 if(damage_goodhits)
                     WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
                 else
                     WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
                 break;
-            case COLOR_TEAM2:   // Blue
+            case FL_TEAM_2:   // Blue
                 if(damage_goodhits)
                     WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
                 else
                     WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
                 break;
-            case COLOR_TEAM3:   // Yellow
+            case FL_TEAM_3:   // Yellow
                 if(damage_goodhits)
                     WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
                 else
                     WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
                 break;
-            case COLOR_TEAM4:   // Pink
+            case FL_TEAM_4:   // Pink
                 if(damage_goodhits)
                     WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
                 else
diff --git a/qcsrc/server/w_tuba.qc b/qcsrc/server/w_tuba.qc
index f19a502082..bf6a98eaec 100644
--- a/qcsrc/server/w_tuba.qc
+++ b/qcsrc/server/w_tuba.qc
@@ -180,7 +180,7 @@ float Tuba_GetNote(entity pl, float hittype)
 	// that way, holes in the range of notes are "plugged"
 	if(teamplay)
 	{
-		if(pl.team == COLOR_TEAM2 || pl.team == COLOR_TEAM4)
+		if(pl.team == FL_TEAM_2 || pl.team == FL_TEAM_4)
 			note += 3;
 	}
 	else
-- 
2.39.5