//=============================================================================
// ChallengeDominationHUD.
//=============================================================================
class ChallengeDominationHUD expands ChallengeTeamHUD;

// Blue
#exec TEXTURE IMPORT NAME=I_DomB FILE=TEXTURES\HUD\I_DomB.PCX GROUP="Icons" MIPS=OFF
#exec TEXTURE IMPORT NAME=I_DomN FILE=TEXTURES\HUD\I_DomN.PCX GROUP="Icons" MIPS=OFF
#exec TEXTURE IMPORT NAME=I_DomR FILE=TEXTURES\HUD\I_DomR.PCX GROUP="Icons" MIPS=OFF

simulated function PostRender( canvas Canvas )
{
	local int TeamScore;
	local int X, Y;
	local int TempX, TempY;
	local float XL, YL;
	local ControlPoint CP;

	Super.PostRender( Canvas );

	if ((PlayerPawn(Owner).bShowMenu))
		return;

	X = Canvas.ClipX - 32;
	Y = Canvas.ClipY - 128;

	foreach AllActors(class'ControlPoint', CP)
	{
		if (CP.ControllingTeam != None) {
			switch (CP.ControllingTeam.TeamIndex) {
				case 0:
					DrawDOMIcon(Canvas, X, Y, texture'I_DomR', CP);
					break;
				case 1:
					DrawDOMIcon(Canvas, X, Y, texture'I_DomB', CP);
					break;
				case 2:
				case 3:
				default:
					break;
			}
		} else {
			DrawDOMIcon(Canvas, X, Y, texture'I_DomN', None);
		}
		Canvas.Font = Font'WhiteFont';
		Canvas.Style = 1;
		Canvas.SetPos(0, 0);
		Canvas.StrLen(CP.PointName, XL, YL);
		Canvas.SetPos(X - XL - 10, Y + 16 - YL/2);
		Canvas.DrawText(CP.PointName);
		Y -= 32;
	}
}

simulated function DrawDOMIcon(Canvas Canvas, int X, int Y, texture DOMTexture, ControlPoint CP)
{ 
	local float XL, YL;

	Canvas.SetPos(X,Y);
	Canvas.DrawIcon(DOMTexture, 1.0);
	if (CP != None)
		if (CP.ScoreTime > 0)
		{
			Canvas.Font = Font'TinyWhiteFont';
			Canvas.StrLen(CP.ScoreTime, XL, YL);
			Canvas.SetPos(X+29-XL, Y+29-YL);
			Canvas.DrawText(CP.ScoreTime);
		}
}
