about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-01-03 12:50:38 +0100
committeroy <Tom_Adams@web.de>2011-01-03 12:50:38 +0100
commita72848e78032014adb1bf053c4556bf1072b0c2d (patch)
tree5a9da24803f3432c79229b87abe77b6235668e19 /src
parentb29b6d0bcff3d22fe5dac3453689fb8d315cf3ee (diff)
downloadzcatch-a72848e78032014adb1bf053c4556bf1072b0c2d.tar.gz
zcatch-a72848e78032014adb1bf053c4556bf1072b0c2d.zip
added constants for teams by Choupom
Diffstat (limited to 'src')
-rw-r--r--src/game/client/components/chat.cpp18
-rw-r--r--src/game/client/components/hud.cpp12
-rw-r--r--src/game/client/components/items.cpp2
-rw-r--r--src/game/client/components/killmessages.cpp4
-rw-r--r--src/game/client/components/menus_ingame.cpp12
-rw-r--r--src/game/client/components/scoreboard.cpp14
-rw-r--r--src/game/client/gameclient.cpp8
-rw-r--r--src/game/server/entities/character.cpp4
-rw-r--r--src/game/server/gamecontext.cpp8
-rw-r--r--src/game/server/gamecontroller.cpp66
-rw-r--r--src/game/server/gamemodes/ctf.cpp6
-rw-r--r--src/game/server/player.cpp6
12 files changed, 80 insertions, 80 deletions
diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp
index b13eb615..3632b45d 100644
--- a/src/game/client/components/chat.cpp
+++ b/src/game/client/components/chat.cpp
@@ -231,15 +231,15 @@ void CChat::AddLine(int ClientId, int Team, const char *pLine)
 		}
 		else
 		{
-			if(m_pClient->m_aClients[ClientId].m_Team == -1)
-				m_aLines[m_CurrentLine].m_NameColor = -1;
+			if(m_pClient->m_aClients[ClientId].m_Team == TEAM_SPECTATORS)
+				m_aLines[m_CurrentLine].m_NameColor = TEAM_SPECTATORS;
 
 			if(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_Flags&GAMEFLAG_TEAMS)
 			{
-				if(m_pClient->m_aClients[ClientId].m_Team == 0)
-					m_aLines[m_CurrentLine].m_NameColor = 0;
-				else if(m_pClient->m_aClients[ClientId].m_Team == 1)
-					m_aLines[m_CurrentLine].m_NameColor = 1;
+				if(m_pClient->m_aClients[ClientId].m_Team == TEAM_RED)
+					m_aLines[m_CurrentLine].m_NameColor = TEAM_RED;
+				else if(m_pClient->m_aClients[ClientId].m_Team == TEAM_BLUE)
+					m_aLines[m_CurrentLine].m_NameColor = TEAM_BLUE;
 			}
 			
 			str_copy(m_aLines[m_CurrentLine].m_aName, m_pClient->m_aClients[ClientId].m_aName, sizeof(m_aLines[m_CurrentLine].m_aName));
@@ -353,11 +353,11 @@ void CChat::OnRender()
 			TextRender()->TextColor(1.0f, 1.0f, 0.5f, Blend); // system
 		else if(m_aLines[r].m_Team)
 			TextRender()->TextColor(0.45f, 0.9f, 0.45f, Blend); // team message
-		else if(m_aLines[r].m_NameColor == 0)
+		else if(m_aLines[r].m_NameColor == TEAM_RED)
 			TextRender()->TextColor(1.0f, 0.5f, 0.5f, Blend); // red
-		else if(m_aLines[r].m_NameColor == 1)
+		else if(m_aLines[r].m_NameColor == TEAM_BLUE)
 			TextRender()->TextColor(0.7f, 0.7f, 1.0f, Blend); // blue
-		else if(m_aLines[r].m_NameColor == -1)
+		else if(m_aLines[r].m_NameColor == TEAM_SPECTATORS)
 			TextRender()->TextColor(0.75f, 0.5f, 0.75f, Blend); // spectator
 		else
 			TextRender()->TextColor(0.8f, 0.8f, 0.8f, Blend);
diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp
index f7e00edb..1f57558e 100644
--- a/src/game/client/components/hud.cpp
+++ b/src/game/client/components/hud.cpp
@@ -74,10 +74,10 @@ void CHud::RenderScoreHud()
 	if(!(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_GameOver) && (GameFlags&GAMEFLAG_TEAMS))
 	{
 		char aScoreTeam[2][32];
-		str_format(aScoreTeam[0], sizeof(aScoreTeam)/2, "%d", m_pClient->m_Snap.m_pGameobj->m_TeamscoreRed);
-		str_format(aScoreTeam[1], sizeof(aScoreTeam)/2, "%d", m_pClient->m_Snap.m_pGameobj->m_TeamscoreBlue);
-		float aScoreTeamWidth[2] = {TextRender()->TextWidth(0, 14.0f, aScoreTeam[0], -1), TextRender()->TextWidth(0, 14.0f, aScoreTeam[1], -1)};
-		float ScoreWidthMax = max(max(aScoreTeamWidth[0], aScoreTeamWidth[1]), TextRender()->TextWidth(0, 14.0f, "100", -1));
+		str_format(aScoreTeam[TEAM_RED], sizeof(aScoreTeam)/2, "%d", m_pClient->m_Snap.m_pGameobj->m_TeamscoreRed);
+		str_format(aScoreTeam[TEAM_BLUE], sizeof(aScoreTeam)/2, "%d", m_pClient->m_Snap.m_pGameobj->m_TeamscoreBlue);
+		float aScoreTeamWidth[2] = {TextRender()->TextWidth(0, 14.0f, aScoreTeam[TEAM_RED], -1), TextRender()->TextWidth(0, 14.0f, aScoreTeam[TEAM_BLUE], -1)};
+		float ScoreWidthMax = max(max(aScoreTeamWidth[TEAM_RED], aScoreTeamWidth[TEAM_BLUE]), TextRender()->TextWidth(0, 14.0f, "100", -1));
 		float Split = 3.0f;
 		float ImageSize = GameFlags&GAMEFLAG_FLAGS ? 16.0f : Split;
 		
@@ -186,7 +186,7 @@ void CHud::RenderTeambalanceWarning()
 	bool Flash = time_get()/(time_freq()/2)%2 == 0;
 	if (m_pClient->m_Snap.m_pGameobj && (m_pClient->m_Snap.m_pGameobj->m_Flags&GAMEFLAG_TEAMS) != 0)
 	{	
-		int TeamDiff = m_pClient->m_Snap.m_aTeamSize[0]-m_pClient->m_Snap.m_aTeamSize[1];
+		int TeamDiff = m_pClient->m_Snap.m_aTeamSize[TEAM_RED]-m_pClient->m_Snap.m_aTeamSize[TEAM_BLUE];
 		if (g_Config.m_ClWarningTeambalance && (TeamDiff >= 2 || TeamDiff <= -2))
 		{
 			const char *pText = Localize("Please balance teams!");
@@ -317,7 +317,7 @@ void CHud::OnRender()
 	m_Width = 300*Graphics()->ScreenAspect();
 
 	bool Spectate = false;
-	if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pLocalInfo->m_Team == -1)
+	if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pLocalInfo->m_Team == TEAM_SPECTATORS)
 		Spectate = true;
 	
 	if(m_pClient->m_Snap.m_pLocalCharacter && !Spectate && !(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_GameOver))
diff --git a/src/game/client/components/items.cpp b/src/game/client/components/items.cpp
index 9d2d27c0..3379378b 100644
--- a/src/game/client/components/items.cpp
+++ b/src/game/client/components/items.cpp
@@ -161,7 +161,7 @@ void CItems::RenderFlag(const CNetObj_Flag *pPrev, const CNetObj_Flag *pCurrent)
 	Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
 	Graphics()->QuadsBegin();
 
-	if(pCurrent->m_Team == 0) // red team
+	if(pCurrent->m_Team == TEAM_RED)
 		RenderTools()->SelectSprite(SPRITE_FLAG_RED);
 	else
 		RenderTools()->SelectSprite(SPRITE_FLAG_BLUE);
diff --git a/src/game/client/components/killmessages.cpp b/src/game/client/components/killmessages.cpp
index 80f0725e..d57d7fd3 100644
--- a/src/game/client/components/killmessages.cpp
+++ b/src/game/client/components/killmessages.cpp
@@ -78,7 +78,7 @@ void CKillMessages::OnRender()
 				Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
 				Graphics()->QuadsBegin();
 
-				if(m_aKillmsgs[r].m_VictimTeam == 0)
+				if(m_aKillmsgs[r].m_VictimTeam == TEAM_RED)
 					RenderTools()->SelectSprite(SPRITE_FLAG_BLUE);
 				else
 					RenderTools()->SelectSprite(SPRITE_FLAG_RED);
@@ -115,7 +115,7 @@ void CKillMessages::OnRender()
 					Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
 					Graphics()->QuadsBegin();
 
-					if(m_aKillmsgs[r].m_KillerTeam == 0)
+					if(m_aKillmsgs[r].m_KillerTeam == TEAM_RED)
 						RenderTools()->SelectSprite(SPRITE_FLAG_BLUE, SPRITE_FLAG_FLIP_X);
 					else
 						RenderTools()->SelectSprite(SPRITE_FLAG_RED, SPRITE_FLAG_FLIP_X);
diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp
index 187a061e..a19961e7 100644
--- a/src/game/client/components/menus_ingame.cpp
+++ b/src/game/client/components/menus_ingame.cpp
@@ -37,40 +37,40 @@ void CMenus::RenderGame(CUIRect MainView)
 
 	if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pGameobj)
 	{
-		if(m_pClient->m_Snap.m_pLocalInfo->m_Team != -1)
+		if(m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_SPECTATORS)
 		{
 			MainView.VSplitLeft(10.0f, &Button, &MainView);
 			MainView.VSplitLeft(120.0f, &Button, &MainView);
 			static int s_SpectateButton = 0;
 			if(DoButton_Menu(&s_SpectateButton, Localize("Spectate"), 0, &Button))
 			{
-				m_pClient->SendSwitchTeam(-1);
+				m_pClient->SendSwitchTeam(TEAM_SPECTATORS);
 				SetActive(false);
 			}
 		}
 		
 		if(m_pClient->m_Snap.m_pGameobj->m_Flags & GAMEFLAG_TEAMS)
 		{
-			if(m_pClient->m_Snap.m_pLocalInfo->m_Team != 0)
+			if(m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_RED)
 			{
 				MainView.VSplitLeft(10.0f, &Button, &MainView);
 				MainView.VSplitLeft(120.0f, &Button, &MainView);
 				static int s_SpectateButton = 0;
 				if(DoButton_Menu(&s_SpectateButton, Localize("Join red"), 0, &Button))
 				{
-					m_pClient->SendSwitchTeam(0);
+					m_pClient->SendSwitchTeam(TEAM_RED);
 					SetActive(false);
 				}
 			}
 
-			if(m_pClient->m_Snap.m_pLocalInfo->m_Team != 1)
+			if(m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_BLUE)
 			{
 				MainView.VSplitLeft(10.0f, &Button, &MainView);
 				MainView.VSplitLeft(120.0f, &Button, &MainView);
 				static int s_SpectateButton = 0;
 				if(DoButton_Menu(&s_SpectateButton, Localize("Join blue"), 0, &Button))
 				{
-					m_pClient->SendSwitchTeam(1);
+					m_pClient->SendSwitchTeam(TEAM_BLUE);
 					SetActive(false);
 				}
 			}
diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp
index 5b17388e..5556861c 100644
--- a/src/game/client/components/scoreboard.cpp
+++ b/src/game/client/components/scoreboard.cpp
@@ -104,7 +104,7 @@ void CScoreboard::RenderSpectators(float x, float y, float w)
 		if(Item.m_Type == NETOBJTYPE_PLAYERINFO)
 		{
 			const CNetObj_PlayerInfo *pInfo = (const CNetObj_PlayerInfo *)pData;
-			if(pInfo->m_Team == -1)
+			if(pInfo->m_Team == TEAM_SPECTATORS)
 			{
 				if(Count)
 					str_append(aBuffer, ", ", sizeof(aBuffer));
@@ -140,7 +140,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
 
 	float tw = TextRender()->TextWidth(0, 48, pTitle, -1);
 
-	if(Team == -1)
+	if(Team == TEAM_SPECTATORS)
 	{
 		TextRender()->Text(0, x+w/2-tw/2, y, 48, pTitle, -1);
 	}
@@ -151,7 +151,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
 		if(m_pClient->m_Snap.m_pGameobj)
 		{
 			char aBuf[128];
-			int Score = Team ? m_pClient->m_Snap.m_pGameobj->m_TeamscoreBlue : m_pClient->m_Snap.m_pGameobj->m_TeamscoreRed;
+			int Score = Team == TEAM_RED ? m_pClient->m_Snap.m_pGameobj->m_TeamscoreRed : m_pClient->m_Snap.m_pGameobj->m_TeamscoreBlue;
 			str_format(aBuf, sizeof(aBuf), "%d", Score);
 			tw = TextRender()->TextWidth(0, 48, aBuf, -1);
 			TextRender()->Text(0, x+w-tw-30, y, 48, aBuf, -1);
@@ -259,7 +259,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
 			Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
 			Graphics()->QuadsBegin();
 
-			if(pInfo->m_Team == 0) RenderTools()->SelectSprite(SPRITE_FLAG_BLUE, SPRITE_FLAG_FLIP_X);
+			if(pInfo->m_Team == TEAM_RED) RenderTools()->SelectSprite(SPRITE_FLAG_BLUE, SPRITE_FLAG_FLIP_X);
 			else RenderTools()->SelectSprite(SPRITE_FLAG_RED, SPRITE_FLAG_FLIP_X);
 			
 			float size = 64.0f;
@@ -308,7 +308,7 @@ void CScoreboard::OnRender()
 	if(m_Active)
 		DoScoreBoard = true;
 		
-	if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pLocalInfo->m_Team != -1)
+	if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_SPECTATORS)
 	{
 		// we are not a spectator, check if we are ead
 		if(!m_pClient->m_Snap.m_pLocalCharacter || m_pClient->m_Snap.m_pLocalCharacter->m_Health < 0)
@@ -354,8 +354,8 @@ void CScoreboard::OnRender()
 			TextRender()->Text(0, Width/2-w/2, 45, 92.0f, pText, -1);
 		}
 		
-		RenderScoreboard(Width/2-w-20, 150.0f, w, 0, Localize("Red team"));
-		RenderScoreboard(Width/2 + 20, 150.0f, w, 1, Localize("Blue team"));
+		RenderScoreboard(Width/2-w-20, 150.0f, w, TEAM_RED, Localize("Red team"));
+		RenderScoreboard(Width/2 + 20, 150.0f, w, TEAM_BLUE, Localize("Blue team"));
 	}
 
 	RenderGoals(Width/2-w/2, 150+750+25, w);
diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp
index 4696bdcd..ceae1b5d 100644
--- a/src/game/client/gameclient.cpp
+++ b/src/game/client/gameclient.cpp
@@ -689,7 +689,7 @@ void CGameClient::OnNewSnapshot()
 
 	// go trough all the items in the snapshot and gather the info we want
 	{
-		m_Snap.m_aTeamSize[0] = m_Snap.m_aTeamSize[1] = 0;
+		m_Snap.m_aTeamSize[TEAM_RED] = m_Snap.m_aTeamSize[TEAM_BLUE] = 0;
 		
 		int Num = Client()->SnapNumItems(IClient::SNAP_CURRENT);
 		for(int i = 0; i < Num; i++)
@@ -750,12 +750,12 @@ void CGameClient::OnNewSnapshot()
 					m_Snap.m_LocalCid = Item.m_Id;
 					m_Snap.m_pLocalInfo = pInfo;
 					
-					if (pInfo->m_Team == -1)
+					if(pInfo->m_Team == TEAM_SPECTATORS)
 						m_Snap.m_Spectate = true;
 				}
 				
 				// calculate team-balance
-				if(pInfo->m_Team != -1)
+				if(pInfo->m_Team != TEAM_SPECTATORS)
 					m_Snap.m_aTeamSize[pInfo->m_Team]++;
 				
 			}
@@ -955,7 +955,7 @@ void CGameClient::CClientData::UpdateRenderInfo()
 	if(g_GameClient.m_Snap.m_pGameobj && g_GameClient.m_Snap.m_pGameobj->m_Flags&GAMEFLAG_TEAMS)
 	{
 		const int TeamColors[2] = {65387, 10223467};
-		if(m_Team >= 0 && m_Team <= 1)
+		if(m_Team >= TEAM_RED && m_Team <= TEAM_BLUE)
 		{
 			m_RenderInfo.m_Texture = g_GameClient.m_pSkins->Get(m_SkinId)->m_ColorTexture;
 			m_RenderInfo.m_ColorBody = g_GameClient.m_pSkins->GetColorV4(TeamColors[m_Team]);
diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp
index e29b778b..e6bb0680 100644
--- a/src/game/server/entities/character.cpp
+++ b/src/game/server/entities/character.cpp
@@ -521,7 +521,7 @@ void CCharacter::OnDirectInput(CNetObj_PlayerInput *pNewInput)
 	mem_copy(&m_LatestPrevInput, &m_LatestInput, sizeof(m_LatestInput));
 	mem_copy(&m_LatestInput, pNewInput, sizeof(m_LatestInput));
 	
-	if(m_NumInputs > 2 && m_pPlayer->GetTeam() != -1)
+	if(m_NumInputs > 2 && m_pPlayer->GetTeam() != TEAM_SPECTATORS)
 	{
 		HandleWeaponSwitch();
 		FireWeapon();
@@ -628,7 +628,7 @@ void CCharacter::TickDefered()
 	if(Events&COREEVENT_HOOK_HIT_NOHOOK) GameServer()->CreateSound(m_Pos, SOUND_HOOK_NOATTACH, Mask);
 
 	
-	if(m_pPlayer->GetTeam() == -1)
+	if(m_pPlayer->GetTeam() == TEAM_SPECTATORS)
 	{
 		m_Pos.x = m_Input.m_TargetX;
 		m_Pos.y = m_Input.m_TargetY;
diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp
index 5834d074..4f494f75 100644
--- a/src/game/server/gamecontext.cpp
+++ b/src/game/server/gamecontext.cpp
@@ -414,7 +414,7 @@ void CGameContext::OnTick()
 				bool aVoteChecked[MAX_CLIENTS] = {0};
 				for(int i = 0; i < MAX_CLIENTS; i++)
 				{
-					if(!m_apPlayers[i] || m_apPlayers[i]->GetTeam() == -1 || aVoteChecked[i])	// don't count in votes by spectators
+					if(!m_apPlayers[i] || m_apPlayers[i]->GetTeam() == TEAM_SPECTATORS || aVoteChecked[i])	// don't count in votes by spectators
 						continue;
 					
 					int ActVote = m_apPlayers[i]->m_Vote;
@@ -513,7 +513,7 @@ void CGameContext::OnClientEnter(int ClientId)
 void CGameContext::OnClientConnected(int ClientId)
 {
 	// Check which team the player should be on
-	const int StartTeam = g_Config.m_SvTournamentMode ? -1 : m_pController->GetAutoTeam(ClientId);
+	const int StartTeam = g_Config.m_SvTournamentMode ? TEAM_SPECTATORS : m_pController->GetAutoTeam(ClientId);
 
 	m_apPlayers[ClientId] = new(ClientId) CPlayer(this, ClientId, StartTeam);
 	//players[client_id].init(client_id);
@@ -595,7 +595,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
 
 		int64 Now = Server()->Tick();
 		p->m_Last_VoteTry = Now;
-		if(p->GetTeam() == -1)
+		if(p->GetTeam() == TEAM_SPECTATORS)
 		{
 			SendChatTarget(ClientId, "Spectators aren't allowed to start a vote.");
 			return;
@@ -732,7 +732,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
 			if(m_pController->CanChangeTeam(p, pMsg->m_Team))
 			{
 				p->m_Last_SetTeam = Server()->Tick();
-				if(p->GetTeam() == -1 || pMsg->m_Team == -1)
+				if(p->GetTeam() == TEAM_SPECTATORS || pMsg->m_Team == TEAM_SPECTATORS)
 					m_VoteUpdate = true;
 				p->SetTeam(pMsg->m_Team);
 				(void)m_pController->CheckTeamBalance();
diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp
index e6f60141..3e8af96c 100644
--- a/src/game/server/gamecontroller.cpp
+++ b/src/game/server/gamecontroller.cpp
@@ -23,8 +23,8 @@ IGameController::IGameController(class CGameContext *pGameServer)
 	m_RoundStartTick = Server()->Tick();
 	m_RoundCount = 0;
 	m_GameFlags = 0;
-	m_aTeamscore[0] = 0;
-	m_aTeamscore[1] = 0;
+	m_aTeamscore[TEAM_RED] = 0;
+	m_aTeamscore[TEAM_BLUE] = 0;
 	m_aMapWish[0] = 0;
 	
 	m_UnbalancedTick = -1;
@@ -81,7 +81,7 @@ bool IGameController::CanSpawn(CPlayer *pPlayer, vec2 *pOutPos)
 	CSpawnEval Eval;
 	
 	// spectators can't spawn
-	if(pPlayer->GetTeam() == -1)
+	if(pPlayer->GetTeam() == TEAM_SPECTATORS)
 		return false;
 	
 	if(IsTeamplay())
@@ -174,9 +174,9 @@ const char *IGameController::GetTeamName(int Team)
 {
 	if(IsTeamplay())
 	{
-		if(Team == 0)
+		if(Team == TEAM_RED)
 			return "red team";
-		else if(Team == 1)
+		else if(Team == TEAM_BLUE)
 			return "blue team";
 	}
 	else
@@ -198,8 +198,8 @@ void IGameController::StartRound()
 	m_SuddenDeath = 0;
 	m_GameOverTick = -1;
 	GameServer()->m_World.m_Paused = false;
-	m_aTeamscore[0] = 0;
-	m_aTeamscore[1] = 0;
+	m_aTeamscore[TEAM_RED] = 0;
+	m_aTeamscore[TEAM_BLUE] = 0;
 	m_ForceBalanced = false;
 	char aBuf[256];
 	str_format(aBuf, sizeof(aBuf), "start round type='%s' teamplay='%d'", m_pGameType, m_GameFlags&GAMEFLAG_TEAMS);
@@ -303,7 +303,7 @@ void IGameController::OnPlayerInfoChange(class CPlayer *pP)
 	const int aTeamColors[2] = {65387, 10223467};
 	if(IsTeamplay())
 	{
-		if(pP->GetTeam() >= 0 || pP->GetTeam() <= 1)
+		if(pP->GetTeam() >= TEAM_RED && pP->GetTeam() <= TEAM_BLUE)
 		{
 			pP->m_TeeInfos.m_UseCustomColor = 1;
 			pP->m_TeeInfos.m_ColorBody = aTeamColors[pP->GetTeam()];
@@ -412,7 +412,7 @@ void IGameController::Tick()
 		float aPScore[MAX_CLIENTS] = {0.0f};
 		for(int i = 0; i < MAX_CLIENTS; i++)
 		{
-			if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() != -1)
+			if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS)
 			{
 				aT[GameServer()->m_apPlayers[i]->GetTeam()]++;
 				aPScore[i] = GameServer()->m_apPlayers[i]->m_Score*Server()->TickSpeed()*60.0f/
@@ -462,7 +462,7 @@ void IGameController::Tick()
 	{
 		for(int i = 0; i < MAX_CLIENTS; ++i)
 		{
-			if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() != -1 && !Server()->IsAuthed(i))
+			if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS && !Server()->IsAuthed(i))
 			{
 				if(Server()->Tick() > GameServer()->m_apPlayers[i]->m_LastActionTick+g_Config.m_SvInactiveKickTime*Server()->TickSpeed()*60)
 				{
@@ -471,7 +471,7 @@ void IGameController::Tick()
 					case 0:
 						{
 							// move player to spectator
-							GameServer()->m_apPlayers[i]->SetTeam(-1);
+							GameServer()->m_apPlayers[i]->SetTeam(TEAM_SPECTATORS);
 						}
 						break;
 					case 1:
@@ -479,12 +479,12 @@ void IGameController::Tick()
 							// move player to spectator if the reserved slots aren't filled yet, kick him otherwise
 							int Spectators = 0;
 							for(int j = 0; j < MAX_CLIENTS; ++j)
-								if(GameServer()->m_apPlayers[j] && GameServer()->m_apPlayers[j]->GetTeam() == -1)
+								if(GameServer()->m_apPlayers[j] && GameServer()->m_apPlayers[j]->GetTeam() == TEAM_SPECTATORS)
 									++Spectators;
 							if(Spectators >= g_Config.m_SvSpectatorSlots)
 								Server()->Kick(i, "Kicked for inactivity");
 							else
-								GameServer()->m_apPlayers[i]->SetTeam(-1);
+								GameServer()->m_apPlayers[i]->SetTeam(TEAM_SPECTATORS);
 						}
 						break;
 					case 2:
@@ -507,8 +507,8 @@ void IGameController::Tick()
 	{
 		if(IsTeamplay())
 		{
-			Prog = max(Prog, (m_aTeamscore[0]*100)/g_Config.m_SvScorelimit);
-			Prog = max(Prog, (m_aTeamscore[1]*100)/g_Config.m_SvScorelimit);
+			Prog = max(Prog, (m_aTeamscore[TEAM_RED]*100)/g_Config.m_SvScorelimit);
+			Prog = max(Prog, (m_aTeamscore[TEAM_BLUE]*100)/g_Config.m_SvScorelimit);
 		}
 		else
 		{
@@ -556,14 +556,14 @@ void IGameController::Snap(int SnappingClient)
 	if(SnappingClient == -1)
 	{
 		// we are recording a demo, just set the scores
-		pGameObj->m_TeamscoreRed = m_aTeamscore[0];
-		pGameObj->m_TeamscoreBlue = m_aTeamscore[1];
+		pGameObj->m_TeamscoreRed = m_aTeamscore[TEAM_RED];
+		pGameObj->m_TeamscoreBlue = m_aTeamscore[TEAM_BLUE];
 	}
 	else
 	{
 		// TODO: this little hack should be removed
-		pGameObj->m_TeamscoreRed = IsTeamplay() ? m_aTeamscore[0] : GameServer()->m_apPlayers[SnappingClient]->m_Score;
-		pGameObj->m_TeamscoreBlue = m_aTeamscore[1];
+		pGameObj->m_TeamscoreRed = IsTeamplay() ? m_aTeamscore[TEAM_RED] : GameServer()->m_apPlayers[SnappingClient]->m_Score;
+		pGameObj->m_TeamscoreBlue = m_aTeamscore[TEAM_BLUE];
 	}
 }
 
@@ -578,14 +578,14 @@ int IGameController::GetAutoTeam(int Notthisid)
 	{
 		if(GameServer()->m_apPlayers[i] && i != Notthisid)
 		{
-			if(GameServer()->m_apPlayers[i]->GetTeam() == 0 || GameServer()->m_apPlayers[i]->GetTeam() == 1)
+			if(GameServer()->m_apPlayers[i]->GetTeam() >= TEAM_RED && GameServer()->m_apPlayers[i]->GetTeam() <= TEAM_BLUE)
 				aNumplayers[GameServer()->m_apPlayers[i]->GetTeam()]++;
 		}
 	}
 
 	int Team = 0;
 	if(IsTeamplay())
-		Team = aNumplayers[0] > aNumplayers[1] ? 1 : 0;
+		Team = aNumplayers[TEAM_RED] > aNumplayers[TEAM_BLUE] ? TEAM_BLUE : TEAM_RED;
 		
 	if(CanJoinTeam(Team, Notthisid))
 		return Team;
@@ -594,7 +594,7 @@ int IGameController::GetAutoTeam(int Notthisid)
 
 bool IGameController::CanJoinTeam(int Team, int Notthisid)
 {
-	if(Team == -1 || (GameServer()->m_apPlayers[Notthisid] && GameServer()->m_apPlayers[Notthisid]->GetTeam() != -1))
+	if(Team == TEAM_SPECTATORS || (GameServer()->m_apPlayers[Notthisid] && GameServer()->m_apPlayers[Notthisid]->GetTeam() != TEAM_SPECTATORS))
 		return true;
 
 	int aNumplayers[2] = {0,0};
@@ -602,7 +602,7 @@ bool IGameController::CanJoinTeam(int Team, int Notthisid)
 	{
 		if(GameServer()->m_apPlayers[i] && i != Notthisid)
 		{
-			if(GameServer()->m_apPlayers[i]->GetTeam() >= 0 || GameServer()->m_apPlayers[i]->GetTeam() == 1)
+			if(GameServer()->m_apPlayers[i]->GetTeam() >= TEAM_RED && GameServer()->m_apPlayers[i]->GetTeam() <= TEAM_BLUE)
 				aNumplayers[GameServer()->m_apPlayers[i]->GetTeam()]++;
 		}
 	}
@@ -619,7 +619,7 @@ bool IGameController::CheckTeamBalance()
 	for(int i = 0; i < MAX_CLIENTS; i++)
 	{
 		CPlayer *pP = GameServer()->m_apPlayers[i];
-		if(pP && pP->GetTeam() != -1)
+		if(pP && pP->GetTeam() != TEAM_SPECTATORS)
 			aT[pP->GetTeam()]++;
 	}
 	
@@ -645,26 +645,26 @@ bool IGameController::CanChangeTeam(CPlayer *pPlayer, int JoinTeam)
 {
 	int aT[2] = {0, 0};
 	
-	if (!IsTeamplay() || JoinTeam == -1 || !g_Config.m_SvTeambalanceTime)
+	if (!IsTeamplay() || JoinTeam == TEAM_SPECTATORS || !g_Config.m_SvTeambalanceTime)
 		return true;
 	
 	for(int i = 0; i < MAX_CLIENTS; i++)
 	{
 		CPlayer *pP = GameServer()->m_apPlayers[i];
-		if(pP && pP->GetTeam() != -1)
+		if(pP && pP->GetTeam() != TEAM_SPECTATORS)
 			aT[pP->GetTeam()]++;
 	}
 	
 	// simulate what would happen if changed team
 	aT[JoinTeam]++;
-	if (pPlayer->GetTeam() != -1)
+	if (pPlayer->GetTeam() != TEAM_SPECTATORS)
 		aT[JoinTeam^1]--;
 	
 	// there is a player-difference of at least 2
 	if(absolute(aT[0]-aT[1]) >= 2)
 	{
 		// player wants to join team with less players
-		if ((aT[0] < aT[1] && JoinTeam == 0) || (aT[0] > aT[1] && JoinTeam == 1))
+		if ((aT[0] < aT[1] && JoinTeam == TEAM_RED) || (aT[0] > aT[1] && JoinTeam == TEAM_BLUE))
 			return true;
 		else
 			return false;
@@ -711,10 +711,10 @@ void IGameController::DoTeamScoreWincheck()
 	if(m_GameOverTick == -1 && !m_Warmup)
 	{
 		// check score win condition
-		if((g_Config.m_SvScorelimit > 0 && (m_aTeamscore[0] >= g_Config.m_SvScorelimit || m_aTeamscore[1] >= g_Config.m_SvScorelimit)) ||
+		if((g_Config.m_SvScorelimit > 0 && (m_aTeamscore[TEAM_RED] >= g_Config.m_SvScorelimit || m_aTeamscore[TEAM_BLUE] >= g_Config.m_SvScorelimit)) ||
 			(g_Config.m_SvTimelimit > 0 && (Server()->Tick()-m_RoundStartTick) >= g_Config.m_SvTimelimit*Server()->TickSpeed()*60))
 		{
-			if(m_aTeamscore[0] != m_aTeamscore[1])
+			if(m_aTeamscore[TEAM_RED] != m_aTeamscore[TEAM_BLUE])
 				EndRound();
 			else
 				m_SuddenDeath = 1;
@@ -724,9 +724,9 @@ void IGameController::DoTeamScoreWincheck()
 
 int IGameController::ClampTeam(int Team)
 {
-	if(Team < 0) // spectator
-		return -1;
+	if(Team < 0)
+		return TEAM_SPECTATORS;
 	if(IsTeamplay())
 		return Team&1;
-	return  0;
+	return 0;
 }
diff --git a/src/game/server/gamemodes/ctf.cpp b/src/game/server/gamemodes/ctf.cpp
index ad9f8e89..18905dbf 100644
--- a/src/game/server/gamemodes/ctf.cpp
+++ b/src/game/server/gamemodes/ctf.cpp
@@ -22,8 +22,8 @@ bool CGameControllerCTF::OnEntity(int Index, vec2 Pos)
 		return true;
 	
 	int Team = -1;
-	if(Index == ENTITY_FLAGSTAND_RED) Team = 0;
-	if(Index == ENTITY_FLAGSTAND_BLUE) Team = 1;
+	if(Index == ENTITY_FLAGSTAND_RED) Team = TEAM_RED;
+	if(Index == ENTITY_FLAGSTAND_BLUE) Team = TEAM_BLUE;
 	if(Team == -1 || m_apFlags[Team])
 		return false;
 		
@@ -142,7 +142,7 @@ void CGameControllerCTF::Tick()
 			int Num = GameServer()->m_World.FindEntities(F->m_Pos, CFlag::ms_PhysSize, (CEntity**)apCloseCCharacters, MAX_CLIENTS, NETOBJTYPE_CHARACTER);
 			for(int i = 0; i < Num; i++)
 			{
-				if(!apCloseCCharacters[i]->IsAlive() || apCloseCCharacters[i]->GetPlayer()->GetTeam() == -1 || GameServer()->Collision()->IntersectLine(F->m_Pos, apCloseCCharacters[i]->m_Pos, NULL, NULL))
+				if(!apCloseCCharacters[i]->IsAlive() || apCloseCCharacters[i]->GetPlayer()->GetTeam() == TEAM_SPECTATORS || GameServer()->Collision()->IntersectLine(F->m_Pos, apCloseCCharacters[i]->m_Pos, NULL, NULL))
 					continue;
 				
 				if(apCloseCCharacters[i]->GetPlayer()->GetTeam() == F->m_Team)
diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp
index 03d715a4..78e7bd00 100644
--- a/src/game/server/player.cpp
+++ b/src/game/server/player.cpp
@@ -129,10 +129,10 @@ void CPlayer::OnDirectInput(CNetObj_PlayerInput *NewInput)
 	if(Character)
 		Character->OnDirectInput(NewInput);
 
-	if(!Character && m_Team >= 0 && (NewInput->m_Fire&1))
+	if(!Character && m_Team != TEAM_SPECTATORS && (NewInput->m_Fire&1))
 		m_Spawning = true;
 	
-	if(!Character && m_Team == -1)
+	if(!Character && m_Team == TEAM_SPECTATORS)
 		m_ViewPos = vec2(NewInput->m_TargetX, NewInput->m_TargetY);
 
 	// check for activity
@@ -165,7 +165,7 @@ void CPlayer::KillCharacter(int Weapon)
 
 void CPlayer::Respawn()
 {
-	if(m_Team > -1)
+	if(m_Team != TEAM_SPECTATORS)
 		m_Spawning = true;
 }