Project: conqueredcastles
Code Location: http://conqueredcastles.googlecode.com/svn/trunk//trunk
Browse
conqueredcastles --username virance/
Download File
ConGRI.uc
class ConGRI extends UTGameReplicationInfo config (ConqueredCastles);

// Server Side Data
var int ElapsedTimeRoundOffset;

// Client Side Data
var ConPlayerController LocalPlayerController;
var int RemainingRoundTime;

// Data replicated from server to client
var bool bRoundIsOver;
var bool bGameIsOver;
var bool bKingIsDead;
var int ConRespawnTime;
var int ConSiegePhase;
var int RemainingTimeRoundOffset;

var globalconfig int ConRoundLength;
var globalconfig int ConReinforcementPulse;

replication
	{
		if (Role == ROLE_Authority)
			bRoundIsOver, bGameIsOver, bKingIsDead, ConSiegePhase, RemainingTimeRoundOffset, ConRoundLength, ConReinforcementPulse, ConRespawnTime;
	}

simulated Function Timer()
{
	local byte TimerMessageIndex;
	local PlayerController PC;
	
	Super (GameReplicationInfo).Timer(); //Super.Super
	
	if ( WorldInfo.NetMode == NM_Client )
	{
		if ( bWarmupRound && RemainingTime > 0 )
			RemainingTime--;
	}
	
	if ( WorldInfo.NetMode != NM_DedicatedServer && MapVoteTimeRemaining > 0)
	{
		MapVoteTimeRemaining--;
	}
	
	if (bRoundIsOver)
	{
		RemainingRoundTime = 0;
	}
	else
	{
		RemainingRoundTime = Min (300, Max (-1, RemainingTime - RemainingTimeRoundOffset));
	}
	
	// check if we should broadcast a time countdown message, subset of UTGameReplicationInfo otherwise it would become annoying
	if (WorldInfo.NetMode != NM_DedicatedServer && !bRoundIsOver && (bMatchHasBegun || bWarmupRound) && !bStopCountDown && !bMatchIsOver && Winner == None)
	{
		// Kyle: Round timer/message
		switch (RemainingRoundTime)
		{
			case 0:
				if (RemainingTime!=0) TimerMessageIndex = 17; // No double overtime message
				break;
			case 30:
				TimerMessageIndex = 12;
				break;
			default:
				if (RemainingRoundTime <= 5 && RemainingRoundTime > 0)
				{
					TimerMessageIndex = RemainingRoundTime;
				}
				break;
		}
		
		if (TimerMessageIndex != 0)
		{
			foreach LocalPlayerControllers(class'PlayerController', PC)
			{
				PC.ReceiveLocalizedMessage(class'ConTimerMessage', TimerMessageIndex);
			}
		}
	if (ConRespawnTime <= 0) ConRespawnTime = ConReinforcementPulse; else ConRespawnTime--;
	}
	
	// Kyle: Check to see if we should end the round
	ConqueredCastles (WorldInfo.Game).CheckEndSiege();	
}	

DefaultProperties
{
	Name="ConGRI"
	ConRoundLength=180
	ConReinforcementPulse=15
	bRoundIsOver=true
}