## XIDInterf
Class XIIIMenuSplitSetupClient

source: C:\XIII\XIDInterf\Classes\XIIIMenuSplitSetupClient.uc

    Core.Object
       |
       +--GUI.GUI
          |
          +--GUI.GUIComponent
             |
             +--GUI.GUIMultiComponent
                |
                +--GUI.GUIPage
                   |
                   +--XIDInterf.XIIIWindow
                      |
                      +--XIDInterf.XIIIWindowMainMenu
                         |
                         +--XIDInterf.XIIIMenuMultiBase
                            |
                            +--XIDInterf.XIIIMenuSplitSetupClient

Direct Known Subclasses:None

class XIIIMenuSplitSetupClient
extends XIDInterf.XIIIMenuMultiBase

    //===========================================================================
    // Split-Screen multiplayer game setup
    //===========================================================================

Variables
`TimeLimit,` | `DefaultConfig`
`XIIICheckBoxControl` | `FriendlyCheck`
`int` | `GameTypeIndex`
`bool` | `Initialized`
`string` | `Map`
`GameCombo,` | `MapCombo`
`MapsList,` | `MapsUNRList`
`OnTime,` | `MaxPlayerValue`
`PlayersText,` | `OKText`
`PlayersButton,` | `OkButton`
`PC[4],` | `PT[4]`
`RealPrefix[6],` | `RealGameInfo[6]`
`sound` | `TempSound`
`FragEdit,` | `TimeEdit`
`string` | `URL`
`sBackground[7],` | `sHighlight`
`tBackGround[7],` | `tHighlight`

Function Summary
`void` | `AfterCreate()`
`void` | `Created()`
`void` | `FragChanged()`
`void` | `GameChanged()`
`string` | `GetPageParameters()`
    // if subclassed, this parent function must always be called first
`void` | `GotoBotSetup()`
`void` | `GotoPlayersSetup()`
`bool` | `InternalOnKeyEvent(out byte, out byte, float delta)`
`void` | `IterateGames()`
`void` | `IterateMaps()`
`void` | `MapChanged()`
`void` | `Paint(Canvas C, float X, float Y)`
`void` | `SetPageParameters(string PageParameters)`
    // if GetPageParameters() is subclassed, you'd better have this one too !
`void` | `ShowWindow()`
`void` | `StartPressed()`
`void` | `TimeChanged()`

Source Code

    00001	//===========================================================================
    00002	// Split-Screen multiplayer game setup
    00003	//===========================================================================
    00004	class XIIIMenuSplitSetupClient extends XIIIMenuMultiBase;
    00005
    00006
    00007	var config string Map;
    00008	VAR config int GameTypeIndex;
    00009
    00010	var XIIIComboControl GameCombo, MapCombo;
    00011	var XIIICheckboxControl FriendlyCheck;
    00012	var XIIIValueControl PlayerCombo, FragEdit, TimeEdit;
    00013	var XIIIButton BotsButton, PlayersButton, OkButton;
    00014
    00015	var string Games[6], Prefix[6], GameInfo[6], Mutator, RealGames[6], RealPrefix[6], RealGameInfo[6];
    00016	var Array<string> MapsList, MapsUNRList;
    00017
    00018	var localized string TitleText, GameText, MapText, PlayerText, FriendlyText, FragText, TimeText, BotsText, PlayersText, OKText;
    00019
    00020	var texture tBackGround[7], tHighlight;
    00021	var string sBackground[7], sHighlight;
    00022
    00023	var bool Initialized;
    00024
    00025	var int OnPlayer, OnGame, OnMap, OnFrag, OnTime, MaxPlayerValue;
    00026
    00027	var int MaxPlayers, WinningScore, MaxTime, NbBots, IdealPC, N, FriendlyFire, FragLimit, TimeLimit, DefaultConfig;
    00028	var int TeamBot[7], NivBot[7], PC[4], PT[4];
    00029
    00030	var string URL;
    00031
    00032	var sound TempSound;
    00033
    00034
    00035	event HandleParameters(string Param1, string Param2)
    00036	{
    00037	    URL = Param1;
    00038	    log("Param1="$URL);
    00039		Map = LocalParseOption ( URL, "Map", "");
    00040		GameTypeIndex = int(localParseOption ( URL, "GameTypeIndex", "0"));
    00041		IdealPC = int( localParseOption( URL,"IP", "0") );
    00042		N = int( localParseOption( URL,"NP", "0") );
    00043		//FriendlyFire = int( localParseOption( URL,"FF", "0") );
    00044		FragLimit = int( localParseOption( URL,"FR", "0") );
    00045		TimeLimit = int( localParseOption( URL,"TI", "0") );
    00046		DefaultConfig = int( localParseOption( URL,"DC", "0") );
    00047		NbBots = int( localParseOption( URL,"NBots", "0") );
    00048		TeamBot[0] = int( localParseOption( URL,"TB0", "1") );
    00049		NivBot[0] = int( localParseOption( URL,"NB0", "1") );
    00050		TeamBot[1] = int( localParseOption( URL,"TB1", "0") );
    00051		NivBot[1] = int( localParseOption( URL,"NB1", "2") );
    00052		TeamBot[2] = int( localParseOption( URL,"TB2", "1") );
    00053		NivBot[2] = int( localParseOption( URL,"NB2", "2") );
    00054		TeamBot[3] = int( localParseOption( URL,"TB3", "0") );
    00055		NivBot[3] = int( localParseOption( URL,"NB3", "0") );
    00056		TeamBot[4] = int( localParseOption( URL,"TB4", "1") );
    00057		NivBot[4] = int( localParseOption( URL,"NB4", "0") );
    00058		TeamBot[5] = int( localParseOption( URL,"TB5", "0") );
    00059		NivBot[5] = int( localParseOption( URL,"NB5", "3") );
    00060		TeamBot[6] = int( localParseOption( URL,"TB6", "1") );
    00061		NivBot[6] = int( localParseOption( URL,"NB6", "3") );
    00062		PC[0] = int( localParseOption( URL,"PC0", "0") );
    00063		PC[1] = int( localParseOption( URL,"PC1", "0") );
    00064		PC[2] = int( localParseOption( URL,"PC2", "1") );
    00065		PC[3] = int( localParseOption( URL,"PC3", "1") );
    00066		PT[0] = int( localParseOption( URL,"PT0", "0") );
    00067		PT[1] = int( localParseOption( URL,"PT1", "1") );
    00068		PT[2] = int( localParseOption( URL,"PT2", "0") );
    00069		PT[3] = int( localParseOption( URL,"PT3", "1") );
    00070
    00071		//log(self@"---> DONNEES"@Map@GameType@IdealPC@N@FragLimit@TimeLimit@NbBots);
    00072		//log(self@"---> NIVEAUX BOTS"@NivBot[0]@NivBot[1]@NivBot[2]@NivBot[3]@NivBot[4]@NivBot[5]@NivBot[6]);
    00073		//log(self@"---> TEAM PLAYERS"@PT[0]@PT[1]@PT[2]@PT[3]);
    00074	}
    00075
    00076	function Created()
    00077	{
    00078		local int i;
    00079
    00080		Super.Created();
    00081
    00082		switch( myRoot.CurrentPF )
    00083		{
    00084		case 1: // PS2
    00085			AllowedGameTypeIndex[0]=DeathmatchIndex;
    00086			AllowedGameTypeIndex[1]=TeamDeathmatchIndex;
    00087			AllowedGameTypeIndex[2]=CaptureTheFlagIndex;
    00088			AllowedGameTypeIndex[3]=TheHuntIndex;
    00089			AllowedGameTypeIndex[4]=PowerUpIndex;
    00090			break;
    00091		case 2: // XBox
    00092			AllowedGameTypeIndex[0]=DeathmatchIndex;
    00093			AllowedGameTypeIndex[1]=TeamDeathmatchIndex;
    00094			AllowedGameTypeIndex[2]=CaptureTheFlagIndex;
    00095			AllowedGameTypeIndex[3]=SabotageIndex;
    00096			break;
    00097		case 3: // CUBE
    00098			AllowedGameTypeIndex[0]=DeathmatchIndex;
    00099			AllowedGameTypeIndex[1]=TeamDeathmatchIndex;
    00100			AllowedGameTypeIndex[2]=CaptureTheFlagIndex;
    00101			AllowedGameTypeIndex[3]=TheHuntIndex;
    00102			break;
    00103		}
    00104
    00105		for (i=0; i<7; i++)
    00106			tBackGround[i] = texture(DynamicLoadObject(sBackGround[i], class'Texture'));
    00107
    00108		tHighlight = texture(DynamicLoadObject(sHighlight, class'Texture'));
    00109
    00110		// Players
    00111		PlayerCombo = XIIIValueControl(CreateControl(class'XIIIValueControl', 288, 70*fScaleTo, 300, 32));
    00112		PlayerCombo.Text = PlayerText;
    00113		PlayerCombo.bCalculateSize = false;
    00114		PlayerCombo.FirstBoxWidth = 200;
    00115
    00116		// Game Type
    00117		GameCombo = XIIIComboControl(CreateControl(class'XIIIComboControl', 288, 116*fScaleTo, 300, 32));
    00118		GameCombo.Text = GameText;
    00119		//GameCombo.bSmallFont = true;
    00120		GameCombo.bArrows = true;
    00121
    00122		// Map
    00123		MapCombo = XIIIComboControl(CreateControl(class'XIIIComboControl', 288, 162*fScaleTo, 300, 32));
    00124		MapCombo.Text = MapText;
    00125		MapCombo.bArrows = true;
    00126		MapCombo.bCalculateSize = false;
    00127		MapCombo.FirstBoxWidth = 160;
    00128
    00129		// Frag Limit
    00130		FragEdit = XIIIValueControl(CreateControl(class'XIIIValueControl', 288, 208*fScaleTo, 300, 32));
    00131		FragEdit.Text = FragText;
    00132		FragEdit.bCalculateSize = false;
    00133		FragEdit.FirstBoxWidth = 200;
    00134		FragEdit.SetRange(0,500);
    00135
    00136		// Time Limit
    00137		TimeEdit = XIIIValueControl(CreateControl(class'XIIIValueControl', 288, 254*fScaleTo, 300, 32));
    00138		TimeEdit.Text = TimeText;
    00139		TimeEdit.bCalculateSize = false;
    00140		TimeEdit.FirstBoxWidth = 175;
    00141		TimeEdit.SetRange(0,60);
    00142
    00143		// Bots setup
    00144		BotsButton = XIIIbutton(CreateControl(class'XIIIbutton', 320, 300*fScaleTo, 220, 32));
    00145		BotsButton.Text = BotsText;
    00146		BotsButton.bUseBorder = true;
    00147
    00148		// friendly fire
    00149		//FriendlyCheck = XIIICheckboxControl(CreateControl(class'XIIICheckboxControl', 288, 389*fScaleTo, 300, 29));
    00150		//FriendlyCheck.Text = FriendlyText;
    00151		//FriendlyCheck.bWhiteColorOnlyWhenFocused = true;
    00152
    00153		// Players setup
    00154		PlayersButton = XIIIbutton(CreateControl(class'XIIIbutton', 320, 346*fScaleTo, 220, 32));
    00155		PlayersButton.Text = PlayersText;
    00156		PlayersButton.bUseBorder = true;
    00157
    00158		// OK go
    00159		OKButton = XIIIbutton(CreateControl(class'XIIIbutton', 360, 392*fScaleTo, 139, 32));
    00160		OKButton.Text = OKText;
    00161		OKButton.bUseBorder = true;
    00162
    00163	    Controls[0] = PlayerCombo;
    00164		Controls[1] = GameCombo;
    00165		Controls[2] = MapCombo;
    00166	    Controls[3] = FragEdit;
    00167		Controls[4] = TimeEdit;
    00168		Controls[5] = BotsButton;
    00169	    //Controls[6] = FriendlyCheck;
    00170		Controls[6] = PlayersButton;
    00171		Controls[7] = OKButton;
    00172
    00173
    00174		// real names of maps
    00175
    00176	    IterateGames();
    00177
    00178	    AfterCreate();
    00179
    00180		if (myRoot.CurrentPF == 3 )
    00181				hSoundMenu2 = TempSound;
    00182
    00183		GotoState('ReinitMusic');
    00184	}
    00185
    00186
    00187	FUNCTION IterateGames()
    00188	{
    00189		local int i;
    00190
    00191		for (i=0;i<AllowedGameTypeIndex.Length;i++)
    00192		{
    00193			GameCombo.AddItem(GetGameTypeText(i));
    00194		}
    00195
    00196		OnGame = 0;
    00197		GameCombo.SetSelectedIndex(0);
    00198
    00199		Initialized = true;
    00200		GameChanged();
    00201	}
    00202
    00203
    00204	function IterateMaps()
    00205	{
    00206		LOCAL Array<string> MapDescList;
    00207		LOCAL int i;
    00208
    00209		GetMapArray( OnGame, MapDescList, MapsUNRList );
    00210
    00211		MapCombo.Clear();
    00212		for( i=0; i<MapDescList.Length; i++ )
    00213			MapCombo.AddItem( MapDescList[i] );
    00214
    00215		OnMap = 0;
    00216		MapCombo.SetSelectedIndex(0);
    00217	}
    00218
    00219
    00220	function AfterCreate()
    00221	{
    00222		OnMenu = 0;
    00223
    00224		PlayerCombo.SetRange(1,int(Mid(MapCombo.GetValue(),1)));
    00225		OnPlayer = Max(GetPlayerOwner().GetPadNumber(), MaxPlayers);
    00226		PlayerCombo.SetValue(OnPlayer);
    00227
    00228		OnFrag = WinningScore;
    00229		FragEdit.SetValue(OnFrag);
    00230		if (OnFrag == 0)
    00231			FragEdit.sValue ="-";
    00232
    00233		OnTime = MaxTime;
    00234		TimeEdit.SetValue(OnTime);
    00235		if (OnTime == 0)
    00236			TimeEdit.sValue ="-";
    00237		else
    00238			TimeEdit.sValue = TimeEdit.sValue@"Min.";
    00239	}
    00240
    00241
    00242	function Paint(canvas C, float X, float Y)
    00243	{
    00244		local float fScale, fHeight, W, H;
    00245
00246 Super.Paint(C,X,Y); 00247 00248 DrawStretchedTexture(C, 253*fRatioX, 54*fRatioY, 353*fRatioX, 377*fScaleTo*fRatioY, myRoot.tFondNoir); 00249 00250 fHeight = (373 / 192) * 64 * fScaleTo; // (sum_back.height/sum_tex.height) * tex_height 00251 DrawStretchedTexture(C, 255*fRatioX, 56*fRatioY, 349*fRatioX, fHeight*fRatioY, tBackGround[0]); 00252 DrawStretchedTexture(C, 255*fRatioX, (56+fHeight)*fRatioY, 349*fRatioX, fHeight*fRatioY, tBackGround[1]); 00253 DrawStretchedTexture(C, 255*fRatioX, (56+2*fHeight)*fRatioY, 349*fRatioX, fHeight*fRatioY, tBackGround[2]); 00254 00255 OnMenu = FindComponentIndex(FocusedControl); 00256 C.Style = 5; 00257 C.DrawColor.A = 180; 00258 DrawStretchedTexture(C, 255*fRatioX, ((65+OnMenu*46)*fScaleTo)*fRatioY, 349*fRatioX, 40*fRatioY, tHighlight);//OnMenu]); 00259 C.DrawColor.A = 255; 00260 DrawStretchedTexture(C, 41*fRatioX, 88*fRatioY, 242*fRatioX, 170*fScaleTo*fRatioY, tBackGround[5]); 00261 DrawStretchedTexture(C, 41*fRatioX, (88+170*fScaleTo)*fRatioY, 242*fRatioX, 170*fScaleTo*fRatioY, tBackGround[6]); 00262 C.Style = 1; 00263 00264 C.bUseBorder = true; 00265 DrawStretchedTexture(C, 100*fRatioX, 40*fRatioY, 180*fRatioX, 40*fRatioY, myRoot.FondMenu); 00266 C.TextSize(TitleText, W, H); 00267 C.DrawColor = BlackColor; 00268 C.SetPos((110 + (160-W)/2)*fRatioX, (60-H/2)*fRatioY); 00269 C.DrawText(TitleText, false); 00270 C.bUseBorder = false; 00271 C.DrawColor = WhiteColor; 00272 } 00273 00274 00275 event Tick(float dt) 00276 { 00277 // pads number detection 00278 if ( GetPlayerOwner().GetPadNumber() != 0 ) 00279 { 00280 OnPlayer = Clamp(OnPlayer,1,GetPlayerOwner().GetPadNumber()); 00281 PlayerCombo.SetRange(1,GetPlayerOwner().GetPadNumber()); 00282 PlayerCombo.SetValue(OnPlayer); 00283 } 00284 else 00285 { 00286 OnPlayer = 0; 00287 PlayerCombo.SetRange(0,0); 00288 PlayerCombo.SetValue(OnPlayer); 00289 } 00290 } 00291 00292 00293 function ShowWindow() 00294 { 00295 Super.ShowWindow(); 00296 00297 bShowBCK = true; 00298 bShowSEL = true; 00299 } 00300 00301 00302 function bool InternalOnKeyEvent(out byte Key, out byte State, float delta) 00303 { 00304 local int OldOnGame; 00305 00306 if ((State==1) || (state==2))// IST_Press // to avoid auto-repeat 00307 { 00308 if (Key==0x0D/*IK_Enter*/) 00309 { 00310 if (FocusedControl == BotsButton) 00311 GotoBotSetup(); 00312 if (FocusedControl == PlayersButton) 00313 GotoPlayersSetup(); 00314 if (FocusedControl == OKButton) 00315 StartPressed(); 00316 return true; 00317 } 00318 if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B)) 00319 { 00320 myRoot.CloseMenu(true); 00321 return true; 00322 } 00323 if (Key==0x26/*IK_Up*/) 00324 { 00325 PrevControl(FocusedControl); 00326 return true; 00327 } 00328 if (Key==0x28/*IK_Down*/) 00329 { 00330 NextControl(FocusedControl); 00331 return true; 00332 } 00333 if ((Key==0x25) || (Key==0x27)) 00334 { 00335 OnMenu = FindComponentIndex(FocusedControl); 00336 if (OnMenu == 0) 00337 { 00338 if (Key==0x25) OnPlayer--; 00339 if (Key==0x27) OnPlayer++; 00340 OnPlayer = Clamp(OnPlayer,1,GetPlayerOwner().GetPadNumber()); 00341 PlayerCombo.SetValue(OnPlayer); 00342 } 00343 else if (OnMenu == 1) 00344 { 00345 OldOnGame = OnGame; 00346 if (Key==0x25) OnGame--; 00347 if (Key==0x27) OnGame++; 00348 OnGame = Clamp(OnGame,0,AllowedGameTypeIndex.Length - 1); 00349 if ( OldOnGame != OnGame ) 00350 { 00351 GameCombo.SetSelectedIndex(OnGame); 00352 GameChanged(); 00353 } 00354 } 00355 else if (OnMenu == 2) 00356 { 00357 if (Key==0x25) OnMap--; 00358 if (Key==0x27) OnMap++; 00359 OnMap = Clamp(OnMap,0,MapsUNRList.Length - 1); 00360 MapCombo.SetSelectedIndex(OnMap); 00361 } 00362 if (OnMenu == 3) 00363 { 00364 if (Key==0x25) 00365 if ( OnFrag <= 100 ) 00366 OnFrag -= 10; 00367 else 00368 OnFrag -= 50; 00369 if (Key==0x27) 00370 if ( OnFrag >= 100 ) 00371 OnFrag += 50; 00372 else 00373 OnFrag += 10; 00374 OnFrag = Clamp(OnFrag,0,500); 00375 FragEdit.SetValue(OnFrag); 00376 if (OnFrag == 0) FragEdit.sValue ="-"; 00377 } 00378 else if (OnMenu == 4) 00379 { 00380 if (Key==0x25) OnTime -= 5; 00381 if (Key==0x27) OnTime += 5; 00382 OnTime = Clamp(OnTime,0,60); 00383 TimeEdit.SetValue(OnTime); 00384 if (OnTime == 0) 00385 TimeEdit.sValue ="-"; 00386 else 00387 TimeEdit.sValue = TimeEdit.sValue@"Min."; 00388 } 00389 /* else if (OnMenu == 6) 00390 { 00391 if (Key==0x25) 00392 FriendlyCheck.bChecked = true; 00393 else 00394 if (Key==0x27) 00395 FriendlyCheck.bChecked = false; 00396 }*/ 00397 return true; 00398 } 00399 } 00400 return super.InternalOnKeyEvent(Key, state, delta); 00401 } 00402 00403 00404 function GameChanged() 00405 { 00406 local int CurrentGame, i; 00407 00408 if (Initialized) 00409 { 00410 OnMap = 0; 00411 Initialized=false; 00412 00413 CurrentGame = GameCombo.GetSelectedIndex(); 00414 00415 if (MapCombo != None) 00416 IterateMaps(); 00417 00418 // time limit and points limit are not visible in Sabotage mode 00419 if ( HasTimeAndFragLimits( OnGame ) ) 00420 { 00421 TimeEdit.bNeverFocus = false; 00422 TimeEdit.bVisible = true; 00423 FragEdit.bNeverFocus = false; 00424 FragEdit.bVisible = true; 00425 } 00426 else 00427 { 00428 TimeEdit.bNeverFocus = true; 00429 TimeEdit.bVisible = false; 00430 FragEdit.bNeverFocus = true; 00431 FragEdit.bVisible = false; 00432 } 00433 00434 // players setup bouton is available if we are in TDM, CTF or sabotage mode 00435 if ( HasFriendlyFire( OnGame ) ) 00436 { 00437 PlayersButton.bNeverFocus = false; 00438 PlayersButton.bVisible = true; 00439 } 00440 else 00441 { 00442 PlayersButton.bNeverFocus = true; 00443 PlayersButton.bVisible = false; 00444 } 00445 00446 Initialized = true; 00447 } 00448 } 00449 00450 00451 function MapChanged() 00452 { 00453 if (Initialized) 00454 { 00455 Map = MapsUNRList[OnMap]; 00456 } 00457 } 00458 00459 00460 function FragChanged() 00461 { 00462 if (Initialized) 00463 { 00464 FragEdit.SetValue(OnFrag); 00465 if (OnFrag == 0) 00466 FragEdit.sValue ="-"; 00467 } 00468 } 00469 00470 00471 function TimeChanged() 00472 { 00473 if (Initialized) 00474 { 00475 TimeEdit.SetValue(OnTime); 00476 if (OnTime == 0) 00477 TimeEdit.sValue ="-"; 00478 else 00479 TimeEdit.sValue = TimeEdit.sValue@"Min."; 00480 } 00481 } 00482 00483 00484 function GotoBotSetup() 00485 { 00486 local string URL; 00487 local int N, IdealPC, FriendlyFire; 00488 00489 N = PlayerCombo.GetValue(); 00490 IdealPC = int( Mid( MapCombo.GetValue(), 1 ) ); 00491 NbBots = Min(NbBots,IdealPC - N); 00492 00493 //FriendlyFire = int(FriendlyCheck.bChecked); 00494 00495 MapChanged(); 00496 TimeChanged(); 00497 FragChanged(); 00498 00499 URL = 00500 "?Map="$Map$ 00501 "?GameTypeIndex="$AllowedGameTypeIndex[OnGame]$ 00502 "?IP="$IdealPC$ 00503 "?NP="$N$ 00504 "?FR="$OnFrag$ 00505 "?TI="$OnTime$ 00506 "?NBots="$NbBots$ 00507 "?DC="$DefaultConfig$ 00508 "?TB0="$TeamBot[0]$ 00509 "?NB0="$NivBot[0]$ 00510 "?TB1="$TeamBot[1]$ 00511 "?NB1="$NivBot[1]$ 00512 "?TB2="$TeamBot[2]$ 00513 "?NB2="$NivBot[2]$ 00514 "?TB3="$TeamBot[3]$ 00515 "?NB3="$NivBot[3]$ 00516 "?TB4="$TeamBot[4]$ 00517 "?NB4="$NivBot[4]$ 00518 "?TB5="$TeamBot[5]$ 00519 "?NB5="$NivBot[5]$ 00520 "?TB6="$TeamBot[6]$ 00521 "?NB6="$NivBot[6]$ 00522 "?PC0="$PC[0]$ 00523 "?PC1="$PC[1]$ 00524 "?PC2="$PC[2]$ 00525 "?PC3="$PC[3]$ 00526 "?PT0="$PT[0]$ 00527 "?PT1="$PT[1]$ 00528 "?PT2="$PT[2]$ 00529 "?PT3="$PT[3]; 00530 00531 log("Go to bots setup :"@URL); 00532 myRoot.OpenMenu("XIDInterf.XIIIMenuBotsSetupClient", false, URL); 00533 } 00534 00535 00536 function GotoPlayersSetup() 00537 { 00538 local string URL; 00539 local int N, IdealPC, FriendlyFire; 00540 00541 N = PlayerCombo.GetValue(); 00542 IdealPC = int( Mid( MapCombo.GetValue(), 1 ) ); 00543 NbBots = Min(NbBots,IdealPC - N); 00544 00545 //FriendlyFire = int(FriendlyCheck.bChecked); 00546 00547 MapChanged(); 00548 TimeChanged(); 00549 FragChanged(); 00550 00551 URL = 00552 "?Map="$Map$ 00553 "?GameTypeIndex="$AllowedGameTypeIndex[OnGame]$ 00554 "?IP="$IdealPC$ 00555 "?NP="$N$ 00556 "?FR="$OnFrag$ 00557 "?TI="$OnTime$ 00558 "?NBots="$NbBots$ 00559 "?DC="$DefaultConfig$ 00560 "?TB0="$TeamBot[0]$ 00561 "?NB0="$NivBot[0]$ 00562 "?TB1="$TeamBot[1]$ 00563 "?NB1="$NivBot[1]$ 00564 "?TB2="$TeamBot[2]$ 00565 "?NB2="$NivBot[2]$ 00566 "?TB3="$TeamBot[3]$ 00567 "?NB3="$NivBot[3]$ 00568 "?TB4="$TeamBot[4]$ 00569 "?NB4="$NivBot[4]$ 00570 "?TB5="$TeamBot[5]$ 00571 "?NB5="$NivBot[5]$ 00572 "?TB6="$TeamBot[6]$ 00573 "?NB6="$NivBot[6]$ 00574 "?PC0="$PC[0]$ 00575 "?PC1="$PC[1]$ 00576 "?PC2="$PC[2]$ 00577 "?PC3="$PC[3]$ 00578 "?PT0="$PT[0]$ 00579 "?PT1="$PT[1]$ 00580 "?PT2="$PT[2]$ 00581 "?PT3="$PT[3]; 00582 00583 log("Go to players setup :"@URL); 00584 myRoot.OpenMenu("XIDInterf.XIIIMenuPlayersSetupClient", false, URL); 00585 } 00586 00587 function StartPressed() 00588 { 00589 local string URL, MyClass, SkinCode, MyName, Mutator; 00590 local int i, N, IdealPC, FriendlyFire, NbTeam0, NbTeam1; 00591 local int TeamBalanceBot[4]; 00592 00593 N = PlayerCombo.GetValue(); 00594 IdealPC = int( Mid( MapCombo.GetValue(), 1 ) ); 00595 NbBots = Min(NbBots,IdealPC - N); 00596 00597 //FriendlyFire = int(FriendlyCheck.bChecked); 00598 00599 GetPlayerOwner().ConsoleCommand("SetViewPortNumberForNextMap "$N); 00600 00601 MapChanged(); 00602 TimeChanged(); 00603 FragChanged(); 00604 00605 TeamBalanceBot[0] = 1; 00606 TeamBalanceBot[1] = 0; 00607 TeamBalanceBot[2] = 1; 00608 TeamBalanceBot[3] = 0; 00609 00610 if (( NbBots == 0 ) && ( DefaultConfig == 0 )) 00611 { 00612 for (i=0;i<N;i++) 00613 { 00614 if ( PT[i] == 0 ) 00615 NbTeam0 ++; 00616 else 00617 NbTeam1 ++; 00618 } 00619 00620 i = 0; 00621 while ( NbTeam0 != NbTeam1 ) 00622 { 00623 if ( NbTeam0 < NbTeam1 ) 00624 { 00625 TeamBalanceBot[i] = 0; 00626 NbTeam0 ++; 00627 } 00628 else 00629 { 00630 TeamBalanceBot[i] = 1; 00631 NbTeam1 ++; 00632 } 00633 i++; 00634 } 00635 00636 URL = 00637 /*"?Map="$*/Map$ 00638 "?Game="$GetGameInfoText(OnGame)$ 00639 "?IP="$IdealPC$ 00640 "?NP="$N$ 00641 "?FR="$OnFrag$ 00642 "?TI="$OnTime$ 00643 "?NBots="$(IdealPC - N)$ 00644 "?TB0="$TeamBalanceBot[0]$ 00645 "?NB0="$1$ 00646 "?TB1="$TeamBalanceBot[1]$ 00647 "?NB1="$2$ 00648 "?TB2="$TeamBalanceBot[2]$ 00649 "?NB2="$2$ 00650 "?TB3="$TeamBalanceBot[3]$ 00651 "?NB3="$0$ 00652 "?TB4="$1$ 00653 "?NB4="$0$ 00654 "?TB5="$0$ 00655 "?NB5="$3$ 00656 "?TB6="$1$ 00657 "?NB6="$3$ 00658 "?PC0="$PC[0]$ 00659 "?PC1="$PC[1]$ 00660 "?PC2="$PC[2]$ 00661 "?PC3="$PC[3]$ 00662 "?PT0="$PT[0]$ 00663 "?PT1="$PT[1]$ 00664 "?PT2="$PT[2]$ 00665 "?PT3="$PT[3]; 00666 } 00667 else 00668 { 00669 URL = 00670 /*"?Map="$*/Map$ 00671 "?Game="$GetGameInfoText(OnGame)$ 00672 "?IP="$IdealPC$ 00673 "?NP="$N$ 00674 "?FR="$OnFrag$ 00675 "?TI="$OnTime$ 00676 "?NBots="$NbBots$ 00677 "?TB0="$TeamBot[0]$ 00678 "?NB0="$NivBot[0]$ 00679 "?TB1="$TeamBot[1]$ 00680 "?NB1="$NivBot[1]$ 00681 "?TB2="$TeamBot[2]$ 00682 "?NB2="$NivBot[2]$ 00683 "?TB3="$TeamBot[3]$ 00684 "?NB3="$NivBot[3]$ 00685 "?TB4="$TeamBot[4]$ 00686 "?NB4="$NivBot[4]$ 00687 "?TB5="$TeamBot[5]$ 00688 "?NB5="$NivBot[5]$ 00689 "?TB6="$TeamBot[6]$ 00690 "?NB6="$NivBot[6]$ 00691 "?PC0="$PC[0]$ 00692 "?PC1="$PC[1]$ 00693 "?PC2="$PC[2]$ 00694 "?PC3="$PC[3]$ 00695 "?PT0="$PT[0]$ 00696 "?PT1="$PT[1]$ 00697 "?PT2="$PT[2]$ 00698 "?PT3="$PT[3]; 00699 } 00700 00701 Mutator = GetMutatorText( OnGame ); 00702 if ( Mutator!="" ) 00703 URL = URL$"?Mutator="$Mutator; 00704 00705 // skin selection 00706 MyClass = GetPlayerOwner().GetDefaultURL("Class"); 00707 SkinCode = class'MeshSkinList'.default.MeshSkinListInfo[0].SkinCode; 00708 for (i=0;i<class'MeshSkinList'.default.MeshSkinListInfo.Length;i++) 00709 { 00710 if ( MyClass == class'MeshSkinList'.default.MeshSkinListInfo[i].SkinName ) 00711 { 00712 SkinCode = class'MeshSkinList'.default.MeshSkinListInfo[i].SkinCode; 00713 break; 00714 } 00715 } 00716 URL = URL$"?SK="$SkinCode; 00717 00718 // name selection 00719 MyName = GetPlayerOwner().GetDefaultURL("Name"); 00720 URL = URL$"?Name="$MyName; 00721 00722 myRoot.CloseAll(true); 00723 myRoot.GotoState(''); 00724 myRoot.bProfileMenu = false; 00725 myRoot.DefaultUserConfig = GetPlayerOwner().UserPadConfig; 00726 GetPlayerOwner().AttribPadToViewport(); 00727 log("TRAVELLING w/URL: "$URL); 00728 GetPlayerOwner().ClientTravel(URL, TRAVEL_Absolute, false); 00729 } 00730 00731 00732 // if subclassed, this parent function must always be called first 00733 function string GetPageParameters() 00734 { 00735 return Super.GetPageParameters()$"?GameType="$GameCombo.GetSelectedIndex()$"?MapName="$MapCombo.GetSelectedIndex()$"?FragLimit="$FragEdit.GetValue()$"?TimeLimit="$TimeEdit.GetValue()$"?NP="$PlayerCombo.GetValue()$"?DC="$DefaultConfig$"?NBots="$NbBots$"?TB0="$TeamBot[0]$"?NB0="$NivBot[0]$"?TB1="$TeamBot[1]$"?NB1="$NivBot[1]$"?TB2="$TeamBot[2]$"?NB2="$NivBot[2]$"?TB3="$TeamBot[3]$"?NB3="$NivBot[3]$"?TB4="$TeamBot[4]$"?NB4="$NivBot[4]$"?TB5="$TeamBot[5]$"?NB5="$NivBot[5]$"?TB6="$TeamBot[6]$"?NB6="$NivBot[6]$"?PC0="$PC[0]$"?PC1="$PC[1]$"?PC2="$PC[2]$"?PC3="$PC[3]$"?PT0="$PT[0]$"?PT1="$PT[1]$"?PT2="$PT[2]$"?PT3="$PT[3]$"?CFG="$GetPlayerOwner().UserPadConfig; 00736 } 00737 00738 // if GetPageParameters() is subclassed, you'd better have this one too ! 00739 function SetPageParameters(string PageParameters) 00740 { 00741 local int CFG; 00742 00743 log("SetPageParameters("$PageParameters$") called for "$self); 00744 00745 OnGame = int(localParseOption(PageParameters, "GameType", "0")); 00746 GameCombo.SetSelectedIndex(OnGame); 00747 GameChanged(); 00748 00749 OnMap = int(localParseOption(PageParameters, "MapName", "0")); 00750 MapCombo.SetSelectedIndex(OnMap); 00751 MapChanged(); 00752 00753 OnFrag = int(localParseOption(PageParameters, "FragLimit", "0")); 00754 FragChanged(); 00755 00756 OnTime = int(localParseOption(PageParameters, "TimeLimit", "0")); 00757 TimeChanged(); 00758 00759 OnPlayer = int( localParseOption( PageParameters,"NP", "0") ); 00760 PlayerCombo.SetValue(OnPlayer); 00761 00762 DefaultConfig = int( localParseOption( PageParameters,"DC", "0") ); 00763 00764 NbBots = int( localParseOption( PageParameters,"NBots", "0") ); 00765 00766 TeamBot[0] = int( localParseOption( PageParameters,"TB0", "1") ); 00767 NivBot[0] = int( localParseOption( PageParameters,"NB0", "1") ); 00768 TeamBot[1] = int( localParseOption( PageParameters,"TB1", "0") ); 00769 NivBot[1] = int( localParseOption( PageParameters,"NB1", "2") ); 00770 TeamBot[2] = int( localParseOption( PageParameters,"TB2", "1") ); 00771 NivBot[2] = int( localParseOption( PageParameters,"NB2", "2") ); 00772 TeamBot[3] = int( localParseOption( PageParameters,"TB3", "0") ); 00773 NivBot[3] = int( localParseOption( PageParameters,"NB3", "0") ); 00774 TeamBot[4] = int( localParseOption( PageParameters,"TB4", "1") ); 00775 NivBot[4] = int( localParseOption( PageParameters,"NB4", "0") ); 00776 TeamBot[5] = int( localParseOption( PageParameters,"TB5", "0") ); 00777 NivBot[5] = int( localParseOption( PageParameters,"NB5", "3") ); 00778 TeamBot[6] = int( localParseOption( PageParameters,"TB6", "1") ); 00779 NivBot[6] = int( localParseOption( PageParameters,"NB6", "3") ); 00780 PC[0] = int( localParseOption( PageParameters,"PC0", "0") ); 00781 PC[1] = int( localParseOption( PageParameters,"PC1", "0") ); 00782 PC[2] = int( localParseOption( PageParameters,"PC2", "1") ); 00783 PC[3] = int( localParseOption( PageParameters,"PC3", "1") ); 00784 PT[0] = int( localParseOption( PageParameters,"PT0", "0") ); 00785 PT[1] = int( localParseOption( PageParameters,"PT1", "1") ); 00786 PT[2] = int( localParseOption( PageParameters,"PT2", "0") ); 00787 PT[3] = int( localParseOption( PageParameters,"PT3", "1") ); 00788 00789 CFG = int( localParseOption( PageParameters,"CFG","0") ); 00790 00791 // reinit controls 00792 if ( myRoot.CurrentPF == 1 ) 00793 { 00794 switch ( CFG ) 00795 { 00796 case 0: 00797 // specific inputs for classic 00798 GetPlayerOwner().ConsoleCommand("SET XIIIPlayerController ConfigType CT_StrafeLookNotSameAxis"); 00799 GetPlayerOwner().ConsoleCommand("SET Input JoyX Axis aStrafe SpeedBase=1.0 DeadZone=0.4"); 00800 GetPlayerOwner().ConsoleCommand("SET Input JoyU Axis aTurn SpeedBase=1.0 DeadZone=0.4"); 00801 break; 00802 case 1: 00803 // specific inputs for goofy 00804 GetPlayerOwner().ConsoleCommand("SET XIIIPlayerController ConfigType CT_StrafeLookSameAxis"); 00805 GetPlayerOwner().ConsoleCommand("SET Input JoyX Axis aTurn SpeedBase=1.0 DeadZone=0.4"); 00806 GetPlayerOwner().ConsoleCommand("SET Input JoyU Axis aStrafe SpeedBase=1.0 DeadZone=0.4"); 00807 break; 00808 } 00809 } 00810 else if ( myRoot.CurrentPF == 2 ) 00811 { 00812 00813 } 00814 /* else if ( myRoot.CurrentPF == 3 ) 00815 { 00816 switch ( CFG ) 00817 { 00818 case 0: 00819 // specific inputs for classic 00820 GetPlayerOwner().ConsoleCommand("set XIIIPlayerController ConfigType CT_StrafeLookNotSameAxis"); 00821 GetPlayerOwner().ConsoleCommand("SET Input JoyX Axis aStrafe SpeedBase=1.0 DeadZone=0.0"); 00822 GetPlayerOwner().ConsoleCommand("SET Input JoyU Axis aTurn SpeedBase=1.0 DeadZone=0.0"); 00823 break; 00824 case 1: 00825 // specific inputs for goofy 00826 GetPlayerOwner().ConsoleCommand("set XIIIPlayerController ConfigType CT_StrafeLookSameAxis"); 00827 GetPlayerOwner().ConsoleCommand("SET Input JoyX Axis aTurn SpeedBase=1.0 DeadZone=0.0"); 00828 GetPlayerOwner().ConsoleCommand("SET Input JoyU Axis aStrafe SpeedBase=1.0 DeadZone=0.0"); 00829 break; 00830 } 00831 }*/ 00832 } 00833 00834 00835 00836 00837 00838 defaultproperties 00839 { 00840 TitleText="Split Screen Game" 00841 GameText="Game Type" 00842 MapText="Map Name" 00843 PlayerText="Number of Player(s)" 00844 FriendlyText="Friendly Fire" 00845 FragText="Points Limit" 00846 TimeText="Time Limit" 00847 BotsText="Bots Setup" 00848 PlayersText="Players Setup" 00849 OKText="Create" 00850 sBackground(0)="XIIIMenuStart.multi_Bg01" 00851 sBackground(1)="XIIIMenuStart.multi_Bg02" 00852 sBackground(2)="XIIIMenuStart.multi_Bg03" 00853 sBackground(5)="XIIIMenuStart.Characters01" 00854 sBackground(6)="XIIIMenuStart.Characters02" 00855 sHighlight="XIIIMenuStart.barreselectmenuoptadv" 00856 WinningScore=10 00857 MaxTime=5 00858 TeamBot(0)=1 00859 TeamBot(2)=1 00860 TeamBot(4)=1 00861 TeamBot(6)=1 00862 NivBot(0)=1 00863 NivBot(1)=2 00864 NivBot(2)=2 00865 NivBot(5)=3 00866 NivBot(6)=3 00867 TempSound=Sound'XIIIsound.Interface__AmbianceMenu.AmbianceMenu__hMulti2' 00868 bUseDefaultBackground=False 00869 bForceHelp=True 00870 }

End Source Code