UnrealShare
Class UnrealOptionsMenu

source: e:\games\UnrealTournament\UnrealShare\Classes\UnrealOptionsMenu.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Menu
         |
         +--UnrealShare.UnrealMenu
            |
            +--UnrealShare.UnrealLongMenu
               |
               +--UnrealShare.UnrealOptionsMenu
Direct Known Subclasses:None

class UnrealOptionsMenu
extends UnrealShare.UnrealLongMenu

//============================================================================= // UnrealOptionsMenu //=============================================================================
Variables
 string FastInternetOption
 Texture HUDIcon[6]
 string HideString
 string InternetOption
 string LANOption
 string MenuValues[20]


Function Summary
 void DrawMenu(Canvas Canvas)
 void DrawValues(Canvas Canvas, Font RegFont, int Spacing, int StartX, int StartY)
 bool ProcessLeft()
 bool ProcessNo()
 bool ProcessRight()
 bool ProcessSelection()
 bool ProcessYes()
 void SaveConfigs()
 int StepSize()



Source Code


00001	//=============================================================================
00002	// UnrealOptionsMenu
00003	//=============================================================================
00004	class UnrealOptionsMenu extends UnrealLongMenu;
00005	
00006	#exec Texture Import File=Textures\hud1.pcx Name=Hud1 MIPS=OFF
00007	#exec Texture Import File=Textures\hud2.pcx Name=Hud2 MIPS=OFF
00008	#exec Texture Import File=Textures\hud3.pcx Name=Hud3 MIPS=OFF
00009	#exec Texture Import File=Textures\hud4.pcx Name=Hud4 MIPS=OFF
00010	#exec Texture Import File=Textures\hud5.pcx Name=Hud5 MIPS=OFF
00011	#exec Texture Import File=Textures\hud6.pcx Name=Hud6 MIPS=OFF
00012	
00013	var() texture HUDIcon[6];
00014	var   string MenuValues[20];
00015	var	  bool bJoystick;
00016	var localized string HideString;
00017	
00018	var localized string InternetOption;
00019	var localized string FastInternetOption;
00020	var localized string LANOption;
00021	
00022	function int StepSize()
00023	{
00024		if ( PlayerOwner.Player.CurrentNetSpeed < 5000 )
00025			return 100;
00026		else if ( PlayerOwner.Player.CurrentNetSpeed < 10000 )
00027			return 500;
00028		else
00029			return 1000;
00030	}
00031	
00032	function bool ProcessYes()
00033	{
00034		if ( Selection == 1 )
00035			PlayerOwner.ChangeAutoAim(0.93);
00036		else if ( Selection == 2 )
00037		{
00038			bJoystick = true;
00039			PlayerOwner.ConsoleCommand("set windrv.windowsclient usejoystick "$int(bJoystick));
00040		}
00041		else if ( Selection == 4 )
00042			PlayerOwner.bInvertMouse = True;
00043		else if ( Selection == 5 )
00044			PlayerOwner.ChangeSnapView(True);
00045		else if ( Selection == 6 )
00046			PlayerOwner.ChangeAlwaysMouseLook(True);
00047		else if ( Selection == 7 )
00048			PlayerOwner.ChangeStairLook(True);
00049		else if ( Selection == 8 )
00050			PlayerOwner.bNoFlash = true;
00051		else 
00052			return false;
00053	
00054		return true;
00055	}
00056	
00057	function bool ProcessNo()
00058	{
00059		if ( Selection == 1 )
00060			PlayerOwner.ChangeAutoAim(1);
00061		else if ( Selection == 2 )
00062		{
00063			bJoystick = false;
00064			PlayerOwner.ConsoleCommand("set windrv.windowsclient usejoystick "$int(bJoystick));
00065		}
00066		else if ( Selection == 4 )
00067			PlayerOwner.bInvertMouse = False;
00068		else if ( Selection == 5 )
00069			PlayerOwner.ChangeSnapView(False);
00070		else if ( Selection == 6 )
00071			PlayerOwner.ChangeAlwaysMouseLook(False);
00072		else if ( Selection == 7 )
00073			PlayerOwner.ChangeStairLook(False);
00074		else if ( Selection == 8 )
00075			PlayerOwner.bNoFlash = false;
00076		else 
00077			return false;
00078	
00079		return true;
00080	}
00081	
00082	function bool ProcessLeft()
00083	{
00084		local int NewSpeed;
00085	
00086		if ( Selection == 1 )
00087		{
00088			if ( PlayerOwner.MyAutoAim == 1 )
00089				PlayerOwner.ChangeAutoAim(0.93);
00090			else
00091				PlayerOwner.ChangeAutoAim(1);
00092		}
00093		else if ( Selection == 2 )
00094		{
00095			bJoystick = !bJoystick;
00096			PlayerOwner.ConsoleCommand("set windrv.windowsclient usejoystick "$int(bJoystick));
00097		}
00098		else if ( Selection == 3 )
00099			PlayerOwner.UpdateSensitivity(FMax(1,PlayerOwner.MouseSensitivity - 1));
00100		else if ( Selection == 4 )
00101			PlayerOwner.bInvertMouse = !PlayerOwner.bInvertMouse;
00102		else if ( Selection == 5 )
00103			PlayerOwner.ChangeSnapView(!PlayerOwner.bSnapToLevel);
00104		else if ( Selection == 6 )
00105			PlayerOwner.ChangeAlwaysMouseLook(!PlayerOwner.bAlwaysMouseLook);
00106		else if ( Selection == 7 )
00107			PlayerOwner.ChangeStairLook(!PlayerOwner.bLookUpStairs);
00108		else if ( Selection == 8 )
00109			PlayerOwner.bNoFlash = !PlayerOwner.bNoFlash;
00110		else if ( Selection == 9 )
00111			PlayerOwner.ChangeCrossHair();
00112		else if ( Selection == 10 )
00113		{
00114			if ( PlayerOwner.Handedness == 1 )
00115				PlayerOwner.ChangeSetHand("Hidden");
00116			else if ( PlayerOwner.Handedness == 2 )
00117				PlayerOwner.ChangeSetHand("Right");
00118			else if ( PlayerOwner.Handedness == 0 )
00119				PlayerOwner.ChangeSetHand("Left");
00120			else 
00121				PlayerOwner.ChangeSetHand("Center");
00122		}
00123		else if ( Selection == 11 )
00124		{
00125			if ( PlayerOwner.DodgeClickTime > 0 )
00126				PlayerOwner.ChangeDodgeClickTime(-1);
00127			else
00128				PlayerOwner.ChangeDodgeClickTime(0.25);
00129		}
00130		else if ( Selection == 14 )
00131			PlayerOwner.myHUD.ChangeHUD(-1);
00132		else if ( Selection == 15 )
00133			PlayerOwner.UpdateBob(PlayerOwner.Bob - 0.004);
00134		else if ( Selection == 16 )
00135		{
00136			if ( PlayerOwner.Player.CurrentNetSpeed <= 3000 )
00137				NewSpeed = 20000;
00138			else if ( PlayerOwner.Player.CurrentNetSpeed < 12500 )
00139				NewSpeed = 2600;
00140			else
00141				NewSpeed = 5000;
00142	
00143			PlayerOwner.ConsoleCommand("NETSPEED "$NewSpeed);
00144		}
00145		else 
00146			return false;
00147	
00148		return true;
00149	}
00150	
00151	function bool ProcessRight()
00152	{
00153		local int NewSpeed;
00154	
00155		if ( Selection == 1 )
00156		{
00157			if ( PlayerOwner.MyAutoAim == 1 )
00158				PlayerOwner.ChangeAutoAim(0.93);
00159			else
00160				PlayerOwner.ChangeAutoAim(1);
00161		}
00162		else if ( Selection == 2 )
00163		{
00164			bJoystick = !bJoystick;
00165			PlayerOwner.ConsoleCommand("set windrv.windowsclient usejoystick "$int(bJoystick));
00166		}
00167		else if ( Selection == 3 )
00168			PlayerOwner.UpdateSensitivity(PlayerOwner.MouseSensitivity + 1);
00169		else if ( Selection == 4 )
00170			PlayerOwner.bInvertMouse = !PlayerOwner.bInvertMouse;
00171		else if ( Selection == 5 )
00172			PlayerOwner.ChangeSnapView(!PlayerOwner.bSnapToLevel);
00173		else if ( Selection == 6 )
00174			PlayerOwner.ChangeAlwaysMouseLook(!PlayerOwner.bAlwaysMouseLook);
00175		else if ( Selection == 7 )
00176			PlayerOwner.ChangeStairLook(!PlayerOwner.bLookUpStairs);
00177		else if ( Selection == 8 )
00178			PlayerOwner.bNoFlash = !PlayerOwner.bNoFlash;
00179		else if ( Selection == 9 )
00180			PlayerOwner.MyHUD.ChangeCrossHair(-1);
00181		else if ( Selection == 10 )
00182		{
00183			if ( PlayerOwner.Handedness == -1 )
00184				PlayerOwner.ChangeSetHand("Hidden");
00185			else if ( PlayerOwner.Handedness == 2 )
00186				PlayerOwner.ChangeSetHand("Left");
00187			else if ( PlayerOwner.Handedness == 0 )
00188				PlayerOwner.ChangeSetHand("Right");
00189			else
00190				PlayerOwner.ChangeSetHand("Center");
00191		}
00192		else if ( Selection == 11 )
00193		{
00194			if ( PlayerOwner.DodgeClickTime > 0 )
00195				PlayerOwner.ChangeDodgeClickTime(-1);
00196			else
00197				PlayerOwner.ChangeDodgeClickTime(0.25);
00198		}
00199		else if ( Selection == 14 )
00200			PlayerOwner.myHUD.ChangeHUD(1);
00201		else if ( Selection == 15 )
00202			PlayerOwner.UpdateBob(PlayerOwner.Bob + 0.004);
00203		else if ( Selection == 16 )
00204		{
00205			if ( PlayerOwner.Player.CurrentNetSpeed <= 3000 )
00206				NewSpeed = 5000;
00207			else if ( PlayerOwner.Player.CurrentNetSpeed < 12500 )
00208				NewSpeed = 20000;
00209			else
00210				NewSpeed = 2600;
00211	
00212			PlayerOwner.ConsoleCommand("NETSPEED "$NewSpeed);
00213		}
00214		else
00215			return false;
00216	
00217		return true;
00218	}
00219	
00220	function bool ProcessSelection()
00221	{
00222		local Menu ChildMenu;
00223	
00224		if ( Selection == 1 )
00225		{
00226			if ( PlayerOwner.MyAutoAim == 1 )
00227				PlayerOwner.ChangeAutoAim(0.93);
00228			else
00229				PlayerOwner.ChangeAutoAim(1);
00230		}
00231		else if ( Selection == 2 )
00232		{
00233			bJoystick = !bJoystick;
00234			PlayerOwner.ConsoleCommand("set windrv.windowsclient usejoystick "$int(bJoystick));
00235		}
00236		else if ( Selection == 4 )
00237			PlayerOwner.bInvertMouse = !PlayerOwner.bInvertMouse;
00238		else if ( Selection == 5 )
00239			PlayerOwner.ChangeSnapView(!PlayerOwner.bSnapToLevel);
00240		else if ( Selection == 6 )
00241			PlayerOwner.ChangeAlwaysMouseLook(!PlayerOwner.bAlwaysMouseLook);
00242		else if ( Selection == 7 )
00243			PlayerOwner.ChangeStairLook(!PlayerOwner.bLookUpStairs);
00244		else if ( Selection == 8 )
00245			PlayerOwner.bNoFlash = !PlayerOwner.bNoFlash;
00246		else if ( Selection == 9 )
00247			PlayerOwner.ChangeCrossHair();
00248		else if ( Selection == 10 )
00249		{
00250			if ( PlayerOwner.Handedness == 1 )
00251				PlayerOwner.ChangeSetHand("Hidden");
00252			else if ( PlayerOwner.Handedness == 2 )
00253				PlayerOwner.ChangeSetHand("Right");
00254			else if ( PlayerOwner.Handedness == 0 )
00255				PlayerOwner.ChangeSetHand("Left");
00256			else 
00257				PlayerOwner.ChangeSetHand("Center");
00258		}
00259		else if ( Selection == 11 )
00260		{
00261			if ( PlayerOwner.DodgeClickTime > 0 )
00262				PlayerOwner.ChangeDodgeClickTime(-1);
00263			else
00264				PlayerOwner.ChangeDodgeClickTime(0.25);
00265		}
00266		else if ( Selection == 14 )
00267			PlayerOwner.myHUD.ChangeHUD(1);
00268		else if ( Selection == 12 )
00269			ChildMenu = spawn(class'UnrealKeyboardMenu', owner);
00270		else if ( Selection == 13 )
00271			ChildMenu = spawn(class'UnrealWeaponMenu', owner);
00272		else if ( Selection == 17 )
00273			PlayerOwner.ConsoleCommand("PREFERENCES");
00274		else
00275			return false;
00276	
00277		if ( ChildMenu != None )
00278		{
00279			HUD(Owner).MainMenu = ChildMenu;
00280			ChildMenu.ParentMenu = self;
00281			ChildMenu.PlayerOwner = PlayerOwner;
00282		}
00283		return true;
00284	}
00285	
00286	function SaveConfigs()
00287	{
00288		PlayerOwner.myHUD.SaveConfig();
00289		PlayerOwner.SaveConfig();
00290		//PlayerOwner.PlayerReplicationInfo.SaveConfig();
00291	}
00292	
00293	function DrawValues(canvas Canvas, Font RegFont, int Spacing, int StartX, int StartY)
00294	{
00295		local int i;
00296	
00297		Canvas.Font = RegFont;
00298		for (i=0; i< MenuLength; i++ )
00299		{
00300			SetFontBrightness( Canvas, (i == Selection - 1) );
00301			Canvas.SetPos(StartX, StartY + Spacing * i);
00302			Canvas.DrawText(MenuValues[i + 1], false);
00303		}
00304		Canvas.DrawColor = Canvas.Default.DrawColor;
00305	}
00306	
00307	function DrawMenu(canvas Canvas)
00308	{
00309		local int StartX, StartY, Spacing, i, HelpPanelX;
00310	
00311		DrawBackGround(Canvas, (Canvas.ClipY < 250));
00312	
00313		HelpPanelX = 228;
00314	
00315		Spacing = Clamp(0.04 * Canvas.ClipY, 11, 32);
00316		StartX = Max(40, 0.5 * Canvas.ClipX - 120);
00317	
00318		if ( Canvas.ClipY > 240 )
00319		{
00320			DrawTitle(Canvas);
00321			StartY = Max(36, 0.5 * (Canvas.ClipY - MenuLength * Spacing - 128));
00322		}
00323		else
00324			StartY = Max(8, 0.5 * (Canvas.ClipY - MenuLength * Spacing - 128));
00325	
00326		// draw text
00327		DrawList(Canvas, false, Spacing, StartX, StartY);  
00328		MenuValues[1] = string( PlayerOwner.MyAutoAim < 1 );
00329		bJoystick =	bool(PlayerOwner.ConsoleCommand("get windrv.windowsclient usejoystick"));
00330		MenuValues[2] = string(bJoystick);
00331		MenuValues[3] = string(int(PlayerOwner.MouseSensitivity));
00332		MenuValues[4] = string(PlayerOwner.bInvertMouse);
00333		MenuValues[5] = string(PlayerOwner.bSnapToLevel);
00334		MenuValues[6] = string(PlayerOwner.bAlwaysMouseLook);
00335		MenuValues[7] = string(PlayerOwner.bLookUpStairs);
00336		MenuValues[8] = string(!PlayerOwner.bNoFlash);
00337		if ( PlayerOwner.Handedness == 1 )
00338			MenuValues[10] = LeftString;
00339		else if ( PlayerOwner.Handedness == 0 )
00340			MenuValues[10] = CenterString;
00341		else if ( PlayerOwner.Handedness == -1 )
00342			MenuValues[10] = RightString;
00343		else
00344			MenuValues[10] = HideString;
00345		if ( PlayerOwner.DodgeClickTime > 0 )
00346			MenuValues[11] = EnabledString;
00347		else
00348			MenuValues[11] = DisabledString;
00349		MenuValues[14] = string(PlayerOwner.MyHUD.HudMode);
00350		if ( PlayerOwner.Player.CurrentNetSpeed <= 3000 )
00351			MenuValues[16] = InternetOption;
00352		else if ( PlayerOwner.Player.CurrentNetSpeed < 12500 )
00353			MenuValues[16] =  FastInternetOption;
00354		else
00355			MenuValues[16] = LANOption;
00356		DrawValues(Canvas, Canvas.MedFont, Spacing, StartX+160, StartY);
00357	
00358		// draw icons
00359		DrawSlider(Canvas, StartX + 155, StartY + 14 * Spacing + 1, 1000 * PlayerOwner.Bob, 0, 4);
00360	
00361		PlayerOwner.MyHUD.DrawCrossHair(Canvas, StartX + 160, StartY + 8 * Spacing - 3 );
00362		Canvas.SetPos(StartX+168, Canvas.ClipY-125 );
00363		if (Selection==14)	
00364		{
00365			if (Canvas.ClipY > 380 && PlayerOwner.MyHUD.HudMode<=6 && HUDIcon[PlayerOwner.MyHud.HudMode]!=None)
00366				Canvas.DrawIcon(HUDIcon[PlayerOwner.MyHUD.HudMode],1.0);
00367			Canvas.Font = Canvas.MedFont;
00368			HelpPanelX = 150;
00369		}
00370	
00371		// Draw help panel
00372		DrawHelpPanel(Canvas, StartY + MenuLength * Spacing, HelpPanelX);
00373	}
00374	
00375	defaultproperties
00376	{
00377	     HUDIcon(0)=Texture'UnrealShare.Hud1'
00378	     HUDIcon(1)=Texture'UnrealShare.Hud2'
00379	     HUDIcon(2)=Texture'UnrealShare.Hud3'
00380	     HUDIcon(3)=Texture'UnrealShare.Hud4'
00381	     HUDIcon(4)=Texture'UnrealShare.Hud5'
00382	     HUDIcon(5)=Texture'UnrealShare.Hud6'
00383	     HideString="Hidden"
00384	     InternetOption="Modem"
00385	     FastInternetOption="ISDN/Cable"
00386	     LANOption=" LAN"
00387	     MenuLength=17
00388	     HelpMessage(1)="Enable or disable vertical aiming help."
00389	     HelpMessage(2)="Toggle enabling of joystick."
00390	     HelpMessage(3)="Adjust the mouse sensitivity, or how far you have to move the mouse to produce a given motion in the game."
00391	     HelpMessage(4)="Invert the mouse X axis.  When true, pushing the mouse forward causes you to look down rather than up."
00392	     HelpMessage(5)="If true, when you let go of the mouselook key the view will automatically center itself."
00393	     HelpMessage(6)="If true, the mouse is always used for looking up and down, with no need for a mouselook key."
00394	     HelpMessage(7)="If true, when not mouse-looking your view will automatically be adjusted to look up and down slopes and stairs."
00395	     HelpMessage(8)="If true, your screen will flash when you fire your weapon."
00396	     HelpMessage(9)="Choose the crosshair appearing at the center of your screen"
00397	     HelpMessage(10)="Select where your weapon will appear."
00398	     HelpMessage(11)="If enabled, double tapping on the movement keys (forward, back, strafe left, and strafe right) will cause you to do a fast dodge move."
00399	     HelpMessage(12)="Hit enter to customize keyboard, mouse, and joystick configuration."
00400	     HelpMessage(13)="Hit enter to prioritize weapon switching order."
00401	     HelpMessage(14)="Use the left and right arrow keys to select a Heads Up Display configuration."
00402	     HelpMessage(15)="Adjust the amount of bobbing when moving."
00403	     HelpMessage(16)="Set your optimal networking speed.  This has an impact on internet gameplay."
00404	     HelpMessage(17)="Open advanced preferences configuration menu."
00405	     MenuList(1)="Auto Aim"
00406	     MenuList(2)="Joystick Enabled"
00407	     MenuList(3)="Mouse Sensitivity"
00408	     MenuList(4)="Invert Mouse"
00409	     MenuList(5)="LookSpring"
00410	     MenuList(6)="Always MouseLook"
00411	     MenuList(7)="Auto Slope Look"
00412	     MenuList(8)="Weapon Flash"
00413	     MenuList(9)="Crosshair"
00414	     MenuList(10)="Weapon Hand"
00415	     MenuList(11)="Dodging"
00416	     MenuList(12)="Customize Controls"
00417	     MenuList(13)="Prioritize Weapons"
00418	     MenuList(14)="HUD Configuration"
00419	     MenuList(15)="View Bob"
00420	     MenuList(16)="Net Speed"
00421	     MenuList(17)="Advanced Options"
00422	     MenuTitle="OPTIONS MENU"
00423	}

End Source Code