XIIIMP
Class XIIITeamHud

source: C:\XIII\XIIIMP\Classes\XIIITeamHud.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.HUD
         |
         +--XIII.XIIIBaseHud
            |
            +--XIIIMP.XIIIMPHud
               |
               +--XIIIMP.XIIITeamHud
Direct Known Subclasses:XIIIBombHud, XIIICTFHud

class XIIITeamHud
extends XIIIMP.XIIIMPHud

//----------------------------------------------------------- // //-----------------------------------------------------------

Function Summary
 void DrawHUD(Canvas C)
     
//____________________________________________________________________
// ELR Draw HUD
 void PlayerNameDisplay(Canvas C)



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class XIIITeamHud extends XIIIMPHud;
00005	
00006	function PlayerNameDisplay(Canvas C)
00007	{
00008	    local float W,H ;
00009	    local string strScore[2], strFlagState[2];
00010	    local int Score[2], PlayerId;
00011	    local XIIIMPFlag Flag;
00012		local Controller Ctrl;
00013		local bool MP,SameTeam;
00014		local int TempTeamID;
00015	
00016	    UseHugeFont(C);
00017	    C.SpaceX = 0;
00018	    if( ! bInit )
00019	    {
00020	      bInit = true;
00021	      C.StrLen("999", ScoreWidth, ScoreHeight );
00022	      ScoreHeight -= 4;
00023	      ScoreWidth += 4;
00024	      if ( (Level.NetMode != NM_Standalone) || (Level.bLonePlayer) )
00025	        bSplitt = false;
00026	      else
00027	        bSplitt = true;
00028	
00029	
00030	    TempTeamID = -1;
00031	
00032	    for ( Ctrl=Level.ControllerList; Ctrl!=None; Ctrl= Ctrl.NextController )
00033	    {
00034	        if( XIIIMPPlayerController(Ctrl) != none )
00035	        {
00036	            MP = true;
00037	            SameTeam = true;
00038	
00039	            if( TempTeamID == -1 )
00040	                TempTeamID = Ctrl.PlayerReplicationInfo.Team.TeamIndex;
00041	            else if(  TempTeamID != Ctrl.PlayerReplicationInfo.Team.TeamIndex )
00042	            {
00043	                SameTeam = false;
00044	                break;
00045	            }
00046	        }
00047	    }
00048	
00049	    if( MP && SameTeam )
00050	        bSplitt = false;
00051	
00052	      Scoring.UpdateScores();
00053	    }
00054	
00055	    PlayerId = PlayerOwner.PlayerReplicationInfo.Team.TeamIndex;
00056	    Score[0] = PlayerOwner.GameReplicationInfo.Teams[ 0 ].Score;
00057	    strScore[0] = string( Score[0] );
00058	    Score[1] = PlayerOwner.GameReplicationInfo.Teams[ 1 ].Score;
00059	    strScore[1] = string( Score[1] );
00060	
00061	    if (PlayerOwner.GameReplicationInfo.GameClass ~= "XIIIMP.XIIIMPCTFGameInfo")
00062	    {
00063	      Flag = XIIIMPFlag(PlayerOwner.GameReplicationInfo.Teams[0].Flag);
00064	      if ( Flag.bHome )
00065	        strFlagState[0] = "";
00066	      else if ( Flag.bHeld )
00067	        strFlagState[0] = "X";
00068	      else
00069	        strFlagState[0] = "?";
00070	      Flag = XIIIMPFlag(PlayerOwner.GameReplicationInfo.Teams[1].Flag);
00071	      if ( Flag.bHome )
00072	        strFlagState[1] = "";
00073	      else if ( Flag.bHeld )
00074	        strFlagState[1] = "X";
00075	      else
00076	        strFlagState[1] = "?";
00077	    }
00078	
00079	    C.bUseBorder = false;
00080	    C.Style = ERenderStyle.STY_Alpha;
00081	
00082	    if( false )
00083	//    if( bSplitt )
00084	    { // if splitted screen, draw only local self team info
00085	      C.DrawColor = TeamColor[PlayerId];
00086	      C.DrawColor.A = 200;
00087	      C.SetPos( XP, YP);
00088	      DrawStdBackground(C, ScoreHeight, ScoreWidth);
00089	
00090	      C.StrLen(strScore[PlayerId], W, H );
00091	
00092	      C.DrawColor = TeamColor[PlayerId]*0.1;
00093	      C.DrawColor.A = 90;
00094	      C.SetPos( XP + ScoreHeight + ScoreWidth/2- W/2+2 , YP+1 );
00095	      C.DrawText(strScore[PlayerId], false);
00096	
00097	      C.DrawColor = HudBasicColor;
00098	      C.DrawColor.A = 255;
00099	      C.SetPos( XP + ScoreHeight + ScoreWidth/2- W/2, YP-1);
00100	      C.DrawText(strScore[PlayerId], false);
00101	
00102	      if (PlayerOwner.GameReplicationInfo.GameClass ~= "XIIIMP.XIIIMPCTFGameInfo")
00103	      {
00104	        C.StrLen(strFlagState[PlayerId], W, H );
00105	        C.bTextShadow = true;
00106	        C.DrawColor = HudBasicColor;
00107	        C.DrawColor.A = 255;
00108	        C.SetPos( XP + ScoreHeight/2.0- W/2, YP-1);
00109	        C.DrawText(strFlagState[PlayerId], false);
00110	      }
00111	    }
00112	    else
00113	    { // no splitted screen, show info for the two teams
00114	      // background team 0
00115	      C.DrawColor = TeamColor[0];
00116	      C.DrawColor.A = 200;
00117	      C.SetPos( XP, YP);
00118	      C.DrawRect(RoundBackGroundTex, ScoreHeight,ScoreHeight);
00119	      C.DrawRect(FondMsg, ScoreWidth,ScoreHeight);
00120	
00121	      // background team 1
00122	      C.DrawColor = TeamColor[1];
00123	      C.DrawColor.A = 200;
00124	      C.SetPos( XP + ScoreHeight +ScoreWidth+4 , YP);
00125	      C.DrawRect(FondMsg, ScoreWidth,ScoreHeight);
00126	      C.DrawTile(RoundBackGroundTex, ScoreHeight,ScoreHeight, 0, 0, -RoundBackGroundTex.USize, RoundBackGroundTex.VSize);
00127	
00128	      C.bTextShadow = true;
00129	      // Info Team 0
00130	      C.StrLen(strScore[0], W, H );
00131	      C.DrawColor = HudBasicColor;
00132	      C.DrawColor.A = 255;
00133	      C.SetPos( XP + ScoreHeight + ScoreWidth/2- W/2-2, YP-1);
00134	      C.DrawText(strScore[0], false);
00135	
00136	      if (PlayerOwner.GameReplicationInfo.GameClass ~= "XIIIMP.XIIIMPCTFGameInfo")
00137	      {
00138	        C.StrLen(strFlagState[0], W, H );
00139	        C.DrawColor = HudBasicColor;
00140	        C.DrawColor.A = 255;
00141	        C.SetPos( XP + ScoreHeight/2.0- W/2-2, YP-1);
00142	        C.DrawText(strFlagState[0], false);
00143	      }
00144	
00145	      // Info Team 1
00146	      C.StrLen(strScore[1], W, H );
00147	      C.DrawColor = HudBasicColor;
00148	      C.DrawColor.A = 255;
00149	      C.SetPos( XP + ScoreHeight + ScoreWidth+4 + ScoreWidth/2- W/2 +4 -2, YP-1);
00150	      C.DrawText(strScore[1], false);
00151	
00152	      if (PlayerOwner.GameReplicationInfo.GameClass ~= "XIIIMP.XIIIMPCTFGameInfo")
00153	      {
00154	        C.StrLen(strFlagState[1], W, H );
00155	        C.DrawColor = HudBasicColor;
00156	        C.DrawColor.A = 255;
00157	        C.SetPos( XP + ScoreHeight*1.5 + ScoreWidth+4 + ScoreWidth- W/2 +4 -2, YP-1);
00158	        C.DrawText(strFlagState[1], false);
00159	      }
00160	      C.bTextShadow = false;
00161	    }
00162	
00163	    if( OldScore != XIIIPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo).MyDeathScore )
00164	    {
00165	        FragCount=XIIIPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo).MyDeathScore-OldScore;
00166	
00167	        if( FragCount > 0 )
00168	        {
00169	            SetTimer2( 2.0, true );
00170	            PlayerOwner.PlayMenu( SndFrag );
00171	            LastFragTime=Level.TimeSeconds;
00172	        }
00173	        else
00174	            FragCount = 0;
00175	    }
00176	
00177	    OldScore = XIIIPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo).MyDeathScore;
00178	
00179	    if( FragCount != 0 )
00180	        DrawFrag(C);
00181	
00182	    MarioBonusDisplay(C);
00183	}
00184	
00185	//____________________________________________________________________
00186	// ELR Draw HUD
00187	function DrawHUD( canvas C )
00188	{
00189	//    Log("TEAMHUD DrawHud PlayerOwner="$PlayerOwner@"GRI="$PlayerOwner.GameReplicationInfo);
00190	    if ( (PlayerOwner == none) || (PlayerOwner.GameReplicationInfo == none) )
00191	      return; // wait for game initialization/replications
00192	
00193	/* // ELR Useless multiple calls
00194	    HUDSetup( C );
00195	
00196	    // ELR Do show scores if needed.
00197	    if ( XIIIGameReplicationInfo(PlayerOwner.GameReplicationInfo).iGameState != 2 )
00198	    {
00199	      if ( Scoring != None )
00200	      {
00201	        Scoring.OwnerHUD = self;
00202	        if ( (Level.Game == none) || (Level.NetMode != NM_StandAlone) )
00203	          Scoring.ShowScores(C, ViewPortId, 1);
00204	        else
00205	          Scoring.ShowScores(C, ViewPortId, Level.Game.NumPlayers);
00206	        DrawViewPortSeparator(C);
00207	        return;
00208	      }
00209	    }
00210	*/
00211	
00212	    HudBackGroundColor = TeamColor[PlayerOwner.PlayerReplicationInfo.Team.TeamIndex];
00213	    HudBackGroundColor.A = 200;
00214	
00215	    Super.DrawHud(C);
00216	}
00217	
00218	//____________________________________________________________________
00219	simulated function LocalizedMessage( class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject, optional string CriticalString )
00220	{
00221	    if( ( Level.NetMode == NM_StandAlone) && ( ( Level.Game == none ) || ( Level.Game.NumPlayers > 2 ) ) )
00222	    {
00223	      if( ( ( Message == class'XIIIDeathMessage' ) || ( Message == Class'XIIIMPBlueDeathMessage' ) ) || ( Message == class'XIIIMPRedDeathMessage' ) )
00224	        return;
00225	    }
00226	
00227	    if ( Message == class'XIIIEndGameMessage' )
00228	    {
00229	      AddHudEndMessage( Message, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject, CriticalString );
00230	      bHideHud = true;
00231	    }
00232	    else if( ( ( ( ( ( Message == class'XIIIDeathMessage' ) || ( Message == class'XIIIMPCTFMessage') ) || ( Message == class'XIIIMultiMessage' ) ) || ( Message == class'XIIIMPDuckMessage' ) ) || ( Message == Class'XIIIMPBlueDeathMessage' ) ) || ( Message == class'XIIIMPRedDeathMessage' ) )
00233	      AddHudMPMessage( Message, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject, CriticalString );
00234	    else
00235	      AddHudMessage( Message, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject, CriticalString );
00236	}
00237	
00238	
00239	
00240	defaultproperties
00241	{
00242	}

End Source Code