about summary refs log tree commit diff
path: root/src/game/server/gamemodes/zcatch.cpp
diff options
context:
space:
mode:
authorTeetime <anton.tsoulos@yahoo.de>2011-10-14 01:17:56 +0200
committerTeetime <anton.tsoulos@yahoo.de>2011-10-14 01:17:56 +0200
commita1be97e2e00a937ad73480d0f5decf19ab5501cc (patch)
tree464f82b363292920c72f68cbcaef20428c9bb6ae /src/game/server/gamemodes/zcatch.cpp
parent35198a95e8d31a39113f16f5104ff0b1a0ec6e9f (diff)
downloadzcatch-a1be97e2e00a937ad73480d0f5decf19ab5501cc.tar.gz
zcatch-a1be97e2e00a937ad73480d0f5decf19ab5501cc.zip
moved code for colorindicator
Diffstat (limited to 'src/game/server/gamemodes/zcatch.cpp')
-rw-r--r--src/game/server/gamemodes/zcatch.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/game/server/gamemodes/zcatch.cpp b/src/game/server/gamemodes/zcatch.cpp
index 3378ad70..1a1b90b3 100644
--- a/src/game/server/gamemodes/zcatch.cpp
+++ b/src/game/server/gamemodes/zcatch.cpp
@@ -58,7 +58,7 @@ int CGameController_zCatch::OnCharacterDeath(class CCharacter *pVictim, class CP
 				GameServer()->m_apPlayers[i]->m_CatchedBy = ZCATCH_NOT_CATCHED;
 				GameServer()->m_apPlayers[i]->SetTeamDirect(GameServer()->m_pController->ClampTeam(1));
 				
-				GameServer()->m_pController->OnPlayerInfoChange(GameServer()->m_apPlayers[i]);
+				OnPlayerInfoChange(GameServer()->m_apPlayers[i]);
 				if(pKiller != pVictim->GetPlayer())
 					pKiller->m_Score++;
 			}
@@ -67,6 +67,20 @@ int CGameController_zCatch::OnCharacterDeath(class CCharacter *pVictim, class CP
 	return 0;
 }
 
+void CGameController_zCatch::OnPlayerInfoChange(class CPlayer *pP)
+{
+	if(g_Config.m_SvColorIndicator)
+	{
+		int num = 161;
+		for(int i = 0; i < MAX_CLIENTS; i++)
+			if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->m_CatchedBy == pP->GetCID())
+				num -= 10;
+		pP->m_TeeInfos.m_ColorBody = num * 0x010000 + 0xff00;
+		pP->m_TeeInfos.m_ColorFeet = num * 0x010000 + 0xff00;
+		pP->m_TeeInfos.m_UseCustomColor = 1;
+	}
+}
+
 void CGameController_zCatch::StartRound()
 {
 	ResetGame();
@@ -88,7 +102,7 @@ void CGameController_zCatch::StartRound()
 			GameServer()->m_apPlayers[i]->m_Deaths = 0;
 			GameServer()->m_apPlayers[i]->m_TicksSpec = 0;
 			GameServer()->m_apPlayers[i]->m_TicksIngame = 0;
-			GameServer()->m_pController->OnPlayerInfoChange(GameServer()->m_apPlayers[i]);
+			OnPlayerInfoChange(GameServer()->m_apPlayers[i]);
 		}
 	}
 	char aBufMsg[256];
@@ -125,7 +139,8 @@ void CGameController_zCatch::OnCharacterSpawn(class CCharacter *pChr)
 			case 4:
 				pChr->GiveWeapon(WEAPON_GRENADE, -1);
 				break;
-			}
+		}
+	OnPlayerInfoChange(pChr->GetPlayer());
 }
 void CGameController_zCatch::EndRound()
 {
@@ -137,7 +152,7 @@ void CGameController_zCatch::EndRound()
 			if(GameServer()->m_apPlayers[i]->m_SpecExplicit == 0)
 			{
 				GameServer()->m_apPlayers[i]->SetTeamDirect(GameServer()->m_pController->ClampTeam(1));
-				GameServer()->m_pController->OnPlayerInfoChange(GameServer()->m_apPlayers[i]);
+				OnPlayerInfoChange(GameServer()->m_apPlayers[i]);
 				
 				char abuf[128];
 				str_format(abuf, sizeof(abuf), "Kills: %d | Deaths: %d", GameServer()->m_apPlayers[i]->m_Kills, GameServer()->m_apPlayers[i]->m_Deaths);