## XIDInterf
Class XIIIMenuAdvancedControlsWindow

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

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

Direct Known Subclasses:None

class XIIIMenuAdvancedControlsWindow
extends XIDInterf.XIIIWindow

Variables
`AutoAimCheck,` | `InvPadCheck` NL 1306, FactorSlider
`AutoAimText,` | `InvPadText` NL 1306 RSpeedText
`int` | `LSpeed` NL 1306 Factor
`XIIIHSliderControl` | `LookSpeedSlider` NL 1306, FactorSlider
`XIIIMenuControlsWindow` | `PWin` NL 1306 RSpeedText
`float` | `controloffset` NL 1306 Factor
`int` | `iObjDecalY` NL 1306 Factor
`sBackground[4],` | `sHighlight` NL 1306 Factor
`Texture` | `tBackGround[4]` NL 1306 Factor
`Texture` | `tHighlight` NL 1306 Factor

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

Source Code

    00001	class XIIIMenuAdvancedControlsWindow extends XIIIWindow;
    00002
    00003	var XIIIHSliderControl LookSpeedSlider;// NL 1306, FactorSlider
    00004	var XIIICheckboxControl RumbleCheck, AutoAimCheck, InvPadCheck;
    00005	var localized string TitleText, RumbleCUBEText, LSpeedText, RumbleText, AutoAimText, InvPadText;//NL 1306 RSpeedText
    00006	var XIIIMenuControlsWindow PWin;
    00007
    00008	var int LSpeed;//NL 1306 Factor
    00009	var float controloffset;
    00010
    00011	var texture tBackGround[4];
    00012	var texture tHighlight;
    00013	var string sBackground[4], sHighlight;
    00014	var int iObjDecalY;
    00015
    00016
    00017	function Created()
    00018	{
    00019	    local int i;
    00020
    00021	    Super.Created();
    00022
    00023	     for (i=0; i<4; i++)
    00024	         tBackGround[i] = texture(DynamicLoadObject(sBackGround[i], class'Texture'));
    00025
    00026	     tHighlight = texture(DynamicLoadObject(sHighlight, class'Texture'));
    00027
    00028	    // Rumble
    00029	    RumbleCheck = XIIICheckboxControl(CreateControl(class'XIIICheckboxControl', 179, 150*fScaleTo, 282, 29));
    00030	    RumbleCheck.bChecked = GetPlayerOwner().bUseRumble;
    00031	    if (myRoot.CurrentPF==3)
    00032		RumbleCheck.Text = RumbleCUBEText;
    00033	    else
    00034	     	RumbleCheck.Text = RumbleText;
    00035	    RumbleCheck.bWhiteColorOnlyWhenFocused = true;
    00036
    00037	    // AutoAim
    00038	    AutoAimCheck = XIIICheckboxControl(CreateControl(class'XIIICheckboxControl', 179, 189*fScaleTo, 282, 29));
    00039	    AutoAimCheck.bChecked = bool(GetPlayerOwner().iAutoAimMode);
    00040	    AutoAimCheck.Text = AutoAimText;
    00041		AutoAimCheck.bWhiteColorOnlyWhenFocused = true;
    00042
    00043	    // Inverse Pad
    00044	    InvPadCheck = XIIICheckboxControl(CreateControl(class'XIIICheckboxControl', 179, 228*fScaleTo, 282, 29));
    00045	    InvPadCheck.bChecked = GetPlayerOwner().bInverseLook;
    00046	    InvPadCheck.Text = InvPadText;
    00047		InvPadCheck.bWhiteColorOnlyWhenFocused = true;
    00048
    00049	    // Create Look speed slider
    00050	    LookSpeedSlider = XIIIHSliderControl(CreateControl(class'XIIIHSliderControl', 179, 267*fScaleTo, 300, 29));
    00051	    LookSpeedSlider.SetRange(0, 10, 1, 160);
    00052	    LookSpeedSlider.Text = LSpeedText;
    00053
    00054	    Controls[0] = RumbleCheck;
    00055		Controls[1] = AutoAimCheck;
    00056	    Controls[2] = InvPadCheck;
    00057	    Controls[3] = LookSpeedSlider;
    00058
    00059	}
    00060
    00061
    00062	//_____________________________________________________________________________
    00063	function ShowWindow()
    00064	{
    00065	    PWin = XIIIMenuControlsWindow(ParentPage);
    00066	    InitValues();
    00067
    00068	    Super.ShowWindow();
    00069	    bShowCCL = true;
    00070	    bShowACC = true;
    00071	}
    00072
    00073
    00074
    00075	function InitValues()
    00076	{
    00077	    local int i, StrPos;
    00078	    local float f;
    00079
    00080	    RumbleCheck.bChecked = GetPlayerOwner().bUseRumble;
    00081	    AutoAimCheck.bChecked = bool(GetPlayerOwner().iAutoAimMode);
    00082	    InvPadCheck.bChecked = GetPlayerOwner().bInverseLook;
    00083
    00084	    StrPos = 0;
    00085	// NL 1306    Factor = PWin.Factor;
    00086	// NL 1306    log(Pwin$": "$int(right(left(PWin.PadConfig[0], strpos + 8), 1)));
    00087	// NL 1306    log(PWin.PadConfig[0]);
    00088	// NL 1306    log(Factor);
    00089
    00090	    //f = float(GetPlayerOwner().ConsoleCommand("Get XIIIPlayerController fLookSpeed"));
    00091	    f = GetPlayerOwner().fLookSpeed;
    00092	    LSpeed = int( ((f-0.7) * 10.0)+0.1 ); // FUCK the innacurate floats
    00093	//    Log("InitValues fLookSpeed="$f@"LSpeed="$LSpeed@"Factor="$Factor);
    00094
    00095	    LookSpeedSlider.SetValue(LSpeed);
    00096	// NL 1306    FactorSlider.SetValue(Factor);
    00097	}
    00098
    00099
    00100	function Paint(Canvas C, float X, float Y)
    00101	{
    00102	    local float W, H;
    00103
    00104	    Super.Paint(C, X, Y);
    00105	    C.Style = 5;
    00106	    DrawStretchedTexture(C, 0, 0, 320*fRatioX, 240*fScaleTo*fRatioY, tBackGround[0]);
    00107	    DrawStretchedTexture(C, 320*fRatioX, 0, 320*fRatioX, 240*fScaleTo*fRatioY, tBackGround[1]);
    00108	    DrawStretchedTexture(C, 0, 240*fScaleTo*fRatioY, 320*fRatioX, 240*fScaleTo*fRatioY, tBackGround[2]);
    00109	    DrawStretchedTexture(C, 320*fRatioX, 240*fScaleTo*fRatioY, 320*fRatioX, 240*fScaleTo*fRatioY, tBackGround[3]);
    00110
    00111	    C.DrawColor.A = 128;
    00112	    DrawStretchedTexture(C, 168*fRatioX, (142 + FindComponentIndex(FocusedControl)*40)*fScaleTo*fRatioY, 301*fRatioX, 40*fRatioY, tHighLight);
    00113	    C.DrawColor.A = 255;
    00114
    00115	    C.bUseBorder = true;
    00116	    DrawStretchedTexture(C, 240*fRatioX, 55*fRatioY, 160*fRatioX, 40*fRatioY, myRoot.FondMenu);
    00117	    C.TextSize(TitleText, W, H);
    00118	    C.DrawColor = BlackColor;
    00119	    C.SetPos((320-W/2)*fRatioX, (75-H/2)*fRatioY);
    00120		C.DrawText(TitleText, false);
    00121	    C.bUseBorder = false;
    00122	    C.DrawColor = WhiteColor;
    00123	}
    00124
    00125
    00126	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
    00127	{
    00128	    local int i;
    00129
    00130	    if ((State==1) || (State==2))// IST_Press // to avoid auto-repeat
    00131	    {
    00132	        if (Key==0x0D/*IK_Enter*/)
    00133		    {
    00134	            LookSpeedChanged();
    00135	            RumbleChanged();
    00136				AutoAimChanged();
    00137	            InvPadChanged();
    00138	//            SaveConfigs();
    00139				SaveConfig();
    00140				myRoot.CloseMenu(false);
    00141				// Also close menu as mentioned in state 'CloseMenu' (see XIIIWindow)
    00142	// NL 1306            log(Factor);
    00143	// NL 1306            PWin.Factor = Factor;
    00144	            PWin.PadConfigChanged();
    00145	            //Controller.FocusedControl.OnClick(Self);
    00146	            return true;
    00147		    }
    00148		    if (Key==0x08/*IK_Backspace*/)
    00149		    {
    00150		        myRoot.CloseMenu(true);
    00151	    	    return true;
    00152		    }
    00153		    if (Key==0x26/*IK_Up*/)
    00154		    {
    00155	  	        PrevControl(FocusedControl);
    00156	    	    return true;
    00157		    }
    00158		    if (Key==0x28/*IK_Down*/)
    00159		    {
    00160	            NextControl(FocusedControl);
    00161	    	    return true;
    00162		    }
    00163		    if ((Key==0x25) || (Key==0x27))
    00164		    {
    00165	            OnMenu = FindComponentIndex(FocusedControl);
    00166	            if (OnMenu == 0)
    00167	            {
    00168	                if (Key==0x25) RumbleCheck.bChecked = true;
    00169	                else if (Key==0x27) RumbleCheck.bChecked = false;
    00170	            }
    00171	            else if (OnMenu == 1)
    00172	            {
    00173	                if (Key==0x25) AutoAimCheck.bChecked = true;
    00174	                else if (Key==0x27) AutoAimCheck.bChecked = false;
    00175	            }
    00176	            else if (OnMenu == 2)
    00177	            {
    00178	                if (Key==0x25) InvPadCheck.bChecked = true;
    00179	                else if (Key==0x27) InvPadCheck.bChecked = false;
    00180	            }
    00181	            return true;
    00182	        }
    00183	    }
    00184	    return super.InternalOnKeyEvent(Key, state, delta);
    00185	}
    00186
    00187
    00188
    00189	//_____________________________________________________________________________
    00190	function LookSpeedChanged()
    00191	{
    00192	//    local string Command;
    00193	    local float f;
    00194
    00195	    LSpeed = LookSpeedSlider.GetValue();
    00196	    f = 0.7+ float(LSpeed)/10.0;
    00197	    log("LSPEED: "$LSpeed$"  "$f);
    00198	//    log("CHANGING LOOKSPEED "$LSpeed$" "$f);
    00199	//    Command = "set XIIIPlayerController fLookSpeed "$f;
    00200	//    Log("LSpeed="$LSpeed@"Command='"$Command$"'");
    00201	//    GetPlayerOwner().ConsoleCommand(Command);
    00202	    GetPlayerOwner().fLookSpeed = f;
    00203	}
    00204
    00205	//_____________________________________________________________________________
    00206	function InvPadChanged()
    00207	{
    00208	    GetPlayerOwner().bInverseLook = InvPadCheck.bChecked;
    00209	}
    00210
    00211	//_____________________________________________________________________________
    00212	function RumbleChanged()
    00213	{
    00214	    GetPlayerOwner().bUseRumble = RumbleCheck.bChecked;
    00215	}
    00216
    00217	//_____________________________________________________________________________
    00218	function AutoAimChanged()
    00219	{
    00220	    GetPlayerOwner().iAutoAimMode = int(AutoAimCheck.bChecked);
    00221	}
    00222
    00223
    00224
    00225

End Source Code