Botpack
Class ChallengeTeamHUD

source: e:\games\UnrealTournament\Botpack\Classes\ChallengeTeamHUD.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.HUD
         |
         +--Botpack.ChallengeHUD
            |
            +--Botpack.ChallengeTeamHUD
Direct Known Subclasses:AssaultHUD, ChallengeCTFHUD, ChallengeDominationHUD

class ChallengeTeamHUD
extends Botpack.ChallengeHUD

//============================================================================= // ChallengeTeamHUD //=============================================================================
Variables
 color AltTeamColor[4]
 int NumOrders
 name OrderNames[16]
 color TeamColor[4]
 Texture TeamIcon[4]


Function Summary
 
simulated
DrawGameSynopsis(Canvas Canvas)
 bool DrawIdentifyInfo(Canvas Canvas)
 void DrawTalkFace(Canvas Canvas, float YPos)
 
simulated
DrawTeam(Canvas Canvas, TeamInfo TI)
 
simulated
HUDSetup(Canvas canvas)
 
simulated
Message(PlayerReplicationInfo PRI, string Msg, name MsgType)
     
// Entry point for string messages.
 
simulated
SetIDColor(Canvas Canvas, int type)



Source Code


00001	//=============================================================================
00002	// ChallengeTeamHUD
00003	//=============================================================================
00004	class ChallengeTeamHUD extends ChallengeHUD;
00005	
00006	#exec TEXTURE IMPORT NAME=I_TeamB FILE=TEXTURES\HUD\TabBluTm.PCX GROUP="Icons" MIPS=OFF FLAGS=2
00007	#exec TEXTURE IMPORT NAME=I_TeamN FILE=TEXTURES\HUD\TabWhiteTm.PCX GROUP="Icons" MIPS=OFF FLAGS=2
00008	#exec TEXTURE IMPORT NAME=I_TeamR FILE=TEXTURES\HUD\TabRedTm.PCX GROUP="Icons" MIPS=OFF FLAGS=2
00009	#exec TEXTURE IMPORT NAME=I_TeamG FILE=TEXTURES\HUD\TabGrnTm.PCX GROUP="Icons" MIPS=OFF FLAGS=2
00010	#exec TEXTURE IMPORT NAME=I_TeamY FILE=TEXTURES\HUD\TabYloTm.PCX GROUP="Icons" MIPS=OFF FLAGS=2
00011	
00012	#exec TEXTURE IMPORT NAME=Static1 FILE=TEXTURES\HUD\Static1.PCX GROUP="Icons" MIPS=OFF
00013	#exec TEXTURE IMPORT NAME=Static2 FILE=TEXTURES\HUD\Static2.PCX GROUP="Icons" MIPS=OFF
00014	#exec TEXTURE IMPORT NAME=Static3 FILE=TEXTURES\HUD\Static3.PCX GROUP="Icons" MIPS=OFF
00015	
00016	var Texture TeamIcon[4];
00017	var() color TeamColor[4];
00018	var() color AltTeamColor[4];
00019	
00020	var() name OrderNames[16];
00021	var() int NumOrders;
00022	
00023	simulated function HUDSetup(canvas canvas)
00024	{
00025		Super.HUDSetup(canvas);
00026		if ( bUseTeamColor && (PawnOwner.PlayerReplicationInfo != None)
00027			&& (PawnOwner.PlayerReplicationInfo.Team < 4) )
00028		{
00029			HUDColor = TeamColor[PawnOwner.PlayerReplicationInfo.Team];
00030			SolidHUDColor = HUDColor;
00031			if ( Level.bHighDetailMode )
00032				HUDColor = Opacity * 0.0625 * HUDColor;
00033		}
00034	}
00035	
00036	simulated function DrawGameSynopsis(Canvas Canvas)
00037	{
00038		local TournamentGameReplicationInfo GRI;
00039		local int i;
00040	
00041		GRI = TournamentGameReplicationInfo(PlayerOwner.GameReplicationInfo);
00042		if ( GRI != None )
00043			for ( i=0 ;i<4; i++ )
00044				DrawTeam(Canvas, GRI.Teams[i]);
00045	}
00046	
00047	simulated function DrawTeam(Canvas Canvas, TeamInfo TI)
00048	{
00049		local float XL, YL;
00050	
00051		if ( (TI != None) && (TI.Size > 0) )
00052		{
00053			Canvas.Font = MyFonts.GetHugeFont( Canvas.ClipX );
00054			Canvas.DrawColor = TeamColor[TI.TeamIndex];
00055			Canvas.SetPos(Canvas.ClipX - 64 * Scale, Canvas.ClipY - (336 + 128 * TI.TeamIndex) * Scale);
00056			Canvas.DrawIcon(TeamIcon[TI.TeamIndex], Scale);
00057			Canvas.StrLen(int(TI.Score), XL, YL);
00058			Canvas.SetPos(Canvas.ClipX - XL - 66 * Scale, Canvas.ClipY - (336 + 128 * TI.TeamIndex) * Scale + ((64 * Scale) - YL)/2 );
00059			Canvas.DrawText(int(TI.Score), false);
00060		}
00061	}
00062	
00063	// Entry point for string messages.
00064	simulated function Message( PlayerReplicationInfo PRI, coerce string Msg, name MsgType )
00065	{
00066		local int i;
00067		local Class<LocalMessage> MessageClass;
00068	
00069		switch (MsgType)
00070		{
00071			case 'Say':
00072				MessageClass = class'SayMessagePlus';
00073				break;
00074			case 'TeamSay':
00075				MessageClass = class'TeamSayMessagePlus';
00076				break;
00077			case 'CriticalEvent':
00078				MessageClass = class'CriticalStringPlus';
00079				LocalizedMessage( MessageClass, 0, None, None, None, Msg );
00080				return;
00081			default:
00082				MessageClass= class'StringMessagePlus';
00083				break;
00084		}
00085		if ( ClassIsChildOf(MessageClass, class'SayMessagePlus') || 
00086					     ClassIsChildOf(MessageClass, class'TeamSayMessagePlus') )
00087		{
00088			FaceTexture = PRI.TalkTexture;
00089			FaceTeam = TeamColor[PRI.Team];
00090			if ( FaceTexture != None )
00091				FaceTime = Level.TimeSeconds + 3;
00092			if ( Msg == "" )
00093				return;
00094		} 
00095	
00096		for (i=0; i<4; i++)
00097		{
00098			if ( ShortMessageQueue[i].Message == None )
00099			{
00100				// Add the message here.
00101				ShortMessageQueue[i].Message = MessageClass;
00102				ShortMessageQueue[i].Switch = 0;
00103				ShortMessageQueue[i].RelatedPRI = PRI;
00104				ShortMessageQueue[i].OptionalObject = None;
00105				ShortMessageQueue[i].EndOfLife = MessageClass.Default.Lifetime + Level.TimeSeconds;
00106				if ( MessageClass.Default.bComplexString )
00107					ShortMessageQueue[i].StringMessage = Msg;
00108				else
00109					ShortMessageQueue[i].StringMessage = MessageClass.Static.AssembleString(self,0,PRI,Msg);
00110				return;
00111			}
00112		}
00113	
00114		// No empty slots.  Force a message out.
00115		for (i=0; i<3; i++)
00116			CopyMessage(ShortMessageQueue[i],ShortMessageQueue[i+1]);
00117	
00118		ShortMessageQueue[3].Message = MessageClass;
00119		ShortMessageQueue[3].Switch = 0;
00120		ShortMessageQueue[3].RelatedPRI = PRI;
00121		ShortMessageQueue[3].OptionalObject = None;
00122		ShortMessageQueue[3].EndOfLife = MessageClass.Default.Lifetime + Level.TimeSeconds;
00123		if ( MessageClass.Default.bComplexString )
00124			ShortMessageQueue[3].StringMessage = Msg;
00125		else
00126			ShortMessageQueue[3].StringMessage = MessageClass.Static.AssembleString(self,0,PRI,Msg);
00127	}
00128	
00129	simulated function SetIDColor( Canvas Canvas, int type )
00130	{
00131		if ( type == 0 )
00132			Canvas.DrawColor = AltTeamColor[IdentifyTarget.Team] * 0.333 * IdentifyFadeTime;
00133		else
00134			Canvas.DrawColor = TeamColor[IdentifyTarget.Team] * 0.333 * IdentifyFadeTime;
00135	
00136	}
00137	
00138	simulated function bool DrawIdentifyInfo(canvas Canvas)
00139	{
00140		local float XL, YL, XOffset, X1;
00141		local Pawn P;
00142	
00143		if ( !Super.DrawIdentifyInfo(Canvas) )
00144			return false;
00145	
00146		Canvas.StrLen("TEST", XL, YL);
00147		if( PawnOwner.PlayerReplicationInfo.Team == IdentifyTarget.Team )
00148		{
00149			P = Pawn(IdentifyTarget.Owner);
00150			Canvas.Font = MyFonts.GetSmallFont(Canvas.ClipX);
00151			if ( P != None )
00152				DrawTwoColorID(Canvas,IdentifyHealth,string(P.Health), (Canvas.ClipY - 256 * Scale) + 1.5 * YL);
00153		}
00154		return true;
00155	}
00156	
00157	function DrawTalkFace(Canvas Canvas, float YPos)
00158	{
00159		if ( !bHideHUD && (PawnOwner.PlayerReplicationInfo != None) && !PawnOwner.PlayerReplicationInfo.bIsSpectator )
00160		{
00161			Canvas.Style = ERenderStyle.STY_Normal;
00162			Canvas.SetPos(FaceAreaOffset, 0);
00163			Canvas.DrawColor = FaceTeam;
00164			Canvas.DrawTile(texture'LadrStatic.Static_a00', YPos + 7*Scale, YPos + 7*Scale, 0, 0, texture'FacePanel1'.USize, texture'FacePanel1'.VSize);
00165			Canvas.DrawColor = WhiteColor;
00166			Canvas.Style = ERenderStyle.STY_Normal;
00167			Canvas.SetPos(FaceAreaOffset + 4*Scale, 4*Scale);
00168			Canvas.DrawTile(FaceTexture, YPos - 1*Scale, YPos - 1*Scale, 0, 0, FaceTexture.USize, FaceTexture.VSize);
00169			Canvas.Style = ERenderStyle.STY_Translucent;
00170			Canvas.DrawColor = FaceColor;
00171			Canvas.SetPos(FaceAreaOffset, 0);
00172			Canvas.DrawTile(texture'LadrStatic.Static_a00', YPos + 7*Scale, YPos + 7*Scale, 0, 0, texture'LadrStatic.Static_a00'.USize, texture'LadrStatic.Static_a00'.VSize);
00173			Canvas.DrawColor = WhiteColor;
00174		}
00175	}
00176	
00177	defaultproperties
00178	{
00179	     TeamIcon(0)=Texture'Botpack.Icons.I_TeamR'
00180	     TeamIcon(1)=Texture'Botpack.Icons.I_TeamB'
00181	     TeamIcon(2)=Texture'Botpack.Icons.I_TeamG'
00182	     TeamIcon(3)=Texture'Botpack.Icons.I_TeamY'
00183	     TeamColor(0)=(R=255)
00184	     TeamColor(1)=(G=128,B=255)
00185	     TeamColor(2)=(G=255)
00186	     TeamColor(3)=(R=255,G=255)
00187	     AltTeamColor(0)=(R=200)
00188	     AltTeamColor(1)=(G=94,B=187)
00189	     AltTeamColor(2)=(G=128)
00190	     AltTeamColor(3)=(R=255,G=255,B=128)
00191	     OrderNames(0)=Defend
00192	     OrderNames(1)=Hold
00193	     OrderNames(2)=Attack
00194	     OrderNames(3)=Follow
00195	     OrderNames(4)=Freelance
00196	     OrderNames(5)=Point
00197	     OrderNames(10)=Attack
00198	     OrderNames(11)=Freelance
00199	     NumOrders=5
00200	     ServerInfoClass=Class'Botpack.ServerInfoTeam'
00201	}

End Source Code