XIDInterf
Class XIIIWindow

source: C:\XIII\XIDInterf\Classes\XIIIWindow.uc
Core.Object
   |
   +--GUI.GUI
      |
      +--GUI.GUIComponent
         |
         +--GUI.GUIMultiComponent
            |
            +--GUI.GUIPage
               |
               +--XIDInterf.XIIIWindow
Direct Known Subclasses:XIIIMenuAudioClientWindow, XIIIMenuBriefingWindow, XIIIMenuCheatClientWindow, XIIIMenuChooseMap, XIIIMenuCompetencesIngame, XIIIMenuConspiracy, XIIIMenuControlsWindow, XIIIMenuCreateProfile, XIIIMenuDifficultyWindow, XIIIMenuDoc1, XIIIMenuDoc10, XIIIMenuDoc11, XIIIMenuDoc12, XIIIMenuDoc2, XIIIMenuDoc3, XIIIMenuDoc4, XIIIMenuDoc5, XIIIMenuDoc6, XIIIMenuDoc7, XIIIMenuDoc8, XIIIMenuDoc9, XIIIMenuDocument, XIIIMenuEnterPasswordWindow, XIIIMenuInGame, XIIIMenuInGameMulti, XIIIMenuInGameMultiKick, XIIIMenuInGameSabotage, XIIIMenuInputPC, XIIIMenuInputPCSubBase, XIIIMenuItemsIngame, XIIIMenuMultiGS, XIIIMenuMultiGSJoinMsgBox, XIIIMenuProfileClient, XIIIMenuSave, XIIIMenuSkill, XIIIMenuStory, XIIIMenuStory2, XIIIMenuStory3, XIIIMenuStory4, XIIIMenuStory5, XIIIMenuStory6, XIIIMenuStory7, XIIIMenuStory8, XIIIMenuVideoClientWindow, XIIIMenuVirtualKeyboard, XIIIMenuYesNoWindow, XIIIMsgBox, XIIIMsgBoxInGame, XIIIMultiViewConfigWindow, XIIIWindowMainMenu, XIIILiveWindow, XIIIMenuAdvancedControlsWindow, XIIIMenuFreeBlock, XIIIMenuInGameControlsWindow, XIIIMenuPressStart, XIIIMultiControlsWindow

class XIIIWindow
extends GUI.GUIPage


Variables
 HighlightColor, DefaultColor
 SaveName[73], DisplayedSaveName[73]
           to be used with save game device
 GoldColor, Grey3Color
 string HelpBarText
           position of the cursor (for pad/key)
 string MyFailureMessage[14]
           to be used with save game device
 int OnMenu
           position of the cursor (for pad/key)
 int ReturnCode
           to be used with save game device
 SafeScreenPourcentageX, SafeScreenPourcentageY
           to be used with save game device
 ChooseText, SaveText
           position of the cursor (for pad/key)
 string Title
           to be used with save game device
 SearchText, UpdateText
           position of the cursor (for pad/key)
 XSize, YSize
           current selected item
 bDoRestartGame, bCenterInGame
           position of the cursor (for pad/key)
 bool bDisplayBar
           to be used with save game device
 bool bPlayingVideo
           position of the cursor (for pad/key)
 bSaving, bSHowUPDATE
           position of the cursor (for pad/key)
 int curSel
           current selected item
 fRatioX, fRatioY
 hMenuOff, hMenuOn
           position of the cursor (for pad/key)
 XIIIRootWindow myRoot
 string sLabel
           current selected item
 string> slList
           to be used with save game device
 slLeft, slTop
           current selected item
 tButton[8], tUpdate
           position of the cursor (for pad/key)

States
CloseMenu, WriteUserConfig

Function Summary
 void AfterPaint(Canvas C, float X, float Y)
 void BeforePaint(Canvas C, float X, float Y)
 void Created()
 void DisplayHelpBar(Canvas C)
 void DrawLabel(Canvas C, XIIILabel myL, optional bool, optional bool, optional bool)
 void DrawStretchedTexture(Canvas C, float X, float Y, float W, float H, Texture Tex, optional float, optional float, optional float, optional float)
 PlayerController GetPlayerOwner()
 void InitComponent(GUIController MyController, GUIComponent MyOwner)
 void InitLabel(out XIIILabel, float xp, float yp, float xs, float ys, string t)
     
//___________________________________________________________________________
// MLK: XIIILabel functions (init & display)
 bool InternalOnDraw(Canvas C)
 bool InternalOnKeyEvent(out byte, out byte, float delta)
 bool InternalOnPreDraw(Canvas C)
 void InternalOnRender(Canvas C)
 void Paint(Canvas C, float X, float Y)
 string ReturnFailureMessage(int ReturnCode)
 void SaveConfigs()
 void ShowWindow()
 void localGetKeyValue(string Pair, out string, out string)
     
//
// Break up a key=value pair into its key and value.
//
 bool localGrabOption(out string, out string)
     
//
// Grab the next option from a string.
//
 string localParseOption(string Options, string InKey, string DefaultVal)
     
/* ParseOption()
 Find an option in the options string and return it.
*/


State CloseMenu Function Summary


State WriteUserConfig Function Summary



Source Code


00001	class XIIIWindow extends GUIPage;
00002	
00003	var XIIIRootWindow myRoot;
00004	var float fScaleTo, fRatioX, fRatioY;
00005	
00006	var color HighlightColor, DefaultColor;
00007	var color RedColor,BlueColor, WhiteColor, BlackColor, GoldColor, Grey3Color;
00008	
00009	var  int       OnMenu;   // position of the cursor (for pad/key)
00010	var bool bForceHelp, bShowRTN, bShowCCL, bShowACC, bShowSEL, bShowRUN, bShowBCK, bShowNXT, bShowSCH, bShowEDT, bShowCHO, bShowDEL, bShowSAV, bSaving, bSHowUPDATE;
00011	var localized string HelpBarText;
00012	var bool bDoQuitGame, bDoRestartGame, bCenterInGame;
00013	var localized string ReturnText, CancelText, AcceptText, SelectText, CurrentText, StartText, BackText, NextText, SearchText, UpdateText;
00014	var localized string EnterText, EscapeText, EditText, DeleteText, ChooseText, SaveText;
00015	
00016	var texture tCancel, tAccept, tButton[8], tUpdate;
00017	
00018	var sound hMenuOff, hMenuOn;
00019	var bool bPlayingVideo;
00020	
00021	var int ReturnCode;       // to be used with save game device
00022	var bool bDisplayBar;
00023	var config float SafeScreenPourcentageX, SafeScreenPourcentageY;
00024	var localized string MyFailureMessage[14];
00025	var string SaveName[73], DisplayedSaveName[73];
00026	
00027	struct XIIIStringList
00028	{
00029	     var string Title;
00030	     var array <localized string> slList;
00031	     var int curSel;     // current selected item
00032	     var float slWidth, slLeft, slTop;
00033	};
00034	
00035	struct XIIILabel
00036	{
00037	    var float XPos, YPos, XSize, YSize;
00038	    var string sLabel;
00039	};
00040	
00041	
00042	
00043	//===================== Utility function to parse a list of options =========================
00044	// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00045	// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00046	//      taken from Gameinfo.uc
00047	// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00048	// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00049	
00050	//
00051	// Grab the next option from a string.
00052	//
00053	function bool localGrabOption( out string Options, out string Result )
00054	{
00055	  if( Left(Options,1)=="?" )
00056	  {
00057	    // Get result.
00058	    Result = Mid(Options,1);
00059	    if( InStr(Result,"?")>=0 )
00060	      Result = Left( Result, InStr(Result,"?") );
00061	
00062	    // Update options.
00063	    Options = Mid(Options,1);
00064	    if( InStr(Options,"?")>=0 )
00065	      Options = Mid( Options, InStr(Options,"?") );
00066	    else
00067	      Options = "";
00068	
00069	    return true;
00070	  }
00071	  else return false;
00072	}
00073	
00074	//
00075	// Break up a key=value pair into its key and value.
00076	//
00077	function localGetKeyValue( string Pair, out string Key, out string Value )
00078	{
00079	  if( InStr(Pair,"=")>=0 )
00080	  {
00081	    Key   = Left(Pair,InStr(Pair,"="));
00082	    Value = Mid(Pair,InStr(Pair,"=")+1);
00083	  }
00084	  else
00085	  {
00086	    Key   = Pair;
00087	    Value = "";
00088	  }
00089	}
00090	
00091	/* ParseOption()
00092	 Find an option in the options string and return it.
00093	*/
00094	function string localParseOption( string Options, string InKey, string DefaultVal )
00095	{
00096		local string Pair, Key, Value,s ;
00097		s="";
00098		while( localGrabOption( Options, Pair ) )
00099		{
00100			localGetKeyValue( Pair, Key, Value );
00101			if( Key ~= InKey )
00102				s = Value;
00103		}
00104		if (s=="")
00105			return DefaultVal;
00106		else
00107			return s;
00108	}
00109	
00110	
00111	function string ReturnFailureMessage(int ReturnCode)
00112	{
00113		if ( ReturnCode >= 200 )
00114		{
00115			switch(ReturnCode)
00116			{
00117			case 200 : // name already exists
00118				return MyFailureMessage[0];
00119				break;
00120			case 201 : // name does not match the format rules
00121				return MyFailureMessage[9];
00122				break;
00123			case 202 : // name contains forbidden substrings
00124				return MyFailureMessage[4];
00125				break;
00126			case 203 : // name is reserved
00127				return MyFailureMessage[5];
00128				break;
00129			case 204 : // password does not match the format rules
00130				return MyFailureMessage[10];
00131				break;
00132			case 205 : // password contains username
00133				return MyFailureMessage[7];
00134				break;
00135			case 206 : // problem with the database
00136				return MyFailureMessage[8];
00137				break;
00138			case 207 : // account is banned
00139				return MyFailureMessage[11];
00140				break;
00141			case 208 : // account is temporarily closed
00142				return MyFailureMessage[12];
00143				break;
00144			case 209 : // account is closed
00145				return MyFailureMessage[13];
00146				break;
00147			}
00148		}
00149		else
00150		{
00151			if (( ReturnCode < 106 ) // array length
00152				&& ( ReturnCode >= 0 ))
00153				return class'MatchMakingManager'.Default.FailureMessages[ReturnCode];
00154			else
00155				return class'MatchMakingManager'.Default.FailureMessages[105];
00156		}
00157	}
00158	
00159	
00160	
00161	
00162	
00163	function InitComponent(GUIController MyController, GUIComponent MyOwner)
00164	{
00165	    OnOpen=ShowWindow;
00166		OnPreDraw = InternalOnPreDraw;
00167	    OnDraw = InternalOnDraw;
00168	    OnRender = InternalOnRender;
00169	    OnKeyEvent=InternalOnKeyEvent;
00170		myRoot = XIIIRootWindow(MyController);
00171	    Created();
00172	    Super.Initcomponent(MyController, MyOwner);
00173	}
00174	
00175	
00176	function Created()
00177	{
00178	    fScaleTo = myRoot.fTextureScaleFactorForConsole;
00179	    tAccept = tButton[myRoot.CurrentPF*2];
00180	    tCancel = tButton[myRoot.CurrentPF*2 + 1];
00181	}
00182	
00183	function GUIComponent CreateControl(class<GUIComponent> CtrlClass, float X, float Y, float W, float H)
00184	{
00185	    local GUIComponent myChild;
00186	
00187	    myChild = new(none) CtrlClass;
00188	    myChild.WinLeft = X / 640.0;
00189	    myChild.WinTop = Y / 480.0;//myRoot.ScreenHeight;
00190	    myChild.WinWidth = W / 640.0;
00191	    myChild.WinHeight = H / 480.0;//myRoot.ScreenHeight;
00192	
00193	    return myChild;
00194	}
00195	
00196	
00197	function ShowWindow()
00198	{
00199	    if (!myRoot.bMapMenu) {
00200	        defaultColor = Grey3Color;
00201	        HighlightColor = BlackColor;
00202	    }
00203	    else {
00204	        DefaultColor = default.DefaultColor;
00205	        HighLightColor = default.HighLightColor;
00206	    }
00207	}
00208	
00209	function BeforePaint(Canvas C, float X, float Y)
00210	{
00211		fRatioX = C.ClipX / 640;
00212		fRatioY = C.ClipY / 480;
00213	
00214	    if (myRoot.bMapMenu || bCenterInGame) {
00215	        fRatioX = FClamp(fRatioX, 0.0, 800/640);
00216	        fRatioY = FClamp(fRatioY, 0.0, 600/480);
00217	    }
00218	
00219	    if (myRoot.GetLevel().LevelAction == LEVACT_Loading)
00220	    {
00221	        myRoot.CloseAll(true);
00222	        myRoot.GotoState('');
00223	    }
00224	}
00225	
00226	
00227	function bool InternalOnPreDraw(Canvas C)
00228	{
00229	    local float nx, ny;
00230	
00231	    if (XIIIPlayerController(GetPlayerOwner()) != none && XIIIPlayerController(GetPlayerOwner()).bRenderPortal)
00232	      return true;
00233	
00234	    nx = 0; ny = 0;
00235	    if (myRoot.bMapMenu || bCenterInGame)
00236	    {
00237	        if (C.ClipX > 800) nx = WinLeft*C.ClipX + (C.ClipX-800)/2;
00238	        if (C.ClipY > 600) ny = WinTop*C.ClipY + (C.ClipY-600)/2;
00239	        C.SetOrigin(nx, ny);
00240	    }
00241	
00242	    C.Font = font'XIIIFonts.PoliceF16';
00243	    //if ((myRoot.bIamInMulti) && (myRoot.GetLevel().NetMode == 0) && (C.SizeX<640)&&(C.SizeY<448))
00244	    //   C.Font = font'XIIIFonts.XIIIConsoleFont';
00245	
00246	    BeforePaint(C, 0, 0);
00247	
00248	    return true;
00249	}
00250	
00251	function bool InternalOnDraw(Canvas C)
00252	{
00253	    local float nx, ny;
00254	
00255	    if (XIIIPlayerController(GetPlayerOwner()) != none && XIIIPlayerController(GetPlayerOwner()).bRenderPortal)
00256	      return true;
00257	
00258	    nx = 0; ny = 0;
00259	    if (myRoot.bMapMenu || bCenterInGame)
00260	    {
00261	        if (C.ClipX > 800) nx = WinLeft*C.ClipX + (C.ClipX-800)/2;
00262	        if (C.ClipY > 600) ny = WinTop*C.ClipY + (C.ClipY-600)/2;
00263	        C.SetOrigin(nx, ny);
00264	    }
00265	
00266	    C.Font = font'XIIIFonts.PoliceF16';
00267	    //if ((myRoot.bIamInMulti) && (myRoot.GetLevel().NetMode == 0) && (C.SizeX<640)&&(C.SizeY<448))
00268	    //   C.Font = font'XIIIFonts.XIIIConsoleFont';
00269	
00270	    C.BorderColor = BlackColor;
00271	    Paint(C, 0, 0);
00272	    return true;
00273	}
00274	
00275	function InternalOnRender(Canvas C)
00276	{
00277	    local float nx, ny;
00278	
00279	    if (XIIIPlayerController(GetPlayerOwner()) != none && XIIIPlayerController(GetPlayerOwner()).bRenderPortal)
00280	      return;
00281	
00282	    nx = 0; ny = 0;
00283	    if (myRoot.bMapMenu || bCenterInGame)
00284	    {
00285	        if (C.ClipX > 800) nx = WinLeft*C.ClipX + (C.ClipX-800)/2;
00286	        if (C.ClipY > 600) ny = WinTop*C.clipY + (C.ClipY-600)/2;
00287	        C.SetOrigin(nx, ny);
00288	    }
00289	
00290	    C.Font = font'XIIIFonts.PoliceF16';
00291	    //if ((myRoot.bIamInMulti) && (myRoot.GetLevel().NetMode == 0) && (C.SizeX<640)&&(C.SizeY<448))
00292	    //   C.Font = font'XIIIFonts.XIIIConsoleFont';
00293	
00294	    AfterPaint(C, 0, 0);
00295	    if (bDisplayBar)
00296	       DisplayHelpBar(C);
00297	
00298		C.Style=1;
00299		if ( SafeScreenPourcentageX!=0 || SafeScreenPourcentageY!=0 )
00300		{
00301			C.DrawLine( C.ClipX*SafeScreenPourcentageX, C.ClipY*SafeScreenPourcentageY, C.ClipX*SafeScreenPourcentageX, C.ClipY*(1-SafeScreenPourcentageY), C.Static.MakeColor(255,0,0) );
00302			C.DrawLine( C.ClipX*(1-SafeScreenPourcentageX), C.ClipY*(1-SafeScreenPourcentageY), C.ClipX*SafeScreenPourcentageX, C.ClipY*(1-SafeScreenPourcentageY), C.Static.MakeColor(255,0,0) );
00303			C.DrawLine( C.ClipX*SafeScreenPourcentageX, C.ClipY*SafeScreenPourcentageY, C.ClipX*(1-SafeScreenPourcentageX), C.ClipY*SafeScreenPourcentageY, C.Static.MakeColor(255,0,0) );
00304			C.DrawLine( C.ClipX*(1-SafeScreenPourcentageX), C.ClipY*(1-SafeScreenPourcentageY), C.ClipX*(1-SafeScreenPourcentageX), C.ClipY*SafeScreenPourcentageY, C.Static.MakeColor(255,0,0) );
00305		}
00306	}
00307	
00308	
00309	function DisplayHelpBar(Canvas C)
00310	{
00311	    LOCAL float W, H, XPos, YPos, BarWidth, XOffset;
00312	//    local float temp;
00313	    LOCAL string myText;
00314		LOCAL int id;
00315	
00316		CONST BarHeight=32;
00317	
00318	    // if many players
00319	    if ( (myRoot.bIamInMulti) && (myRoot.GetLevel().NetMode == 0) && GetPlayerowner().Level.Game.NumPlayers!=1
00320			&& (myRoot.CurrentPF > 0)) //NetMode != 0 means 1 player on the local machine on LAN or Internet
00321	    {
00322			XIIIBaseHud(GetPlayerowner().myHUD).InitViewPortId( C, false );
00323			id = XIIIBaseHud(GetPlayerowner().myHUD).ViewPortId;
00324			if ( GetPlayerowner().Level.Game.NumPlayers==2 )
00325			{
00326				switch ( id )
00327				{
00328				case 0: // en haut
00329					XPos = 30;
00330					BarWidth = C.ClipX-60;
00331					YPos = C.ClipY-BarHeight-10;
00332					break;
00333				case 1: // en bas
00334					XPos = 30;
00335					BarWidth = C.ClipX-60;
00336					YPos = C.ClipY-BarHeight-30;
00337					break;
00338				}
00339			}
00340			else
00341			{
00342				switch ( id )
00343				{
00344				case 0: // haut à gauche
00345					XPos = 30;
00346					BarWidth = C.ClipX-XPos-10;
00347					YPos = C.ClipY-BarHeight-10;
00348					break;
00349				case 1: // haut à droite
00350					XPos = 10;
00351					BarWidth = C.ClipX-XPos-30;
00352					YPos = C.ClipY-BarHeight-10;
00353					break;
00354				case 2: // bas à gauche
00355					XPos = 30;
00356					BarWidth = C.ClipX-XPos-10;
00357					YPos = C.ClipY-BarHeight-30;
00358					break;
00359				case 3: // bas à droite
00360					XPos = 10;
00361					BarWidth = C.ClipX-XPos-30;
00362					YPos = C.ClipY-BarHeight-30;
00363					break;
00364				}
00365			}
00366		}
00367		else
00368		{
00369			id = 0;
00370			XPos = 30;
00371			BarWidth = C.ClipX-XPos-30;
00372			if ( myRoot.CurrentPF==0 ) // PC
00373			{
00374				if ( ( C.ClipX > 800 ) && !(myRoot.bIamInGame) && !(myRoot.bIamInMulti) )
00375				{
00376					YPos = 600 - BarHeight - 6;
00377					BarWidth = 800 - XPos - 30;
00378				}
00379				else
00380					YPos = C.ClipY-BarHeight-6;
00381			}
00382			else // PS2, XBox, Cube
00383				YPos = C.ClipY-BarHeight-30;
00384		}
00385	
00386		if ((myRoot.bMapMenu || bForceHelp))
00387	    {
00388	        C.bUseBorder = true;
00389	        DrawStretchedTexture(C, XPos, YPos, BarWidth, BarHeight, myRoot.FondMenu);
00390	        C.bUseBorder = false;
00391	
00392	        if (bShowSEL || bShowRUN || bShowNXT || bShowACC || bShowSCH || bShowEDT || bShowCHO ) 
00393	        {
00394	            if (myRoot.CurrentPF!=0) 
00395	            {
00396	                DrawStretchedTexture(C, XPos+BarWidth-32+2, YPos + 2, 28, 28, tAccept);
00397	                XOffset = 32;
00398	            }
00399	            else 
00400	            {
00401	                if ( myRoot.CurrentPF == 0 )
00402						C.DrawColor = Grey3Color;
00403					else
00404						C.DrawColor = BlueColor;
00405	                C.TextSize( EnterText, W, H);
00406	                C.SetPos( XPos+BarWidth-W, YPos + (BarHeight-H)*0.5 );
00407	                C.DrawText( EnterText, false);
00408	                XOffset = W+3;
00409	            }
00410	            if (bShowSEL) myText = SelectText;
00411	            if (bShowRUN) myText = StartText;
00412	            if (bShowNXT) myText = NextText;
00413	            if (bShowACC) myText = AcceptText;
00414	            if (bShowSCH) myText = SearchText;
00415				if (bShowEDT) myText = EditText;
00416				if (bShowCHO) myText = ChooseText;
00417	
00418	            C.Textsize(myText, W, H);
00419				C.SetPos( XPos+BarWidth-XOffset-W, YPos + (BarHeight-H)*0.5 );
00420	            if ( myRoot.CurrentPF == 0 )
00421					C.DrawColor = Grey3Color;
00422				else
00423					C.DrawColor = BlackColor; 
00424	            C.DrawText(myText, false);
00425	        }
00426	        if (bShowRTN || bShowCCL || bShowBCK || bShowDEL || bShowSAV) 
00427	        {
00428	            C.DrawColor = WhiteColor;
00429	            if (myRoot.CurrentPF!=0)
00430	            {
00431	                DrawStretchedTexture(C, XPos+2, YPos+2, 28, 28, tCancel);
00432	                XOffset = 32;
00433	            }
00434	            else 
00435	            {
00436	                if ( myRoot.CurrentPF == 0 )
00437						C.DrawColor = Grey3Color;
00438					else
00439						C.DrawColor = RedColor;
00440	                C.TextSize( EscapeText, W, H);
00441	                C.SetPos( XPos, YPos + (BarHeight-H)*0.5 );
00442	                C.DrawText( EscapeText, false);
00443	                XOffset = W+3;
00444	            }
00445	            if (bShowRTN) myText = returnText;
00446	            if (bShowCCL) myText = CancelText;
00447	            if (bShowBCK) myText = BackText;
00448				if (bShowDEL) myText = DeleteText;
00449				if (bShowSAV) myText = SaveText;
00450	
00451	            C.Textsize(myText, W, H);
00452				C.SetPos( XPos+XOffset, YPos + (BarHeight-H)*0.5 );
00453	            if ( myRoot.CurrentPF == 0 )
00454					C.DrawColor = Grey3Color;
00455				else
00456					C.DrawColor = BlackColor; 
00457	            C.DrawText(myText, false);
00458	        }
00459	        if ( bSHowUPDATE )
00460	        {
00461	            myText = UpdateText;
00462	            C.Textsize(myText, W, H);
00463	
00464				XPos = 0.5*C.ClipX-W/2;
00465	            C.DrawColor = WhiteColor;
00466	            DrawStretchedTexture(C, XPos, YPos+2, 28, 28, tUpdate);
00467	            XOffset = 32;
00468	            C.SetPos(XPos+XOffset, YPos + (BarHeight-H)*0.5 );
00469	            if ( myRoot.CurrentPF == 0 )
00470					C.DrawColor = Grey3Color;
00471				else
00472					C.DrawColor = BlackColor;
00473	            C.DrawText(myText, false);
00474	        }
00475	        if ( ( FocusedControl != none ) && ( HelpBarText == "" ) )
00476	        {
00477	            C.Font = font'XIIIFonts.XIIIConsoleFont';
00478	            C.Textsize( FocusedControl.Hint, W, H);
00479				if (( C.ClipX > 800 ) && ( myRoot.CurrentPF == 0 ))
00480					C.SetPos( (800-W)*0.5, YPos + (BarHeight-H)*0.5 );
00481				else
00482					C.SetPos( (C.ClipX-W)*0.5, YPos + (BarHeight-H)*0.5 );
00483	            if ( myRoot.CurrentPF == 0 )
00484					C.DrawColor = Grey3Color;
00485				else
00486					C.DrawColor = BlackColor; //Grey3Color;
00487				C.DrawText( FocusedControl.Hint, false);
00488	            C.Font = font'XIIIFonts.PoliceF16';
00489	        }
00490	        else if ( HelpBarText != "" )
00491	        {
00492	            C.Font = font'XIIIFonts.XIIIConsoleFont';
00493	            C.Textsize( HelpBarText, W, H );
00494	            C.SetPos( (C.ClipX-W)*0.5, YPos + (BarHeight-H)*0.5 );
00495	            C.DrawColor = Grey3Color;
00496				C.DrawText( HelpBarText, false );
00497	            C.Font = font'XIIIFonts.PoliceF16';
00498	        }
00499	        C.DrawColor = WhiteColor;
00500	    }
00501	}
00502	
00503	function Paint(Canvas C, float X, float Y)
00504	{
00505	    C.DrawColor = WhiteColor;
00506	}
00507	
00508	
00509	function AfterPaint(Canvas C, float X, float Y)
00510	{
00511	}
00512	
00513	
00514	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
00515	{
00516	    if ( !bPlayingVideo)
00517		{
00518			if (Key==0x0D) {
00519				if (bShowSEL || bShowRUN || bShowNXT || bShowACC || bShowSCH || bShowEDT || bShowCHO || bShowSAV)
00520					GetPlayerOwner().PlayMenu(hMenuOn);
00521			}
00522			if (Key==0x08) {
00523				if (bShowRTN || bShowCCL || bShowBCK || bShowDEL)
00524					GetPlayerOwner().PlayMenu(hMenuOff);
00525			}
00526			return (Key != 0x73/*IK_F4*/); // as soon as a page is active, eat all the key event, except F4 !
00527		}
00528		return false;
00529	}
00530	
00531	
00532	
00533	final function DrawStretchedTexture( Canvas C, float X, float Y, float W, float H, texture Tex, optional float PosTexX, optional float PosTexY, optional float FactorX, optional float FactorY )
00534	{   // NL - warning the same function exists in XIIIRootWindow (why ??)
00535	    local float OrgX, OrgY, ClipX, ClipY, tW, tH;//, tx, ty;
00536	
00537	    tW = Tex.USize; tH = Tex.VSize;
00538	    OrgX = C.OrgX;
00539	    OrgY = C.OrgY;
00540	    ClipX = C.ClipX;
00541	    ClipY = C.ClipY;
00542	
00543	    C.SetPos(X, Y);
00544		if ( FactorY != 0 )
00545			C.DrawTileClipped( Tex, W*myRoot.GUIScale, H*myRoot.GUIScale, PosTexX, PosTexY, FactorX*(tW - 2*PosTexX), FactorY*(tH - 2*PosTexY));
00546		else
00547			C.DrawTileClipped( Tex, W*myRoot.GUIScale, H*myRoot.GUIScale, 0, 0, tW, tH);
00548	
00549	    C.SetClip(ClipX, ClipY);
00550	    C.SetOrigin(OrgX, OrgY);
00551	}
00552	
00553	
00554	//___________________________________________________________________________
00555	// MLK: XIIILabel functions (init & display)
00556	
00557	function InitLabel(out XIIILabel myL, float xp, float yp, float xs, float ys, string t)
00558	{
00559	    myL.XPos = xp; myL.YPos = yp; myL.XSize = xs; myL.YSize = ys;
00560	    myL.sLabel = t;
00561	}
00562	
00563	function DrawLabel(Canvas C, XIIILabel myL, optional bool bNoCaps, optional bool bTransparency, optional bool bFixWidth )
00564	{
00565	    local float W, H, TextX, TextY;
00566		local float Offset;
00567	
00568		C.StrLen(MyL.sLabel, W, H);
00569	
00570		if ( !bFixWidth )
00571		{
00572			if ((W + 16*fRatioX) > myL.XSize)
00573			{
00574				Offset = W + 16*fRatioX - myL.XSize;
00575				myL.XSize += OffSet;
00576				if ( ( ( myL.XPos - OffSet/2 ) > 30 ) )
00577				{
00578					if ( myL.XPos + myL.XSize > 610 )
00579						myL.XPos -= Offset;
00580					else
00581						myL.XPos -= Offset/2;
00582				}
00583			}
00584		}
00585	    TextX = (myL.Xsize*fRatioX - W) / 2;
00586		TextY = (myL.YSize*fRatioY - H) / 2;
00587	
00588	    C.bUseBorder=true;
00589	/*	if ( bTransparency )
00590		{
00591			C.Style = 5;
00592			C.DrawColor.A = 208;
00593		}*/
00594		C.Style = 1;
00595	    DrawStretchedTexture(C, (myL.XPos+2)*fRatioX, (myL.YPos+2)*fRatioY, (myL.XSize-4)*fRatioX, (myL.YSize-4)*fRatioY, myRoot.FondMenu);
00596	    C.bUseBorder=false;
00597		if(myL.sLabel != "")
00598		{
00599			C.DrawColor = HighlightColor;
00600	        C.SetPos(myL.XPos*fRatioX + TextX, myL.YPos*fRatioY + TextY); C.DrawText(myL.sLabel, false);
00601			C.SetDrawColor(255,255,255);
00602		}
00603		C.Style = 1;
00604	}
00605	
00606	
00607	final function PlayerController GetPlayerOwner()
00608	{
00609		return myRoot.GetPlayerOwner();
00610	}
00611	
00612	
00613	
00614	
00615	function SaveConfigs()
00616	{
00617		if ( bSaving )
00618			return;
00619		bSaving=true;
00620	    SaveConfig();
00621	    if (GetPlayerOwner() != none)
00622	    {
00623	        GetPlayerOwner().SaveConfig();
00624	        if (GetPlayerOwner().PlayerReplicationInfo != none) GetPlayerOwner().PlayerReplicationInfo.SaveConfig();
00625	    }
00626	    GotoState('WriteUserConfig');
00627	}
00628	
00629	
00630	State WriteUserConfig
00631	{
00632	Begin:
00633	  if (!MyRoot.RequestWriteUserConfig())
00634	  {
00635	      log("Unable to write use config !");
00636	  }
00637	  else
00638	  {
00639	      while (!MyRoot.IsWriteUserConfigFinished(ReturnCode))
00640	      {
00641	          Sleep(0.1);
00642	      }
00643	      if (ReturnCode < 0)
00644	      {
00645	          log("Failed to write user config !");
00646	      }
00647	      else
00648	      {
00649	          log("user config successfull written");
00650	      }
00651	  }
00652	  GotoState('CloseMenu');
00653	}
00654	
00655	
00656	
00657	State CloseMenu
00658	{
00659	Begin:
00660	  myRoot.CloseMenu(true);
00661	}
00662	
00663	
00664	
00665	
00666	
00667	defaultproperties
00668	{
00669	     HighlightColor=(A=255)
00670	     DefaultColor=(B=255,G=255,R=255,A=255)
00671	     RedColor=(R=255,A=255)
00672	     BlueColor=(B=255,A=255)
00673	     WhiteColor=(B=255,G=255,R=255,A=255)
00674	     BlackColor=(A=255)
00675	     GoldColor=(B=71,G=193,R=238,A=255)
00676	     Grey3Color=(B=127,G=127,R=127,A=255)
00677	     ReturnText="Previous"
00678	     CancelText="Cancel"
00679	     AcceptText="Accept"
00680	     SelectText="Select"
00681	     StartText="Start"
00682	     BackText="Back"
00683	     NextText="Next"
00684	     SearchText="Search"
00685	     UpdateText="Update"
00686	     EnterText="Enter"
00687	     EscapeText="Escape"
00688	     EditText="Edit"
00689	     DeleteText="Delete"
00690	     ChooseText="Choose"
00691	     SaveText="Save options"
00692	     tButton(0)=Texture'XIIIMenuStart.SoftRules_PC.bouton_select'
00693	     tButton(1)=Texture'XIIIMenuStart.SoftRules_PC.bouton_back'
00694	     tButton(2)=Texture'XIIIMenuStart.boutonC4A'
00695	     tButton(3)=Texture'XIIIMenuStart.boutonC2A'
00696	     tButton(4)=Texture'XIIIMenuStart.bouton1A'
00697	     tButton(5)=Texture'XIIIMenuStart.bouton2A'
00698	     tButton(6)=Texture'XIIIMenuStart.boutonB1A'
00699	     tButton(7)=Texture'XIIIMenuStart.boutonB2A'
00700	     tUpdate=Texture'XIIIMenuStart.bouton4A'
00701	     hMenuOff=Sound'XIIIsound.Interface.MnAnnul'
00702	     hMenuOn=Sound'XIIIsound.Interface.MnValid'
00703	     bDisplayBar=True
00704	     MyFailureMessage(0)="The account name already exists"
00705	     MyFailureMessage(1)="- The account name must start with a letter"
00706	     MyFailureMessage(2)="- The account name must be at least 3 characters long"
00707	     MyFailureMessage(3)="- The account name must only contain letters, numbers, underscores, backslashes, dots or dashes"
00708	     MyFailureMessage(4)="The account name contains forbidden substrings"
00709	     MyFailureMessage(5)="The account name is reserved"
00710	     MyFailureMessage(6)="- The password must be at least 2 characters long"
00711	     MyFailureMessage(7)="- The password must not include your login"
00712	     MyFailureMessage(8)="There is a problem with the database"
00713	     MyFailureMessage(9)="The account name is invalid"
00714	     MyFailureMessage(10)="The password is invalid"
00715	     MyFailureMessage(11)="Your account is banned"
00716	     MyFailureMessage(12)="Your account is temporarily closed. Retry later (15 min.)"
00717	     MyFailureMessage(13)="Your account is locked"
00718	     MyFailureMessage(14)="Could not access the external network device. Please check all connections and reconnect."
00719	     SaveName(0)="Brighton Beach 1"
00720	     SaveName(1)="Brighton Beach 2"
00721	     SaveName(2)="Brighton Beach 3"
00722	     SaveName(3)="Winslow Bank"
00723	     SaveName(4)="Winslow Bank 1"
00724	     SaveName(5)="Winslow Bank 2"
00725	     SaveName(6)="FBI"
00726	     SaveName(7)="FBI 1"
00727	     SaveName(8)="FBI 2"
00728	     SaveName(9)="Major Jones"
00729	     SaveName(10)="Major Jones 1"
00730	     SaveName(11)="Major Jones 2"
00731	     SaveName(12)="Major Jones 3"
00732	     SaveName(13)="Emerald Base bridge"
00733	     SaveName(14)="Emerald Base roof"
00734	     SaveName(15)="Carrington's cell "
00735	     SaveName(16)="Carrington's cell 1"
00736	     SaveName(17)="Carrington's cell 2"
00737	     SaveName(18)="Cable car station"
00738	     SaveName(19)="Cable car"
00739	     SaveName(20)="Cable car 1"
00740	     SaveName(21)="Kellownee Lake"
00741	     SaveName(22)="Kellownee Lake 1"
00742	     SaveName(23)="Kellownee hideout"
00743	     SaveName(24)="Kellownee hideout 1"
00744	     SaveName(25)="Plain Rock 1"
00745	     SaveName(26)="Plain Rock 2"
00746	     SaveName(27)="Plain Rock 3"
00747	     SaveName(28)="Plain Rock 4"
00748	     SaveName(29)="Doc Johansson"
00749	     SaveName(30)="Doc Johansson 1"
00750	     SaveName(31)="Canyon 1"
00751	     SaveName(32)="Canyon 2"
00752	     SaveName(33)="Canyon 3"
00753	     SaveName(34)="Canyon 4"
00754	     SaveName(35)="Canyon 5"
00755	     SaveName(36)="Canyon 6"
00756	     SaveName(37)="Sewage"
00757	     SaveName(38)="SPADS camp 1"
00758	     SaveName(39)="SPADS camp 2"
00759	     SaveName(40)="SPADS camp 3"
00760	     SaveName(41)="McCall"
00761	     SaveName(42)="McCall 1"
00762	     SaveName(43)="Submarine base"
00763	     SaveName(44)="Submarine base 1"
00764	     SaveName(45)="Submarine 1"
00765	     SaveName(46)="Submarine 2"
00766	     SaveName(47)="Submarine 3"
00767	     SaveName(48)="Submarine 4"
00768	     SaveName(49)="Sabotage"
00769	     SaveName(50)="Sabotage 1"
00770	     SaveName(51)="Quay 33"
00771	     SaveName(52)="Quay 33-1"
00772	     SaveName(53)="Bristol Suites Hotel"
00773	     SaveName(54)="Bristol Suites Hotel 1"
00774	     SaveName(55)="Sanctuary garden"
00775	     SaveName(56)="Sanctuary garden 1"
00776	     SaveName(57)="Sanctuary hall"
00777	     SaveName(58)="Sanctuary hall 1"
00778	     SaveName(59)="Sanctuary crypt"
00779	     SaveName(60)="Sanctuary crypt 1"
00780	     SaveName(61)="Sanctuary cliff"
00781	     SaveName(62)="Sanctuary cliff 1"
00782	     SaveName(63)="SSH1 base admission"
00783	     SaveName(64)="SSH1 base admission 1"
00784	     SaveName(65)="SSH1 base admission 2"
00785	     SaveName(66)="SSH1 trap"
00786	     SaveName(67)="SSH1 trap 1"
00787	     SaveName(68)="Total Red"
00788	     SaveName(69)="SSH1 final"
00789	     SaveName(70)="SSH1 final 1"
00790	     SaveName(71)="Lady Bee"
00791	     SaveName(72)="Carrington's cell 3"
00792	     DisplayedSaveName(0)="Brighton 1"
00793	     DisplayedSaveName(1)="Brighton 2"
00794	     DisplayedSaveName(2)="Brighton 3"
00795	     DisplayedSaveName(3)="Winslow 1"
00796	     DisplayedSaveName(4)="Winslow 2"
00797	     DisplayedSaveName(5)="Winslow 3"
00798	     DisplayedSaveName(6)="FBI 1"
00799	     DisplayedSaveName(7)="FBI 2"
00800	     DisplayedSaveName(8)="FBI 3"
00801	     DisplayedSaveName(9)="Jones 1"
00802	     DisplayedSaveName(10)="Jones 2"
00803	     DisplayedSaveName(11)="Jones 3"
00804	     DisplayedSaveName(12)="Jones 4"
00805	     DisplayedSaveName(13)="Emerald 1"
00806	     DisplayedSaveName(14)="Emerald 2"
00807	     DisplayedSaveName(15)="Ben Carrington 1"
00808	     DisplayedSaveName(16)="Ben Carrington 2"
00809	     DisplayedSaveName(17)="Ben Carrington 3"
00810	     DisplayedSaveName(18)="Emerald 3"
00811	     DisplayedSaveName(19)="Emerald 4"
00812	     DisplayedSaveName(20)="Emerald 5"
00813	     DisplayedSaveName(21)="Kellownee 1"
00814	     DisplayedSaveName(22)="Kellownee 2"
00815	     DisplayedSaveName(23)="Kim Rowland 1"
00816	     DisplayedSaveName(24)="Kim Rowland 2"
00817	     DisplayedSaveName(25)="Plain Rock 1"
00818	     DisplayedSaveName(26)="Plain Rock 2"
00819	     DisplayedSaveName(27)="Plain Rock 3"
00820	     DisplayedSaveName(28)="Plain Rock 4"
00821	     DisplayedSaveName(29)="Edward Johansson 1"
00822	     DisplayedSaveName(30)="Edward Johansson 2"
00823	     DisplayedSaveName(31)="Arizona 1"
00824	     DisplayedSaveName(32)="Arizona 2"
00825	     DisplayedSaveName(33)="Arizona 3"
00826	     DisplayedSaveName(34)="Arizona 4"
00827	     DisplayedSaveName(35)="Arizona 5"
00828	     DisplayedSaveName(36)="Arizona 6"
00829	     DisplayedSaveName(37)="SPADS 1"
00830	     DisplayedSaveName(38)="SPADS 2"
00831	     DisplayedSaveName(39)="SPADS 3"
00832	     DisplayedSaveName(40)="SPADS 4"
00833	     DisplayedSaveName(41)="Seymour McCall 1"
00834	     DisplayedSaveName(42)="Seymour McCall 2"
00835	     DisplayedSaveName(43)="USS-Patriot 1"
00836	     DisplayedSaveName(44)="USS-Patriot 2"
00837	     DisplayedSaveName(45)="USS-Patriot 3"
00838	     DisplayedSaveName(46)="USS-Patriot 4"
00839	     DisplayedSaveName(47)="Franklin Edelbright 1"
00840	     DisplayedSaveName(48)="Franklin Edelbright 2"
00841	     DisplayedSaveName(49)="Resolute AFDM 1"
00842	     DisplayedSaveName(50)="Resolute AFDM 2"
00843	     DisplayedSaveName(51)="Maryland 1"
00844	     DisplayedSaveName(52)="Maryland 2"
00845	     DisplayedSaveName(53)="Bristol Hotel 1"
00846	     DisplayedSaveName(54)="Bristol Hotel 2"
00847	     DisplayedSaveName(55)="XX 1"
00848	     DisplayedSaveName(56)="XX 2"
00849	     DisplayedSaveName(57)="XX 3"
00850	     DisplayedSaveName(58)="XX 4"
00851	     DisplayedSaveName(59)="XX 5"
00852	     DisplayedSaveName(60)="XX 6"
00853	     DisplayedSaveName(61)="XX 7"
00854	     DisplayedSaveName(62)="XX 8"
00855	     DisplayedSaveName(63)="SSH1 - 1"
00856	     DisplayedSaveName(64)="SSH1 - 2"
00857	     DisplayedSaveName(65)="SSH1 - 3"
00858	     DisplayedSaveName(66)="William Standwell"
00859	     DisplayedSaveName(67)="Joseph Galbrain"
00860	     DisplayedSaveName(68)="CalvinWax"
00861	     DisplayedSaveName(69)="SSH1 - 4"
00862	     DisplayedSaveName(70)="SSH1 - 5"
00863	     DisplayedSaveName(71)="Lady Bee"
00864	     DisplayedSaveName(72)="Ben Carrington 4"
00865	     Background=Texture'XIIIMenuStart.menublanc'
00866	     WinHeight=1.000000
00867	}

End Source Code