XIIIMP
Class XIIICTFHud

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

class XIIICTFHud
extends XIIIMP.XIIITeamHud

//----------------------------------------------------------- // //-----------------------------------------------------------
Variables
 int FlagState[2]
 Texture FlagTex[2]
 sndFlagDropped, sndFlagScored
 texFlagHold, texFlagDropped


Function Summary
 void PlayerNameDisplay(Canvas C)
     
//____________________________________________________________________



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class XIIICTFHud extends XIIITeamHud;
00005	
00006	var texture texFlagFree, texFlagHold, texFlagDropped;
00007	var int FlagState[2];
00008	var sound sndFlagHold, sndFlagReturn, sndFlagDropped, sndFlagScored;
00009	var texture FlagTex[2];
00010	
00011	//____________________________________________________________________
00012	// ELR
00013	simulated event PostRender( canvas C )
00014	{
00015	    if ( (PlayerOwner == none) || (PlayerOwner.GameReplicationInfo == none) )
00016	    {
00017	      DrawWaitForMPInit(C);
00018	      return; // wait for game initialization/replications
00019	    }
00020	
00021	//    Log("PR SND 0="$XIIIGameReplicationInfo(PlayerOwner.GameReplicationInfo).SoundFlagState0@"SND 1="$XIIIGameReplicationInfo(PlayerOwner.GameReplicationInfo).SoundFlagState1);
00022	    if ( FlagState[0] != XIIIGameReplicationInfo(PlayerOwner.GameReplicationInfo).SoundFlagState0 )
00023	    {
00024	      FlagState[0] = XIIIGameReplicationInfo(PlayerOwner.GameReplicationInfo).SoundFlagState0;
00025	      switch ( FlagState[0] )
00026	      {
00027	        Case -1: // Start/Restart game, don't play any sound
00028	          FlagTex[0] = texFlagFree;
00029	          Log("MP-] FLAG 0 Restart");
00030	          break;
00031	        case 1:
00032	          FlagTex[0] = texFlagFree;
00033	          PlayerOwner.PlayMenu( sndFlagReturn );
00034	          Log("MP-] FLAG 0 Returned");
00035	          break;
00036	        case 2:
00037	          FlagTex[0] = texFlagDropped;
00038	          PlayerOwner.PlayMenu( sndFlagDropped );
00039	          Log("MP-] FLAG 0 Dropped");
00040	          break;
00041	        Case 3:
00042	          FlagTex[0] = texFlagFree;
00043	          PlayerOwner.PlayMenu( sndFlagScored );
00044	          Log("MP-] FLAG 0 Score");
00045	          break;
00046	        Case 4:
00047	          FlagTex[0] = texFlagHold;
00048	          PlayerOwner.PlayMenu( sndFlagHold );
00049	          Log("MP-] FLAG 0 Held");
00050	          break;
00051	
00052	      }
00053	    }
00054	    if ( FlagState[1] != XIIIGameReplicationInfo(PlayerOwner.GameReplicationInfo).SoundFlagState1 )
00055	    {
00056	      FlagState[1] = XIIIGameReplicationInfo(PlayerOwner.GameReplicationInfo).SoundFlagState1;
00057	      switch ( FlagState[1] )
00058	      {
00059	        case -1: // Start/Restart game, don't play any sound
00060	          FlagTex[1] = texFlagFree;
00061	          Log("MP-] FLAG 1 Restart");
00062	          break;
00063	        Case 1:
00064	          FlagTex[1] = texFlagFree;
00065	          PlayerOwner.PlayMenu( sndFlagReturn );
00066	          Log("MP-] FLAG 1 Returned");
00067	          break;
00068	        Case 2:
00069	          FlagTex[1] = texFlagDropped;
00070	          PlayerOwner.PlayMenu( sndFlagDropped );
00071	          Log("MP-] FLAG 1 Dropped");
00072	          break;
00073	        Case 3:
00074	          FlagTex[1] = texFlagFree;
00075	          PlayerOwner.PlayMenu( sndFlagScored );
00076	          Log("MP-] FLAG 1 Score");
00077	          break;
00078	        Case 4:
00079	          FlagTex[1] = texFlagHold;
00080	          PlayerOwner.PlayMenu( sndFlagHold );
00081	          Log("MP-] FLAG 1 Held");
00082	          break;
00083	      }
00084	    }
00085	
00086	    Super.PostRender(C);
00087	}
00088	
00089	//____________________________________________________________________
00090	function PlayerNameDisplay(Canvas C)
00091	{
00092	    local float W,H ;
00093	    local string strScore[2], strFlagState[2];
00094	    local int Score[2], PlayerId;
00095	    local XIIIMPFlag Flag;
00096	    local Controller Ctrl;
00097	    local bool MP,SameTeam;
00098	    local int TempTeamID;
00099	
00100	    UseHugeFont(C);
00101	    C.SpaceX = 0;
00102	    if( ! bInit )
00103	    {
00104	      bInit = true;
00105	      C.StrLen("999", ScoreWidth, ScoreHeight );
00106	      ScoreHeight -= 4;
00107	      ScoreWidth += 4;
00108	      if ( (Level.NetMode != NM_Standalone) || (Level.bLonePlayer) )
00109	        bSplitt = false;
00110	      else
00111	        bSplitt = true;
00112	
00113	
00114	        TempTeamID = -1;
00115	
00116	        for ( Ctrl=Level.ControllerList; Ctrl!=None; Ctrl= Ctrl.NextController )
00117	        {
00118	            if( XIIIMPPlayerController(Ctrl) != none )
00119	            {
00120	                MP = true;
00121	                SameTeam = true;
00122	
00123	                if( TempTeamID == -1 )
00124	                    TempTeamID = Ctrl.PlayerReplicationInfo.Team.TeamIndex;
00125	                else if(  TempTeamID != Ctrl.PlayerReplicationInfo.Team.TeamIndex )
00126	                {
00127	                    SameTeam = false;
00128	                    break;
00129	                }
00130	            }
00131	        }
00132	
00133	        if( MP && SameTeam )
00134	            bSplitt = false;
00135	
00136	          Scoring.UpdateScores();
00137	    }
00138	
00139	    PlayerId = PlayerOwner.PlayerReplicationInfo.Team.TeamIndex;
00140	    Score[0] = PlayerOwner.GameReplicationInfo.Teams[ 0 ].Score;
00141	    strScore[0] = string( Score[0] );
00142	    Score[1] = PlayerOwner.GameReplicationInfo.Teams[ 1 ].Score;
00143	    strScore[1] = string( Score[1] );
00144	
00145	    C.bUseBorder = false;
00146	    C.Style = ERenderStyle.STY_Alpha;
00147	
00148	    // background team 0
00149	
00150	    C.DrawColor = TeamColor[0];
00151	    C.DrawColor.A = 200;
00152	    C.SetPos( XP, YP);
00153	    C.DrawRect(RoundBackGroundTex, ScoreHeight,ScoreHeight);
00154	    C.DrawRect(FondMsg, ScoreWidth +ScoreHeight + 4,ScoreHeight);
00155	
00156	    // background team 1
00157	
00158	    C.DrawColor = TeamColor[1];
00159	    C.DrawColor.A = 200;
00160	    C.SetPos( XP + ScoreHeight +ScoreWidth+4+ScoreHeight+4 , YP);
00161	    C.DrawRect(FondMsg, ScoreWidth +ScoreHeight + 4,ScoreHeight);
00162	    C.DrawTile(RoundBackGroundTex, ScoreHeight,ScoreHeight, 0, 0, -RoundBackGroundTex.USize, RoundBackGroundTex.VSize);
00163	
00164	    C.bTextShadow = true;
00165	
00166	    // Info Team 0
00167	    C.StrLen(strScore[0], W, H );
00168	
00169	    C.DrawColor = HudBasicColor;
00170	    C.DrawColor.A = 255;
00171	    C.SetPos( XP + ScoreHeight + ScoreWidth/2- W/2, YP-1);
00172	    C.DrawText(strScore[0], false);
00173	
00174	/*
00175	    Flag = XIIIMPFlag(PlayerOwner.GameReplicationInfo.Teams[0].Flag);
00176	
00177	    if ( Flag.bHome )
00178	    {
00179	        TmpTexFlag = texFlagFree;
00180	
00181	        if( FlagState[0] == 4 )
00182	        {
00183	            FlagState[0] = 0;
00184	            PlayerOwner.PlayMenu( sndFlagScored );
00185	        }
00186	        else if( FlagState[0] == 2 )
00187	        {
00188	            FlagState[0] = 0;
00189	            PlayerOwner.PlayMenu( sndFlagReturn );
00190	        }
00191	    }
00192	    else if ( Flag.bHeld )
00193	    {
00194	        TmpTexFlag = texFlagHold;
00195	
00196	        if( ( FlagState[0] == 0 ) || ( FlagState[0] == 2 ) )
00197	        {
00198	            FlagState[0] = 4;
00199	            PlayerOwner.PlayMenu( sndFlagHold );
00200	        }
00201	    }
00202	    else
00203	    {
00204	        TmpTexFlag = texFlagDropped;
00205	
00206	        if( FlagState[0] == 4 )
00207	        {
00208	            FlagState[0] = 2;
00209	            PlayerOwner.PlayMenu( sndFlagDropped );
00210	        }
00211	    }
00212	*/
00213	
00214	
00215	    C.DrawColor = WhiteColor;
00216	    C.DrawColor.A = 255;
00217	    C.SetPos( XP + ScoreHeight + ScoreWidth, YP-1);
00218	    C.DrawTile(FlagTex[0], ScoreHeight,ScoreHeight, 0, 0, FlagTex[0].USize, FlagTex[0].VSize);
00219	
00220	    // Info Team 1
00221	
00222	/*
00223	    Flag = XIIIMPFlag(PlayerOwner.GameReplicationInfo.Teams[1].Flag);
00224	
00225	    if ( Flag.bHome )
00226	        TmpTexFlag = texFlagFree;
00227	    else if ( Flag.bHeld )
00228	        TmpTexFlag = texFlagHold;
00229	    else
00230	        TmpTexFlag = texFlagDropped;
00231	
00232	
00233	    if ( Flag.bHome )
00234	    {
00235	        TmpTexFlag = texFlagFree;
00236	
00237	        if( FlagState[1] == 4 )
00238	        {
00239	            FlagState[1] = 0;
00240	            PlayerOwner.PlayMenu( sndFlagScored );
00241	        }
00242	        else if( FlagState[1] == 2 )
00243	        {
00244	            FlagState[1] = 0;
00245	            PlayerOwner.PlayMenu( sndFlagReturn );
00246	        }
00247	    }
00248	    else if ( Flag.bHeld )
00249	    {
00250	        TmpTexFlag = texFlagHold;
00251	
00252	        if( ( FlagState[1] == 0 ) || ( FlagState[1] == 2 ) )
00253	        {
00254	            FlagState[1] = 4;
00255	            PlayerOwner.PlayMenu( sndFlagHold );
00256	        }
00257	    }
00258	    else
00259	    {
00260	        TmpTexFlag = texFlagDropped;
00261	
00262	        if( FlagState[1] == 4 )
00263	        {
00264	            FlagState[1] = 2;
00265	            PlayerOwner.PlayMenu( sndFlagDropped );
00266	        }
00267	    }
00268	*/
00269	
00270	
00271	    C.DrawColor = WhiteColor;
00272	    C.DrawColor.A = 255;
00273	//    C.SetPos( XP + ScoreHeight +ScoreWidth+4+ScoreHeight+4+4, YP-1);
00274	    C.SetPos( XP + ScoreHeight*2+ScoreWidth+12, YP-1);
00275	    C.DrawTile(FlagTex[1], ScoreHeight,ScoreHeight, 0, 0, FlagTex[1].USize, FlagTex[1].VSize);
00276	
00277	    C.StrLen(strScore[1], W, H );
00278	    C.DrawColor = HudBasicColor;
00279	    C.DrawColor.A = 255;
00280	//    C.SetPos( XP + ScoreHeight +ScoreWidth+4+ScoreHeight+4+    ScoreWidth +ScoreHeight + 4 - ScoreWidth/2- W/2, YP-1);
00281	    C.SetPos( XP + ScoreHeight*3 +ScoreWidth*1.5 +12 -W/2, YP-1);
00282	    C.DrawText(strScore[1], false);
00283	
00284	    C.bTextShadow = false;
00285	
00286	    if( OldScore != XIIIPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo).MyDeathScore )
00287	    {
00288	        FragCount=XIIIPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo).MyDeathScore-OldScore;
00289	
00290	        if( FragCount > 0 )
00291	        {
00292	            SetTimer2( 2.0, true );
00293	            PlayerOwner.PlayMenu( SndFrag );
00294	            LastFragTime=Level.TimeSeconds;
00295	        }
00296	        else
00297	            FragCount = 0;
00298	    }
00299	
00300	    OldScore = XIIIPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo).MyDeathScore;
00301	
00302	    if( FragCount != 0 )
00303	        DrawFrag(C);
00304	
00305	    MarioBonusDisplay(C);
00306	}
00307	
00308	//____________________________________________________________________
00309	
00310	
00311	
00312	defaultproperties
00313	{
00314	     texFlagFree=Texture'XIIIMenu.HUD.mul_flagsimple'
00315	     texFlagHold=Texture'XIIIMenu.HUD.mul_flagpris'
00316	     texFlagDropped=Texture'XIIIMenu.HUD.mul_flaglost'
00317	     FlagState(0)=3
00318	     FlagState(1)=3
00319	     sndFlagHold=Sound'XIIIsound.Multi__SFXMulti.SFXMulti__hFlagToken'
00320	     sndFlagReturn=Sound'XIIIsound.Multi__SFXMulti.SFXMulti__hFlagBack'
00321	     sndFlagDropped=Sound'XIIIsound.Multi__SFXMulti.SFXMulti__hFlagDrop'
00322	     sndFlagScored=Sound'XIIIsound.Multi__SFXMulti.SFXMulti__hScoreFlag'
00323	     FlagTex(0)=Texture'XIIIMenu.HUD.mul_flagsimple'
00324	     FlagTex(1)=Texture'XIIIMenu.HUD.mul_flagsimple'
00325	}

End Source Code