about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/server/gamemodes/zcatch.cpp23
-rw-r--r--src/game/server/gamemodes/zcatch.hpp1
-rw-r--r--src/game/server/player.cpp14
3 files changed, 20 insertions, 18 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);				
diff --git a/src/game/server/gamemodes/zcatch.hpp b/src/game/server/gamemodes/zcatch.hpp
index bf8b026b..2103678c 100644
--- a/src/game/server/gamemodes/zcatch.hpp
+++ b/src/game/server/gamemodes/zcatch.hpp
@@ -22,6 +22,7 @@ class CGameController_zCatch : public IGameController
 	virtual int OnCharacterDeath(class CCharacter *pVictim, class CPlayer *pKiller, int WeaponID);
 	virtual void StartRound();
 	virtual void OnCharacterSpawn(class CCharacter *pChr);
+	virtual void OnPlayerInfoChange(class CPlayer *pP);
 	virtual void EndRound();
 };
 
diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp
index cccff50f..77aa9b38 100644
--- a/src/game/server/player.cpp
+++ b/src/game/server/player.cpp
@@ -183,20 +183,6 @@ void CPlayer::Snap(int SnappingClient)
 
 	if(m_ClientID == SnappingClient)
 		pPlayerInfo->m_Local = 1;
-		
-	/* begin zCatch*/
-	if(GameServer()->m_apPlayers[m_ClientID] && GameServer()->m_pController->IsZCatch() && 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 == m_ClientID)
-				num -= 10;
-		pClientInfo->m_ColorBody = num * 0x010000 + 0xff00;
-		pClientInfo->m_ColorFeet = num * 0x010000 + 0xff00;
-		pClientInfo->m_UseCustomColor = 1;
-	}
-		
-	/* end zCatch*/
 
 	if(m_ClientID == SnappingClient && m_Team == TEAM_SPECTATORS)
 	{