RMenu
Class RuneMenuInputOptionsClientWindow

source: c:\runehov\RMenu\Classes\RuneMenuInputOptionsClientWindow.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowWindow
         |
         +--UWindow.UWindowClientWindow
            |
            +--UWindow.UWindowDialogClientWindow
               |
               +--UWindow.UWindowPageWindow
                  |
                  +--RMenu.RuneMenuPageWindow
                     |
                     +--RMenu.RuneMenuInputOptionsClientWindow
Direct Known Subclasses:None

class RuneMenuInputOptionsClientWindow
extends RMenu.RuneMenuPageWindow


Variables
 UWindowCheckbox AutoAimCheck
 string AutoAimHelp
 string AutoAimText
 UWindowCheckbox AutoSlopeCheck
 string AutoSlopeHelp
 string AutoSlopeText
 float ControlOffset
 UWindowCheckbox DirectInputCheck
 string DirectInputHelp
 string DirectInputText
 UWindowCheckbox InvertMouseCheck
 string InvertMouseHelp
 string InvertMouseText
 UWindowCheckbox JoystickCheck
 string JoystickHelp
 string JoystickText
 UWindowCheckbox LookSpringCheck
 string LookSpringHelp
 string LookSpringText
 string MouseHelp
 UWindowHSliderControl MouseSlider
 UWindowCheckbox MouseSmoothCheck
 string MouseSmoothHelp
 string MouseSmoothText
 string MouseText
 UWindowCheckbox MouselookCheck
 string MouselookHelp
 string MouselookText
 UWindowEditControl SensitivityEdit
 string SensitivityHelp
 string SensitivityText


Function Summary
 void AfterCreate()
 void AutoAimChecked()
     
/*
 * Message Crackers
 */
 void AutoSlopeChecked()
 void BeforePaint(Canvas C, float X, float Y)
 void Created()
 void DirectInputChecked()
 void InvertMouseChecked()
 void JoystickChecked()
 void LookSpringChecked()
 void MouseChanged()
 void MouseSmoothChanged()
 void MouselookChecked()
 void Notify(UWindowDialogControl C, byte E)
 void SaveConfigs()
 void SensitivityChanged()



Source Code


00001	class RuneMenuInputOptionsClientWindow extends RuneMenuPageWindow;
00002	
00003	// Auto Aim
00004	var UWindowCheckbox AutoAimCheck;
00005	var localized string AutoAimText;
00006	var localized string AutoAimHelp;
00007	
00008	// Joystick
00009	var UWindowCheckbox JoystickCheck;
00010	var localized string JoystickText;
00011	var localized string JoystickHelp;
00012	
00013	// DirectInput
00014	var UWindowCheckbox DirectInputCheck;
00015	var localized string DirectInputText;
00016	var localized string DirectInputHelp;
00017	
00018	// Mouse Sensitivity
00019	var UWindowEditControl SensitivityEdit;
00020	var localized string SensitivityText;
00021	var localized string SensitivityHelp;
00022	
00023	// Invert Mouse
00024	var UWindowCheckbox InvertMouseCheck;
00025	var localized string InvertMouseText;
00026	var localized string InvertMouseHelp;
00027	
00028	// Look Spring
00029	var UWindowCheckbox LookSpringCheck;
00030	var localized string LookSpringText;
00031	var localized string LookSpringHelp;
00032	
00033	// Always Mouselook
00034	var UWindowCheckbox MouselookCheck;
00035	var localized string MouselookText;
00036	var localized string MouselookHelp;
00037	
00038	// Mouse smoothing
00039	var UWindowCheckbox MouseSmoothCheck;
00040	var localized string MouseSmoothText;
00041	var localized string MouseSmoothHelp;
00042	
00043	// Auto Slope
00044	var UWindowCheckbox AutoSlopeCheck;
00045	var localized string AutoSlopeText;
00046	var localized string AutoSlopeHelp;
00047	
00048	// Mouse Speed
00049	var UWindowHSliderControl MouseSlider;
00050	var localized string MouseText;
00051	var localized string MouseHelp;
00052	
00053	var float ControlOffset;
00054	
00055	function Created()
00056	{
00057		local int ControlWidth, ControlLeft, ControlRight;
00058		local int CenterWidth, CenterPos, i;
00059		local string Sens;
00060	
00061		Super.Created();
00062	
00063		ControlWidth = WinWidth/2.5;
00064		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00065		ControlRight = WinWidth/2 + ControlLeft;
00066	
00067		CenterWidth = (WinWidth/4)*3;
00068		CenterPos = (WinWidth - CenterWidth)/2;
00069	
00070		// GUI Mouse speed
00071		MouseSlider = UWindowHSliderControl(CreateControl(class'UWindowHSliderControl', CenterPos, ControlOffset, CenterWidth, 1));
00072		MouseSlider.bNoSlidingNotify = True;
00073		MouseSlider.SetRange(40, 500, 5);
00074		MouseSlider.SetText(MouseText);
00075		MouseSlider.SetHelpText(MouseHelp);
00076		MouseSlider.SetFont(F_Normal);
00077		MouseSlider.SetValue(Root.Console.MouseScale * 100);
00078		MouseSlider.Align = TA_Left;
00079		ControlOffset += 25;
00080	
00081		// Joystick
00082		JoystickCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlLeft, ControlOffset, ControlWidth, 1));
00083		JoystickCheck.bChecked = bool(GetPlayerOwner().ConsoleCommand("get windrv.windowsclient usejoystick"));
00084		JoystickCheck.SetText(JoystickText);
00085		JoystickCheck.SetHelpText(JoystickHelp);
00086		JoystickCheck.SetFont(F_Normal);
00087		JoystickCheck.Align = TA_Left;
00088		ControlOffset += 25;
00089	
00090		// Auto Aim
00091		AutoAimCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlRight, ControlOffset, ControlWidth, 1));
00092		if (GetPlayerOwner().MyAutoAim < 1.0)
00093			AutoAimCheck.bChecked = true;
00094		AutoAimCheck.SetText(AutoAimText);
00095		AutoAimCheck.SetHelpText(AutoAimHelp);
00096		AutoAimCheck.SetFont(F_Normal);
00097		AutoAimCheck.Align = TA_Left;
00098		ControlOffset += 25;
00099	
00100		// DirectInput
00101		DirectInputCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlLeft, ControlOffset, ControlWidth, 1));
00102		DirectInputCheck.bChecked = bool(GetPlayerOwner().ConsoleCommand("get windrv.windowsclient UseDirectInput"));
00103		DirectInputCheck.SetText(DirectInputText);
00104		DirectInputCheck.SetHelpText(DirectInputHelp);
00105		DirectInputCheck.SetFont(F_Normal);
00106		DirectInputCheck.Align = TA_Left;
00107		ControlOffset += 25;
00108	
00109		// Look Spring
00110		LookSpringCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlRight, ControlOffset, ControlWidth, 1));
00111		if (GetPlayerOwner().bSnapToLevel)
00112			LookSpringCheck.bChecked = true;
00113		LookSpringCheck.SetText(LookSpringText);
00114		LookSpringCheck.SetHelpText(LookSpringHelp);
00115		LookSpringCheck.SetFont(F_Normal);
00116		LookSpringCheck.Align = TA_Left;
00117		ControlOffset += 25;
00118	
00119		// Always Mouselook
00120		MouselookCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlLeft, ControlOffset, ControlWidth, 1));
00121		if (GetPlayerOwner().bAlwaysMouselook)
00122			MouselookCheck.bChecked = true;
00123		MouselookCheck.SetText(MouselookText);
00124		MouselookCheck.SetHelpText(MouselookHelp);
00125		MouselookCheck.SetFont(F_Normal);
00126		MouselookCheck.Align = TA_Left;
00127		ControlOffset += 25;
00128	
00129		// Auto Slope
00130		AutoSlopeCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlRight, ControlOffset, ControlWidth, 1));
00131		if (GetPlayerOwner().bLookUpStairs)
00132			AutoSlopeCheck.bChecked = true;
00133		AutoSlopeCheck.SetText(AutoSlopeText);
00134		AutoSlopeCheck.SetHelpText(AutoSlopeHelp);
00135		AutoSlopeCheck.SetFont(F_Normal);
00136		AutoSlopeCheck.Align = TA_Left;
00137		ControlOffset += 25;
00138	
00139		// Mouse Smoothing
00140		MouseSmoothCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlLeft, ControlOffset, ControlWidth, 1));
00141		MouseSmoothCheck.bChecked = GetPlayerOwner().bMaxMouseSmoothing;
00142		MouseSmoothCheck.SetText(MouseSmoothText);
00143		MouseSmoothCheck.SetHelpText(MouseSmoothHelp);
00144		MouseSmoothCheck.SetFont(F_Normal);
00145		MouseSmoothCheck.Align = TA_Left;
00146		ControlOffset += 25;
00147	
00148		// Mouse Sensitivity
00149		SensitivityEdit = UWindowEditControl(CreateControl(class'UWindowEditControl', ControlRight, ControlOffset, ControlWidth, 1));
00150		SensitivityEdit.SetText(SensitivityText);
00151		SensitivityEdit.SetHelpText(SensitivityHelp);
00152		SensitivityEdit.SetFont(F_Normal);
00153		SensitivityEdit.SetNumericOnly(True);
00154		SensitivityEdit.SetNumericFloat(True);
00155		SensitivityEdit.SetMaxLength(4);
00156		Sens = string(GetPlayerOwner().MouseSensitivity);
00157		i = InStr(Sens, ".");
00158		SensitivityEdit.SetValue(Left(Sens, i+3));
00159		SensitivityEdit.Align = TA_Left;
00160		ControlOffset += 25;
00161	
00162		// Invert Mouse
00163		InvertMouseCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlLeft, ControlOffset, ControlWidth, 1));
00164		if (GetPlayerOwner().bInvertMouse)
00165			InvertMouseCheck.bChecked = true;
00166		InvertMouseCheck.SetText(InvertMouseText);
00167		InvertMouseCheck.SetHelpText(InvertMouseHelp);
00168		InvertMouseCheck.SetFont(F_Normal);
00169		InvertMouseCheck.Align = TA_Left;
00170		ControlOffset += 25;
00171	}
00172	
00173	function AfterCreate()
00174	{
00175		DesiredWidth = 220;
00176		DesiredHeight = ControlOffset;
00177	}
00178	
00179	function BeforePaint(Canvas C, float X, float Y)
00180	{
00181		local int ControlWidth, ControlLeft, ControlRight;
00182		local int CenterWidth, CenterPos;
00183	
00184		Super.BeforePaint(C, X, Y);
00185	
00186		ControlWidth = WinWidth/2.5;
00187		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00188		ControlRight = WinWidth/2 + ControlLeft;
00189	
00190		CenterWidth = (WinWidth/4)*3;
00191		CenterPos = (WinWidth - CenterWidth)/2;
00192	
00193		AutoAimCheck.SetSize(CenterWidth-100+16, 1);
00194		AutoAimCheck.WinLeft = CenterPos;
00195	
00196		JoystickCheck.SetSize(CenterWidth-100+16, 1);
00197		JoystickCheck.WinLeft = CenterPos;
00198	
00199		InvertMouseCheck.SetSize(CenterWidth-100+16, 1);
00200		InvertMouseCheck.WinLeft = CenterPos;
00201	
00202		DirectInputCheck.SetSize(CenterWidth-100+16, 1);
00203		DirectInputCheck.WinLeft = CenterPos;
00204	
00205		LookSpringCheck.SetSize(CenterWidth-100+16, 1);
00206		LookSpringCheck.WinLeft = CenterPos;
00207	
00208		MouselookCheck.SetSize(CenterWidth-100+16, 1);
00209		MouselookCheck.WinLeft = CenterPos;
00210	
00211		AutoSlopeCheck.SetSize(CenterWidth-100+16, 1);
00212		AutoSlopeCheck.WinLeft = CenterPos;
00213	
00214		MouseSmoothCheck.SetSize(CenterWidth-100+16, 1);
00215		MouseSmoothCheck.WinLeft = CenterPos;
00216	
00217		SensitivityEdit.SetSize(CenterWidth-100+30, 1);
00218		SensitivityEdit.WinLeft = CenterPos;
00219		SensitivityEdit.EditBoxWidth = 30;
00220	
00221		MouseSlider.SetSize(CenterWidth, 1);
00222		MouseSlider.SliderWidth = 100;
00223		MouseSlider.WinLeft = CenterPos;
00224	}
00225	
00226	function Notify(UWindowDialogControl C, byte E)
00227	{
00228		Super.Notify(C, E);
00229		switch(E)
00230		{
00231		case DE_Change:
00232			switch(C)
00233			{
00234			case AutoAimCheck:
00235				AutoAimChecked();
00236				break;
00237			case JoystickCheck:
00238				JoystickChecked();
00239				break;
00240			case DirectInputCheck:
00241				DirectInputChecked();
00242				break;
00243			case InvertMouseCheck:
00244				InvertMouseChecked();
00245				break;
00246			case LookSpringCheck:
00247				LookSpringChecked();
00248				break;
00249			case MouselookCheck:
00250				MouselookChecked();
00251				break;
00252			case AutoSlopeCheck:
00253				AutoSlopeChecked();
00254				break;
00255			case SensitivityEdit:
00256				SensitivityChanged();
00257				break;
00258			case MouseSmoothCheck:
00259				MouseSmoothChanged();
00260				break;
00261			case MouseSlider:
00262				MouseChanged();
00263				break;
00264			}
00265		}
00266	}
00267	
00268	/*
00269	 * Message Crackers
00270	 */
00271	
00272	function AutoAimChecked()
00273	{
00274		if(AutoAimCheck.bChecked)
00275		{
00276			GetPlayerOwner().ChangeAutoAim(0.93);
00277		} else {
00278			GetPlayerOwner().ChangeAutoAim(1.0);
00279		}
00280	}
00281	
00282	function JoystickChecked()
00283	{
00284		if(JoystickCheck.bChecked)
00285		{
00286			GetPlayerOwner().ConsoleCommand("set windrv.windowsclient usejoystick 1");
00287		} else {
00288			GetPlayerOwner().ConsoleCommand("set windrv.windowsclient usejoystick 0");
00289		}
00290	}
00291	
00292	function DirectInputChecked()
00293	{
00294		if(DirectInputCheck.bChecked)
00295		{
00296			GetPlayerOwner().ConsoleCommand("set windrv.windowsclient UseDirectInput 1");
00297		} else {
00298			GetPlayerOwner().ConsoleCommand("set windrv.windowsclient UseDirectInput 0");
00299		}
00300	}
00301	
00302	function InvertMouseChecked()
00303	{
00304		GetPlayerOwner().bInvertMouse = InvertMouseCheck.bChecked;
00305	}
00306	
00307	function LookSpringChecked()
00308	{
00309		GetPlayerOwner().bSnapToLevel = LookSpringCheck.bChecked;
00310	}
00311	
00312	function MouselookChecked()
00313	{
00314		GetPlayerOwner().bAlwaysMouseLook = MouselookCheck.bChecked;
00315	}
00316	
00317	function AutoSlopeChecked()
00318	{
00319		GetPlayerOwner().bLookUpStairs = AutoSlopeCheck.bChecked;
00320	}
00321	
00322	function SensitivityChanged()
00323	{
00324		GetPlayerOwner().MouseSensitivity = float(SensitivityEdit.EditBox.Value);
00325	}
00326	
00327	function MouseSmoothChanged()
00328	{
00329		GetPlayerOwner().bMaxMouseSmoothing = MouseSmoothCheck.bChecked;
00330	}
00331	
00332	function MouseChanged()
00333	{
00334		Root.Console.MouseScale = (MouseSlider.Value / 100);
00335		Root.Console.SaveConfig();
00336	}
00337	
00338	function SaveConfigs()
00339	{
00340		GetPlayerOwner().SaveConfig();
00341		Super.SaveConfigs();
00342	}
00343	
00344	defaultproperties
00345	{
00346	     AutoAimText="Auto Aim"
00347	     AutoAimHelp="Enable or disable vertical aiming help."
00348	     JoystickText="Joystick"
00349	     JoystickHelp="Enable or disable joystick."
00350	     DirectInputText="DirectInput"
00351	     DirectInputHelp="Enabling DirectInput on Windows 9x machines will improve mouse smoothness.  You must restart the game for this setting to take effect."
00352	     SensitivityText="Mouse Sensitivity"
00353	     SensitivityHelp="Adjust the mouse sensitivity, or how far you have to move the mouse to produce a given motion in the game."
00354	     InvertMouseText="Invert Mouse"
00355	     InvertMouseHelp="Invert the mouse X axis.  When true, pushing the mouse forward causes you to look down rather than up."
00356	     LookSpringText="Look Spring"
00357	     LookSpringHelp="If checked, releasing the mouselook key will automatically center the view. Only valid if Mouselook is disabled."
00358	     MouselookText="Mouselook"
00359	     MouselookHelp="If checked, the mouse is always used for controlling your view direction."
00360	     MouseSmoothText="Mouse Smoothing"
00361	     MouseSmoothHelp="If checked, mouse input will be smoothed to improve Mouselook smoothness."
00362	     AutoSlopeText="Auto Slope"
00363	     AutoSlopeHelp="If checked, your view will automatically adjust to look up and down slopes and stairs. Only valid if Mouselook is disabled."
00364	     MouseText="GUI Mouse Speed"
00365	     MouseHelp="Adjust the speed of the mouse in the User Interface."
00366	     ControlOffset=20.000000
00367	}

End Source Code