diff --git a/ScoreboardExt/Classes/ClassicStyle.uc b/ScoreboardExt/Classes/ClassicStyle.uc index 45380c4..c7e1dfe 100644 --- a/ScoreboardExt/Classes/ClassicStyle.uc +++ b/ScoreboardExt/Classes/ClassicStyle.uc @@ -3,7 +3,7 @@ Class ClassicStyle extends KF2Style; `include(Build.uci) `include(Logger.uci) -function RenderFramedWindow( KFGUI_FloatingWindow P ) +function RenderFramedWindow( KFGUI_FloatingWindow P) { local int XS,YS,TitleHeight; local float XL, YL, FontScale; @@ -12,7 +12,7 @@ function RenderFramedWindow( KFGUI_FloatingWindow P ) YS = Canvas.ClipY-Canvas.OrgY; TitleHeight = DefaultHeight; - if( P.bWindowFocused ) + if (P.bWindowFocused) Canvas.SetDrawColor(105,105,105,255); else Canvas.SetDrawColor(85,85,85,P.FrameOpacity); @@ -25,7 +25,7 @@ function RenderFramedWindow( KFGUI_FloatingWindow P ) Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT],XS,YS-TitleHeight,0,0,128,128); // Title. - if( P.WindowTitle!="" ) + if (P.WindowTitle != "") { Canvas.Font = PickFont(FontScale); Canvas.TextSize(P.WindowTitle,XL,YL,FontScale,FontScale); @@ -35,7 +35,7 @@ function RenderFramedWindow( KFGUI_FloatingWindow P ) } } -function RenderWindow( KFGUI_Page P ) +function RenderWindow( KFGUI_Page P) { local int XS,YS; @@ -43,7 +43,7 @@ function RenderWindow( KFGUI_Page P ) YS = Canvas.ClipY-Canvas.OrgY; // Frame itself. - if( P.bWindowFocused ) + if (P.bWindowFocused) Canvas.SetDrawColor(105,105,105,255); else Canvas.SetDrawColor(85,85,85,P.FrameOpacity); @@ -51,7 +51,7 @@ function RenderWindow( KFGUI_Page P ) Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT],XS,YS,0,0,128,128); } -function RenderToolTip( KFGUI_Tooltip TT ) +function RenderToolTip( KFGUI_Tooltip TT) { local int i; local float X,Y,XS,YS,TX,TY,TS,DefFontHeight; @@ -60,9 +60,9 @@ function RenderToolTip( KFGUI_Tooltip TT ) // First compute textbox size. TY = DefaultHeight*TT.Lines.Length; - for( i=0; iTT.Owner.ScreenSize.X ) + if ((X+TX) > TT.Owner.ScreenSize.X) X = TT.Owner.ScreenSize.X-TX; - if( (Y+TY)>TT.Owner.ScreenSize.Y ) + if ((Y+TY) > TT.Owner.ScreenSize.Y) Y = TT.CompPos[1]-TY; - if( TT.CurrentAlpha<255 ) + if (TT.CurrentAlpha < 255) TT.CurrentAlpha = Min(TT.CurrentAlpha+25,255); // Reset clipping. @@ -102,7 +102,7 @@ function RenderToolTip( KFGUI_Tooltip TT ) Canvas.SetDrawColor(255,255,255,TT.CurrentAlpha); X+=TOOLTIP_BORDER; Y+=TOOLTIP_BORDER; - for( i=0; i0.f && X0.f && Y 0.f && X < C.CompPos[2] && Y > 0.f && Y < C.CompPos[3]); Canvas.Font = C.Combo.TextFont; YL = C.Combo.TextHeight; @@ -235,9 +235,9 @@ function RenderComboList( KFGUI_ComboSelector C ) C.CurrentRow = -1; Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY); - for( i=0; i=YP && Y<=(YP+YL) ) + if (bCheckMouse && Y >= YP && Y <= (YP+YL)) { bCheckMouse = false; C.CurrentRow = i; @@ -247,7 +247,7 @@ function RenderComboList( KFGUI_ComboSelector C ) } Canvas.SetPos(Edge,YP); - if( i==C.Combo.SelectedIndex ) + if (i == C.Combo.SelectedIndex) Canvas.DrawColor = C.Combo.SelectedTextColor; else Canvas.DrawColor = C.Combo.TextColor; @@ -256,14 +256,14 @@ function RenderComboList( KFGUI_ComboSelector C ) YP+=YL; } Canvas.PopMaskRegion(); - if( C.OldRow!=C.CurrentRow ) + if (C.OldRow != C.CurrentRow) { C.OldRow = C.CurrentRow; C.PlayMenuSound(MN_DropdownChange); } } -function RenderRightClickMenu( KFGUI_RightClickMenu C ) +function RenderRightClickMenu( KFGUI_RightClickMenu C) { local float X,Y,XL,YL,YP,Edge,TextScale; local int i; @@ -278,7 +278,7 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C ) X = C.Owner.MousePosition.X - Canvas.OrgX; Y = C.Owner.MousePosition.Y - Canvas.OrgY; - bCheckMouse = (X>0.f && X0.f && Y 0.f && X < C.CompPos[2] && Y > 0.f && Y < C.CompPos[3]); PickFont(TextScale); @@ -286,15 +286,15 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C ) C.CurrentRow = -1; Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY); - for( i=0; i=YP && Y<=(YP+YL) ) + if (bCheckMouse && Y >= YP && Y <= (YP+YL)) { bCheckMouse = false; C.CurrentRow = i; @@ -304,11 +304,11 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C ) } Canvas.SetPos(Edge*6,YP); - if( C.ItemRows[i].bSplitter ) + if (C.ItemRows[i].bSplitter) Canvas.SetDrawColor(255,255,255,255); else { - if( C.ItemRows[i].bDisabled ) + if (C.ItemRows[i].bDisabled) Canvas.SetDrawColor(148,148,148,255); else Canvas.SetDrawColor(248,248,248,255); } @@ -317,41 +317,41 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C ) YP+=YL; } Canvas.PopMaskRegion(); - if( C.OldRow!=C.CurrentRow ) + if (C.OldRow != C.CurrentRow) { C.OldRow = C.CurrentRow; C.PlayMenuSound(MN_FocusHover); } } -function RenderButton( KFGUI_Button B ) +function RenderButton( KFGUI_Button B) { local float XL,YL,TS,AX,AY,GamepadTexSize; local Texture2D Mat, ButtonTex; local bool bDrawOverride; bDrawOverride = B.DrawOverride(Canvas, B); - if( !bDrawOverride ) + if (!bDrawOverride) { - if( B.bDisabled ) + if (B.bDisabled) Mat = ButtonTextures[`BUTTON_DISABLED]; - else if( B.bPressedDown ) + else if (B.bPressedDown) Mat = ButtonTextures[`BUTTON_PRESSED]; - else if( B.bFocused || B.bIsHighlighted ) + else if (B.bFocused || B.bIsHighlighted) Mat = ButtonTextures[`BUTTON_HIGHLIGHTED]; else Mat = ButtonTextures[`BUTTON_NORMAL]; Canvas.SetPos(0.f,0.f); Canvas.DrawTileStretched(Mat,B.CompPos[2],B.CompPos[3],0,0,32,32); - if( B.OverlayTexture.Texture!=None ) + if (B.OverlayTexture.Texture != None) { Canvas.SetPos(0.f,0.f); Canvas.DrawTile(B.OverlayTexture.Texture,B.CompPos[2],B.CompPos[3],B.OverlayTexture.U,B.OverlayTexture.V,B.OverlayTexture.UL,B.OverlayTexture.VL); } } - if( B.ButtonText!="" ) + if (B.ButtonText != "") { Canvas.Font = MainFont; @@ -360,28 +360,28 @@ function RenderButton( KFGUI_Button B ) TS = GetFontScaler(); TS *= B.FontScale; - while( true ) + while( true) { Canvas.TextSize(B.ButtonText,XL,YL,TS,TS); - if( XL<(B.CompPos[2]*0.9) && YL<(B.CompPos[3]*0.9) ) + if (XL < (B.CompPos[2]*0.9) && YL < (B.CompPos[3]*0.9)) break; TS -= 0.001; } Canvas.SetPos((B.CompPos[2]-XL)*0.5,(B.CompPos[3]-YL)*0.5); - if( B.bDisabled ) + if (B.bDisabled) Canvas.DrawColor = B.TextColor*0.5f; else Canvas.DrawColor = B.TextColor; Canvas.DrawText(B.ButtonText,,TS,TS,B.TextFontInfo); - if( B.GetUsingGamepad() ) + if (B.GetUsingGamepad()) { ButtonTex = Texture2D(DynamicLoadObject("UI_Controller."$B.GamepadButtonName$"_Asset", class'Texture2D')); - if( ButtonTex != None ) + if (ButtonTex != None) { B.GetRealtivePos(AX, AY); - while( (Canvas.CurX-(GamepadTexSize*1.25)) Rank; +var config array < RankInfo> Rank; diff --git a/ScoreboardExt/Classes/GUIStyleBase.uc b/ScoreboardExt/Classes/GUIStyleBase.uc index 6395ce5..4290474 100644 --- a/ScoreboardExt/Classes/GUIStyleBase.uc +++ b/ScoreboardExt/Classes/GUIStyleBase.uc @@ -5,7 +5,7 @@ Class GUIStyleBase extends Object `include(Logger.uci) var Texture2D ItemTex; -var array BorderTextures, ArrowTextures, ButtonTextures, TabTextures, ItemBoxTextures, PerkBox, CheckBoxTextures, ProgressBarTextures, SliderTextures; +var array < Texture2D> BorderTextures, ArrowTextures, ButtonTextures, TabTextures, ItemBoxTextures, PerkBox, CheckBoxTextures, ProgressBarTextures, SliderTextures; var Texture2D ScrollTexture,FavoriteIcon,BankNoteIcon; var SoundCue MenuDown, MenuDrag, MenuEdit, MenuFade, MenuClick, MenuHover, MenuUp; @@ -24,21 +24,21 @@ struct FColorInfo var name Code; var Color Color; }; -var array ColorCodes; +var array < FColorInfo> ColorCodes; struct FTexturePreCache { var string Path; var Texture2D Tex; }; -var array PrecachedTextures; +var array < FTexturePreCache> PrecachedTextures; function InitStyle() { local FColorInfo ColorInfo; ItemTex=Texture2D(DynamicLoadObject("UI_LevelChevrons_TEX.UI_LevelChevron_Icon_02",class'Texture2D')); - if( ItemTex==None ) + if (ItemTex == None) ItemTex=Texture2D'EngineMaterials.DefaultWhiteGrid'; NumberFont = Font(DynamicLoadObject("UI_Canvas_Fonts.Font_General", class'Font')); @@ -142,19 +142,19 @@ function RenderCheckbox( KFGUI_CheckBox C ); function RenderComboBox( KFGUI_ComboBox C ); function RenderComboList( KFGUI_ComboSelector C ); -function Font PickFont( out float Scaler, optional bool bNumbersOnly, optional bool bInfinite ) +function Font PickFont( out float Scaler, optional bool bNumbersOnly, optional bool bInfinite) { Scaler = GetFontScaler(); - if( bNumbersOnly ) + if (bNumbersOnly) return NumberFont; - else if( bInfinite ) + else if (bInfinite) return InfiniteFont; return MainFont; } -function PickDefaultFontSize( float YRes ) +function PickDefaultFontSize( float YRes) { local int XL,YL; local string S; @@ -164,7 +164,7 @@ function PickDefaultFontSize( float YRes ) DefaultHeight=float(YL)*YRes; } -final function float ScreenScale( float Size, optional float MaxRes=1080.f ) +final function float ScreenScale( float Size, optional float MaxRes=1080.f) { return Size * ( HUDOwner.SizeY / MaxRes ); } @@ -172,32 +172,32 @@ final function float GetFontScaler(optional float Scaler=0.750f, optional float { return FClamp((HUDOwner.SizeY / 1080.f) * Scaler, Min, Max); } -final function DrawText( coerce string S ) +final function DrawText( coerce string S) { local float Scale; Canvas.Font=PickFont(Scale); Canvas.DrawText(S,,Scale,Scale); } -final function DrawCenteredText( coerce string S, float X, float Y, optional float Scale=1.f, optional bool bVertical, optional bool bUseOutline ) +final function DrawCenteredText( coerce string S, float X, float Y, optional float Scale=1.f, optional bool bVertical, optional bool bUseOutline) { local float XL,YL; Canvas.TextSize(S,XL,YL); - if( bVertical ) + if (bVertical) Canvas.SetPos(X,Y-(YL*Scale*0.5)); else Canvas.SetPos(X-(XL*Scale*0.5),Y); - if( bUseOutline ) + if (bUseOutline) DrawTextShadow(S, Canvas.CurX, Canvas.CurY, 1, Scale); else Canvas.DrawText(S,,Scale,Scale); } -final function string StripColorTags( coerce string S ) +final function string StripColorTags( coerce string S) { local int Pos; Pos = InStr(S, "\\c"); - while( Pos != INDEX_NONE ) + while( Pos != INDEX_NONE) { S = Left(S,Pos) $ Mid(S,Pos+3); Pos = InStr(S, "\\c"); @@ -205,17 +205,17 @@ final function string StripColorTags( coerce string S ) return S; } -final function DrawColoredText( coerce string S, float X, float Y, optional float Scale=1.f, optional bool bUseOutline ) +final function DrawColoredText( coerce string S, float X, float Y, optional float Scale=1.f, optional bool bUseOutline) { local float XL,YL; local int i, Index; - local array SArray; + local array < string> SArray; local string T, PrevT; local Color TextColor; - if( InStr(S, "\\c") == INDEX_NONE ) + if (InStr(S, "\\c") == INDEX_NONE) { - if( bUseOutline ) + if (bUseOutline) DrawTextShadow(S, X, Y, 1, Scale); else { @@ -228,11 +228,11 @@ final function DrawColoredText( coerce string S, float X, float Y, optional floa SArray = SplitString(S, "\\c"); PrevT = Left(S,InStr(S, "\\c")); - if( Len(PrevT) > 0 ) + if (Len(PrevT) > 0) { Canvas.TextSize(PrevT,XL,YL,Scale,Scale); - if( bUseOutline ) + if (bUseOutline) DrawTextShadow(PrevT, X, Y, 1, Scale); else { @@ -241,13 +241,13 @@ final function DrawColoredText( coerce string S, float X, float Y, optional floa } } - for( i=0; i0 || Left(S, 2)~="\\c" ) + if (i > 0 || Left(S, 2)~="\\c") { Index = ColorCodes.Find('Code', name(Left(T, 1))); - if( Index != INDEX_NONE ) + if (Index != INDEX_NONE) TextColor = ColorCodes[Index].Color; else TextColor = class'HUD'.default.WhiteColor; @@ -259,7 +259,7 @@ final function DrawColoredText( coerce string S, float X, float Y, optional floa Canvas.DrawColor = TextColor; Canvas.TextSize(T,XL,YL,Scale,Scale); - if( bUseOutline ) + if (bUseOutline) DrawTextShadow(T, X, Y, 1, Scale); else { @@ -271,7 +271,7 @@ final function DrawColoredText( coerce string S, float X, float Y, optional floa } } } -final function DrawTextBlurry( coerce string S, float X, float Y, optional float Scale=1.f ) +final function DrawTextBlurry( coerce string S, float X, float Y, optional float Scale=1.f) { local Color OldDrawColor; @@ -291,7 +291,7 @@ final function DrawTextBlurry( coerce string S, float X, float Y, optional float Canvas.SetPos(X, Y); Canvas.DrawText(S,,Scale,Scale); } -final function DrawTextOutline( coerce string S, float X, float Y, int Size, Color OutlineColor, optional float Scale=1.f, optional FontRenderInfo FRI ) +final function DrawTextOutline( coerce string S, float X, float Y, int Size, Color OutlineColor, optional float Scale=1.f, optional FontRenderInfo FRI) { local Color OldDrawColor; local int XS, YS, Steps; @@ -301,7 +301,7 @@ final function DrawTextOutline( coerce string S, float X, float Y, int Size, Col Size += 1; Steps = (Size * 2) / 3; - if( Steps < 1 ) + if (Steps < 1 ) { Steps = 1; } @@ -320,7 +320,7 @@ final function DrawTextOutline( coerce string S, float X, float Y, int Size, Col Canvas.SetPos(X, Y); Canvas.DrawText(S,, Scale, Scale, FRI); } -final function DrawTextShadow( coerce string S, float X, float Y, float ShadowSize, optional float Scale=1.f ) +final function DrawTextShadow( coerce string S, float X, float Y, float ShadowSize, optional float Scale=1.f) { local Color OldDrawColor; @@ -334,7 +334,7 @@ final function DrawTextShadow( coerce string S, float X, float Y, float ShadowSi Canvas.DrawColor = OldDrawColor; Canvas.DrawText(S,, Scale, Scale); } -final function DrawTexturedString( coerce string S, float X, float Y, optional float TextScaler=1.f, optional FontRenderInfo FRI, optional bool bUseOutline, optional bool bOnlyTexture ) +final function DrawTexturedString( coerce string S, float X, float Y, optional float TextScaler=1.f, optional FontRenderInfo FRI, optional bool bUseOutline, optional bool bOnlyTexture) { local Texture2D Mat; local string D; @@ -345,15 +345,15 @@ final function DrawTexturedString( coerce string S, float X, float Y, optional f OrgC = Canvas.DrawColor; Mat = FindNextTexture(S); - while( Mat != None ) + while( Mat != None) { - i = InStr(S,""); + i = InStr(S," < TEXTURE"); + j = InStr(S," > "); D = Left(S,i); S = Mid(S,j+2); - if( !bOnlyTexture ) + if (!bOnlyTexture) { Canvas.TextSize(StripColorTags(D),XL,YL,TextScaler,TextScaler); DrawColoredText(D,X,Y,TextScaler,bUseOutline); @@ -384,20 +384,20 @@ final function Texture2D FindNextTexture(out string S) local FTexturePreCache Cache; Path = S; - i = InStr(Path,""); - if( i == INDEX_NONE ) + i = InStr(Path," < Icon > "); + if (i == INDEX_NONE) return None; - j = InStr(Path,""); - S = Left(Path,i)$""$Mid(Path, j+6); + j = InStr(Path," < /Icon > "); + S = Left(Path,i)$" < TEXTURE > "$Mid(Path, j+6); Path = Mid(Path, i+6, j-(i+6)); i = PrecachedTextures.Find('Path', Path); - if( i != INDEX_NONE ) + if (i != INDEX_NONE) return PrecachedTextures[i].Tex; Tex = Texture2D(FindObject(Path, class'Texture2D')); - if( Tex != None ) + if (Tex != None) { Cache.Path = Path; Cache.Tex = Tex; @@ -416,14 +416,14 @@ final function string StripTextureFromString(string S, optional bool bNoStringAd { local int i, j; - while( true ) + while( true) { - i = InStr(S,""); - if( i == INDEX_NONE ) + i = InStr(S," < Icon > "); + if (i == INDEX_NONE) break; - j = InStr(S,""); - S = Left(S,i)$(bNoStringAdd ? "" : "W")$Mid(S, j+Len("")); + j = InStr(S," < /Icon > "); + S = Left(S,i)$(bNoStringAdd ? "" : "W")$Mid(S, j+Len(" < /Icon > ")); } return StripColorTags(S); @@ -433,7 +433,7 @@ final function string GetTimeString(int Seconds) local int Minutes, Hours; local string Time; - if( Seconds > 3600 ) + if (Seconds > 3600) { Hours = Seconds / 3600; Seconds -= Hours * 3600; @@ -443,11 +443,11 @@ final function string GetTimeString(int Seconds) Minutes = Seconds / 60; Seconds -= Minutes * 60; - if( Minutes >= 10 ) + if (Minutes >= 10) Time = Time $ Minutes $ ":"; else Time = Time $ "0" $ Minutes $ ":"; - if( Seconds >= 10 ) + if (Seconds >= 10) Time = Time $ Seconds; else Time = Time $ "0" $ Seconds; @@ -456,7 +456,7 @@ final function string GetTimeString(int Seconds) final function DrawCornerTexNU( int SizeX, int SizeY, byte Dir ) // Draw non-uniform corner. { - switch( Dir ) + switch( Dir) { case 0: // Up-left Canvas.DrawTile(ItemTex,SizeX,SizeY,77,15,-66,58); @@ -471,9 +471,9 @@ final function DrawCornerTexNU( int SizeX, int SizeY, byte Dir ) // Draw non-uni Canvas.DrawTile(ItemTex,SizeX,SizeY,11,73,66,-58); } } -final function DrawCornerTex( int Size, byte Dir ) +final function DrawCornerTex( int Size, byte Dir) { - switch( Dir ) + switch( Dir) { case 0: // Up-left Canvas.DrawTile(ItemTex,Size,Size,77,15,-66,58); @@ -488,19 +488,19 @@ final function DrawCornerTex( int Size, byte Dir ) Canvas.DrawTile(ItemTex,Size,Size,11,73,66,-58); } } -final function DrawWhiteBox( float XS, float YS, optional bool bClip ) +final function DrawWhiteBox( float XS, float YS, optional bool bClip) { Canvas.DrawTile(ItemTex,XS,YS,19,45,1,1,,bClip); } -final function DrawRectBox( float X, float Y, float Width, float Height, int Edge, optional byte Extrav ) +final function DrawRectBox( float X, float Y, float Width, float Height, int Edge, optional byte Extrav) { - if( Extrav==2 ) + if (Extrav == 2) Edge=Min(FMin(Edge,(Width)*0.5),Height);// Verify size. else Edge=Min(FMin(Edge,(Width)*0.5),(Height)*0.5);// Verify size. - Canvas.PreOptimizeDrawTiles(Extrav==0 ? 7 : 6, ItemTex); + Canvas.PreOptimizeDrawTiles(Extrav == 0 ? 7 : 6, ItemTex); switch (Extrav) { @@ -663,7 +663,7 @@ final function DrawRectBox( float X, float Y, float Width, float Height, int Edg } } -final function DrawBoxHollow( float X, float Y, float Width, float Height, float Thickness ) +final function DrawBoxHollow( float X, float Y, float Width, float Height, float Thickness) { Canvas.PreOptimizeDrawTiles(4, ItemTex); @@ -680,7 +680,7 @@ final function DrawBoxHollow( float X, float Y, float Width, float Height, float DrawWhiteBox(Thickness, Height); } -final function DrawOutlinedBox( float X, float Y, float Width, float Height, float Thickness, Color BoxColor, Color OutlineColor ) +final function DrawOutlinedBox( float X, float Y, float Width, float Height, float Thickness, Color BoxColor, Color OutlineColor) { Canvas.DrawColor = BoxColor; Canvas.SetPos(X + Thickness, Y + Thickness); @@ -694,39 +694,39 @@ final function DrawBoxCorners(float BorderSize, float X, float Y, float W, float { // Top left Canvas.SetPos(X,Y); - if( TopLeft ) + if (TopLeft) DrawCornerTex(BorderSize,0); else DrawWhiteBox(BorderSize, BorderSize); // Top right Canvas.SetPos(X+W-BorderSize,Y); - if( TopRight ) + if (TopRight) DrawCornerTex(BorderSize,1); else DrawWhiteBox(BorderSize, BorderSize); // Bottom left Canvas.SetPos(X,Y+H-BorderSize); - if( BottomLeft ) + if (BottomLeft) DrawCornerTex(BorderSize,2); else DrawWhiteBox(BorderSize, BorderSize); // Bottom right Canvas.SetPos(X+W-BorderSize,Y+H-BorderSize); - if( BottomRight ) + if (BottomRight) DrawCornerTex(BorderSize,3); else DrawWhiteBox(BorderSize, BorderSize); } -final function DrawRoundedBox( float BorderSize, float X, float Y, float W, float H, Color BoxColor ) +final function DrawRoundedBox( float BorderSize, float X, float Y, float W, float H, Color BoxColor) { DrawRoundedBoxEx(BorderSize, X, Y, W, H, BoxColor, true, true, true, true); } -final function DrawRoundedBoxEx( float BorderSize, float X, float Y, float W, float H, Color BoxColor, optional bool TopLeft, optional bool TopRight, optional bool BottomLeft, optional bool BottomRight ) +final function DrawRoundedBoxEx( float BorderSize, float X, float Y, float W, float H, Color BoxColor, optional bool TopLeft, optional bool TopRight, optional bool BottomLeft, optional bool BottomRight) { Canvas.DrawColor = BoxColor; - if( BorderSize <= 0 ) + if (BorderSize <= 0) { Canvas.SetPos(X, Y); DrawWhiteBox(W, H); @@ -749,12 +749,12 @@ final function DrawRoundedBoxEx( float BorderSize, float X, float Y, float W, fl DrawBoxCorners(BorderSize, X, Y, W, H, TopLeft, TopRight, BottomLeft, BottomRight); } -final function DrawRoundedBoxHollow( float BorderSize, float X, float Y, float W, float H, Color BoxColor ) +final function DrawRoundedBoxHollow( float BorderSize, float X, float Y, float W, float H, Color BoxColor) { DrawRoundedBoxHollowEx(BorderSize, X, Y, W, H, BoxColor, true, true, true, true); } -final function DrawRoundedBoxHollowEx( float BorderSize, float X, float Y, float W, float H, Color BoxColor, optional bool TopLeft, optional bool TopRight, optional bool BottomLeft, optional bool BottomRight ) +final function DrawRoundedBoxHollowEx( float BorderSize, float X, float Y, float W, float H, Color BoxColor, optional bool TopLeft, optional bool TopRight, optional bool BottomLeft, optional bool BottomRight) { Canvas.PreOptimizeDrawTiles(8, ItemTex); @@ -777,7 +777,7 @@ final function DrawRoundedBoxHollowEx( float BorderSize, float X, float Y, float DrawBoxCorners(BorderSize, X, Y, W, H, TopLeft, TopRight, BottomLeft, BottomRight); } -final function DrawRoundedBoxOutlined( float BorderSize, float X, float Y, float Width, float Height, Color BoxColor, Color OutlineColor ) +final function DrawRoundedBoxOutlined( float BorderSize, float X, float Y, float Width, float Height, Color BoxColor, Color OutlineColor) { Canvas.DrawColor = BoxColor; Canvas.SetPos(X + BorderSize, Y + BorderSize); @@ -786,7 +786,7 @@ final function DrawRoundedBoxOutlined( float BorderSize, float X, float Y, float DrawRoundedBoxHollow(BorderSize, X, Y, Width, Height, OutlineColor); } -final function DrawRoundedBoxOutlinedEx( float BorderSize, float X, float Y, float Width, float Height, Color BoxColor, Color OutlineColor, optional bool TopLeft, optional bool TopRight, optional bool BottomLeft, optional bool BottomRight ) +final function DrawRoundedBoxOutlinedEx( float BorderSize, float X, float Y, float Width, float Height, Color BoxColor, Color OutlineColor, optional bool TopLeft, optional bool TopRight, optional bool BottomLeft, optional bool BottomRight) { Canvas.DrawColor = BoxColor; Canvas.SetPos(X + BorderSize, Y + BorderSize); @@ -795,11 +795,11 @@ final function DrawRoundedBoxOutlinedEx( float BorderSize, float X, float Y, flo DrawRoundedBoxHollowEx(BorderSize, X, Y, Width, Height, OutlineColor, TopLeft, TopRight, BottomLeft, BottomRight); } -final function DrawArrowBox( int Direction, float X, float Y, float Width, float Height ) +final function DrawArrowBox( int Direction, float X, float Y, float Width, float Height) { local Texture2D DirectionMat; - switch( Direction ) + switch( Direction) { case 0: DirectionMat=ArrowTextures[`ARROW_UP]; @@ -822,12 +822,12 @@ final function DrawArrowBox( int Direction, float X, float Y, float Width, float DrawTileStretched(DirectionMat,X,Y,Width,Height); } -final function DrawTileStretched( Texture Tex, float X, float Y, float XS, float YS ) +final function DrawTileStretched( Texture Tex, float X, float Y, float XS, float YS) { local float mW,mH,MidX,MidY,SmallTileW,SmallTileH,fX,fY; local int OptimizeTiles; - if( Tex==None ) Tex = Texture2D'EngineMaterials.DefaultDiffuse'; + if (Tex == None ) Tex = Texture2D'EngineMaterials.DefaultDiffuse'; // Get the size of the image mW = Tex.GetSurfaceWidth(); @@ -844,22 +844,22 @@ final function DrawTileStretched( Texture Tex, float X, float Y, float XS, float // Optimized OptimizeTiles = 4; - if( mWYS) + if (mH > YS) fY = YS/2; else fY = MidY; @@ -873,7 +873,7 @@ final function DrawTileStretched( Texture Tex, float X, float Y, float XS, float fX = XS / 2; // Left and Right - if (mH X2-X1 ) + if (XL > X2-X1) CurX = 0; else CurX = ((X2-X1) / 2) - (XL/2); } - else if( Justification == 2 ) + else if (Justification == 2) { CurX = (X2-X1) - XL; } @@ -931,7 +931,7 @@ final function DrawTextJustified( byte Justification, float X1, float Y1, float Canvas.DrawText(S,,XS, YS); } -static final function float TimeFraction( float Start, float End, float Current ) +static final function float TimeFraction( float Start, float End, float Current) { return FClamp((Current - Start) / (End - Start), 0.f, 1.f); } diff --git a/ScoreboardExt/Classes/KF2GUIController.uc b/ScoreboardExt/Classes/KF2GUIController.uc index 6398033..e48866d 100644 --- a/ScoreboardExt/Classes/KF2GUIController.uc +++ b/ScoreboardExt/Classes/KF2GUIController.uc @@ -4,7 +4,7 @@ Class KF2GUIController extends Info `include(Build.uci) `include(Logger.uci) -var() class DefaultStyle; +var() class < GUIStyleBase> DefaultStyle; var PlayerController PlayerOwner; var ScoreboardExtHUD HUDOwner; @@ -12,13 +12,13 @@ var transient KF2GUIInput CustomInput; var transient PlayerInput BackupInput; var transient GameViewportClient ClientViewport; -var delegate OldOnReceivedNativeInputKey; -var delegate OldOnReceivedNativeInputAxis; -var delegate OldOnReceivedNativeInputChar; +var delegate < Interaction.OnReceivedNativeInputKey> OldOnReceivedNativeInputKey; +var delegate < Interaction.OnReceivedNativeInputAxis> OldOnReceivedNativeInputAxis; +var delegate < Interaction.OnReceivedNativeInputChar> OldOnReceivedNativeInputChar; -var delegate OldHandleInputAxis; +var delegate < GameViewportClient.HandleInputAxis> OldHandleInputAxis; -var array ActiveMenus,PersistentMenus; +var array < KFGUI_Page> ActiveMenus,PersistentMenus; var transient KFGUI_Base MouseFocus,InputFocus,KeyboardFocus; var IntPoint MousePosition,ScreenSize,OldMousePos,LastMousePos,LastClickPos[2]; var transient float MousePauseTime,MenuTime,LastClickTimes[2]; @@ -27,7 +27,7 @@ var transient GUIStyleBase CurrentStyle; var transient Console OrgConsole; var transient KFGUIConsoleHack HackConsole; -var array CursorTextures; +var array < Texture2D> CursorTextures; var Color CursorColor; var int CurrentCursorIndex, CursorSize; @@ -38,24 +38,24 @@ var int FontBlurX,FontBlurX2,FontBlurY,FontBlurY2,FastFontBlurX,FastFontBlurX2,F var bool bMouseWasIdle,bIsInMenuState,bAbsorbInput,bIsInvalid,bHideCursor,bUsingGamepad,bForceEngineCursor,bNoInputReset; -static function KF2GUIController GetGUIController( PlayerController PC ) +static function KF2GUIController GetGUIController( PlayerController PC) { local KF2GUIController G; - if( PC.Player==None ) + if (PC.Player == None) { return None; } foreach PC.ChildActors(class'ScoreboardExt.KF2GUIController',G) { - if( !G.bIsInvalid ) + if (!G.bIsInvalid) { break; } } - if( G==None ) + if (G == None) { G = PC.Spawn(class'ScoreboardExt.KF2GUIController',PC); } @@ -81,7 +81,7 @@ simulated function PostBeginPlay() simulated function SetupCursorFlash() { - if( CursorFlash == 255 ) + if (CursorFlash == 255) CursorFlash = 0; else CursorFlash = 255; } @@ -109,24 +109,24 @@ simulated function Tick(float DT) DT /= WorldInfo.TimeDilation; CursorFade += 255 * DT * CursorStep; - if( CursorFade<=0 ) + if (CursorFade <= 0) { CursorFade = 0; CursorStep = 1; } - else if( CursorFade>=255 ) + else if (CursorFade >= 255) { CursorFade = 255; CursorStep = -1; } FastCursorFade += 8192 * DT * FastCursorStep; - if( FastCursorFade<=0 ) + if (FastCursorFade <= 0) { FastCursorFade = 0; FastCursorStep = 1; } - else if( FastCursorFade>=255 ) + else if (FastCursorFade >= 255) { FastCursorFade = 255; FastCursorStep = -1; @@ -135,27 +135,27 @@ simulated function Tick(float DT) simulated function Destroyed() { - if( PlayerOwner!=None ) + if (PlayerOwner != None) SetMenuState(false); } simulated function HandleDrawMenu() { - if( HackConsole==None ) + if (HackConsole == None) { HackConsole = new(ClientViewport)class'ScoreboardExt.KFGUIConsoleHack'; HackConsole.OutputObject = Self; } - if( HackConsole!=ClientViewport.ViewportConsole ) + if (HackConsole != ClientViewport.ViewportConsole) { OrgConsole = ClientViewport.ViewportConsole; ClientViewport.ViewportConsole = HackConsole; // Make sure nothing overrides these settings while menu is being open. - if( bIsInMenuState ) PlayerOwner.PlayerInput = CustomInput; + if (bIsInMenuState ) PlayerOwner.PlayerInput = CustomInput; } } -simulated function RenderMenu( Canvas C ) +simulated function RenderMenu( Canvas C) { local int i; local float OrgX,OrgY,ClipX,ClipY; @@ -172,11 +172,11 @@ simulated function RenderMenu( Canvas C ) CurrentStyle.Canvas = C; CurrentStyle.PickDefaultFontSize(C.SizeY); - if( !KFPlayerController(PlayerOwner).MyGFxManager.bMenusActive ) + if (!KFPlayerController(PlayerOwner).MyGFxManager.bMenusActive) { HUDOwner.Canvas = C; - for( i=(HUDOwner.HUDWidgets.Length-1); i>=0; --i ) + for (i=(HUDOwner.HUDWidgets.Length-1); i >= 0; --i) { HUDOwner.HUDWidgets[i].InputPos[0] = 0.f; HUDOwner.HUDWidgets[i].InputPos[1] = 0.f; @@ -190,11 +190,11 @@ simulated function RenderMenu( Canvas C ) C.SetClip(ClipX,ClipY); } - if( bIsInMenuState ) + if (bIsInMenuState) { - for( i=(ActiveMenus.Length-1); i>=0; --i ) + for (i=(ActiveMenus.Length-1); i >= 0; --i) { - ActiveMenus[i].bWindowFocused = (i==0); + ActiveMenus[i].bWindowFocused = (i == 0); ActiveMenus[i].InputPos[0] = 0.f; ActiveMenus[i].InputPos[1] = 0.f; ActiveMenus[i].InputPos[2] = ScreenSize.X; @@ -202,7 +202,7 @@ simulated function RenderMenu( Canvas C ) ActiveMenus[i].Canvas = C; ActiveMenus[i].PreDraw(); } - if( InputFocus!=None && InputFocus.bFocusedPostDrawItem ) + if (InputFocus != None && InputFocus.bFocusedPostDrawItem) { InputFocus.InputPos[0] = 0.f; InputFocus.InputPos[1] = 0.f; @@ -220,7 +220,7 @@ simulated function RenderMenu( Canvas C ) } } - if( OrgConsole!=None ) + if (OrgConsole != None) OrgConsole.PostRender_Console(C); OrgConsole = None; } @@ -236,28 +236,28 @@ simulated final function InventoryChanged(optional KFWeapon Wep, optional bool b { local int i; - for( i=(ActiveMenus.Length-1); i>=0; --i ) + for (i=(ActiveMenus.Length-1); i >= 0; --i) { ActiveMenus[i].InventoryChanged(Wep,bRemove); } } -simulated final function SetMenuState( bool bActive ) +simulated final function SetMenuState( bool bActive) { - if( PlayerOwner.PlayerInput==None ) + if (PlayerOwner.PlayerInput == None) { NotifyLevelChange(); bActive = false; } - if( bIsInMenuState==bActive ) + if (bIsInMenuState == bActive) return; bIsInMenuState = bActive; bHideCursor = !bActive; - if( bActive ) + if (bActive) { - if( CustomInput==None ) + if (CustomInput == None) { CustomInput = new (KFPlayerController(PlayerOwner)) class'ScoreboardExt.KF2GUIInput'; CustomInput.ControllerOwner = Self; @@ -280,7 +280,7 @@ simulated final function SetMenuState( bool bActive ) PlayerOwner.PlayerInput = CustomInput; - if( LastMousePos != default.LastMousePos ) + if (LastMousePos != default.LastMousePos) ClientViewport.SetMouse(LastMousePos.X,LastMousePos.Y); } else @@ -289,7 +289,7 @@ simulated final function SetMenuState( bool bActive ) ClientViewport.HandleInputAxis = None; - if( BackupInput!=None ) + if (BackupInput != None) { PlayerOwner.PlayerInput = BackupInput; BackupInput.OnReceivedNativeInputKey = OldOnReceivedNativeInputKey; @@ -302,7 +302,7 @@ simulated final function SetMenuState( bool bActive ) LastClickTimes[1] = 0; } - if( !bNoInputReset ) + if (!bNoInputReset) { PlayerOwner.PlayerInput.ResetInput(); } @@ -312,19 +312,19 @@ simulated function NotifyLevelChange() { local int i; - if( bIsInvalid ) + if (bIsInvalid) return; bIsInvalid = true; - if( InputFocus!=None ) + if (InputFocus != None) { InputFocus.LostInputFocus(); InputFocus = None; } - for( i=(ActiveMenus.Length-1); i>=0; --i ) + for (i=(ActiveMenus.Length-1); i >= 0; --i) ActiveMenus[i].NotifyLevelChange(); - for( i=(PersistentMenus.Length-1); i>=0; --i ) + for (i=(PersistentMenus.Length-1); i >= 0; --i) PersistentMenus[i].NotifyLevelChange(); SetMenuState(false); @@ -335,36 +335,36 @@ simulated function MenuInput(float DeltaTime) local int i; local vector2D V; - if( PlayerOwner.PlayerInput==None ) + if (PlayerOwner.PlayerInput == None) { NotifyLevelChange(); return; } - if( InputFocus!=None ) + if (InputFocus != None) InputFocus.MenuTick(DeltaTime); - for( i=0; i5.f || Abs(MousePosition.Y-OldMousePos.Y)>5.f || (bMouseWasIdle && MousePauseTime<0.5f) ) + if (Abs(MousePosition.X-OldMousePos.X) > 5.f || Abs(MousePosition.Y-OldMousePos.Y) > 5.f || (bMouseWasIdle && MousePauseTime < 0.5f)) { - if( bMouseWasIdle ) + if (bMouseWasIdle) { bMouseWasIdle = false; - if( InputFocus!=None ) + if (InputFocus != None) InputFocus.InputMouseMoved(); } OldMousePos = MousePosition; MousePauseTime = 0.f; } - else if( !bMouseWasIdle && (MousePauseTime+=DeltaTime)>0.5f ) + else if (!bMouseWasIdle && (MousePauseTime+=DeltaTime) > 0.5f) { bMouseWasIdle = true; - if( MouseFocus!=None ) + if (MouseFocus != None) MouseFocus.NotifyMousePaused(); } - if( ActiveMenus.Length>0 ) + if (ActiveMenus.Length > 0) MenuTime+=DeltaTime; V = ClientViewport.GetMousePosition(); @@ -381,15 +381,15 @@ simulated function MouseMove() local KFGUI_Base F; // Capture mouse for GUI - if( InputFocus!=None && InputFocus.bCanFocus ) + if (InputFocus != None && InputFocus.bCanFocus) { - if( InputFocus.CaptureMouse() ) + if (InputFocus.CaptureMouse()) { F = InputFocus.GetMouseFocus(); - if( F!=MouseFocus ) + if (F != MouseFocus) { MousePauseTime = 0; - if( MouseFocus!=None ) + if (MouseFocus != None) MouseFocus.MouseLeave(); MouseFocus = F; F.MouseEnter(); @@ -399,32 +399,32 @@ simulated function MouseMove() } else { - for( i=0; i GUIClass ) +simulated function KFGUI_Base InitializeHUDWidget( class < KFGUI_Base> GUIClass) { local KFGUI_Base Widget; - if( GUIClass==None ) + if (GUIClass == None) return None; Widget = New(None) GUIClass; - if( Widget==None ) + if (Widget == None) return None; HUDOwner.HUDWidgets.AddItem(Widget); @@ -466,17 +466,17 @@ simulated function KFGUI_Base InitializeHUDWidget( class GUIClass ) return Widget; } -simulated function KFGUI_Page OpenMenu( class MenuClass ) +simulated function KFGUI_Page OpenMenu( class < KFGUI_Page> MenuClass) { local int i; local KFGUI_Page M; - if( MenuClass==None ) + if (MenuClass == None) return None; - if( KeyboardFocus!=None ) + if (KeyboardFocus != None) GrabInputFocus(None); - if( InputFocus!=None ) + if (InputFocus != None) { InputFocus.LostInputFocus(); InputFocus = None; @@ -486,12 +486,12 @@ simulated function KFGUI_Page OpenMenu( class MenuClass ) SetMenuState(true); // Check if should use pre-excisting menu. - if( MenuClass.Default.bUnique ) + if (MenuClass.Default.bUnique) { - for( i=0; i0 && ActiveMenus[i].BringPageToFront() ) // Sort it upfront. + if (i > 0 && ActiveMenus[i].BringPageToFront() ) // Sort it upfront. { M = ActiveMenus[i]; ActiveMenus.Remove(i,1); @@ -501,10 +501,10 @@ simulated function KFGUI_Page OpenMenu( class MenuClass ) return M; } - if( MenuClass.Default.bPersistant ) + if (MenuClass.Default.bPersistant) { - for( i=0; i MenuClass ) } M = New(None)MenuClass; - if( M==None ) // Probably abstract class. + if (M == None ) // Probably abstract class. return None; i = GetFreeIndex(M.bAlwaysTop); @@ -527,125 +527,125 @@ simulated function KFGUI_Page OpenMenu( class MenuClass ) M.ShowMenu(); return M; } -simulated function CloseMenu( class MenuClass, optional bool bCloseAll ) +simulated function CloseMenu( class < KFGUI_Page> MenuClass, optional bool bCloseAll) { local int i, j; local KFGUI_Page M; - if( !bCloseAll && MenuClass==None ) + if (!bCloseAll && MenuClass == None) return; - if( KeyboardFocus!=None ) + if (KeyboardFocus != None) GrabInputFocus(None); - if( InputFocus!=None ) + if (InputFocus != None) { InputFocus.LostInputFocus(); InputFocus = None; } - for( i=(ActiveMenus.Length-1); i>=0; --i ) + for (i=(ActiveMenus.Length-1); i >= 0; --i) { - if( bCloseAll || ActiveMenus[i].Class==MenuClass ) + if (bCloseAll || ActiveMenus[i].Class == MenuClass) { M = ActiveMenus[i]; ActiveMenus.Remove(i,1); M.CloseMenu(); - for( j=0; j=0; --i ) - if( ActiveMenus[i]==Item ) + for (i=(ActiveMenus.Length-1); i >= 0; --i) + if (ActiveMenus[i] == Item) { M = ActiveMenus[i]; ActiveMenus.Remove(i,1); M.CloseMenu(); // Cache menu. - if( M.bPersistant && M.bUnique ) + if (M.bPersistant && M.bUnique) PersistentMenus[PersistentMenus.Length] = M; break; } - if( ActiveMenus.Length==0 ) + if (ActiveMenus.Length == 0) SetMenuState(false); } -simulated function BringMenuToFront( KFGUI_Page Page ) +simulated function BringMenuToFront( KFGUI_Page Page) { local int i; - if( ActiveMenus[0].bAlwaysTop && !Page.bAlwaysTop ) + if (ActiveMenus[0].bAlwaysTop && !Page.bAlwaysTop) return; // Can't override this menu. // Try to remove from current position at stack. - for( i=(ActiveMenus.Length-1); i>=0; --i ) - if( ActiveMenus[i]==Page ) + for (i=(ActiveMenus.Length-1); i >= 0; --i) + if (ActiveMenus[i] == Page) { ActiveMenus.Remove(i,1); break; } - if( i==-1 ) + if (i == -1) return; // Page isn't open. // Put on front of stack. ActiveMenus.Insert(0,1); ActiveMenus[0] = Page; } -simulated final function bool MenuIsOpen( optional class MenuClass ) +simulated final function bool MenuIsOpen( optional class < KFGUI_Page> MenuClass) { local int i; - for( i=(ActiveMenus.Length-1); i>=0; --i ) - if( MenuClass==None || ActiveMenus[i].Class==MenuClass ) + for (i=(ActiveMenus.Length-1); i >= 0; --i) + if (MenuClass == None || ActiveMenus[i].Class == MenuClass) return true; return false; } -simulated final function GrabInputFocus( KFGUI_Base Comp, optional bool bForce ) +simulated final function GrabInputFocus( KFGUI_Base Comp, optional bool bForce) { - if( Comp==KeyboardFocus && !bForce ) + if (Comp == KeyboardFocus && !bForce) return; - if( KeyboardFocus!=None ) + if (KeyboardFocus != None) KeyboardFocus.LostKeyFocus(); - if( Comp==None ) + if (Comp == None) { OnInputKey = InternalInputKey; OnReceivedInputChar = InternalReceivedInputChar; } - else if( KeyboardFocus==None ) + else if (KeyboardFocus == None) { OnInputKey = Comp.NotifyInputKey; OnReceivedInputChar = Comp.NotifyInputChar; @@ -654,23 +654,23 @@ simulated final function GrabInputFocus( KFGUI_Base Comp, optional bool bForce ) KeyboardFocus = Comp; } -simulated final function GUI_InputMouse( bool bPressed, bool bRight ) +simulated final function GUI_InputMouse( bool bPressed, bool bRight) { local byte i; MousePauseTime = 0; - if( bPressed ) + if (bPressed) { - if( KeyboardFocus!=None && KeyboardFocus!=MouseFocus ) + if (KeyboardFocus != None && KeyboardFocus != MouseFocus) { GrabInputFocus(None); LastClickTimes[0] = 0; LastClickTimes[1] = 0; } - if( MouseFocus!=None ) + if (MouseFocus != None) { - if( MouseFocus!=InputFocus && !MouseFocus.bClickable && !MouseFocus.IsTopMenu() && MouseFocus.BringPageToFront() ) + if (MouseFocus != InputFocus && !MouseFocus.bClickable && !MouseFocus.IsTopMenu() && MouseFocus.BringPageToFront()) { BringMenuToFront(MouseFocus.GetPageTop()); LastClickTimes[0] = 0; @@ -679,7 +679,7 @@ simulated final function GUI_InputMouse( bool bPressed, bool bRight ) else { i = byte(bRight); - if( (MenuTime-LastClickTimes[i])<0.2 && Abs(LastClickPos[i].X-MousePosition.X)<5 && Abs(LastClickPos[i].Y-MousePosition.Y)<5 ) + if ((MenuTime-LastClickTimes[i]) < 0.2 && Abs(LastClickPos[i].X-MousePosition.X) < 5 && Abs(LastClickPos[i].Y-MousePosition.Y) < 5) { LastClickTimes[i] = 0; MouseFocus.DoubleMouseClick(bRight); @@ -692,7 +692,7 @@ simulated final function GUI_InputMouse( bool bPressed, bool bRight ) } } } - else if( InputFocus!=None ) + else if (InputFocus != None) { InputFocus.LostInputFocus(); InputFocus = None; @@ -702,17 +702,17 @@ simulated final function GUI_InputMouse( bool bPressed, bool bRight ) } else { - if( InputFocus!=None ) + if (InputFocus != None) InputFocus.MouseRelease(bRight); - else if( MouseFocus!=None ) + else if (MouseFocus != None) MouseFocus.MouseRelease(bRight); } } -simulated final function bool CheckMouse( name Key, EInputEvent Event ) +simulated final function bool CheckMouse( name Key, EInputEvent Event) { - if ( Event == IE_Pressed ) + if (Event == IE_Pressed) { - switch( Key ) + switch( Key) { case 'XboxTypeS_A': case 'LeftMouseButton': @@ -724,9 +724,9 @@ simulated final function bool CheckMouse( name Key, EInputEvent Event ) return true; } } - else if ( Event == IE_Released ) + else if (Event == IE_Released) { - switch( Key ) + switch( Key) { case 'XboxTypeS_A': case 'LeftMouseButton': @@ -740,34 +740,34 @@ simulated final function bool CheckMouse( name Key, EInputEvent Event ) } return false; } -simulated function bool ReceivedInputKey( int ControllerId, name Key, EInputEvent Event, optional float AmountDepressed=1.f, optional bool bGamepad ) +simulated function bool ReceivedInputKey( int ControllerId, name Key, EInputEvent Event, optional float AmountDepressed=1.f, optional bool bGamepad) { local KFPlayerInput KFInput; local KeyBind BoundKey; - if( !bIsInMenuState ) + if (!bIsInMenuState) return false; bUsingGamepad = bGamepad; KFInput = KFPlayerInput(BackupInput); - if( KFInput == None ) + if (KFInput == None) { KFInput = KFPlayerInput(PlayerOwner.PlayerInput); } - if( KeyboardFocus == None ) + if (KeyboardFocus == None) { - if( KFInput != None ) + if (KFInput != None) { KFInput.GetKeyBindFromCommand(BoundKey, "GBA_VoiceChat", false); - if( string(Key) ~= KFInput.GetBindDisplayName(BoundKey) ) + if (string(Key) ~= KFInput.GetBindDisplayName(BoundKey)) { - if( Event == IE_Pressed ) + if (Event == IE_Pressed) { KFInput.StartVoiceChat(true); } - else if( Event == IE_Released ) + else if (Event == IE_Released) { KFInput.StopVoiceChat(); } @@ -777,19 +777,19 @@ simulated function bool ReceivedInputKey( int ControllerId, name Key, EInputEven } } - if( !CheckMouse(Key,Event) && !OnInputKey(ControllerId,Key,Event,AmountDepressed,bGamepad) ) + if (!CheckMouse(Key,Event) && !OnInputKey(ControllerId,Key,Event,AmountDepressed,bGamepad)) { - if( bGamepad ) + if (bGamepad) { - if( ActiveMenus[0].ReceievedControllerInput(ControllerId, Key, Event) ) + if (ActiveMenus[0].ReceievedControllerInput(ControllerId, Key, Event)) return true; } - switch( Key ) + switch( Key) { case 'XboxTypeS_Start': case 'Escape': - if( Event==IE_Pressed ) + if (Event == IE_Pressed) ActiveMenus[0].UserPressedEsc(); // Pop top menu if possible. // IE_Released return true; case 'XboxTypeS_DPad_Up': @@ -798,8 +798,8 @@ simulated function bool ReceivedInputKey( int ControllerId, name Key, EInputEven case 'XboxTypeS_DPad_Right': case 'MouseScrollDown': case 'MouseScrollUp': - if( Event==IE_Pressed && MouseFocus!=None ) - MouseFocus.ScrollMouseWheel(Key=='MouseScrollUp' || Key=='XboxTypeS_DPad_Up' || Key=='XboxTypeS_DPad_Left'); + if (Event == IE_Pressed && MouseFocus != None) + MouseFocus.ScrollMouseWheel(Key == 'MouseScrollUp' || Key == 'XboxTypeS_DPad_Up' || Key == 'XboxTypeS_DPad_Left'); return true; } @@ -808,18 +808,18 @@ simulated function bool ReceivedInputKey( int ControllerId, name Key, EInputEven return true; } -simulated function bool ReceivedInputAxis( int ControllerId, name Key, float Delta, float DeltaTime, bool bGamepad ) +simulated function bool ReceivedInputAxis( int ControllerId, name Key, float Delta, float DeltaTime, bool bGamepad) { local Vector2D V; local KFPlayerInput KFInput; local float GamepadSensitivity,OldMouseX,OldMouseY,MoveDelta,MoveDeltaInvert; - if( !bIsInMenuState ) + if (!bIsInMenuState) return false; - if( bGamepad ) + if (bGamepad ) { - if( Abs(Delta) > 0.2f ) + if (Abs(Delta) > 0.2f) { bUsingGamepad = true; @@ -836,52 +836,52 @@ simulated function bool ReceivedInputAxis( int ControllerId, name Key, float Del { case 'XboxTypeS_LeftX': case 'XboxTypeS_RightX': - if( Delta < 0 ) + if (Delta < 0) V.X = Clamp(V.X - MoveDeltaInvert, 0, ScreenSize.X); else V.X = Clamp(V.X + MoveDelta, 0, ScreenSize.X); break; case 'XboxTypeS_LeftY': - if( Delta < 0 ) + if (Delta < 0) V.Y = Clamp(V.Y + MoveDeltaInvert, 0, ScreenSize.Y); else V.Y = Clamp(V.Y - MoveDelta, 0, ScreenSize.Y); break; case 'XboxTypeS_RightY': - if( Delta < 0 ) + if (Delta < 0) V.Y = Clamp(V.Y - MoveDeltaInvert, 0, ScreenSize.Y); else V.Y = Clamp(V.Y + MoveDelta, 0, ScreenSize.Y); break; } - if( OldMouseX != V.X || OldMouseY != V.Y ) + if (OldMouseX != V.X || OldMouseY != V.Y) ClientViewport.SetMouse(V.X, V.Y); } } return OnReceivedInputAxis(ControllerId, Key, Delta, DeltaTime, bGamepad); } -simulated function bool ReceivedInputChar( int ControllerId, string Unicode ) +simulated function bool ReceivedInputChar( int ControllerId, string Unicode) { - if( !bIsInMenuState ) + if (!bIsInMenuState) return false; return OnReceivedInputChar(ControllerId,Unicode); } -simulated Delegate bool OnInputKey( int ControllerId, name Key, EInputEvent Event, optional float AmountDepressed=1.f, optional bool bGamepad ) +simulated Delegate bool OnInputKey( int ControllerId, name Key, EInputEvent Event, optional float AmountDepressed=1.f, optional bool bGamepad) { return false; } -simulated Delegate bool OnReceivedInputAxis( int ControllerId, name Key, float Delta, float DeltaTime, bool bGamepad ) +simulated Delegate bool OnReceivedInputAxis( int ControllerId, name Key, float Delta, float DeltaTime, bool bGamepad) { return false; } -simulated Delegate bool OnReceivedInputChar( int ControllerId, string Unicode ) +simulated Delegate bool OnReceivedInputChar( int ControllerId, string Unicode) { return false; } -simulated Delegate bool InternalInputKey( int ControllerId, name Key, EInputEvent Event, optional float AmountDepressed=1.f, optional bool bGamepad ) +simulated Delegate bool InternalInputKey( int ControllerId, name Key, EInputEvent Event, optional float AmountDepressed=1.f, optional bool bGamepad) { return false; } -simulated Delegate bool InternalReceivedInputChar( int ControllerId, string Unicode ) +simulated Delegate bool InternalReceivedInputChar( int ControllerId, string Unicode) { return false; } diff --git a/ScoreboardExt/Classes/KF2GUIInput.uc b/ScoreboardExt/Classes/KF2GUIInput.uc index 7b50f41..5ec5816 100644 --- a/ScoreboardExt/Classes/KF2GUIInput.uc +++ b/ScoreboardExt/Classes/KF2GUIInput.uc @@ -8,24 +8,24 @@ class KF2GUIInput extends KFPlayerInput; var KF2GUIController ControllerOwner; var PlayerInput BaseInput; -function DrawHUD( HUD H ) +function DrawHUD( HUD H) { //ControllerOwner.RenderMenu(H.Canvas); } -function PostRender( Canvas Canvas ) +function PostRender( Canvas Canvas) { - if( ControllerOwner.bIsInMenuState ) + if (ControllerOwner.bIsInMenuState) ControllerOwner.HandleDrawMenu(); //ControllerOwner.RenderMenu(Canvas); } // Postprocess the player's input. -function PlayerInput( float DeltaTime ) +function PlayerInput( float DeltaTime) { // Do not move. ControllerOwner.MenuInput(DeltaTime); - if( !ControllerOwner.bAbsorbInput ) + if (!ControllerOwner.bAbsorbInput) { aMouseX = 0; aMouseY = 0; diff --git a/ScoreboardExt/Classes/KF2Style.uc b/ScoreboardExt/Classes/KF2Style.uc index 14d0268..c86d414 100644 --- a/ScoreboardExt/Classes/KF2Style.uc +++ b/ScoreboardExt/Classes/KF2Style.uc @@ -14,13 +14,13 @@ function InitStyle() LoadedTex[0] = Texture2D(DynamicLoadObject("EditorMaterials.CASC_ModuleEnable",class'Texture2D')); LoadedTex[1] = Texture2D(DynamicLoadObject("EditorMaterials.Tick",class'Texture2D')); - for( i=0; iTT.Owner.ScreenSize.X ) + if ((X+TX) > TT.Owner.ScreenSize.X) X = TT.Owner.ScreenSize.X-TX; - if( (Y+TY)>TT.Owner.ScreenSize.Y ) + if ((Y+TY) > TT.Owner.ScreenSize.Y) Y = TT.CompPos[1]-TY; - if( TT.CurrentAlpha<255 ) + if (TT.CurrentAlpha < 255) TT.CurrentAlpha = Min(TT.CurrentAlpha+25,255); // Reset clipping. @@ -157,39 +157,39 @@ function RenderToolTip( KFGUI_Tooltip TT ) Canvas.SetDrawColor(255,255,255,TT.CurrentAlpha); X+=TOOLTIP_BORDER; Y+=TOOLTIP_BORDER; - for( i=0; i0.f && X0.f && Y 0.f && X < C.CompPos[2] && Y > 0.f && Y < C.CompPos[3]); Canvas.Font = C.Combo.TextFont; YL = C.Combo.TextHeight; @@ -310,9 +310,9 @@ function RenderComboList( KFGUI_ComboSelector C ) C.CurrentRow = -1; Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY); - for( i=0; i=YP && Y<=(YP+YL) ) + if (bCheckMouse && Y >= YP && Y <= (YP+YL)) { bCheckMouse = false; C.CurrentRow = i; @@ -322,7 +322,7 @@ function RenderComboList( KFGUI_ComboSelector C ) } Canvas.SetPos(Edge,YP); - if( i==C.Combo.SelectedIndex ) + if (i == C.Combo.SelectedIndex) Canvas.DrawColor = C.Combo.SelectedTextColor; else Canvas.DrawColor = C.Combo.TextColor; @@ -331,13 +331,13 @@ function RenderComboList( KFGUI_ComboSelector C ) YP+=YL; } Canvas.PopMaskRegion(); - if( C.OldRow!=C.CurrentRow ) + if (C.OldRow != C.CurrentRow) { C.OldRow = C.CurrentRow; C.PlayMenuSound(MN_DropdownChange); } } -function RenderRightClickMenu( KFGUI_RightClickMenu C ) +function RenderRightClickMenu( KFGUI_RightClickMenu C) { local float X,Y,YP,Edge,TextScale,TexDefHieght; local int i; @@ -355,7 +355,7 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C ) X = C.Owner.MousePosition.X - Canvas.OrgX; Y = C.Owner.MousePosition.Y - Canvas.OrgY; - bCheckMouse = (X>0.f && X0.f && Y 0.f && X < C.CompPos[2] && Y > 0.f && Y < C.CompPos[3]); Canvas.Font = PickFont(TextScale); @@ -365,9 +365,9 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C ) TexDefHieght = DefaultHeight; Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY); - for( i=0; i=YP && Y<=(YP+TexDefHieght) ) + if (bCheckMouse && Y >= YP && Y <= (YP+TexDefHieght)) { bCheckMouse = false; C.CurrentRow = i; @@ -377,14 +377,14 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C ) } Canvas.SetPos(Edge,YP); - if( C.ItemRows[i].bSplitter ) + if (C.ItemRows[i].bSplitter) { Canvas.SetDrawColor(0,0,0,255); Canvas.DrawText("-------",,TextScale,TextScale); } else { - if( C.ItemRows[i].bDisabled ) + if (C.ItemRows[i].bDisabled) Canvas.SetDrawColor(148,148,148,255); else Canvas.SetDrawColor(248,248,248,255); Canvas.DrawText(C.ItemRows[i].Text,,TextScale,TextScale); @@ -393,26 +393,26 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C ) YP+=TexDefHieght; } Canvas.PopMaskRegion(); - if( C.OldRow!=C.CurrentRow ) + if (C.OldRow != C.CurrentRow) { C.OldRow = C.CurrentRow; C.PlayMenuSound(MN_DropdownChange); } } -function RenderButton( KFGUI_Button B ) +function RenderButton( KFGUI_Button B) { local float XL,YL,TS; local byte i; - if( B.bDisabled ) + if (B.bDisabled) Canvas.SetDrawColor(32,0,0,255); - else if( B.bPressedDown ) + else if (B.bPressedDown) Canvas.SetDrawColor(255,64,64,255); - else if( B.bFocused ) + else if (B.bFocused) Canvas.SetDrawColor(180,45,45,255); else Canvas.SetDrawColor(164,8,8,255); - if( B.bIsHighlighted ) + if (B.bIsHighlighted) { Canvas.DrawColor.R = Min(Canvas.DrawColor.R+25,255); Canvas.DrawColor.G = Min(Canvas.DrawColor.G+25,255); @@ -420,29 +420,29 @@ function RenderButton( KFGUI_Button B ) } Canvas.SetPos(0.f,0.f); - if( B.ExtravDir==255 ) + if (B.ExtravDir == 255) DrawWhiteBox(B.CompPos[2],B.CompPos[3]); else DrawRectBox(0,0,B.CompPos[2],B.CompPos[3],Min(B.CompPos[2],B.CompPos[3])*0.2,B.ExtravDir); - if( B.OverlayTexture.Texture!=None ) + if (B.OverlayTexture.Texture != None) { Canvas.SetPos(0.f,0.f); Canvas.DrawTile(B.OverlayTexture.Texture,B.CompPos[2],B.CompPos[3],B.OverlayTexture.U,B.OverlayTexture.V,B.OverlayTexture.UL,B.OverlayTexture.VL); } - if( B.ButtonText!="" ) + if (B.ButtonText != "") { // Chose the best font to fit this button. i = Min(B.FontScale,MaxFontScale); - while( true ) + while( true) { Canvas.Font = PickFont(TS); Canvas.TextSize(B.ButtonText,XL,YL,TS,TS); - if( i==0 || (XL<(B.CompPos[2]*0.95) && YL<(B.CompPos[3]*0.95)) ) + if (i == 0 || (XL < (B.CompPos[2]*0.95) && YL < (B.CompPos[3]*0.95))) break; --i; } Canvas.SetPos((B.CompPos[2]-XL)*0.5,(B.CompPos[3]-YL)*0.5); - if( B.bDisabled ) + if (B.bDisabled) Canvas.DrawColor = B.TextColor*0.5f; else Canvas.DrawColor = B.TextColor; Canvas.DrawText(B.ButtonText,,TS,TS,B.TextFontInfo); diff --git a/ScoreboardExt/Classes/KFColorHelper.uc b/ScoreboardExt/Classes/KFColorHelper.uc index b8ebad0..acc8067 100644 --- a/ScoreboardExt/Classes/KFColorHelper.uc +++ b/ScoreboardExt/Classes/KFColorHelper.uc @@ -28,18 +28,18 @@ static final function HSVColour RGBToHSV(const LinearColor RGB) Chroma = Max - Min; //If Chroma is 0, then S is 0 by definition, and H is undefined but 0 by convention. - if(Chroma != 0) + if (Chroma != 0) { - if(RGB.R == Max) + if (RGB.R == Max) { HSV.H = (RGB.G - RGB.B) / Chroma; - if(HSV.H < 0.0) + if (HSV.H < 0.0) { HSV.H += 6.0; } } - else if(RGB.G == Max) + else if (RGB.G == Max) { HSV.H = ((RGB.B - RGB.R) / Chroma) + 2.0; } @@ -70,32 +70,32 @@ static final function LinearColor HSVToRGB(const HSVColour HSV) Hdash = HSV.H / 60.0; X = Chroma * (1.0 - Abs((Hdash % 2.0) - 1.0)); - if(Hdash < 1.0) + if (Hdash < 1.0) { RGB.R = Chroma; RGB.G = X; } - else if(Hdash < 2.0) + else if (Hdash < 2.0) { RGB.R = X; RGB.G = Chroma; } - else if(Hdash < 3.0) + else if (Hdash < 3.0) { RGB.G = Chroma; RGB.B = X; } - else if(Hdash < 4.0) + else if (Hdash < 4.0) { RGB.G= X; RGB.B = Chroma; } - else if(Hdash < 5.0) + else if (Hdash < 5.0) { RGB.R = X; RGB.B = Chroma; } - else if(Hdash < 6.0) + else if (Hdash < 6.0) { RGB.R = Chroma; RGB.B = X; diff --git a/ScoreboardExt/Classes/KFGUI_Base.uc b/ScoreboardExt/Classes/KFGUI_Base.uc index 086a948..21f1bc9 100644 --- a/ScoreboardExt/Classes/KFGUI_Base.uc +++ b/ScoreboardExt/Classes/KFGUI_Base.uc @@ -34,13 +34,13 @@ var() bool bDisabled,bClickable,bCanFocus; var bool bFocusedPostDrawItem; // If this component has been given input focus, should it receive draw menu call after everything else been drawn? var transient bool bFocused,bTextureInit,bVisible; var bool bIsHUDWidget,bEnableInputs,bNoLookInputs; -var array TimerNames; +var array < name> TimerNames; function InitMenu(); // Menu was initialized for the first time. function ShowMenu(); // Menu was opened. function PreDraw() { - if( !bVisible ) + if (!bVisible) return; ComputeCoords(); @@ -56,13 +56,13 @@ function MenuTick( float DeltaTime ); final function SetTimer(float InRate, optional bool inbLoop, optional Name inTimerFunc='Timer') { - if( InRate <= 0.f ) + if (InRate <= 0.f) { ClearTimer(inTimerFunc); return; } - if( TimerNames.Find(inTimerFunc) == INDEX_NONE ) + if (TimerNames.Find(inTimerFunc) == INDEX_NONE) { TimerNames.AddItem(inTimerFunc); } @@ -71,7 +71,7 @@ final function SetTimer(float InRate, optional bool inbLoop, optional Name inTim } final function ClearTimer(optional Name inTimerFunc='Timer') { - if( TimerNames.Find(inTimerFunc) != INDEX_NONE ) + if (TimerNames.Find(inTimerFunc) != INDEX_NONE) { TimerNames.RemoveItem(inTimerFunc); } @@ -109,7 +109,7 @@ final function PlayerController GetPlayer() return Owner.PlayerOwner; } -function SetDisabled( bool bDisable ) +function SetDisabled( bool bDisable) { bDisabled = bDisable; } @@ -126,14 +126,14 @@ final function ComputeCoords() function bool CaptureMouse() { - return bVisible && ( Owner.MousePosition.X>=CompPos[0] && Owner.MousePosition.Y>=CompPos[1] && Owner.MousePosition.X<=(CompPos[0]+CompPos[2]) && Owner.MousePosition.Y<=(CompPos[1]+CompPos[3]) ); + return bVisible && ( Owner.MousePosition.X >= CompPos[0] && Owner.MousePosition.Y >= CompPos[1] && Owner.MousePosition.X <= (CompPos[0]+CompPos[2]) && Owner.MousePosition.Y <= (CompPos[1]+CompPos[3]) ); } final function KFGUI_Base GetMouseFocus() { local KFGUI_Base M; - for( M=Self; M.MouseArea!=None; M=M.MouseArea ) + for (M=Self; M.MouseArea != None; M=M.MouseArea) {} return M; } @@ -147,12 +147,12 @@ function DoClose() { local int i; - for( i=0; i0 && GetPageTop()==Owner.ActiveMenus[0]); + return (Owner.ActiveMenus.Length > 0 && GetPageTop() == Owner.ActiveMenus[0]); } final function KFGUI_Page GetPageTop() { local KFGUI_Base M; - for( M=Self; M.ParentComponent!=None; M=M.ParentComponent ) + for (M=Self; M.ParentComponent != None; M=M.ParentComponent) {} return KFGUI_Page(M); } -function KFGUI_Base FindComponentID( name InID ) +function KFGUI_Base FindComponentID( name InID) { - if( ID==InID ) + if (ID == InID) return Self; return None; } -function FindAllComponentID( name InID, out array Res ) +function FindAllComponentID( name InID, out array < KFGUI_Base> Res) { - if( ID==InID ) + if (ID == InID) Res[Res.Length] = Self; } function RemoveComponent( KFGUI_Base B ); function GetInputFocus() { - if( Owner.InputFocus!=None ) + if (Owner.InputFocus != None) Owner.InputFocus.LostInputFocus(); Owner.InputFocus = Self; } function DropInputFocus() { - if( Owner.InputFocus==Self ) + if (Owner.InputFocus == Self) { Owner.InputFocus.LostInputFocus(); Owner.InputFocus = None; @@ -222,20 +222,20 @@ final function GrabKeyFocus() } final function ReleaseKeyFocus() { - if( Owner.KeyboardFocus==Self ) + if (Owner.KeyboardFocus == Self) Owner.GrabInputFocus(None); } function LostKeyFocus(); -function bool NotifyInputKey( int ControllerId, name Key, EInputEvent Event, float AmountDepressed, bool bGamepad ) +function bool NotifyInputKey( int ControllerId, name Key, EInputEvent Event, float AmountDepressed, bool bGamepad) { - if( bIsHUDWidget && bEnableInputs ) + if (bIsHUDWidget && bEnableInputs) { - switch( Key ) + switch( Key) { case 'XboxTypeS_Start': case 'Escape': - if( Event==IE_Pressed ) + if (Event == IE_Pressed) UserPressedEsc(); return true; case 'XboxTypeS_DPad_Up': @@ -246,19 +246,19 @@ function bool NotifyInputKey( int ControllerId, name Key, EInputEvent Event, flo case 'MouseScrollUp': case 'MouseScrollDown': case 'MouseScrollUp': - if( Event==IE_Pressed ) - ScrollMouseWheel(Key=='MouseScrollUp' || Key=='XboxTypeS_DPad_Up' || Key=='XboxTypeS_DPad_Left'); + if (Event == IE_Pressed) + ScrollMouseWheel(Key == 'MouseScrollUp' || Key == 'XboxTypeS_DPad_Up' || Key == 'XboxTypeS_DPad_Left'); return true; } } return false; } -function bool NotifyInputAxis( int ControllerId, name Key, float Delta, float DeltaTime, bool bGamepad ) +function bool NotifyInputAxis( int ControllerId, name Key, float Delta, float DeltaTime, bool bGamepad) { return false; } -function bool NotifyInputChar( int ControllerId, string Unicode ) +function bool NotifyInputChar( int ControllerId, string Unicode) { return false; } @@ -269,25 +269,25 @@ function InputMouseMoved(); // Notify any focused menu element that mouse has been idle over it. function NotifyMousePaused(); -final function GetActualPos( out float X, out float Y ) +final function GetActualPos( out float X, out float Y) { X = ((XPosition+X)*InputPos[2]) + InputPos[0]; Y = ((YPosition+Y)*InputPos[3]) + InputPos[1]; } -final function GetRealtivePos( out float X, out float Y ) +final function GetRealtivePos( out float X, out float Y) { X = X / CompPos[2]; Y = Y / CompPos[2]; } -simulated final function PlayMenuSound( EMenuSound Slot ) +simulated final function PlayMenuSound( EMenuSound Slot) { local SoundCue S; local KFGameEngine Engine; Engine = KFGameEngine(class'Engine'.static.GetEngine()); - switch( Slot ) + switch( Slot) { case MN_FocusHover: case MN_Focus: @@ -308,7 +308,7 @@ simulated final function PlayMenuSound( EMenuSound Slot ) break; } - if( S!=None ) + if (S != None) { S.VolumeMultiplier = (Engine.SFxVolumeMultiplier/100.f) * (Engine.MasterVolumeMultiplier/100.f); GetPlayer().PlaySound(S,true,,false); @@ -318,7 +318,7 @@ simulated final function PlayMenuSound( EMenuSound Slot ) // Pre level change notification. function NotifyLevelChange(); -final function SetPosition( float X, float Y, float XS, float YS ) +final function SetPosition( float X, float Y, float XS, float YS) { XPosition = X; YPosition = Y; @@ -326,7 +326,7 @@ final function SetPosition( float X, float Y, float XS, float YS ) YSize = YS; } -static final function string MakeSortStr( int Value ) +static final function string MakeSortStr( int Value) { local string S; local int i; @@ -334,7 +334,7 @@ static final function string MakeSortStr( int Value ) // Prefix with zeroes to properly sort this string. S = string(Value); i = Len(S); - if( i<10 ) + if (i < 10) return Mid("0000000000",i)$S; return S; } diff --git a/ScoreboardExt/Classes/KFGUI_Button.uc b/ScoreboardExt/Classes/KFGUI_Button.uc index bda0df2..177d923 100644 --- a/ScoreboardExt/Classes/KFGUI_Button.uc +++ b/ScoreboardExt/Classes/KFGUI_Button.uc @@ -21,9 +21,9 @@ function bool GetUsingGamepad() return Owner.bUsingGamepad && GamepadButtonName != ""; } -function HandleMouseClick( bool bRight ) +function HandleMouseClick( bool bRight) { - if( bRight ) + if (bRight) OnClickRight(Self); else OnClickLeft(Self); } diff --git a/ScoreboardExt/Classes/KFGUI_CategoryButton.uc b/ScoreboardExt/Classes/KFGUI_CategoryButton.uc index bdd856a..ee30741 100644 --- a/ScoreboardExt/Classes/KFGUI_CategoryButton.uc +++ b/ScoreboardExt/Classes/KFGUI_CategoryButton.uc @@ -15,37 +15,37 @@ function DrawMenu() local bool bDrawOverride; bDrawOverride = DrawOverride(Canvas, Self); - if( !bDrawOverride ) + if (!bDrawOverride) { - if( bDisabled ) + if (bDisabled) Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_DISABLED]; - else if( bPressedDown ) + else if (bPressedDown) Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_PRESSED]; - else if( bFocused || bIsHighlighted ) + else if (bFocused || bIsHighlighted) Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_NORMAL]; else Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_HIGHLIGHTED]; Canvas.SetPos(0.f,0.f); Canvas.DrawTileStretched(Mat,CompPos[2],CompPos[3],0,0,32,32); - if( OverlayTexture.Texture!=None ) + if (OverlayTexture.Texture != None) { Canvas.SetPos(0.f,0.f); Canvas.DrawTile(OverlayTexture.Texture,CompPos[2],CompPos[3],OverlayTexture.U,OverlayTexture.V,OverlayTexture.UL,OverlayTexture.VL); } } - if( ButtonText!="" ) + if (ButtonText != "") { Canvas.Font = Owner.CurrentStyle.MainFont; TS = Owner.CurrentStyle.GetFontScaler(); TS *= FontScale; - while( true ) + while( true) { Canvas.TextSize(ButtonText,XL,YL,TS,TS); - if( XL<(CompPos[2]*0.9) && YL<(CompPos[3]*0.9) ) + if (XL < (CompPos[2]*0.9) && YL < (CompPos[3]*0.9)) break; TS -= 0.001; @@ -55,12 +55,12 @@ function DrawMenu() TextY = (CompPos[3]-YL)*0.5; Canvas.SetPos(TextX, TextY); - if( bDisabled ) + if (bDisabled) Canvas.DrawColor = TextColor*0.5f; else Canvas.DrawColor = TextColor; Canvas.DrawText(ButtonText,,TS,TS,TextFontInfo); - if( Icon != None ) + if (Icon != None) { Canvas.DrawColor = IconColor; diff --git a/ScoreboardExt/Classes/KFGUI_CategoryList.uc b/ScoreboardExt/Classes/KFGUI_CategoryList.uc index b23641f..90abf5a 100644 --- a/ScoreboardExt/Classes/KFGUI_CategoryList.uc +++ b/ScoreboardExt/Classes/KFGUI_CategoryList.uc @@ -10,7 +10,7 @@ struct FCategoryItems var name ID; var KFGUI_Base Item; }; -var array CategoryItems; +var array < FCategoryItems> CategoryItems; function AddCategory(name CatID, string CatName, optional Texture2D IconMat, optional Color IconClr, optional float XS=1.f, optional float YS=1.f) { @@ -25,7 +25,7 @@ function AddCategory(name CatID, string CatName, optional Texture2D IconMat, opt B.OnClickRight = SelectedCategory; } -function KFGUI_Base AddItemToCategory(name CatID, class Item) +function KFGUI_Base AddItemToCategory(name CatID, class < KFGUI_Base> Item) { local FCategoryItems CatItem; local KFGUI_Base G; @@ -48,28 +48,28 @@ function SelectedCategory(KFGUI_Button Sender) local KFGUI_CategoryButton CatB; CatB = KFGUI_CategoryButton(Sender); - if( CatB == None ) + if (CatB == None) return; Index = ItemComponents.Find(Sender); - if( Index != INDEX_NONE ) + if (Index != INDEX_NONE) { - if( !CatB.bOpened ) + if (!CatB.bOpened) { CatB.bOpened = true; j = Index+1; - for( i=0; i Columns; -var() class ListItemClass; +var() array < FColumnItem> Columns; +var() class < KFGUI_ListItem> ListItemClass; var() float FontSize; var() color FocusedLineColor,SelectedLineColor; var() float EdgeSize; @@ -36,13 +36,13 @@ var() bool bCanSortColumn; // Allow user to sort columns. delegate OnSelectedRow( KFGUI_ListItem Item, int Row, bool bRight, bool bDblClick ); -function KFGUI_ListItem AddLine( string Value, optional int iValue, optional string SortValue, optional int Index=-1 ) +function KFGUI_ListItem AddLine( string Value, optional int iValue, optional string SortValue, optional int Index=-1) { local KFGUI_ListItem N,O; local int i; // Allocate list item object. - if( UnusedItem!=None ) + if (UnusedItem != None) { N = UnusedItem; UnusedItem = N.Next; @@ -54,27 +54,27 @@ function KFGUI_ListItem AddLine( string Value, optional int iValue, optional str N.SetValue(Value,iValue,SortValue); // Insert into list. - if( bShouldSortList && Index==-1 ) + if (bShouldSortList && Index == -1) { N.Temp = N.GetSortStr(LastSortedColumn); - if( ListCount==0 ) // No sorting needed yet. + if (ListCount == 0 ) // No sorting needed yet. { N.Next = FirstItem; FirstItem = N; } - else if( bLastSortedReverse ) + else if (bLastSortedReverse) { - if( FirstItem.TempN.Temp ) + else if (FirstItem.Temp > N.Temp) { N.Next = FirstItem; FirstItem = N; } else { - for( O=FirstItem; O!=None; O=O.Next ) + for (O=FirstItem; O != None; O=O.Next) { - if( O.Next==None || O.Next.Temp>N.Temp ) + if (O.Next == None || O.Next.Temp > N.Temp) { N.Next = O.Next; O.Next = N; @@ -101,9 +101,9 @@ function KFGUI_ListItem AddLine( string Value, optional int iValue, optional str } } } - else if( Index==-1 || Index>ListCount ) + else if (Index == -1 || Index > ListCount) Index = ListCount; - if( Index==0 ) + if (Index == 0) { N.Next = FirstItem; FirstItem = N; @@ -111,9 +111,9 @@ function KFGUI_ListItem AddLine( string Value, optional int iValue, optional str else { i = 0; - for( O=FirstItem; O!=None; O=O.Next ) + for (O=FirstItem; O != None; O=O.Next) { - if( (++i)==Index ) + if ((++i) == Index) { N.Next = O.Next; O.Next = N; @@ -125,26 +125,26 @@ function KFGUI_ListItem AddLine( string Value, optional int iValue, optional str return N; } -final function RemoveLine( KFGUI_ListItem I ) +final function RemoveLine( KFGUI_ListItem I) { local KFGUI_ListItem N; - if( I.Index==-1 ) + if (I.Index == -1) return; // Update selected row info. - if( SelectedRowIndex==I.Index ) + if (SelectedRowIndex == I.Index) SelectedRowIndex = -1; - else if( SelectedRowIndex>I.Index ) + else if (SelectedRowIndex > I.Index) --SelectedRowIndex; // Remove from list. - if( FirstItem==I ) + if (FirstItem == I) FirstItem = I.Next; else { - for( N=FirstItem; N!=None; N=N.Next ) - if( N.Next==I ) + for (N=FirstItem; N != None; N=N.Next) + if (N.Next == I) { N.Next = I.Next; break; @@ -162,7 +162,7 @@ final function EmptyList() { local KFGUI_ListItem N,I; - for( I=FirstItem; I!=None; I=N ) + for (I=FirstItem; I != None; I=N) { N = I.Next; @@ -176,25 +176,25 @@ final function EmptyList() UpdateListSize(); } -final function KFGUI_ListItem GetFromIndex( int Index ) +final function KFGUI_ListItem GetFromIndex( int Index) { local KFGUI_ListItem N; - if( Index<0 || Index>=ListCount ) + if (Index < 0 || Index >= ListCount) return None; - for( N=FirstItem; N!=None; N=N.Next ) - if( (Index--)==0 ) + for (N=FirstItem; N != None; N=N.Next) + if ((Index--) == 0) return N; return None; } -function SortColumn( int Column, optional bool bReverse ) +function SortColumn( int Column, optional bool bReverse) { - local array List; + local array < KFGUI_ListItem> List; local KFGUI_ListItem Sel,N,P; local int i; - if( !bCanSortColumn || Column<0 || Column>=Columns.Length ) + if (!bCanSortColumn || Column < 0 || Column >= Columns.Length) return; LastSortedColumn = Column; @@ -210,20 +210,20 @@ function SortColumn( int Column, optional bool bReverse ) SelectedRowIndex = -1; // Slow, sort it all. - for( N=FirstItem; N!=None; N=N.Next ) + for (N=FirstItem; N != None; N=N.Next) { N.Temp = N.GetSortStr(Column); - if( bReverse ) + if (bReverse) { - for( i=0; iN.Temp ) + for (i=0; i < List.Length; ++i) + if (List[i].Temp > N.Temp) break; } List.Insert(i,1); @@ -233,14 +233,14 @@ function SortColumn( int Column, optional bool bReverse ) // Rebuild list. FirstItem = None; P = None; - for( i=0; i=ListCount ) + if (SelectedRowIndex >= ListCount) SelectedRowIndex = -1; OldItemsPerFrame = ListItemsPerPage; bListSizeDirty = false; @@ -411,12 +411,12 @@ function PreDraw() CompPos[2] += SpaceX; CompPos[3] += ColumnComp.CompPos[3]; } -function InternalClickedItem( int Index, bool bRight, int MouseX, int MouseY ) +function InternalClickedItem( int Index, bool bRight, int MouseX, int MouseY) { SelectedRowIndex = Index; OnSelectedRow(GetFromIndex(Index),Index,bRight,false); } -function InternalDblClickedItem( int Index, bool bRight, int MouseX, int MouseY ) +function InternalDblClickedItem( int Index, bool bRight, int MouseX, int MouseY) { SelectedRowIndex = Index; OnSelectedRow(GetFromIndex(Index),Index,bRight,true); diff --git a/ScoreboardExt/Classes/KFGUI_ColumnTop.uc b/ScoreboardExt/Classes/KFGUI_ColumnTop.uc index b54a531..7252278 100644 --- a/ScoreboardExt/Classes/KFGUI_ColumnTop.uc +++ b/ScoreboardExt/Classes/KFGUI_ColumnTop.uc @@ -27,37 +27,37 @@ function DrawMenu() MinSize = ColumnMinSize / CompPos[2]; // Scale column - if( bScaleColumn ) + if (bScaleColumn) { MouseX = Owner.MousePosition.X - CompPos[0]; - for( i=0; i=(1.f-MinSize) ) + if (X >= (1.f-MinSize)) { MouseX = X-(1.f-MinSize); // Grab overshoot. // Then push back! - for( j=i; j>=0; --j ) + for (j=i; j >= 0; --j) { - if( (ListOwner.Columns[j].Width-MouseX)>MinSize ) // This column has enough space to retract. + if ((ListOwner.Columns[j].Width-MouseX) > MinSize ) // This column has enough space to retract. { - ListOwner.Columns[j].Width-=MouseX; + ListOwner.Columns[j].Width -= MouseX; MouseX = 0; break; } - else if( ListOwner.Columns[j].Width>MinSize ) // This column has limited space to retract. + else if (ListOwner.Columns[j].Width > MinSize ) // This column has limited space to retract. { - MouseX-=(ListOwner.Columns[j].Width-MinSize); + MouseX -= (ListOwner.Columns[j].Width-MinSize); ListOwner.Columns[j].Width = MinSize; } } @@ -69,7 +69,7 @@ function DrawMenu() // Init mouse check. MouseColumn = -1; bCheckMouse = (bClickable && bFocused); - if( bCheckMouse ) + if (bCheckMouse) { GrabWidth = CompPos[3]*0.175; MouseX = Owner.MousePosition.X - CompPos[0] - GrabWidth; @@ -79,17 +79,17 @@ function DrawMenu() // Draw the columns and compute the scalings. X = 0; j = (ListOwner.bShouldSortList ? ListOwner.LastSortedColumn : -1); - for( i=0; i=GrabWidth) && ((i+1)= GrabWidth) && ((i+1) < ListOwner.Columns.Length); } - if( X>=CompPos[2] ) + if (X >= CompPos[2]) ListOwner.Columns[i].bHidden = true; else { @@ -113,13 +113,13 @@ function DrawMenu() //Canvas.SetClip(X+Wd,CompPos[1]+CompPos[3]); // Draw column. - if( i==j ) + if (i == j) { - if( MouseColumn==i && !bMouseScaler ) + if (MouseColumn == i && !bMouseScaler) Canvas.SetDrawColor(175,240,8,255); else Canvas.SetDrawColor(128,200,56,255); } - else if( MouseColumn==i && !bMouseScaler ) + else if (MouseColumn == i && !bMouseScaler) Canvas.SetDrawColor(220,220,8,255); XS = Owner.CurrentStyle.DefaultHeight*0.5; @@ -134,14 +134,14 @@ function DrawMenu() } } -function MouseClick( bool bRight ) +function MouseClick( bool bRight) { - if( !ListOwner.bDisabled && bClickable ) + if (!ListOwner.bDisabled && bClickable) { PressedDown[byte(bRight)] = 1; bPressedDown = true; - if( !bRight && bMouseScaler ) + if (!bRight && bMouseScaler) { PlayMenuSound(MN_ClickButton); bScaleColumn = true; @@ -150,24 +150,24 @@ function MouseClick( bool bRight ) } } } -function MouseRelease( bool bRight ) +function MouseRelease( bool bRight) { - if( bScaleColumn && !bRight ) + if (bScaleColumn && !bRight) { bScaleColumn = false; DropInputFocus(); return; } - if( !bDisabled && bClickable && PressedDown[byte(bRight)]==1 ) + if (!bDisabled && bClickable && PressedDown[byte(bRight)] == 1) { PlayMenuSound(MN_ClickButton); PressedDown[byte(bRight)] = 0; - bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0); + bPressedDown = (PressedDown[0] != 0 || PressedDown[1] != 0); - if( MouseColumn>=0 ) + if (MouseColumn >= 0) { - ListOwner.SortColumn(MouseColumn,(PrevSortedColumn==MouseColumn)); - if( PrevSortedColumn==MouseColumn ) + ListOwner.SortColumn(MouseColumn,(PrevSortedColumn == MouseColumn)); + if (PrevSortedColumn == MouseColumn) PrevSortedColumn = -1; else PrevSortedColumn = MouseColumn; } @@ -175,14 +175,14 @@ function MouseRelease( bool bRight ) } function byte GetCursorStyle() { - if( bClickable ) + if (bClickable) return (bMouseScaler ? 2 : 1); return 0; } function MouseLeave() { Super.MouseLeave(); - if( !bScaleColumn ) + if (!bScaleColumn) { PressedDown[0] = 0; PressedDown[1] = 0; diff --git a/ScoreboardExt/Classes/KFGUI_ComboBox.uc b/ScoreboardExt/Classes/KFGUI_ComboBox.uc index cc55ab1..2560ed3 100644 --- a/ScoreboardExt/Classes/KFGUI_ComboBox.uc +++ b/ScoreboardExt/Classes/KFGUI_ComboBox.uc @@ -6,7 +6,7 @@ Class KFGUI_ComboBox extends KFGUI_EditControl; var KFGUI_ComboSelector Selection; var float BorderSize; -var() array Values; +var() array < string> Values; var() int SelectedIndex; var() color SelectedTextColor,TextColor; var() bool bButtonStretched; @@ -14,7 +14,7 @@ var() bool bButtonStretched; function UpdateSizes() { // Update height. - if( bScaleByFontSize ) + if (bScaleByFontSize) YSize = (TextHeight + (BorderSize*2)) / InputPos[3]; } @@ -23,10 +23,10 @@ function DrawMenu() Owner.CurrentStyle.RenderComboBox(Self); } -function HandleMouseClick( bool bRight ) +function HandleMouseClick( bool bRight) { PlayMenuSound(MN_Dropdown); - if( Selection==None ) + if (Selection == None) { Selection = New(None)Class'KFGUI_ComboSelector'; Selection.Owner = Owner; @@ -37,22 +37,22 @@ function HandleMouseClick( bool bRight ) Selection.YPosition = (CompPos[1]+CompPos[3]) / Owner.ScreenSize.Y; Selection.XSize = CompPos[2] / Owner.ScreenSize.X; Selection.YSize = (TextHeight / Owner.ScreenSize.Y) * Values.Length + ((BorderSize*2) / Owner.ScreenSize.Y); - if( (Selection.YPosition+Selection.YSize)>1.f ) - Selection.YPosition-=((Selection.YPosition+Selection.YSize)-1.f); + if ((Selection.YPosition+Selection.YSize) > 1.f) + Selection.YPosition -= ((Selection.YPosition+Selection.YSize)-1.f); Selection.GetInputFocus(); } final function string GetCurrent() { - if( SelectedIndex=0 ) + if (CurrentRow >= 0) { Combo.SelectedIndex = CurrentRow; Combo.OnComboChanged(Combo); diff --git a/ScoreboardExt/Classes/KFGUI_ComponentList.uc b/ScoreboardExt/Classes/KFGUI_ComponentList.uc index e3deb42..668247e 100644 --- a/ScoreboardExt/Classes/KFGUI_ComponentList.uc +++ b/ScoreboardExt/Classes/KFGUI_ComponentList.uc @@ -6,20 +6,20 @@ Class KFGUI_ComponentList extends KFGUI_List; var int VisRange[2]; var() int NumColumns; -var array ItemComponents; +var array < KFGUI_Base> ItemComponents; // REMEMBER to call InitMenu() on the newly created component after values are init!!! -final function KFGUI_Base AddListComponent( class CompClass, optional float XS=1.f, optional float YS=1.f ) +final function KFGUI_Base AddListComponent( class < KFGUI_Base> CompClass, optional float XS=1.f, optional float YS=1.f) { return AddComponentAtIndex(ItemComponents.Length, CompClass, XS, YS); } -final function KFGUI_Base CreateComponent(class CompClass, optional float XS=1.f, optional float YS=1.f) +final function KFGUI_Base CreateComponent(class < KFGUI_Base> CompClass, optional float XS=1.f, optional float YS=1.f) { local KFGUI_Base G; G = new(Self)CompClass; - if( G==None ) + if (G == None) return None; G.XPosition = (1.f - XS) * 0.5f; @@ -30,17 +30,17 @@ final function KFGUI_Base CreateComponent(class CompClass, optional return G; } -final function AddItem( KFGUI_Base Item ) +final function AddItem( KFGUI_Base Item) { AddItemAtIndex(ItemComponents.Length, Item); } -final function AddItemAtIndex( int i, KFGUI_Base Item ) +final function AddItemAtIndex( int i, KFGUI_Base Item) { ItemComponents.InsertItem(i, Item); } -final function KFGUI_Base AddComponentAtIndex( int i, class CompClass, optional float XS=1.f, optional float YS=1.f ) +final function KFGUI_Base AddComponentAtIndex( int i, class < KFGUI_Base> CompClass, optional float XS=1.f, optional float YS=1.f) { local KFGUI_Base G; @@ -66,7 +66,7 @@ function InitMenu() function DrawMenu() { - if( bDrawBackground ) + if (bDrawBackground) { Canvas.SetDrawColor(250,250,250,255); Canvas.SetPos(0.f,0.f); @@ -79,25 +79,25 @@ function PreDraw() local int i; local byte j; - if( !bVisible ) + if (!bVisible) return; ComputeCoords(); // Update list size i = ItemComponents.Length / NumColumns; - if( i!=NumColumns ) + if (i != NumColumns) { ListCount = i; UpdateListVis(); } - if( !ScrollBar.bDisabled && !ScrollBar.bHideScrollbar ) + if (!ScrollBar.bDisabled && !ScrollBar.bHideScrollbar) { // First draw scrollbar to allow it to resize itself. - for( j=0; j<4; ++j ) + for (j=0; j < 4; ++j) ScrollBar.InputPos[j] = CompPos[j]; - if( OldXSize!=InputPos[2] ) + if (OldXSize != InputPos[2]) { OldXSize = InputPos[2]; } @@ -132,7 +132,7 @@ function PreDrawListItems() YS = CompPos[3] / ListItemsPerPage; VisRange[0] = (ScrollBar.CurrentScroll*NumColumns); VisRange[1] = ItemComponents.Length; - for( i=VisRange[0]; i 0 ) + if (ItemComponents.Length > 0) { - for( i=VisRange[1] - 1; i>=VisRange[0] && i= VisRange[0] && i < ItemComponents.Length; i--) { - if( ItemComponents[i].CaptureMouse() ) + if (ItemComponents[i].CaptureMouse()) { MouseArea = ItemComponents[i]; return true; @@ -188,7 +188,7 @@ function CloseMenu() { local int i; - for( i=0; i=0) ) + if ((AllowedCharSet == "") || ( (bIncludeSign) && ( (S == "-") || (S == "+") ) && (TextStr == "") ) || (InStr(AllowedCharSet,S) >= 0)) { - if ( (MaxWidth==0) || (Len(TextStr)0 ) + else if (CaretPos > 0) { SetInputText(Left(TextStr,CaretPos-1) $ Right(TextStr, Len(TextStr) - CaretPos)); CaretPos -= 1; @@ -249,12 +249,12 @@ function bool NotifyInputKey(int ControllerId, name Key, EInputEvent Event, floa return true; } - else if ( Key=='Left' ) + else if (Key == 'Left') { CaretPos = Max(0, CaretPos - 1); return true; } - else if ( Key=='Right' ) + else if (Key == 'Right') { CaretPos = Min(Len(TextStr), CaretPos + 1); return true; @@ -272,15 +272,15 @@ function string ConvertIllegal(string InputStr) i = 0; Max = Len(InputStr); - while ( i < Max ) + while ( i < Max) { C = Mid(InputStr,i,1); - if ( AllowedCharSet != "" && InStr(AllowedCharSet,C) < 0 ) + if (AllowedCharSet != "" && InStr(AllowedCharSet,C) < 0) { C = ""; } - if ( bConvertSpaces && - ((C == " ") || (C =="?") || (C=="\\") )) + if (bConvertSpaces && + ((C == " ") || (C =="?") || (C == "\\") )) { C = "_"; } @@ -313,7 +313,7 @@ function DrawMenu() Super.DrawMenu(); - if( bDrawBackground ) + if (bDrawBackground) { Canvas.SetDrawColor(250,250,250,255); Canvas.SetPos(0.f,0.f); @@ -327,12 +327,12 @@ function DrawMenu() Storage = TextStr; - if ( bMaskText && Len(Storage)>0 ) + if (bMaskText && Len(Storage) > 0) { StorageLength = Len(Storage); Storage = ""; - for(MaskIndex=1; MaskIndex <= StorageLength; MaskIndex++ ) + for (MaskIndex=1; MaskIndex <= StorageLength; MaskIndex++) { Storage $= "*"; } @@ -343,16 +343,16 @@ function DrawMenu() BoxWidth=CompPos[2]*0.9875; - if ( (Len(Storage) != LastLength) || (CaretPos!=LastCaret) ) + if ((Len(Storage) != LastLength) || (CaretPos != LastCaret)) { - if (CaretPos<=FirstVis) + if (CaretPos <= FirstVis) FirstVis = Max(0,CaretPos-1); else { FinalDraw = Mid(Storage, FirstVis, CaretPos-FirstVis); Canvas.TextSize(FinalDraw, XL, YL, FontScale, FontScale); - while ( (XL>=BoxWidth) && (FirstVis= BoxWidth) && (FirstVis < Len(Storage))) { FirstVis++; FinalDraw = Mid(Storage, FirstVis, CaretPos-FirstVis); @@ -371,7 +371,7 @@ function DrawMenu() if (!bReadOnly && (Owner.KeyboardFocus == self || bForceShowCaret)) { - if ( (FirstVis==CaretPos) || (Len(FinalDraw)==0) ) + if ((FirstVis == CaretPos) || (Len(FinalDraw) == 0)) { Canvas.TextSize("W", XL, YL, FontScale, FontScale); XL = BorderSize; @@ -385,7 +385,7 @@ function DrawMenu() CursorY = (CompPos[3]/2) - ((YL-Owner.HUDOwner.ScaledBorderSize)/2); - if(bAllSelected) + if (bAllSelected) { Canvas.SetDrawColor(255,255,255,195); Canvas.SetPos(BorderSize, CursorY); @@ -404,9 +404,9 @@ function DrawMenu() Canvas.DrawText(FinalDraw,,FontScale,FontScale,FRI); } -function HandleMouseClick( bool bRight ) +function HandleMouseClick( bool bRight) { - if( Owner.KeyboardFocus != self ) + if (Owner.KeyboardFocus != self) { GrabKeyFocus(); } diff --git a/ScoreboardExt/Classes/KFGUI_EditControl.uc b/ScoreboardExt/Classes/KFGUI_EditControl.uc index 5185b7d..8024c77 100644 --- a/ScoreboardExt/Classes/KFGUI_EditControl.uc +++ b/ScoreboardExt/Classes/KFGUI_EditControl.uc @@ -16,7 +16,7 @@ var(Lable) bool bScaleByFontSize; // Scale this component height by font height. function InitMenu() { - if( LableString=="" ) + if (LableString == "") TextLable = None; else { @@ -40,7 +40,7 @@ function InitMenu() function UpdateSizes() { // Update height. - if( bScaleByFontSize ) + if (bScaleByFontSize) YSize = ((TextHeight*1.05) + 6) / InputPos[3]; } @@ -59,26 +59,26 @@ function PreDraw() UpdateSizes(); Super.PreDraw(); - if( TextLable!=None ) + if (TextLable != None) { TextLable.YSize = YSize; TextLable.Canvas = Canvas; - for( i=0; i<4; ++i ) + for (i=0; i < 4; ++i) TextLable.InputPos[i] = InputPos[i]; TextLable.PreDraw(); } } -final function DrawClippedText( string S, float TScale, float MaxX ) +final function DrawClippedText( string S, float TScale, float MaxX) { local int i,l; local float X,XL,YL; l = Len(S); - for( i=0; iMaxX ) + if ((Canvas.CurX+X+XL) > MaxX) { --i; break; diff --git a/ScoreboardExt/Classes/KFGUI_FloatingWindow.uc b/ScoreboardExt/Classes/KFGUI_FloatingWindow.uc index 817989d..32a383e 100644 --- a/ScoreboardExt/Classes/KFGUI_FloatingWindow.uc +++ b/ScoreboardExt/Classes/KFGUI_FloatingWindow.uc @@ -29,25 +29,25 @@ function DrawMenu() { local float TempSize; - if( bUseAnimation ) + if (bUseAnimation) { TempSize = `TimeSinceEx(GetPlayer(), OpenStartTime); - if ( WindowFadeInTime - TempSize > 0 && FrameOpacity != default.FrameOpacity ) + if (WindowFadeInTime - TempSize > 0 && FrameOpacity != default.FrameOpacity) FrameOpacity = (1.f - ((WindowFadeInTime - TempSize) / WindowFadeInTime)) * default.FrameOpacity; } Owner.CurrentStyle.RenderFramedWindow(Self); - if( HeaderComp!=None ) + if (HeaderComp != None) { HeaderComp.CompPos[3] = Owner.CurrentStyle.DefaultHeight; HeaderComp.YSize = HeaderComp.CompPos[3] / CompPos[3]; // Keep header height fit the window height. } } -function SetWindowDrag( bool bDrag ) +function SetWindowDrag( bool bDrag) { bDragWindow = bDrag; - if( bDrag ) + if (bDrag) { DragOffset[0] = Owner.MousePosition.X-CompPos[0]; DragOffset[1] = Owner.MousePosition.Y-CompPos[1]; @@ -57,15 +57,15 @@ function bool CaptureMouse() { local int i; - if( bDragWindow && HeaderComp!=None ) // Always keep focus on window frame now! + if (bDragWindow && HeaderComp != None ) // Always keep focus on window frame now! { MouseArea = HeaderComp; return true; } - for( i=0; i 0 && FrameOpacity != default.FrameOpacity ) + if (WindowFadeInTime - TempSize > 0 && FrameOpacity != default.FrameOpacity) FrameOpacity = (1.f - ((WindowFadeInTime - TempSize) / WindowFadeInTime)) * default.FrameOpacity; } - if( bDrawBackground ) + if (bDrawBackground) { OnDrawFrame(Canvas, CompPos[2], CompPos[3]); } @@ -36,13 +36,13 @@ delegate OnDrawFrame(Canvas C, float W, Float H) local float T,XL,YL,HeaderH; local FontRenderInfo FRI; - if( FrameTex == None ) + if (FrameTex == None) { return; } C.SetDrawColor(255,255,255,FrameOpacity); - if( bUseLegacyDrawTile ) + if (bUseLegacyDrawTile) { Owner.CurrentStyle.DrawTileStretched(FrameTex,0,0,W,H); } @@ -52,7 +52,7 @@ delegate OnDrawFrame(Canvas C, float W, Float H) Canvas.DrawTileStretched(FrameTex,W,H,0,0,FrameTex.GetSurfaceWidth(),FrameTex.GetSurfaceHeight()); } - if( bDrawHeader && WindowTitle!="" ) + if (bDrawHeader && WindowTitle != "") { FRI.bClipText = true; FRI.bEnableShadow = true; @@ -64,7 +64,7 @@ delegate OnDrawFrame(Canvas C, float W, Float H) C.TextSize(WindowTitle, XL, YL, T, T); HeaderH = EdgeSize[1]-HeaderSize[1]; - if( bHeaderCenter ) + if (bHeaderCenter) C.SetPos((W/2) - (XL/2),(HeaderH/2) - (YL/2)); else C.SetPos(HeaderSize[0],(HeaderH/2) - (YL/2)); @@ -78,10 +78,10 @@ function PreDraw() local byte j; local float Frac, CenterX, CenterY; - if( !bVisible ) + if (!bVisible) return; - if( bUseAnimation ) + if (bUseAnimation) { Frac = Owner.CurrentStyle.TimeFraction(OpenStartTime, OpenEndTime, GetPlayer().WorldInfo.RealTimeSeconds); XSize = Lerp(default.XSize*0.75, default.XSize, Frac); @@ -100,10 +100,10 @@ function PreDraw() Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]); DrawMenu(); - for( i=0; i=ListCount ) + if (n >= ListCount) break; - if( bCheckMouse && FocusMouseItem==-1 ) + if (bCheckMouse && FocusMouseItem == -1) { - if( MouseYHit=0 ) + if (Owner.InputFocus == None && FocusMouseItem >= 0) OnMouseRest(FocusMouseItem); } diff --git a/ScoreboardExt/Classes/KFGUI_ListHorz.uc b/ScoreboardExt/Classes/KFGUI_ListHorz.uc index d81a547..a464e85 100644 --- a/ScoreboardExt/Classes/KFGUI_ListHorz.uc +++ b/ScoreboardExt/Classes/KFGUI_ListHorz.uc @@ -37,7 +37,7 @@ function DrawMenu() local float X; local bool bCheckMouse; - if( bDrawBackground ) + if (bDrawBackground) { //Canvas.DrawColor = BackgroundColor; Canvas.SetDrawColor(250,250,250,255); @@ -48,30 +48,30 @@ function DrawMenu() // Mouse focused item check. bCheckMouse = bClickable && bFocused; FocusMouseItem = -1; - if( bCheckMouse ) + if (bCheckMouse) MouseXHit = Owner.MousePosition.X - CompPos[0]; n = ScrollBar.CurrentScroll; ItemWidth = CompPos[2] / ListItemsPerPage; X = 0.f; - for( i=0; i=ListCount ) + if (n >= ListCount) break; - if( bCheckMouse && FocusMouseItem==-1 ) + if (bCheckMouse && FocusMouseItem == -1) { - if( MouseXHit=0 ) + if (Owner.InputFocus == None && FocusMouseItem >= 0) OnMouseRest(FocusMouseItem); } diff --git a/ScoreboardExt/Classes/KFGUI_ListItem.uc b/ScoreboardExt/Classes/KFGUI_ListItem.uc index a329d9b..2bbd1d1 100644 --- a/ScoreboardExt/Classes/KFGUI_ListItem.uc +++ b/ScoreboardExt/Classes/KFGUI_ListItem.uc @@ -5,37 +5,37 @@ Class KFGUI_ListItem extends Object `include(Logger.uci) var KFGUI_ListItem Next; -var array Columns,SortColumns; +var array < string> Columns,SortColumns; var int Index,Value; var transient string Temp; // Cache sorting key. -function SetValue( string S, int i, string SortStr ) +function SetValue( string S, int i, string SortStr) { ParseStringIntoArray(S,Columns,"\n",false); - if( SortStr=="" ) + if (SortStr == "") SortColumns.Length = 0; else ParseStringIntoArray(Caps(SortStr),SortColumns,"\n",false); Value = i; } // Return string to draw on HUD. -function string GetDisplayStr( int Column ) +function string GetDisplayStr( int Column) { - if( Column0 ) + if (SortColumns.Length > 0) { - if( Column Components; +var() export editinline array < KFGUI_Base> Components; function InitMenu() { local int i; - for( i=0; i=0; i-- ) + for (i=Components.Length - 1; i >= 0; i--) { - if( Components[i].CaptureMouse() ) + if (Components[i].CaptureMouse()) { MouseArea = Components[i]; return true; @@ -94,9 +94,9 @@ function bool ReceievedControllerInput(int ControllerId, name Key, EInputEvent E { local int i; - for( i=Components.Length - 1; i>=0; i-- ) + for (i=Components.Length - 1; i >= 0; i--) { - if( Components[i].ReceievedControllerInput(ControllerId, Key, Event) ) + if (Components[i].ReceievedControllerInput(ControllerId, Key, Event)) { return true; } @@ -104,47 +104,47 @@ function bool ReceievedControllerInput(int ControllerId, name Key, EInputEvent E return Super.ReceievedControllerInput(ControllerId, Key, Event); } -function KFGUI_Base FindComponentID( name InID ) +function KFGUI_Base FindComponentID( name InID) { local int i; local KFGUI_Base Result; - if( ID==InID ) + if (ID == InID) Result = Self; else { - for( i=0; i Res ) +function FindAllComponentID( name InID, out array < KFGUI_Base> Res) { local int i; - if( ID==InID ) + if (ID == InID) Res[Res.Length] = Self; - for( i=0; i Width ) + if (W > Width) { W = Width; } @@ -60,21 +60,21 @@ function DrawMenu() Width -= W; } - if ( (bShowHigh || bShowValue) && ValueRightWidth > 0.0 && Width > 0.0) + if ((bShowHigh || bShowValue) && ValueRightWidth > 0.0 && Width > 0.0) { W = ValueRightWidth; - if( W < 1.0 ) + if (W < 1.0) { W *= Width; } - if( W > Width ) + if (W > Width) { W = Width; } - if( bShowValue && bShowHigh ) + if (bShowValue && bShowHigh) { S = int(Value)$"/"$int(High); } @@ -99,12 +99,12 @@ function DrawMenu() } Canvas.SetDrawColor(255, 255, 255, 255); - if( Width > 0.0 && BarBack != None ) + if (Width > 0.0 && BarBack != None) { Owner.CurrentStyle.DrawTileStretched(BarBack, Left, Top, Width, Height); } - if( Width > 0.0 && BarTop != None && Value > Low ) + if (Width > 0.0 && BarTop != None && Value > Low) { Canvas.DrawColor = BarColor; Owner.CurrentStyle.DrawTileStretched(BarTop, Left + BorderSize, Top + BorderSize, (Width - (BorderSize * 2)) * (Value/High), Height - (BorderSize * 2)); diff --git a/ScoreboardExt/Classes/KFGUI_RightClickMenu.uc b/ScoreboardExt/Classes/KFGUI_RightClickMenu.uc index 37ec2a7..7b236d4 100644 --- a/ScoreboardExt/Classes/KFGUI_RightClickMenu.uc +++ b/ScoreboardExt/Classes/KFGUI_RightClickMenu.uc @@ -8,14 +8,14 @@ struct FRowItem var string Text,ToolTip; var bool bSplitter,bDisabled; }; -var array ItemRows; +var array < FRowItem> ItemRows; var int CurrentRow,OldRow; var int EdgeSize; var int OldSizeX; var transient bool bDrawToolTip; var Color BoxColor,OutlineColor; -function OpenMenu( KFGUI_Base Menu ) +function OpenMenu( KFGUI_Base Menu) { Owner = Menu.Owner; InitMenu(); @@ -29,10 +29,10 @@ final function ComputeSize() local int i; local string S; - if( OldSizeX == Owner.ScreenSize.X ) + if (OldSizeX == Owner.ScreenSize.X) return; - if( ItemRows.Length==0 ) + if (ItemRows.Length == 0) { YS = 0; XS = 50; @@ -40,9 +40,9 @@ final function ComputeSize() else { Canvas.Font = Owner.CurrentStyle.PickFont(Scalar); - for( i=0; i1.f ) + if ((XPosition+XSize) > 1.f) YPosition = (float(Owner.MousePosition.X) / Owner.ScreenSize.X) - XSize; // Move to left side of mouse pointer. - if( (YPosition+YSize)>1.f ) - YPosition-=((YPosition+YSize)-1.f); // Move up until fit on screen. + if ((YPosition+YSize) > 1.f) + YPosition -= ((YPosition+YSize)-1.f); // Move up until fit on screen. } -final function AddRow( string Text, bool bDisable, optional string AltToolTip ) +final function AddRow( string Text, bool bDisable, optional string AltToolTip) { local int i; i = ItemRows.Length; ItemRows.Length = i+1; - if( Text=="-" ) + if (Text == "-") ItemRows[i].bSplitter = true; else { @@ -92,9 +92,9 @@ function DrawMenu() { Owner.CurrentStyle.RenderRightClickMenu(Self); - if( bDrawToolTip ) + if (bDrawToolTip) { - if( OldRow != CurrentRow ) + if (OldRow != CurrentRow) bDrawToolTip = false; DrawToolTip(); } @@ -117,7 +117,7 @@ function DrawToolTip() BoxW = XL * 1.05f; BoxH = YL * 1.25f; - while( (X + BoxW) > Canvas.ClipX ) + while( (X + BoxW) > Canvas.ClipX) { X -= 0.01; } @@ -131,9 +131,9 @@ function DrawToolTip() Canvas.SetPos(TextX, TextY); Canvas.DrawText(S,,Scalar,Scalar); } -function HandleMouseClick( bool bRight ) +function HandleMouseClick( bool bRight) { - if( CurrentRow>=0 && (ItemRows[CurrentRow].bSplitter || ItemRows[CurrentRow].bDisabled) ) + if (CurrentRow >= 0 && (ItemRows[CurrentRow].bSplitter || ItemRows[CurrentRow].bDisabled)) return; OnSelectedItem(CurrentRow); PlayMenuSound(MN_ClickButton); @@ -147,7 +147,7 @@ function LostInputFocus() } function NotifyMousePaused() { - if(CurrentRow != -1 && ItemRows[CurrentRow].ToolTip != "") + if (CurrentRow != -1 && ItemRows[CurrentRow].ToolTip != "") bDrawToolTip = true; } diff --git a/ScoreboardExt/Classes/KFGUI_ScrollBarBase.uc b/ScoreboardExt/Classes/KFGUI_ScrollBarBase.uc index d5a4f32..2b6b016 100644 --- a/ScoreboardExt/Classes/KFGUI_ScrollBarBase.uc +++ b/ScoreboardExt/Classes/KFGUI_ScrollBarBase.uc @@ -15,7 +15,7 @@ var transient bool bGrabbedScroller; var bool bVertical, bHideScrollbar; -final function UpdateScrollSize( int Current, int MxRange, int Stride, int StepStride, optional int MnRange ) +final function UpdateScrollSize( int Current, int MxRange, int Stride, int StepStride, optional int MnRange) { MaxRange = MxRange; MinRange = MnRange; @@ -23,11 +23,11 @@ final function UpdateScrollSize( int Current, int MxRange, int Stride, int StepS PageStep = StepStride; SetValue(Current); } -final function AddValue( int V ) +final function AddValue( int V) { SetValue(CurrentScroll+V); } -final function SetValue( int V ) +final function SetValue( int V) { CurrentScroll = Clamp((V / ScrollStride) * ScrollStride,MinRange,MaxRange); OnScrollChange(Self,CurrentScroll); @@ -47,53 +47,53 @@ function float GetWidth() function PreDraw() { // Auto scale to match width to screen size. - if( bVertical ) + if (bVertical) XSize = GetWidth(); else YSize = GetWidth(); Super.PreDraw(); } function DrawMenu() { - if( !bHideScrollbar ) + if (!bHideScrollbar) { Owner.CurrentStyle.RenderScrollBar(Self); } } -function MouseClick( bool bRight ) +function MouseClick( bool bRight) { - if( bRight || bDisabled ) + if (bRight || bDisabled) return; bPressedDown = true; PlayMenuSound(MN_ClickButton); - if( bVertical ) + if (bVertical) { - if( Owner.MousePosition.Y>=(CompPos[1]+ButtonOffset) && Owner.MousePosition.Y<=(CompPos[1]+ButtonOffset+SliderScale) ) // Grabbed scrollbar! + if (Owner.MousePosition.Y >= (CompPos[1]+ButtonOffset) && Owner.MousePosition.Y <= (CompPos[1]+ButtonOffset+SliderScale) ) // Grabbed scrollbar! { GrabbedOffset = Owner.MousePosition.Y - (CompPos[1]+ButtonOffset); bGrabbedScroller = true; GetInputFocus(); } - else if( Owner.MousePosition.Y<(CompPos[1]+ButtonOffset) ) // Page up. + else if (Owner.MousePosition.Y < (CompPos[1]+ButtonOffset) ) // Page up. AddValue(-PageStep); else AddValue(PageStep); } else { - if( Owner.MousePosition.X>=(CompPos[0]+ButtonOffset) && Owner.MousePosition.X<=(CompPos[0]+ButtonOffset+SliderScale) ) // Grabbed scrollbar! + if (Owner.MousePosition.X >= (CompPos[0]+ButtonOffset) && Owner.MousePosition.X <= (CompPos[0]+ButtonOffset+SliderScale) ) // Grabbed scrollbar! { GrabbedOffset = Owner.MousePosition.X - (CompPos[0]+ButtonOffset); bGrabbedScroller = true; GetInputFocus(); } - else if( Owner.MousePosition.X<(CompPos[0]+ButtonOffset) ) // Page left. + else if (Owner.MousePosition.X < (CompPos[0]+ButtonOffset) ) // Page left. AddValue(-PageStep); else AddValue(PageStep); } } -function MouseRelease( bool bRight ) +function MouseRelease( bool bRight) { - if( !bRight ) + if (!bRight) DropInputFocus(); } @@ -103,11 +103,11 @@ function LostInputFocus() bPressedDown = false; } -function ScrollMouseWheel( bool bUp ) +function ScrollMouseWheel( bool bUp) { - if( bDisabled ) + if (bDisabled) return; - if( bUp ) + if (bUp) AddValue(-ScrollStride); else AddValue(ScrollStride); } diff --git a/ScoreboardExt/Classes/KFGUI_Slider.uc b/ScoreboardExt/Classes/KFGUI_Slider.uc index 28c3e18..80c580a 100644 --- a/ScoreboardExt/Classes/KFGUI_Slider.uc +++ b/ScoreboardExt/Classes/KFGUI_Slider.uc @@ -38,9 +38,9 @@ function UpdateListVis() ScrollBar.UpdateScrollSize(CurrentValue,MaxValue,1,1,MinValue); } -function ScrollMouseWheel( bool bUp ) +function ScrollMouseWheel( bool bUp) { - if( !ScrollBar.bDisabled ) + if (!ScrollBar.bDisabled) ScrollBar.ScrollMouseWheel(bUp); } diff --git a/ScoreboardExt/Classes/KFGUI_SwitchMenuBar.uc b/ScoreboardExt/Classes/KFGUI_SwitchMenuBar.uc index 593c1c5..f80d70e 100644 --- a/ScoreboardExt/Classes/KFGUI_SwitchMenuBar.uc +++ b/ScoreboardExt/Classes/KFGUI_SwitchMenuBar.uc @@ -4,13 +4,13 @@ Class KFGUI_SwitchMenuBar extends KFGUI_MultiComponent; `include(Build.uci) `include(Logger.uci) -var array SubPages; +var array < KFGUI_Base> SubPages; var() byte ButtonPosition; // 0 = top, 1 = bottom, 2 = left, 3 = right var() float BorderWidth,ButtonAxisSize; // Width for buttons. var() float PagePadding; // Padding for pages var int NumButtons,CurrentPageNum,PageComponentIndex; -var array PageButtons; +var array < KFGUI_Button> PageButtons; function ShowMenu() { @@ -25,7 +25,7 @@ function CloseMenu() } // Remember to call InitMenu() on the newly created page after. -final function KFGUI_Base AddPage( class PageClass, string Caption, string Hint, optional out KFGUI_Button Button ) +final function KFGUI_Base AddPage( class < KFGUI_Base> PageClass, string Caption, string Hint, optional out KFGUI_Button Button) { local KFGUI_Base P; local KFGUI_Button B; @@ -44,29 +44,29 @@ final function KFGUI_Base AddPage( class PageClass, string Caption, B.OnClickRight = PageSwitched; B.IDValue = NumButtons; - if( ButtonPosition<2 ) + if (ButtonPosition < 2) { B.XPosition = NumButtons*ButtonAxisSize; B.XSize = ButtonAxisSize*0.99; - if( ButtonPosition==0 ) + if (ButtonPosition == 0) B.YPosition = 0.f; else B.YPosition = YSize-BorderWidth*0.99; B.YSize = BorderWidth*0.99; - if( NumButtons>0 ) + if (NumButtons > 0) PageButtons[PageButtons.Length-1].ExtravDir = 1; } else { - if( ButtonPosition==2 ) + if (ButtonPosition == 2) B.XPosition = 0.f; else B.XPosition = XSize-BorderWidth*0.99; B.XSize = BorderWidth*0.99; B.YPosition = NumButtons*ButtonAxisSize; B.YSize = ButtonAxisSize*0.99; - if( NumButtons>0 ) + if (NumButtons > 0) PageButtons[PageButtons.Length-1].ExtravDir = 2; } @@ -77,24 +77,24 @@ final function KFGUI_Base AddPage( class PageClass, string Caption, return P; } -function PageSwitched( KFGUI_Button Sender ) +function PageSwitched( KFGUI_Button Sender) { SelectPage(Sender.IDValue); } -final function SelectPage( int Index ) +final function SelectPage( int Index) { PlayMenuSound(MN_LostFocus); - if( CurrentPageNum>=0 ) + if (CurrentPageNum >= 0) { PageButtons[CurrentPageNum].bIsHighlighted = false; SubPages[CurrentPageNum].CloseMenu(); Components.Remove(PageComponentIndex,1); PageComponentIndex = -1; } - CurrentPageNum = (Index>=0 && Index=0 ) + CurrentPageNum = (Index >= 0 && Index < SubPages.Length) ? Index : -1; + if (CurrentPageNum >= 0) { PageButtons[CurrentPageNum].bIsHighlighted = true; SubPages[CurrentPageNum].ShowMenu(); @@ -108,23 +108,23 @@ function PreDraw() local int i; local byte j; - if( !bVisible ) + if (!bVisible) return; - if( CurrentPageNum==-1 && NumButtons>0 ) + if (CurrentPageNum == -1 && NumButtons > 0) SelectPage(0); ComputeCoords(); Canvas.SetOrigin(CompPos[0],CompPos[1]); Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]); DrawMenu(); - for( i=0; i Text; + var array < FTextPart> Text; var float Y; }; var KFGUI_ScrollBarV ScrollBar; @@ -36,14 +36,14 @@ var() Canvas.FontRenderInfo TextFontInfo; var() float FontScale,MessageDisplayTime,MessageFadeInTime,MessageFadeOutTime; var() bool bNoReset,bFadeInOut,bUseOutlineText; var() int MaxHistory, OutlineSize; -var protected transient array Lines,OrgLines; +var protected transient array < FTextLineInfo> Lines,OrgLines; var transient float MaxHeight,ScrollWidth,OldSize[2],InitFontScale,TextHeight,FadeStartTime; var transient Font InitFont; var transient bool bShowScrollbar,bTextParsed; -function SetText( string S ) +function SetText( string S) { - if( Text==S ) + if (Text == S) return; Text = S; OldSize[0] = -1; // Force to refresh. @@ -51,7 +51,7 @@ function SetText( string S ) OrgLines.Length = 0; bTextParsed = false; } -function AddText( string S, optional bool bIgnoreSpam ) +function AddText( string S, optional bool bIgnoreSpam) { Text $= S; OldSize[0] = -1; @@ -66,7 +66,7 @@ final function string GetText() final function ParseTextLines() { - local array SA; + local array < string> SA; local int i,j,z; local string S; local color C; @@ -76,19 +76,19 @@ final function ParseTextLines() Lines.Length = SA.Length; C.A = 0; TextType = TEXT_FIELD_NONE; - for( i=0; i0 ) + if (j > 0) { Lines[i].Text.Length = z+1; Lines[i].Text[z].S = Left(S,j); @@ -96,29 +96,29 @@ final function ParseTextLines() Lines[i].Text[z].TextType = TextType; ++z; } - else if( j==-1 ) + else if (j == -1) break; S = Mid(S,j+2); - if( Left(S,4)=="DEF}" ) + if (Left(S,4) == "DEF}") { C.A = 0; S = Mid(S,4); TextType = TEXT_FIELD_NONE; } - else if( Left(S,4)=="HSV}" ) + else if (Left(S,4) == "HSV}") { C.A = 0; S = Mid(S,4); TextType = TEXT_FIELD_HSV; } - else if( Left(S,6)=="FLASH}" ) + else if (Left(S,6) == "FLASH}") { C.A = 0; S = Mid(S,6); TextType = TEXT_FIELD_FLASH; } - else if( Left(S,7)=="CFLASH=" ) + else if (Left(S,7) == "CFLASH=") { C.A = 0; S = Mid(S,7); @@ -147,21 +147,21 @@ final function ParseTextLines() } OrgLines = Lines; // Create a backup. } -final function byte GrabHexValue( string S ) +final function byte GrabHexValue( string S) { local byte n; - n = (HexToInt(Asc(Left(S,1)))<<4) | HexToInt(Asc(Right(S,1))); + n = (HexToInt(Asc(Left(S,1))) << 4) | HexToInt(Asc(Right(S,1))); S = Mid(S,2); return n; } -final function byte HexToInt( byte n ) +final function byte HexToInt( byte n) { - if( n>=48 && n<=57 ) // '0' - '9' + if (n >= 48 && n <= 57 ) // '0' - '9' return n-48; - if( n>=65 && n<=70 ) // 'A' - 'F' + if (n >= 65 && n <= 70 ) // 'A' - 'F' return n-55; // 'A' - 10 - if( n>=97 && n<=102 ) // 'a' - 'f' + if (n >= 97 && n <= 102 ) // 'a' - 'f' return n-87; // 'a' - 10 return 0; } @@ -172,12 +172,12 @@ function InitSize() local float XS; local int MaxScrollRange; - if( Canvas == None ) + if (Canvas == None) return; OldSize[0] = CompPos[2]; OldSize[1] = CompPos[3]; - if( !bTextParsed ) + if (!bTextParsed) { ParseTextLines(); bTextParsed = true; @@ -193,13 +193,13 @@ function InitSize() ParseLines(CompPos[2] / InitFontScale); MaxHeight = (Lines.Length * TextHeight); - bShowScrollbar = (MaxHeight>=CompPos[3]); + bShowScrollbar = (MaxHeight >= CompPos[3]); bClickable = bShowScrollbar; bCanFocus = bShowScrollbar; - if( bShowScrollbar ) + if (bShowScrollbar) { - if( ScrollBar==None ) + if (ScrollBar == None) { ScrollBar = new(Self) class'KFGUI_ScrollBarV'; ScrollBar.SetPosition(0.9,0.0,0.1,1.0); @@ -210,7 +210,7 @@ function InitSize() } // Compute scrollbar size and X-position. - for( i=0; i<4; ++i ) + for (i=0; i < 4; ++i) ScrollBar.InputPos[i] = CompPos[i]; ScrollWidth = ScrollBar.GetWidth(); ScrollBar.XPosition = 1.f - ScrollWidth; @@ -222,32 +222,32 @@ function InitSize() Lines = OrgLines; ParseLines((CompPos[2]-ScrollWidth) / InitFontScale); - if( Components.Find(ScrollBar)==-1 ) + if (Components.Find(ScrollBar) == -1) Components.AddItem(ScrollBar); MaxHeight = (Lines.Length * TextHeight); MaxScrollRange = Max(((MaxHeight-CompPos[3])/TextHeight),1); ScrollBar.UpdateScrollSize(bNoReset ? MaxScrollRange : 0,MaxScrollRange,1,1); } - else if( ScrollBar!=None ) + else if (ScrollBar != None) Components.RemoveItem(ScrollBar); } // Parse textlines to see if they're too long. -final function ParseLines( float ClipX ) +final function ParseLines( float ClipX) { local float X,XS,YS; local int i,j,z,n; - for( i=0; iClipX ) + if ((X+XS) > ClipX) { z = FindSplitPoint(Lines[i].Text[j].S,X,ClipX); @@ -255,7 +255,7 @@ final function ParseLines( float ClipX ) Lines.Insert(i+1,1); // Append the remaining lines there. - for( n=j; nClipX ) // Split here if possible. + if (X > ClipX ) // Split here if possible. { - if( PrevWord==0 ) + if (PrevWord == 0) return (bStartedZero ? i : 0); // No wrap. return PrevWord; } @@ -318,9 +318,9 @@ final function int FindSplitPoint( string S, float X, float ClipX ) } return l; } -final function string StripWhiteSpaces( string S ) +final function string StripWhiteSpaces( string S) { - if( Left(S,1)==" " ) + if (Left(S,1) == " ") S = Mid(S,1); return S; } @@ -335,19 +335,19 @@ function DrawMenu() local int i,j,Index; local float Y; - if( Text=="" || !bVisible ) + if (Text == "" || !bVisible) return; // Need to figure out best fitting font. - if( OldSize[0]!=CompPos[2] || OldSize[1]!=CompPos[3] ) + if (OldSize[0] != CompPos[2] || OldSize[1] != CompPos[3]) InitSize(); - if( MaxHistory != 0 ) + if (MaxHistory != 0) { - if( Lines.Length >= MaxHistory ) + if (Lines.Length >= MaxHistory) { Index = InStr(Text, LineSplitter); - if( Index == INDEX_NONE ) + if (Index == INDEX_NONE) Lines.Remove(0, 1); else SetText(Mid(Text, Index+Len(LineSplitter))); } @@ -355,24 +355,24 @@ function DrawMenu() Canvas.Font = InitFont; - if( bShowScrollbar ) + if (bShowScrollbar) { Canvas.SetClip(CompPos[0]+(CompPos[2]-ScrollWidth),CompPos[1]+CompPos[3]); i = ScrollBar.GetValue(); } else i = 0; - if( i=CompPos[3] ) + if ((Lines[i].Y-Y+TextHeight) >= CompPos[3]) break; - for( j=0; j MessageDisplayTime ) + if (TempSize > MessageDisplayTime) { return; } - if ( TempSize < MessageFadeInTime ) + if (TempSize < MessageFadeInTime) { FadeAlpha = int((TempSize / MessageFadeInTime) * 255.0); } - else if ( TempSize > MessageDisplayTime - MessageFadeOutTime ) + else if (TempSize > MessageDisplayTime - MessageFadeOutTime) { FadeAlpha = int((1.0 - ((TempSize - (MessageDisplayTime - MessageFadeOutTime)) / MessageFadeOutTime)) * 255.0); } @@ -417,7 +417,7 @@ function DrawTextField(string S, int Index, float X, float Y, optional Color C, Canvas.DrawColor.A = FadeAlpha; } - if( bUseOutlineText ) + if (bUseOutlineText) { Owner.CurrentStyle.DrawTextShadow(S,X,Y,OutlineSize,InitFontScale); } @@ -433,7 +433,7 @@ function Color GetColorFromStyle(Color MainColor, ETextFieldStyles TextStyle) local float ColorHUE,Value; local HSVColour HSV; - if( TextStyle == TEXT_FIELD_HSV ) + if (TextStyle == TEXT_FIELD_HSV) { ColorHUE = Abs(Sin(GetPlayer().WorldInfo.TimeSeconds * 0.9) * 335); @@ -444,7 +444,7 @@ function Color GetColorFromStyle(Color MainColor, ETextFieldStyles TextStyle) return class'KFColorHelper'.static.LinearColorToColor(class'KFColorHelper'.static.HSVToRGB(HSV)); } - else if( TextStyle == TEXT_FIELD_FLASH ) + else if (TextStyle == TEXT_FIELD_FLASH) { Value = Abs(Sin(GetPlayer().WorldInfo.TimeSeconds * 0.9) * 1); HSV = class'KFColorHelper'.static.RGBToHSV(ColorToLinearColor(MainColor)); @@ -461,9 +461,9 @@ function bool CaptureMouse() return (bShowScrollbar ? Super.CaptureMouse() : false); // Nope. } -function ScrollMouseWheel( bool bUp ) +function ScrollMouseWheel( bool bUp) { - if( bShowScrollbar ) + if (bShowScrollbar) ScrollBar.ScrollMouseWheel(bUp); } @@ -471,7 +471,7 @@ function SetVisibility(bool Visible) { Super.SetVisibility(Visible); - if( ScrollBar != None ) + if (ScrollBar != None) { ScrollBar.SetVisibility(Visible); } diff --git a/ScoreboardExt/Classes/KFGUI_TextLable.uc b/ScoreboardExt/Classes/KFGUI_TextLable.uc index 1078548..4ca7cd7 100644 --- a/ScoreboardExt/Classes/KFGUI_TextLable.uc +++ b/ScoreboardExt/Classes/KFGUI_TextLable.uc @@ -24,15 +24,15 @@ function InitSize() TS = Owner.CurrentStyle.GetFontScaler(); TS *= FontScale; - while( true ) + while( true) { Canvas.Font = Owner.CurrentStyle.MainFont; - if( TextFontInfo.bClipText ) + if (TextFontInfo.bClipText) Canvas.TextSize(Text,XL,YL,TS,TS); else { Canvas.SetPos(0,0); - if( TS==1 ) + if (TS == 1) Canvas.StrLen(Text,XL,YL); else { @@ -42,7 +42,7 @@ function InitSize() YL*=TS; } } - if( (XL<(CompPos[2]*0.99) && YL<(CompPos[3]*0.99)) ) + if ((XL < (CompPos[2]*0.99) && YL < (CompPos[3]*0.99))) break; TS -= 0.001; @@ -51,7 +51,7 @@ function InitSize() InitFont = Canvas.Font; InitFontScale = TS; - switch( AlignX ) + switch( AlignX) { case 0: InitOffset[0] = 0; @@ -62,7 +62,7 @@ function InitSize() default: InitOffset[0] = CompPos[2]-(XL+1); } - switch( AlignY ) + switch( AlignY) { case 0: InitOffset[1] = 0; @@ -74,9 +74,9 @@ function InitSize() InitOffset[1] = CompPos[3]-YL; } } -function SetText( string S ) +function SetText( string S) { - if( Text==S ) + if (Text == S) return; Text = S; OldSize[0] = -1; // Force to refresh. @@ -88,16 +88,16 @@ final function string GetText() function DrawMenu() { - if( Text=="" ) + if (Text == "") return; // Need to figure out best fitting font. - if( OldSize[0]!=CompPos[2] || OldSize[1]!=CompPos[3] ) + if (OldSize[0] != CompPos[2] || OldSize[1] != CompPos[3]) InitSize(); Canvas.Font = InitFont; Canvas.DrawColor = TextColor; - if( bUseOutline ) + if (bUseOutline) { Owner.CurrentStyle.DrawTextShadow(Text,InitOffset[0],InitOffset[1],OutlineSize,InitFontScale); } diff --git a/ScoreboardExt/Classes/KFGUI_TextScroll.uc b/ScoreboardExt/Classes/KFGUI_TextScroll.uc index 7d545ff..279c1fe 100644 --- a/ScoreboardExt/Classes/KFGUI_TextScroll.uc +++ b/ScoreboardExt/Classes/KFGUI_TextScroll.uc @@ -7,10 +7,10 @@ var float ScrollSpeed; var transient float CharStartTime; var transient bool bScrollCompleted, bTextDirty; -var transient array RowsCompleted; +var transient array < bool> RowsCompleted; var transient int MaxIndex, RowsDropped; -function SetText( string S ) +function SetText( string S) { Super.SetText(S); @@ -32,38 +32,38 @@ function DrawMenu() local Texture CurrentCursor; local ETextFieldStyles TextStyle; - if( bScrollCompleted ) + if (bScrollCompleted) { Super.DrawMenu(); return; } - if( Text=="" ) + if (Text == "") return; // Need to figure out best fitting font. - if( OldSize[0]!=CompPos[2] || OldSize[1]!=CompPos[3] ) + if (OldSize[0] != CompPos[2] || OldSize[1] != CompPos[3]) InitSize(); Canvas.Font = InitFont; - if( bShowScrollbar ) + if (bShowScrollbar) { Canvas.SetClip(CompPos[0]+(CompPos[2]-ScrollWidth),CompPos[1]+CompPos[3]); i = ScrollBar.GetValue(); } else i = 0; - if( ScrollBar != None ) + if (ScrollBar != None) { - if( bTextDirty ) + if (bTextDirty) { ScrollBar.bDisabled = true; RowsCompleted.Length = Lines.Length; bTextDirty = false; } - if( RowsCompleted[Lines.Length-1] ) + if (RowsCompleted[Lines.Length-1]) { ScrollBar.AddValue(1); ScrollBar.bDisabled = false; @@ -74,7 +74,7 @@ function DrawMenu() return; } - else if( MaxIndex != 0 && RowsCompleted[MaxIndex] ) + else if (MaxIndex != 0 && RowsCompleted[MaxIndex]) { MaxIndex = 0; ScrollBar.AddValue(1); @@ -85,13 +85,13 @@ function DrawMenu() } } - if( RowsDropped > 0 ) + if (RowsDropped > 0) { - for( i=0; i<=RowsDropped; ++i ) + for (i=0; i <= RowsDropped; ++i) { - for( j=0; j=CompPos[3] ) + if ((Lines[i].Y-Y+TextHeight) >= CompPos[3]) { MaxIndex = i-1; break; } - if( Lines[i].Text.Length!=0 ) + if (Lines[i].Text.Length != 0) { - for( j=0; j DTime ) + if (CharTime > DTime) { - if( CurrentIndex == k ) + if (CurrentIndex == k) { Canvas.SetDrawColor(255,255,255,255); Canvas.SetPos(MainX+XL,MainY); @@ -152,7 +152,7 @@ function DrawMenu() CurrentIndex = k+1; - if( k >= SLen ) + if (k >= SLen) { RowsCompleted[i] = true; } @@ -168,12 +168,12 @@ function bool CaptureMouse() return (!bScrollCompleted && Super(KFGUI_MultiComponent).CaptureMouse()) || Super.CaptureMouse(); } -function MouseClick( bool bRight ) +function MouseClick( bool bRight) { - if( bScrollCompleted ) + if (bScrollCompleted) return; - if( ScrollBar != None ) + if (ScrollBar != None) ScrollBar.bDisabled = false; bScrollCompleted = true; diff --git a/ScoreboardExt/Classes/KFGUI_Tooltip.uc b/ScoreboardExt/Classes/KFGUI_Tooltip.uc index 20181d4..a68befa 100644 --- a/ScoreboardExt/Classes/KFGUI_Tooltip.uc +++ b/ScoreboardExt/Classes/KFGUI_Tooltip.uc @@ -3,7 +3,7 @@ Class KFGUI_Tooltip extends KFGUI_Base; `include(Build.uci) `include(Logger.uci) -var() array Lines; +var() array < string> Lines; var() Canvas.FontRenderInfo TextFontInfo; var byte CurrentAlpha; @@ -11,11 +11,11 @@ function InputMouseMoved() { DropInputFocus(); } -function MouseClick( bool bRight ) +function MouseClick( bool bRight) { DropInputFocus(); } -function MouseRelease( bool bRight ) +function MouseRelease( bool bRight) { DropInputFocus(); } @@ -24,14 +24,14 @@ function ShowMenu() CurrentAlpha = 1; } -final function SetText( string S ) +final function SetText( string S) { - ParseStringIntoArray(S,Lines,"",false); + ParseStringIntoArray(S,Lines," < SEPERATOR > ",false); } function PreDraw() { - if( !bVisible ) + if (!bVisible) return; Owner.CurrentStyle.RenderToolTip(Self); diff --git a/ScoreboardExt/Classes/KFScoreBoard.uc b/ScoreboardExt/Classes/KFScoreBoard.uc index 809ecaa..ece271c 100644 --- a/ScoreboardExt/Classes/KFScoreBoard.uc +++ b/ScoreboardExt/Classes/KFScoreBoard.uc @@ -13,7 +13,7 @@ var KFGUI_List PlayersList; var Texture2D DefaultAvatar; var KFGameReplicationInfo KFGRI; -var array KFPRIArray; +var array < KFPlayerReplicationInfo> KFPRIArray; var KFPlayerController OwnerPC; @@ -21,8 +21,8 @@ var Color PingColor; var float PingBars; // Ranks -var array CustomRanks; -var array RankRelations; +var array < RankInfo> CustomRanks; +var array < UIDRankRelation> RankRelations; var SCESettings Settings; @@ -37,27 +37,27 @@ static function CheckAvatar(KFPlayerReplicationInfo KFPRI, KFPlayerController PC { local Texture2D Avatar; - if( KFPRI.Avatar == None || KFPRI.Avatar == default.DefaultAvatar ) + if (KFPRI.Avatar == None || KFPRI.Avatar == default.DefaultAvatar) { Avatar = FindAvatar(PC, KFPRI.UniqueId); - if( Avatar == None ) + if (Avatar == None) Avatar = default.DefaultAvatar; KFPRI.Avatar = Avatar; } } -delegate bool InOrder( KFPlayerReplicationInfo P1, KFPlayerReplicationInfo P2 ) +delegate bool InOrder( KFPlayerReplicationInfo P1, KFPlayerReplicationInfo P2) { - if( P1 == None || P2 == None ) + if (P1 == None || P2 == None) return true; - if( P1.GetTeamNum() < P2.GetTeamNum() ) + if (P1.GetTeamNum() < P2.GetTeamNum()) return false; - if( P1.Kills == P2.Kills ) + if (P1.Kills == P2.Kills) { - if( P1.Assists == P2.Assists ) + if (P1.Assists == P2.Assists) return true; return P1.Assists < P2.Assists; @@ -71,7 +71,7 @@ function string WaveText() local int CurrentWaveNum; CurrentWaveNum = KFGRI.WaveNum; - if(KFGRI.IsBossWave()) + if (KFGRI.IsBossWave()) { return class'KFGFxHUD_WaveInfo'.default.BossWaveString; } @@ -103,23 +103,23 @@ function DrawMenu() local float BorderSize; PC = GetPlayer(); - if( KFGRI==None ) + if (KFGRI == None) { KFGRI = KFGameReplicationInfo(PC.WorldInfo.GRI); - if( KFGRI==None ) + if (KFGRI == None) return; } // Sort player list. - if( NextScoreboardRefresh < PC.WorldInfo.TimeSeconds ) + if (NextScoreboardRefresh < PC.WorldInfo.TimeSeconds) { NextScoreboardRefresh = PC.WorldInfo.TimeSeconds + 0.1; - for( i=(KFGRI.PRIArray.Length-1); i>0; --i ) + for (i=(KFGRI.PRIArray.Length-1); i > 0; --i) { - for( j=i-1; j>=0; --j ) + for (j=i-1; j >= 0; --j) { - if( !InOrder(KFPlayerReplicationInfo(KFGRI.PRIArray[i]),KFPlayerReplicationInfo(KFGRI.PRIArray[j])) ) + if (!InOrder(KFPlayerReplicationInfo(KFGRI.PRIArray[i]),KFPlayerReplicationInfo(KFGRI.PRIArray[j]))) { PRI = KFGRI.PRIArray[i]; KFGRI.PRIArray[i] = KFGRI.PRIArray[j]; @@ -132,30 +132,30 @@ function DrawMenu() // Check players. PlayerIndex = -1; NumPlayer = 0; - for( i=(KFGRI.PRIArray.Length-1); i>=0; --i ) + for (i=(KFGRI.PRIArray.Length-1); i >= 0; --i) { KFPRI = KFPlayerReplicationInfo(KFGRI.PRIArray[i]); - if( KFPRI==None ) + if (KFPRI == None) continue; - if( KFPRI.bOnlySpectator ) + if (KFPRI.bOnlySpectator) { ++NumSpec; continue; } - if( KFPRI.PlayerHealth>0 && KFPRI.PlayerHealthPercent>0 && KFPRI.GetTeamNum()==0 ) + if (KFPRI.PlayerHealth > 0 && KFPRI.PlayerHealthPercent > 0 && KFPRI.GetTeamNum() == 0) ++NumAlivePlayer; ++NumPlayer; } KFPRIArray.Length = NumPlayer; j = KFPRIArray.Length; - for( i=(KFGRI.PRIArray.Length-1); i>=0; --i ) + for (i=(KFGRI.PRIArray.Length-1); i >= 0; --i) { KFPRI = KFPlayerReplicationInfo(KFGRI.PRIArray[i]); - if( KFPRI!=None && !KFPRI.bOnlySpectator ) + if (KFPRI != None && !KFPRI.bOnlySpectator) { KFPRIArray[--j] = KFPRI; - if( KFPRI==PC.PlayerReplicationInfo ) + if (KFPRI == PC.PlayerReplicationInfo) PlayerIndex = j; } } @@ -316,7 +316,7 @@ function SetDrawColor(Canvas C, ColorRGBA RGBA) C.SetDrawColor(RGBA.R, RGBA.G, RGBA.B, RGBA.A); } -function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, float Width, bool bFocus ) +function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, float Width, bool bFocus) { local string S, StrValue; local float FontScalar, TextYOffset, XL, YL, PerkIconPosX, PerkIconPosY, PerkIconSize, PrestigeIconScale; @@ -368,7 +368,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa } // Now all players belongs to 'Rank' - if( KFGRI.bVersusGame ) + if (KFGRI.bVersusGame) bIsZED = KFTeamInfo_Zeds(KFPRI.Team) != None; XPos = 0.f; @@ -378,15 +378,15 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa Canvas.TextSize("ABC", XL, YL, FontScalar, FontScalar); // change rect color by HP - if( !KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun ) + if (!KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun) { SetDrawColor(C, Settings.Style.LeftStateBoxColor); } - else if ( !KFGRI.bMatchHasBegun ) + else if (!KFGRI.bMatchHasBegun) { SetDrawColor(C, Settings.Style.LeftStateBoxColor); } - else if( bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None ) + else if (bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None) { SetDrawColor(C, Settings.Style.LeftStateBoxColor); } @@ -447,7 +447,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa DrawTextShadowHLeftVCenter(S, RankXPos, TextYOffset, FontScalar); // Perk - if( bIsZED ) + if (bIsZED) { if (CurrentRank.ApplyColorToFields.Perk) SetDrawColor(C, CurrentRank.TextColor); @@ -461,7 +461,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa } else { - if( KFPRI.CurrentPerkClass!=None ) + if (KFPRI.CurrentPerkClass != None) { PrestigeLevel = KFPRI.GetActivePerkPrestigeLevel(); Level = KFPRI.GetActivePerkLevel(); @@ -525,9 +525,9 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa } // Avatar - if( KFPRI.Avatar != None ) + if (KFPRI.Avatar != None) { - if( KFPRI.Avatar == default.DefaultAvatar ) + if (KFPRI.Avatar == default.DefaultAvatar) CheckAvatar(KFPRI, OwnerPC); C.SetDrawColor(255,255,255,255); @@ -535,7 +535,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa C.DrawTile(KFPRI.Avatar,Height - 6,Height - 6,0,0,KFPRI.Avatar.SizeX,KFPRI.Avatar.SizeY); Owner.CurrentStyle.DrawBoxHollow(PlayerXPos - (Height * 1.075), YOffset + (Height * 0.5f) - ((Height - 6) * 0.5f), Height - 6, Height - 6, 1); } - else if( !KFPRI.bBot ) + else if (!KFPRI.bBot) CheckAvatar(KFPRI, OwnerPC); // Player @@ -561,7 +561,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa DrawTextShadowHVCenter(string (KFPRI.Assists), AssistXPos, TextYOffset, AssistWBox, FontScalar); // Cash - if( bIsZED ) + if (bIsZED) { SetDrawColor(C, Settings.Style.ZedTextColor); StrValue = "Brains!"; @@ -577,12 +577,12 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa DrawTextShadowHVCenter(StrValue, CashXPos, TextYOffset, CashWBox, FontScalar); // State - if( !KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun ) + if (!KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun) { SetDrawColor(C, Settings.Style.StateTextColorLobby); S = "LOBBY"; } - else if( !KFGRI.bMatchHasBegun ) + else if (!KFGRI.bMatchHasBegun) { if (KFPRI.bReadyToPlay) { @@ -595,7 +595,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa S = "Not Ready"; } } - else if( bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None ) + else if (bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None) { SetDrawColor(C, Settings.Style.StateTextColor); S = "Unknown"; @@ -659,7 +659,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa DrawPingBars(C, YOffset + (Height/2) - ((Height*0.5)/2), Width - (Height*0.5) - (Owner.HUDOwner.ScaledBorderSize*2), Height*0.5, Height*0.5, float(Ping)); } -final function DrawPingBars( Canvas C, float YOffset, float XOffset, float W, float H, float Ping ) +final function DrawPingBars( Canvas C, float YOffset, float XOffset, float W, float H, float Ping) { local float PingMul, BarW, BarH, BaseH, XPos, YPos; local byte i; @@ -671,7 +671,7 @@ final function DrawPingBars( Canvas C, float YOffset, float XOffset, float W, fl PingColor.R = (1.f - PingMul) * 255; PingColor.G = PingMul * 255; - for(i=1; i= (i / PingBars) ) + if (PingMul >= (i / PingBars)) { C.SetPos(XPos,YPos); C.DrawColor = PingColor; @@ -693,26 +693,26 @@ final function DrawPingBars( Canvas C, float YOffset, float XOffset, float W, fl } } -static final function Texture2D FindAvatar( KFPlayerController PC, UniqueNetId ClientID ) +static final function Texture2D FindAvatar( KFPlayerController PC, UniqueNetId ClientID) { local string S; S = PC.GetSteamAvatar(ClientID); - if( S=="" ) + if (S == "") return None; return Texture2D(PC.FindObject(S,class'Texture2D')); } final static function string GetNiceSize(int Num) { - if( Num < 1000 ) return string(Num); - else if( Num < 1000000 ) return (Num / 1000) $ "K"; - else if( Num < 1000000000 ) return (Num / 1000000) $ "M"; + if (Num < 1000 ) return string(Num); + else if (Num < 1000000 ) return (Num / 1000) $ "K"; + else if (Num < 1000000000 ) return (Num / 1000000) $ "M"; return (Num / 1000000000) $ "B"; } -function ScrollMouseWheel( bool bUp ) +function ScrollMouseWheel( bool bUp) { PlayersList.ScrollMouseWheel(bUp); } diff --git a/ScoreboardExt/Classes/PlayerRankRelations.uc b/ScoreboardExt/Classes/PlayerRankRelations.uc index 90358a7..6c95026 100644 --- a/ScoreboardExt/Classes/PlayerRankRelations.uc +++ b/ScoreboardExt/Classes/PlayerRankRelations.uc @@ -5,4 +5,4 @@ class PlayerRankRelations extends Object `include(Build.uci) `include(Logger.uci) -var config array Relation; +var config array < RankRelation> Relation; diff --git a/ScoreboardExt/Classes/ScoreboardExtHUD.uc b/ScoreboardExt/Classes/ScoreboardExtHUD.uc index 448f03a..3402179 100644 --- a/ScoreboardExt/Classes/ScoreboardExtHUD.uc +++ b/ScoreboardExt/Classes/ScoreboardExtHUD.uc @@ -7,9 +7,9 @@ class ScoreboardExtHUD extends KFGFxHudWrapper const HUDBorderSize = 3; var float ScaledBorderSize; -var array HUDWidgets; +var array < KFGUI_Base> HUDWidgets; -var class ScoreboardClass; +var class < KFScoreBoard> ScoreboardClass; var KFScoreBoard Scoreboard; var transient KF2GUIController GUIController; @@ -29,16 +29,16 @@ simulated function PostBeginPlay() function PostRender() { - if( KFGRI == None ) + if (KFGRI == None) KFGRI = KFGameReplicationInfo(WorldInfo.GRI); - if( GUIController!=None && PlayerOwner.PlayerInput==None ) + if (GUIController != None && PlayerOwner.PlayerInput == None) GUIController.NotifyLevelChange(); - if( GUIController==None || GUIController.bIsInvalid ) + if (GUIController == None || GUIController.bIsInvalid) { GUIController = Class'ScoreboardExt.KF2GUIController'.Static.GetGUIController(PlayerOwner); - if( GUIController!=None ) + if (GUIController != None) { GUIStyle = GUIController.CurrentStyle; GUIStyle.HUDOwner = self; @@ -48,7 +48,7 @@ function PostRender() GUIStyle.Canvas = Canvas; GUIStyle.PickDefaultFontSize(Canvas.ClipY); - if( !GUIController.bIsInMenuState ) + if (!GUIController.bIsInMenuState) GUIController.HandleDrawMenu(); ScaledBorderSize = FMax(GUIStyle.ScreenScale(HUDBorderSize), 1.f); @@ -66,9 +66,9 @@ function bool NotifyInputKey(int ControllerId, Name Key, EInputEvent Event, floa { local int i; - for( i=(HUDWidgets.Length-1); i>=0; --i ) + for (i=(HUDWidgets.Length-1); i >= 0; --i) { - if( HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputKey(ControllerId, Key, Event, AmountDepressed, bGamepad) ) + if (HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputKey(ControllerId, Key, Event, AmountDepressed, bGamepad)) return true; } @@ -79,9 +79,9 @@ function bool NotifyInputAxis(int ControllerId, name Key, float Delta, float Del { local int i; - for( i=(HUDWidgets.Length-1); i>=0; --i ) + for (i=(HUDWidgets.Length-1); i >= 0; --i) { - if( HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputAxis(ControllerId, Key, Delta, DeltaTime, bGamepad) ) + if (HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputAxis(ControllerId, Key, Delta, DeltaTime, bGamepad)) return true; } @@ -92,9 +92,9 @@ function bool NotifyInputChar(int ControllerId, string Unicode) { local int i; - for( i=(HUDWidgets.Length-1); i>=0; --i ) + for (i=(HUDWidgets.Length-1); i >= 0; --i) { - if( HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputChar(ControllerId, Unicode) ) + if (HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputChar(ControllerId, Unicode)) return true; } diff --git a/ScoreboardExt/Classes/ScoreboardExtMut.uc b/ScoreboardExt/Classes/ScoreboardExtMut.uc index e63833c..fcb2af8 100644 --- a/ScoreboardExt/Classes/ScoreboardExtMut.uc +++ b/ScoreboardExt/Classes/ScoreboardExtMut.uc @@ -17,10 +17,10 @@ struct SClient var KFPlayerController KFPC; }; -var private array RepClients; -var private array UIDRankRelationsPlayers; -var private array UIDRankRelationsSteamGroups; -var private array UIDRankRelationsActive; +var private array < SClient> RepClients; +var private array < UIDRankRelation> UIDRankRelationsPlayers; +var private array < UIDRankRelation> UIDRankRelationsSteamGroups; +var private array < UIDRankRelation> UIDRankRelationsActive; var private SCESettings Settings; function PostBeginPlay() diff --git a/ScoreboardExt/Classes/ScoreboardExtRepInfo.uc b/ScoreboardExt/Classes/ScoreboardExtRepInfo.uc index 874b771..03f8800 100644 --- a/ScoreboardExt/Classes/ScoreboardExtRepInfo.uc +++ b/ScoreboardExt/Classes/ScoreboardExtRepInfo.uc @@ -11,9 +11,9 @@ var private KFScoreBoard SC; var private OnlineSubsystemSteamworks SW; // Fitst time replication -var public array SteamGroupRelations; -var private array RankRelations; -var public array CustomRanks; +var public array < UIDRankRelation> SteamGroupRelations; +var private array < UIDRankRelation> RankRelations; +var public array < RankInfo> CustomRanks; var public SCESettings Settings; var public UIDRankRelation RankRelation; // Current player rank relation diff --git a/ScoreboardExt/Classes/SteamGroupRankRelations.uc b/ScoreboardExt/Classes/SteamGroupRankRelations.uc index 88d2e6a..48f60b6 100644 --- a/ScoreboardExt/Classes/SteamGroupRankRelations.uc +++ b/ScoreboardExt/Classes/SteamGroupRankRelations.uc @@ -5,7 +5,7 @@ class SteamGroupRankRelations extends Object `include(Build.uci) `include(Logger.uci) -var config array Relation; +var config array < RankRelation> Relation; DefaultProperties {