// September 2015 // Levee Patroller / Dijk Patrouille // This source file is (c) by Deltares. This source file is open source but only available to select users. Do not redistribute without written permission of Stichting Deltares, Delft, The Netherlands. // This header has been automatically generated. //============================================================================= // // ------------------------------------------------------------ // © 2006, Geodelft // // Date Id Modification // 2006-10-07 The Created this header // 2006-10-08 The Implemented Dutch translations // 2007-01-18 Zmr When Bshow = false no input possible //============================================================================= class Tab_ControlSettings extends GUITabPanel; struct KeyBinding { var bool bIsSectionLabel; var localized string KeyLabel; var string Alias; var array Binds; var array BindKeyNames; var array BindLocalizedKeyNames; }; var GUIListBox MyListBox; var Color BkColor; var GeoPlayerController GeoPC; const DefaultBindings=54; // # of default bindings there are var array Bindings; // Holds the array of key bindings var localized string Labels[54]; // fixed-length array for localization. accesses clamped to [0,74] var bool bSetNextKeyPress; var int NewIndex, NewSubIndex; var GUIStyles SelStyle; var int row, HackIndex; // Hacky Hacky var localized string Header,Footer; var float SectionLabelMargin; var bool bListInitialised; var automated GUIButton but_KeyResetButton; var automated GUILabel key_KeyConfigAliasLabel3; var automated GUILabel key_KeyConfigAliasLabel2; var automated GUILabel key_KeyConfigAliasLabel; var automated GUIListBox key_KeyConfigKeyList; //var localized string //============================================================================= // Date Id Modification // 2006-10-07 The Created this header // 2007-11-28 Jln Added Dutch language, wasn't in here yet! //============================================================================= function UpdateLanguage() { but_KeyResetButton = GUIButton(Controls[7]); key_KeyConfigAliasLabel3 = GUILabel(Controls[6]); key_KeyConfigAliasLabel2 = GUILabel(Controls[5]); key_KeyConfigAliasLabel = GUILabel(Controls[4]); key_KeyConfigKeyList = GUIListBox(Controls[0]); if (GeoPC.Dutch) { Labels[0]="Bewegen"; Labels[1]="Vooruit"; Labels[2]="Achteruit"; Labels[3]="Naar links"; Labels[4]="Naar rechts"; Labels[5]="Springen"; Labels[6]="Lopen"; Labels[7]="Bukken"; Labels[8]="Zijwaarts lopen"; Labels[9]="Rondkijken"; Labels[10]="Naar links draaien"; Labels[11]="Naar rechts draaien"; Labels[12]="Omhoog kijken"; Labels[13]="Naar beneden kijken"; Labels[14]="Centreren"; Labels[15]="Spel opties"; Labels[16]="Inventaris menu"; Labels[17]="Actie ondernemen"; Labels[18]="Bekijk briefing"; Labels[19]="Bekijk kaart"; Labels[20]="Bekijk notities"; Labels[21]="Diversen"; Labels[22]="Pauzeren"; Labels[23]="Screenshot"; Footer="] om deze actie uit te voeren "; but_KeyResetButton.Caption = "Reset"; but_KeyResetButton.SetHint("Zet alle toetsinstellingen terug naar de standaardwaarden."); key_KeyConfigAliasLabel.Caption = "Actie"; key_KeyConfigAliasLabel3.Caption = "Toets 2"; key_KeyConfigAliasLabel2.Caption = "Toets 1"; key_KeyConfigKeyList.Hint="Kies de actie die u wilt configureren."; } else { Labels[1]="Forwards"; Labels[2]="Backwards"; Labels[3]="Sidestep Left"; Labels[4]="Sidestep Right"; Labels[5]="Jump"; Labels[6]="Walk"; Labels[7]="Crouch"; Labels[8]="Sidestep Toggle"; Labels[9]="Looking"; Labels[10]="Turn Left"; Labels[11]="Turn Right"; Labels[12]="Look Up"; Labels[13]="Look Down"; Labels[14]="Center View"; Labels[15]="Game Options"; Labels[16]="Inventory Menu"; Labels[17]="Take Action"; Labels[18]="Show Briefing"; Labels[19]="Show Map"; Labels[20]="Show Notebook"; Labels[21]="Miscellaneous"; Labels[22]="Pause"; Labels[23]="Screenshot"; Footer="] Perform this action "; but_KeyResetButton.Caption = "Reset"; but_KeyResetButton.SetHint("Reset keys to default values"); key_KeyConfigAliasLabel.Caption = "Action"; key_KeyConfigAliasLabel3.Caption = "Key 2"; key_KeyConfigAliasLabel2.Caption = "Key 1"; key_KeyConfigKeyList.Hint="Select Control to config"; } } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function InitComponent(GUIController MyController, GUIComponent MyOwner) { Super.Initcomponent(MyController, MyOwner); GeoPC = GeoPlayerController(PlayerOwner()); UpdateLanguage(); MyListBox = GUIListBox(Controls[0]); MyListBox.List.OnDrawItem = DrawBinding; MyListBox.List.SelectedBkColor = BkColor; MyListBox.List.SelectedImage=None; MyListbox.List.OnClick=GetNewKey; MyListBox.List.OnChange=ListChange; MyListBox.List.OnKeyEvent = ListOnKeyEvent; MyListBox.List.bHotTrack=true; MyListBox.List.OnClickSound=CS_None; MyListBox.List.OnAdjustTop = MyOnAdjustTop; SelStyle = Controller.GetStyle("RoundButton"); //alle input uit de weg! Controls[0].wintop = Controls[0].wintop -2; Controls[1].wintop = Controls[1].wintop -2; Controls[2].wintop = Controls[2].wintop -2; Controls[3].wintop = Controls[3].wintop -2; Controls[4].wintop = Controls[4].wintop -2; Controls[5].wintop = Controls[5].wintop -2; Controls[6].wintop = Controls[6].wintop -2; Controls[7].wintop = Controls[7].wintop -2; } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function ShowPanel(bool bShow) { Super.ShowPanel(bShow); log("ShowPanel Tab_ControlSettings"); if(bShow) { if(!bListInitialised) { InitBindings(); MyListBox.List.Index=1; HackIndex=1; bListInitialised = true; } Controls[0].wintop = Controls[0].wintop +2; Controls[1].wintop = Controls[1].wintop +2; Controls[2].wintop = Controls[2].wintop +2; Controls[3].wintop = Controls[3].wintop +2; Controls[4].wintop = Controls[4].wintop +2; Controls[5].wintop = Controls[5].wintop +2; Controls[6].wintop = Controls[6].wintop +2; Controls[7].wintop = Controls[7].wintop +2; }else { Controls[0].wintop = Controls[0].wintop -2; Controls[1].wintop = Controls[1].wintop -2; Controls[2].wintop = Controls[2].wintop -2; Controls[3].wintop = Controls[3].wintop -2; Controls[4].wintop = Controls[4].wintop -2; Controls[5].wintop = Controls[5].wintop -2; Controls[6].wintop = Controls[6].wintop -2; Controls[7].wintop = Controls[7].wintop -2; } } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function int Weight(int i) { if ( (i==0x01) || (i==0x02) ) return 100; if ( (i>=0x30) && (i<=0x5A) ) return 50; if (i==0x20) return 45; if (i==0x04) return 40; if (i==0xEC || i==0xED) return 35; if (i>=0x21 && i<=0x28) return 30; if (i>=0x60 && i<=0x6F) return 30; return 25; } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function Swap(int index, int a, int b) { local int TempInt; local string TempStrA, TempStrB; TempInt = Bindings[Index].Binds[a]; TempStrA = Bindings[Index].BindKeyNames[a]; TempStrB = Bindings[Index].BindLocalizedKeyNames[a]; Bindings[Index].Binds[a] = Bindings[Index].Binds[B]; Bindings[Index].BindKeyNames[a] = Bindings[Index].BindKeyNames[b]; Bindings[Index].BindLocalizedKeyNames[a] = Bindings[Index].BindLocalizedKeyNames[b]; Bindings[Index].Binds[b] = TempInt; Bindings[Index].BindKeyNames[b] = TempStrA; Bindings[Index].BindLocalizedKeyNames[b] = TempStrB; } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function AddToBindings(string Alias, string KeyLabel, bool bSectionLabel) { local int At; At = Bindings.Length; Bindings.Length = Bindings.Length + 1; Bindings[At].bIsSectionLabel = bSectionLabel; Bindings[At].KeyLabel = KeyLabel; Bindings[At].Alias = Alias; MyListBox.List.Add(Bindings[At].KeyLabel); } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function InitBindings() { local int i,j,k,index; local string KeyName, Alias, LocalizedKeyName; local string UserKeyClass; local class Key; // Clear them all. MyListBox.List.Clear(); // Fix by Martin Robaszewski added by ' Studios (Runtime) for (i=0;i0) Bindings[i].Binds.Remove(0,Bindings[i].Binds.Length); if (Bindings[i].BindKeyNames.Length>0) Bindings[i].BindKeyNames.Remove(0,Bindings[i].BindKeyNames.Length); if (Bindings[i].BindLocalizedKeyNames.Length>0) Bindings[i].BindLocalizedKeyNames.Remove(0,Bindings[i].BindLocalizedKeyNames.Length); // Set the Localized name if (i(DynamicLoadObject(UserKeyClass,class'Class')); if (Key!=None) { for (i=0;i= bindings.Length ) return ""; if (Bindings[Index].bIsSectionLabel) return ""; if (Index==NewIndex && Bind==NewSubIndex) return "???"; if (Bind>=Bindings[Index].Binds.Length) return ""; return Bindings[Index].BindLocalizedKeyNames[Bind]; } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function DrawBinding(Canvas Canvas, int Item, float X, float Y, float W, float H, bool bSelected) { local int x1,w1; local bool InBindArea; if (Item>=Bindings.Length) return; if (Controller.MouseX >= controls[2].Bounds[0] && Controller.MouseX <=Controls[3].Bounds[2]) { InBindArea=true; } if ( (Controller.HasMouseMoved()) && (!bSetNextKeyPress) ) { if (InBindArea) { if ( ( Controller.MouseX >= Controls[2].Bounds[0] ) && ( Controller.MouseX <= Controls[2].Bounds[2] ) ) Row = 0; else if ( (Controller.MouseX>=Controls[3].Bounds[0]) && (Controller.MouseX<=Controls[3].Bounds[2]) ) Row = 1; InBindArea=true; } if ( InBindArea && (MyListBox.List.Index != HackIndex) && (MyListBox.List.Index= Controls[2].Bounds[0] ) && ( Controller.MouseX <= Controls[2].Bounds[2] ) ) RemoveExistingKey(MyListBox.List.Index,0); else if ( (Controller.MouseX>=Controls[3].Bounds[0]) && (Controller.MouseX<=Controls[3].Bounds[2]) ) RemoveExistingKey(MyListBox.List.Index,1); UpdateHint(MyListBox.List.Index); return true; } // -- WARNING.. really big hack here if ( (State==1) && (Key==0x25 || Key==0x64 || Key==0x27 || Key ==0x66) ) { if (row==0) row = 1; else row = 0; UpdateHint(MyListBox.List.Index); return true; } OldIndex = MyListBox.List.Index; result = MyListBox.List.InternalOnKeyEvent(Key,State,delta); if (MyListBox.List.Index!=OldIndex) { if (Bindings[MyListBox.List.Index].bIsSectionLabel) { if (MyListBox.List.Index0) { if (!Bindings[cindex].bIsSectionLabel) { MyListBox.List.SetIndex(cIndex); return; } cindex--; } MyListBox.List.SetIndex(OldIndex); } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function SearchDown(int OldIndex) { local int cindex; cindex = MyListBox.List.Index; while (cindex=Bindings.Length) || (SubIndex>=Bindings[Index].Binds.Length) || (Bindings[Index].Binds[SubIndex] <0) ) return; // Clear the bind PlayerOwner().ConsoleCommand("SET Input"@Bindings[Index].BindKeyNames[SubIndex]); // Clear the entry Bindings[Index].Binds.Remove(SubIndex,1); Bindings[Index].BindKeyNames.Remove(SubIndex,1); Bindings[Index].BindLocalizedKeyNames.Remove(SubIndex,1); } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function RemoveAllOccurance(byte NewKey) { local int i,j; for (i=0;i=0;j--) { if (Bindings[i].Binds[j]==NewKey) { RemoveExistingKey(i,j); } } } } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header // 2008-01-16 Jln Added binding count to loop only through the first two items max // Otherwise quite some other keys will appear in the list. //============================================================================= function UpdateHint(int index) { local int i; local string t; local int bindingcount; if (Index<0 || Index>=Bindings.Length) { MyListBox.List.Hint =""; Controller.ActivePage.ChangeHint(MyListBox.List.Hint); return; } else { t = ""; /// Limit to two items max: bindingcount = Bindings[Index].Binds.Length; if (bindingcount > 2) bindingcount = 2; for (i=0;i < bindingcount; i++) { if (t=="") t = ""$GetCurrentKeyBind(Index,i); else t = t$", "$GetCurrentKeyBind(Index,i); } } MyListBox.List.Hint =Header$t$Footer; Controller.ActivePage.ChangeHint(MyListBox.List.Hint); } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function AddNewKey(int Index, int SubIndex, byte NewKey) { if (Index >= Bindings.Length || Index < 0) // Changed by Demiurge (Runtime) return; if ( (SubIndex=Bindings[Index].Binds.Length) { Bindings[Index].Binds.Length = Bindings[Index].Binds.Length + 1; Bindings[Index].BindKeyNames.Length = Bindings[Index].BindKeyNames.Length + 1; Bindings[Index].BindLocalizedKeyNames.Length = Bindings[Index].BindLocalizedKeyNames.Length + 1; SubIndex = Bindings[Index].Binds.Length-1; } Bindings[Index].Binds[SubIndex] = NewKey; Bindings[Index].BindKeyNames[SubIndex] = PlayerOwner().ConsoleCommand("KeyName"@NewKey); Bindings[Index].BindLocalizedKeyNames[SubIndex] = PlayerOwner().ConsoleCommand("LOCALIZEDKEYNAME"@NewKey); PlayerOwner().ConsoleCommand("SET Input"@Bindings[Index].BindKeyNames[SubIndex]@Bindings[Index].Alias); UpdateHint(Index); } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function bool GetNewKey(GUIComponent Sender) { local int SubIndex; if ( ( Controller.MouseX >= Controls[2].Bounds[0] ) && ( Controller.MouseX <= Controls[2].Bounds[2] ) ) SubIndex = 0; else if ( (Controller.MouseX>=Controls[3].Bounds[0]) && (Controller.MouseX<=Controls[3].Bounds[2]) ) SubIndex = 1; else return true; NewIndex = MyListBox.List.Index; NewSubIndex = SubIndex; bSetNextKeyPress=true; //log("tadilalala"); Controller.OnNeedRawKeyPress = RawKey; Controller.Master.bRequireRawJoystick=true; PlayerOwner().ClientPlaySound(Controller.EditSound); PlayerOwner().ConsoleCommand("toggleime 0"); return true; } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function bool RawKey(byte NewKey) { if (NewKey!=0x1B) AddNewKey(NewIndex, NewSubIndex, NewKey); //log("tadilalala2123"); NewIndex = -1; NewSubIndex = -1; bSetNextKeyPress=false; Controller.OnNeedRawKeyPress = none; Controller.Master.bRequireRawJoystick=false; PlayerOwner().ClientPlaySound(Controller.ClickSound); return true; } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function ListChange(GUIComponent Sender) { UpdateHint(MyListBox.List.Index); } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function MyOnAdjustTop(GUIComponent Sender) { if( MyListBox.List.Index < MyListBox.List.Top ) MyListBox.List.SetIndex( MyListBox.List.Top ); else if( MyListBox.List.Index >= MyListBox.List.Top + MyListBox.List.ItemsPerPage ) MyListBox.List.SetIndex( MyListBox.List.Top + MyListBox.List.ItemsPerPage ); } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function bool ResetClicked(GUIComponent Sender) { Controller.ResetKeyboard(); InitBindings(); return true; } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= defaultproperties { Begin Object Class=GUIListBox Name=KeyConfigKeyList WinWidth=0.929493 WinHeight=0.820040 WinLeft=0.027188 WinTop=0.094218 bVisibleWhenEmpty=true StyleName="BindBox" Hint="Select Control to config" End Object Controls(0)=GUIListBox'KeyConfigKeyList' Begin Object class=GUIImage Name=KeyConfigBK1 WinWidth=0.431248 WinLeft=0.021641 WinHeight=0.834063 WinTop=0.083281 Image=Material'GUIContent.BorderBoxD' ImageColor=(R=255,G=255,B=255,A=160); ImageRenderStyle=MSTY_Alpha ImageStyle=ISTY_Stretched bNeverFocus=true bAcceptsInput=true End Object Controls(1)=GUIImage'KeyConfigBK1' Begin Object class=GUIImage Name=KeyConfigBK2 WinWidth=0.230937 WinLeft=0.460078 WinHeight=0.834063 WinTop=0.083281 Image=Material'GUIContent.BorderBoxD' ImageColor=(R=255,G=255,B=255,A=160); ImageRenderStyle=MSTY_Alpha ImageStyle=ISTY_Stretched End Object Controls(2)=GUIImage'KeyConfigBK2' Begin Object class=GUIImage Name=KeyConfigBK3 WinWidth=0.232499 WinLeft=0.688828 WinHeight=0.834063 WinTop=0.083281 Image=Material'GUIContent.BorderBoxD' ImageColor=(R=255,G=255,B=255,A=160); ImageRenderStyle=MSTY_Alpha ImageStyle=ISTY_Stretched End Object Controls(3)=GUIImage'KeyConfigBK3' Begin Object class=GUILabel Name=KeyConfigAliasLabel Caption="Action" TextALign=TXTA_Center TextColor=(R=255,G=255,B=255,A=255) WinWidth=0.250000 WinHeight=32.000000 WinLeft=0.124414 WinTop=0.004167 TextFont="HeaderFont" End Object Controls(4)=GUILabel'KeyConfigAliasLabel' Begin Object class=GUILabel Name=KeyConfigAliasLabel2 Caption="Key 1" TextALign=TXTA_Center TextColor=(R=255,G=255,B=255,A=255) WinWidth=0.250000 WinHeight=32.000000 WinLeft=0.449414 WinTop=0.004167 TextFont="HeaderFont" End Object Controls(5)=GUILabel'KeyConfigAliasLabel2' Begin Object class=GUILabel Name=KeyConfigAliasLabel3 Caption="Key 2" TextALign=TXTA_Center TextColor=(R=255,G=255,B=255,A=255) WinWidth=0.250000 WinHeight=32.000000 WinLeft=0.686914 WinTop=0.004167 TextFont="HeaderFont" End Object Controls(6)=GUILabel'KeyConfigAliasLabel3' Begin Object Class=GUIButton Name=KeyResetButton Caption="RESET" StyleName="SquareMenuButton" Hint="Reset keys to default values" WinWidth=0.231250 WinHeight=0.068750 WinLeft=0.687500 WinTop=0.933333 OnClick=ResetClicked End Object Controls(7)=GUIButton'KeyResetButton' WinTop=0.15 WinLeft=0 WinWidth=1 WinHeight=0.74 bAcceptsInput=false BKColor=(R=24,G=24,B=100,A=200) SectionLabelMargin=10 Bindings(0)=(bIsSectionLabel=true,KeyLabel="Movement",Alias="") Bindings(1)=(bIsSectionLabel=false,KeyLabel="Forwards",Alias="MoveForward") Bindings(2)=(bIsSectionLabel=false,KeyLabel="Backwards",Alias="MoveBackward") Bindings(3)=(bIsSectionLabel=false,KeyLabel="Sidestep Left",Alias="StrafeLeft") Bindings(4)=(bIsSectionLabel=false,KeyLabel="Sidestep Right",Alias="StrafeRight") Bindings(5)=(bIsSectionLabel=false,KeyLabel="Jump",Alias="Jump") Bindings(6)=(bIsSectionLabel=false,KeyLabel="Walk",Alias="Walking") Bindings(7)=(bIsSectionLabel=false,KeyLabel="Crouch",Alias="Duck") Bindings(8)=(bIsSectionLabel=false,KeyLabel="Sidestep Toggle",Alias="Strafe") Bindings(9)=(bIsSectionLabel=true,KeyLabel="Looking",Alias="") Bindings(10)=(bIsSectionLabel=false,KeyLabel="Turn Left",Alias="TurnLeft") Bindings(11)=(bIsSectionLabel=false,KeyLabel="Turn Right",Alias="TurnRight") Bindings(12)=(bIsSectionLabel=false,KeyLabel="Look Up",Alias="LookUp") Bindings(13)=(bIsSectionLabel=false,KeyLabel="Look Down",Alias="LookDown") Bindings(14)=(bIsSectionLabel=false,KeyLabel="Center View",Alias="CenterView") Bindings(15)=(bIsSectionLabel=true,KeyLabel="Game Options",Alias="") Bindings(16)=(bIsSectionLabel=false,KeyLabel="Inventory Menu",Alias="MakeCall") Bindings(17)=(bIsSectionLabel=false,KeyLabel="Take Action",Alias="TakeAction") Bindings(18)=(bIsSectionLabel=false,KeyLabel="Show Briefing",Alias="SeeBriefing") Bindings(19)=(bIsSectionLabel=false,KeyLabel="Show Map",Alias="ShowMap") Bindings(20)=(bIsSectionLabel=false,KeyLabel="Show Notebook",Alias="ShowNotebook") Bindings(21)=(bIsSectionLabel=true,KeyLabel="Miscellaneous",Alias="") Bindings(22)=(bIsSectionLabel=false,KeyLabel="Pause",Alias="Pause") Bindings(23)=(bIsSectionLabel=false,KeyLabel="Screenshot",Alias="shot") Row=0 Labels(0)="Movement" Labels(1)="Forwards" Labels(2)="Backwards" Labels(3)="Sidestep Left" Labels(4)="Sidestep Right" Labels(5)="Jump" Labels(6)="Walk" Labels(7)="Crouch" Labels(8)="Sidestep Toggle" Labels(9)="Looking" Labels(10)="Turn Left" Labels(11)="Turn Right" Labels(12)="Look Up" Labels(13)="Look Down" Labels(14)="Center View" Labels(15)="Game Options" Labels(16)="Inventory Menu" Labels(17)="Take Action" Labels(18)="Show Briefing" Labels(19)="Show Map" Labels(20)="Show Notebook" Labels(21)="Miscellaneous" Labels(22)="Pause" Labels(23)="Screenshot" Header="[" Footer="] Perform this action " }