fix code style

This commit is contained in:
GenZmeY 2021-06-13 05:53:33 +03:00
parent 09ea64e941
commit 68a5e16a9e
45 changed files with 1011 additions and 1011 deletions

View File

@ -3,7 +3,7 @@ Class ClassicStyle extends KF2Style;
`include(Build.uci) `include(Build.uci)
`include(Logger.uci) `include(Logger.uci)
function RenderFramedWindow( KFGUI_FloatingWindow P ) function RenderFramedWindow( KFGUI_FloatingWindow P)
{ {
local int XS,YS,TitleHeight; local int XS,YS,TitleHeight;
local float XL, YL, FontScale; local float XL, YL, FontScale;
@ -12,7 +12,7 @@ function RenderFramedWindow( KFGUI_FloatingWindow P )
YS = Canvas.ClipY-Canvas.OrgY; YS = Canvas.ClipY-Canvas.OrgY;
TitleHeight = DefaultHeight; TitleHeight = DefaultHeight;
if( P.bWindowFocused ) if (P.bWindowFocused)
Canvas.SetDrawColor(105,105,105,255); Canvas.SetDrawColor(105,105,105,255);
else Canvas.SetDrawColor(85,85,85,P.FrameOpacity); 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); Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT],XS,YS-TitleHeight,0,0,128,128);
// Title. // Title.
if( P.WindowTitle!="" ) if (P.WindowTitle != "")
{ {
Canvas.Font = PickFont(FontScale); Canvas.Font = PickFont(FontScale);
Canvas.TextSize(P.WindowTitle,XL,YL,FontScale,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; local int XS,YS;
@ -43,7 +43,7 @@ function RenderWindow( KFGUI_Page P )
YS = Canvas.ClipY-Canvas.OrgY; YS = Canvas.ClipY-Canvas.OrgY;
// Frame itself. // Frame itself.
if( P.bWindowFocused ) if (P.bWindowFocused)
Canvas.SetDrawColor(105,105,105,255); Canvas.SetDrawColor(105,105,105,255);
else Canvas.SetDrawColor(85,85,85,P.FrameOpacity); 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); 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 int i;
local float X,Y,XS,YS,TX,TY,TS,DefFontHeight; local float X,Y,XS,YS,TX,TY,TS,DefFontHeight;
@ -60,9 +60,9 @@ function RenderToolTip( KFGUI_Tooltip TT )
// First compute textbox size. // First compute textbox size.
TY = DefaultHeight*TT.Lines.Length; TY = DefaultHeight*TT.Lines.Length;
for( i=0; i<TT.Lines.Length; ++i ) for (i=0; i < TT.Lines.Length; ++i)
{ {
if( TT.Lines[i]!="" ) if (TT.Lines[i] != "")
Canvas.TextSize(TT.Lines[i],XS,YS); Canvas.TextSize(TT.Lines[i],XS,YS);
TX = FMax(XS,TX); TX = FMax(XS,TX);
} }
@ -76,12 +76,12 @@ function RenderToolTip( KFGUI_Tooltip TT )
Y = TT.CompPos[1]+24.f; Y = TT.CompPos[1]+24.f;
// Then check if too close to window edge, then move it to another pivot. // Then check if too close to window edge, then move it to another pivot.
if( (X+TX)>TT.Owner.ScreenSize.X ) if ((X+TX) > TT.Owner.ScreenSize.X)
X = TT.Owner.ScreenSize.X-TX; 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; Y = TT.CompPos[1]-TY;
if( TT.CurrentAlpha<255 ) if (TT.CurrentAlpha < 255)
TT.CurrentAlpha = Min(TT.CurrentAlpha+25,255); TT.CurrentAlpha = Min(TT.CurrentAlpha+25,255);
// Reset clipping. // Reset clipping.
@ -102,7 +102,7 @@ function RenderToolTip( KFGUI_Tooltip TT )
Canvas.SetDrawColor(255,255,255,TT.CurrentAlpha); Canvas.SetDrawColor(255,255,255,TT.CurrentAlpha);
X+=TOOLTIP_BORDER; X+=TOOLTIP_BORDER;
Y+=TOOLTIP_BORDER; Y+=TOOLTIP_BORDER;
for( i=0; i<TT.Lines.Length; ++i ) for (i=0; i < TT.Lines.Length; ++i)
{ {
Canvas.SetPos(X,Y); Canvas.SetPos(X,Y);
Canvas.DrawText(TT.Lines[i],,TS,TS,TT.TextFontInfo); Canvas.DrawText(TT.Lines[i],,TS,TS,TT.TextFontInfo);
@ -110,33 +110,33 @@ function RenderToolTip( KFGUI_Tooltip TT )
} }
} }
function RenderScrollBar( KFGUI_ScrollBarBase S ) function RenderScrollBar( KFGUI_ScrollBarBase S)
{ {
local float A; local float A;
local byte i; local byte i;
if( S.bDisabled ) if (S.bDisabled)
Canvas.SetDrawColor(5, 5, 5, 0); Canvas.SetDrawColor(5, 5, 5, 0);
else if( S.bFocused || S.bGrabbedScroller ) else if (S.bFocused || S.bGrabbedScroller)
Canvas.SetDrawColor(15, 15, 15, 160); Canvas.SetDrawColor(15, 15, 15, 160);
else Canvas.SetDrawColor(15, 15, 15, 160); else Canvas.SetDrawColor(15, 15, 15, 160);
Canvas.SetPos(0.f, 0.f); Canvas.SetPos(0.f, 0.f);
Canvas.DrawTileStretched(BorderTextures[`BOX_INNERBORDER],S.CompPos[2],S.CompPos[3],0,0,128,128); Canvas.DrawTileStretched(BorderTextures[`BOX_INNERBORDER],S.CompPos[2],S.CompPos[3],0,0,128,128);
if( S.bDisabled ) if (S.bDisabled)
return; return;
if( S.bVertical ) if (S.bVertical)
i = 3; i = 3;
else i = 2; else i = 2;
S.SliderScale = FMax(S.PageStep * (S.CompPos[i] - 32.f) / (S.MaxRange + S.PageStep),S.CalcButtonScale); S.SliderScale = FMax(S.PageStep * (S.CompPos[i] - 32.f) / (S.MaxRange + S.PageStep),S.CalcButtonScale);
if( S.bGrabbedScroller ) if (S.bGrabbedScroller)
{ {
// Track mouse. // Track mouse.
if( S.bVertical ) if (S.bVertical)
A = S.Owner.MousePosition.Y - S.CompPos[1] - S.GrabbedOffset; A = S.Owner.MousePosition.Y - S.CompPos[1] - S.GrabbedOffset;
else A = S.Owner.MousePosition.X - S.CompPos[0] - S.GrabbedOffset; else A = S.Owner.MousePosition.X - S.CompPos[0] - S.GrabbedOffset;
@ -147,13 +147,13 @@ function RenderScrollBar( KFGUI_ScrollBarBase S )
A = float(S.CurrentScroll) / float(S.MaxRange); A = float(S.CurrentScroll) / float(S.MaxRange);
S.ButtonOffset = A*(S.CompPos[i]-S.SliderScale); S.ButtonOffset = A*(S.CompPos[i]-S.SliderScale);
if( S.bGrabbedScroller ) if (S.bGrabbedScroller)
Canvas.SetDrawColor(125,125,125,200); Canvas.SetDrawColor(125,125,125,200);
else if( S.bFocused ) else if (S.bFocused)
Canvas.SetDrawColor(200,200,200,200); Canvas.SetDrawColor(200,200,200,200);
else Canvas.SetDrawColor(255,255,255,200); else Canvas.SetDrawColor(255,255,255,200);
if( S.bVertical ) if (S.bVertical)
{ {
Canvas.SetPos(0.f, S.ButtonOffset); Canvas.SetPos(0.f, S.ButtonOffset);
Canvas.DrawTileStretched(ScrollTexture,S.CompPos[2],S.SliderScale,0,0,32,32); Canvas.DrawTileStretched(ScrollTexture,S.CompPos[2],S.SliderScale,0,0,32,32);
@ -165,17 +165,17 @@ function RenderScrollBar( KFGUI_ScrollBarBase S )
} }
} }
function RenderCheckbox( KFGUI_CheckBox C ) function RenderCheckbox( KFGUI_CheckBox C)
{ {
local Texture CheckMark; local Texture CheckMark;
DrawTileStretched(ItemBoxTextures[`ITEMBOX_DISABLED],0.f,0.f,C.CompPos[2],C.CompPos[3]); DrawTileStretched(ItemBoxTextures[`ITEMBOX_DISABLED],0.f,0.f,C.CompPos[2],C.CompPos[3]);
if( C.bChecked ) if (C.bChecked)
{ {
if( C.bDisabled ) if (C.bDisabled)
CheckMark = CheckBoxTextures[`CHECKMARK_DISABLED]; CheckMark = CheckBoxTextures[`CHECKMARK_DISABLED];
else if( C.bFocused ) else if (C.bFocused)
CheckMark = CheckBoxTextures[`CHECKMARK_HIGHLIGHTED]; CheckMark = CheckBoxTextures[`CHECKMARK_HIGHLIGHTED];
else CheckMark = CheckBoxTextures[`CHECKMARK_NORMAL]; else CheckMark = CheckBoxTextures[`CHECKMARK_NORMAL];
@ -185,13 +185,13 @@ function RenderCheckbox( KFGUI_CheckBox C )
} }
} }
function RenderComboBox( KFGUI_ComboBox C ) function RenderComboBox( KFGUI_ComboBox C)
{ {
if( C.bDisabled ) if (C.bDisabled)
Canvas.SetDrawColor(64,64,64,255); Canvas.SetDrawColor(64,64,64,255);
else if( C.bPressedDown ) else if (C.bPressedDown)
Canvas.SetDrawColor(220,220,220,255); Canvas.SetDrawColor(220,220,220,255);
else if( C.bFocused ) else if (C.bFocused)
Canvas.SetDrawColor(190,190,190,255); Canvas.SetDrawColor(190,190,190,255);
Canvas.SetPos(0.f,0.f); Canvas.SetPos(0.f,0.f);
@ -199,10 +199,10 @@ function RenderComboBox( KFGUI_ComboBox C )
DrawArrowBox(3, C.CompPos[2]-32, 0.5f, 32, 32); DrawArrowBox(3, C.CompPos[2]-32, 0.5f, 32, 32);
if( C.SelectedIndex<C.Values.Length && C.Values[C.SelectedIndex]!="" ) if (C.SelectedIndex < C.Values.Length && C.Values[C.SelectedIndex] != "")
{ {
Canvas.SetPos(C.BorderSize,(C.CompPos[3]-C.TextHeight)*0.5); Canvas.SetPos(C.BorderSize,(C.CompPos[3]-C.TextHeight)*0.5);
if( C.bDisabled ) if (C.bDisabled)
Canvas.DrawColor = C.TextColor*0.5f; Canvas.DrawColor = C.TextColor*0.5f;
else Canvas.DrawColor = C.TextColor; else Canvas.DrawColor = C.TextColor;
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX-C.BorderSize,Canvas.ClipY); Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX-C.BorderSize,Canvas.ClipY);
@ -211,7 +211,7 @@ function RenderComboBox( KFGUI_ComboBox C )
} }
} }
function RenderComboList( KFGUI_ComboSelector C ) function RenderComboList( KFGUI_ComboSelector C)
{ {
local float X,Y,YL,YP,Edge; local float X,Y,YL,YP,Edge;
local int i; local int i;
@ -226,7 +226,7 @@ function RenderComboList( KFGUI_ComboSelector C )
X = C.Owner.MousePosition.X - Canvas.OrgX; X = C.Owner.MousePosition.X - Canvas.OrgX;
Y = C.Owner.MousePosition.Y - Canvas.OrgY; Y = C.Owner.MousePosition.Y - Canvas.OrgY;
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]); bCheckMouse = (X > 0.f && X < C.CompPos[2] && Y > 0.f && Y < C.CompPos[3]);
Canvas.Font = C.Combo.TextFont; Canvas.Font = C.Combo.TextFont;
YL = C.Combo.TextHeight; YL = C.Combo.TextHeight;
@ -235,9 +235,9 @@ function RenderComboList( KFGUI_ComboSelector C )
C.CurrentRow = -1; C.CurrentRow = -1;
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY); Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
for( i=0; i<C.Combo.Values.Length; ++i ) for (i=0; i < C.Combo.Values.Length; ++i)
{ {
if( bCheckMouse && Y>=YP && Y<=(YP+YL) ) if (bCheckMouse && Y >= YP && Y <= (YP+YL))
{ {
bCheckMouse = false; bCheckMouse = false;
C.CurrentRow = i; C.CurrentRow = i;
@ -247,7 +247,7 @@ function RenderComboList( KFGUI_ComboSelector C )
} }
Canvas.SetPos(Edge,YP); Canvas.SetPos(Edge,YP);
if( i==C.Combo.SelectedIndex ) if (i == C.Combo.SelectedIndex)
Canvas.DrawColor = C.Combo.SelectedTextColor; Canvas.DrawColor = C.Combo.SelectedTextColor;
else Canvas.DrawColor = C.Combo.TextColor; else Canvas.DrawColor = C.Combo.TextColor;
@ -256,14 +256,14 @@ function RenderComboList( KFGUI_ComboSelector C )
YP+=YL; YP+=YL;
} }
Canvas.PopMaskRegion(); Canvas.PopMaskRegion();
if( C.OldRow!=C.CurrentRow ) if (C.OldRow != C.CurrentRow)
{ {
C.OldRow = C.CurrentRow; C.OldRow = C.CurrentRow;
C.PlayMenuSound(MN_DropdownChange); C.PlayMenuSound(MN_DropdownChange);
} }
} }
function RenderRightClickMenu( KFGUI_RightClickMenu C ) function RenderRightClickMenu( KFGUI_RightClickMenu C)
{ {
local float X,Y,XL,YL,YP,Edge,TextScale; local float X,Y,XL,YL,YP,Edge,TextScale;
local int i; local int i;
@ -278,7 +278,7 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
X = C.Owner.MousePosition.X - Canvas.OrgX; X = C.Owner.MousePosition.X - Canvas.OrgX;
Y = C.Owner.MousePosition.Y - Canvas.OrgY; Y = C.Owner.MousePosition.Y - Canvas.OrgY;
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]); bCheckMouse = (X > 0.f && X < C.CompPos[2] && Y > 0.f && Y < C.CompPos[3]);
PickFont(TextScale); PickFont(TextScale);
@ -286,15 +286,15 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
C.CurrentRow = -1; C.CurrentRow = -1;
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY); Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
for( i=0; i<C.ItemRows.Length; ++i ) for (i=0; i < C.ItemRows.Length; ++i)
{ {
if( C.ItemRows[i].bSplitter ) if (C.ItemRows[i].bSplitter)
S = "-------"; S = "-------";
else S = C.ItemRows[i].Text; else S = C.ItemRows[i].Text;
Canvas.TextSize(S,XL,YL,TextScale,TextScale); Canvas.TextSize(S,XL,YL,TextScale,TextScale);
if( bCheckMouse && Y>=YP && Y<=(YP+YL) ) if (bCheckMouse && Y >= YP && Y <= (YP+YL))
{ {
bCheckMouse = false; bCheckMouse = false;
C.CurrentRow = i; C.CurrentRow = i;
@ -304,11 +304,11 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
} }
Canvas.SetPos(Edge*6,YP); Canvas.SetPos(Edge*6,YP);
if( C.ItemRows[i].bSplitter ) if (C.ItemRows[i].bSplitter)
Canvas.SetDrawColor(255,255,255,255); Canvas.SetDrawColor(255,255,255,255);
else else
{ {
if( C.ItemRows[i].bDisabled ) if (C.ItemRows[i].bDisabled)
Canvas.SetDrawColor(148,148,148,255); Canvas.SetDrawColor(148,148,148,255);
else Canvas.SetDrawColor(248,248,248,255); else Canvas.SetDrawColor(248,248,248,255);
} }
@ -317,41 +317,41 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
YP+=YL; YP+=YL;
} }
Canvas.PopMaskRegion(); Canvas.PopMaskRegion();
if( C.OldRow!=C.CurrentRow ) if (C.OldRow != C.CurrentRow)
{ {
C.OldRow = C.CurrentRow; C.OldRow = C.CurrentRow;
C.PlayMenuSound(MN_FocusHover); C.PlayMenuSound(MN_FocusHover);
} }
} }
function RenderButton( KFGUI_Button B ) function RenderButton( KFGUI_Button B)
{ {
local float XL,YL,TS,AX,AY,GamepadTexSize; local float XL,YL,TS,AX,AY,GamepadTexSize;
local Texture2D Mat, ButtonTex; local Texture2D Mat, ButtonTex;
local bool bDrawOverride; local bool bDrawOverride;
bDrawOverride = B.DrawOverride(Canvas, B); bDrawOverride = B.DrawOverride(Canvas, B);
if( !bDrawOverride ) if (!bDrawOverride)
{ {
if( B.bDisabled ) if (B.bDisabled)
Mat = ButtonTextures[`BUTTON_DISABLED]; Mat = ButtonTextures[`BUTTON_DISABLED];
else if( B.bPressedDown ) else if (B.bPressedDown)
Mat = ButtonTextures[`BUTTON_PRESSED]; Mat = ButtonTextures[`BUTTON_PRESSED];
else if( B.bFocused || B.bIsHighlighted ) else if (B.bFocused || B.bIsHighlighted)
Mat = ButtonTextures[`BUTTON_HIGHLIGHTED]; Mat = ButtonTextures[`BUTTON_HIGHLIGHTED];
else Mat = ButtonTextures[`BUTTON_NORMAL]; else Mat = ButtonTextures[`BUTTON_NORMAL];
Canvas.SetPos(0.f,0.f); Canvas.SetPos(0.f,0.f);
Canvas.DrawTileStretched(Mat,B.CompPos[2],B.CompPos[3],0,0,32,32); 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.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); 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; Canvas.Font = MainFont;
@ -360,28 +360,28 @@ function RenderButton( KFGUI_Button B )
TS = GetFontScaler(); TS = GetFontScaler();
TS *= B.FontScale; TS *= B.FontScale;
while( true ) while( true)
{ {
Canvas.TextSize(B.ButtonText,XL,YL,TS,TS); 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; break;
TS -= 0.001; TS -= 0.001;
} }
Canvas.SetPos((B.CompPos[2]-XL)*0.5,(B.CompPos[3]-YL)*0.5); 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; Canvas.DrawColor = B.TextColor*0.5f;
else Canvas.DrawColor = B.TextColor; else Canvas.DrawColor = B.TextColor;
Canvas.DrawText(B.ButtonText,,TS,TS,B.TextFontInfo); Canvas.DrawText(B.ButtonText,,TS,TS,B.TextFontInfo);
if( B.GetUsingGamepad() ) if (B.GetUsingGamepad())
{ {
ButtonTex = Texture2D(DynamicLoadObject("UI_Controller."$B.GamepadButtonName$"_Asset", class'Texture2D')); ButtonTex = Texture2D(DynamicLoadObject("UI_Controller."$B.GamepadButtonName$"_Asset", class'Texture2D'));
if( ButtonTex != None ) if (ButtonTex != None)
{ {
B.GetRealtivePos(AX, AY); B.GetRealtivePos(AX, AY);
while( (Canvas.CurX-(GamepadTexSize*1.25))<AX ) while( (Canvas.CurX-(GamepadTexSize*1.25)) < AX)
{ {
GamepadTexSize *= 0.95; GamepadTexSize *= 0.95;
} }

View File

@ -5,4 +5,4 @@ class CustomRanks extends Object
`include(Build.uci) `include(Build.uci)
`include(Logger.uci) `include(Logger.uci)
var config array<RankInfo> Rank; var config array < RankInfo> Rank;

View File

@ -5,7 +5,7 @@ Class GUIStyleBase extends Object
`include(Logger.uci) `include(Logger.uci)
var Texture2D ItemTex; var Texture2D ItemTex;
var array<Texture2D> 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 Texture2D ScrollTexture,FavoriteIcon,BankNoteIcon;
var SoundCue MenuDown, MenuDrag, MenuEdit, MenuFade, MenuClick, MenuHover, MenuUp; var SoundCue MenuDown, MenuDrag, MenuEdit, MenuFade, MenuClick, MenuHover, MenuUp;
@ -24,21 +24,21 @@ struct FColorInfo
var name Code; var name Code;
var Color Color; var Color Color;
}; };
var array<FColorInfo> ColorCodes; var array < FColorInfo> ColorCodes;
struct FTexturePreCache struct FTexturePreCache
{ {
var string Path; var string Path;
var Texture2D Tex; var Texture2D Tex;
}; };
var array<FTexturePreCache> PrecachedTextures; var array < FTexturePreCache> PrecachedTextures;
function InitStyle() function InitStyle()
{ {
local FColorInfo ColorInfo; local FColorInfo ColorInfo;
ItemTex=Texture2D(DynamicLoadObject("UI_LevelChevrons_TEX.UI_LevelChevron_Icon_02",class'Texture2D')); ItemTex=Texture2D(DynamicLoadObject("UI_LevelChevrons_TEX.UI_LevelChevron_Icon_02",class'Texture2D'));
if( ItemTex==None ) if (ItemTex == None)
ItemTex=Texture2D'EngineMaterials.DefaultWhiteGrid'; ItemTex=Texture2D'EngineMaterials.DefaultWhiteGrid';
NumberFont = Font(DynamicLoadObject("UI_Canvas_Fonts.Font_General", class'Font')); 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 RenderComboBox( KFGUI_ComboBox C );
function RenderComboList( KFGUI_ComboSelector 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(); Scaler = GetFontScaler();
if( bNumbersOnly ) if (bNumbersOnly)
return NumberFont; return NumberFont;
else if( bInfinite ) else if (bInfinite)
return InfiniteFont; return InfiniteFont;
return MainFont; return MainFont;
} }
function PickDefaultFontSize( float YRes ) function PickDefaultFontSize( float YRes)
{ {
local int XL,YL; local int XL,YL;
local string S; local string S;
@ -164,7 +164,7 @@ function PickDefaultFontSize( float YRes )
DefaultHeight=float(YL)*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 ); 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); return FClamp((HUDOwner.SizeY / 1080.f) * Scaler, Min, Max);
} }
final function DrawText( coerce string S ) final function DrawText( coerce string S)
{ {
local float Scale; local float Scale;
Canvas.Font=PickFont(Scale); Canvas.Font=PickFont(Scale);
Canvas.DrawText(S,,Scale,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; local float XL,YL;
Canvas.TextSize(S,XL,YL); Canvas.TextSize(S,XL,YL);
if( bVertical ) if (bVertical)
Canvas.SetPos(X,Y-(YL*Scale*0.5)); Canvas.SetPos(X,Y-(YL*Scale*0.5));
else Canvas.SetPos(X-(XL*Scale*0.5),Y); else Canvas.SetPos(X-(XL*Scale*0.5),Y);
if( bUseOutline ) if (bUseOutline)
DrawTextShadow(S, Canvas.CurX, Canvas.CurY, 1, Scale); DrawTextShadow(S, Canvas.CurX, Canvas.CurY, 1, Scale);
else Canvas.DrawText(S,,Scale,Scale); else Canvas.DrawText(S,,Scale,Scale);
} }
final function string StripColorTags( coerce string S ) final function string StripColorTags( coerce string S)
{ {
local int Pos; local int Pos;
Pos = InStr(S, "\\c"); Pos = InStr(S, "\\c");
while( Pos != INDEX_NONE ) while( Pos != INDEX_NONE)
{ {
S = Left(S,Pos) $ Mid(S,Pos+3); S = Left(S,Pos) $ Mid(S,Pos+3);
Pos = InStr(S, "\\c"); Pos = InStr(S, "\\c");
@ -205,17 +205,17 @@ final function string StripColorTags( coerce string S )
return 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 float XL,YL;
local int i, Index; local int i, Index;
local array<string> SArray; local array < string> SArray;
local string T, PrevT; local string T, PrevT;
local Color TextColor; 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); DrawTextShadow(S, X, Y, 1, Scale);
else else
{ {
@ -228,11 +228,11 @@ final function DrawColoredText( coerce string S, float X, float Y, optional floa
SArray = SplitString(S, "\\c"); SArray = SplitString(S, "\\c");
PrevT = Left(S,InStr(S, "\\c")); PrevT = Left(S,InStr(S, "\\c"));
if( Len(PrevT) > 0 ) if (Len(PrevT) > 0)
{ {
Canvas.TextSize(PrevT,XL,YL,Scale,Scale); Canvas.TextSize(PrevT,XL,YL,Scale,Scale);
if( bUseOutline ) if (bUseOutline)
DrawTextShadow(PrevT, X, Y, 1, Scale); DrawTextShadow(PrevT, X, Y, 1, Scale);
else else
{ {
@ -241,13 +241,13 @@ final function DrawColoredText( coerce string S, float X, float Y, optional floa
} }
} }
for( i=0; i<SArray.Length; i++ ) for (i=0; i < SArray.Length; i++)
{ {
T = SArray[i]; T = SArray[i];
if( i>0 || Left(S, 2)~="\\c" ) if (i > 0 || Left(S, 2)~="\\c")
{ {
Index = ColorCodes.Find('Code', name(Left(T, 1))); Index = ColorCodes.Find('Code', name(Left(T, 1)));
if( Index != INDEX_NONE ) if (Index != INDEX_NONE)
TextColor = ColorCodes[Index].Color; TextColor = ColorCodes[Index].Color;
else TextColor = class'HUD'.default.WhiteColor; 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.DrawColor = TextColor;
Canvas.TextSize(T,XL,YL,Scale,Scale); Canvas.TextSize(T,XL,YL,Scale,Scale);
if( bUseOutline ) if (bUseOutline)
DrawTextShadow(T, X, Y, 1, Scale); DrawTextShadow(T, X, Y, 1, Scale);
else 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; local Color OldDrawColor;
@ -291,7 +291,7 @@ final function DrawTextBlurry( coerce string S, float X, float Y, optional float
Canvas.SetPos(X, Y); Canvas.SetPos(X, Y);
Canvas.DrawText(S,,Scale,Scale); 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 Color OldDrawColor;
local int XS, YS, Steps; local int XS, YS, Steps;
@ -301,7 +301,7 @@ final function DrawTextOutline( coerce string S, float X, float Y, int Size, Col
Size += 1; Size += 1;
Steps = (Size * 2) / 3; Steps = (Size * 2) / 3;
if( Steps < 1 ) if (Steps < 1 )
{ {
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.SetPos(X, Y);
Canvas.DrawText(S,, Scale, Scale, FRI); 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; local Color OldDrawColor;
@ -334,7 +334,7 @@ final function DrawTextShadow( coerce string S, float X, float Y, float ShadowSi
Canvas.DrawColor = OldDrawColor; Canvas.DrawColor = OldDrawColor;
Canvas.DrawText(S,, Scale, Scale); 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 Texture2D Mat;
local string D; local string D;
@ -345,15 +345,15 @@ final function DrawTexturedString( coerce string S, float X, float Y, optional f
OrgC = Canvas.DrawColor; OrgC = Canvas.DrawColor;
Mat = FindNextTexture(S); Mat = FindNextTexture(S);
while( Mat != None ) while( Mat != None)
{ {
i = InStr(S,"<TEXTURE"); i = InStr(S," < TEXTURE");
j = InStr(S,">"); j = InStr(S," > ");
D = Left(S,i); D = Left(S,i);
S = Mid(S,j+2); S = Mid(S,j+2);
if( !bOnlyTexture ) if (!bOnlyTexture)
{ {
Canvas.TextSize(StripColorTags(D),XL,YL,TextScaler,TextScaler); Canvas.TextSize(StripColorTags(D),XL,YL,TextScaler,TextScaler);
DrawColoredText(D,X,Y,TextScaler,bUseOutline); DrawColoredText(D,X,Y,TextScaler,bUseOutline);
@ -384,20 +384,20 @@ final function Texture2D FindNextTexture(out string S)
local FTexturePreCache Cache; local FTexturePreCache Cache;
Path = S; Path = S;
i = InStr(Path,"<Icon>"); i = InStr(Path," < Icon > ");
if( i == INDEX_NONE ) if (i == INDEX_NONE)
return None; return None;
j = InStr(Path,"</Icon>"); j = InStr(Path," < /Icon > ");
S = Left(Path,i)$"<TEXTURE>"$Mid(Path, j+6); S = Left(Path,i)$" < TEXTURE > "$Mid(Path, j+6);
Path = Mid(Path, i+6, j-(i+6)); Path = Mid(Path, i+6, j-(i+6));
i = PrecachedTextures.Find('Path', Path); i = PrecachedTextures.Find('Path', Path);
if( i != INDEX_NONE ) if (i != INDEX_NONE)
return PrecachedTextures[i].Tex; return PrecachedTextures[i].Tex;
Tex = Texture2D(FindObject(Path, class'Texture2D')); Tex = Texture2D(FindObject(Path, class'Texture2D'));
if( Tex != None ) if (Tex != None)
{ {
Cache.Path = Path; Cache.Path = Path;
Cache.Tex = Tex; Cache.Tex = Tex;
@ -416,14 +416,14 @@ final function string StripTextureFromString(string S, optional bool bNoStringAd
{ {
local int i, j; local int i, j;
while( true ) while( true)
{ {
i = InStr(S,"<Icon>"); i = InStr(S," < Icon > ");
if( i == INDEX_NONE ) if (i == INDEX_NONE)
break; break;
j = InStr(S,"</Icon>"); j = InStr(S," < /Icon > ");
S = Left(S,i)$(bNoStringAdd ? "" : "W")$Mid(S, j+Len("</Icon>")); S = Left(S,i)$(bNoStringAdd ? "" : "W")$Mid(S, j+Len(" < /Icon > "));
} }
return StripColorTags(S); return StripColorTags(S);
@ -433,7 +433,7 @@ final function string GetTimeString(int Seconds)
local int Minutes, Hours; local int Minutes, Hours;
local string Time; local string Time;
if( Seconds > 3600 ) if (Seconds > 3600)
{ {
Hours = Seconds / 3600; Hours = Seconds / 3600;
Seconds -= Hours * 3600; Seconds -= Hours * 3600;
@ -443,11 +443,11 @@ final function string GetTimeString(int Seconds)
Minutes = Seconds / 60; Minutes = Seconds / 60;
Seconds -= Minutes * 60; Seconds -= Minutes * 60;
if( Minutes >= 10 ) if (Minutes >= 10)
Time = Time $ Minutes $ ":"; Time = Time $ Minutes $ ":";
else Time = Time $ "0" $ Minutes $ ":"; else Time = Time $ "0" $ Minutes $ ":";
if( Seconds >= 10 ) if (Seconds >= 10)
Time = Time $ Seconds; Time = Time $ Seconds;
else Time = Time $ "0" $ 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. final function DrawCornerTexNU( int SizeX, int SizeY, byte Dir ) // Draw non-uniform corner.
{ {
switch( Dir ) switch( Dir)
{ {
case 0: // Up-left case 0: // Up-left
Canvas.DrawTile(ItemTex,SizeX,SizeY,77,15,-66,58); 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); 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 case 0: // Up-left
Canvas.DrawTile(ItemTex,Size,Size,77,15,-66,58); 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); 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); 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. Edge=Min(FMin(Edge,(Width)*0.5),Height);// Verify size.
else else
Edge=Min(FMin(Edge,(Width)*0.5),(Height)*0.5);// Verify size. 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) 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); Canvas.PreOptimizeDrawTiles(4, ItemTex);
@ -680,7 +680,7 @@ final function DrawBoxHollow( float X, float Y, float Width, float Height, float
DrawWhiteBox(Thickness, Height); 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.DrawColor = BoxColor;
Canvas.SetPos(X + Thickness, Y + Thickness); Canvas.SetPos(X + Thickness, Y + Thickness);
@ -694,39 +694,39 @@ final function DrawBoxCorners(float BorderSize, float X, float Y, float W, float
{ {
// Top left // Top left
Canvas.SetPos(X,Y); Canvas.SetPos(X,Y);
if( TopLeft ) if (TopLeft)
DrawCornerTex(BorderSize,0); DrawCornerTex(BorderSize,0);
else DrawWhiteBox(BorderSize, BorderSize); else DrawWhiteBox(BorderSize, BorderSize);
// Top right // Top right
Canvas.SetPos(X+W-BorderSize,Y); Canvas.SetPos(X+W-BorderSize,Y);
if( TopRight ) if (TopRight)
DrawCornerTex(BorderSize,1); DrawCornerTex(BorderSize,1);
else DrawWhiteBox(BorderSize, BorderSize); else DrawWhiteBox(BorderSize, BorderSize);
// Bottom left // Bottom left
Canvas.SetPos(X,Y+H-BorderSize); Canvas.SetPos(X,Y+H-BorderSize);
if( BottomLeft ) if (BottomLeft)
DrawCornerTex(BorderSize,2); DrawCornerTex(BorderSize,2);
else DrawWhiteBox(BorderSize, BorderSize); else DrawWhiteBox(BorderSize, BorderSize);
// Bottom right // Bottom right
Canvas.SetPos(X+W-BorderSize,Y+H-BorderSize); Canvas.SetPos(X+W-BorderSize,Y+H-BorderSize);
if( BottomRight ) if (BottomRight)
DrawCornerTex(BorderSize,3); DrawCornerTex(BorderSize,3);
else DrawWhiteBox(BorderSize, BorderSize); 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); 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; Canvas.DrawColor = BoxColor;
if( BorderSize <= 0 ) if (BorderSize <= 0)
{ {
Canvas.SetPos(X, Y); Canvas.SetPos(X, Y);
DrawWhiteBox(W, H); 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); 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); 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); 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); 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.DrawColor = BoxColor;
Canvas.SetPos(X + BorderSize, Y + BorderSize); 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); 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.DrawColor = BoxColor;
Canvas.SetPos(X + BorderSize, Y + BorderSize); 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); 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; local Texture2D DirectionMat;
switch( Direction ) switch( Direction)
{ {
case 0: case 0:
DirectionMat=ArrowTextures[`ARROW_UP]; 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); 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 float mW,mH,MidX,MidY,SmallTileW,SmallTileH,fX,fY;
local int OptimizeTiles; local int OptimizeTiles;
if( Tex==None ) Tex = Texture2D'EngineMaterials.DefaultDiffuse'; if (Tex == None ) Tex = Texture2D'EngineMaterials.DefaultDiffuse';
// Get the size of the image // Get the size of the image
mW = Tex.GetSurfaceWidth(); mW = Tex.GetSurfaceWidth();
@ -844,22 +844,22 @@ final function DrawTileStretched( Texture Tex, float X, float Y, float XS, float
// Optimized // Optimized
OptimizeTiles = 4; OptimizeTiles = 4;
if( mW<XS ) if (mW < XS)
OptimizeTiles += 2; OptimizeTiles += 2;
if( mH<YS ) if (mH < YS)
OptimizeTiles += 2; OptimizeTiles += 2;
if( (mH<YS) && (mW<XS) ) if ((mH < YS) && (mW < XS))
OptimizeTiles += 1; OptimizeTiles += 1;
Canvas.PreOptimizeDrawTiles(OptimizeTiles, Tex); Canvas.PreOptimizeDrawTiles(OptimizeTiles, Tex);
// Draw the spans first // Draw the spans first
// Top and Bottom // Top and Bottom
if (mW<XS) if (mW < XS)
{ {
fX = MidX; fX = MidX;
if (mH>YS) if (mH > YS)
fY = YS/2; fY = YS/2;
else else
fY = MidY; fY = MidY;
@ -873,7 +873,7 @@ final function DrawTileStretched( Texture Tex, float X, float Y, float XS, float
fX = XS / 2; fX = XS / 2;
// Left and Right // Left and Right
if (mH<YS) if (mH < YS)
{ {
fY = MidY; fY = MidY;
@ -886,7 +886,7 @@ final function DrawTileStretched( Texture Tex, float X, float Y, float XS, float
fY = YS / 2; fY = YS / 2;
// Center // Center
if ( (mH<YS) && (mW<XS) ) if ((mH < YS) && (mW < XS))
{ {
Canvas.SetPos(X+fX,Y+fY); Canvas.SetPos(X+fX,Y+fY);
Canvas.DrawTile(Tex,SmallTileW,SmallTileH,fX,fY,1,1); Canvas.DrawTile(Tex,SmallTileW,SmallTileH,fX,fY,1,1);
@ -903,7 +903,7 @@ final function DrawTileStretched( Texture Tex, float X, float Y, float XS, float
Canvas.DrawTile(Tex,fX,fY,mW-fX,mH-fY,fX,fY); Canvas.DrawTile(Tex,fX,fY,mW-fX,mH-fY,fX,fY);
} }
final function DrawTextJustified( byte Justification, float X1, float Y1, float X2, float Y2, coerce string S, optional float XS, optional float YS ) final function DrawTextJustified( byte Justification, float X1, float Y1, float X2, float Y2, coerce string S, optional float XS, optional float YS)
{ {
local float XL, YL; local float XL, YL;
local float CurY, CurX; local float CurY, CurX;
@ -912,17 +912,17 @@ final function DrawTextJustified( byte Justification, float X1, float Y1, float
CurY = ((Y2-Y1) / 2) - (YL/2); CurY = ((Y2-Y1) / 2) - (YL/2);
if( Justification == 0 ) if (Justification == 0)
{ {
CurX = 0; CurX = 0;
} }
else if( Justification == 1 ) else if (Justification == 1)
{ {
if( XL > X2-X1 ) if (XL > X2-X1)
CurX = 0; CurX = 0;
else CurX = ((X2-X1) / 2) - (XL/2); else CurX = ((X2-X1) / 2) - (XL/2);
} }
else if( Justification == 2 ) else if (Justification == 2)
{ {
CurX = (X2-X1) - XL; CurX = (X2-X1) - XL;
} }
@ -931,7 +931,7 @@ final function DrawTextJustified( byte Justification, float X1, float Y1, float
Canvas.DrawText(S,,XS, YS); 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); return FClamp((Current - Start) / (End - Start), 0.f, 1.f);
} }

View File

@ -4,7 +4,7 @@ Class KF2GUIController extends Info
`include(Build.uci) `include(Build.uci)
`include(Logger.uci) `include(Logger.uci)
var() class<GUIStyleBase> DefaultStyle; var() class < GUIStyleBase> DefaultStyle;
var PlayerController PlayerOwner; var PlayerController PlayerOwner;
var ScoreboardExtHUD HUDOwner; var ScoreboardExtHUD HUDOwner;
@ -12,13 +12,13 @@ var transient KF2GUIInput CustomInput;
var transient PlayerInput BackupInput; var transient PlayerInput BackupInput;
var transient GameViewportClient ClientViewport; var transient GameViewportClient ClientViewport;
var delegate<Interaction.OnReceivedNativeInputKey> OldOnReceivedNativeInputKey; var delegate < Interaction.OnReceivedNativeInputKey> OldOnReceivedNativeInputKey;
var delegate<Interaction.OnReceivedNativeInputAxis> OldOnReceivedNativeInputAxis; var delegate < Interaction.OnReceivedNativeInputAxis> OldOnReceivedNativeInputAxis;
var delegate<Interaction.OnReceivedNativeInputChar> OldOnReceivedNativeInputChar; var delegate < Interaction.OnReceivedNativeInputChar> OldOnReceivedNativeInputChar;
var delegate<GameViewportClient.HandleInputAxis> OldHandleInputAxis; var delegate < GameViewportClient.HandleInputAxis> OldHandleInputAxis;
var array<KFGUI_Page> ActiveMenus,PersistentMenus; var array < KFGUI_Page> ActiveMenus,PersistentMenus;
var transient KFGUI_Base MouseFocus,InputFocus,KeyboardFocus; var transient KFGUI_Base MouseFocus,InputFocus,KeyboardFocus;
var IntPoint MousePosition,ScreenSize,OldMousePos,LastMousePos,LastClickPos[2]; var IntPoint MousePosition,ScreenSize,OldMousePos,LastMousePos,LastClickPos[2];
var transient float MousePauseTime,MenuTime,LastClickTimes[2]; var transient float MousePauseTime,MenuTime,LastClickTimes[2];
@ -27,7 +27,7 @@ var transient GUIStyleBase CurrentStyle;
var transient Console OrgConsole; var transient Console OrgConsole;
var transient KFGUIConsoleHack HackConsole; var transient KFGUIConsoleHack HackConsole;
var array<Texture2D> CursorTextures; var array < Texture2D> CursorTextures;
var Color CursorColor; var Color CursorColor;
var int CurrentCursorIndex, CursorSize; 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; 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; local KF2GUIController G;
if( PC.Player==None ) if (PC.Player == None)
{ {
return None; return None;
} }
foreach PC.ChildActors(class'ScoreboardExt.KF2GUIController',G) foreach PC.ChildActors(class'ScoreboardExt.KF2GUIController',G)
{ {
if( !G.bIsInvalid ) if (!G.bIsInvalid)
{ {
break; break;
} }
} }
if( G==None ) if (G == None)
{ {
G = PC.Spawn(class'ScoreboardExt.KF2GUIController',PC); G = PC.Spawn(class'ScoreboardExt.KF2GUIController',PC);
} }
@ -81,7 +81,7 @@ simulated function PostBeginPlay()
simulated function SetupCursorFlash() simulated function SetupCursorFlash()
{ {
if( CursorFlash == 255 ) if (CursorFlash == 255)
CursorFlash = 0; CursorFlash = 0;
else CursorFlash = 255; else CursorFlash = 255;
} }
@ -109,24 +109,24 @@ simulated function Tick(float DT)
DT /= WorldInfo.TimeDilation; DT /= WorldInfo.TimeDilation;
CursorFade += 255 * DT * CursorStep; CursorFade += 255 * DT * CursorStep;
if( CursorFade<=0 ) if (CursorFade <= 0)
{ {
CursorFade = 0; CursorFade = 0;
CursorStep = 1; CursorStep = 1;
} }
else if( CursorFade>=255 ) else if (CursorFade >= 255)
{ {
CursorFade = 255; CursorFade = 255;
CursorStep = -1; CursorStep = -1;
} }
FastCursorFade += 8192 * DT * FastCursorStep; FastCursorFade += 8192 * DT * FastCursorStep;
if( FastCursorFade<=0 ) if (FastCursorFade <= 0)
{ {
FastCursorFade = 0; FastCursorFade = 0;
FastCursorStep = 1; FastCursorStep = 1;
} }
else if( FastCursorFade>=255 ) else if (FastCursorFade >= 255)
{ {
FastCursorFade = 255; FastCursorFade = 255;
FastCursorStep = -1; FastCursorStep = -1;
@ -135,27 +135,27 @@ simulated function Tick(float DT)
simulated function Destroyed() simulated function Destroyed()
{ {
if( PlayerOwner!=None ) if (PlayerOwner != None)
SetMenuState(false); SetMenuState(false);
} }
simulated function HandleDrawMenu() simulated function HandleDrawMenu()
{ {
if( HackConsole==None ) if (HackConsole == None)
{ {
HackConsole = new(ClientViewport)class'ScoreboardExt.KFGUIConsoleHack'; HackConsole = new(ClientViewport)class'ScoreboardExt.KFGUIConsoleHack';
HackConsole.OutputObject = Self; HackConsole.OutputObject = Self;
} }
if( HackConsole!=ClientViewport.ViewportConsole ) if (HackConsole != ClientViewport.ViewportConsole)
{ {
OrgConsole = ClientViewport.ViewportConsole; OrgConsole = ClientViewport.ViewportConsole;
ClientViewport.ViewportConsole = HackConsole; ClientViewport.ViewportConsole = HackConsole;
// Make sure nothing overrides these settings while menu is being open. // 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 int i;
local float OrgX,OrgY,ClipX,ClipY; local float OrgX,OrgY,ClipX,ClipY;
@ -172,11 +172,11 @@ simulated function RenderMenu( Canvas C )
CurrentStyle.Canvas = C; CurrentStyle.Canvas = C;
CurrentStyle.PickDefaultFontSize(C.SizeY); CurrentStyle.PickDefaultFontSize(C.SizeY);
if( !KFPlayerController(PlayerOwner).MyGFxManager.bMenusActive ) if (!KFPlayerController(PlayerOwner).MyGFxManager.bMenusActive)
{ {
HUDOwner.Canvas = C; 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[0] = 0.f;
HUDOwner.HUDWidgets[i].InputPos[1] = 0.f; HUDOwner.HUDWidgets[i].InputPos[1] = 0.f;
@ -190,11 +190,11 @@ simulated function RenderMenu( Canvas C )
C.SetClip(ClipX,ClipY); 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[0] = 0.f;
ActiveMenus[i].InputPos[1] = 0.f; ActiveMenus[i].InputPos[1] = 0.f;
ActiveMenus[i].InputPos[2] = ScreenSize.X; ActiveMenus[i].InputPos[2] = ScreenSize.X;
@ -202,7 +202,7 @@ simulated function RenderMenu( Canvas C )
ActiveMenus[i].Canvas = C; ActiveMenus[i].Canvas = C;
ActiveMenus[i].PreDraw(); ActiveMenus[i].PreDraw();
} }
if( InputFocus!=None && InputFocus.bFocusedPostDrawItem ) if (InputFocus != None && InputFocus.bFocusedPostDrawItem)
{ {
InputFocus.InputPos[0] = 0.f; InputFocus.InputPos[0] = 0.f;
InputFocus.InputPos[1] = 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.PostRender_Console(C);
OrgConsole = None; OrgConsole = None;
} }
@ -236,28 +236,28 @@ simulated final function InventoryChanged(optional KFWeapon Wep, optional bool b
{ {
local int i; local int i;
for( i=(ActiveMenus.Length-1); i>=0; --i ) for (i=(ActiveMenus.Length-1); i >= 0; --i)
{ {
ActiveMenus[i].InventoryChanged(Wep,bRemove); 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(); NotifyLevelChange();
bActive = false; bActive = false;
} }
if( bIsInMenuState==bActive ) if (bIsInMenuState == bActive)
return; return;
bIsInMenuState = bActive; bIsInMenuState = bActive;
bHideCursor = !bActive; bHideCursor = !bActive;
if( bActive ) if (bActive)
{ {
if( CustomInput==None ) if (CustomInput == None)
{ {
CustomInput = new (KFPlayerController(PlayerOwner)) class'ScoreboardExt.KF2GUIInput'; CustomInput = new (KFPlayerController(PlayerOwner)) class'ScoreboardExt.KF2GUIInput';
CustomInput.ControllerOwner = Self; CustomInput.ControllerOwner = Self;
@ -280,7 +280,7 @@ simulated final function SetMenuState( bool bActive )
PlayerOwner.PlayerInput = CustomInput; PlayerOwner.PlayerInput = CustomInput;
if( LastMousePos != default.LastMousePos ) if (LastMousePos != default.LastMousePos)
ClientViewport.SetMouse(LastMousePos.X,LastMousePos.Y); ClientViewport.SetMouse(LastMousePos.X,LastMousePos.Y);
} }
else else
@ -289,7 +289,7 @@ simulated final function SetMenuState( bool bActive )
ClientViewport.HandleInputAxis = None; ClientViewport.HandleInputAxis = None;
if( BackupInput!=None ) if (BackupInput != None)
{ {
PlayerOwner.PlayerInput = BackupInput; PlayerOwner.PlayerInput = BackupInput;
BackupInput.OnReceivedNativeInputKey = OldOnReceivedNativeInputKey; BackupInput.OnReceivedNativeInputKey = OldOnReceivedNativeInputKey;
@ -302,7 +302,7 @@ simulated final function SetMenuState( bool bActive )
LastClickTimes[1] = 0; LastClickTimes[1] = 0;
} }
if( !bNoInputReset ) if (!bNoInputReset)
{ {
PlayerOwner.PlayerInput.ResetInput(); PlayerOwner.PlayerInput.ResetInput();
} }
@ -312,19 +312,19 @@ simulated function NotifyLevelChange()
{ {
local int i; local int i;
if( bIsInvalid ) if (bIsInvalid)
return; return;
bIsInvalid = true; bIsInvalid = true;
if( InputFocus!=None ) if (InputFocus != None)
{ {
InputFocus.LostInputFocus(); InputFocus.LostInputFocus();
InputFocus = None; InputFocus = None;
} }
for( i=(ActiveMenus.Length-1); i>=0; --i ) for (i=(ActiveMenus.Length-1); i >= 0; --i)
ActiveMenus[i].NotifyLevelChange(); ActiveMenus[i].NotifyLevelChange();
for( i=(PersistentMenus.Length-1); i>=0; --i ) for (i=(PersistentMenus.Length-1); i >= 0; --i)
PersistentMenus[i].NotifyLevelChange(); PersistentMenus[i].NotifyLevelChange();
SetMenuState(false); SetMenuState(false);
@ -335,36 +335,36 @@ simulated function MenuInput(float DeltaTime)
local int i; local int i;
local vector2D V; local vector2D V;
if( PlayerOwner.PlayerInput==None ) if (PlayerOwner.PlayerInput == None)
{ {
NotifyLevelChange(); NotifyLevelChange();
return; return;
} }
if( InputFocus!=None ) if (InputFocus != None)
InputFocus.MenuTick(DeltaTime); InputFocus.MenuTick(DeltaTime);
for( i=0; i<ActiveMenus.Length; ++i ) for (i=0; i < ActiveMenus.Length; ++i)
ActiveMenus[i].MenuTick(DeltaTime); ActiveMenus[i].MenuTick(DeltaTime);
// Check idle. // Check idle.
if( Abs(MousePosition.X-OldMousePos.X)>5.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; bMouseWasIdle = false;
if( InputFocus!=None ) if (InputFocus != None)
InputFocus.InputMouseMoved(); InputFocus.InputMouseMoved();
} }
OldMousePos = MousePosition; OldMousePos = MousePosition;
MousePauseTime = 0.f; MousePauseTime = 0.f;
} }
else if( !bMouseWasIdle && (MousePauseTime+=DeltaTime)>0.5f ) else if (!bMouseWasIdle && (MousePauseTime+=DeltaTime) > 0.5f)
{ {
bMouseWasIdle = true; bMouseWasIdle = true;
if( MouseFocus!=None ) if (MouseFocus != None)
MouseFocus.NotifyMousePaused(); MouseFocus.NotifyMousePaused();
} }
if( ActiveMenus.Length>0 ) if (ActiveMenus.Length > 0)
MenuTime+=DeltaTime; MenuTime+=DeltaTime;
V = ClientViewport.GetMousePosition(); V = ClientViewport.GetMousePosition();
@ -381,15 +381,15 @@ simulated function MouseMove()
local KFGUI_Base F; local KFGUI_Base F;
// Capture mouse for GUI // Capture mouse for GUI
if( InputFocus!=None && InputFocus.bCanFocus ) if (InputFocus != None && InputFocus.bCanFocus)
{ {
if( InputFocus.CaptureMouse() ) if (InputFocus.CaptureMouse())
{ {
F = InputFocus.GetMouseFocus(); F = InputFocus.GetMouseFocus();
if( F!=MouseFocus ) if (F != MouseFocus)
{ {
MousePauseTime = 0; MousePauseTime = 0;
if( MouseFocus!=None ) if (MouseFocus != None)
MouseFocus.MouseLeave(); MouseFocus.MouseLeave();
MouseFocus = F; MouseFocus = F;
F.MouseEnter(); F.MouseEnter();
@ -399,32 +399,32 @@ simulated function MouseMove()
} }
else else
{ {
for( i=0; i<ActiveMenus.Length; ++i ) for (i=0; i < ActiveMenus.Length; ++i)
{ {
if( ActiveMenus[i].CaptureMouse() ) if (ActiveMenus[i].CaptureMouse())
{ {
F = ActiveMenus[i].GetMouseFocus(); F = ActiveMenus[i].GetMouseFocus();
if( F!=MouseFocus ) if (F != MouseFocus)
{ {
MousePauseTime = 0; MousePauseTime = 0;
if( MouseFocus!=None ) if (MouseFocus != None)
MouseFocus.MouseLeave(); MouseFocus.MouseLeave();
MouseFocus = F; MouseFocus = F;
F.MouseEnter(); F.MouseEnter();
} }
break; break;
} }
else if( ActiveMenus[i].bOnlyThisFocus ) // Discard any other menus after this one. else if (ActiveMenus[i].bOnlyThisFocus ) // Discard any other menus after this one.
{ {
i = ActiveMenus.Length; i = ActiveMenus.Length;
break; break;
} }
} }
} }
if( MouseFocus!=None && i==ActiveMenus.Length ) // Hovering over nothing. if (MouseFocus != None && i == ActiveMenus.Length ) // Hovering over nothing.
{ {
MousePauseTime = 0; MousePauseTime = 0;
if( MouseFocus!=None ) if (MouseFocus != None)
MouseFocus.MouseLeave(); MouseFocus.MouseLeave();
MouseFocus = None; MouseFocus = None;
} }
@ -434,8 +434,8 @@ simulated final function int GetFreeIndex( bool bNewAlwaysTop ) // Find first al
{ {
local int i; local int i;
for( i=0; i<ActiveMenus.Length; ++i ) for (i=0; i < ActiveMenus.Length; ++i)
if( bNewAlwaysTop || !ActiveMenus[i].bAlwaysTop ) if (bNewAlwaysTop || !ActiveMenus[i].bAlwaysTop)
{ {
ActiveMenus.Insert(i,1); ActiveMenus.Insert(i,1);
return i; return i;
@ -444,16 +444,16 @@ simulated final function int GetFreeIndex( bool bNewAlwaysTop ) // Find first al
ActiveMenus.Length = i+1; ActiveMenus.Length = i+1;
return i; return i;
} }
simulated function KFGUI_Base InitializeHUDWidget( class<KFGUI_Base> GUIClass ) simulated function KFGUI_Base InitializeHUDWidget( class < KFGUI_Base> GUIClass)
{ {
local KFGUI_Base Widget; local KFGUI_Base Widget;
if( GUIClass==None ) if (GUIClass == None)
return None; return None;
Widget = New(None) GUIClass; Widget = New(None) GUIClass;
if( Widget==None ) if (Widget == None)
return None; return None;
HUDOwner.HUDWidgets.AddItem(Widget); HUDOwner.HUDWidgets.AddItem(Widget);
@ -466,17 +466,17 @@ simulated function KFGUI_Base InitializeHUDWidget( class<KFGUI_Base> GUIClass )
return Widget; return Widget;
} }
simulated function KFGUI_Page OpenMenu( class<KFGUI_Page> MenuClass ) simulated function KFGUI_Page OpenMenu( class < KFGUI_Page> MenuClass)
{ {
local int i; local int i;
local KFGUI_Page M; local KFGUI_Page M;
if( MenuClass==None ) if (MenuClass == None)
return None; return None;
if( KeyboardFocus!=None ) if (KeyboardFocus != None)
GrabInputFocus(None); GrabInputFocus(None);
if( InputFocus!=None ) if (InputFocus != None)
{ {
InputFocus.LostInputFocus(); InputFocus.LostInputFocus();
InputFocus = None; InputFocus = None;
@ -486,12 +486,12 @@ simulated function KFGUI_Page OpenMenu( class<KFGUI_Page> MenuClass )
SetMenuState(true); SetMenuState(true);
// Check if should use pre-excisting menu. // Check if should use pre-excisting menu.
if( MenuClass.Default.bUnique ) if (MenuClass.Default.bUnique)
{ {
for( i=0; i<ActiveMenus.Length; ++i ) for (i=0; i < ActiveMenus.Length; ++i)
if( ActiveMenus[i].Class==MenuClass ) if (ActiveMenus[i].Class == MenuClass)
{ {
if( i>0 && ActiveMenus[i].BringPageToFront() ) // Sort it upfront. if (i > 0 && ActiveMenus[i].BringPageToFront() ) // Sort it upfront.
{ {
M = ActiveMenus[i]; M = ActiveMenus[i];
ActiveMenus.Remove(i,1); ActiveMenus.Remove(i,1);
@ -501,10 +501,10 @@ simulated function KFGUI_Page OpenMenu( class<KFGUI_Page> MenuClass )
return M; return M;
} }
if( MenuClass.Default.bPersistant ) if (MenuClass.Default.bPersistant)
{ {
for( i=0; i<PersistentMenus.Length; ++i ) for (i=0; i < PersistentMenus.Length; ++i)
if( PersistentMenus[i].Class==MenuClass ) if (PersistentMenus[i].Class == MenuClass)
{ {
M = PersistentMenus[i]; M = PersistentMenus[i];
PersistentMenus.Remove(i,1); PersistentMenus.Remove(i,1);
@ -517,7 +517,7 @@ simulated function KFGUI_Page OpenMenu( class<KFGUI_Page> MenuClass )
} }
M = New(None)MenuClass; M = New(None)MenuClass;
if( M==None ) // Probably abstract class. if (M == None ) // Probably abstract class.
return None; return None;
i = GetFreeIndex(M.bAlwaysTop); i = GetFreeIndex(M.bAlwaysTop);
@ -527,125 +527,125 @@ simulated function KFGUI_Page OpenMenu( class<KFGUI_Page> MenuClass )
M.ShowMenu(); M.ShowMenu();
return M; return M;
} }
simulated function CloseMenu( class<KFGUI_Page> MenuClass, optional bool bCloseAll ) simulated function CloseMenu( class < KFGUI_Page> MenuClass, optional bool bCloseAll)
{ {
local int i, j; local int i, j;
local KFGUI_Page M; local KFGUI_Page M;
if( !bCloseAll && MenuClass==None ) if (!bCloseAll && MenuClass == None)
return; return;
if( KeyboardFocus!=None ) if (KeyboardFocus != None)
GrabInputFocus(None); GrabInputFocus(None);
if( InputFocus!=None ) if (InputFocus != None)
{ {
InputFocus.LostInputFocus(); InputFocus.LostInputFocus();
InputFocus = None; 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]; M = ActiveMenus[i];
ActiveMenus.Remove(i,1); ActiveMenus.Remove(i,1);
M.CloseMenu(); M.CloseMenu();
for( j=0; j<M.TimerNames.Length; j++ ) for (j=0; j < M.TimerNames.Length; j++)
{ {
M.ClearTimer(M.TimerNames[j]); M.ClearTimer(M.TimerNames[j]);
} }
// Cache menu. // Cache menu.
if( M.bPersistant && M.bUnique ) if (M.bPersistant && M.bUnique)
PersistentMenus[PersistentMenus.Length] = M; PersistentMenus[PersistentMenus.Length] = M;
} }
} }
if( ActiveMenus.Length==0 ) if (ActiveMenus.Length == 0)
{ {
SetMenuState(false); SetMenuState(false);
} }
} }
simulated function PopCloseMenu( KFGUI_Base Item ) simulated function PopCloseMenu( KFGUI_Base Item)
{ {
local int i; local int i;
local KFGUI_Page M; local KFGUI_Page M;
if( Item==None ) if (Item == None)
return; return;
if( Item.bIsHUDWidget ) if (Item.bIsHUDWidget)
{ {
HUDOwner.HUDWidgets.RemoveItem(Item); HUDOwner.HUDWidgets.RemoveItem(Item);
Item.CloseMenu(); Item.CloseMenu();
return; return;
} }
if( KeyboardFocus!=None ) if (KeyboardFocus != None)
GrabInputFocus(None); GrabInputFocus(None);
if( InputFocus!=None ) if (InputFocus != None)
{ {
InputFocus.LostInputFocus(); InputFocus.LostInputFocus();
InputFocus = None; InputFocus = None;
} }
for( i=(ActiveMenus.Length-1); i>=0; --i ) for (i=(ActiveMenus.Length-1); i >= 0; --i)
if( ActiveMenus[i]==Item ) if (ActiveMenus[i] == Item)
{ {
M = ActiveMenus[i]; M = ActiveMenus[i];
ActiveMenus.Remove(i,1); ActiveMenus.Remove(i,1);
M.CloseMenu(); M.CloseMenu();
// Cache menu. // Cache menu.
if( M.bPersistant && M.bUnique ) if (M.bPersistant && M.bUnique)
PersistentMenus[PersistentMenus.Length] = M; PersistentMenus[PersistentMenus.Length] = M;
break; break;
} }
if( ActiveMenus.Length==0 ) if (ActiveMenus.Length == 0)
SetMenuState(false); SetMenuState(false);
} }
simulated function BringMenuToFront( KFGUI_Page Page ) simulated function BringMenuToFront( KFGUI_Page Page)
{ {
local int i; local int i;
if( ActiveMenus[0].bAlwaysTop && !Page.bAlwaysTop ) if (ActiveMenus[0].bAlwaysTop && !Page.bAlwaysTop)
return; // Can't override this menu. return; // Can't override this menu.
// Try to remove from current position at stack. // Try to remove from current position at stack.
for( i=(ActiveMenus.Length-1); i>=0; --i ) for (i=(ActiveMenus.Length-1); i >= 0; --i)
if( ActiveMenus[i]==Page ) if (ActiveMenus[i] == Page)
{ {
ActiveMenus.Remove(i,1); ActiveMenus.Remove(i,1);
break; break;
} }
if( i==-1 ) if (i == -1)
return; // Page isn't open. return; // Page isn't open.
// Put on front of stack. // Put on front of stack.
ActiveMenus.Insert(0,1); ActiveMenus.Insert(0,1);
ActiveMenus[0] = Page; ActiveMenus[0] = Page;
} }
simulated final function bool MenuIsOpen( optional class<KFGUI_Page> MenuClass ) simulated final function bool MenuIsOpen( optional class < KFGUI_Page> MenuClass)
{ {
local int i; local int i;
for( i=(ActiveMenus.Length-1); i>=0; --i ) for (i=(ActiveMenus.Length-1); i >= 0; --i)
if( MenuClass==None || ActiveMenus[i].Class==MenuClass ) if (MenuClass == None || ActiveMenus[i].Class == MenuClass)
return true; return true;
return false; 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; return;
if( KeyboardFocus!=None ) if (KeyboardFocus != None)
KeyboardFocus.LostKeyFocus(); KeyboardFocus.LostKeyFocus();
if( Comp==None ) if (Comp == None)
{ {
OnInputKey = InternalInputKey; OnInputKey = InternalInputKey;
OnReceivedInputChar = InternalReceivedInputChar; OnReceivedInputChar = InternalReceivedInputChar;
} }
else if( KeyboardFocus==None ) else if (KeyboardFocus == None)
{ {
OnInputKey = Comp.NotifyInputKey; OnInputKey = Comp.NotifyInputKey;
OnReceivedInputChar = Comp.NotifyInputChar; OnReceivedInputChar = Comp.NotifyInputChar;
@ -654,23 +654,23 @@ simulated final function GrabInputFocus( KFGUI_Base Comp, optional bool bForce )
KeyboardFocus = Comp; KeyboardFocus = Comp;
} }
simulated final function GUI_InputMouse( bool bPressed, bool bRight ) simulated final function GUI_InputMouse( bool bPressed, bool bRight)
{ {
local byte i; local byte i;
MousePauseTime = 0; MousePauseTime = 0;
if( bPressed ) if (bPressed)
{ {
if( KeyboardFocus!=None && KeyboardFocus!=MouseFocus ) if (KeyboardFocus != None && KeyboardFocus != MouseFocus)
{ {
GrabInputFocus(None); GrabInputFocus(None);
LastClickTimes[0] = 0; LastClickTimes[0] = 0;
LastClickTimes[1] = 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()); BringMenuToFront(MouseFocus.GetPageTop());
LastClickTimes[0] = 0; LastClickTimes[0] = 0;
@ -679,7 +679,7 @@ simulated final function GUI_InputMouse( bool bPressed, bool bRight )
else else
{ {
i = byte(bRight); 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; LastClickTimes[i] = 0;
MouseFocus.DoubleMouseClick(bRight); 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.LostInputFocus();
InputFocus = None; InputFocus = None;
@ -702,17 +702,17 @@ simulated final function GUI_InputMouse( bool bPressed, bool bRight )
} }
else else
{ {
if( InputFocus!=None ) if (InputFocus != None)
InputFocus.MouseRelease(bRight); InputFocus.MouseRelease(bRight);
else if( MouseFocus!=None ) else if (MouseFocus != None)
MouseFocus.MouseRelease(bRight); 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 'XboxTypeS_A':
case 'LeftMouseButton': case 'LeftMouseButton':
@ -724,9 +724,9 @@ simulated final function bool CheckMouse( name Key, EInputEvent Event )
return true; return true;
} }
} }
else if ( Event == IE_Released ) else if (Event == IE_Released)
{ {
switch( Key ) switch( Key)
{ {
case 'XboxTypeS_A': case 'XboxTypeS_A':
case 'LeftMouseButton': case 'LeftMouseButton':
@ -740,34 +740,34 @@ simulated final function bool CheckMouse( name Key, EInputEvent Event )
} }
return false; 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 KFPlayerInput KFInput;
local KeyBind BoundKey; local KeyBind BoundKey;
if( !bIsInMenuState ) if (!bIsInMenuState)
return false; return false;
bUsingGamepad = bGamepad; bUsingGamepad = bGamepad;
KFInput = KFPlayerInput(BackupInput); KFInput = KFPlayerInput(BackupInput);
if( KFInput == None ) if (KFInput == None)
{ {
KFInput = KFPlayerInput(PlayerOwner.PlayerInput); KFInput = KFPlayerInput(PlayerOwner.PlayerInput);
} }
if( KeyboardFocus == None ) if (KeyboardFocus == None)
{ {
if( KFInput != None ) if (KFInput != None)
{ {
KFInput.GetKeyBindFromCommand(BoundKey, "GBA_VoiceChat", false); 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); KFInput.StartVoiceChat(true);
} }
else if( Event == IE_Released ) else if (Event == IE_Released)
{ {
KFInput.StopVoiceChat(); 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; return true;
} }
switch( Key ) switch( Key)
{ {
case 'XboxTypeS_Start': case 'XboxTypeS_Start':
case 'Escape': case 'Escape':
if( Event==IE_Pressed ) if (Event == IE_Pressed)
ActiveMenus[0].UserPressedEsc(); // Pop top menu if possible. // IE_Released ActiveMenus[0].UserPressedEsc(); // Pop top menu if possible. // IE_Released
return true; return true;
case 'XboxTypeS_DPad_Up': case 'XboxTypeS_DPad_Up':
@ -798,8 +798,8 @@ simulated function bool ReceivedInputKey( int ControllerId, name Key, EInputEven
case 'XboxTypeS_DPad_Right': case 'XboxTypeS_DPad_Right':
case 'MouseScrollDown': case 'MouseScrollDown':
case 'MouseScrollUp': case 'MouseScrollUp':
if( Event==IE_Pressed && MouseFocus!=None ) if (Event == IE_Pressed && MouseFocus != None)
MouseFocus.ScrollMouseWheel(Key=='MouseScrollUp' || Key=='XboxTypeS_DPad_Up' || Key=='XboxTypeS_DPad_Left'); MouseFocus.ScrollMouseWheel(Key == 'MouseScrollUp' || Key == 'XboxTypeS_DPad_Up' || Key == 'XboxTypeS_DPad_Left');
return true; return true;
} }
@ -808,18 +808,18 @@ simulated function bool ReceivedInputKey( int ControllerId, name Key, EInputEven
return true; 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 Vector2D V;
local KFPlayerInput KFInput; local KFPlayerInput KFInput;
local float GamepadSensitivity,OldMouseX,OldMouseY,MoveDelta,MoveDeltaInvert; local float GamepadSensitivity,OldMouseX,OldMouseY,MoveDelta,MoveDeltaInvert;
if( !bIsInMenuState ) if (!bIsInMenuState)
return false; return false;
if( bGamepad ) if (bGamepad )
{ {
if( Abs(Delta) > 0.2f ) if (Abs(Delta) > 0.2f)
{ {
bUsingGamepad = true; bUsingGamepad = true;
@ -836,52 +836,52 @@ simulated function bool ReceivedInputAxis( int ControllerId, name Key, float Del
{ {
case 'XboxTypeS_LeftX': case 'XboxTypeS_LeftX':
case 'XboxTypeS_RightX': case 'XboxTypeS_RightX':
if( Delta < 0 ) if (Delta < 0)
V.X = Clamp(V.X - MoveDeltaInvert, 0, ScreenSize.X); V.X = Clamp(V.X - MoveDeltaInvert, 0, ScreenSize.X);
else V.X = Clamp(V.X + MoveDelta, 0, ScreenSize.X); else V.X = Clamp(V.X + MoveDelta, 0, ScreenSize.X);
break; break;
case 'XboxTypeS_LeftY': case 'XboxTypeS_LeftY':
if( Delta < 0 ) if (Delta < 0)
V.Y = Clamp(V.Y + MoveDeltaInvert, 0, ScreenSize.Y); V.Y = Clamp(V.Y + MoveDeltaInvert, 0, ScreenSize.Y);
else V.Y = Clamp(V.Y - MoveDelta, 0, ScreenSize.Y); else V.Y = Clamp(V.Y - MoveDelta, 0, ScreenSize.Y);
break; break;
case 'XboxTypeS_RightY': case 'XboxTypeS_RightY':
if( Delta < 0 ) if (Delta < 0)
V.Y = Clamp(V.Y - MoveDeltaInvert, 0, ScreenSize.Y); V.Y = Clamp(V.Y - MoveDeltaInvert, 0, ScreenSize.Y);
else V.Y = Clamp(V.Y + MoveDelta, 0, ScreenSize.Y); else V.Y = Clamp(V.Y + MoveDelta, 0, ScreenSize.Y);
break; break;
} }
if( OldMouseX != V.X || OldMouseY != V.Y ) if (OldMouseX != V.X || OldMouseY != V.Y)
ClientViewport.SetMouse(V.X, V.Y); ClientViewport.SetMouse(V.X, V.Y);
} }
} }
return OnReceivedInputAxis(ControllerId, Key, Delta, DeltaTime, bGamepad); 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 false;
return OnReceivedInputChar(ControllerId,Unicode); 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; 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; return false;
} }
simulated Delegate bool OnReceivedInputChar( int ControllerId, string Unicode ) simulated Delegate bool OnReceivedInputChar( int ControllerId, string Unicode)
{ {
return false; 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; return false;
} }
simulated Delegate bool InternalReceivedInputChar( int ControllerId, string Unicode ) simulated Delegate bool InternalReceivedInputChar( int ControllerId, string Unicode)
{ {
return false; return false;
} }

View File

@ -8,24 +8,24 @@ class KF2GUIInput extends KFPlayerInput;
var KF2GUIController ControllerOwner; var KF2GUIController ControllerOwner;
var PlayerInput BaseInput; var PlayerInput BaseInput;
function DrawHUD( HUD H ) function DrawHUD( HUD H)
{ {
//ControllerOwner.RenderMenu(H.Canvas); //ControllerOwner.RenderMenu(H.Canvas);
} }
function PostRender( Canvas Canvas ) function PostRender( Canvas Canvas)
{ {
if( ControllerOwner.bIsInMenuState ) if (ControllerOwner.bIsInMenuState)
ControllerOwner.HandleDrawMenu(); ControllerOwner.HandleDrawMenu();
//ControllerOwner.RenderMenu(Canvas); //ControllerOwner.RenderMenu(Canvas);
} }
// Postprocess the player's input. // Postprocess the player's input.
function PlayerInput( float DeltaTime ) function PlayerInput( float DeltaTime)
{ {
// Do not move. // Do not move.
ControllerOwner.MenuInput(DeltaTime); ControllerOwner.MenuInput(DeltaTime);
if( !ControllerOwner.bAbsorbInput ) if (!ControllerOwner.bAbsorbInput)
{ {
aMouseX = 0; aMouseX = 0;
aMouseY = 0; aMouseY = 0;

View File

@ -14,13 +14,13 @@ function InitStyle()
LoadedTex[0] = Texture2D(DynamicLoadObject("EditorMaterials.CASC_ModuleEnable",class'Texture2D')); LoadedTex[0] = Texture2D(DynamicLoadObject("EditorMaterials.CASC_ModuleEnable",class'Texture2D'));
LoadedTex[1] = Texture2D(DynamicLoadObject("EditorMaterials.Tick",class'Texture2D')); LoadedTex[1] = Texture2D(DynamicLoadObject("EditorMaterials.Tick",class'Texture2D'));
for( i=0; i<ArrayCount(LoadedTex); ++i ) for (i=0; i < ArrayCount(LoadedTex); ++i)
{ {
if( LoadedTex[i]==None ) if (LoadedTex[i] == None)
LoadedTex[i] = Texture2D'EngineMaterials.DefaultWhiteGrid'; LoadedTex[i] = Texture2D'EngineMaterials.DefaultWhiteGrid';
} }
} }
function RenderFramedWindow( KFGUI_FloatingWindow P ) function RenderFramedWindow( KFGUI_FloatingWindow P)
{ {
local int XS,YS,CornerSlope,TitleHeight; local int XS,YS,CornerSlope,TitleHeight;
@ -30,7 +30,7 @@ function RenderFramedWindow( KFGUI_FloatingWindow P )
TitleHeight = DefaultHeight; TitleHeight = DefaultHeight;
// Frame Header // Frame Header
if( P.bWindowFocused ) if (P.bWindowFocused)
Canvas.SetDrawColor(220,2,2,255); Canvas.SetDrawColor(220,2,2,255);
else Canvas.SetDrawColor(100,1,1,P.FrameOpacity); else Canvas.SetDrawColor(100,1,1,P.FrameOpacity);
Canvas.SetPos(0,0); Canvas.SetPos(0,0);
@ -49,7 +49,7 @@ function RenderFramedWindow( KFGUI_FloatingWindow P )
DrawWhiteBox(XS-(CornerSlope*2),CornerSlope); DrawWhiteBox(XS-(CornerSlope*2),CornerSlope);
// Frame itself. // Frame itself.
if( P.bWindowFocused ) if (P.bWindowFocused)
Canvas.SetDrawColor(32,6,6,255); Canvas.SetDrawColor(32,6,6,255);
else Canvas.SetDrawColor(16,2,2,P.FrameOpacity); else Canvas.SetDrawColor(16,2,2,P.FrameOpacity);
Canvas.SetPos(0,TitleHeight); Canvas.SetPos(0,TitleHeight);
@ -70,14 +70,14 @@ function RenderFramedWindow( KFGUI_FloatingWindow P )
DrawWhiteBox(CornerSlope,YS-(CornerSlope*2)-TitleHeight); DrawWhiteBox(CornerSlope,YS-(CornerSlope*2)-TitleHeight);
// Title. // Title.
if( P.WindowTitle!="" ) if (P.WindowTitle != "")
{ {
Canvas.SetDrawColor(250,250,250,P.FrameOpacity); Canvas.SetDrawColor(250,250,250,P.FrameOpacity);
Canvas.SetPos(CornerSlope,0); Canvas.SetPos(CornerSlope,0);
DrawText(P.WindowTitle); DrawText(P.WindowTitle);
} }
} }
function RenderWindow( KFGUI_Page P ) function RenderWindow( KFGUI_Page P)
{ {
local int XS,YS,CornerSlope; local int XS,YS,CornerSlope;
@ -86,7 +86,7 @@ function RenderWindow( KFGUI_Page P )
CornerSlope = DefaultHeight*0.4; CornerSlope = DefaultHeight*0.4;
// Frame itself. // Frame itself.
if( P.bWindowFocused ) if (P.bWindowFocused)
Canvas.SetDrawColor(64,64,64,255); Canvas.SetDrawColor(64,64,64,255);
else Canvas.SetDrawColor(32,32,32,P.FrameOpacity); else Canvas.SetDrawColor(32,32,32,P.FrameOpacity);
Canvas.SetPos(0,0); Canvas.SetPos(0,0);
@ -106,7 +106,7 @@ function RenderWindow( KFGUI_Page P )
Canvas.SetPos(XS-CornerSlope,CornerSlope); Canvas.SetPos(XS-CornerSlope,CornerSlope);
DrawWhiteBox(CornerSlope,YS-(CornerSlope*2)); DrawWhiteBox(CornerSlope,YS-(CornerSlope*2));
} }
function RenderToolTip( KFGUI_Tooltip TT ) function RenderToolTip( KFGUI_Tooltip TT)
{ {
local int i; local int i;
local float X,Y,XS,YS,TX,TY,TS,DefFontHeight; local float X,Y,XS,YS,TX,TY,TS,DefFontHeight;
@ -115,9 +115,9 @@ function RenderToolTip( KFGUI_Tooltip TT )
// First compute textbox size. // First compute textbox size.
TY = DefaultHeight*TT.Lines.Length; TY = DefaultHeight*TT.Lines.Length;
for( i=0; i<TT.Lines.Length; ++i ) for (i=0; i < TT.Lines.Length; ++i)
{ {
if( TT.Lines[i]!="" ) if (TT.Lines[i] != "")
Canvas.TextSize(TT.Lines[i],XS,YS); Canvas.TextSize(TT.Lines[i],XS,YS);
TX = FMax(XS,TX); TX = FMax(XS,TX);
} }
@ -131,12 +131,12 @@ function RenderToolTip( KFGUI_Tooltip TT )
Y = TT.CompPos[1]+24.f; Y = TT.CompPos[1]+24.f;
// Then check if too close to window edge, then move it to another pivot. // Then check if too close to window edge, then move it to another pivot.
if( (X+TX)>TT.Owner.ScreenSize.X ) if ((X+TX) > TT.Owner.ScreenSize.X)
X = TT.Owner.ScreenSize.X-TX; 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; Y = TT.CompPos[1]-TY;
if( TT.CurrentAlpha<255 ) if (TT.CurrentAlpha < 255)
TT.CurrentAlpha = Min(TT.CurrentAlpha+25,255); TT.CurrentAlpha = Min(TT.CurrentAlpha+25,255);
// Reset clipping. // Reset clipping.
@ -157,39 +157,39 @@ function RenderToolTip( KFGUI_Tooltip TT )
Canvas.SetDrawColor(255,255,255,TT.CurrentAlpha); Canvas.SetDrawColor(255,255,255,TT.CurrentAlpha);
X+=TOOLTIP_BORDER; X+=TOOLTIP_BORDER;
Y+=TOOLTIP_BORDER; Y+=TOOLTIP_BORDER;
for( i=0; i<TT.Lines.Length; ++i ) for (i=0; i < TT.Lines.Length; ++i)
{ {
Canvas.SetPos(X,Y); Canvas.SetPos(X,Y);
Canvas.DrawText(TT.Lines[i],,TS,TS,TT.TextFontInfo); Canvas.DrawText(TT.Lines[i],,TS,TS,TT.TextFontInfo);
Y+=DefFontHeight; Y+=DefFontHeight;
} }
} }
function RenderScrollBar( KFGUI_ScrollBarBase S ) function RenderScrollBar( KFGUI_ScrollBarBase S)
{ {
local float A; local float A;
local byte i; local byte i;
if( S.bDisabled ) if (S.bDisabled)
Canvas.SetDrawColor(5, 5, 5, 0); Canvas.SetDrawColor(5, 5, 5, 0);
else if( S.bFocused || S.bGrabbedScroller ) else if (S.bFocused || S.bGrabbedScroller)
Canvas.SetDrawColor(15, 15, 15, 160); Canvas.SetDrawColor(15, 15, 15, 160);
else Canvas.SetDrawColor(15, 15, 15, 160); else Canvas.SetDrawColor(15, 15, 15, 160);
DrawRectBox (0.f, 0.f, S.CompPos[2], S.CompPos[3], 4); DrawRectBox (0.f, 0.f, S.CompPos[2], S.CompPos[3], 4);
if( S.bDisabled ) if (S.bDisabled)
return; return;
if( S.bVertical ) if (S.bVertical)
i = 3; i = 3;
else i = 2; else i = 2;
S.SliderScale = FMax(S.PageStep * (S.CompPos[i] - 32.f) / (S.MaxRange + S.PageStep),S.CalcButtonScale); S.SliderScale = FMax(S.PageStep * (S.CompPos[i] - 32.f) / (S.MaxRange + S.PageStep),S.CalcButtonScale);
if( S.bGrabbedScroller ) if (S.bGrabbedScroller)
{ {
// Track mouse. // Track mouse.
if( S.bVertical ) if (S.bVertical)
A = S.Owner.MousePosition.Y - S.CompPos[1] - S.GrabbedOffset; A = S.Owner.MousePosition.Y - S.CompPos[1] - S.GrabbedOffset;
else A = S.Owner.MousePosition.X - S.CompPos[0] - S.GrabbedOffset; else A = S.Owner.MousePosition.X - S.CompPos[0] - S.GrabbedOffset;
@ -200,27 +200,27 @@ function RenderScrollBar( KFGUI_ScrollBarBase S )
A = float(S.CurrentScroll) / float(S.MaxRange); A = float(S.CurrentScroll) / float(S.MaxRange);
S.ButtonOffset = A*(S.CompPos[i]-S.SliderScale); S.ButtonOffset = A*(S.CompPos[i]-S.SliderScale);
if( S.bGrabbedScroller ) if (S.bGrabbedScroller)
Canvas.SetDrawColor(255,0,0,200); Canvas.SetDrawColor(255,0,0,200);
else if( S.bFocused ) else if (S.bFocused)
Canvas.SetDrawColor(200,0,0,200); Canvas.SetDrawColor(200,0,0,200);
else Canvas.SetDrawColor(150,0,0,200); else Canvas.SetDrawColor(150,0,0,200);
if( S.bVertical ) if (S.bVertical)
DrawRectBox (0.f, S.ButtonOffset, S.CompPos[2], S.SliderScale, 4); DrawRectBox (0.f, S.ButtonOffset, S.CompPos[2], S.SliderScale, 4);
else DrawRectBox (S.ButtonOffset, 0.f, S.SliderScale, S.CompPos[3], 4); else DrawRectBox (S.ButtonOffset, 0.f, S.SliderScale, S.CompPos[3], 4);
} }
function RenderColumnHeader( KFGUI_ColumnTop C, float XPos, float Width, int Index, bool bFocus, bool bSort ) function RenderColumnHeader( KFGUI_ColumnTop C, float XPos, float Width, int Index, bool bFocus, bool bSort)
{ {
local int XS; local int XS;
if( bSort ) if (bSort)
{ {
if( bFocus ) if (bFocus)
Canvas.SetDrawColor(175,240,8,255); Canvas.SetDrawColor(175,240,8,255);
else Canvas.SetDrawColor(128,200,56,255); else Canvas.SetDrawColor(128,200,56,255);
} }
else if( bFocus ) else if (bFocus)
Canvas.SetDrawColor(220,220,8,255); Canvas.SetDrawColor(220,220,8,255);
else Canvas.SetDrawColor(220,86,56,255); else Canvas.SetDrawColor(220,86,56,255);
@ -236,45 +236,45 @@ function RenderColumnHeader( KFGUI_ColumnTop C, float XPos, float Width, int Ind
Canvas.SetPos(XPos+XS,(C.CompPos[3]-C.ListOwner.TextHeight)*0.5f); Canvas.SetPos(XPos+XS,(C.CompPos[3]-C.ListOwner.TextHeight)*0.5f);
C.ListOwner.DrawStrClipped(C.ListOwner.Columns[Index].Text); C.ListOwner.DrawStrClipped(C.ListOwner.Columns[Index].Text);
} }
function RenderCheckbox( KFGUI_CheckBox C ) function RenderCheckbox( KFGUI_CheckBox C)
{ {
if( C.bDisabled ) if (C.bDisabled)
Canvas.SetDrawColor(86,86,86,255); Canvas.SetDrawColor(86,86,86,255);
else if( C.bPressedDown ) else if (C.bPressedDown)
Canvas.SetDrawColor(128,255,128,255); Canvas.SetDrawColor(128,255,128,255);
else if( C.bFocused ) else if (C.bFocused)
Canvas.SetDrawColor(150,200,128,255); Canvas.SetDrawColor(150,200,128,255);
else Canvas.SetDrawColor(128,186,128,255); else Canvas.SetDrawColor(128,186,128,255);
Canvas.SetPos(0.f,0.f); Canvas.SetPos(0.f,0.f);
Canvas.DrawTileStretched(LoadedTex[0],C.CompPos[2],C.CompPos[3],0,0,LoadedTex[0].GetSurfaceWidth(),LoadedTex[0].GetSurfaceHeight()); Canvas.DrawTileStretched(LoadedTex[0],C.CompPos[2],C.CompPos[3],0,0,LoadedTex[0].GetSurfaceWidth(),LoadedTex[0].GetSurfaceHeight());
if( C.bChecked ) if (C.bChecked)
{ {
if( C.bDisabled ) if (C.bDisabled)
Canvas.SetDrawColor(128,128,128,255); Canvas.SetDrawColor(128,128,128,255);
else Canvas.SetDrawColor(255,255,255,255); else Canvas.SetDrawColor(255,255,255,255);
Canvas.SetPos(0.f,0.f); Canvas.SetPos(0.f,0.f);
Canvas.DrawTile(LoadedTex[1],C.CompPos[2],C.CompPos[3],0,0,LoadedTex[1].GetSurfaceWidth(),LoadedTex[1].GetSurfaceHeight()); Canvas.DrawTile(LoadedTex[1],C.CompPos[2],C.CompPos[3],0,0,LoadedTex[1].GetSurfaceWidth(),LoadedTex[1].GetSurfaceHeight());
} }
} }
function RenderComboBox( KFGUI_ComboBox C ) function RenderComboBox( KFGUI_ComboBox C)
{ {
if( C.bDisabled ) if (C.bDisabled)
Canvas.SetDrawColor(64,4,4,255); Canvas.SetDrawColor(64,4,4,255);
else if( C.bPressedDown ) else if (C.bPressedDown)
Canvas.SetDrawColor(220,56,56,255); Canvas.SetDrawColor(220,56,56,255);
else if( C.bFocused ) else if (C.bFocused)
Canvas.SetDrawColor(190,48,48,255); Canvas.SetDrawColor(190,48,48,255);
else Canvas.SetDrawColor(186,4,4,255); else Canvas.SetDrawColor(186,4,4,255);
Canvas.SetPos(0.f,0.f); Canvas.SetPos(0.f,0.f);
DrawWhiteBox(C.CompPos[2],C.CompPos[3]); DrawWhiteBox(C.CompPos[2],C.CompPos[3]);
if( C.SelectedIndex<C.Values.Length && C.Values[C.SelectedIndex]!="" ) if (C.SelectedIndex < C.Values.Length && C.Values[C.SelectedIndex] != "")
{ {
Canvas.SetPos(C.BorderSize,(C.CompPos[3]-C.TextHeight)*0.5); Canvas.SetPos(C.BorderSize,(C.CompPos[3]-C.TextHeight)*0.5);
if( C.bDisabled ) if (C.bDisabled)
Canvas.DrawColor = C.TextColor*0.5f; Canvas.DrawColor = C.TextColor*0.5f;
else Canvas.DrawColor = C.TextColor; else Canvas.DrawColor = C.TextColor;
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX-C.BorderSize,Canvas.ClipY); Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX-C.BorderSize,Canvas.ClipY);
@ -282,7 +282,7 @@ function RenderComboBox( KFGUI_ComboBox C )
Canvas.PopMaskRegion(); Canvas.PopMaskRegion();
} }
} }
function RenderComboList( KFGUI_ComboSelector C ) function RenderComboList( KFGUI_ComboSelector C)
{ {
local float X,Y,YL,YP,Edge; local float X,Y,YL,YP,Edge;
local int i; local int i;
@ -301,7 +301,7 @@ function RenderComboList( KFGUI_ComboSelector C )
X = C.Owner.MousePosition.X - Canvas.OrgX; X = C.Owner.MousePosition.X - Canvas.OrgX;
Y = C.Owner.MousePosition.Y - Canvas.OrgY; Y = C.Owner.MousePosition.Y - Canvas.OrgY;
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]); bCheckMouse = (X > 0.f && X < C.CompPos[2] && Y > 0.f && Y < C.CompPos[3]);
Canvas.Font = C.Combo.TextFont; Canvas.Font = C.Combo.TextFont;
YL = C.Combo.TextHeight; YL = C.Combo.TextHeight;
@ -310,9 +310,9 @@ function RenderComboList( KFGUI_ComboSelector C )
C.CurrentRow = -1; C.CurrentRow = -1;
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY); Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
for( i=0; i<C.Combo.Values.Length; ++i ) for (i=0; i < C.Combo.Values.Length; ++i)
{ {
if( bCheckMouse && Y>=YP && Y<=(YP+YL) ) if (bCheckMouse && Y >= YP && Y <= (YP+YL))
{ {
bCheckMouse = false; bCheckMouse = false;
C.CurrentRow = i; C.CurrentRow = i;
@ -322,7 +322,7 @@ function RenderComboList( KFGUI_ComboSelector C )
} }
Canvas.SetPos(Edge,YP); Canvas.SetPos(Edge,YP);
if( i==C.Combo.SelectedIndex ) if (i == C.Combo.SelectedIndex)
Canvas.DrawColor = C.Combo.SelectedTextColor; Canvas.DrawColor = C.Combo.SelectedTextColor;
else Canvas.DrawColor = C.Combo.TextColor; else Canvas.DrawColor = C.Combo.TextColor;
@ -331,13 +331,13 @@ function RenderComboList( KFGUI_ComboSelector C )
YP+=YL; YP+=YL;
} }
Canvas.PopMaskRegion(); Canvas.PopMaskRegion();
if( C.OldRow!=C.CurrentRow ) if (C.OldRow != C.CurrentRow)
{ {
C.OldRow = C.CurrentRow; C.OldRow = C.CurrentRow;
C.PlayMenuSound(MN_DropdownChange); C.PlayMenuSound(MN_DropdownChange);
} }
} }
function RenderRightClickMenu( KFGUI_RightClickMenu C ) function RenderRightClickMenu( KFGUI_RightClickMenu C)
{ {
local float X,Y,YP,Edge,TextScale,TexDefHieght; local float X,Y,YP,Edge,TextScale,TexDefHieght;
local int i; local int i;
@ -355,7 +355,7 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
X = C.Owner.MousePosition.X - Canvas.OrgX; X = C.Owner.MousePosition.X - Canvas.OrgX;
Y = C.Owner.MousePosition.Y - Canvas.OrgY; Y = C.Owner.MousePosition.Y - Canvas.OrgY;
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]); bCheckMouse = (X > 0.f && X < C.CompPos[2] && Y > 0.f && Y < C.CompPos[3]);
Canvas.Font = PickFont(TextScale); Canvas.Font = PickFont(TextScale);
@ -365,9 +365,9 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
TexDefHieght = DefaultHeight; TexDefHieght = DefaultHeight;
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY); Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
for( i=0; i<C.ItemRows.Length; ++i ) for (i=0; i < C.ItemRows.Length; ++i)
{ {
if( bCheckMouse && Y>=YP && Y<=(YP+TexDefHieght) ) if (bCheckMouse && Y >= YP && Y <= (YP+TexDefHieght))
{ {
bCheckMouse = false; bCheckMouse = false;
C.CurrentRow = i; C.CurrentRow = i;
@ -377,14 +377,14 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
} }
Canvas.SetPos(Edge,YP); Canvas.SetPos(Edge,YP);
if( C.ItemRows[i].bSplitter ) if (C.ItemRows[i].bSplitter)
{ {
Canvas.SetDrawColor(0,0,0,255); Canvas.SetDrawColor(0,0,0,255);
Canvas.DrawText("-------",,TextScale,TextScale); Canvas.DrawText("-------",,TextScale,TextScale);
} }
else else
{ {
if( C.ItemRows[i].bDisabled ) if (C.ItemRows[i].bDisabled)
Canvas.SetDrawColor(148,148,148,255); Canvas.SetDrawColor(148,148,148,255);
else Canvas.SetDrawColor(248,248,248,255); else Canvas.SetDrawColor(248,248,248,255);
Canvas.DrawText(C.ItemRows[i].Text,,TextScale,TextScale); Canvas.DrawText(C.ItemRows[i].Text,,TextScale,TextScale);
@ -393,26 +393,26 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
YP+=TexDefHieght; YP+=TexDefHieght;
} }
Canvas.PopMaskRegion(); Canvas.PopMaskRegion();
if( C.OldRow!=C.CurrentRow ) if (C.OldRow != C.CurrentRow)
{ {
C.OldRow = C.CurrentRow; C.OldRow = C.CurrentRow;
C.PlayMenuSound(MN_DropdownChange); C.PlayMenuSound(MN_DropdownChange);
} }
} }
function RenderButton( KFGUI_Button B ) function RenderButton( KFGUI_Button B)
{ {
local float XL,YL,TS; local float XL,YL,TS;
local byte i; local byte i;
if( B.bDisabled ) if (B.bDisabled)
Canvas.SetDrawColor(32,0,0,255); Canvas.SetDrawColor(32,0,0,255);
else if( B.bPressedDown ) else if (B.bPressedDown)
Canvas.SetDrawColor(255,64,64,255); Canvas.SetDrawColor(255,64,64,255);
else if( B.bFocused ) else if (B.bFocused)
Canvas.SetDrawColor(180,45,45,255); Canvas.SetDrawColor(180,45,45,255);
else Canvas.SetDrawColor(164,8,8,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.R = Min(Canvas.DrawColor.R+25,255);
Canvas.DrawColor.G = Min(Canvas.DrawColor.G+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); Canvas.SetPos(0.f,0.f);
if( B.ExtravDir==255 ) if (B.ExtravDir == 255)
DrawWhiteBox(B.CompPos[2],B.CompPos[3]); 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); 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.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); 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. // Chose the best font to fit this button.
i = Min(B.FontScale,MaxFontScale); i = Min(B.FontScale,MaxFontScale);
while( true ) while( true)
{ {
Canvas.Font = PickFont(TS); Canvas.Font = PickFont(TS);
Canvas.TextSize(B.ButtonText,XL,YL,TS,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; break;
--i; --i;
} }
Canvas.SetPos((B.CompPos[2]-XL)*0.5,(B.CompPos[3]-YL)*0.5); 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; Canvas.DrawColor = B.TextColor*0.5f;
else Canvas.DrawColor = B.TextColor; else Canvas.DrawColor = B.TextColor;
Canvas.DrawText(B.ButtonText,,TS,TS,B.TextFontInfo); Canvas.DrawText(B.ButtonText,,TS,TS,B.TextFontInfo);

View File

@ -28,18 +28,18 @@ static final function HSVColour RGBToHSV(const LinearColor RGB)
Chroma = Max - Min; Chroma = Max - Min;
//If Chroma is 0, then S is 0 by definition, and H is undefined but 0 by convention. //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; HSV.H = (RGB.G - RGB.B) / Chroma;
if(HSV.H < 0.0) if (HSV.H < 0.0)
{ {
HSV.H += 6.0; HSV.H += 6.0;
} }
} }
else if(RGB.G == Max) else if (RGB.G == Max)
{ {
HSV.H = ((RGB.B - RGB.R) / Chroma) + 2.0; 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; Hdash = HSV.H / 60.0;
X = Chroma * (1.0 - Abs((Hdash % 2.0) - 1.0)); X = Chroma * (1.0 - Abs((Hdash % 2.0) - 1.0));
if(Hdash < 1.0) if (Hdash < 1.0)
{ {
RGB.R = Chroma; RGB.R = Chroma;
RGB.G = X; RGB.G = X;
} }
else if(Hdash < 2.0) else if (Hdash < 2.0)
{ {
RGB.R = X; RGB.R = X;
RGB.G = Chroma; RGB.G = Chroma;
} }
else if(Hdash < 3.0) else if (Hdash < 3.0)
{ {
RGB.G = Chroma; RGB.G = Chroma;
RGB.B = X; RGB.B = X;
} }
else if(Hdash < 4.0) else if (Hdash < 4.0)
{ {
RGB.G= X; RGB.G= X;
RGB.B = Chroma; RGB.B = Chroma;
} }
else if(Hdash < 5.0) else if (Hdash < 5.0)
{ {
RGB.R = X; RGB.R = X;
RGB.B = Chroma; RGB.B = Chroma;
} }
else if(Hdash < 6.0) else if (Hdash < 6.0)
{ {
RGB.R = Chroma; RGB.R = Chroma;
RGB.B = X; RGB.B = X;

View File

@ -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 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 transient bool bFocused,bTextureInit,bVisible;
var bool bIsHUDWidget,bEnableInputs,bNoLookInputs; var bool bIsHUDWidget,bEnableInputs,bNoLookInputs;
var array<name> TimerNames; var array < name> TimerNames;
function InitMenu(); // Menu was initialized for the first time. function InitMenu(); // Menu was initialized for the first time.
function ShowMenu(); // Menu was opened. function ShowMenu(); // Menu was opened.
function PreDraw() function PreDraw()
{ {
if( !bVisible ) if (!bVisible)
return; return;
ComputeCoords(); ComputeCoords();
@ -56,13 +56,13 @@ function MenuTick( float DeltaTime );
final function SetTimer(float InRate, optional bool inbLoop, optional Name inTimerFunc='Timer') final function SetTimer(float InRate, optional bool inbLoop, optional Name inTimerFunc='Timer')
{ {
if( InRate <= 0.f ) if (InRate <= 0.f)
{ {
ClearTimer(inTimerFunc); ClearTimer(inTimerFunc);
return; return;
} }
if( TimerNames.Find(inTimerFunc) == INDEX_NONE ) if (TimerNames.Find(inTimerFunc) == INDEX_NONE)
{ {
TimerNames.AddItem(inTimerFunc); 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') final function ClearTimer(optional Name inTimerFunc='Timer')
{ {
if( TimerNames.Find(inTimerFunc) != INDEX_NONE ) if (TimerNames.Find(inTimerFunc) != INDEX_NONE)
{ {
TimerNames.RemoveItem(inTimerFunc); TimerNames.RemoveItem(inTimerFunc);
} }
@ -109,7 +109,7 @@ final function PlayerController GetPlayer()
return Owner.PlayerOwner; return Owner.PlayerOwner;
} }
function SetDisabled( bool bDisable ) function SetDisabled( bool bDisable)
{ {
bDisabled = bDisable; bDisabled = bDisable;
} }
@ -126,14 +126,14 @@ final function ComputeCoords()
function bool CaptureMouse() 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() final function KFGUI_Base GetMouseFocus()
{ {
local KFGUI_Base M; local KFGUI_Base M;
for( M=Self; M.MouseArea!=None; M=M.MouseArea ) for (M=Self; M.MouseArea != None; M=M.MouseArea)
{} {}
return M; return M;
} }
@ -147,12 +147,12 @@ function DoClose()
{ {
local int i; local int i;
for( i=0; i<TimerNames.Length; i++ ) for (i=0; i < TimerNames.Length; i++)
{ {
ClearTimer(TimerNames[i]); ClearTimer(TimerNames[i]);
} }
if( ParentComponent!=None ) if (ParentComponent != None)
ParentComponent.DoClose(); ParentComponent.DoClose();
else Owner.PopCloseMenu(Self); else Owner.PopCloseMenu(Self);
} }
@ -164,50 +164,50 @@ function byte GetCursorStyle()
function UserPressedEsc() // user pressed escape while this menu was active. function UserPressedEsc() // user pressed escape while this menu was active.
{ {
if( ParentComponent!=None ) if (ParentComponent != None)
ParentComponent.UserPressedEsc(); ParentComponent.UserPressedEsc();
else DoClose(); else DoClose();
} }
function bool BringPageToFront() function bool BringPageToFront()
{ {
if( ParentComponent!=None ) if (ParentComponent != None)
return ParentComponent.BringPageToFront(); return ParentComponent.BringPageToFront();
return true; // Allow user to bring this page to front. return true; // Allow user to bring this page to front.
} }
final function bool IsTopMenu() final function bool IsTopMenu()
{ {
return (Owner.ActiveMenus.Length>0 && GetPageTop()==Owner.ActiveMenus[0]); return (Owner.ActiveMenus.Length > 0 && GetPageTop() == Owner.ActiveMenus[0]);
} }
final function KFGUI_Page GetPageTop() final function KFGUI_Page GetPageTop()
{ {
local KFGUI_Base M; 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); 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 Self;
return None; return None;
} }
function FindAllComponentID( name InID, out array<KFGUI_Base> Res ) function FindAllComponentID( name InID, out array < KFGUI_Base> Res)
{ {
if( ID==InID ) if (ID == InID)
Res[Res.Length] = Self; Res[Res.Length] = Self;
} }
function RemoveComponent( KFGUI_Base B ); function RemoveComponent( KFGUI_Base B );
function GetInputFocus() function GetInputFocus()
{ {
if( Owner.InputFocus!=None ) if (Owner.InputFocus != None)
Owner.InputFocus.LostInputFocus(); Owner.InputFocus.LostInputFocus();
Owner.InputFocus = Self; Owner.InputFocus = Self;
} }
function DropInputFocus() function DropInputFocus()
{ {
if( Owner.InputFocus==Self ) if (Owner.InputFocus == Self)
{ {
Owner.InputFocus.LostInputFocus(); Owner.InputFocus.LostInputFocus();
Owner.InputFocus = None; Owner.InputFocus = None;
@ -222,20 +222,20 @@ final function GrabKeyFocus()
} }
final function ReleaseKeyFocus() final function ReleaseKeyFocus()
{ {
if( Owner.KeyboardFocus==Self ) if (Owner.KeyboardFocus == Self)
Owner.GrabInputFocus(None); Owner.GrabInputFocus(None);
} }
function LostKeyFocus(); 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 'XboxTypeS_Start':
case 'Escape': case 'Escape':
if( Event==IE_Pressed ) if (Event == IE_Pressed)
UserPressedEsc(); UserPressedEsc();
return true; return true;
case 'XboxTypeS_DPad_Up': case 'XboxTypeS_DPad_Up':
@ -246,19 +246,19 @@ function bool NotifyInputKey( int ControllerId, name Key, EInputEvent Event, flo
case 'MouseScrollUp': case 'MouseScrollUp':
case 'MouseScrollDown': case 'MouseScrollDown':
case 'MouseScrollUp': case 'MouseScrollUp':
if( Event==IE_Pressed ) if (Event == IE_Pressed)
ScrollMouseWheel(Key=='MouseScrollUp' || Key=='XboxTypeS_DPad_Up' || Key=='XboxTypeS_DPad_Left'); ScrollMouseWheel(Key == 'MouseScrollUp' || Key == 'XboxTypeS_DPad_Up' || Key == 'XboxTypeS_DPad_Left');
return true; return true;
} }
} }
return false; 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; return false;
} }
function bool NotifyInputChar( int ControllerId, string Unicode ) function bool NotifyInputChar( int ControllerId, string Unicode)
{ {
return false; return false;
} }
@ -269,25 +269,25 @@ function InputMouseMoved();
// Notify any focused menu element that mouse has been idle over it. // Notify any focused menu element that mouse has been idle over it.
function NotifyMousePaused(); 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]; X = ((XPosition+X)*InputPos[2]) + InputPos[0];
Y = ((YPosition+Y)*InputPos[3]) + InputPos[1]; 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]; X = X / CompPos[2];
Y = Y / CompPos[2]; Y = Y / CompPos[2];
} }
simulated final function PlayMenuSound( EMenuSound Slot ) simulated final function PlayMenuSound( EMenuSound Slot)
{ {
local SoundCue S; local SoundCue S;
local KFGameEngine Engine; local KFGameEngine Engine;
Engine = KFGameEngine(class'Engine'.static.GetEngine()); Engine = KFGameEngine(class'Engine'.static.GetEngine());
switch( Slot ) switch( Slot)
{ {
case MN_FocusHover: case MN_FocusHover:
case MN_Focus: case MN_Focus:
@ -308,7 +308,7 @@ simulated final function PlayMenuSound( EMenuSound Slot )
break; break;
} }
if( S!=None ) if (S != None)
{ {
S.VolumeMultiplier = (Engine.SFxVolumeMultiplier/100.f) * (Engine.MasterVolumeMultiplier/100.f); S.VolumeMultiplier = (Engine.SFxVolumeMultiplier/100.f) * (Engine.MasterVolumeMultiplier/100.f);
GetPlayer().PlaySound(S,true,,false); GetPlayer().PlaySound(S,true,,false);
@ -318,7 +318,7 @@ simulated final function PlayMenuSound( EMenuSound Slot )
// Pre level change notification. // Pre level change notification.
function NotifyLevelChange(); 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; XPosition = X;
YPosition = Y; YPosition = Y;
@ -326,7 +326,7 @@ final function SetPosition( float X, float Y, float XS, float YS )
YSize = YS; YSize = YS;
} }
static final function string MakeSortStr( int Value ) static final function string MakeSortStr( int Value)
{ {
local string S; local string S;
local int i; local int i;
@ -334,7 +334,7 @@ static final function string MakeSortStr( int Value )
// Prefix with zeroes to properly sort this string. // Prefix with zeroes to properly sort this string.
S = string(Value); S = string(Value);
i = Len(S); i = Len(S);
if( i<10 ) if (i < 10)
return Mid("0000000000",i)$S; return Mid("0000000000",i)$S;
return S; return S;
} }

View File

@ -21,9 +21,9 @@ function bool GetUsingGamepad()
return Owner.bUsingGamepad && GamepadButtonName != ""; return Owner.bUsingGamepad && GamepadButtonName != "";
} }
function HandleMouseClick( bool bRight ) function HandleMouseClick( bool bRight)
{ {
if( bRight ) if (bRight)
OnClickRight(Self); OnClickRight(Self);
else OnClickLeft(Self); else OnClickLeft(Self);
} }

View File

@ -15,37 +15,37 @@ function DrawMenu()
local bool bDrawOverride; local bool bDrawOverride;
bDrawOverride = DrawOverride(Canvas, Self); bDrawOverride = DrawOverride(Canvas, Self);
if( !bDrawOverride ) if (!bDrawOverride)
{ {
if( bDisabled ) if (bDisabled)
Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_DISABLED]; Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_DISABLED];
else if( bPressedDown ) else if (bPressedDown)
Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_PRESSED]; Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_PRESSED];
else if( bFocused || bIsHighlighted ) else if (bFocused || bIsHighlighted)
Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_NORMAL]; Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_NORMAL];
else Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_HIGHLIGHTED]; else Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_HIGHLIGHTED];
Canvas.SetPos(0.f,0.f); Canvas.SetPos(0.f,0.f);
Canvas.DrawTileStretched(Mat,CompPos[2],CompPos[3],0,0,32,32); 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.SetPos(0.f,0.f);
Canvas.DrawTile(OverlayTexture.Texture,CompPos[2],CompPos[3],OverlayTexture.U,OverlayTexture.V,OverlayTexture.UL,OverlayTexture.VL); 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; Canvas.Font = Owner.CurrentStyle.MainFont;
TS = Owner.CurrentStyle.GetFontScaler(); TS = Owner.CurrentStyle.GetFontScaler();
TS *= FontScale; TS *= FontScale;
while( true ) while( true)
{ {
Canvas.TextSize(ButtonText,XL,YL,TS,TS); 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; break;
TS -= 0.001; TS -= 0.001;
@ -55,12 +55,12 @@ function DrawMenu()
TextY = (CompPos[3]-YL)*0.5; TextY = (CompPos[3]-YL)*0.5;
Canvas.SetPos(TextX, TextY); Canvas.SetPos(TextX, TextY);
if( bDisabled ) if (bDisabled)
Canvas.DrawColor = TextColor*0.5f; Canvas.DrawColor = TextColor*0.5f;
else Canvas.DrawColor = TextColor; else Canvas.DrawColor = TextColor;
Canvas.DrawText(ButtonText,,TS,TS,TextFontInfo); Canvas.DrawText(ButtonText,,TS,TS,TextFontInfo);
if( Icon != None ) if (Icon != None)
{ {
Canvas.DrawColor = IconColor; Canvas.DrawColor = IconColor;

View File

@ -10,7 +10,7 @@ struct FCategoryItems
var name ID; var name ID;
var KFGUI_Base Item; var KFGUI_Base Item;
}; };
var array<FCategoryItems> 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) 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; B.OnClickRight = SelectedCategory;
} }
function KFGUI_Base AddItemToCategory(name CatID, class<KFGUI_Base> Item) function KFGUI_Base AddItemToCategory(name CatID, class < KFGUI_Base> Item)
{ {
local FCategoryItems CatItem; local FCategoryItems CatItem;
local KFGUI_Base G; local KFGUI_Base G;
@ -48,28 +48,28 @@ function SelectedCategory(KFGUI_Button Sender)
local KFGUI_CategoryButton CatB; local KFGUI_CategoryButton CatB;
CatB = KFGUI_CategoryButton(Sender); CatB = KFGUI_CategoryButton(Sender);
if( CatB == None ) if (CatB == None)
return; return;
Index = ItemComponents.Find(Sender); Index = ItemComponents.Find(Sender);
if( Index != INDEX_NONE ) if (Index != INDEX_NONE)
{ {
if( !CatB.bOpened ) if (!CatB.bOpened)
{ {
CatB.bOpened = true; CatB.bOpened = true;
j = Index+1; j = Index+1;
for( i=0; i<CategoryItems.Length; i++ ) for (i=0; i < CategoryItems.Length; i++)
{ {
if( CategoryItems[i].ID == CatB.ID ) if (CategoryItems[i].ID == CatB.ID)
AddItemAtIndex(j++, CategoryItems[i].Item); AddItemAtIndex(j++, CategoryItems[i].Item);
} }
} }
else else
{ {
CatB.bOpened = false; CatB.bOpened = false;
for( i=0; i<CategoryItems.Length; i++ ) for (i=0; i < CategoryItems.Length; i++)
{ {
if( CategoryItems[i].ID == CatB.ID ) if (CategoryItems[i].ID == CatB.ID)
ItemComponents.RemoveItem(CategoryItems[i].Item); ItemComponents.RemoveItem(CategoryItems[i].Item);
} }
} }
@ -80,9 +80,9 @@ function EmptyList()
{ {
local int i; local int i;
for( i=0; i<ItemComponents.Length; i++ ) for (i=0; i < ItemComponents.Length; i++)
{ {
if( KFGUI_CategoryButton(ItemComponents[i]) == None ) if (KFGUI_CategoryButton(ItemComponents[i]) == None)
ItemComponents.Remove(i, 1); ItemComponents.Remove(i, 1);
} }
CategoryItems.Length = 0; CategoryItems.Length = 0;

View File

@ -10,7 +10,7 @@ var() bool bForceUniform,bChecked;
function UpdateSizes() function UpdateSizes()
{ {
Super.UpdateSizes(); Super.UpdateSizes();
if( bForceUniform ) if (bForceUniform)
XSize = (YSize*InputPos[3]) / InputPos[2]; XSize = (YSize*InputPos[3]) / InputPos[2];
} }
@ -19,7 +19,7 @@ function DrawMenu()
Owner.CurrentStyle.RenderCheckbox(Self); Owner.CurrentStyle.RenderCheckbox(Self);
} }
function HandleMouseClick( bool bRight ) function HandleMouseClick( bool bRight)
{ {
bChecked = !bChecked; bChecked = !bChecked;
OnCheckChange(Self); OnCheckChange(Self);

View File

@ -20,21 +20,21 @@ function InitMenu()
Super.InitMenu(); Super.InitMenu();
bClickable = !bDisabled; bClickable = !bDisabled;
} }
function MouseClick( bool bRight ) function MouseClick( bool bRight)
{ {
if( !bDisabled ) if (!bDisabled)
{ {
PressedDown[byte(bRight)] = 1; PressedDown[byte(bRight)] = 1;
bPressedDown = true; bPressedDown = true;
} }
} }
function MouseRelease( bool bRight ) function MouseRelease( bool bRight)
{ {
if( !bDisabled && PressedDown[byte(bRight)]==1 ) if (!bDisabled && PressedDown[byte(bRight)] == 1)
{ {
PlayMenuSound(MN_ClickButton); PlayMenuSound(MN_ClickButton);
PressedDown[byte(bRight)] = 0; PressedDown[byte(bRight)] = 0;
bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0); bPressedDown = (PressedDown[0] != 0 || PressedDown[1] != 0);
HandleMouseClick(bRight); HandleMouseClick(bRight);
} }
} }
@ -48,11 +48,11 @@ function MouseLeave()
function MouseEnter() function MouseEnter()
{ {
Super.MouseEnter(); Super.MouseEnter();
if( !bDisabled && bHoverSound ) if (!bDisabled && bHoverSound)
PlayMenuSound(MN_FocusHover); PlayMenuSound(MN_FocusHover);
} }
function SetDisabled( bool bDisable ) function SetDisabled( bool bDisable)
{ {
Super.SetDisabled(bDisable); Super.SetDisabled(bDisable);
bClickable = !bDisable; bClickable = !bDisable;
@ -63,9 +63,9 @@ function SetDisabled( bool bDisable )
function NotifyMousePaused() function NotifyMousePaused()
{ {
if( Owner.InputFocus==None && ToolTip!="" ) if (Owner.InputFocus == None && ToolTip != "")
{ {
if( ToolTipItem==None ) if (ToolTipItem == None)
{ {
ToolTipItem = New(None)Class'KFGUI_Tooltip'; ToolTipItem = New(None)Class'KFGUI_Tooltip';
ToolTipItem.Owner = Owner; ToolTipItem.Owner = Owner;
@ -79,9 +79,9 @@ function NotifyMousePaused()
ToolTipItem.GetInputFocus(); ToolTipItem.GetInputFocus();
} }
} }
final function ChangeToolTip( string S ) final function ChangeToolTip( string S)
{ {
if( ToolTipItem!=None ) if (ToolTipItem != None)
ToolTipItem.SetText(S); ToolTipItem.SetText(S);
else ToolTip = S; else ToolTip = S;
} }

View File

@ -42,7 +42,7 @@ function SetDefaultColor(Color Def)
ASlider.UpdateListVis(); ASlider.UpdateListVis();
} }
final function KFGUI_Slider AddSlider( string Cap, name IDN, int MinValue, int MaxValue, out KFGUI_TextLable Label, out KFGUI_TextLable ColorValueLabel ) final function KFGUI_Slider AddSlider( string Cap, name IDN, int MinValue, int MaxValue, out KFGUI_TextLable Label, out KFGUI_TextLable ColorValueLabel)
{ {
local KFGUI_Slider SL; local KFGUI_Slider SL;
local KFGUI_MultiComponent MC; local KFGUI_MultiComponent MC;

View File

@ -13,8 +13,8 @@ struct FColumnItem
var transient bool bHidden; var transient bool bHidden;
var transient int X,XSize; var transient int X,XSize;
}; };
var() array<FColumnItem> Columns; var() array < FColumnItem> Columns;
var() class<KFGUI_ListItem> ListItemClass; var() class < KFGUI_ListItem> ListItemClass;
var() float FontSize; var() float FontSize;
var() color FocusedLineColor,SelectedLineColor; var() color FocusedLineColor,SelectedLineColor;
var() float EdgeSize; 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 ); 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 KFGUI_ListItem N,O;
local int i; local int i;
// Allocate list item object. // Allocate list item object.
if( UnusedItem!=None ) if (UnusedItem != None)
{ {
N = UnusedItem; N = UnusedItem;
UnusedItem = N.Next; UnusedItem = N.Next;
@ -54,27 +54,27 @@ function KFGUI_ListItem AddLine( string Value, optional int iValue, optional str
N.SetValue(Value,iValue,SortValue); N.SetValue(Value,iValue,SortValue);
// Insert into list. // Insert into list.
if( bShouldSortList && Index==-1 ) if (bShouldSortList && Index == -1)
{ {
N.Temp = N.GetSortStr(LastSortedColumn); N.Temp = N.GetSortStr(LastSortedColumn);
if( ListCount==0 ) // No sorting needed yet. if (ListCount == 0 ) // No sorting needed yet.
{ {
N.Next = FirstItem; N.Next = FirstItem;
FirstItem = N; FirstItem = N;
} }
else if( bLastSortedReverse ) else if (bLastSortedReverse)
{ {
if( FirstItem.Temp<N.Temp ) if (FirstItem.Temp < N.Temp)
{ {
N.Next = FirstItem; N.Next = FirstItem;
FirstItem = N; FirstItem = N;
} }
else 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; N.Next = O.Next;
O.Next = N; O.Next = N;
@ -83,16 +83,16 @@ function KFGUI_ListItem AddLine( string Value, optional int iValue, optional str
} }
} }
} }
else if( FirstItem.Temp>N.Temp ) else if (FirstItem.Temp > N.Temp)
{ {
N.Next = FirstItem; N.Next = FirstItem;
FirstItem = N; FirstItem = N;
} }
else 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; N.Next = O.Next;
O.Next = N; 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; Index = ListCount;
if( Index==0 ) if (Index == 0)
{ {
N.Next = FirstItem; N.Next = FirstItem;
FirstItem = N; FirstItem = N;
@ -111,9 +111,9 @@ function KFGUI_ListItem AddLine( string Value, optional int iValue, optional str
else else
{ {
i = 0; 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; N.Next = O.Next;
O.Next = N; O.Next = N;
@ -125,26 +125,26 @@ function KFGUI_ListItem AddLine( string Value, optional int iValue, optional str
return N; return N;
} }
final function RemoveLine( KFGUI_ListItem I ) final function RemoveLine( KFGUI_ListItem I)
{ {
local KFGUI_ListItem N; local KFGUI_ListItem N;
if( I.Index==-1 ) if (I.Index == -1)
return; return;
// Update selected row info. // Update selected row info.
if( SelectedRowIndex==I.Index ) if (SelectedRowIndex == I.Index)
SelectedRowIndex = -1; SelectedRowIndex = -1;
else if( SelectedRowIndex>I.Index ) else if (SelectedRowIndex > I.Index)
--SelectedRowIndex; --SelectedRowIndex;
// Remove from list. // Remove from list.
if( FirstItem==I ) if (FirstItem == I)
FirstItem = I.Next; FirstItem = I.Next;
else else
{ {
for( N=FirstItem; N!=None; N=N.Next ) for (N=FirstItem; N != None; N=N.Next)
if( N.Next==I ) if (N.Next == I)
{ {
N.Next = I.Next; N.Next = I.Next;
break; break;
@ -162,7 +162,7 @@ final function EmptyList()
{ {
local KFGUI_ListItem N,I; local KFGUI_ListItem N,I;
for( I=FirstItem; I!=None; I=N ) for (I=FirstItem; I != None; I=N)
{ {
N = I.Next; N = I.Next;
@ -176,25 +176,25 @@ final function EmptyList()
UpdateListSize(); UpdateListSize();
} }
final function KFGUI_ListItem GetFromIndex( int Index ) final function KFGUI_ListItem GetFromIndex( int Index)
{ {
local KFGUI_ListItem N; local KFGUI_ListItem N;
if( Index<0 || Index>=ListCount ) if (Index < 0 || Index >= ListCount)
return None; return None;
for( N=FirstItem; N!=None; N=N.Next ) for (N=FirstItem; N != None; N=N.Next)
if( (Index--)==0 ) if ((Index--) == 0)
return N; return N;
return None; return None;
} }
function SortColumn( int Column, optional bool bReverse ) function SortColumn( int Column, optional bool bReverse)
{ {
local array<KFGUI_ListItem> List; local array < KFGUI_ListItem> List;
local KFGUI_ListItem Sel,N,P; local KFGUI_ListItem Sel,N,P;
local int i; local int i;
if( !bCanSortColumn || Column<0 || Column>=Columns.Length ) if (!bCanSortColumn || Column < 0 || Column >= Columns.Length)
return; return;
LastSortedColumn = Column; LastSortedColumn = Column;
@ -210,20 +210,20 @@ function SortColumn( int Column, optional bool bReverse )
SelectedRowIndex = -1; SelectedRowIndex = -1;
// Slow, sort it all. // 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); N.Temp = N.GetSortStr(Column);
if( bReverse ) if (bReverse)
{ {
for( i=0; i<List.Length; ++i ) for (i=0; i < List.Length; ++i)
if( List[i].Temp<N.Temp ) if (List[i].Temp < N.Temp)
break; break;
} }
else else
{ {
for( i=0; i<List.Length; ++i ) for (i=0; i < List.Length; ++i)
if( List[i].Temp>N.Temp ) if (List[i].Temp > N.Temp)
break; break;
} }
List.Insert(i,1); List.Insert(i,1);
@ -233,14 +233,14 @@ function SortColumn( int Column, optional bool bReverse )
// Rebuild list. // Rebuild list.
FirstItem = None; FirstItem = None;
P = None; P = None;
for( i=0; i<List.Length; ++i ) for (i=0; i < List.Length; ++i)
{ {
N = List[i]; N = List[i];
if( Sel==N ) if (Sel == N)
SelectedRowIndex = i; SelectedRowIndex = i;
N.Index = i; N.Index = i;
N.Next = None; N.Next = None;
if( P==None ) if (P == None)
FirstItem = N; FirstItem = N;
else P.Next = N; else P.Next = N;
P = N; P = N;
@ -254,7 +254,7 @@ final function UpdateListSize()
local KFGUI_ListItem N; local KFGUI_ListItem N;
ListCount = 0; ListCount = 0;
for( N=FirstItem; N!=None; N=N.Next ) for (N=FirstItem; N != None; N=N.Next)
N.Index = ListCount++; N.Index = ListCount++;
bListSizeDirty = true; bListSizeDirty = true;
} }
@ -266,7 +266,7 @@ function InitMenu()
ColumnComp = KFGUI_ColumnTop(FindComponentID('Columns')); ColumnComp = KFGUI_ColumnTop(FindComponentID('Columns'));
} }
final function DrawStrClipped( string S, optional bool bOnlyTextures ) final function DrawStrClipped( string S, optional bool bOnlyTextures)
{ {
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY); Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
Owner.CurrentStyle.DrawTexturedString(S,Canvas.CurX,Canvas.CurY,TextScaler,LineFontInfo,false,bOnlyTextures); Owner.CurrentStyle.DrawTexturedString(S,Canvas.CurX,Canvas.CurY,TextScaler,LineFontInfo,false,bOnlyTextures);
@ -287,38 +287,38 @@ function DrawMenu()
// Mouse focused item check. // Mouse focused item check.
bCheckMouse = bClickable && bFocused; bCheckMouse = bClickable && bFocused;
FocusMouseItem = -1; FocusMouseItem = -1;
if( bCheckMouse ) if (bCheckMouse)
MouseYHit = Owner.MousePosition.Y - CompPos[1]; MouseYHit = Owner.MousePosition.Y - CompPos[1];
n = ScrollBar.CurrentScroll; n = ScrollBar.CurrentScroll;
i = 0; i = 0;
for( C=FirstItem; C!=None; C=C.Next ) for (C=FirstItem; C != None; C=C.Next)
if( (i++)==n ) if ((i++) == n)
break; break;
Y = 0.f; Y = 0.f;
TextY = (ItemHeight-TextHeight)*0.5f; TextY = (ItemHeight-TextHeight)*0.5f;
XOffset = TextY*0.75; XOffset = TextY*0.75;
Canvas.SetDrawColor(250,250,250,255); Canvas.SetDrawColor(250,250,250,255);
for( i=0; (i<ListItemsPerPage && C!=None); ++i ) for (i=0; (i < ListItemsPerPage && C != None); ++i)
{ {
// Check for mouse hit. // Check for mouse hit.
if( bCheckMouse && FocusMouseItem==-1 ) if (bCheckMouse && FocusMouseItem == -1)
{ {
if( MouseYHit<ItemHeight ) if (MouseYHit < ItemHeight)
FocusMouseItem = n; FocusMouseItem = n;
else MouseYHit-=ItemHeight; else MouseYHit -= ItemHeight;
} }
// Draw selection background. // Draw selection background.
if( SelectedRowIndex==n ) // Selected if (SelectedRowIndex == n ) // Selected
{ {
Canvas.SetPos(EdgeSize,Y); Canvas.SetPos(EdgeSize,Y);
Canvas.DrawColor = SelectedLineColor; Canvas.DrawColor = SelectedLineColor;
Owner.CurrentStyle.DrawWhiteBox(CompPos[2]-(EdgeSize*2),ItemHeight); Owner.CurrentStyle.DrawWhiteBox(CompPos[2]-(EdgeSize*2),ItemHeight);
Canvas.SetDrawColor(250,250,250,255); Canvas.SetDrawColor(250,250,250,255);
} }
else if( FocusMouseItem==n ) // Focused else if (FocusMouseItem == n ) // Focused
{ {
Canvas.SetPos(EdgeSize,Y); Canvas.SetPos(EdgeSize,Y);
Canvas.DrawColor = FocusedLineColor; Canvas.DrawColor = FocusedLineColor;
@ -327,8 +327,8 @@ function DrawMenu()
} }
// Draw columns of text // Draw columns of text
for( j=0; j<Columns.Length; ++j ) for (j=0; j < Columns.Length; ++j)
if( !Columns[j].bHidden ) if (!Columns[j].bHidden)
{ {
//Canvas.SetClip(Columns[j].X+Columns[j].XSize+EdgeSize,YClip); //Canvas.SetClip(Columns[j].X+Columns[j].XSize+EdgeSize,YClip);
Canvas.SetPos(Columns[j].X+XOffset+EdgeSize,TextY); Canvas.SetPos(Columns[j].X+XOffset+EdgeSize,TextY);
@ -346,7 +346,7 @@ function PreDraw()
local byte j; local byte j;
local float XS,SpaceX; local float XS,SpaceX;
if( !bVisible ) if (!bVisible)
return; return;
ComputeCoords(); ComputeCoords();
@ -356,7 +356,7 @@ function PreDraw()
TextScaler *= FontSize; TextScaler *= FontSize;
Canvas.TextSize("ABC",XS,TextHeight,TextScaler,TextScaler); Canvas.TextSize("ABC",XS,TextHeight,TextScaler,TextScaler);
for( j=0; j<4; ++j ) for (j=0; j < 4; ++j)
{ {
ScrollBar.InputPos[j] = CompPos[j]; ScrollBar.InputPos[j] = CompPos[j];
ColumnComp.InputPos[j] = CompPos[j]; ColumnComp.InputPos[j] = CompPos[j];
@ -364,7 +364,7 @@ function PreDraw()
// Setup positioning. // Setup positioning.
// First compute the width scrollbar. // First compute the width scrollbar.
if( OldXSize!=InputPos[2] ) if (OldXSize != InputPos[2])
{ {
OldXSize = InputPos[2]; OldXSize = InputPos[2];
ScalerSize = ScrollBar.GetWidth(); ScalerSize = ScrollBar.GetWidth();
@ -388,9 +388,9 @@ function PreDraw()
ItemHeight = TextHeight*1.025; ItemHeight = TextHeight*1.025;
ListItemsPerPage = CompPos[3]/ItemHeight; ListItemsPerPage = CompPos[3]/ItemHeight;
ItemHeight = CompPos[3]/ListItemsPerPage; ItemHeight = CompPos[3]/ListItemsPerPage;
if( OldItemsPerFrame!=ListItemsPerPage || bListSizeDirty ) if (OldItemsPerFrame != ListItemsPerPage || bListSizeDirty)
{ {
if( SelectedRowIndex>=ListCount ) if (SelectedRowIndex >= ListCount)
SelectedRowIndex = -1; SelectedRowIndex = -1;
OldItemsPerFrame = ListItemsPerPage; OldItemsPerFrame = ListItemsPerPage;
bListSizeDirty = false; bListSizeDirty = false;
@ -411,12 +411,12 @@ function PreDraw()
CompPos[2] += SpaceX; CompPos[2] += SpaceX;
CompPos[3] += ColumnComp.CompPos[3]; 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; SelectedRowIndex = Index;
OnSelectedRow(GetFromIndex(Index),Index,bRight,false); 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; SelectedRowIndex = Index;
OnSelectedRow(GetFromIndex(Index),Index,bRight,true); OnSelectedRow(GetFromIndex(Index),Index,bRight,true);

View File

@ -27,37 +27,37 @@ function DrawMenu()
MinSize = ColumnMinSize / CompPos[2]; MinSize = ColumnMinSize / CompPos[2];
// Scale column // Scale column
if( bScaleColumn ) if (bScaleColumn)
{ {
MouseX = Owner.MousePosition.X - CompPos[0]; MouseX = Owner.MousePosition.X - CompPos[0];
for( i=0; i<ScalingColumn; ++i ) for (i=0; i < ScalingColumn; ++i)
MouseX-=(ListOwner.Columns[i].Width * CompPos[2]); MouseX -= (ListOwner.Columns[i].Width * CompPos[2]);
ListOwner.Columns[ScalingColumn].Width = MouseX / CompPos[2]; ListOwner.Columns[ScalingColumn].Width = MouseX / CompPos[2];
// Make sure no column is scrolled off screen. // Make sure no column is scrolled off screen.
X = 0; X = 0;
for( i=0; i<(ListOwner.Columns.Length-1); ++i ) for (i=0; i < (ListOwner.Columns.Length-1); ++i)
{ {
if( ListOwner.Columns[i].Width<MinSize ) if (ListOwner.Columns[i].Width < MinSize)
ListOwner.Columns[i].Width = MinSize; ListOwner.Columns[i].Width = MinSize;
X+=ListOwner.Columns[i].Width; X+=ListOwner.Columns[i].Width;
if( X>=(1.f-MinSize) ) if (X >= (1.f-MinSize))
{ {
MouseX = X-(1.f-MinSize); // Grab overshoot. MouseX = X-(1.f-MinSize); // Grab overshoot.
// Then push back! // 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; MouseX = 0;
break; 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; ListOwner.Columns[j].Width = MinSize;
} }
} }
@ -69,7 +69,7 @@ function DrawMenu()
// Init mouse check. // Init mouse check.
MouseColumn = -1; MouseColumn = -1;
bCheckMouse = (bClickable && bFocused); bCheckMouse = (bClickable && bFocused);
if( bCheckMouse ) if (bCheckMouse)
{ {
GrabWidth = CompPos[3]*0.175; GrabWidth = CompPos[3]*0.175;
MouseX = Owner.MousePosition.X - CompPos[0] - GrabWidth; MouseX = Owner.MousePosition.X - CompPos[0] - GrabWidth;
@ -79,17 +79,17 @@ function DrawMenu()
// Draw the columns and compute the scalings. // Draw the columns and compute the scalings.
X = 0; X = 0;
j = (ListOwner.bShouldSortList ? ListOwner.LastSortedColumn : -1); j = (ListOwner.bShouldSortList ? ListOwner.LastSortedColumn : -1);
for( i=0; i<ListOwner.Columns.Length; ++i ) for (i=0; i < ListOwner.Columns.Length; ++i)
{ {
if( ListOwner.Columns[i].Width<MinSize ) if (ListOwner.Columns[i].Width < MinSize)
ListOwner.Columns[i].Width = MinSize; ListOwner.Columns[i].Width = MinSize;
Wd = ListOwner.Columns[i].Width * CompPos[2]; Wd = ListOwner.Columns[i].Width * CompPos[2];
if( i==(ListOwner.Columns.Length-1) ) // Final column, give infinitive width. if (i == (ListOwner.Columns.Length-1) ) // Final column, give infinitive width.
{ {
Wd = (CompPos[2]-X); Wd = (CompPos[2]-X);
} }
if( Wd<=0 ) // Impossible. if (Wd <= 0 ) // Impossible.
{ {
ListOwner.Columns[i].bHidden = true; ListOwner.Columns[i].bHidden = true;
continue; continue;
@ -98,14 +98,14 @@ function DrawMenu()
ListOwner.Columns[i].X = X; ListOwner.Columns[i].X = X;
ListOwner.Columns[i].XSize = Wd; ListOwner.Columns[i].XSize = Wd;
if( bCheckMouse && (MouseX-=Wd)<=0.f ) if (bCheckMouse && (MouseX -= Wd) <= 0.f)
{ {
MouseColumn = i; MouseColumn = i;
bCheckMouse = false; bCheckMouse = false;
bMouseScaler = (MouseX>=GrabWidth) && ((i+1)<ListOwner.Columns.Length); bMouseScaler = (MouseX >= GrabWidth) && ((i+1) < ListOwner.Columns.Length);
} }
if( X>=CompPos[2] ) if (X >= CompPos[2])
ListOwner.Columns[i].bHidden = true; ListOwner.Columns[i].bHidden = true;
else else
{ {
@ -113,13 +113,13 @@ function DrawMenu()
//Canvas.SetClip(X+Wd,CompPos[1]+CompPos[3]); //Canvas.SetClip(X+Wd,CompPos[1]+CompPos[3]);
// Draw column. // Draw column.
if( i==j ) if (i == j)
{ {
if( MouseColumn==i && !bMouseScaler ) if (MouseColumn == i && !bMouseScaler)
Canvas.SetDrawColor(175,240,8,255); Canvas.SetDrawColor(175,240,8,255);
else Canvas.SetDrawColor(128,200,56,255); else Canvas.SetDrawColor(128,200,56,255);
} }
else if( MouseColumn==i && !bMouseScaler ) else if (MouseColumn == i && !bMouseScaler)
Canvas.SetDrawColor(220,220,8,255); Canvas.SetDrawColor(220,220,8,255);
XS = Owner.CurrentStyle.DefaultHeight*0.5; 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; PressedDown[byte(bRight)] = 1;
bPressedDown = true; bPressedDown = true;
if( !bRight && bMouseScaler ) if (!bRight && bMouseScaler)
{ {
PlayMenuSound(MN_ClickButton); PlayMenuSound(MN_ClickButton);
bScaleColumn = true; 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; bScaleColumn = false;
DropInputFocus(); DropInputFocus();
return; return;
} }
if( !bDisabled && bClickable && PressedDown[byte(bRight)]==1 ) if (!bDisabled && bClickable && PressedDown[byte(bRight)] == 1)
{ {
PlayMenuSound(MN_ClickButton); PlayMenuSound(MN_ClickButton);
PressedDown[byte(bRight)] = 0; 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)); ListOwner.SortColumn(MouseColumn,(PrevSortedColumn == MouseColumn));
if( PrevSortedColumn==MouseColumn ) if (PrevSortedColumn == MouseColumn)
PrevSortedColumn = -1; PrevSortedColumn = -1;
else PrevSortedColumn = MouseColumn; else PrevSortedColumn = MouseColumn;
} }
@ -175,14 +175,14 @@ function MouseRelease( bool bRight )
} }
function byte GetCursorStyle() function byte GetCursorStyle()
{ {
if( bClickable ) if (bClickable)
return (bMouseScaler ? 2 : 1); return (bMouseScaler ? 2 : 1);
return 0; return 0;
} }
function MouseLeave() function MouseLeave()
{ {
Super.MouseLeave(); Super.MouseLeave();
if( !bScaleColumn ) if (!bScaleColumn)
{ {
PressedDown[0] = 0; PressedDown[0] = 0;
PressedDown[1] = 0; PressedDown[1] = 0;

View File

@ -6,7 +6,7 @@ Class KFGUI_ComboBox extends KFGUI_EditControl;
var KFGUI_ComboSelector Selection; var KFGUI_ComboSelector Selection;
var float BorderSize; var float BorderSize;
var() array<string> Values; var() array < string> Values;
var() int SelectedIndex; var() int SelectedIndex;
var() color SelectedTextColor,TextColor; var() color SelectedTextColor,TextColor;
var() bool bButtonStretched; var() bool bButtonStretched;
@ -14,7 +14,7 @@ var() bool bButtonStretched;
function UpdateSizes() function UpdateSizes()
{ {
// Update height. // Update height.
if( bScaleByFontSize ) if (bScaleByFontSize)
YSize = (TextHeight + (BorderSize*2)) / InputPos[3]; YSize = (TextHeight + (BorderSize*2)) / InputPos[3];
} }
@ -23,10 +23,10 @@ function DrawMenu()
Owner.CurrentStyle.RenderComboBox(Self); Owner.CurrentStyle.RenderComboBox(Self);
} }
function HandleMouseClick( bool bRight ) function HandleMouseClick( bool bRight)
{ {
PlayMenuSound(MN_Dropdown); PlayMenuSound(MN_Dropdown);
if( Selection==None ) if (Selection == None)
{ {
Selection = New(None)Class'KFGUI_ComboSelector'; Selection = New(None)Class'KFGUI_ComboSelector';
Selection.Owner = Owner; Selection.Owner = Owner;
@ -37,22 +37,22 @@ function HandleMouseClick( bool bRight )
Selection.YPosition = (CompPos[1]+CompPos[3]) / Owner.ScreenSize.Y; Selection.YPosition = (CompPos[1]+CompPos[3]) / Owner.ScreenSize.Y;
Selection.XSize = CompPos[2] / Owner.ScreenSize.X; Selection.XSize = CompPos[2] / Owner.ScreenSize.X;
Selection.YSize = (TextHeight / Owner.ScreenSize.Y) * Values.Length + ((BorderSize*2) / Owner.ScreenSize.Y); Selection.YSize = (TextHeight / Owner.ScreenSize.Y) * Values.Length + ((BorderSize*2) / Owner.ScreenSize.Y);
if( (Selection.YPosition+Selection.YSize)>1.f ) if ((Selection.YPosition+Selection.YSize) > 1.f)
Selection.YPosition-=((Selection.YPosition+Selection.YSize)-1.f); Selection.YPosition -= ((Selection.YPosition+Selection.YSize)-1.f);
Selection.GetInputFocus(); Selection.GetInputFocus();
} }
final function string GetCurrent() final function string GetCurrent()
{ {
if( SelectedIndex<Values.Length ) if (SelectedIndex < Values.Length)
return Values[SelectedIndex]; return Values[SelectedIndex];
return ""; return "";
} }
final function bool SetValue( string S ) final function bool SetValue( string S)
{ {
local int i; local int i;
i = Values.Find(S); i = Values.Find(S);
if( i==-1 ) if (i == -1)
return false; return false;
SelectedIndex = i; SelectedIndex = i;
return true; return true;

View File

@ -11,11 +11,11 @@ function DrawMenu()
Owner.CurrentStyle.RenderComboList(Self); Owner.CurrentStyle.RenderComboList(Self);
} }
function HandleMouseClick( bool bRight ) function HandleMouseClick( bool bRight)
{ {
PlayMenuSound(MN_ClickButton); PlayMenuSound(MN_ClickButton);
DropInputFocus(); DropInputFocus();
if( CurrentRow>=0 ) if (CurrentRow >= 0)
{ {
Combo.SelectedIndex = CurrentRow; Combo.SelectedIndex = CurrentRow;
Combo.OnComboChanged(Combo); Combo.OnComboChanged(Combo);

View File

@ -6,20 +6,20 @@ Class KFGUI_ComponentList extends KFGUI_List;
var int VisRange[2]; var int VisRange[2];
var() int NumColumns; var() int NumColumns;
var array<KFGUI_Base> ItemComponents; var array < KFGUI_Base> ItemComponents;
// REMEMBER to call InitMenu() on the newly created component after values are init!!! // REMEMBER to call InitMenu() on the newly created component after values are init!!!
final function KFGUI_Base AddListComponent( class<KFGUI_Base> 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); return AddComponentAtIndex(ItemComponents.Length, CompClass, XS, YS);
} }
final function KFGUI_Base CreateComponent(class<KFGUI_Base> 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; local KFGUI_Base G;
G = new(Self)CompClass; G = new(Self)CompClass;
if( G==None ) if (G == None)
return None; return None;
G.XPosition = (1.f - XS) * 0.5f; G.XPosition = (1.f - XS) * 0.5f;
@ -30,17 +30,17 @@ final function KFGUI_Base CreateComponent(class<KFGUI_Base> CompClass, optional
return G; return G;
} }
final function AddItem( KFGUI_Base Item ) final function AddItem( KFGUI_Base Item)
{ {
AddItemAtIndex(ItemComponents.Length, 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); ItemComponents.InsertItem(i, Item);
} }
final function KFGUI_Base AddComponentAtIndex( int i, class<KFGUI_Base> 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; local KFGUI_Base G;
@ -66,7 +66,7 @@ function InitMenu()
function DrawMenu() function DrawMenu()
{ {
if( bDrawBackground ) if (bDrawBackground)
{ {
Canvas.SetDrawColor(250,250,250,255); Canvas.SetDrawColor(250,250,250,255);
Canvas.SetPos(0.f,0.f); Canvas.SetPos(0.f,0.f);
@ -79,25 +79,25 @@ function PreDraw()
local int i; local int i;
local byte j; local byte j;
if( !bVisible ) if (!bVisible)
return; return;
ComputeCoords(); ComputeCoords();
// Update list size // Update list size
i = ItemComponents.Length / NumColumns; i = ItemComponents.Length / NumColumns;
if( i!=NumColumns ) if (i != NumColumns)
{ {
ListCount = i; ListCount = i;
UpdateListVis(); UpdateListVis();
} }
if( !ScrollBar.bDisabled && !ScrollBar.bHideScrollbar ) if (!ScrollBar.bDisabled && !ScrollBar.bHideScrollbar)
{ {
// First draw scrollbar to allow it to resize itself. // 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]; ScrollBar.InputPos[j] = CompPos[j];
if( OldXSize!=InputPos[2] ) if (OldXSize != InputPos[2])
{ {
OldXSize = InputPos[2]; OldXSize = InputPos[2];
} }
@ -132,7 +132,7 @@ function PreDrawListItems()
YS = CompPos[3] / ListItemsPerPage; YS = CompPos[3] / ListItemsPerPage;
VisRange[0] = (ScrollBar.CurrentScroll*NumColumns); VisRange[0] = (ScrollBar.CurrentScroll*NumColumns);
VisRange[1] = ItemComponents.Length; VisRange[1] = ItemComponents.Length;
for( i=VisRange[0]; i<VisRange[1]; ++i ) for (i=VisRange[0]; i < VisRange[1]; ++i)
{ {
ItemComponents[i].Canvas = Canvas; ItemComponents[i].Canvas = Canvas;
ItemComponents[i].InputPos[0] = CompPos[0]+XS*XNum; ItemComponents[i].InputPos[0] = CompPos[0]+XS*XNum;
@ -141,10 +141,10 @@ function PreDrawListItems()
ItemComponents[i].InputPos[3] = YS; ItemComponents[i].InputPos[3] = YS;
ItemComponents[i].PreDraw(); ItemComponents[i].PreDraw();
if( ++XNum==NumColumns ) if (++XNum == NumColumns)
{ {
XNum = 0; XNum = 0;
if( ++r==ListItemsPerPage ) if (++r == ListItemsPerPage)
{ {
VisRange[1] = i+1; VisRange[1] = i+1;
break; break;
@ -170,11 +170,11 @@ function bool CaptureMouse()
{ {
local int i; local int i;
if( ItemComponents.Length > 0 ) if (ItemComponents.Length > 0)
{ {
for( i=VisRange[1] - 1; i>=VisRange[0] && i<ItemComponents.Length; i-- ) for (i=VisRange[1] - 1; i >= VisRange[0] && i < ItemComponents.Length; i--)
{ {
if( ItemComponents[i].CaptureMouse() ) if (ItemComponents[i].CaptureMouse())
{ {
MouseArea = ItemComponents[i]; MouseArea = ItemComponents[i];
return true; return true;
@ -188,7 +188,7 @@ function CloseMenu()
{ {
local int i; local int i;
for( i=0; i<ItemComponents.Length; ++i ) for (i=0; i < ItemComponents.Length; ++i)
ItemComponents[i].CloseMenu(); ItemComponents[i].CloseMenu();
Super.CloseMenu(); Super.CloseMenu();
} }
@ -196,7 +196,7 @@ function NotifyLevelChange()
{ {
local int i; local int i;
for( i=0; i<ItemComponents.Length; ++i ) for (i=0; i < ItemComponents.Length; ++i)
ItemComponents[i].NotifyLevelChange(); ItemComponents[i].NotifyLevelChange();
Super.NotifyLevelChange(); Super.NotifyLevelChange();
} }
@ -204,15 +204,15 @@ function InventoryChanged(optional KFWeapon Wep, optional bool bRemove)
{ {
local int i; local int i;
for( i=0; i<ItemComponents.Length; ++i ) for (i=0; i < ItemComponents.Length; ++i)
ItemComponents[i].InventoryChanged(Wep,bRemove); ItemComponents[i].InventoryChanged(Wep,bRemove);
} }
function MenuTick( float DeltaTime ) function MenuTick( float DeltaTime)
{ {
local int i; local int i;
Super.MenuTick(DeltaTime); Super.MenuTick(DeltaTime);
for( i=0; i<ItemComponents.Length; ++i ) for (i=0; i < ItemComponents.Length; ++i)
ItemComponents[i].MenuTick(DeltaTime); ItemComponents[i].MenuTick(DeltaTime);
} }

View File

@ -23,7 +23,7 @@ function InitMenu()
{ {
Super.InitMenu(); Super.InitMenu();
if ( bIntOnly || bFloatOnly ) if (bIntOnly || bFloatOnly)
{ {
AllowedCharSet = "0123456789"; AllowedCharSet = "0123456789";
@ -55,31 +55,31 @@ function bool NotifyInputChar(int Key, string Unicode)
if (bReadOnly) if (bReadOnly)
return false; return false;
if( UniCode!="" ) if (UniCode != "")
S = Unicode; S = Unicode;
else S = Chr(Key); else S = Chr(Key);
if( Asc(S) == 13 || Asc(S) == 8 || Asc(S) == 27 ) if (Asc(S) == 13 || Asc(S) == 8 || Asc(S) == 27)
return false; return false;
if( bCtrl ) if (bCtrl)
return false; return false;
if(bAllSelected) if (bAllSelected)
{ {
TextStr=""; TextStr="";
CaretPos=0; CaretPos=0;
bAllSelected=false; bAllSelected=false;
} }
if ( (AllowedCharSet=="") || ( (bIncludeSign) && ( (S=="-") || (S=="+") ) && (TextStr=="") ) || (InStr(AllowedCharSet,S)>=0) ) if ((AllowedCharSet == "") || ( (bIncludeSign) && ( (S == "-") || (S == "+") ) && (TextStr == "") ) || (InStr(AllowedCharSet,S) >= 0))
{ {
if ( (MaxWidth==0) || (Len(TextStr)<MaxWidth) ) if ((MaxWidth == 0) || (Len(TextStr) < MaxWidth))
{ {
if ( (bConvertSpaces) && ((S==" ") || (S=="?") || (S=="\\")) ) if ((bConvertSpaces) && ((S == " ") || (S == "?") || (S == "\\")))
S = "_"; S = "_";
if ( (TextStr=="") || ( CaretPos==Len(TextStr) ) ) if ((TextStr == "") || ( CaretPos == Len(TextStr) ))
{ {
TextStr = TextStr$S; TextStr = TextStr$S;
CaretPos=Len(TextStr); CaretPos=Len(TextStr);
@ -181,7 +181,7 @@ function bool NotifyInputKey(int ControllerId, name Key, EInputEvent Event, floa
{ {
local string Temp; local string Temp;
if( bReadOnly ) if (bReadOnly)
{ {
return false; return false;
} }
@ -190,9 +190,9 @@ function bool NotifyInputKey(int ControllerId, name Key, EInputEvent Event, floa
{ {
return false; return false;
} }
else if( Key == 'Escape' && Event == IE_Pressed ) else if (Key == 'Escape' && Event == IE_Pressed)
{ {
if( TextStr!="" ) if (TextStr != "")
{ {
SetInputText(""); SetInputText("");
CaretPos = 0; CaretPos = 0;
@ -200,20 +200,20 @@ function bool NotifyInputKey(int ControllerId, name Key, EInputEvent Event, floa
} }
else else
{ {
if( ParentComponent != None ) if (ParentComponent != None)
{ {
ParentComponent.UserPressedEsc(); ParentComponent.UserPressedEsc();
return true; return true;
} }
} }
} }
else if( Key=='Enter' && Event == IE_Released ) else if (Key == 'Enter' && Event == IE_Released)
{ {
if( TextStr!="" ) if (TextStr != "")
{ {
Temp = TextStr; Temp = TextStr;
OnTextFinished(self, Temp); OnTextFinished(self, Temp);
if( !bNoClearOnEnter ) if (!bNoClearOnEnter)
{ {
SetInputText(""); SetInputText("");
CaretPos = 0; CaretPos = 0;
@ -222,26 +222,26 @@ function bool NotifyInputKey(int ControllerId, name Key, EInputEvent Event, floa
return true; return true;
} }
else if ( Key=='Home' ) else if (Key == 'Home')
{ {
CaretPos = 0; CaretPos = 0;
return true; return true;
} }
else if ( Key=='End' ) else if (Key == 'End')
{ {
CaretPos = Len(TextStr); CaretPos = Len(TextStr);
return true; return true;
} }
else if( Event == IE_Pressed || Event == IE_Repeat ) else if (Event == IE_Pressed || Event == IE_Repeat)
{ {
if( Key=='Backspace' || Key=='Delete' ) if (Key == 'Backspace' || Key == 'Delete')
{ {
if( bAllSelected ) if (bAllSelected)
{ {
SetInputText(""); SetInputText("");
CaretPos = 0; CaretPos = 0;
} }
else if( CaretPos>0 ) else if (CaretPos > 0)
{ {
SetInputText(Left(TextStr,CaretPos-1) $ Right(TextStr, Len(TextStr) - CaretPos)); SetInputText(Left(TextStr,CaretPos-1) $ Right(TextStr, Len(TextStr) - CaretPos));
CaretPos -= 1; CaretPos -= 1;
@ -249,12 +249,12 @@ function bool NotifyInputKey(int ControllerId, name Key, EInputEvent Event, floa
return true; return true;
} }
else if ( Key=='Left' ) else if (Key == 'Left')
{ {
CaretPos = Max(0, CaretPos - 1); CaretPos = Max(0, CaretPos - 1);
return true; return true;
} }
else if ( Key=='Right' ) else if (Key == 'Right')
{ {
CaretPos = Min(Len(TextStr), CaretPos + 1); CaretPos = Min(Len(TextStr), CaretPos + 1);
return true; return true;
@ -272,15 +272,15 @@ function string ConvertIllegal(string InputStr)
i = 0; i = 0;
Max = Len(InputStr); Max = Len(InputStr);
while ( i < Max ) while ( i < Max)
{ {
C = Mid(InputStr,i,1); C = Mid(InputStr,i,1);
if ( AllowedCharSet != "" && InStr(AllowedCharSet,C) < 0 ) if (AllowedCharSet != "" && InStr(AllowedCharSet,C) < 0)
{ {
C = ""; C = "";
} }
if ( bConvertSpaces && if (bConvertSpaces &&
((C == " ") || (C =="?") || (C=="\\") )) ((C == " ") || (C =="?") || (C == "\\") ))
{ {
C = "_"; C = "_";
} }
@ -313,7 +313,7 @@ function DrawMenu()
Super.DrawMenu(); Super.DrawMenu();
if( bDrawBackground ) if (bDrawBackground)
{ {
Canvas.SetDrawColor(250,250,250,255); Canvas.SetDrawColor(250,250,250,255);
Canvas.SetPos(0.f,0.f); Canvas.SetPos(0.f,0.f);
@ -327,12 +327,12 @@ function DrawMenu()
Storage = TextStr; Storage = TextStr;
if ( bMaskText && Len(Storage)>0 ) if (bMaskText && Len(Storage) > 0)
{ {
StorageLength = Len(Storage); StorageLength = Len(Storage);
Storage = ""; Storage = "";
for(MaskIndex=1; MaskIndex <= StorageLength; MaskIndex++ ) for (MaskIndex=1; MaskIndex <= StorageLength; MaskIndex++)
{ {
Storage $= "*"; Storage $= "*";
} }
@ -343,16 +343,16 @@ function DrawMenu()
BoxWidth=CompPos[2]*0.9875; 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); FirstVis = Max(0,CaretPos-1);
else else
{ {
FinalDraw = Mid(Storage, FirstVis, CaretPos-FirstVis); FinalDraw = Mid(Storage, FirstVis, CaretPos-FirstVis);
Canvas.TextSize(FinalDraw, XL, YL, FontScale, FontScale); Canvas.TextSize(FinalDraw, XL, YL, FontScale, FontScale);
while ( (XL>=BoxWidth) && (FirstVis<Len(Storage)) ) while ( (XL >= BoxWidth) && (FirstVis < Len(Storage)))
{ {
FirstVis++; FirstVis++;
FinalDraw = Mid(Storage, FirstVis, CaretPos-FirstVis); FinalDraw = Mid(Storage, FirstVis, CaretPos-FirstVis);
@ -371,7 +371,7 @@ function DrawMenu()
if (!bReadOnly && (Owner.KeyboardFocus == self || bForceShowCaret)) 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); Canvas.TextSize("W", XL, YL, FontScale, FontScale);
XL = BorderSize; XL = BorderSize;
@ -385,7 +385,7 @@ function DrawMenu()
CursorY = (CompPos[3]/2) - ((YL-Owner.HUDOwner.ScaledBorderSize)/2); CursorY = (CompPos[3]/2) - ((YL-Owner.HUDOwner.ScaledBorderSize)/2);
if(bAllSelected) if (bAllSelected)
{ {
Canvas.SetDrawColor(255,255,255,195); Canvas.SetDrawColor(255,255,255,195);
Canvas.SetPos(BorderSize, CursorY); Canvas.SetPos(BorderSize, CursorY);
@ -404,9 +404,9 @@ function DrawMenu()
Canvas.DrawText(FinalDraw,,FontScale,FontScale,FRI); Canvas.DrawText(FinalDraw,,FontScale,FontScale,FRI);
} }
function HandleMouseClick( bool bRight ) function HandleMouseClick( bool bRight)
{ {
if( Owner.KeyboardFocus != self ) if (Owner.KeyboardFocus != self)
{ {
GrabKeyFocus(); GrabKeyFocus();
} }

View File

@ -16,7 +16,7 @@ var(Lable) bool bScaleByFontSize; // Scale this component height by font height.
function InitMenu() function InitMenu()
{ {
if( LableString=="" ) if (LableString == "")
TextLable = None; TextLable = None;
else else
{ {
@ -40,7 +40,7 @@ function InitMenu()
function UpdateSizes() function UpdateSizes()
{ {
// Update height. // Update height.
if( bScaleByFontSize ) if (bScaleByFontSize)
YSize = ((TextHeight*1.05) + 6) / InputPos[3]; YSize = ((TextHeight*1.05) + 6) / InputPos[3];
} }
@ -59,26 +59,26 @@ function PreDraw()
UpdateSizes(); UpdateSizes();
Super.PreDraw(); Super.PreDraw();
if( TextLable!=None ) if (TextLable != None)
{ {
TextLable.YSize = YSize; TextLable.YSize = YSize;
TextLable.Canvas = Canvas; TextLable.Canvas = Canvas;
for( i=0; i<4; ++i ) for (i=0; i < 4; ++i)
TextLable.InputPos[i] = InputPos[i]; TextLable.InputPos[i] = InputPos[i];
TextLable.PreDraw(); 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 int i,l;
local float X,XL,YL; local float X,XL,YL;
l = Len(S); l = Len(S);
for( i=0; i<l; ++i ) for (i=0; i < l; ++i)
{ {
Canvas.TextSize(Mid(S,i,1),XL,YL,TScale,TScale); Canvas.TextSize(Mid(S,i,1),XL,YL,TScale,TScale);
if( (Canvas.CurX+X+XL)>MaxX ) if ((Canvas.CurX+X+XL) > MaxX)
{ {
--i; --i;
break; break;

View File

@ -29,25 +29,25 @@ function DrawMenu()
{ {
local float TempSize; local float TempSize;
if( bUseAnimation ) if (bUseAnimation)
{ {
TempSize = `TimeSinceEx(GetPlayer(), OpenStartTime); 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; FrameOpacity = (1.f - ((WindowFadeInTime - TempSize) / WindowFadeInTime)) * default.FrameOpacity;
} }
Owner.CurrentStyle.RenderFramedWindow(Self); Owner.CurrentStyle.RenderFramedWindow(Self);
if( HeaderComp!=None ) if (HeaderComp != None)
{ {
HeaderComp.CompPos[3] = Owner.CurrentStyle.DefaultHeight; HeaderComp.CompPos[3] = Owner.CurrentStyle.DefaultHeight;
HeaderComp.YSize = HeaderComp.CompPos[3] / CompPos[3]; // Keep header height fit the window height. HeaderComp.YSize = HeaderComp.CompPos[3] / CompPos[3]; // Keep header height fit the window height.
} }
} }
function SetWindowDrag( bool bDrag ) function SetWindowDrag( bool bDrag)
{ {
bDragWindow = bDrag; bDragWindow = bDrag;
if( bDrag ) if (bDrag)
{ {
DragOffset[0] = Owner.MousePosition.X-CompPos[0]; DragOffset[0] = Owner.MousePosition.X-CompPos[0];
DragOffset[1] = Owner.MousePosition.Y-CompPos[1]; DragOffset[1] = Owner.MousePosition.Y-CompPos[1];
@ -57,15 +57,15 @@ function bool CaptureMouse()
{ {
local int i; 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; MouseArea = HeaderComp;
return true; return true;
} }
for( i=0; i<Components.Length; i++ ) for (i=0; i < Components.Length; i++)
{ {
if( Components[i].CaptureMouse() ) if (Components[i].CaptureMouse())
{ {
MouseArea = Components[i]; MouseArea = Components[i];
return true; return true;
@ -80,7 +80,7 @@ function PreDraw()
{ {
local float Frac, CenterX, CenterY; local float Frac, CenterX, CenterY;
if( bUseAnimation ) if (bUseAnimation)
{ {
Frac = Owner.CurrentStyle.TimeFraction(OpenStartTime, OpenEndTime, GetPlayer().WorldInfo.RealTimeSeconds); Frac = Owner.CurrentStyle.TimeFraction(OpenStartTime, OpenEndTime, GetPlayer().WorldInfo.RealTimeSeconds);
XSize = Lerp(default.XSize*0.75, default.XSize, Frac); XSize = Lerp(default.XSize*0.75, default.XSize, Frac);
@ -92,7 +92,7 @@ function PreDraw()
XPosition = Lerp(CenterX, default.XPosition, Frac); XPosition = Lerp(CenterX, default.XPosition, Frac);
YPosition = Lerp(CenterY, default.YPosition, Frac); YPosition = Lerp(CenterY, default.YPosition, Frac);
if( bDragWindow ) if (bDragWindow)
{ {
XPosition = FClamp(Owner.MousePosition.X-DragOffset[0],0,InputPos[2]-CompPos[2]) / InputPos[2]; XPosition = FClamp(Owner.MousePosition.X-DragOffset[0],0,InputPos[2]-CompPos[2]) / InputPos[2];
YPosition = FClamp(Owner.MousePosition.Y-DragOffset[1],0,InputPos[3]-CompPos[3]) / InputPos[3]; YPosition = FClamp(Owner.MousePosition.Y-DragOffset[1],0,InputPos[3]-CompPos[3]) / InputPos[3];

View File

@ -9,14 +9,14 @@ function PreDraw()
{ {
ComputeCoords(); ComputeCoords();
} }
function MouseClick( bool bRight ) function MouseClick( bool bRight)
{ {
if( !bRight ) if (!bRight)
KFGUI_FloatingWindow(ParentComponent).SetWindowDrag(true); KFGUI_FloatingWindow(ParentComponent).SetWindowDrag(true);
} }
function MouseRelease( bool bRight ) function MouseRelease( bool bRight)
{ {
if( !bRight ) if (!bRight)
KFGUI_FloatingWindow(ParentComponent).SetWindowDrag(false); KFGUI_FloatingWindow(ParentComponent).SetWindowDrag(false);
} }

View File

@ -18,14 +18,14 @@ function DrawMenu()
{ {
local float TempSize; local float TempSize;
if( bUseAnimation ) if (bUseAnimation)
{ {
TempSize = `TimeSinceEx(GetPlayer(), OpenStartTime); 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; FrameOpacity = (1.f - ((WindowFadeInTime - TempSize) / WindowFadeInTime)) * default.FrameOpacity;
} }
if( bDrawBackground ) if (bDrawBackground)
{ {
OnDrawFrame(Canvas, CompPos[2], CompPos[3]); 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 float T,XL,YL,HeaderH;
local FontRenderInfo FRI; local FontRenderInfo FRI;
if( FrameTex == None ) if (FrameTex == None)
{ {
return; return;
} }
C.SetDrawColor(255,255,255,FrameOpacity); C.SetDrawColor(255,255,255,FrameOpacity);
if( bUseLegacyDrawTile ) if (bUseLegacyDrawTile)
{ {
Owner.CurrentStyle.DrawTileStretched(FrameTex,0,0,W,H); 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()); Canvas.DrawTileStretched(FrameTex,W,H,0,0,FrameTex.GetSurfaceWidth(),FrameTex.GetSurfaceHeight());
} }
if( bDrawHeader && WindowTitle!="" ) if (bDrawHeader && WindowTitle != "")
{ {
FRI.bClipText = true; FRI.bClipText = true;
FRI.bEnableShadow = true; FRI.bEnableShadow = true;
@ -64,7 +64,7 @@ delegate OnDrawFrame(Canvas C, float W, Float H)
C.TextSize(WindowTitle, XL, YL, T, T); C.TextSize(WindowTitle, XL, YL, T, T);
HeaderH = EdgeSize[1]-HeaderSize[1]; HeaderH = EdgeSize[1]-HeaderSize[1];
if( bHeaderCenter ) if (bHeaderCenter)
C.SetPos((W/2) - (XL/2),(HeaderH/2) - (YL/2)); C.SetPos((W/2) - (XL/2),(HeaderH/2) - (YL/2));
else C.SetPos(HeaderSize[0],(HeaderH/2) - (YL/2)); else C.SetPos(HeaderSize[0],(HeaderH/2) - (YL/2));
@ -78,10 +78,10 @@ function PreDraw()
local byte j; local byte j;
local float Frac, CenterX, CenterY; local float Frac, CenterX, CenterY;
if( !bVisible ) if (!bVisible)
return; return;
if( bUseAnimation ) if (bUseAnimation)
{ {
Frac = Owner.CurrentStyle.TimeFraction(OpenStartTime, OpenEndTime, GetPlayer().WorldInfo.RealTimeSeconds); Frac = Owner.CurrentStyle.TimeFraction(OpenStartTime, OpenEndTime, GetPlayer().WorldInfo.RealTimeSeconds);
XSize = Lerp(default.XSize*0.75, default.XSize, Frac); 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]); Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
DrawMenu(); DrawMenu();
for( i=0; i<Components.Length; ++i ) for (i=0; i < Components.Length; ++i)
{ {
Components[i].Canvas = Canvas; Components[i].Canvas = Canvas;
for( j=0; j<4; ++j ) for (j=0; j < 4; ++j)
{ {
Components[i].InputPos[j] = CompPos[j]+EdgeSize[j]; Components[i].InputPos[j] = CompPos[j]+EdgeSize[j];
} }

View File

@ -25,7 +25,7 @@ function DrawMenu()
{ {
local float X, Y, XL, YL; local float X, Y, XL, YL;
if( Image == None ) if (Image == None)
return; return;
DrawBackground(Canvas, CompPos[2], CompPos[3]); DrawBackground(Canvas, CompPos[2], CompPos[3]);
@ -35,17 +35,17 @@ function DrawMenu()
switch (ImageStyle) switch (ImageStyle)
{ {
case ISTY_Normal: case ISTY_Normal:
if( X1 != -1 ) if (X1 != -1)
X = X1; X = X1;
else X = 0; else X = 0;
if( Y1 != -1 ) if (Y1 != -1)
Y = Y1; Y = Y1;
else Y = 0; else Y = 0;
if( bForceUniformSize ) if (bForceUniformSize)
{ {
if( ScaleStyle == ISTY_Height ) if (ScaleStyle == ISTY_Height)
{ {
YL = CompPos[3]; YL = CompPos[3];
XL = YL; XL = YL;
@ -58,16 +58,16 @@ function DrawMenu()
} }
else else
{ {
if( Y2 == -1 ) if (Y2 == -1)
YL = FMin(CompPos[3], Image.GetSurfaceHeight()); YL = FMin(CompPos[3], Image.GetSurfaceHeight());
else YL = (Y2-Y1); else YL = (Y2-Y1);
if( X2 == -1 ) if (X2 == -1)
XL = FMin(CompPos[2], Image.GetSurfaceWidth()); XL = FMin(CompPos[2], Image.GetSurfaceWidth());
else XL = (X2-X1); else XL = (X2-X1);
} }
if( bAlignCenter ) if (bAlignCenter)
{ {
Canvas.SetPos((CompPos[2]/2) - (XL/2), (CompPos[3]/2) - (YL/2)); Canvas.SetPos((CompPos[2]/2) - (XL/2), (CompPos[3]/2) - (YL/2));
Canvas.DrawTile(Image, XL, YL, X, Y, Image.GetSurfaceWidth(), Image.GetSurfaceHeight()); Canvas.DrawTile(Image, XL, YL, X, Y, Image.GetSurfaceWidth(), Image.GetSurfaceHeight());
@ -80,21 +80,21 @@ function DrawMenu()
break; break;
case ISTY_Stretched: case ISTY_Stretched:
if ( X1 < 0 && X2 < 0 && Y1 < 0 && Y2 < 0 ) if (X1 < 0 && X2 < 0 && Y1 < 0 && Y2 < 0 )
Owner.CurrentStyle.DrawTileStretched(Image, 0.f, 0.f, CompPos[2], CompPos[3]); Owner.CurrentStyle.DrawTileStretched(Image, 0.f, 0.f, CompPos[2], CompPos[3]);
else else
{ {
if ( X1 != -1 ) if (X1 != -1)
X = X1; X = X1;
else X = 0; else X = 0;
if( Y1 != -1 ) if (Y1 != -1)
Y = Y1; Y = Y1;
else Y = 0; else Y = 0;
if( bForceUniformSize ) if (bForceUniformSize)
{ {
if( ScaleStyle == ISTY_Height ) if (ScaleStyle == ISTY_Height)
{ {
YL = CompPos[3]; YL = CompPos[3];
XL = YL; XL = YL;
@ -107,16 +107,16 @@ function DrawMenu()
} }
else else
{ {
if( Y2 == -1 ) if (Y2 == -1)
YL = FMin(CompPos[3], Image.GetSurfaceHeight()); YL = FMin(CompPos[3], Image.GetSurfaceHeight());
else YL = (Y2-Y1); else YL = (Y2-Y1);
if( X2 == -1 ) if (X2 == -1)
XL = FMin(CompPos[2], Image.GetSurfaceWidth()); XL = FMin(CompPos[2], Image.GetSurfaceWidth());
else XL = (X2-X1); else XL = (X2-X1);
} }
if( bAlignCenter ) if (bAlignCenter)
{ {
Canvas.SetPos((CompPos[2]/2) - (XL/2), (CompPos[3]/2) - (YL/2)); Canvas.SetPos((CompPos[2]/2) - (XL/2), (CompPos[3]/2) - (YL/2));
Canvas.DrawTile(Image, CompPos[2], CompPos[3], X, Y, Image.GetSurfaceWidth(), Image.GetSurfaceHeight()); Canvas.DrawTile(Image, CompPos[2], CompPos[3], X, Y, Image.GetSurfaceWidth(), Image.GetSurfaceHeight());

View File

@ -36,7 +36,7 @@ function DrawMenu()
local float Y; local float Y;
local bool bCheckMouse; local bool bCheckMouse;
if( bDrawBackground ) if (bDrawBackground)
{ {
Canvas.DrawColor = BackgroundColor; Canvas.DrawColor = BackgroundColor;
Canvas.SetPos(0.f,0.f); Canvas.SetPos(0.f,0.f);
@ -46,30 +46,30 @@ function DrawMenu()
// Mouse focused item check. // Mouse focused item check.
bCheckMouse = bClickable && bFocused; bCheckMouse = bClickable && bFocused;
FocusMouseItem = -1; FocusMouseItem = -1;
if( bCheckMouse ) if (bCheckMouse)
MouseYHit = Owner.MousePosition.Y - CompPos[1]; MouseYHit = Owner.MousePosition.Y - CompPos[1];
n = ScrollBar.CurrentScroll; n = ScrollBar.CurrentScroll;
ItemHeight = CompPos[3] / ListItemsPerPage; ItemHeight = CompPos[3] / ListItemsPerPage;
Y = 0.f; Y = 0.f;
for( i=0; i<ListItemsPerPage; ++i ) for (i=0; i < ListItemsPerPage; ++i)
{ {
if( n>=ListCount ) if (n >= ListCount)
break; break;
if( bCheckMouse && FocusMouseItem==-1 ) if (bCheckMouse && FocusMouseItem == -1)
{ {
if( MouseYHit<ItemHeight ) if (MouseYHit < ItemHeight)
FocusMouseItem = n; FocusMouseItem = n;
else MouseYHit-=ItemHeight; else MouseYHit -= ItemHeight;
} }
OnDrawItem(Canvas,n,Y,ItemHeight,CompPos[2],(FocusMouseItem==n)); OnDrawItem(Canvas,n,Y,ItemHeight,CompPos[2],(FocusMouseItem == n));
Y+=ItemHeight; Y+=ItemHeight;
++n; ++n;
} }
if( LastFocusItem!=FocusMouseItem ) if (LastFocusItem != FocusMouseItem)
{ {
LastFocusItem = FocusMouseItem; LastFocusItem = FocusMouseItem;
if( bUseFocusSound ) if (bUseFocusSound)
{ {
PlayMenuSound(MN_FocusHover); PlayMenuSound(MN_FocusHover);
} }
@ -81,17 +81,17 @@ function PreDraw()
local int i; local int i;
local byte j; local byte j;
if( !bVisible ) if (!bVisible)
return; return;
ComputeCoords(); ComputeCoords();
if( !ScrollBar.bDisabled && !ScrollBar.bHideScrollbar ) if (!ScrollBar.bDisabled && !ScrollBar.bHideScrollbar)
{ {
// First draw scrollbar to allow it to resize itself. // 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]; ScrollBar.InputPos[j] = CompPos[j];
if( OldXSize!=InputPos[2] ) if (OldXSize != InputPos[2])
{ {
OldXSize = InputPos[2]; OldXSize = InputPos[2];
ScrollBar.XPosition = 1.f - ScrollBar.GetWidth(); ScrollBar.XPosition = 1.f - ScrollBar.GetWidth();
@ -114,12 +114,12 @@ function PreDraw()
} }
// Then draw rest of components. // Then draw rest of components.
for( i=0; i<Components.Length; ++i ) for (i=0; i < Components.Length; ++i)
{ {
if( Components[i]!=ScrollBar ) if (Components[i] != ScrollBar)
{ {
Components[i].Canvas = Canvas; Components[i].Canvas = Canvas;
for( j=0; j<4; ++j ) for (j=0; j < 4; ++j)
Components[i].InputPos[j] = CompPos[j]; Components[i].InputPos[j] = CompPos[j];
Components[i].PreDraw(); Components[i].PreDraw();
} }
@ -127,7 +127,7 @@ function PreDraw()
} }
function UpdateListVis() function UpdateListVis()
{ {
if( ListCount<=ListItemsPerPage ) if (ListCount <= ListItemsPerPage)
{ {
ScrollBar.UpdateScrollSize(0,1,1,1); ScrollBar.UpdateScrollSize(0,1,1,1);
ScrollBar.SetDisabled(true); ScrollBar.SetDisabled(true);
@ -138,9 +138,9 @@ function UpdateListVis()
ScrollBar.SetDisabled(false); ScrollBar.SetDisabled(false);
} }
} }
function ChangeListSize( int NewSize ) function ChangeListSize( int NewSize)
{ {
if( ListCount==NewSize ) if (ListCount == NewSize)
return; return;
ListCount = NewSize; ListCount = NewSize;
UpdateListVis(); UpdateListVis();
@ -150,29 +150,29 @@ final function int GetListSize()
return ListCount; return ListCount;
} }
function DoubleMouseClick( bool bRight ) function DoubleMouseClick( bool bRight)
{ {
if( !bDisabled && bClickable ) if (!bDisabled && bClickable)
{ {
PressedDown[byte(bRight)] = 0; PressedDown[byte(bRight)] = 0;
bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0); bPressedDown = (PressedDown[0] != 0 || PressedDown[1] != 0);
OnDblClickedItem(FocusMouseItem,bRight,Owner.MousePosition.X-CompPos[0],MouseYHit); OnDblClickedItem(FocusMouseItem,bRight,Owner.MousePosition.X-CompPos[0],MouseYHit);
} }
} }
function MouseClick( bool bRight ) function MouseClick( bool bRight)
{ {
if( !bDisabled && bClickable ) if (!bDisabled && bClickable)
{ {
PressedDown[byte(bRight)] = 1; PressedDown[byte(bRight)] = 1;
bPressedDown = true; bPressedDown = true;
} }
} }
function MouseRelease( bool bRight ) function MouseRelease( bool bRight)
{ {
if( !bDisabled && bClickable && PressedDown[byte(bRight)]==1 ) if (!bDisabled && bClickable && PressedDown[byte(bRight)] == 1)
{ {
PressedDown[byte(bRight)] = 0; PressedDown[byte(bRight)] = 0;
bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0); bPressedDown = (PressedDown[0] != 0 || PressedDown[1] != 0);
OnClickedItem(FocusMouseItem,bRight,Owner.MousePosition.X-CompPos[0],MouseYHit); OnClickedItem(FocusMouseItem,bRight,Owner.MousePosition.X-CompPos[0],MouseYHit);
} }
} }
@ -189,15 +189,15 @@ function MouseEnter()
LastFocusItem = -1; LastFocusItem = -1;
} }
function ScrollMouseWheel( bool bUp ) function ScrollMouseWheel( bool bUp)
{ {
if( !ScrollBar.bDisabled ) if (!ScrollBar.bDisabled)
ScrollBar.ScrollMouseWheel(bUp); ScrollBar.ScrollMouseWheel(bUp);
} }
function NotifyMousePaused() function NotifyMousePaused()
{ {
if( Owner.InputFocus==None && FocusMouseItem>=0 ) if (Owner.InputFocus == None && FocusMouseItem >= 0)
OnMouseRest(FocusMouseItem); OnMouseRest(FocusMouseItem);
} }

View File

@ -37,7 +37,7 @@ function DrawMenu()
local float X; local float X;
local bool bCheckMouse; local bool bCheckMouse;
if( bDrawBackground ) if (bDrawBackground)
{ {
//Canvas.DrawColor = BackgroundColor; //Canvas.DrawColor = BackgroundColor;
Canvas.SetDrawColor(250,250,250,255); Canvas.SetDrawColor(250,250,250,255);
@ -48,30 +48,30 @@ function DrawMenu()
// Mouse focused item check. // Mouse focused item check.
bCheckMouse = bClickable && bFocused; bCheckMouse = bClickable && bFocused;
FocusMouseItem = -1; FocusMouseItem = -1;
if( bCheckMouse ) if (bCheckMouse)
MouseXHit = Owner.MousePosition.X - CompPos[0]; MouseXHit = Owner.MousePosition.X - CompPos[0];
n = ScrollBar.CurrentScroll; n = ScrollBar.CurrentScroll;
ItemWidth = CompPos[2] / ListItemsPerPage; ItemWidth = CompPos[2] / ListItemsPerPage;
X = 0.f; X = 0.f;
for( i=0; i<ListItemsPerPage; ++i ) for (i=0; i < ListItemsPerPage; ++i)
{ {
if( n>=ListCount ) if (n >= ListCount)
break; break;
if( bCheckMouse && FocusMouseItem==-1 ) if (bCheckMouse && FocusMouseItem == -1)
{ {
if( MouseXHit<ItemWidth ) if (MouseXHit < ItemWidth)
FocusMouseItem = n; FocusMouseItem = n;
else MouseXHit-=ItemWidth; else MouseXHit -= ItemWidth;
} }
OnDrawItem(Canvas,n,X,CompPos[3],ItemWidth,(FocusMouseItem==n)); OnDrawItem(Canvas,n,X,CompPos[3],ItemWidth,(FocusMouseItem == n));
X+=ItemWidth; X+=ItemWidth;
++n; ++n;
} }
if( LastFocusItem!=FocusMouseItem ) if (LastFocusItem != FocusMouseItem)
{ {
LastFocusItem = FocusMouseItem; LastFocusItem = FocusMouseItem;
if( bUseFocusSound ) if (bUseFocusSound)
{ {
PlayMenuSound(MN_FocusHover); PlayMenuSound(MN_FocusHover);
} }
@ -83,17 +83,17 @@ function PreDraw()
local int i; local int i;
local byte j; local byte j;
if( !bVisible ) if (!bVisible)
return; return;
ComputeCoords(); ComputeCoords();
if( !ScrollBar.bDisabled && !ScrollBar.bHideScrollbar ) if (!ScrollBar.bDisabled && !ScrollBar.bHideScrollbar)
{ {
// First draw scrollbar to allow it to resize itself. // 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]; ScrollBar.InputPos[j] = CompPos[j];
if( OldYSize!=InputPos[3] ) if (OldYSize != InputPos[3])
{ {
OldYSize = InputPos[3]; OldYSize = InputPos[3];
ScrollBar.YPosition = 1.f - ScrollBar.GetWidth(); ScrollBar.YPosition = 1.f - ScrollBar.GetWidth();
@ -116,12 +116,12 @@ function PreDraw()
} }
// Then draw rest of components. // Then draw rest of components.
for( i=0; i<Components.Length; ++i ) for (i=0; i < Components.Length; ++i)
{ {
if( Components[i]!=ScrollBar ) if (Components[i] != ScrollBar)
{ {
Components[i].Canvas = Canvas; Components[i].Canvas = Canvas;
for( j=0; j<4; ++j ) for (j=0; j < 4; ++j)
Components[i].InputPos[j] = CompPos[j]; Components[i].InputPos[j] = CompPos[j];
Components[i].PreDraw(); Components[i].PreDraw();
} }
@ -129,7 +129,7 @@ function PreDraw()
} }
function UpdateListVis() function UpdateListVis()
{ {
if( ListCount<=ListItemsPerPage ) if (ListCount <= ListItemsPerPage)
{ {
ScrollBar.UpdateScrollSize(0,1,1,1); ScrollBar.UpdateScrollSize(0,1,1,1);
ScrollBar.SetDisabled(true); ScrollBar.SetDisabled(true);
@ -140,9 +140,9 @@ function UpdateListVis()
ScrollBar.SetDisabled(false); ScrollBar.SetDisabled(false);
} }
} }
function ChangeListSize( int NewSize ) function ChangeListSize( int NewSize)
{ {
if( ListCount==NewSize ) if (ListCount == NewSize)
return; return;
ListCount = NewSize; ListCount = NewSize;
UpdateListVis(); UpdateListVis();
@ -152,31 +152,31 @@ final function int GetListSize()
return ListCount; return ListCount;
} }
function DoubleMouseClick( bool bRight ) function DoubleMouseClick( bool bRight)
{ {
if( !bDisabled && bClickable ) if (!bDisabled && bClickable)
{ {
PlayMenuSound(MN_ClickButton); PlayMenuSound(MN_ClickButton);
PressedDown[byte(bRight)] = 0; PressedDown[byte(bRight)] = 0;
bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0); bPressedDown = (PressedDown[0] != 0 || PressedDown[1] != 0);
OnDblClickedItem(FocusMouseItem,bRight,MouseXHit,Owner.MousePosition.Y-CompPos[1]); OnDblClickedItem(FocusMouseItem,bRight,MouseXHit,Owner.MousePosition.Y-CompPos[1]);
} }
} }
function MouseClick( bool bRight ) function MouseClick( bool bRight)
{ {
if( !bDisabled && bClickable ) if (!bDisabled && bClickable)
{ {
PressedDown[byte(bRight)] = 1; PressedDown[byte(bRight)] = 1;
bPressedDown = true; bPressedDown = true;
} }
} }
function MouseRelease( bool bRight ) function MouseRelease( bool bRight)
{ {
if( !bDisabled && bClickable && PressedDown[byte(bRight)]==1 ) if (!bDisabled && bClickable && PressedDown[byte(bRight)] == 1)
{ {
PlayMenuSound(MN_ClickButton); PlayMenuSound(MN_ClickButton);
PressedDown[byte(bRight)] = 0; PressedDown[byte(bRight)] = 0;
bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0); bPressedDown = (PressedDown[0] != 0 || PressedDown[1] != 0);
OnClickedItem(FocusMouseItem,bRight,MouseXHit,Owner.MousePosition.Y-CompPos[1]); OnClickedItem(FocusMouseItem,bRight,MouseXHit,Owner.MousePosition.Y-CompPos[1]);
} }
} }
@ -191,19 +191,19 @@ function MouseEnter()
{ {
Super.MouseEnter(); Super.MouseEnter();
LastFocusItem = -1; LastFocusItem = -1;
if( !bDisabled && bClickable && bUseFocusSound ) if (!bDisabled && bClickable && bUseFocusSound)
PlayMenuSound(MN_FocusHover); PlayMenuSound(MN_FocusHover);
} }
function ScrollMouseWheel( bool bUp ) function ScrollMouseWheel( bool bUp)
{ {
if( !ScrollBar.bDisabled ) if (!ScrollBar.bDisabled)
ScrollBar.ScrollMouseWheel(bUp); ScrollBar.ScrollMouseWheel(bUp);
} }
function NotifyMousePaused() function NotifyMousePaused()
{ {
if( Owner.InputFocus==None && FocusMouseItem>=0 ) if (Owner.InputFocus == None && FocusMouseItem >= 0)
OnMouseRest(FocusMouseItem); OnMouseRest(FocusMouseItem);
} }

View File

@ -5,37 +5,37 @@ Class KFGUI_ListItem extends Object
`include(Logger.uci) `include(Logger.uci)
var KFGUI_ListItem Next; var KFGUI_ListItem Next;
var array<string> Columns,SortColumns; var array < string> Columns,SortColumns;
var int Index,Value; var int Index,Value;
var transient string Temp; // Cache sorting key. 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); ParseStringIntoArray(S,Columns,"\n",false);
if( SortStr=="" ) if (SortStr == "")
SortColumns.Length = 0; SortColumns.Length = 0;
else ParseStringIntoArray(Caps(SortStr),SortColumns,"\n",false); else ParseStringIntoArray(Caps(SortStr),SortColumns,"\n",false);
Value = i; Value = i;
} }
// Return string to draw on HUD. // Return string to draw on HUD.
function string GetDisplayStr( int Column ) function string GetDisplayStr( int Column)
{ {
if( Column<Columns.Length ) if (Column < Columns.Length)
return Columns[Column]; return Columns[Column];
return ""; return "";
} }
// Return string to compare string with. // Return string to compare string with.
function string GetSortStr( int Column ) function string GetSortStr( int Column)
{ {
if( SortColumns.Length>0 ) if (SortColumns.Length > 0)
{ {
if( Column<SortColumns.Length ) if (Column < SortColumns.Length)
return SortColumns[Column]; return SortColumns[Column];
} }
if( Column<Columns.Length ) if (Column < Columns.Length)
return Caps(Columns[Column]); return Caps(Columns[Column]);
return ""; return "";
} }

View File

@ -3,13 +3,13 @@ Class KFGUI_MultiComponent extends KFGUI_Base;
`include(Build.uci) `include(Build.uci)
`include(Logger.uci) `include(Logger.uci)
var() export editinline array<KFGUI_Base> Components; var() export editinline array < KFGUI_Base> Components;
function InitMenu() function InitMenu()
{ {
local int i; local int i;
for( i=0; i<Components.Length; ++i ) for (i=0; i < Components.Length; ++i)
{ {
Components[i].Owner = Owner; Components[i].Owner = Owner;
Components[i].ParentComponent = Self; Components[i].ParentComponent = Self;
@ -20,7 +20,7 @@ function ShowMenu()
{ {
local int i; local int i;
for( i=0; i<Components.Length; ++i ) for (i=0; i < Components.Length; ++i)
Components[i].ShowMenu(); Components[i].ShowMenu();
} }
function PreDraw() function PreDraw()
@ -28,7 +28,7 @@ function PreDraw()
local int i; local int i;
local byte j; local byte j;
if( !bVisible ) if (!bVisible)
return; return;
ComputeCoords(); ComputeCoords();
@ -36,10 +36,10 @@ function PreDraw()
Canvas.SetOrigin(CompPos[0],CompPos[1]); Canvas.SetOrigin(CompPos[0],CompPos[1]);
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]); Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
DrawMenu(); DrawMenu();
for( i=0; i<Components.Length; ++i ) for (i=0; i < Components.Length; ++i)
{ {
Components[i].Canvas = Canvas; Components[i].Canvas = Canvas;
for( j=0; j<4; ++j ) for (j=0; j < 4; ++j)
Components[i].InputPos[j] = CompPos[j]; Components[i].InputPos[j] = CompPos[j];
Components[i].PreDraw(); Components[i].PreDraw();
} }
@ -48,19 +48,19 @@ function InventoryChanged(optional KFWeapon Wep, optional bool bRemove)
{ {
local int i; local int i;
for( i=0; i<Components.Length; ++i ) for (i=0; i < Components.Length; ++i)
Components[i].InventoryChanged(Wep,bRemove); Components[i].InventoryChanged(Wep,bRemove);
} }
function MenuTick( float DeltaTime ) function MenuTick( float DeltaTime)
{ {
local int i; local int i;
Super.MenuTick(DeltaTime); Super.MenuTick(DeltaTime);
for( i=0; i<Components.Length; ++i ) for (i=0; i < Components.Length; ++i)
Components[i].MenuTick(DeltaTime); Components[i].MenuTick(DeltaTime);
} }
function AddComponent( KFGUI_Base C ) function AddComponent( KFGUI_Base C)
{ {
Components[Components.Length] = C; Components[Components.Length] = C;
C.Owner = Owner; C.Owner = Owner;
@ -72,16 +72,16 @@ function CloseMenu()
{ {
local int i; local int i;
for( i=0; i<Components.Length; ++i ) for (i=0; i < Components.Length; ++i)
Components[i].CloseMenu(); Components[i].CloseMenu();
} }
function bool CaptureMouse() function bool CaptureMouse()
{ {
local int i; local int i;
for( i=Components.Length - 1; i>=0; i-- ) for (i=Components.Length - 1; i >= 0; i--)
{ {
if( Components[i].CaptureMouse() ) if (Components[i].CaptureMouse())
{ {
MouseArea = Components[i]; MouseArea = Components[i];
return true; return true;
@ -94,9 +94,9 @@ function bool ReceievedControllerInput(int ControllerId, name Key, EInputEvent E
{ {
local int i; 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; return true;
} }
@ -104,47 +104,47 @@ function bool ReceievedControllerInput(int ControllerId, name Key, EInputEvent E
return Super.ReceievedControllerInput(ControllerId, Key, Event); return Super.ReceievedControllerInput(ControllerId, Key, Event);
} }
function KFGUI_Base FindComponentID( name InID ) function KFGUI_Base FindComponentID( name InID)
{ {
local int i; local int i;
local KFGUI_Base Result; local KFGUI_Base Result;
if( ID==InID ) if (ID == InID)
Result = Self; Result = Self;
else else
{ {
for( i=0; i<Components.Length && Result==None; ++i ) for (i=0; i < Components.Length && Result == None; ++i)
Result = Components[i].FindComponentID(InID); Result = Components[i].FindComponentID(InID);
} }
return Result; return Result;
} }
function FindAllComponentID( name InID, out array<KFGUI_Base> Res ) function FindAllComponentID( name InID, out array < KFGUI_Base> Res)
{ {
local int i; local int i;
if( ID==InID ) if (ID == InID)
Res[Res.Length] = Self; Res[Res.Length] = Self;
for( i=0; i<Components.Length; ++i ) for (i=0; i < Components.Length; ++i)
Components[i].FindAllComponentID(InID,Res); Components[i].FindAllComponentID(InID,Res);
} }
function RemoveComponent( KFGUI_Base B ) function RemoveComponent( KFGUI_Base B)
{ {
local int i; local int i;
for( i=0; i<Components.Length; ++i ) for (i=0; i < Components.Length; ++i)
if( Components[i]==B ) if (Components[i] == B)
{ {
Components.Remove(i,1); Components.Remove(i,1);
B.CloseMenu(); B.CloseMenu();
return; return;
} }
for( i=0; i<Components.Length; ++i ) for (i=0; i < Components.Length; ++i)
Components[i].RemoveComponent(B); Components[i].RemoveComponent(B);
} }
function NotifyLevelChange() function NotifyLevelChange()
{ {
local int i; local int i;
for( i=0; i<Components.Length; ++i ) for (i=0; i < Components.Length; ++i)
Components[i].NotifyLevelChange(); Components[i].NotifyLevelChange();
} }

View File

@ -15,7 +15,7 @@ var bool bWindowFocused; // This page is currently focused.
function DrawMenu() function DrawMenu()
{ {
if( !bNoBackground ) if (!bNoBackground)
{ {
Owner.CurrentStyle.RenderWindow(Self); Owner.CurrentStyle.RenderWindow(Self);
} }

View File

@ -44,12 +44,12 @@ function DrawMenu()
{ {
W = CaptionWidth; W = CaptionWidth;
if( W < 1.0 ) if (W < 1.0)
{ {
W *= Width; W *= Width;
} }
if( W > Width ) if (W > Width)
{ {
W = Width; W = Width;
} }
@ -60,21 +60,21 @@ function DrawMenu()
Width -= W; Width -= W;
} }
if ( (bShowHigh || bShowValue) && ValueRightWidth > 0.0 && Width > 0.0) if ((bShowHigh || bShowValue) && ValueRightWidth > 0.0 && Width > 0.0)
{ {
W = ValueRightWidth; W = ValueRightWidth;
if( W < 1.0 ) if (W < 1.0)
{ {
W *= Width; W *= Width;
} }
if( W > Width ) if (W > Width)
{ {
W = Width; W = Width;
} }
if( bShowValue && bShowHigh ) if (bShowValue && bShowHigh)
{ {
S = int(Value)$"/"$int(High); S = int(Value)$"/"$int(High);
} }
@ -99,12 +99,12 @@ function DrawMenu()
} }
Canvas.SetDrawColor(255, 255, 255, 255); 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); 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; Canvas.DrawColor = BarColor;
Owner.CurrentStyle.DrawTileStretched(BarTop, Left + BorderSize, Top + BorderSize, (Width - (BorderSize * 2)) * (Value/High), Height - (BorderSize * 2)); Owner.CurrentStyle.DrawTileStretched(BarTop, Left + BorderSize, Top + BorderSize, (Width - (BorderSize * 2)) * (Value/High), Height - (BorderSize * 2));

View File

@ -8,14 +8,14 @@ struct FRowItem
var string Text,ToolTip; var string Text,ToolTip;
var bool bSplitter,bDisabled; var bool bSplitter,bDisabled;
}; };
var array<FRowItem> ItemRows; var array < FRowItem> ItemRows;
var int CurrentRow,OldRow; var int CurrentRow,OldRow;
var int EdgeSize; var int EdgeSize;
var int OldSizeX; var int OldSizeX;
var transient bool bDrawToolTip; var transient bool bDrawToolTip;
var Color BoxColor,OutlineColor; var Color BoxColor,OutlineColor;
function OpenMenu( KFGUI_Base Menu ) function OpenMenu( KFGUI_Base Menu)
{ {
Owner = Menu.Owner; Owner = Menu.Owner;
InitMenu(); InitMenu();
@ -29,10 +29,10 @@ final function ComputeSize()
local int i; local int i;
local string S; local string S;
if( OldSizeX == Owner.ScreenSize.X ) if (OldSizeX == Owner.ScreenSize.X)
return; return;
if( ItemRows.Length==0 ) if (ItemRows.Length == 0)
{ {
YS = 0; YS = 0;
XS = 50; XS = 50;
@ -40,9 +40,9 @@ final function ComputeSize()
else else
{ {
Canvas.Font = Owner.CurrentStyle.PickFont(Scalar); Canvas.Font = Owner.CurrentStyle.PickFont(Scalar);
for( i=0; i<ItemRows.Length; ++i ) for (i=0; i < ItemRows.Length; ++i)
{ {
if( ItemRows[i].bSplitter ) if (ItemRows[i].bSplitter)
S = "----"; S = "----";
else S = ItemRows[i].Text; else S = ItemRows[i].Text;
@ -63,18 +63,18 @@ function ComputePosition()
{ {
XPosition = float(Owner.MousePosition.X+4) / Owner.ScreenSize.X; XPosition = float(Owner.MousePosition.X+4) / Owner.ScreenSize.X;
YPosition = float(Owner.MousePosition.Y+4) / Owner.ScreenSize.Y; YPosition = float(Owner.MousePosition.Y+4) / Owner.ScreenSize.Y;
if( (XPosition+XSize)>1.f ) if ((XPosition+XSize) > 1.f)
YPosition = (float(Owner.MousePosition.X) / Owner.ScreenSize.X) - XSize; // Move to left side of mouse pointer. YPosition = (float(Owner.MousePosition.X) / Owner.ScreenSize.X) - XSize; // Move to left side of mouse pointer.
if( (YPosition+YSize)>1.f ) if ((YPosition+YSize) > 1.f)
YPosition-=((YPosition+YSize)-1.f); // Move up until fit on screen. 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; local int i;
i = ItemRows.Length; i = ItemRows.Length;
ItemRows.Length = i+1; ItemRows.Length = i+1;
if( Text=="-" ) if (Text == "-")
ItemRows[i].bSplitter = true; ItemRows[i].bSplitter = true;
else else
{ {
@ -92,9 +92,9 @@ function DrawMenu()
{ {
Owner.CurrentStyle.RenderRightClickMenu(Self); Owner.CurrentStyle.RenderRightClickMenu(Self);
if( bDrawToolTip ) if (bDrawToolTip)
{ {
if( OldRow != CurrentRow ) if (OldRow != CurrentRow)
bDrawToolTip = false; bDrawToolTip = false;
DrawToolTip(); DrawToolTip();
} }
@ -117,7 +117,7 @@ function DrawToolTip()
BoxW = XL * 1.05f; BoxW = XL * 1.05f;
BoxH = YL * 1.25f; BoxH = YL * 1.25f;
while( (X + BoxW) > Canvas.ClipX ) while( (X + BoxW) > Canvas.ClipX)
{ {
X -= 0.01; X -= 0.01;
} }
@ -131,9 +131,9 @@ function DrawToolTip()
Canvas.SetPos(TextX, TextY); Canvas.SetPos(TextX, TextY);
Canvas.DrawText(S,,Scalar,Scalar); 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; return;
OnSelectedItem(CurrentRow); OnSelectedItem(CurrentRow);
PlayMenuSound(MN_ClickButton); PlayMenuSound(MN_ClickButton);
@ -147,7 +147,7 @@ function LostInputFocus()
} }
function NotifyMousePaused() function NotifyMousePaused()
{ {
if(CurrentRow != -1 && ItemRows[CurrentRow].ToolTip != "") if (CurrentRow != -1 && ItemRows[CurrentRow].ToolTip != "")
bDrawToolTip = true; bDrawToolTip = true;
} }

View File

@ -15,7 +15,7 @@ var transient bool bGrabbedScroller;
var bool bVertical, bHideScrollbar; 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; MaxRange = MxRange;
MinRange = MnRange; MinRange = MnRange;
@ -23,11 +23,11 @@ final function UpdateScrollSize( int Current, int MxRange, int Stride, int StepS
PageStep = StepStride; PageStep = StepStride;
SetValue(Current); SetValue(Current);
} }
final function AddValue( int V ) final function AddValue( int V)
{ {
SetValue(CurrentScroll+V); SetValue(CurrentScroll+V);
} }
final function SetValue( int V ) final function SetValue( int V)
{ {
CurrentScroll = Clamp((V / ScrollStride) * ScrollStride,MinRange,MaxRange); CurrentScroll = Clamp((V / ScrollStride) * ScrollStride,MinRange,MaxRange);
OnScrollChange(Self,CurrentScroll); OnScrollChange(Self,CurrentScroll);
@ -47,53 +47,53 @@ function float GetWidth()
function PreDraw() function PreDraw()
{ {
// Auto scale to match width to screen size. // Auto scale to match width to screen size.
if( bVertical ) if (bVertical)
XSize = GetWidth(); XSize = GetWidth();
else YSize = GetWidth(); else YSize = GetWidth();
Super.PreDraw(); Super.PreDraw();
} }
function DrawMenu() function DrawMenu()
{ {
if( !bHideScrollbar ) if (!bHideScrollbar)
{ {
Owner.CurrentStyle.RenderScrollBar(Self); Owner.CurrentStyle.RenderScrollBar(Self);
} }
} }
function MouseClick( bool bRight ) function MouseClick( bool bRight)
{ {
if( bRight || bDisabled ) if (bRight || bDisabled)
return; return;
bPressedDown = true; bPressedDown = true;
PlayMenuSound(MN_ClickButton); 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); GrabbedOffset = Owner.MousePosition.Y - (CompPos[1]+ButtonOffset);
bGrabbedScroller = true; bGrabbedScroller = true;
GetInputFocus(); GetInputFocus();
} }
else if( Owner.MousePosition.Y<(CompPos[1]+ButtonOffset) ) // Page up. else if (Owner.MousePosition.Y < (CompPos[1]+ButtonOffset) ) // Page up.
AddValue(-PageStep); AddValue(-PageStep);
else AddValue(PageStep); else AddValue(PageStep);
} }
else 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); GrabbedOffset = Owner.MousePosition.X - (CompPos[0]+ButtonOffset);
bGrabbedScroller = true; bGrabbedScroller = true;
GetInputFocus(); GetInputFocus();
} }
else if( Owner.MousePosition.X<(CompPos[0]+ButtonOffset) ) // Page left. else if (Owner.MousePosition.X < (CompPos[0]+ButtonOffset) ) // Page left.
AddValue(-PageStep); AddValue(-PageStep);
else AddValue(PageStep); else AddValue(PageStep);
} }
} }
function MouseRelease( bool bRight ) function MouseRelease( bool bRight)
{ {
if( !bRight ) if (!bRight)
DropInputFocus(); DropInputFocus();
} }
@ -103,11 +103,11 @@ function LostInputFocus()
bPressedDown = false; bPressedDown = false;
} }
function ScrollMouseWheel( bool bUp ) function ScrollMouseWheel( bool bUp)
{ {
if( bDisabled ) if (bDisabled)
return; return;
if( bUp ) if (bUp)
AddValue(-ScrollStride); AddValue(-ScrollStride);
else AddValue(ScrollStride); else AddValue(ScrollStride);
} }

View File

@ -38,9 +38,9 @@ function UpdateListVis()
ScrollBar.UpdateScrollSize(CurrentValue,MaxValue,1,1,MinValue); ScrollBar.UpdateScrollSize(CurrentValue,MaxValue,1,1,MinValue);
} }
function ScrollMouseWheel( bool bUp ) function ScrollMouseWheel( bool bUp)
{ {
if( !ScrollBar.bDisabled ) if (!ScrollBar.bDisabled)
ScrollBar.ScrollMouseWheel(bUp); ScrollBar.ScrollMouseWheel(bUp);
} }

View File

@ -4,13 +4,13 @@ Class KFGUI_SwitchMenuBar extends KFGUI_MultiComponent;
`include(Build.uci) `include(Build.uci)
`include(Logger.uci) `include(Logger.uci)
var array<KFGUI_Base> SubPages; var array < KFGUI_Base> SubPages;
var() byte ButtonPosition; // 0 = top, 1 = bottom, 2 = left, 3 = right var() byte ButtonPosition; // 0 = top, 1 = bottom, 2 = left, 3 = right
var() float BorderWidth,ButtonAxisSize; // Width for buttons. var() float BorderWidth,ButtonAxisSize; // Width for buttons.
var() float PagePadding; // Padding for pages var() float PagePadding; // Padding for pages
var int NumButtons,CurrentPageNum,PageComponentIndex; var int NumButtons,CurrentPageNum,PageComponentIndex;
var array<KFGUI_Button> PageButtons; var array < KFGUI_Button> PageButtons;
function ShowMenu() function ShowMenu()
{ {
@ -25,7 +25,7 @@ function CloseMenu()
} }
// Remember to call InitMenu() on the newly created page after. // Remember to call InitMenu() on the newly created page after.
final function KFGUI_Base AddPage( class<KFGUI_Base> 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_Base P;
local KFGUI_Button B; local KFGUI_Button B;
@ -44,29 +44,29 @@ final function KFGUI_Base AddPage( class<KFGUI_Base> PageClass, string Caption,
B.OnClickRight = PageSwitched; B.OnClickRight = PageSwitched;
B.IDValue = NumButtons; B.IDValue = NumButtons;
if( ButtonPosition<2 ) if (ButtonPosition < 2)
{ {
B.XPosition = NumButtons*ButtonAxisSize; B.XPosition = NumButtons*ButtonAxisSize;
B.XSize = ButtonAxisSize*0.99; B.XSize = ButtonAxisSize*0.99;
if( ButtonPosition==0 ) if (ButtonPosition == 0)
B.YPosition = 0.f; B.YPosition = 0.f;
else B.YPosition = YSize-BorderWidth*0.99; else B.YPosition = YSize-BorderWidth*0.99;
B.YSize = BorderWidth*0.99; B.YSize = BorderWidth*0.99;
if( NumButtons>0 ) if (NumButtons > 0)
PageButtons[PageButtons.Length-1].ExtravDir = 1; PageButtons[PageButtons.Length-1].ExtravDir = 1;
} }
else else
{ {
if( ButtonPosition==2 ) if (ButtonPosition == 2)
B.XPosition = 0.f; B.XPosition = 0.f;
else B.XPosition = XSize-BorderWidth*0.99; else B.XPosition = XSize-BorderWidth*0.99;
B.XSize = BorderWidth*0.99; B.XSize = BorderWidth*0.99;
B.YPosition = NumButtons*ButtonAxisSize; B.YPosition = NumButtons*ButtonAxisSize;
B.YSize = ButtonAxisSize*0.99; B.YSize = ButtonAxisSize*0.99;
if( NumButtons>0 ) if (NumButtons > 0)
PageButtons[PageButtons.Length-1].ExtravDir = 2; PageButtons[PageButtons.Length-1].ExtravDir = 2;
} }
@ -77,24 +77,24 @@ final function KFGUI_Base AddPage( class<KFGUI_Base> PageClass, string Caption,
return P; return P;
} }
function PageSwitched( KFGUI_Button Sender ) function PageSwitched( KFGUI_Button Sender)
{ {
SelectPage(Sender.IDValue); SelectPage(Sender.IDValue);
} }
final function SelectPage( int Index ) final function SelectPage( int Index)
{ {
PlayMenuSound(MN_LostFocus); PlayMenuSound(MN_LostFocus);
if( CurrentPageNum>=0 ) if (CurrentPageNum >= 0)
{ {
PageButtons[CurrentPageNum].bIsHighlighted = false; PageButtons[CurrentPageNum].bIsHighlighted = false;
SubPages[CurrentPageNum].CloseMenu(); SubPages[CurrentPageNum].CloseMenu();
Components.Remove(PageComponentIndex,1); Components.Remove(PageComponentIndex,1);
PageComponentIndex = -1; PageComponentIndex = -1;
} }
CurrentPageNum = (Index>=0 && Index<SubPages.Length) ? Index : -1; CurrentPageNum = (Index >= 0 && Index < SubPages.Length) ? Index : -1;
if( CurrentPageNum>=0 ) if (CurrentPageNum >= 0)
{ {
PageButtons[CurrentPageNum].bIsHighlighted = true; PageButtons[CurrentPageNum].bIsHighlighted = true;
SubPages[CurrentPageNum].ShowMenu(); SubPages[CurrentPageNum].ShowMenu();
@ -108,23 +108,23 @@ function PreDraw()
local int i; local int i;
local byte j; local byte j;
if( !bVisible ) if (!bVisible)
return; return;
if( CurrentPageNum==-1 && NumButtons>0 ) if (CurrentPageNum == -1 && NumButtons > 0)
SelectPage(0); SelectPage(0);
ComputeCoords(); ComputeCoords();
Canvas.SetOrigin(CompPos[0],CompPos[1]); Canvas.SetOrigin(CompPos[0],CompPos[1]);
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]); Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
DrawMenu(); DrawMenu();
for( i=0; i<Components.Length; ++i ) for (i=0; i < Components.Length; ++i)
{ {
Components[i].Canvas = Canvas; Components[i].Canvas = Canvas;
for( j=0; j<4; ++j ) for (j=0; j < 4; ++j)
Components[i].InputPos[j] = CompPos[j]; Components[i].InputPos[j] = CompPos[j];
if( i==PageComponentIndex ) if (i == PageComponentIndex)
{ {
switch( ButtonPosition ) switch( ButtonPosition)
{ {
case 0: case 0:
Components[i].InputPos[1] += (InputPos[3]*BorderWidth*PagePadding); Components[i].InputPos[1] += (InputPos[3]*BorderWidth*PagePadding);
@ -146,11 +146,11 @@ function bool ReceievedControllerInput(int ControllerId, name Key, EInputEvent E
switch(Key) switch(Key)
{ {
case 'XboxTypeS_LeftShoulder': case 'XboxTypeS_LeftShoulder':
if( Event == IE_Pressed ) if (Event == IE_Pressed)
SelectPage(Clamp(CurrentPageNum - 1, 0, NumButtons)); SelectPage(Clamp(CurrentPageNum - 1, 0, NumButtons));
return true; return true;
case 'XboxTypeS_RightShoulder': case 'XboxTypeS_RightShoulder':
if( Event == IE_Pressed ) if (Event == IE_Pressed)
SelectPage(Clamp(CurrentPageNum + 1, 0, NumButtons)); SelectPage(Clamp(CurrentPageNum + 1, 0, NumButtons));
return true; return true;
} }

View File

@ -24,7 +24,7 @@ struct FTextPart
}; };
struct FTextLineInfo struct FTextLineInfo
{ {
var array<FTextPart> Text; var array < FTextPart> Text;
var float Y; var float Y;
}; };
var KFGUI_ScrollBarV ScrollBar; var KFGUI_ScrollBarV ScrollBar;
@ -36,14 +36,14 @@ var() Canvas.FontRenderInfo TextFontInfo;
var() float FontScale,MessageDisplayTime,MessageFadeInTime,MessageFadeOutTime; var() float FontScale,MessageDisplayTime,MessageFadeInTime,MessageFadeOutTime;
var() bool bNoReset,bFadeInOut,bUseOutlineText; var() bool bNoReset,bFadeInOut,bUseOutlineText;
var() int MaxHistory, OutlineSize; var() int MaxHistory, OutlineSize;
var protected transient array<FTextLineInfo> Lines,OrgLines; var protected transient array < FTextLineInfo> Lines,OrgLines;
var transient float MaxHeight,ScrollWidth,OldSize[2],InitFontScale,TextHeight,FadeStartTime; var transient float MaxHeight,ScrollWidth,OldSize[2],InitFontScale,TextHeight,FadeStartTime;
var transient Font InitFont; var transient Font InitFont;
var transient bool bShowScrollbar,bTextParsed; var transient bool bShowScrollbar,bTextParsed;
function SetText( string S ) function SetText( string S)
{ {
if( Text==S ) if (Text == S)
return; return;
Text = S; Text = S;
OldSize[0] = -1; // Force to refresh. OldSize[0] = -1; // Force to refresh.
@ -51,7 +51,7 @@ function SetText( string S )
OrgLines.Length = 0; OrgLines.Length = 0;
bTextParsed = false; bTextParsed = false;
} }
function AddText( string S, optional bool bIgnoreSpam ) function AddText( string S, optional bool bIgnoreSpam)
{ {
Text $= S; Text $= S;
OldSize[0] = -1; OldSize[0] = -1;
@ -66,7 +66,7 @@ final function string GetText()
final function ParseTextLines() final function ParseTextLines()
{ {
local array<string> SA; local array < string> SA;
local int i,j,z; local int i,j,z;
local string S; local string S;
local color C; local color C;
@ -76,19 +76,19 @@ final function ParseTextLines()
Lines.Length = SA.Length; Lines.Length = SA.Length;
C.A = 0; C.A = 0;
TextType = TEXT_FIELD_NONE; TextType = TEXT_FIELD_NONE;
for( i=0; i<SA.Length; ++i ) for (i=0; i < SA.Length; ++i)
{ {
Lines[i].Text.Length = 0; Lines[i].Text.Length = 0;
S = SA[i]; S = SA[i];
if( S=="" ) if (S == "")
continue; continue;
z = 0; z = 0;
while( true ) while( true)
{ {
j = InStr(S,"#{"); j = InStr(S,"#{");
if( j>0 ) if (j > 0)
{ {
Lines[i].Text.Length = z+1; Lines[i].Text.Length = z+1;
Lines[i].Text[z].S = Left(S,j); Lines[i].Text[z].S = Left(S,j);
@ -96,29 +96,29 @@ final function ParseTextLines()
Lines[i].Text[z].TextType = TextType; Lines[i].Text[z].TextType = TextType;
++z; ++z;
} }
else if( j==-1 ) else if (j == -1)
break; break;
S = Mid(S,j+2); S = Mid(S,j+2);
if( Left(S,4)=="DEF}" ) if (Left(S,4) == "DEF}")
{ {
C.A = 0; C.A = 0;
S = Mid(S,4); S = Mid(S,4);
TextType = TEXT_FIELD_NONE; TextType = TEXT_FIELD_NONE;
} }
else if( Left(S,4)=="HSV}" ) else if (Left(S,4) == "HSV}")
{ {
C.A = 0; C.A = 0;
S = Mid(S,4); S = Mid(S,4);
TextType = TEXT_FIELD_HSV; TextType = TEXT_FIELD_HSV;
} }
else if( Left(S,6)=="FLASH}" ) else if (Left(S,6) == "FLASH}")
{ {
C.A = 0; C.A = 0;
S = Mid(S,6); S = Mid(S,6);
TextType = TEXT_FIELD_FLASH; TextType = TEXT_FIELD_FLASH;
} }
else if( Left(S,7)=="CFLASH=" ) else if (Left(S,7) == "CFLASH=")
{ {
C.A = 0; C.A = 0;
S = Mid(S,7); S = Mid(S,7);
@ -147,21 +147,21 @@ final function ParseTextLines()
} }
OrgLines = Lines; // Create a backup. OrgLines = Lines; // Create a backup.
} }
final function byte GrabHexValue( string S ) final function byte GrabHexValue( string S)
{ {
local byte n; 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); S = Mid(S,2);
return n; 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; return n-48;
if( n>=65 && n<=70 ) // 'A' - 'F' if (n >= 65 && n <= 70 ) // 'A' - 'F'
return n-55; // 'A' - 10 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 n-87; // 'a' - 10
return 0; return 0;
} }
@ -172,12 +172,12 @@ function InitSize()
local float XS; local float XS;
local int MaxScrollRange; local int MaxScrollRange;
if( Canvas == None ) if (Canvas == None)
return; return;
OldSize[0] = CompPos[2]; OldSize[0] = CompPos[2];
OldSize[1] = CompPos[3]; OldSize[1] = CompPos[3];
if( !bTextParsed ) if (!bTextParsed)
{ {
ParseTextLines(); ParseTextLines();
bTextParsed = true; bTextParsed = true;
@ -193,13 +193,13 @@ function InitSize()
ParseLines(CompPos[2] / InitFontScale); ParseLines(CompPos[2] / InitFontScale);
MaxHeight = (Lines.Length * TextHeight); MaxHeight = (Lines.Length * TextHeight);
bShowScrollbar = (MaxHeight>=CompPos[3]); bShowScrollbar = (MaxHeight >= CompPos[3]);
bClickable = bShowScrollbar; bClickable = bShowScrollbar;
bCanFocus = bShowScrollbar; bCanFocus = bShowScrollbar;
if( bShowScrollbar ) if (bShowScrollbar)
{ {
if( ScrollBar==None ) if (ScrollBar == None)
{ {
ScrollBar = new(Self) class'KFGUI_ScrollBarV'; ScrollBar = new(Self) class'KFGUI_ScrollBarV';
ScrollBar.SetPosition(0.9,0.0,0.1,1.0); ScrollBar.SetPosition(0.9,0.0,0.1,1.0);
@ -210,7 +210,7 @@ function InitSize()
} }
// Compute scrollbar size and X-position. // Compute scrollbar size and X-position.
for( i=0; i<4; ++i ) for (i=0; i < 4; ++i)
ScrollBar.InputPos[i] = CompPos[i]; ScrollBar.InputPos[i] = CompPos[i];
ScrollWidth = ScrollBar.GetWidth(); ScrollWidth = ScrollBar.GetWidth();
ScrollBar.XPosition = 1.f - ScrollWidth; ScrollBar.XPosition = 1.f - ScrollWidth;
@ -222,32 +222,32 @@ function InitSize()
Lines = OrgLines; Lines = OrgLines;
ParseLines((CompPos[2]-ScrollWidth) / InitFontScale); ParseLines((CompPos[2]-ScrollWidth) / InitFontScale);
if( Components.Find(ScrollBar)==-1 ) if (Components.Find(ScrollBar) == -1)
Components.AddItem(ScrollBar); Components.AddItem(ScrollBar);
MaxHeight = (Lines.Length * TextHeight); MaxHeight = (Lines.Length * TextHeight);
MaxScrollRange = Max(((MaxHeight-CompPos[3])/TextHeight),1); MaxScrollRange = Max(((MaxHeight-CompPos[3])/TextHeight),1);
ScrollBar.UpdateScrollSize(bNoReset ? MaxScrollRange : 0,MaxScrollRange,1,1); ScrollBar.UpdateScrollSize(bNoReset ? MaxScrollRange : 0,MaxScrollRange,1,1);
} }
else if( ScrollBar!=None ) else if (ScrollBar != None)
Components.RemoveItem(ScrollBar); Components.RemoveItem(ScrollBar);
} }
// Parse textlines to see if they're too long. // 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 float X,XS,YS;
local int i,j,z,n; local int i,j,z,n;
for( i=0; i<Lines.Length; ++i ) for (i=0; i < Lines.Length; ++i)
{ {
Lines[i].Y = i*TextHeight; Lines[i].Y = i*TextHeight;
X = 0.f; X = 0.f;
for( j=0; j<Lines[i].Text.Length; ++j ) for (j=0; j < Lines[i].Text.Length; ++j)
{ {
Lines[i].Text[j].X = (X*InitFontScale); Lines[i].Text[j].X = (X*InitFontScale);
Canvas.TextSize(Lines[i].Text[j].S,XS,YS); Canvas.TextSize(Lines[i].Text[j].S,XS,YS);
if( (X+XS)>ClipX ) if ((X+XS) > ClipX)
{ {
z = FindSplitPoint(Lines[i].Text[j].S,X,ClipX); z = FindSplitPoint(Lines[i].Text[j].S,X,ClipX);
@ -255,7 +255,7 @@ final function ParseLines( float ClipX )
Lines.Insert(i+1,1); Lines.Insert(i+1,1);
// Append the remaining lines there. // Append the remaining lines there.
for( n=j; n<Lines[i].Text.Length; ++n ) for (n=j; n < Lines[i].Text.Length; ++n)
Lines[i+1].Text.AddItem(Lines[i].Text[n]); Lines[i+1].Text.AddItem(Lines[i].Text[n]);
// Split the string at wrapping point. // Split the string at wrapping point.
@ -265,7 +265,7 @@ final function ParseLines( float ClipX )
Lines[i+1].Text[0].S = StripWhiteSpaces(Lines[i+1].Text[0].S); Lines[i+1].Text[0].S = StripWhiteSpaces(Lines[i+1].Text[0].S);
// If empty, clean it up. // If empty, clean it up.
if( Lines[i+1].Text[0].S=="" ) if (Lines[i+1].Text[0].S == "")
Lines[i+1].Text.Remove(0,1); Lines[i+1].Text.Remove(0,1);
// End the current line at wrapping point. // End the current line at wrapping point.
@ -279,24 +279,24 @@ final function ParseLines( float ClipX )
} }
// Slow, find wrapped splitting point in text. // Slow, find wrapped splitting point in text.
final function int FindSplitPoint( string S, float X, float ClipX ) final function int FindSplitPoint( string S, float X, float ClipX)
{ {
local int i,l,PrevWord; local int i,l,PrevWord;
local float XL,YL; local float XL,YL;
local bool bWasWhite,bStartedZero; local bool bWasWhite,bStartedZero;
bStartedZero = (X==0.f); bStartedZero = (X == 0.f);
Canvas.TextSize(Mid(S,0,1),XL,YL); Canvas.TextSize(Mid(S,0,1),XL,YL);
X += XL; X += XL;
i = 1; i = 1;
l = Len(S); l = Len(S);
PrevWord = 0; PrevWord = 0;
bWasWhite = true; bWasWhite = true;
while( i<l ) while( i < l)
{ {
if( Mid(S,i,1)==" " ) if (Mid(S,i,1) == " ")
{ {
if( !bWasWhite ) if (!bWasWhite)
{ {
PrevWord = i; PrevWord = i;
bWasWhite = true; bWasWhite = true;
@ -308,9 +308,9 @@ final function int FindSplitPoint( string S, float X, float ClipX )
} }
Canvas.TextSize(Mid(S,i,1),XL,YL); Canvas.TextSize(Mid(S,i,1),XL,YL);
X+=XL; X+=XL;
if( X>ClipX ) // Split here if possible. if (X > ClipX ) // Split here if possible.
{ {
if( PrevWord==0 ) if (PrevWord == 0)
return (bStartedZero ? i : 0); // No wrap. return (bStartedZero ? i : 0); // No wrap.
return PrevWord; return PrevWord;
} }
@ -318,9 +318,9 @@ final function int FindSplitPoint( string S, float X, float ClipX )
} }
return l; 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); S = Mid(S,1);
return S; return S;
} }
@ -335,19 +335,19 @@ function DrawMenu()
local int i,j,Index; local int i,j,Index;
local float Y; local float Y;
if( Text=="" || !bVisible ) if (Text == "" || !bVisible)
return; return;
// Need to figure out best fitting font. // 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(); InitSize();
if( MaxHistory != 0 ) if (MaxHistory != 0)
{ {
if( Lines.Length >= MaxHistory ) if (Lines.Length >= MaxHistory)
{ {
Index = InStr(Text, LineSplitter); Index = InStr(Text, LineSplitter);
if( Index == INDEX_NONE ) if (Index == INDEX_NONE)
Lines.Remove(0, 1); Lines.Remove(0, 1);
else SetText(Mid(Text, Index+Len(LineSplitter))); else SetText(Mid(Text, Index+Len(LineSplitter)));
} }
@ -355,24 +355,24 @@ function DrawMenu()
Canvas.Font = InitFont; Canvas.Font = InitFont;
if( bShowScrollbar ) if (bShowScrollbar)
{ {
Canvas.SetClip(CompPos[0]+(CompPos[2]-ScrollWidth),CompPos[1]+CompPos[3]); Canvas.SetClip(CompPos[0]+(CompPos[2]-ScrollWidth),CompPos[1]+CompPos[3]);
i = ScrollBar.GetValue(); i = ScrollBar.GetValue();
} }
else i = 0; else i = 0;
if( i<Lines.Length ) if (i < Lines.Length)
{ {
Y = Lines[i].Y; Y = Lines[i].Y;
for( i=i; i<Lines.Length; ++i ) for (i=i; i < Lines.Length; ++i)
{ {
if( Lines[i].Text.Length!=0 ) if (Lines[i].Text.Length != 0)
{ {
if( (Lines[i].Y-Y+TextHeight)>=CompPos[3] ) if ((Lines[i].Y-Y+TextHeight) >= CompPos[3])
break; break;
for( j=0; j<Lines[i].Text.Length; ++j ) for (j=0; j < Lines[i].Text.Length; ++j)
{ {
DrawTextField(Lines[i].Text[j].S, i, Lines[i].Text[j].X, Lines[i].Y-Y, Lines[i].Text[j].C, Lines[i].Text[j].TextType); DrawTextField(Lines[i].Text[j].S, i, Lines[i].Text[j].X, Lines[i].Y-Y, Lines[i].Text[j].C, Lines[i].Text[j].TextType);
} }
@ -388,24 +388,24 @@ function DrawTextField(string S, int Index, float X, float Y, optional Color C,
local Color MainColor; local Color MainColor;
MainColor = C; MainColor = C;
if( MainColor.A==0 ) if (MainColor.A == 0)
MainColor = TextColor; MainColor = TextColor;
Canvas.DrawColor = GetColorFromStyle(MainColor, TextStyle); Canvas.DrawColor = GetColorFromStyle(MainColor, TextStyle);
if( bFadeInOut ) if (bFadeInOut)
{ {
TempSize = `TimeSinceEx(GetPlayer(), FadeStartTime); TempSize = `TimeSinceEx(GetPlayer(), FadeStartTime);
if ( TempSize > MessageDisplayTime ) if (TempSize > MessageDisplayTime)
{ {
return; return;
} }
if ( TempSize < MessageFadeInTime ) if (TempSize < MessageFadeInTime)
{ {
FadeAlpha = int((TempSize / MessageFadeInTime) * 255.0); 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); 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; Canvas.DrawColor.A = FadeAlpha;
} }
if( bUseOutlineText ) if (bUseOutlineText)
{ {
Owner.CurrentStyle.DrawTextShadow(S,X,Y,OutlineSize,InitFontScale); Owner.CurrentStyle.DrawTextShadow(S,X,Y,OutlineSize,InitFontScale);
} }
@ -433,7 +433,7 @@ function Color GetColorFromStyle(Color MainColor, ETextFieldStyles TextStyle)
local float ColorHUE,Value; local float ColorHUE,Value;
local HSVColour HSV; local HSVColour HSV;
if( TextStyle == TEXT_FIELD_HSV ) if (TextStyle == TEXT_FIELD_HSV)
{ {
ColorHUE = Abs(Sin(GetPlayer().WorldInfo.TimeSeconds * 0.9) * 335); 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)); 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); Value = Abs(Sin(GetPlayer().WorldInfo.TimeSeconds * 0.9) * 1);
HSV = class'KFColorHelper'.static.RGBToHSV(ColorToLinearColor(MainColor)); HSV = class'KFColorHelper'.static.RGBToHSV(ColorToLinearColor(MainColor));
@ -461,9 +461,9 @@ function bool CaptureMouse()
return (bShowScrollbar ? Super.CaptureMouse() : false); // Nope. return (bShowScrollbar ? Super.CaptureMouse() : false); // Nope.
} }
function ScrollMouseWheel( bool bUp ) function ScrollMouseWheel( bool bUp)
{ {
if( bShowScrollbar ) if (bShowScrollbar)
ScrollBar.ScrollMouseWheel(bUp); ScrollBar.ScrollMouseWheel(bUp);
} }
@ -471,7 +471,7 @@ function SetVisibility(bool Visible)
{ {
Super.SetVisibility(Visible); Super.SetVisibility(Visible);
if( ScrollBar != None ) if (ScrollBar != None)
{ {
ScrollBar.SetVisibility(Visible); ScrollBar.SetVisibility(Visible);
} }

View File

@ -24,15 +24,15 @@ function InitSize()
TS = Owner.CurrentStyle.GetFontScaler(); TS = Owner.CurrentStyle.GetFontScaler();
TS *= FontScale; TS *= FontScale;
while( true ) while( true)
{ {
Canvas.Font = Owner.CurrentStyle.MainFont; Canvas.Font = Owner.CurrentStyle.MainFont;
if( TextFontInfo.bClipText ) if (TextFontInfo.bClipText)
Canvas.TextSize(Text,XL,YL,TS,TS); Canvas.TextSize(Text,XL,YL,TS,TS);
else else
{ {
Canvas.SetPos(0,0); Canvas.SetPos(0,0);
if( TS==1 ) if (TS == 1)
Canvas.StrLen(Text,XL,YL); Canvas.StrLen(Text,XL,YL);
else else
{ {
@ -42,7 +42,7 @@ function InitSize()
YL*=TS; 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; break;
TS -= 0.001; TS -= 0.001;
@ -51,7 +51,7 @@ function InitSize()
InitFont = Canvas.Font; InitFont = Canvas.Font;
InitFontScale = TS; InitFontScale = TS;
switch( AlignX ) switch( AlignX)
{ {
case 0: case 0:
InitOffset[0] = 0; InitOffset[0] = 0;
@ -62,7 +62,7 @@ function InitSize()
default: default:
InitOffset[0] = CompPos[2]-(XL+1); InitOffset[0] = CompPos[2]-(XL+1);
} }
switch( AlignY ) switch( AlignY)
{ {
case 0: case 0:
InitOffset[1] = 0; InitOffset[1] = 0;
@ -74,9 +74,9 @@ function InitSize()
InitOffset[1] = CompPos[3]-YL; InitOffset[1] = CompPos[3]-YL;
} }
} }
function SetText( string S ) function SetText( string S)
{ {
if( Text==S ) if (Text == S)
return; return;
Text = S; Text = S;
OldSize[0] = -1; // Force to refresh. OldSize[0] = -1; // Force to refresh.
@ -88,16 +88,16 @@ final function string GetText()
function DrawMenu() function DrawMenu()
{ {
if( Text=="" ) if (Text == "")
return; return;
// Need to figure out best fitting font. // 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(); InitSize();
Canvas.Font = InitFont; Canvas.Font = InitFont;
Canvas.DrawColor = TextColor; Canvas.DrawColor = TextColor;
if( bUseOutline ) if (bUseOutline)
{ {
Owner.CurrentStyle.DrawTextShadow(Text,InitOffset[0],InitOffset[1],OutlineSize,InitFontScale); Owner.CurrentStyle.DrawTextShadow(Text,InitOffset[0],InitOffset[1],OutlineSize,InitFontScale);
} }

View File

@ -7,10 +7,10 @@ var float ScrollSpeed;
var transient float CharStartTime; var transient float CharStartTime;
var transient bool bScrollCompleted, bTextDirty; var transient bool bScrollCompleted, bTextDirty;
var transient array<bool> RowsCompleted; var transient array < bool> RowsCompleted;
var transient int MaxIndex, RowsDropped; var transient int MaxIndex, RowsDropped;
function SetText( string S ) function SetText( string S)
{ {
Super.SetText(S); Super.SetText(S);
@ -32,38 +32,38 @@ function DrawMenu()
local Texture CurrentCursor; local Texture CurrentCursor;
local ETextFieldStyles TextStyle; local ETextFieldStyles TextStyle;
if( bScrollCompleted ) if (bScrollCompleted)
{ {
Super.DrawMenu(); Super.DrawMenu();
return; return;
} }
if( Text=="" ) if (Text == "")
return; return;
// Need to figure out best fitting font. // 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(); InitSize();
Canvas.Font = InitFont; Canvas.Font = InitFont;
if( bShowScrollbar ) if (bShowScrollbar)
{ {
Canvas.SetClip(CompPos[0]+(CompPos[2]-ScrollWidth),CompPos[1]+CompPos[3]); Canvas.SetClip(CompPos[0]+(CompPos[2]-ScrollWidth),CompPos[1]+CompPos[3]);
i = ScrollBar.GetValue(); i = ScrollBar.GetValue();
} }
else i = 0; else i = 0;
if( ScrollBar != None ) if (ScrollBar != None)
{ {
if( bTextDirty ) if (bTextDirty)
{ {
ScrollBar.bDisabled = true; ScrollBar.bDisabled = true;
RowsCompleted.Length = Lines.Length; RowsCompleted.Length = Lines.Length;
bTextDirty = false; bTextDirty = false;
} }
if( RowsCompleted[Lines.Length-1] ) if (RowsCompleted[Lines.Length-1])
{ {
ScrollBar.AddValue(1); ScrollBar.AddValue(1);
ScrollBar.bDisabled = false; ScrollBar.bDisabled = false;
@ -74,7 +74,7 @@ function DrawMenu()
return; return;
} }
else if( MaxIndex != 0 && RowsCompleted[MaxIndex] ) else if (MaxIndex != 0 && RowsCompleted[MaxIndex])
{ {
MaxIndex = 0; MaxIndex = 0;
ScrollBar.AddValue(1); 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<Lines[i].Text.Length; ++j ) for (j=0; j < Lines[i].Text.Length; ++j)
{ {
for( k=0; k<=Len(Lines[i].Text[j].S); ++k ) for (k=0; k <= Len(Lines[i].Text[j].S); ++k)
{ {
CharTime += ScrollSpeed; CharTime += ScrollSpeed;
} }
@ -100,24 +100,24 @@ function DrawMenu()
} }
DTime = `TimeSinceEx(GetPlayer(), CharStartTime); DTime = `TimeSinceEx(GetPlayer(), CharStartTime);
if( i<Lines.Length ) if (i < Lines.Length)
{ {
CurrentCursor = Owner.DefaultPens[GetCursorStyle()]; CurrentCursor = Owner.DefaultPens[GetCursorStyle()];
Y = Lines[i].Y; Y = Lines[i].Y;
for( i=i; i<Lines.Length; ++i ) for (i=i; i < Lines.Length; ++i)
{ {
if( (Lines[i].Y-Y+TextHeight)>=CompPos[3] ) if ((Lines[i].Y-Y+TextHeight) >= CompPos[3])
{ {
MaxIndex = i-1; MaxIndex = i-1;
break; break;
} }
if( Lines[i].Text.Length!=0 ) if (Lines[i].Text.Length != 0)
{ {
for( j=0; j<Lines[i].Text.Length; ++j ) for (j=0; j < Lines[i].Text.Length; ++j)
{ {
MainTextColor = Lines[i].Text[j].C; MainTextColor = Lines[i].Text[j].C;
if( MainTextColor.A==0 ) if (MainTextColor.A == 0)
MainTextColor = TextColor; MainTextColor = TextColor;
TextStyle = Lines[i].Text[j].TextType; TextStyle = Lines[i].Text[j].TextType;
@ -128,15 +128,15 @@ function DrawMenu()
SLen = Len(MainString); SLen = Len(MainString);
CurrentIndex = 0; CurrentIndex = 0;
for( k=0; k<=SLen; ++k ) for (k=0; k <= SLen; ++k)
{ {
CharTime += ScrollSpeed; CharTime += ScrollSpeed;
Canvas.TextSize(Mid(MainString, 0, k), XL, YL, InitFontScale, InitFontScale); Canvas.TextSize(Mid(MainString, 0, k), XL, YL, InitFontScale, InitFontScale);
if ( CharTime > DTime ) if (CharTime > DTime)
{ {
if( CurrentIndex == k ) if (CurrentIndex == k)
{ {
Canvas.SetDrawColor(255,255,255,255); Canvas.SetDrawColor(255,255,255,255);
Canvas.SetPos(MainX+XL,MainY); Canvas.SetPos(MainX+XL,MainY);
@ -152,7 +152,7 @@ function DrawMenu()
CurrentIndex = k+1; CurrentIndex = k+1;
if( k >= SLen ) if (k >= SLen)
{ {
RowsCompleted[i] = true; RowsCompleted[i] = true;
} }
@ -168,12 +168,12 @@ function bool CaptureMouse()
return (!bScrollCompleted && Super(KFGUI_MultiComponent).CaptureMouse()) || Super.CaptureMouse(); return (!bScrollCompleted && Super(KFGUI_MultiComponent).CaptureMouse()) || Super.CaptureMouse();
} }
function MouseClick( bool bRight ) function MouseClick( bool bRight)
{ {
if( bScrollCompleted ) if (bScrollCompleted)
return; return;
if( ScrollBar != None ) if (ScrollBar != None)
ScrollBar.bDisabled = false; ScrollBar.bDisabled = false;
bScrollCompleted = true; bScrollCompleted = true;

View File

@ -3,7 +3,7 @@ Class KFGUI_Tooltip extends KFGUI_Base;
`include(Build.uci) `include(Build.uci)
`include(Logger.uci) `include(Logger.uci)
var() array<string> Lines; var() array < string> Lines;
var() Canvas.FontRenderInfo TextFontInfo; var() Canvas.FontRenderInfo TextFontInfo;
var byte CurrentAlpha; var byte CurrentAlpha;
@ -11,11 +11,11 @@ function InputMouseMoved()
{ {
DropInputFocus(); DropInputFocus();
} }
function MouseClick( bool bRight ) function MouseClick( bool bRight)
{ {
DropInputFocus(); DropInputFocus();
} }
function MouseRelease( bool bRight ) function MouseRelease( bool bRight)
{ {
DropInputFocus(); DropInputFocus();
} }
@ -24,14 +24,14 @@ function ShowMenu()
CurrentAlpha = 1; CurrentAlpha = 1;
} }
final function SetText( string S ) final function SetText( string S)
{ {
ParseStringIntoArray(S,Lines,"<SEPERATOR>",false); ParseStringIntoArray(S,Lines," < SEPERATOR > ",false);
} }
function PreDraw() function PreDraw()
{ {
if( !bVisible ) if (!bVisible)
return; return;
Owner.CurrentStyle.RenderToolTip(Self); Owner.CurrentStyle.RenderToolTip(Self);

View File

@ -13,7 +13,7 @@ var KFGUI_List PlayersList;
var Texture2D DefaultAvatar; var Texture2D DefaultAvatar;
var KFGameReplicationInfo KFGRI; var KFGameReplicationInfo KFGRI;
var array<KFPlayerReplicationInfo> KFPRIArray; var array < KFPlayerReplicationInfo> KFPRIArray;
var KFPlayerController OwnerPC; var KFPlayerController OwnerPC;
@ -21,8 +21,8 @@ var Color PingColor;
var float PingBars; var float PingBars;
// Ranks // Ranks
var array<RankInfo> CustomRanks; var array < RankInfo> CustomRanks;
var array<UIDRankRelation> RankRelations; var array < UIDRankRelation> RankRelations;
var SCESettings Settings; var SCESettings Settings;
@ -37,27 +37,27 @@ static function CheckAvatar(KFPlayerReplicationInfo KFPRI, KFPlayerController PC
{ {
local Texture2D Avatar; local Texture2D Avatar;
if( KFPRI.Avatar == None || KFPRI.Avatar == default.DefaultAvatar ) if (KFPRI.Avatar == None || KFPRI.Avatar == default.DefaultAvatar)
{ {
Avatar = FindAvatar(PC, KFPRI.UniqueId); Avatar = FindAvatar(PC, KFPRI.UniqueId);
if( Avatar == None ) if (Avatar == None)
Avatar = default.DefaultAvatar; Avatar = default.DefaultAvatar;
KFPRI.Avatar = Avatar; 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; return true;
if( P1.GetTeamNum() < P2.GetTeamNum() ) if (P1.GetTeamNum() < P2.GetTeamNum())
return false; 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 true;
return P1.Assists < P2.Assists; return P1.Assists < P2.Assists;
@ -71,7 +71,7 @@ function string WaveText()
local int CurrentWaveNum; local int CurrentWaveNum;
CurrentWaveNum = KFGRI.WaveNum; CurrentWaveNum = KFGRI.WaveNum;
if(KFGRI.IsBossWave()) if (KFGRI.IsBossWave())
{ {
return class'KFGFxHUD_WaveInfo'.default.BossWaveString; return class'KFGFxHUD_WaveInfo'.default.BossWaveString;
} }
@ -103,23 +103,23 @@ function DrawMenu()
local float BorderSize; local float BorderSize;
PC = GetPlayer(); PC = GetPlayer();
if( KFGRI==None ) if (KFGRI == None)
{ {
KFGRI = KFGameReplicationInfo(PC.WorldInfo.GRI); KFGRI = KFGameReplicationInfo(PC.WorldInfo.GRI);
if( KFGRI==None ) if (KFGRI == None)
return; return;
} }
// Sort player list. // Sort player list.
if( NextScoreboardRefresh < PC.WorldInfo.TimeSeconds ) if (NextScoreboardRefresh < PC.WorldInfo.TimeSeconds)
{ {
NextScoreboardRefresh = PC.WorldInfo.TimeSeconds + 0.1; 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]; PRI = KFGRI.PRIArray[i];
KFGRI.PRIArray[i] = KFGRI.PRIArray[j]; KFGRI.PRIArray[i] = KFGRI.PRIArray[j];
@ -132,30 +132,30 @@ function DrawMenu()
// Check players. // Check players.
PlayerIndex = -1; PlayerIndex = -1;
NumPlayer = 0; 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]); KFPRI = KFPlayerReplicationInfo(KFGRI.PRIArray[i]);
if( KFPRI==None ) if (KFPRI == None)
continue; continue;
if( KFPRI.bOnlySpectator ) if (KFPRI.bOnlySpectator)
{ {
++NumSpec; ++NumSpec;
continue; continue;
} }
if( KFPRI.PlayerHealth>0 && KFPRI.PlayerHealthPercent>0 && KFPRI.GetTeamNum()==0 ) if (KFPRI.PlayerHealth > 0 && KFPRI.PlayerHealthPercent > 0 && KFPRI.GetTeamNum() == 0)
++NumAlivePlayer; ++NumAlivePlayer;
++NumPlayer; ++NumPlayer;
} }
KFPRIArray.Length = NumPlayer; KFPRIArray.Length = NumPlayer;
j = KFPRIArray.Length; 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]); KFPRI = KFPlayerReplicationInfo(KFGRI.PRIArray[i]);
if( KFPRI!=None && !KFPRI.bOnlySpectator ) if (KFPRI != None && !KFPRI.bOnlySpectator)
{ {
KFPRIArray[--j] = KFPRI; KFPRIArray[--j] = KFPRI;
if( KFPRI==PC.PlayerReplicationInfo ) if (KFPRI == PC.PlayerReplicationInfo)
PlayerIndex = j; PlayerIndex = j;
} }
} }
@ -316,7 +316,7 @@ function SetDrawColor(Canvas C, ColorRGBA RGBA)
C.SetDrawColor(RGBA.R, RGBA.G, RGBA.B, RGBA.A); 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 string S, StrValue;
local float FontScalar, TextYOffset, XL, YL, PerkIconPosX, PerkIconPosY, PerkIconSize, PrestigeIconScale; 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' // Now all players belongs to 'Rank'
if( KFGRI.bVersusGame ) if (KFGRI.bVersusGame)
bIsZED = KFTeamInfo_Zeds(KFPRI.Team) != None; bIsZED = KFTeamInfo_Zeds(KFPRI.Team) != None;
XPos = 0.f; 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); Canvas.TextSize("ABC", XL, YL, FontScalar, FontScalar);
// change rect color by HP // change rect color by HP
if( !KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun ) if (!KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun)
{ {
SetDrawColor(C, Settings.Style.LeftStateBoxColor); SetDrawColor(C, Settings.Style.LeftStateBoxColor);
} }
else if ( !KFGRI.bMatchHasBegun ) else if (!KFGRI.bMatchHasBegun)
{ {
SetDrawColor(C, Settings.Style.LeftStateBoxColor); 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); 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); DrawTextShadowHLeftVCenter(S, RankXPos, TextYOffset, FontScalar);
// Perk // Perk
if( bIsZED ) if (bIsZED)
{ {
if (CurrentRank.ApplyColorToFields.Perk) if (CurrentRank.ApplyColorToFields.Perk)
SetDrawColor(C, CurrentRank.TextColor); SetDrawColor(C, CurrentRank.TextColor);
@ -461,7 +461,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
} }
else else
{ {
if( KFPRI.CurrentPerkClass!=None ) if (KFPRI.CurrentPerkClass != None)
{ {
PrestigeLevel = KFPRI.GetActivePerkPrestigeLevel(); PrestigeLevel = KFPRI.GetActivePerkPrestigeLevel();
Level = KFPRI.GetActivePerkLevel(); Level = KFPRI.GetActivePerkLevel();
@ -525,9 +525,9 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
} }
// Avatar // Avatar
if( KFPRI.Avatar != None ) if (KFPRI.Avatar != None)
{ {
if( KFPRI.Avatar == default.DefaultAvatar ) if (KFPRI.Avatar == default.DefaultAvatar)
CheckAvatar(KFPRI, OwnerPC); CheckAvatar(KFPRI, OwnerPC);
C.SetDrawColor(255,255,255,255); 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); 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); 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); CheckAvatar(KFPRI, OwnerPC);
// Player // Player
@ -561,7 +561,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
DrawTextShadowHVCenter(string (KFPRI.Assists), AssistXPos, TextYOffset, AssistWBox, FontScalar); DrawTextShadowHVCenter(string (KFPRI.Assists), AssistXPos, TextYOffset, AssistWBox, FontScalar);
// Cash // Cash
if( bIsZED ) if (bIsZED)
{ {
SetDrawColor(C, Settings.Style.ZedTextColor); SetDrawColor(C, Settings.Style.ZedTextColor);
StrValue = "Brains!"; StrValue = "Brains!";
@ -577,12 +577,12 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
DrawTextShadowHVCenter(StrValue, CashXPos, TextYOffset, CashWBox, FontScalar); DrawTextShadowHVCenter(StrValue, CashXPos, TextYOffset, CashWBox, FontScalar);
// State // State
if( !KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun ) if (!KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun)
{ {
SetDrawColor(C, Settings.Style.StateTextColorLobby); SetDrawColor(C, Settings.Style.StateTextColorLobby);
S = "LOBBY"; S = "LOBBY";
} }
else if( !KFGRI.bMatchHasBegun ) else if (!KFGRI.bMatchHasBegun)
{ {
if (KFPRI.bReadyToPlay) if (KFPRI.bReadyToPlay)
{ {
@ -595,7 +595,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
S = "Not Ready"; 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); SetDrawColor(C, Settings.Style.StateTextColor);
S = "Unknown"; 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)); 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 float PingMul, BarW, BarH, BaseH, XPos, YPos;
local byte i; 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.R = (1.f - PingMul) * 255;
PingColor.G = PingMul * 255; PingColor.G = PingMul * 255;
for(i=1; i<PingBars; i++) for (i=1; i < PingBars; i++)
{ {
BarH = BaseH * i; BarH = BaseH * i;
XPos = XOffset + ((i - 1) * BarW); XPos = XOffset + ((i - 1) * BarW);
@ -681,7 +681,7 @@ final function DrawPingBars( Canvas C, float YOffset, float XOffset, float W, fl
C.SetDrawColor(20, 20, 20, 255); C.SetDrawColor(20, 20, 20, 255);
Owner.CurrentStyle.DrawWhiteBox(BarW,BarH); Owner.CurrentStyle.DrawWhiteBox(BarW,BarH);
if( PingMul >= (i / PingBars) ) if (PingMul >= (i / PingBars))
{ {
C.SetPos(XPos,YPos); C.SetPos(XPos,YPos);
C.DrawColor = PingColor; 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; local string S;
S = PC.GetSteamAvatar(ClientID); S = PC.GetSteamAvatar(ClientID);
if( S=="" ) if (S == "")
return None; return None;
return Texture2D(PC.FindObject(S,class'Texture2D')); return Texture2D(PC.FindObject(S,class'Texture2D'));
} }
final static function string GetNiceSize(int Num) final static function string GetNiceSize(int Num)
{ {
if( Num < 1000 ) return string(Num); if (Num < 1000 ) return string(Num);
else if( Num < 1000000 ) return (Num / 1000) $ "K"; else if (Num < 1000000 ) return (Num / 1000) $ "K";
else if( Num < 1000000000 ) return (Num / 1000000) $ "M"; else if (Num < 1000000000 ) return (Num / 1000000) $ "M";
return (Num / 1000000000) $ "B"; return (Num / 1000000000) $ "B";
} }
function ScrollMouseWheel( bool bUp ) function ScrollMouseWheel( bool bUp)
{ {
PlayersList.ScrollMouseWheel(bUp); PlayersList.ScrollMouseWheel(bUp);
} }

View File

@ -5,4 +5,4 @@ class PlayerRankRelations extends Object
`include(Build.uci) `include(Build.uci)
`include(Logger.uci) `include(Logger.uci)
var config array<RankRelation> Relation; var config array < RankRelation> Relation;

View File

@ -7,9 +7,9 @@ class ScoreboardExtHUD extends KFGFxHudWrapper
const HUDBorderSize = 3; const HUDBorderSize = 3;
var float ScaledBorderSize; var float ScaledBorderSize;
var array<KFGUI_Base> HUDWidgets; var array < KFGUI_Base> HUDWidgets;
var class<KFScoreBoard> ScoreboardClass; var class < KFScoreBoard> ScoreboardClass;
var KFScoreBoard Scoreboard; var KFScoreBoard Scoreboard;
var transient KF2GUIController GUIController; var transient KF2GUIController GUIController;
@ -29,16 +29,16 @@ simulated function PostBeginPlay()
function PostRender() function PostRender()
{ {
if( KFGRI == None ) if (KFGRI == None)
KFGRI = KFGameReplicationInfo(WorldInfo.GRI); KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
if( GUIController!=None && PlayerOwner.PlayerInput==None ) if (GUIController != None && PlayerOwner.PlayerInput == None)
GUIController.NotifyLevelChange(); GUIController.NotifyLevelChange();
if( GUIController==None || GUIController.bIsInvalid ) if (GUIController == None || GUIController.bIsInvalid)
{ {
GUIController = Class'ScoreboardExt.KF2GUIController'.Static.GetGUIController(PlayerOwner); GUIController = Class'ScoreboardExt.KF2GUIController'.Static.GetGUIController(PlayerOwner);
if( GUIController!=None ) if (GUIController != None)
{ {
GUIStyle = GUIController.CurrentStyle; GUIStyle = GUIController.CurrentStyle;
GUIStyle.HUDOwner = self; GUIStyle.HUDOwner = self;
@ -48,7 +48,7 @@ function PostRender()
GUIStyle.Canvas = Canvas; GUIStyle.Canvas = Canvas;
GUIStyle.PickDefaultFontSize(Canvas.ClipY); GUIStyle.PickDefaultFontSize(Canvas.ClipY);
if( !GUIController.bIsInMenuState ) if (!GUIController.bIsInMenuState)
GUIController.HandleDrawMenu(); GUIController.HandleDrawMenu();
ScaledBorderSize = FMax(GUIStyle.ScreenScale(HUDBorderSize), 1.f); ScaledBorderSize = FMax(GUIStyle.ScreenScale(HUDBorderSize), 1.f);
@ -66,9 +66,9 @@ function bool NotifyInputKey(int ControllerId, Name Key, EInputEvent Event, floa
{ {
local int i; 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; return true;
} }
@ -79,9 +79,9 @@ function bool NotifyInputAxis(int ControllerId, name Key, float Delta, float Del
{ {
local int i; 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; return true;
} }
@ -92,9 +92,9 @@ function bool NotifyInputChar(int ControllerId, string Unicode)
{ {
local int i; 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; return true;
} }

View File

@ -17,10 +17,10 @@ struct SClient
var KFPlayerController KFPC; var KFPlayerController KFPC;
}; };
var private array<SClient> RepClients; var private array < SClient> RepClients;
var private array<UIDRankRelation> UIDRankRelationsPlayers; var private array < UIDRankRelation> UIDRankRelationsPlayers;
var private array<UIDRankRelation> UIDRankRelationsSteamGroups; var private array < UIDRankRelation> UIDRankRelationsSteamGroups;
var private array<UIDRankRelation> UIDRankRelationsActive; var private array < UIDRankRelation> UIDRankRelationsActive;
var private SCESettings Settings; var private SCESettings Settings;
function PostBeginPlay() function PostBeginPlay()

View File

@ -11,9 +11,9 @@ var private KFScoreBoard SC;
var private OnlineSubsystemSteamworks SW; var private OnlineSubsystemSteamworks SW;
// Fitst time replication // Fitst time replication
var public array<UIDRankRelation> SteamGroupRelations; var public array < UIDRankRelation> SteamGroupRelations;
var private array<UIDRankRelation> RankRelations; var private array < UIDRankRelation> RankRelations;
var public array<RankInfo> CustomRanks; var public array < RankInfo> CustomRanks;
var public SCESettings Settings; var public SCESettings Settings;
var public UIDRankRelation RankRelation; // Current player rank relation var public UIDRankRelation RankRelation; // Current player rank relation

View File

@ -5,7 +5,7 @@ class SteamGroupRankRelations extends Object
`include(Build.uci) `include(Build.uci)
`include(Logger.uci) `include(Logger.uci)
var config array<RankRelation> Relation; var config array < RankRelation> Relation;
DefaultProperties DefaultProperties
{ {