## XIDInterf
Class XIIIMultiControlsWindow

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

    Core.Object
       |
       +--GUI.GUI
          |
          +--GUI.GUIComponent
             |
             +--GUI.GUIMultiComponent
                |
                +--GUI.GUIPage
                   |
                   +--XIDInterf.XIIIWindow
                      |
                      +--XIDInterf.XIIIMultiControlsWindow

Direct Known Subclasses:None

class XIIIMultiControlsWindow
extends XIDInterf.XIIIWindow

Variables
`BoxOffsetY,` | `BoxInterY`
`float` | `ControlOffset`
`XIIILabel` | `InfoLabel`
`AutoAimButton,` | `InvPadButton`
`int` | `LSpeed`
`int` | `LocalPadConfig`
`XIIIHSliderControl` | `LookSpeedSlider`
`int` | `NbPadConfig`
`XIIIComboControl` | `PadConfigButton`
`InvPadText,` | `PadConfigXBoxText[4]`
`BackgroundHeight,` | `SliderPosX`
`bMemoAutoAim,` | `bMemoInvPad`
`bool` | `bSplitScreenMode`
`float` | `memoLookSpeed`
`int` | `memoPadConfig`
`sYes,` | `sNo`

Function Summary
`void` | `AutoAimChanged()`
    //_____________________________________________________________________________
`void` | `Created()`
    //_____________________________________________________________________________
`bool` | `HadPadConfigChanged()`
`void` | `InitValues()`
    //_____________________________________________________________________________
`bool` | `InternalOnKeyEvent(out byte, out byte, float delta)`
`void` | `InvPadChanged()`
    //_____________________________________________________________________________
`void` | `LookSpeedChanged()`
    //_____________________________________________________________________________
`void` | `PadConfigChanged()`
    //_____________________________________________________________________________
`void` | `Paint(Canvas C, float X, float Y)`
    //_____________________________________________________________________________
`void` | `SavePadConfig()`
    //_____________________________________________________________________________
`void` | `ShowWindow()`
    //_____________________________________________________________________________

Source Code

    00001	class XIIIMultiControlsWindow extends XIIIWindow;
    00002
    00003	var XIIIComboControl PadConfigButton;
    00004	var XIIIHSliderControl LookSpeedSlider;
    00005	var XIIIComboControl RumbleButton, AutoAimButton, InvPadButton;
    00006
    00007	var localized string RumbleText, AutoAimText, LSpeedText, InvPadText, PadConfigXBoxText[4];
    00008
    00009	var int NbButtons, BoxPosX, BoxPosY, BoxWidth, BoxHeight, FirstBoxHeight, BoxOffsetY, BoxInterY;
    00010	var int BackgroundPosX, BackgroundPosY, BackgroundWidth, BackgroundHeight, SliderPosX;
    00011
    00012	var int NbPadConfig;
    00013
    00014	var int LocalPadConfig;
    00015
    00016	var localized string sYes, sNo;
    00017
    00018	var float ControlOffset;
    00019	var int LSpeed;
    00020
    00021	var XIIILabel InfoLabel;
    00022
    00023	var bool bSplitScreenMode;
    00024
    00025	VAR bool bMemoUseRumble, bMemoAutoAim, bMemoInvPad;
    00026	VAR int memoPadConfig;
    00027	VAR float memoLookSpeed;
    00028
    00029	//_____________________________________________________________________________
    00030	FUNCTION SavePadConfig()
    00031	{
    00032		bMemoUseRumble = GetPlayerOwner().bUseRumble;
    00033		memoLookSpeed=GetPlayerOwner().fLookSpeed;
    00034			bMemoAutoAim = bool(GetPlayerOwner().iAutoAimMode);
    00035		bMemoInvPad = GetPlayerOwner().bInverseLook;
    00036		memoPadConfig = Clamp(GetPlayerOwner().UserPadConfig,0,NbPadConfig - 1);
    00037	}
    00038
    00039	FUNCTION bool HadPadConfigChanged()
    00040	{
    00041		return
    00042			(
    00043				( memoPadConfig != PadConfigButton.GetSelectedIndex( ) )
    00044			||	( memoLookSpeed != 0.7f + LookSpeedSlider.GetValue()*0.1f )
    00045			||	( bMemoUseRumble != bool(1-RumbleButton.GetSelectedIndex( ) ) )
    00046			||	( bMemoInvPad != bool(1-InvPadButton.GetSelectedIndex( ) ) )
    00047			||	( bMemoAutoAim != bool(1-AutoAimButton.GetSelectedIndex( ) ) )
    00048			);
    00049	}
    00050
    00051	//_____________________________________________________________________________
    00052	function Created()
    00053	{
    00054	    local int i;
    00055		LOCAL int id;
    00056
    00057	    Super.Created();
    00058
    00059		SavePadConfig();
    00060
    00061		// init values
    00062		BoxWidth = 210;
    00063		BoxHeight = 30;
    00064		BoxPosX = 225;
    00065		BoxOffsetY = 5;
    00066		BoxInterY = 10;
    00067		FirstBoxHeight = BoxHeight*1.4;
    00068		BackgroundPosX = 210;
    00069		BackgroundWidth = 240;
    00070		BackgroundHeight = 230;
    00071		SliderPosX = 140;
    00072
    00073		// split screen mode
    00074		if ( ( GetPlayerOwner().Level.Game!=none ) && ( GetPlayerOwner().Level.Game.NumPlayers > 1 ) && (myRoot.GetLevel().NetMode == 0) )
    00075		{
    00076			bSplitScreenMode = true;
    00077			BackgroundHeight = 178;
    00078			BoxInterY = 15;
    00079			BoxHeight *= 1.7;
    00080			FirstBoxHeight = BoxHeight*1.2;
    00081			BoxPosY = 30; //WinHeigth*480-FirstBoxHeight
    00082
    00083			XIIIBaseHud(GetPlayerowner().myHUD).InitViewPortId( none, false );
    00084			id = XIIIBaseHud(GetPlayerowner().myHUD).ViewPortId;
    00085			if ( GetPlayerowner().Level.Game.NumPlayers==2 )
    00086			{
    00087				switch( id )
    00088				{
    00089				case 0: // en haut
    00090					BackgroundPosY = 30;
    00091					break;
    00092				case 1: // en bas
    00093					BackgroundPosY = 10;
    00094					break;
    00095				}
    00096			}
    00097			else
    00098			{
    00099				BoxWidth *= 2;
    00100				BoxPosX -= 115;
    00101				BackgroundPosX -= 170;
    00102				SliderPosX *= 2;
    00103				switch( id )
    00104				{
    00105				case 0: // en haut à gauche
    00106				case 1: // en haut à droite
    00107					BackgroundPosY = 30;
    00108					break;
    00109				case 2: // en bas à gauche
    00110				case 3: // en bas à droite
    00111					BackgroundPosY = 10;
    00112					break;
    00113				}
    00114			}
    00115			BoxPosY = (BackgroundPosY+5)*2;
    00116		}
    00117		else
    00118		{
    00119			BackgroundPosY = 130;
    00120			BoxPosY = 150;
    00121		}
    00122
    00123		PadConfigButton = XIIIComboControl(CreateControl(class'XIIIComboControl', BoxPosX, (BoxPosY - BoxOffsetY)*fScaleTo, BoxWidth, FirstBoxHeight*fScaleTo));
    00124		PadConfigButton.bArrows = true;
    00125		for (i=0;i<NbPadConfig;i++)
    00126			PadConfigButton.AddItem(PadConfigXBoxText[i]);
    00127		PadConfigButton.bShowBordersOnlyWhenFocused=true;
    00128
    00129		RumbleButton = XIIIComboControl(CreateControl(class'XIIIComboControl',BoxPosX, (BoxPosY + (BoxHeight + BoxInterY))*fScaleTo, BoxWidth, BoxHeight*fScaleTo));
    00130		RumbleButton.Text = RumbleText;
    00131		RumbleButton.bArrows = true;
    00132		RumbleButton.bSplitScreenMode = bSplitScreenMode;
    00133		RumbleButton.bCalculateSize = false;
    00134		RumbleButton.FirstBoxWidth = 170;
    00135		RumbleButton.AddItem(sYes);
    00136		RumbleButton.AddItem(sNo);
    00137		RumbleButton.SetSelectedIndex( int(!bMemoUseRumble) );
    00138		RumbleButton.bShowBordersOnlyWhenFocused=true;
    00139
    00140		AutoAimButton = XIIIComboControl(CreateControl(class'XIIIComboControl', BoxPosX, (BoxPosY + (BoxHeight + BoxInterY)*2)*fScaleTo, BoxWidth, BoxHeight*fScaleTo));
    00141		AutoAimButton.Text = AutoAimText;
    00142		AutoAimButton.bArrows = true;
    00143		AutoAimButton.bSplitScreenMode = bSplitScreenMode;
    00144		AutoAimButton.bCalculateSize = false;
    00145		AutoAimButton.FirstBoxWidth = 170;
    00146		AutoAimButton.AddItem(sYes);
    00147		AutoAimButton.AddItem(sNo);
    00148		AutoAimButton.SetSelectedIndex( int(!bMemoAutoAim) );
    00149		AutoAimButton.bShowBordersOnlyWhenFocused=true;
    00150
    00151		InvPadButton = XIIIComboControl(CreateControl(class'XIIIComboControl',BoxPosX, (BoxPosY + (BoxHeight + BoxInterY)*3)*fScaleTo, BoxWidth, BoxHeight*fScaleTo));
    00152		InvPadButton.Text = InvPadText;
    00153		InvPadButton.bArrows = true;
    00154		InvPadButton.bSplitScreenMode = bSplitScreenMode;
    00155		InvPadButton.bCalculateSize = false;
    00156		InvPadButton.FirstBoxWidth = 170;
    00157		InvPadButton.AddItem(sYes);
    00158		InvPadButton.AddItem(sNo);
    00159		InvPadButton.SetSelectedIndex( int(!bMemoInvPad) );
    00160		InvPadButton.bShowBordersOnlyWhenFocused=true;
    00161
    00162	    LookSpeedSlider = XIIIHSliderControl(CreateControl(class'XIIIHSliderControl', BoxPosX, (BoxPosY + (BoxHeight + BoxInterY)*4)*fScaleTo, BoxWidth, BoxHeight*fScaleTo));
    00163	    LookSpeedSlider.SetRange(0, 10, 1, SliderPosX);
    00164	    LookSpeedSlider.Text = LSpeedText;
    00165		LookSpeedSlider.NbMultiSplit = GetPlayerOwner().Level.Game.NumPlayers;
    00166		LookSpeedSlider.bShowBordersOnlyWhenFocused=true;
    00167
    00168	    Controls[0] = PadConfigButton;
    00169	    Controls[1] = RumbleButton;
    00170	    Controls[2] = AutoAimButton;
    00171	    Controls[3] = InvPadButton;
    00172	    Controls[4] = LookSpeedSlider;
    00173
    00174		LocalPadConfig = memoPadConfig;
    00175
    00176		PadConfigButton.SetSelectedIndex(LocalPadConfig);
    00177	}
    00178
    00179	//_____________________________________________________________________________
    00180	function ShowWindow()
    00181	{
    00182	    InitValues();
    00183
    00184	    Super.ShowWindow();
    00185
    00186	    bShowCCL = true;
    00187		bShowACC = true;
    00188	}
    00189
    00190
    00191	//_____________________________________________________________________________
    00192	function InitValues()
    00193	{
    00194	    local int i;
    00195
    00196	    LSpeed = int( ( ( memoLookSpeed-0.7 ) * 10.0 ) + 0.1 ); // FUCK the innacurate floats
    00197
    00198	    LookSpeedSlider.SetValue(LSpeed);
    00199	}
    00200
    00201
    00202	//_____________________________________________________________________________
    00203	function Paint(Canvas C, float X, float Y)
    00204	{
    00205	    local int i;
    00206	    local float fScale, W, H;
    00207	//	local float LabelPosX, LabelPosY, LabelWidth, LabelHeight;
    00208
    00209	    Super.Paint(C,X,Y);
    00210	    // background
    00211	    if (myRoot.GetLevel().bCineFrame)
    00212		{
    00213		    C.Style = 5;
    00214			C.DrawColor = BlackColor;
    00215			C.DrawColor.A = 192;
    00216		    DrawStretchedTexture(C, 0, 0, WinWidth*C.ClipX, WinHeight*C.ClipY, myRoot.FondMenu);
    00217			C.Style = 1;
    00218		}
    00219		C.DrawColor = WhiteColor;
    00220		if ( GetPlayerOwner().Level.Game==none || GetPlayerOwner().Level.NetMode != 0 || GetPlayerOwner().Level.Game.NumPlayers == 1 )
    00221			C.DrawMsgboxBackground(false, BackgroundPosX*fRatioX, BackgroundPosY*fScaleTo*fRatioY, 10, 10, BackgroundWidth*fRatioX, BackgroundHeight*fScaleTo*fRatioY);
    00222		else
    00223		{
    00224			C.bUseBorder = true;
    00225			DrawStretchedTexture( C, BackgroundPosX, BackgroundPosY*fScaleTo, BackgroundWidth, BackgroundHeight*fScaleTo, texture'XIIIMenu.FonDialog');
    00226			C.bUseBorder = false;
    00227		}
    00228
    00229		// only selected control has a border (border is a XIIILabel without text)
    00230	/*	LabelPosX = BackgroundPosX + 5;
    00231		LabelPosY = BackgroundPosY + 16 + 39.5*FindComponentIndex(FocusedControl);
    00232		LabelWidth = BackgroundWidth - 10;
    00233		LabelHeight = 40.5;
    00234		if ( bSplitScreenMode )
    00235		{
    00236			if ( GetPlayerOwner().Level.Game.NumPlayers >= 2 )
    00237			{
    00238				LabelHeight *= 1.53;
    00239				LabelPosY = BackgroundPosY + 35 + (BoxHeight + BoxInterY)*FindComponentIndex(FocusedControl);;
    00240				if ( GetPlayerOwner().Level.Game.NumPlayers > 2 )
    00241				{
    00242					LabelPosX += 40;
    00243					LabelWidth *= 2;
    00244				}
    00245
} 00246 } 00247 InitLabel(InfoLabel, LabelPosX, LabelPosY*fScaleTo, LabelWidth, LabelHeight*fScaleTo, ""); 00248 C.Style = 1; 00249 C.DrawColor = WhiteColor; 00250 DrawLabel(C, InfoLabel, true, false); 00251 */ 00252 // restore old param 00253 C.DrawColor = WhiteColor; 00254 C.DrawColor.A = 255; 00255 C.Style = 1; 00256 C.bUseBorder = false; 00257 } 00258 00259 00260 function bool InternalOnKeyEvent(out byte Key, out byte State, float delta) 00261 { 00262 local int i; 00263 00264 if ((State==1) || (State==2))// IST_Press // to avoid auto-repeat 00265 { 00266 if (Key==0x0D/*IK_Enter*/) 00267 { 00268 if ( HadPadConfigChanged() ) 00269 { 00270 GetPlayerOwner().UserPadConfig = LocalPadConfig; 00271 PadConfigChanged(); 00272 LookSpeedChanged(); 00273 //RumbleChanged(); 00274 AutoAimChanged(); 00275 InvPadChanged(); 00276 //SaveConfigs(); // Also close menu as mentioned in state 'CloseMenu' (see XIIIWindow) 00277 } 00278 myRoot.CloseMenu(true); 00279 return true; 00280 } 00281 if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B)) 00282 { 00283 if ( bMemoUseRumble ) 00284 { 00285 if ( !GetPlayerOwner().bUseRumble ) 00286 { 00287 XIIIPlayerController( GetPlayerOwner( ) ).SetRumbleFX( true ); 00288 GetPlayerOwner().bUseRumble = true; 00289 XIIIPlayerController(GetPlayerOwner()).RumbleFX(13); 00290 } 00291 } 00292 else 00293 { 00294 if ( GetPlayerOwner().bUseRumble ) 00295 { 00296 XIIIPlayerController( GetPlayerOwner( ) ).SetRumbleFX( false ); 00297 GetPlayerOwner().bUseRumble = false; 00298 } 00299 } 00300 myRoot.CloseMenu(true); 00301 return true; 00302 } 00303 if (Key==0x26/*IK_Up*/) 00304 { 00305 PrevControl(FocusedControl); 00306 return true; 00307 } 00308 if (Key==0x28/*IK_Down*/) 00309 { 00310 NextControl(FocusedControl); 00311 return true; 00312 } 00313 if ((Key==0x25/*IK_Left*/) || (Key==0x27/*IK_Right*/)) 00314 { 00315 if (FocusedControl == Controls[0]) 00316 { 00317 if (Key==0x25) LocalPadConfig--; 00318 if (Key==0x27) LocalPadConfig++; 00319 LocalPadConfig = Clamp(LocalPadConfig,0,NbPadConfig - 1); 00320 00321 PadConfigButton.SetSelectedIndex(LocalPadConfig); 00322 } 00323 else if (FocusedControl == Controls[1]) 00324 { 00325 if (Key==0x25) 00326 { 00327 if ( RumbleButton.GetSelectedIndex()!=0 ) 00328 { 00329 RumbleButton.SetSelectedIndex( 0 ); 00330 XIIIPlayerController( GetPlayerOwner( ) ).SetRumbleFX( true ); 00331 GetPlayerOwner().bUseRumble = true; 00332 XIIIPlayerController(GetPlayerOwner()).RumbleFX(13); 00333 } 00334 } 00335 else if (Key==0x27) 00336 { 00337 if ( RumbleButton.GetSelectedIndex()!=1 ) 00338 { 00339 RumbleButton.SetSelectedIndex( 1 ); 00340 XIIIPlayerController( GetPlayerOwner( ) ).SetRumbleFX( false ); 00341 GetPlayerOwner().bUseRumble = false; 00342 } 00343 } 00344 } 00345 else if (FocusedControl == Controls[2]) 00346 { 00347 if (Key==0x27) AutoAimButton.SetSelectedIndex(1); 00348 else if (Key==0x25) AutoAimButton.SetSelectedIndex(0); 00349 } 00350 else if (FocusedControl == Controls[3]) 00351 { 00352 if (Key==0x27) InvPadButton.SetSelectedIndex(1); 00353 else if (Key==0x25) InvPadButton.SetSelectedIndex(0); 00354 } 00355 return true; 00356 } 00357 00358 } 00359 return super.InternalOnKeyEvent(Key, state, delta); 00360 } 00361 00362 //_____________________________________________________________________________ 00363 function PadConfigChanged() 00364 { 00365 00366 switch ( LocalPadConfig ) 00367 { 00368 case 0: 00369 // specific inputs for classic halo 00370 GetPlayerOwner().ConsoleCommand("SET XIIIPlayerController ConfigType CT_StrafeLookNotSameAxis"); 00371 GetPlayerOwner().ConsoleCommand("SET Input Joy1 Jump"); 00372 GetPlayerOwner().ConsoleCommand("SET Input Joy3 Grab"); 00373 GetPlayerOwner().ConsoleCommand("SET Input Joy4 PrevWeapon"); 00374 GetPlayerOwner().ConsoleCommand("SET Input Joy7 AltFire | onrelease UnFire"); 00375 GetPlayerOwner().ConsoleCommand("SET Input JoyX Axis aStrafe SpeedBase=1.0 DeadZone=0.4"); 00376 GetPlayerOwner().ConsoleCommand("SET Input JoyU Axis aTurn SpeedBase=1.0 DeadZone=0.4"); 00377 break; 00378 case 1: 00379 // specific inputs for goofy halo 00380 GetPlayerOwner().ConsoleCommand("SET XIIIPlayerController ConfigType CT_StrafeLookSameAxis"); 00381 GetPlayerOwner().ConsoleCommand("SET Input Joy1 Jump"); 00382 GetPlayerOwner().ConsoleCommand("SET Input Joy3 Grab"); 00383 GetPlayerOwner().ConsoleCommand("SET Input Joy4 PrevWeapon"); 00384 GetPlayerOwner().ConsoleCommand("SET Input Joy7 AltFire | onrelease UnFire"); 00385 GetPlayerOwner().ConsoleCommand("SET Input JoyX Axis aTurn SpeedBase=1.0 DeadZone=0.4"); 00386 GetPlayerOwner().ConsoleCommand("SET Input JoyU Axis aStrafe SpeedBase=1.0 DeadZone=0.4"); 00387 break; 00388 case 2: 00389 // specific inputs for classic XIII 00390 GetPlayerOwner().ConsoleCommand("SET XIIIPlayerController ConfigType CT_StrafeLookNotSameAxis"); 00391 GetPlayerOwner().ConsoleCommand("SET Input Joy1 Grab"); 00392 GetPlayerOwner().ConsoleCommand("SET Input Joy3 PrevWeapon"); 00393 GetPlayerOwner().ConsoleCommand("SET Input Joy4 AltFire | onrelease UnFire"); 00394 GetPlayerOwner().ConsoleCommand("SET Input Joy7 Jump"); 00395 GetPlayerOwner().ConsoleCommand("SET Input JoyX Axis aStrafe SpeedBase=1.0 DeadZone=0.4"); 00396 GetPlayerOwner().ConsoleCommand("SET Input JoyU Axis aTurn SpeedBase=1.0 DeadZone=0.4"); 00397 break; 00398 case 3: 00399 // specific inputs for goofy XIII 00400 GetPlayerOwner().ConsoleCommand("SET XIIIPlayerController ConfigType CT_StrafeLookSameAxis"); 00401 GetPlayerOwner().ConsoleCommand("SET Input Joy1 Grab"); 00402 GetPlayerOwner().ConsoleCommand("SET Input Joy3 PrevWeapon"); 00403 GetPlayerOwner().ConsoleCommand("SET Input Joy4 AltFire | onrelease UnFire"); 00404 GetPlayerOwner().ConsoleCommand("SET Input Joy7 Jump"); 00405 GetPlayerOwner().ConsoleCommand("SET Input JoyX Axis aTurn SpeedBase=1.0 DeadZone=0.4"); 00406 GetPlayerOwner().ConsoleCommand("SET Input JoyU Axis aStrafe SpeedBase=1.0 DeadZone=0.4"); 00407 break; 00408 } 00409 00410 GetPlayerOwner().OptimizeInputBindings(); 00411 } 00412 00413 00414 //_____________________________________________________________________________ 00415 function LookSpeedChanged() 00416 { 00417 local float f; 00418 00419 LSpeed = LookSpeedSlider.GetValue(); 00420 f = 0.7+float(LSpeed)/10.0; 00421 00422 GetPlayerOwner().fLookSpeed = f; 00423 } 00424 00425 00426 //_____________________________________________________________________________ 00427 function InvPadChanged() 00428 { 00429 GetPlayerOwner().bInverseLook = !bool(InvPadButton.GetSelectedIndex()); 00430 } 00431 00432 //_____________________________________________________________________________ 00433 function AutoAimChanged() 00434 { 00435 GetPlayerOwner().iAutoAimMode = 1-AutoAimButton.GetSelectedIndex(); 00436 } 00437 00438 00439

End Source Code