diff --git a/YAS/Build.uci b/YAS/Build.uci deleted file mode 100644 index 1d385b7..0000000 --- a/YAS/Build.uci +++ /dev/null @@ -1,2 +0,0 @@ -`define bEnableCallstack false -`define bEnableDebug false \ No newline at end of file diff --git a/YAS/Classes/ClassicStyle.uc b/YAS/Classes/ClassicStyle.uc index 0d12c45..88e1b50 100644 --- a/YAS/Classes/ClassicStyle.uc +++ b/YAS/Classes/ClassicStyle.uc @@ -1,7 +1,4 @@ -Class ClassicStyle extends KF2Style; - -`include(Build.uci) -`include(Logger.uci) +class ClassicStyle extends KF2Style; function RenderFramedWindow(KFGUI_FloatingWindow P) { diff --git a/YAS/Classes/CustomRanks.uc b/YAS/Classes/CustomRanks.uc deleted file mode 100644 index c422b47..0000000 --- a/YAS/Classes/CustomRanks.uc +++ /dev/null @@ -1,47 +0,0 @@ -class CustomRanks extends Object - dependson(Types) - config(YAS); - -`include(Build.uci) -`include(Logger.uci) - -var config array Rank; - -public static function InitConfig(int ConfigVersion) -{ - local RankInfo ExampleRank; - - `callstack_static("InitConfig"); - - switch (ConfigVersion) - { - case 0: - // Example rank for player(s) - ExampleRank.ID = 0; - ExampleRank.Rank = "YAS Creator"; - ExampleRank.TextColor.R = 130; - ExampleRank.TextColor.G = 250; - ExampleRank.TextColor.B = 235; - ExampleRank.OverrideAdminRank = false; - default.Rank.AddItem(ExampleRank); - - // Example rank for steam group members - ExampleRank.ID = 1; - ExampleRank.Rank = "MSK-GS"; - ExampleRank.TextColor.R = 130; - ExampleRank.TextColor.G = 250; - ExampleRank.TextColor.B = 130; - ExampleRank.OverrideAdminRank = false; - default.Rank.AddItem(ExampleRank); - - case 1: - - case 2147483647: - StaticSaveConfig(); - } -} - -defaultproperties -{ - -} \ No newline at end of file diff --git a/YAS/Classes/GUIStyleBase.uc b/YAS/Classes/GUIStyleBase.uc index 172327e..bde0dac 100644 --- a/YAS/Classes/GUIStyleBase.uc +++ b/YAS/Classes/GUIStyleBase.uc @@ -1,9 +1,6 @@ -Class GUIStyleBase extends Object +class GUIStyleBase extends Object abstract; -`include(Build.uci) -`include(Logger.uci) - var Texture2D ItemTex; var array BorderTextures, ArrowTextures, ButtonTextures, TabTextures, ItemBoxTextures, PerkBox, CheckBoxTextures, ProgressBarTextures, SliderTextures; var Texture2D ScrollTexture, FavoriteIcon, BankNoteIcon; @@ -14,7 +11,7 @@ var() byte MaxFontScale; var float DefaultHeight; // Default font text size. var transient Canvas Canvas; var transient KF2GUIController Owner; -var transient YASHUD HUDOwner; +var transient YAS_HUD HUDOwner; var Font MainFont, NumberFont, InfiniteFont; var Color BlurColor, BlurColor2; diff --git a/YAS/Classes/KF2GUIController.uc b/YAS/Classes/KF2GUIController.uc index d8913cb..90ab307 100644 --- a/YAS/Classes/KF2GUIController.uc +++ b/YAS/Classes/KF2GUIController.uc @@ -1,13 +1,10 @@ -Class KF2GUIController extends Info +class KF2GUIController extends Info transient; -`include(Build.uci) -`include(Logger.uci) - var() class DefaultStyle; var PlayerController PlayerOwner; -var YASHUD HUDOwner; +var YAS_HUD HUDOwner; var transient KF2GUIInput CustomInput; var transient PlayerInput BackupInput; var transient GameViewportClient ClientViewport; @@ -67,7 +64,7 @@ simulated function PostBeginPlay() { PlayerOwner = PlayerController(Owner); ClientViewport = LocalPlayer(PlayerOwner.Player).ViewportClient; - HUDOwner = YASHUD(PlayerOwner.myHUD); + HUDOwner = YAS_HUD(PlayerOwner.myHUD); CurrentStyle = new (None) DefaultStyle; CurrentStyle.InitStyle(); @@ -448,7 +445,7 @@ simulated function KFGUI_Base InitializeHUDWidget(class GUIClass) { local KFGUI_Base Widget; - if (GUIClass == None) + if (GUIclass == None) return None; Widget = New(None) GUIClass; @@ -471,7 +468,7 @@ simulated function KFGUI_Page OpenMenu(class MenuClass) local int i; local KFGUI_Page M; - if (MenuClass == None) + if (Menuclass == None) return None; if (KeyboardFocus != None) @@ -489,7 +486,7 @@ simulated function KFGUI_Page OpenMenu(class MenuClass) if (MenuClass.Default.bUnique) { 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. { @@ -504,7 +501,7 @@ simulated function KFGUI_Page OpenMenu(class MenuClass) if (MenuClass.Default.bPersistant) { for (i=0; i < PersistentMenus.Length; ++i) - if (PersistentMenus[i].Class == MenuClass) + if (PersistentMenus[i].class == MenuClass) { M = PersistentMenus[i]; PersistentMenus.Remove(i, 1); @@ -532,7 +529,7 @@ simulated function CloseMenu(class MenuClass, optional bool bCloseAl local int i, j; local KFGUI_Page M; - if (!bCloseAll && MenuClass == None) + if (!bCloseAll && Menuclass == None) return; if (KeyboardFocus != None) @@ -544,7 +541,7 @@ simulated function CloseMenu(class MenuClass, optional bool bCloseAl } for (i=(ActiveMenus.Length-1); i >= 0; --i) { - if (bCloseAll || ActiveMenus[i].Class == MenuClass) + if (bCloseAll || ActiveMenus[i].class == MenuClass) { M = ActiveMenus[i]; ActiveMenus.Remove(i, 1); @@ -628,7 +625,7 @@ simulated final function bool MenuIsOpen(optional class MenuClass) local int 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 false; } diff --git a/YAS/Classes/KF2GUIInput.uc b/YAS/Classes/KF2GUIInput.uc index e0acdd3..0edc83c 100644 --- a/YAS/Classes/KF2GUIInput.uc +++ b/YAS/Classes/KF2GUIInput.uc @@ -1,10 +1,6 @@ // Input while in a menu. class KF2GUIInput extends KFPlayerInput; -`include(Build.uci) -`include(Logger.uci) - - var KF2GUIController ControllerOwner; var PlayerInput BaseInput; diff --git a/YAS/Classes/KF2Style.uc b/YAS/Classes/KF2Style.uc index a5a563a..e35befd 100644 --- a/YAS/Classes/KF2Style.uc +++ b/YAS/Classes/KF2Style.uc @@ -1,7 +1,4 @@ -Class KF2Style extends GUIStyleBase; - -`include(Build.uci) -`include(Logger.uci) +class KF2Style extends GUIStyleBase; var Texture2D LoadedTex[2]; const TOOLTIP_BORDER=4; diff --git a/YAS/Classes/KFColorHelper.uc b/YAS/Classes/KFColorHelper.uc index acc8067..a32e4d8 100644 --- a/YAS/Classes/KFColorHelper.uc +++ b/YAS/Classes/KFColorHelper.uc @@ -2,10 +2,6 @@ class KFColorHelper extends Object transient; -`include(Build.uci) -`include(Logger.uci) - - struct HSVColour { var() float H, S, V, A; diff --git a/YAS/Classes/KFGUIConsoleHack.uc b/YAS/Classes/KFGUIConsoleHack.uc index 7ab73a9..5745413 100644 --- a/YAS/Classes/KFGUIConsoleHack.uc +++ b/YAS/Classes/KFGUIConsoleHack.uc @@ -1,8 +1,5 @@ // Ugly hack to draw ontop of flash UI! -Class KFGUIConsoleHack extends Console; - -`include(Build.uci) -`include(Logger.uci) +class KFGUIConsoleHack extends Console; var KF2GUIController OutputObject; diff --git a/YAS/Classes/KFGUI_Base.uc b/YAS/Classes/KFGUI_Base.uc index 8ff4868..07c6d86 100644 --- a/YAS/Classes/KFGUI_Base.uc +++ b/YAS/Classes/KFGUI_Base.uc @@ -1,13 +1,9 @@ // Menu system written by Marco. -Class KFGUI_Base extends Object +class KFGUI_Base extends Object abstract; -`include(Build.uci) -`include(Logger.uci) - - var KF2GUIController Owner; -var YASHUD HUDOwner; +var YAS_HUD HUDOwner; var KFGUI_Base ParentComponent; // Parent component if any. var transient Canvas Canvas; diff --git a/YAS/Classes/KFGUI_Button.uc b/YAS/Classes/KFGUI_Button.uc index 73487aa..4eb40ac 100644 --- a/YAS/Classes/KFGUI_Button.uc +++ b/YAS/Classes/KFGUI_Button.uc @@ -1,8 +1,4 @@ -Class KFGUI_Button extends KFGUI_Clickable; - -`include(Build.uci) -`include(Logger.uci) - +class KFGUI_Button extends KFGUI_Clickable; var() Canvas.CanvasIcon OverlayTexture; var() string ButtonText, GamepadButtonName; diff --git a/YAS/Classes/KFGUI_CategoryButton.uc b/YAS/Classes/KFGUI_CategoryButton.uc index cd5ba49..a394b18 100644 --- a/YAS/Classes/KFGUI_CategoryButton.uc +++ b/YAS/Classes/KFGUI_CategoryButton.uc @@ -1,9 +1,5 @@ class KFGUI_CategoryButton extends KFGUI_Button; -`include(Build.uci) -`include(Logger.uci) - - var transient bool bOpened; var Texture2D Icon; var Color IconColor; diff --git a/YAS/Classes/KFGUI_CategoryList.uc b/YAS/Classes/KFGUI_CategoryList.uc index b4f2b42..cc1a52f 100644 --- a/YAS/Classes/KFGUI_CategoryList.uc +++ b/YAS/Classes/KFGUI_CategoryList.uc @@ -1,9 +1,5 @@ class KFGUI_CategoryList extends KFGUI_ComponentList; -`include(Build.uci) -`include(Logger.uci) - - // Broken, does not work correctly when closing a menu and re-opening it if a category is open struct FCategoryItems { diff --git a/YAS/Classes/KFGUI_CheckBox.uc b/YAS/Classes/KFGUI_CheckBox.uc index 25bcf64..2bbd867 100644 --- a/YAS/Classes/KFGUI_CheckBox.uc +++ b/YAS/Classes/KFGUI_CheckBox.uc @@ -1,8 +1,4 @@ -Class KFGUI_CheckBox extends KFGUI_EditControl; - -`include(Build.uci) -`include(Logger.uci) - +class KFGUI_CheckBox extends KFGUI_EditControl; var() Texture CheckMark, CheckDisabled, CheckIdle, CheckFocus, CheckClicked; var() bool bForceUniform, bChecked; diff --git a/YAS/Classes/KFGUI_Clickable.uc b/YAS/Classes/KFGUI_Clickable.uc index 374bd5b..f3f5ba8 100644 --- a/YAS/Classes/KFGUI_Clickable.uc +++ b/YAS/Classes/KFGUI_Clickable.uc @@ -1,10 +1,6 @@ -Class KFGUI_Clickable extends KFGUI_Base +class KFGUI_Clickable extends KFGUI_Base abstract; -`include(Build.uci) -`include(Logger.uci) - - var() int IntIndex; // More user variables. var() string ToolTip; diff --git a/YAS/Classes/KFGUI_ColorSlider.uc b/YAS/Classes/KFGUI_ColorSlider.uc index 6198db5..472f439 100644 --- a/YAS/Classes/KFGUI_ColorSlider.uc +++ b/YAS/Classes/KFGUI_ColorSlider.uc @@ -1,8 +1,5 @@ class KFGUI_ColorSlider extends KFGUI_MultiComponent; -`include(Build.uci) -`include(Logger.uci) - var KFGUI_Slider RSlider, GSlider, BSlider, ASlider; var KFGUI_TextLable TextLable, RedLabel, GreenLabel, BlueLabel, AlphaLabel, RedValue, GreenValue, BlueValue, AlphaValue; var KFGUI_ComponentList SettingsBox; diff --git a/YAS/Classes/KFGUI_ColumnList.uc b/YAS/Classes/KFGUI_ColumnList.uc index 924bccc..eb40af9 100644 --- a/YAS/Classes/KFGUI_ColumnList.uc +++ b/YAS/Classes/KFGUI_ColumnList.uc @@ -1,8 +1,5 @@ // Columned list box (only for text lines). -Class KFGUI_ColumnList extends KFGUI_List; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_ColumnList extends KFGUI_List; struct FColumnItem { diff --git a/YAS/Classes/KFGUI_ColumnTop.uc b/YAS/Classes/KFGUI_ColumnTop.uc index c43fc29..989e77a 100644 --- a/YAS/Classes/KFGUI_ColumnTop.uc +++ b/YAS/Classes/KFGUI_ColumnTop.uc @@ -1,8 +1,5 @@ // Do not use this on your own, it is used by ColumnList -Class KFGUI_ColumnTop extends KFGUI_Base; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_ColumnTop extends KFGUI_Base; var() float ColumnMinSize; // Minimum pixels width allowed. var KFGUI_ColumnList ListOwner; diff --git a/YAS/Classes/KFGUI_ComboBox.uc b/YAS/Classes/KFGUI_ComboBox.uc index 4e974c0..71992ff 100644 --- a/YAS/Classes/KFGUI_ComboBox.uc +++ b/YAS/Classes/KFGUI_ComboBox.uc @@ -1,7 +1,4 @@ -Class KFGUI_ComboBox extends KFGUI_EditControl; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_ComboBox extends KFGUI_EditControl; var KFGUI_ComboSelector Selection; diff --git a/YAS/Classes/KFGUI_ComboSelector.uc b/YAS/Classes/KFGUI_ComboSelector.uc index 9eb5afb..bcf6637 100644 --- a/YAS/Classes/KFGUI_ComboSelector.uc +++ b/YAS/Classes/KFGUI_ComboSelector.uc @@ -1,7 +1,4 @@ -Class KFGUI_ComboSelector extends KFGUI_Clickable; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_ComboSelector extends KFGUI_Clickable; var KFGUI_ComboBox Combo; var int CurrentRow, OldRow; diff --git a/YAS/Classes/KFGUI_ComponentList.uc b/YAS/Classes/KFGUI_ComponentList.uc index d92f7ca..ffeba95 100644 --- a/YAS/Classes/KFGUI_ComponentList.uc +++ b/YAS/Classes/KFGUI_ComponentList.uc @@ -1,8 +1,5 @@ // List box with components as items. -Class KFGUI_ComponentList extends KFGUI_List; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_ComponentList extends KFGUI_List; var int VisRange[2]; var() int NumColumns; diff --git a/YAS/Classes/KFGUI_EditBox.uc b/YAS/Classes/KFGUI_EditBox.uc index 3e81752..ebe8a25 100644 --- a/YAS/Classes/KFGUI_EditBox.uc +++ b/YAS/Classes/KFGUI_EditBox.uc @@ -1,7 +1,4 @@ -Class KFGUI_EditBox extends KFGUI_Clickable; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_EditBox extends KFGUI_Clickable; var enum eTextCase { diff --git a/YAS/Classes/KFGUI_EditControl.uc b/YAS/Classes/KFGUI_EditControl.uc index 3d9aa1e..eb533c6 100644 --- a/YAS/Classes/KFGUI_EditControl.uc +++ b/YAS/Classes/KFGUI_EditControl.uc @@ -1,7 +1,4 @@ -Class KFGUI_EditControl extends KFGUI_Clickable; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_EditControl extends KFGUI_Clickable; var export editinline KFGUI_TextLable TextLable; var transient float TextHeight, TextScale; diff --git a/YAS/Classes/KFGUI_FloatingWindow.uc b/YAS/Classes/KFGUI_FloatingWindow.uc index 4f35b9a..23d3c55 100644 --- a/YAS/Classes/KFGUI_FloatingWindow.uc +++ b/YAS/Classes/KFGUI_FloatingWindow.uc @@ -1,9 +1,6 @@ -Class KFGUI_FloatingWindow extends KFGUI_Page +class KFGUI_FloatingWindow extends KFGUI_Page abstract; -`include(Build.uci) -`include(Logger.uci) - var() string WindowTitle; // Title of this window. var float DragOffset[2], OpenAnimSpeed; var KFGUI_FloatingWindowHeader HeaderComp; diff --git a/YAS/Classes/KFGUI_FloatingWindowHeader.uc b/YAS/Classes/KFGUI_FloatingWindowHeader.uc index 6ee093d..91bdd61 100644 --- a/YAS/Classes/KFGUI_FloatingWindowHeader.uc +++ b/YAS/Classes/KFGUI_FloatingWindowHeader.uc @@ -1,7 +1,4 @@ -Class KFGUI_FloatingWindowHeader extends KFGUI_Base; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_FloatingWindowHeader extends KFGUI_Base; var bool bDragWindow; diff --git a/YAS/Classes/KFGUI_Frame.uc b/YAS/Classes/KFGUI_Frame.uc index 6c1843f..a5a67fa 100644 --- a/YAS/Classes/KFGUI_Frame.uc +++ b/YAS/Classes/KFGUI_Frame.uc @@ -1,7 +1,4 @@ -Class KFGUI_Frame extends KFGUI_FloatingWindow; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_Frame extends KFGUI_FloatingWindow; var() float EdgeSize[4]; // Pixels wide for edges (left, top, right, bottom). var() float HeaderSize[2]; // Pixels wide for edges (left, top). diff --git a/YAS/Classes/KFGUI_Image.uc b/YAS/Classes/KFGUI_Image.uc index fcec4e0..a3dcd39 100644 --- a/YAS/Classes/KFGUI_Image.uc +++ b/YAS/Classes/KFGUI_Image.uc @@ -1,7 +1,4 @@ -Class KFGUI_Image extends KFGUI_Base; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_Image extends KFGUI_Base; var enum eImageStyle { diff --git a/YAS/Classes/KFGUI_List.uc b/YAS/Classes/KFGUI_List.uc index 95f9ef2..fd56692 100644 --- a/YAS/Classes/KFGUI_List.uc +++ b/YAS/Classes/KFGUI_List.uc @@ -1,8 +1,5 @@ // List box with custom render code for the items. -Class KFGUI_List extends KFGUI_MultiComponent; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_List extends KFGUI_MultiComponent; var() bool bDrawBackground, bHideScrollbar, bUseFocusSound; var() protectedwrite int ListCount; diff --git a/YAS/Classes/KFGUI_ListHorz.uc b/YAS/Classes/KFGUI_ListHorz.uc index 87bcbdd..e56ea06 100644 --- a/YAS/Classes/KFGUI_ListHorz.uc +++ b/YAS/Classes/KFGUI_ListHorz.uc @@ -1,7 +1,4 @@ -Class KFGUI_ListHorz extends KFGUI_MultiComponent; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_ListHorz extends KFGUI_MultiComponent; var() bool bDrawBackground, bHideScrollbar, bUseFocusSound; var() protected int ListCount; diff --git a/YAS/Classes/KFGUI_ListItem.uc b/YAS/Classes/KFGUI_ListItem.uc index 0a9f32e..aa1c357 100644 --- a/YAS/Classes/KFGUI_ListItem.uc +++ b/YAS/Classes/KFGUI_ListItem.uc @@ -1,9 +1,6 @@ -Class KFGUI_ListItem extends Object +class KFGUI_ListItem extends Object transient; -`include(Build.uci) -`include(Logger.uci) - var KFGUI_ListItem Next; var array Columns, SortColumns; var int Index, Value; diff --git a/YAS/Classes/KFGUI_MultiComponent.uc b/YAS/Classes/KFGUI_MultiComponent.uc index 8b96fae..f89ad9c 100644 --- a/YAS/Classes/KFGUI_MultiComponent.uc +++ b/YAS/Classes/KFGUI_MultiComponent.uc @@ -1,7 +1,4 @@ -Class KFGUI_MultiComponent extends KFGUI_Base; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_MultiComponent extends KFGUI_Base; var() export editinline array Components; diff --git a/YAS/Classes/KFGUI_Page.uc b/YAS/Classes/KFGUI_Page.uc index 902d701..2c3487f 100644 --- a/YAS/Classes/KFGUI_Page.uc +++ b/YAS/Classes/KFGUI_Page.uc @@ -1,9 +1,6 @@ -Class KFGUI_Page extends KFGUI_MultiComponent +class KFGUI_Page extends KFGUI_MultiComponent abstract; -`include(Build.uci) -`include(Logger.uci) - var() byte FrameOpacity; // Transperancy of the frame. var() bool bPersistant, // Reuse the same menu object throughout the level. bUnique, // If calling OpenMenu multiple times with same menu class, only open one instance of it. diff --git a/YAS/Classes/KFGUI_ProgressBar.uc b/YAS/Classes/KFGUI_ProgressBar.uc index 1801c94..d235d54 100644 --- a/YAS/Classes/KFGUI_ProgressBar.uc +++ b/YAS/Classes/KFGUI_ProgressBar.uc @@ -1,8 +1,5 @@ class KFGUI_ProgressBar extends KFGUI_Base; -`include(Build.uci) -`include(Logger.uci) - var Texture BarBack; var Texture BarTop; var Color BarColor; diff --git a/YAS/Classes/KFGUI_RightClickMenu.uc b/YAS/Classes/KFGUI_RightClickMenu.uc index 979e7f3..90f7c68 100644 --- a/YAS/Classes/KFGUI_RightClickMenu.uc +++ b/YAS/Classes/KFGUI_RightClickMenu.uc @@ -1,7 +1,4 @@ -Class KFGUI_RightClickMenu extends KFGUI_Clickable; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_RightClickMenu extends KFGUI_Clickable; struct FRowItem { diff --git a/YAS/Classes/KFGUI_ScrollBarBase.uc b/YAS/Classes/KFGUI_ScrollBarBase.uc index a250eac..d63d011 100644 --- a/YAS/Classes/KFGUI_ScrollBarBase.uc +++ b/YAS/Classes/KFGUI_ScrollBarBase.uc @@ -1,9 +1,6 @@ -Class KFGUI_ScrollBarBase extends KFGUI_Clickable +class KFGUI_ScrollBarBase extends KFGUI_Clickable abstract; -`include(Build.uci) -`include(Logger.uci) - var() int MinRange, MaxRange, ScrollStride, PageStep; var() float ButtonScale; // Button width (scaled by default font height). var int CurrentScroll; diff --git a/YAS/Classes/KFGUI_ScrollBarH.uc b/YAS/Classes/KFGUI_ScrollBarH.uc index 532cca7..5fc6dee 100644 --- a/YAS/Classes/KFGUI_ScrollBarH.uc +++ b/YAS/Classes/KFGUI_ScrollBarH.uc @@ -1,7 +1,4 @@ -Class KFGUI_ScrollBarH extends KFGUI_ScrollBarBase; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_ScrollBarH extends KFGUI_ScrollBarBase; defaultproperties { diff --git a/YAS/Classes/KFGUI_ScrollBarV.uc b/YAS/Classes/KFGUI_ScrollBarV.uc index 81c18e4..1ff2814 100644 --- a/YAS/Classes/KFGUI_ScrollBarV.uc +++ b/YAS/Classes/KFGUI_ScrollBarV.uc @@ -1,7 +1,4 @@ -Class KFGUI_ScrollBarV extends KFGUI_ScrollBarBase; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_ScrollBarV extends KFGUI_ScrollBarBase; defaultproperties { diff --git a/YAS/Classes/KFGUI_Slider.uc b/YAS/Classes/KFGUI_Slider.uc index 8fc05f6..a90efae 100644 --- a/YAS/Classes/KFGUI_Slider.uc +++ b/YAS/Classes/KFGUI_Slider.uc @@ -1,8 +1,5 @@ class KFGUI_Slider extends KFGUI_MultiComponent; -`include(Build.uci) -`include(Logger.uci) - var KFGUI_ScrollBarH ScrollBar; var int MinValue, MaxValue; diff --git a/YAS/Classes/KFGUI_SwitchMenuBar.uc b/YAS/Classes/KFGUI_SwitchMenuBar.uc index 4d19e38..c29d6d5 100644 --- a/YAS/Classes/KFGUI_SwitchMenuBar.uc +++ b/YAS/Classes/KFGUI_SwitchMenuBar.uc @@ -1,8 +1,5 @@ // Same as SwitchComponent, but with buttons. -Class KFGUI_SwitchMenuBar extends KFGUI_MultiComponent; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_SwitchMenuBar extends KFGUI_MultiComponent; var array SubPages; var() byte ButtonPosition; // 0 = top, 1 = bottom, 2 = left, 3 = right diff --git a/YAS/Classes/KFGUI_TextField.uc b/YAS/Classes/KFGUI_TextField.uc index 731c998..4300fc3 100644 --- a/YAS/Classes/KFGUI_TextField.uc +++ b/YAS/Classes/KFGUI_TextField.uc @@ -1,7 +1,4 @@ -Class KFGUI_TextField extends KFGUI_MultiComponent; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_TextField extends KFGUI_MultiComponent; enum ETextFieldStyles { diff --git a/YAS/Classes/KFGUI_TextLable.uc b/YAS/Classes/KFGUI_TextLable.uc index eea8f03..4c551b8 100644 --- a/YAS/Classes/KFGUI_TextLable.uc +++ b/YAS/Classes/KFGUI_TextLable.uc @@ -1,7 +1,4 @@ -Class KFGUI_TextLable extends KFGUI_Base; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_TextLable extends KFGUI_Base; var() protected string Text; var() color TextColor; diff --git a/YAS/Classes/KFGUI_TextScroll.uc b/YAS/Classes/KFGUI_TextScroll.uc index 08ca1e9..f091467 100644 --- a/YAS/Classes/KFGUI_TextScroll.uc +++ b/YAS/Classes/KFGUI_TextScroll.uc @@ -1,7 +1,4 @@ -Class KFGUI_TextScroll extends KFGUI_TextField; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_TextScroll extends KFGUI_TextField; var float ScrollSpeed; diff --git a/YAS/Classes/KFGUI_Tooltip.uc b/YAS/Classes/KFGUI_Tooltip.uc index 74b0d04..98cc8c5 100644 --- a/YAS/Classes/KFGUI_Tooltip.uc +++ b/YAS/Classes/KFGUI_Tooltip.uc @@ -1,7 +1,4 @@ -Class KFGUI_Tooltip extends KFGUI_Base; - -`include(Build.uci) -`include(Logger.uci) +class KFGUI_Tooltip extends KFGUI_Base; var() array Lines; var() Canvas.FontRenderInfo TextFontInfo; diff --git a/YAS/Classes/PlayerRankRelations.uc b/YAS/Classes/PlayerRankRelations.uc deleted file mode 100644 index 91f50d8..0000000 --- a/YAS/Classes/PlayerRankRelations.uc +++ /dev/null @@ -1,32 +0,0 @@ -class PlayerRankRelations extends Object - dependson(Types) - config(YAS); - -`include(Build.uci) -`include(Logger.uci) - -var config array Relation; - -public static function InitConfig(int ConfigVersion) -{ - local RankRelation ExamplePlayer; - - `callstack_static("InitConfig"); - - switch (ConfigVersion) - { - case 0: - // Example player - ExamplePlayer.ObjectID = "76561198001617867"; // GenZmeY SteamID64 - ExamplePlayer.RankID = 0; - default.Relation.AddItem(ExamplePlayer); - - case 2147483647: - StaticSaveConfig(); - } -} - -defaultproperties -{ - -} \ No newline at end of file diff --git a/YAS/Classes/ScoreboardStyle.uc b/YAS/Classes/ScoreboardStyle.uc deleted file mode 100644 index 6f8e0c7..0000000 --- a/YAS/Classes/ScoreboardStyle.uc +++ /dev/null @@ -1,472 +0,0 @@ -class ScoreboardStyle extends Object - dependson(Types) - config(YAS); - -`include(Build.uci) -`include(Logger.uci) - -// Box shapes -var config int EdgeSize; -var config int ShapeServerNameBox; -var config int ShapeGameInfoBox; -var config int ShapeWaveInfoBox; -var config int ShapePlayersCountBox; -var config int ShapeHeaderBox; -var config int ShapeStateHealthBoxTopPlayer; -var config int ShapeStateHealthBoxMidPlayer; -var config int ShapeStateHealthBoxBottomPlayer; -var config int ShapePlayerBoxTopPlayer; -var config int ShapePlayerBoxMidPlayer; -var config int ShapePlayerBoxBottomPlayer; -var config int ShapeStatsBoxTopPlayer; -var config int ShapeStatsBoxMidPlayer; -var config int ShapeStatsBoxBottomPlayer; - -// Server box -var config ColorRGBA ServerNameBoxColor; -var config ColorRGBA ServerNameTextColor; - -// Game info box -var config ColorRGBA GameInfoBoxColor; -var config ColorRGBA GameInfoTextColor; - -// Wave info box -var config ColorRGBA WaveBoxColor; -var config ColorRGBA WaveTextColor; - -// Player count box -var config ColorRGBA PlayerCountBoxColor; -var config ColorRGBA PlayerCountTextColor; - -// Header box -var config ColorRGBA ListHeaderBoxColor; -var config ColorRGBA ListHeaderTextColor; - -// State box -var config ColorRGBA StateBoxColorLobby; -var config ColorRGBA StateBoxColorReady; -var config ColorRGBA StateBoxColorNotReady; -var config ColorRGBA StateBoxColorSpectator; -var config ColorRGBA StateBoxColorDead; -var config ColorRGBA StateBoxColorNone; -var config ColorRGBA StateBoxColorHealthLow; -var config ColorRGBA StateBoxColorHealthMid; -var config ColorRGBA StateBoxColorHealthHigh; - -// Player box -var config ColorRGBA PlayerOwnerBoxColor; -var config ColorRGBA PlayerBoxColor; - -// Stats box -var config ColorRGBA StatsOwnerBoxColor; -var config ColorRGBA StatsBoxColor; - -// State text -var config ColorRGBA StateTextColorLobby; -var config ColorRGBA StateTextColorReady; -var config ColorRGBA StateTextColorNotReady; -var config ColorRGBA StateTextColorSpectator; -var config ColorRGBA StateTextColorDead; -var config ColorRGBA StateTextColorNone; -var config ColorRGBA StateTextColorHealthLow; -var config ColorRGBA StateTextColorHealthMid; -var config ColorRGBA StateTextColorHealthHigh; - -// Rank text -var config ColorRGBA RankTextColor; - -// Player text -var config ColorRGBA PlayerNameTextColor; - -// Level text -var config ColorRGBA LevelTextColorLow; -var config ColorRGBA LevelTextColorMid; -var config ColorRGBA LevelTextColorHigh; - -// Perk text -var config ColorRGBA ZedTextColor; -var config ColorRGBA PerkNoneTextColor; -var config ColorRGBA PerkBerserkerTextColor; -var config ColorRGBA PerkCommandoTextColor; -var config ColorRGBA PerkSupportTextColor; -var config ColorRGBA PerkFieldMedicTextColor; -var config ColorRGBA PerkDemolitionistTextColor; -var config ColorRGBA PerkFirebugTextColor; -var config ColorRGBA PerkGunslingerTextColor; -var config ColorRGBA PerkSharpshooterTextColor; -var config ColorRGBA PerkSwatTextColor; -var config ColorRGBA PerkSurvivalistTextColor; - -// Dosh text -var config ColorRGBA DoshTextColorLow; -var config ColorRGBA DoshTextColorMid; -var config ColorRGBA DoshTextColorHigh; - -// Kills text -var config ColorRGBA KillsTextColorLow; -var config ColorRGBA KillsTextColorMid; -var config ColorRGBA KillsTextColorHigh; - -// Assists text -var config ColorRGBA AssistsTextColorLow; -var config ColorRGBA AssistsTextColorMid; -var config ColorRGBA AssistsTextColorHigh; - -// Ping text -var config ColorRGBA PingTextColorNone; -var config ColorRGBA PingTextColorLow; -var config ColorRGBA PingTextColorMid; -var config ColorRGBA PingTextColorHigh; - -// Other settings -var config bool bShowPingBars; -var config bool bHealthBoxSmoothColorChange; -var config bool bHealthTextSmoothColorChange; -var config bool bLevelTextSmoothColorChange; -var config bool bDoshTextSmoothColorChange; -var config bool bKillsTextSmoothColorChange; -var config bool bAssistsTextSmoothColorChange; -var config bool bPingTextSmoothColorChange; - -public static function InitConfig(int ConfigVersion) -{ - local YASStyle DefaultStyle; - - `callstack_static("InitConfig"); - - switch (ConfigVersion) - { - case 0: - WriteSettings(DefaultSettings()); - - case 1: - default.AssistsTextColorHigh = DefaultStyle.AssistsTextColorHigh; - default.AssistsTextColorLow = DefaultStyle.AssistsTextColorLow; - default.AssistsTextColorMid = DefaultStyle.AssistsTextColorMid; - default.bAssistsTextSmoothColorChange = DefaultStyle.AssistsTextSmoothColorChange; - default.bDoshTextSmoothColorChange = DefaultStyle.DoshTextSmoothColorChange; - default.bHealthBoxSmoothColorChange = DefaultStyle.HealthBoxSmoothColorChange; - default.bHealthTextSmoothColorChange = DefaultStyle.HealthTextSmoothColorChange; - default.bKillsTextSmoothColorChange = DefaultStyle.KillsTextSmoothColorChange; - default.bLevelTextSmoothColorChange = DefaultStyle.LevelTextSmoothColorChange; - default.bPingTextSmoothColorChange = DefaultStyle.PingTextSmoothColorChange; - default.bShowPingBars = DefaultStyle.ShowPingBars; - default.DoshTextColorHigh = DefaultStyle.DoshTextColorHigh; - default.DoshTextColorLow = DefaultStyle.DoshTextColorLow; - default.DoshTextColorMid = DefaultStyle.DoshTextColorMid; - default.KillsTextColorHigh = DefaultStyle.KillsTextColorHigh; - default.KillsTextColorLow = DefaultStyle.KillsTextColorLow; - default.KillsTextColorMid = DefaultStyle.KillsTextColorMid; - default.LevelTextColorHigh = DefaultStyle.LevelTextColorHigh; - default.LevelTextColorLow = DefaultStyle.LevelTextColorLow; - default.LevelTextColorMid = DefaultStyle.LevelTextColorMid; - default.PerkBerserkerTextColor = DefaultStyle.PerkBerserkerTextColor; - default.PerkCommandoTextColor = DefaultStyle.PerkCommandoTextColor; - default.PerkDemolitionistTextColor = DefaultStyle.PerkDemolitionistTextColor; - default.PerkFieldMedicTextColor = DefaultStyle.PerkFieldMedicTextColor; - default.PerkFirebugTextColor = DefaultStyle.PerkFirebugTextColor; - default.PerkGunslingerTextColor = DefaultStyle.PerkGunslingerTextColor; - default.PerkNoneTextColor = DefaultStyle.PerkNoneTextColor; - default.PerkSharpshooterTextColor = DefaultStyle.PerkSharpshooterTextColor; - default.PerkSupportTextColor = DefaultStyle.PerkSupportTextColor; - default.PerkSurvivalistTextColor = DefaultStyle.PerkSurvivalistTextColor; - default.PerkSwatTextColor = DefaultStyle.PerkSwatTextColor; - default.StateBoxColorDead = DefaultStyle.StateBoxColorDead; - default.StateBoxColorNone = DefaultStyle.StateBoxColorNone; - default.StateBoxColorHealthHigh = DefaultStyle.StateBoxColorHealthHigh; - default.StateBoxColorHealthLow = DefaultStyle.StateBoxColorHealthLow; - default.StateBoxColorHealthMid = DefaultStyle.StateBoxColorHealthMid; - default.StateBoxColorLobby = DefaultStyle.StateBoxColorLobby; - default.StateBoxColorNotReady = DefaultStyle.StateBoxColorNotReady; - default.StateBoxColorReady = DefaultStyle.StateBoxColorReady; - default.StateBoxColorSpectator = DefaultStyle.StateBoxColorSpectator; - default.StateTextColorNone = DefaultStyle.StateTextColorNone; - default.StateTextColorHealthHigh = DefaultStyle.StateTextColorHealthHigh; - default.StateTextColorHealthLow = DefaultStyle.StateTextColorHealthLow; - default.StateTextColorHealthMid = DefaultStyle.StateTextColorHealthMid; - default.StatsOwnerBoxColor = DefaultStyle.StatsOwnerBoxColor; - default.ShapeStateHealthBoxTopPlayer = DefaultStyle.ShapeStateHealthBoxTopPlayer; - default.ShapeStateHealthBoxMidPlayer = DefaultStyle.ShapeStateHealthBoxMidPlayer; - default.ShapeStateHealthBoxBottomPlayer = DefaultStyle.ShapeStateHealthBoxBottomPlayer; - default.PingTextColorNone = DefaultStyle.PingTextColorNone; - - WriteSettings(Settings()); - - case 2147483647: - StaticSaveConfig(); - } -} - -public static function YASStyle DefaultSettings() -{ - local YASStyle Settings; - - `callstack_static("DefaultSettings"); - - return Settings; -} - -public static function YASStyle Settings() -{ - local YASStyle Settings; - - `callstack_static("Settings"); - - // Box shapes - Settings.EdgeSize = default.EdgeSize; - Settings.ShapeServerNameBox = default.ShapeServerNameBox; - Settings.ShapeGameInfoBox = default.ShapeGameInfoBox; - Settings.ShapeWaveInfoBox = default.ShapeWaveInfoBox; - Settings.ShapePlayersCountBox = default.ShapePlayersCountBox; - Settings.ShapeHeaderBox = default.ShapeHeaderBox; - Settings.ShapeStateHealthBoxTopPlayer = default.ShapeStateHealthBoxTopPlayer; - Settings.ShapeStateHealthBoxMidPlayer = default.ShapeStateHealthBoxMidPlayer; - Settings.ShapeStateHealthBoxBottomPlayer = default.ShapeStateHealthBoxBottomPlayer; - Settings.ShapePlayerBoxTopPlayer = default.ShapePlayerBoxTopPlayer; - Settings.ShapePlayerBoxMidPlayer = default.ShapePlayerBoxMidPlayer; - Settings.ShapePlayerBoxBottomPlayer = default.ShapePlayerBoxBottomPlayer; - Settings.ShapeStatsBoxTopPlayer = default.ShapeStatsBoxTopPlayer; - Settings.ShapeStatsBoxMidPlayer = default.ShapeStatsBoxMidPlayer; - Settings.ShapeStatsBoxBottomPlayer = default.ShapeStatsBoxBottomPlayer; - - // Server box - Settings.ServerNameBoxColor = default.ServerNameBoxColor; - Settings.ServerNameTextColor = default.ServerNameTextColor; - - // Game info box - Settings.GameInfoBoxColor = default.GameInfoBoxColor; - Settings.GameInfoTextColor = default.GameInfoTextColor; - - // Wave info box - Settings.WaveBoxColor = default.WaveBoxColor; - Settings.WaveTextColor = default.WaveTextColor; - - // Player count box - Settings.PlayerCountBoxColor = default.PlayerCountBoxColor; - Settings.PlayerCountTextColor = default.PlayerCountTextColor; - - // Header box - Settings.ListHeaderBoxColor = default.ListHeaderBoxColor; - Settings.ListHeaderTextColor = default.ListHeaderTextColor; - - // State box - Settings.StateBoxColorLobby = default.StateBoxColorLobby; - Settings.StateBoxColorReady = default.StateBoxColorReady; - Settings.StateBoxColorNotReady = default.StateBoxColorNotReady; - Settings.StateBoxColorSpectator = default.StateBoxColorSpectator; - Settings.StateBoxColorDead = default.StateBoxColorDead; - Settings.StateBoxColorNone = default.StateBoxColorNone; - Settings.StateBoxColorHealthLow = default.StateBoxColorHealthLow; - Settings.StateBoxColorHealthMid = default.StateBoxColorHealthMid; - Settings.StateBoxColorHealthHigh = default.StateBoxColorHealthHigh; - - // Player box - Settings.PlayerOwnerBoxColor = default.PlayerOwnerBoxColor; - Settings.PlayerBoxColor = default.PlayerBoxColor; - - // Stats box - Settings.StatsOwnerBoxColor = default.StatsOwnerBoxColor; - Settings.StatsBoxColor = default.StatsBoxColor; - - // State text - Settings.StateTextColorLobby = default.StateTextColorLobby; - Settings.StateTextColorReady = default.StateTextColorReady; - Settings.StateTextColorNotReady = default.StateTextColorNotReady; - Settings.StateTextColorSpectator = default.StateTextColorSpectator; - Settings.StateTextColorDead = default.StateTextColorDead; - Settings.StateTextColorNone = default.StateTextColorNone; - Settings.StateTextColorHealthLow = default.StateTextColorHealthLow; - Settings.StateTextColorHealthMid = default.StateTextColorHealthMid; - Settings.StateTextColorHealthHigh = default.StateTextColorHealthHigh; - - // Rank text - Settings.RankTextColor = default.RankTextColor; - - // Player text - Settings.PlayerNameTextColor = default.PlayerNameTextColor; - - // Level text - Settings.LevelTextColorLow = default.LevelTextColorLow; - Settings.LevelTextColorMid = default.LevelTextColorMid; - Settings.LevelTextColorHigh = default.LevelTextColorHigh; - - // Perk text - Settings.ZedTextColor = default.ZedTextColor; - Settings.PerkNoneTextColor = default.PerkNoneTextColor; - Settings.PerkBerserkerTextColor = default.PerkBerserkerTextColor; - Settings.PerkCommandoTextColor = default.PerkCommandoTextColor; - Settings.PerkSupportTextColor = default.PerkSupportTextColor; - Settings.PerkFieldMedicTextColor = default.PerkFieldMedicTextColor; - Settings.PerkDemolitionistTextColor = default.PerkDemolitionistTextColor; - Settings.PerkFirebugTextColor = default.PerkFirebugTextColor; - Settings.PerkGunslingerTextColor = default.PerkGunslingerTextColor; - Settings.PerkSharpshooterTextColor = default.PerkSharpshooterTextColor; - Settings.PerkSwatTextColor = default.PerkSwatTextColor; - Settings.PerkSurvivalistTextColor = default.PerkSurvivalistTextColor; - - // Dosh text - Settings.DoshTextColorLow = default.DoshTextColorLow; - Settings.DoshTextColorMid = default.DoshTextColorMid; - Settings.DoshTextColorHigh = default.DoshTextColorHigh; - - // Kills text - Settings.KillsTextColorLow = default.KillsTextColorLow; - Settings.KillsTextColorMid = default.KillsTextColorMid; - Settings.KillsTextColorHigh = default.KillsTextColorHigh; - - // Assists text - Settings.AssistsTextColorLow = default.AssistsTextColorLow; - Settings.AssistsTextColorMid = default.AssistsTextColorMid; - Settings.AssistsTextColorHigh = default.AssistsTextColorHigh; - - // Ping text - Settings.PingTextColorNone = default.PingTextColorNone; - Settings.PingTextColorLow = default.PingTextColorLow; - Settings.PingTextColorMid = default.PingTextColorMid; - Settings.PingTextColorHigh = default.PingTextColorHigh; - - // Other settings - Settings.ShowPingBars = default.bShowPingBars; - Settings.HealthBoxSmoothColorChange = default.bHealthBoxSmoothColorChange; - Settings.HealthTextSmoothColorChange = default.bHealthTextSmoothColorChange; - Settings.LevelTextSmoothColorChange = default.bLevelTextSmoothColorChange; - Settings.DoshTextSmoothColorChange = default.bDoshTextSmoothColorChange; - Settings.KillsTextSmoothColorChange = default.bKillsTextSmoothColorChange; - Settings.AssistsTextSmoothColorChange = default.bAssistsTextSmoothColorChange; - Settings.PingTextSmoothColorChange = default.bPingTextSmoothColorChange; - - return Settings; -} - -public static function WriteSettings(YASStyle Settings) -{ - `callstack_static("WriteSettings"); - - // Box shapes - default.EdgeSize = Settings.EdgeSize; - default.ShapeServerNameBox = Settings.ShapeServerNameBox; - default.ShapeGameInfoBox = Settings.ShapeGameInfoBox; - default.ShapeWaveInfoBox = Settings.ShapeWaveInfoBox; - default.ShapePlayersCountBox = Settings.ShapePlayersCountBox; - default.ShapeHeaderBox = Settings.ShapeHeaderBox; - default.ShapeStateHealthBoxTopPlayer = Settings.ShapeStateHealthBoxTopPlayer; - default.ShapeStateHealthBoxMidPlayer = Settings.ShapeStateHealthBoxMidPlayer; - default.ShapeStateHealthBoxBottomPlayer = Settings.ShapeStateHealthBoxBottomPlayer; - default.ShapePlayerBoxTopPlayer = Settings.ShapePlayerBoxTopPlayer; - default.ShapePlayerBoxMidPlayer = Settings.ShapePlayerBoxMidPlayer; - default.ShapePlayerBoxBottomPlayer = Settings.ShapePlayerBoxBottomPlayer; - default.ShapeStatsBoxTopPlayer = Settings.ShapeStatsBoxTopPlayer; - default.ShapeStatsBoxMidPlayer = Settings.ShapeStatsBoxMidPlayer; - default.ShapeStatsBoxBottomPlayer = Settings.ShapeStatsBoxBottomPlayer; - - // Server box - default.ServerNameBoxColor = Settings.ServerNameBoxColor; - default.ServerNameTextColor = Settings.ServerNameTextColor; - - // Game info box - default.GameInfoBoxColor = Settings.GameInfoBoxColor; - default.GameInfoTextColor = Settings.GameInfoTextColor; - - // Wave info box - default.WaveBoxColor = Settings.WaveBoxColor; - default.WaveTextColor = Settings.WaveTextColor; - - // Player count box - default.PlayerCountBoxColor = Settings.PlayerCountBoxColor; - default.PlayerCountTextColor = Settings.PlayerCountTextColor; - - // Header box - default.ListHeaderBoxColor = Settings.ListHeaderBoxColor; - default.ListHeaderTextColor = Settings.ListHeaderTextColor; - - // State box - default.StateBoxColorLobby = Settings.StateBoxColorLobby; - default.StateBoxColorReady = Settings.StateBoxColorReady; - default.StateBoxColorNotReady = Settings.StateBoxColorNotReady; - default.StateBoxColorSpectator = Settings.StateBoxColorSpectator; - default.StateBoxColorDead = Settings.StateBoxColorDead; - default.StateBoxColorNone = Settings.StateBoxColorNone; - default.StateBoxColorHealthLow = Settings.StateBoxColorHealthLow; - default.StateBoxColorHealthMid = Settings.StateBoxColorHealthMid; - default.StateBoxColorHealthHigh = Settings.StateBoxColorHealthHigh; - - // Player box - default.PlayerOwnerBoxColor = Settings.PlayerOwnerBoxColor; - default.PlayerBoxColor = Settings.PlayerBoxColor; - - // Stats box - default.StatsOwnerBoxColor = Settings.StatsOwnerBoxColor; - default.StatsBoxColor = Settings.StatsBoxColor; - - // State text - default.StateTextColorLobby = Settings.StateTextColorLobby; - default.StateTextColorReady = Settings.StateTextColorReady; - default.StateTextColorNotReady = Settings.StateTextColorNotReady; - default.StateTextColorSpectator = Settings.StateTextColorSpectator; - default.StateTextColorDead = Settings.StateTextColorDead; - default.StateTextColorNone = Settings.StateTextColorNone; - default.StateTextColorHealthLow = Settings.StateTextColorHealthLow; - default.StateTextColorHealthMid = Settings.StateTextColorHealthMid; - default.StateTextColorHealthHigh = Settings.StateTextColorHealthHigh; - - // Rank text - default.RankTextColor = Settings.RankTextColor; - - // Player text - default.PlayerNameTextColor = Settings.PlayerNameTextColor; - - // Level text - default.LevelTextColorLow = Settings.LevelTextColorLow; - default.LevelTextColorMid = Settings.LevelTextColorMid; - default.LevelTextColorHigh = Settings.LevelTextColorHigh; - - // Perk text - default.ZedTextColor = Settings.ZedTextColor; - default.PerkNoneTextColor = Settings.PerkNoneTextColor; - default.PerkBerserkerTextColor = Settings.PerkBerserkerTextColor; - default.PerkCommandoTextColor = Settings.PerkCommandoTextColor; - default.PerkSupportTextColor = Settings.PerkSupportTextColor; - default.PerkFieldMedicTextColor = Settings.PerkFieldMedicTextColor; - default.PerkDemolitionistTextColor = Settings.PerkDemolitionistTextColor; - default.PerkFirebugTextColor = Settings.PerkFirebugTextColor; - default.PerkGunslingerTextColor = Settings.PerkGunslingerTextColor; - default.PerkSharpshooterTextColor = Settings.PerkSharpshooterTextColor; - default.PerkSwatTextColor = Settings.PerkSwatTextColor; - default.PerkSurvivalistTextColor = Settings.PerkSurvivalistTextColor; - - // Dosh text - default.DoshTextColorLow = Settings.DoshTextColorLow; - default.DoshTextColorMid = Settings.DoshTextColorMid; - default.DoshTextColorHigh = Settings.DoshTextColorHigh; - - // Kills text - default.KillsTextColorLow = Settings.KillsTextColorLow; - default.KillsTextColorMid = Settings.KillsTextColorMid; - default.KillsTextColorHigh = Settings.KillsTextColorHigh; - - // Assists text - default.AssistsTextColorLow = Settings.AssistsTextColorLow; - default.AssistsTextColorMid = Settings.AssistsTextColorMid; - default.AssistsTextColorHigh = Settings.AssistsTextColorHigh; - - // Ping text - default.PingTextColorNone = Settings.PingTextColorNone; - default.PingTextColorLow = Settings.PingTextColorLow; - default.PingTextColorMid = Settings.PingTextColorMid; - default.PingTextColorHigh = Settings.PingTextColorHigh; - - // Other settings - default.bShowPingBars = Settings.ShowPingBars; - default.bHealthBoxSmoothColorChange = Settings.HealthBoxSmoothColorChange; - default.bHealthTextSmoothColorChange = Settings.HealthTextSmoothColorChange; - default.bLevelTextSmoothColorChange = Settings.LevelTextSmoothColorChange; - default.bDoshTextSmoothColorChange = Settings.DoshTextSmoothColorChange; - default.bKillsTextSmoothColorChange = Settings.KillsTextSmoothColorChange; - default.bAssistsTextSmoothColorChange = Settings.AssistsTextSmoothColorChange; - default.bPingTextSmoothColorChange = Settings.PingTextSmoothColorChange; -} - -defaultProperties -{ - -} \ No newline at end of file diff --git a/YAS/Classes/ScoreboardStyleClient.uc b/YAS/Classes/ScoreboardStyleClient.uc deleted file mode 100644 index e1b0d4e..0000000 --- a/YAS/Classes/ScoreboardStyleClient.uc +++ /dev/null @@ -1,12 +0,0 @@ -class ScoreboardStyleClient extends ScoreboardStyle - config(YAS); - -`include(Build.uci) -`include(Logger.uci) - -var config bool bEnabled; - -defaultProperties -{ - -} \ No newline at end of file diff --git a/YAS/Classes/SettingsHealth.uc b/YAS/Classes/SettingsHealth.uc deleted file mode 100644 index 562b7dc..0000000 --- a/YAS/Classes/SettingsHealth.uc +++ /dev/null @@ -1,58 +0,0 @@ -class SettingsHealth extends Object - dependson(Types) - config(YAS); - -`include(Build.uci) -`include(Logger.uci) - -var config int Low; -var config int High; - -public static function InitConfig(int ConfigVersion) -{ - `callstack_static("InitConfig"); - - switch (ConfigVersion) - { - case 0: - case 1: - WriteSettings(DefaultSettings()); - - case 2147483647: - StaticSaveConfig(); - } -} - -public static function YASSettingsHealth DefaultSettings() -{ - local YASSettingsHealth Settings; - - `callstack_static("DefaultSettings"); - - return Settings; -} - -public static function YASSettingsHealth Settings() -{ - local YASSettingsHealth Settings; - - `callstack_static("Settings"); - - Settings.Low = default.Low; - Settings.High = default.High; - - return Settings; -} - -public static function WriteSettings(YASSettingsHealth Settings) -{ - `callstack_static("WriteSettings"); - - default.Low = Settings.Low; - default.High = Settings.High; -} - -defaultproperties -{ - -} \ No newline at end of file diff --git a/YAS/Classes/SettingsLevel.uc b/YAS/Classes/SettingsLevel.uc deleted file mode 100644 index fae9cd4..0000000 --- a/YAS/Classes/SettingsLevel.uc +++ /dev/null @@ -1,76 +0,0 @@ -class SettingsLevel extends Object - dependson(Types) - config(YAS); - -`include(Build.uci) -`include(Logger.uci) - -var config int Normal_Low; -var config int Normal_High; -var config int Hard_Low; -var config int Hard_High; -var config int Suicide_Low; -var config int Suicide_High; -var config int HellOnEarth_Low; -var config int HellOnEarth_High; - -public static function InitConfig(int ConfigVersion) -{ - `callstack_static("InitConfig"); - - switch (ConfigVersion) - { - case 0: - case 1: - WriteSettings(DefaultSettings()); - - case 2147483647: - StaticSaveConfig(); - } -} - -public static function YASSettingsLevel DefaultSettings() -{ - local YASSettingsLevel Settings; - - `callstack_static("DefaultSettings"); - - return Settings; -} - -public static function YASSettingsLevel Settings() -{ - local YASSettingsLevel Settings; - - `callstack_static("Settings"); - - Settings.Low [0] = default.Normal_Low; - Settings.High[0] = default.Normal_High; - Settings.Low [1] = default.Hard_Low; - Settings.High[1] = default.Hard_High; - Settings.Low [2] = default.Suicide_Low; - Settings.High[2] = default.Suicide_High; - Settings.Low [3] = default.HellOnEarth_Low; - Settings.High[3] = default.HellOnEarth_High; - - return Settings; -} - -public static function WriteSettings(YASSettingsLevel Settings) -{ - `callstack_static("WriteSettings"); - - default.Normal_Low = Settings.Low [0]; - default.Normal_High = Settings.High[0]; - default.Hard_Low = Settings.Low [1]; - default.Hard_High = Settings.High[1]; - default.Suicide_Low = Settings.Low [2]; - default.Suicide_High = Settings.High[2]; - default.HellOnEarth_Low = Settings.Low [3]; - default.HellOnEarth_High = Settings.High[3]; -} - -defaultproperties -{ - -} \ No newline at end of file diff --git a/YAS/Classes/SettingsPing.uc b/YAS/Classes/SettingsPing.uc deleted file mode 100644 index 774d6c1..0000000 --- a/YAS/Classes/SettingsPing.uc +++ /dev/null @@ -1,58 +0,0 @@ -class SettingsPing extends Object - dependson(Types) - config(YAS); - -`include(Build.uci) -`include(Logger.uci) - -var config int Low; -var config int High; - -public static function InitConfig(int ConfigVersion) -{ - `callstack_static("InitConfig"); - - switch (ConfigVersion) - { - case 0: - case 1: - WriteSettings(DefaultSettings()); - - case 2147483647: - StaticSaveConfig(); - } -} - -public static function YASSettingsPing DefaultSettings() -{ - local YASSettingsPing Settings; - - `callstack_static("DefaultSettings"); - - return Settings; -} - -public static function YASSettingsPing Settings() -{ - local YASSettingsPing Settings; - - `callstack_static("Settings"); - - Settings.Low = default.Low; - Settings.High = default.High; - - return Settings; -} - -public static function WriteSettings(YASSettingsPing Settings) -{ - `callstack_static("WriteSettings"); - - default.Low = Settings.Low; - default.High = Settings.High; -} - -defaultproperties -{ - -} \ No newline at end of file diff --git a/YAS/Classes/SteamGroupRankRelations.uc b/YAS/Classes/SteamGroupRankRelations.uc deleted file mode 100644 index 918e15f..0000000 --- a/YAS/Classes/SteamGroupRankRelations.uc +++ /dev/null @@ -1,32 +0,0 @@ -class SteamGroupRankRelations extends Object - dependson(Types) - config(YAS); - -`include(Build.uci) -`include(Logger.uci) - -var config array Relation; - -public static function InitConfig(int ConfigVersion) -{ - local RankRelation ExampleSteamGroup; - - `callstack_static("InitConfig"); - - switch (ConfigVersion) - { - case 0: - // Example steam group - ExampleSteamGroup.ObjectID = "103582791465384046"; // MSK-GS SteamID64 - ExampleSteamGroup.RankID = 1; - default.Relation.AddItem(ExampleSteamGroup); - - case 2147483647: - StaticSaveConfig(); - } -} - -defaultproperties -{ - -} \ No newline at end of file diff --git a/YAS/Classes/SystemAdminRank.uc b/YAS/Classes/SystemAdminRank.uc deleted file mode 100644 index 7926a25..0000000 --- a/YAS/Classes/SystemAdminRank.uc +++ /dev/null @@ -1,62 +0,0 @@ -class SystemAdminRank extends Object - dependson(Types) - config(YAS); - -`include(Build.uci) -`include(Logger.uci) - -var config string Rank; -var config ColorRGBA TextColor; -var config Fields ApplyColorToFields; - -public static function InitConfig(int ConfigVersion) -{ - `callstack_static("InitConfig"); - - switch (ConfigVersion) - { - case 0: - WriteSettings(DefaultSettings()); - - case 1: - - case 2147483647: - StaticSaveConfig(); - } -} - -public static function YASSettingsAdmin DefaultSettings() -{ - local YASSettingsAdmin Settings; - - `callstack_static("DefaultSettings"); - - return Settings; -} - -public static function YASSettingsAdmin Settings() -{ - local YASSettingsAdmin Settings; - - `callstack_static("Settings"); - - Settings.Rank = default.Rank; - Settings.TextColor = default.TextColor; - Settings.ApplyColorToFields = default.ApplyColorToFields; - - return Settings; -} - -public static function WriteSettings(YASSettingsAdmin Settings) -{ - `callstack_static("WriteSettings"); - - default.Rank = Settings.Rank; - default.TextColor = Settings.TextColor; - default.ApplyColorToFields = Settings.ApplyColorToFields; -} - -defaultproperties -{ - -} \ No newline at end of file diff --git a/YAS/Classes/SystemPlayerRank.uc b/YAS/Classes/SystemPlayerRank.uc deleted file mode 100644 index 2a6c1e4..0000000 --- a/YAS/Classes/SystemPlayerRank.uc +++ /dev/null @@ -1,62 +0,0 @@ -class SystemPlayerRank extends Object - dependson(Types) - config(YAS); - -`include(Build.uci) -`include(Logger.uci) - -var config string Rank; -var config ColorRGBA TextColor; -var config Fields ApplyColorToFields; - -public static function InitConfig(int ConfigVersion) -{ - `callstack_static("InitConfig"); - - switch (ConfigVersion) - { - case 0: - WriteSettings(DefaultSettings()); - - case 1: - - case 2147483647: - StaticSaveConfig(); - } -} - -public static function YASSettingsPlayer DefaultSettings() -{ - local YASSettingsPlayer Settings; - - `callstack_static("DefaultSettings"); - - return Settings; -} - -public static function YASSettingsPlayer Settings() -{ - local YASSettingsPlayer Settings; - - `callstack_static("Settings"); - - Settings.Rank = default.Rank; - Settings.TextColor = default.TextColor; - Settings.ApplyColorToFields = default.ApplyColorToFields; - - return Settings; -} - -public static function WriteSettings(YASSettingsPlayer Settings) -{ - `callstack_static("WriteSettings"); - - default.Rank = Settings.Rank; - default.TextColor = Settings.TextColor; - default.ApplyColorToFields = Settings.ApplyColorToFields; -} - -defaultproperties -{ - -} \ No newline at end of file diff --git a/YAS/Classes/YAS.uc b/YAS/Classes/YAS.uc new file mode 100644 index 0000000..9158775 --- /dev/null +++ b/YAS/Classes/YAS.uc @@ -0,0 +1,202 @@ +class YAS extends Info + config(YAS); + +const LatestVersion = 1; + +//const CfgExampleConfig = class'ExampleConfig'; + +var private config int Version; +var private config E_LogLevel LogLevel; + +var private KFGameInfo KFGI; +var private KFGameInfo_Survival KFGIS; +var private KFGameInfo_Endless KFGIE; +var private KFGameReplicationInfo KFGRI; + +var private Array RepInfos; + +public simulated function bool SafeDestroy() +{ + `Log_Trace(); + + return (bPendingDelete || bDeleteMe || Destroy()); +} + +public event PreBeginPlay() +{ + `Log_Trace(); + + if (WorldInfo.NetMode == NM_Client) + { + `Log_Fatal("NetMode == NM_Client"); + SafeDestroy(); + return; + } + + Super.PreBeginPlay(); + + PreInit(); +} + +public event PostBeginPlay() +{ + `Log_Trace(); + + if (bPendingDelete || bDeleteMe) return; + + Super.PostBeginPlay(); + + PostInit(); +} + +private function PreInit() +{ + `Log_Trace(); + + if (Version == `NO_CONFIG) + { + LogLevel = LL_Info; + SaveConfig(); + } + + //CfgExampleConfig.static.InitConfig(Version, LatestVersion); + + switch (Version) + { + case `NO_CONFIG: + `Log_Info("Config created"); + + case MaxInt: + `Log_Info("Config updated to version" @ LatestVersion); + break; + + case LatestVersion: + `Log_Info("Config is up-to-date"); + break; + + default: + `Log_Warn("The config version is higher than the current version (are you using an old mutator?)"); + `Log_Warn("Config version is" @ Version @ "but current version is" @ LatestVersion); + `Log_Warn("The config version will be changed to" @ LatestVersion); + break; + } + + if (LatestVersion != Version) + { + Version = LatestVersion; + SaveConfig(); + } + + if (LogLevel == LL_WrongLevel) + { + LogLevel = LL_Info; + `Log_Warn("Wrong 'LogLevel', return to default value"); + SaveConfig(); + } + `Log_Base("LogLevel:" @ LogLevel); + + //ExampleConfig = CfgExampleConfig.static.Load(LogLevel); +} + +private function PostInit() +{ + `Log_Trace(); + + if (WorldInfo == None || WorldInfo.Game == None) + { + SetTimer(1.0f, false, nameof(PostInit)); + return; + } + + KFGI = KFGameInfo(WorldInfo.Game); + if (KFGI == None) + { + `Log_Fatal("Incompatible gamemode:" @ WorldInfo.Game); + SafeDestroy(); + return; + } + + KFGI.HUDType = class'YAS_HUD'; + + if (KFGI.GameReplicationInfo == None) + { + SetTimer(1.0f, false, nameof(PostInit)); + return; + } + + KFGRI = KFGameReplicationInfo(KFGI.GameReplicationInfo); + if (KFGRI == None) + { + `Log_Fatal("Incompatible Replication info:" @ KFGI.GameReplicationInfo); + SafeDestroy(); + return; + } + + KFGIS = KFGameInfo_Survival(KFGI); + KFGIE = KFGameInfo_Endless(KFGI); +} + +public function NotifyLogin(Controller C) +{ + `Log_Trace(); + + if (!CreateRepInfo(C)) + { + `Log_Error("Can't create RepInfo for:" @ C); + } +} + +public function NotifyLogout(Controller C) +{ + `Log_Trace(); + + if (!DestroyRepInfo(C)) + { + `Log_Error("Can't destroy RepInfo of:" @ C); + } +} + +public function bool CreateRepInfo(Controller C) +{ + local YAS_RepInfo RepInfo; + + `Log_Trace(); + + if (C == None) return false; + + RepInfo = Spawn(class'YAS_RepInfo', C); + + if (RepInfo == None) return false; + + // Do something + + RepInfos.AddItem(RepInfo); + + return true; +} + +public function bool DestroyRepInfo(Controller C) +{ + local YAS_RepInfo RepInfo; + + `Log_Trace(); + + if (C == None) return false; + + foreach RepInfos(RepInfo) + { + if (RepInfo.Owner == C) + { + RepInfos.RemoveItem(RepInfo); + RepInfo.SafeDestroy(); + return true; + } + } + + return false; +} + +DefaultProperties +{ + +} \ No newline at end of file diff --git a/YAS/Classes/YAS.upkg b/YAS/Classes/YAS.upkg new file mode 100644 index 0000000..29cb156 --- /dev/null +++ b/YAS/Classes/YAS.upkg @@ -0,0 +1,4 @@ +[Flags] +AllowDownload=True +ClientOptional=False +ServerSideOnly=False diff --git a/YAS/Classes/YASMut.uc b/YAS/Classes/YASMut.uc index 9fa84c3..40f1433 100644 --- a/YAS/Classes/YASMut.uc +++ b/YAS/Classes/YASMut.uc @@ -1,212 +1,60 @@ -class YASMut extends KFMutator - dependson(Types) - config(YAS); +class YASMut extends KFMutator; + +var private YAS YAS; -`include(Build.uci) -`include(Logger.uci) - -const CurrentVersion = 2; - -var config int ConfigVersion; - -var private OnlineSubsystem Steamworks; - -var private array RepInfos; -var private array UIDRankRelationsPlayers; -var private array UIDRankRelationsSteamGroups; -var private array UIDRankRelationsActive; -var private YASSettings Settings; - -function PostBeginPlay() +public simulated function bool SafeDestroy() { - `callstack(); - - Super.PostBeginPlay(); - - WorldInfo.Game.HUDType = class'YASHUD'; - Steamworks = class'GameEngine'.static.GetOnlineSubsystem(); - - InitConfig(); - - LoadRelations(); - - Settings.Style = class'ScoreboardStyle'.static.Settings(); - Settings.Admin = class'SystemAdminRank'.static.Settings(); - Settings.Player = class'SystemPlayerRank'.static.Settings(); - Settings.Health = class'SettingsHealth'.static.Settings(); - Settings.Ping = class'SettingsPing'.static.Settings(); - Settings.Level = class'SettingsLevel'.static.Settings(); + return (bPendingDelete || bDeleteMe || Destroy()); } -function NotifyLogin(Controller C) +public event PreBeginPlay() { - `callstack(); + Super.PreBeginPlay(); - CreateRepInfo(C); + if (WorldInfo.NetMode == NM_Client) return; + + foreach WorldInfo.DynamicActors(class'YAS', YAS) + { + break; + } + + if (YAS == None) + { + YAS = WorldInfo.Spawn(class'YAS'); + } + + if (YAS == None) + { + `Log_Base("FATAL: Can't Spawn 'YAS'"); + SafeDestroy(); + } +} + +public function AddMutator(Mutator Mut) +{ + if (Mut == Self) return; + + if (Mut.Class == Class) + Mut.Destroy(); + else + Super.AddMutator(Mut); +} + +public function NotifyLogin(Controller C) +{ + YAS.NotifyLogin(C); Super.NotifyLogin(C); } -function NotifyLogout(Controller C) +public function NotifyLogout(Controller C) { - `callstack(); - - DestroyRepInfo(C); + YAS.NotifyLogout(C); Super.NotifyLogout(C); } -private function bool IsUID(String ID) -{ - `callstack(); - - return (Left(ID, 2) ~= "0x"); -} - -private function InitConfig() -{ - `callstack(); - - if (ConfigVersion == 0) SaveConfig(); // because I want the main settings to be at the beginning of the config :) - - class'ScoreboardStyle'.static.InitConfig(ConfigVersion); - class'SystemAdminRank'.static.InitConfig(ConfigVersion); - class'SystemPlayerRank'.static.InitConfig(ConfigVersion); - class'SettingsHealth'.static.InitConfig(ConfigVersion); - class'SettingsPing'.static.InitConfig(ConfigVersion); - class'SettingsLevel'.static.InitConfig(ConfigVersion); - class'CustomRanks'.static.InitConfig(ConfigVersion); - class'PlayerRankRelations'.static.InitConfig(ConfigVersion); - class'SteamGroupRankRelations'.static.InitConfig(ConfigVersion); - - switch (ConfigVersion) - { - case 0: - case 1: - case 2147483647: - `info("Config updated to version"@CurrentVersion); - break; - - case CurrentVersion: - `info("Config is up-to-date"); - break; - - default: - `warning("The config version is higher than the current version (are you using an old mutator?)"); - `warning("Config version is"@ConfigVersion@"but current version is"@CurrentVersion); - `warning("The config version will be changed to "@CurrentVersion); - break; - } - - if (ConfigVersion != CurrentVersion) - { - ConfigVersion = CurrentVersion; - SaveConfig(); - } -} - -private function LoadRelations() -{ - local RankRelation Player, SteamGroup; - local UIDRankRelation UIDInfo; - - `callstack(); - - foreach class'PlayerRankRelations'.default.Relation(Player) - { - UIDInfo.RankID = Player.RankID; - if (IsUID(Player.ObjectID) && Steamworks.StringToUniqueNetId(Player.ObjectID, UIDInfo.UID)) - { - if (UIDRankRelationsPlayers.Find('Uid', UIDInfo.UID) == INDEX_NONE) - UIDRankRelationsPlayers.AddItem(UIDInfo); - } - else if (Steamworks.Int64ToUniqueNetId(Player.ObjectID, UIDInfo.UID)) - { - if (UIDRankRelationsPlayers.Find('Uid', UIDInfo.UID) == INDEX_NONE) - UIDRankRelationsPlayers.AddItem(UIDInfo); - } - else `warning("Can't add player:"@Player.ObjectID); - } - - foreach class'SteamGroupRankRelations'.default.Relation(SteamGroup) - { - UIDInfo.RankID = SteamGroup.RankID; - if (IsUID(SteamGroup.ObjectID) && Steamworks.StringToUniqueNetId(SteamGroup.ObjectID, UIDInfo.UID)) - { - if (UIDRankRelationsPlayers.Find('Uid', UIDInfo.UID) == INDEX_NONE) - UIDRankRelationsPlayers.AddItem(UIDInfo); - } - else if (Steamworks.Int64ToUniqueNetId(SteamGroup.ObjectID, UIDInfo.UID)) - { - if (UIDRankRelationsSteamGroups.Find('Uid', UIDInfo.UID) == INDEX_NONE) - UIDRankRelationsSteamGroups.AddItem(UIDInfo); - } - else `warning("Can't add steamgroup:"@SteamGroup.ObjectID); - } -} - -private function CreateRepInfo(Controller C) -{ - local YASRepInfo RepInfo; - - `callstack(); - - if (C == None) return; - - RepInfo = Spawn(class'YASRepInfo', C); - - RepInfo.Mut = Self; - RepInfo.Settings = Settings; - - RepInfos.AddItem(RepInfo); -} - -private function DestroyRepInfo(Controller C) -{ - local YASRepInfo RepInfo; - - `callstack(); - - if (C == None) return; - - foreach RepInfos(RepInfo) - { - if (RepInfo.Owner == C) - { - RepInfos.RemoveItem(RepInfo); - RepInfo.Destroy(); - } - } -} - -public function UpdatePlayerRank(UIDRankRelation Rel) -{ - local YASRepInfo RepInfo; - local int Index; - - `callstack(); - - Index = UIDRankRelationsActive.Find('UID', Rel.UID); - if (Index != INDEX_NONE) - UIDRankRelationsActive[Index] = Rel; - else - UIDRankRelationsActive.AddItem(Rel); - - foreach RepInfos(RepInfo) - RepInfo.UpdateRankRelation(Rel); -} - -public function AddPlayerRank(UIDRankRelation Rel) -{ - local YASRepInfo RepInfo; - - `callstack(); - - foreach RepInfos(RepInfo) - RepInfo.AddRankRelation(Rel); -} - -defaultproperties +DefaultProperties { } \ No newline at end of file diff --git a/YAS/Classes/YASRepInfo.uc b/YAS/Classes/YASRepInfo.uc deleted file mode 100644 index e521651..0000000 --- a/YAS/Classes/YASRepInfo.uc +++ /dev/null @@ -1,258 +0,0 @@ -class YASRepInfo extends ReplicationInfo; - -`include(Build.uci) -`include(Logger.uci) - -// Server vars -var public YASMut Mut; - -// Client vars -var private KFScoreBoard SC; -var private OnlineSubsystemSteamworks SW; - -// Fitst time replication -var public array SteamGroupRelations; -var private array RankRelations; -var public array CustomRanks; -var public YASSettings Settings; -var public UIDRankRelation RankRelation; // Current player rank relation - -var private int CustomRanksRepProgress, SteamGroupsRepProgress; - -simulated event PostBeginPlay() -{ - `callstack(); - - super.PostBeginPlay(); - - if (bDeleteMe) return; - - if (Role < ROLE_Authority || WorldInfo.NetMode == NM_StandAlone) - { - GetScoreboard(); - GetOnlineSubsystem(); - } -} - -private reliable client function GetScoreboard() -{ - `callstack(); - - if (SC == None) - SC = YASHUD(GetALocalPlayerController().myHUD).Scoreboard; - - if (SC == None) - SetTimer(0.1f, false, nameof(GetScoreboard)); - else - ClearTimer(nameof(GetScoreboard)); -} - -private reliable client function GetOnlineSubsystem() -{ - `callstack(); - - if (SW == None) - SW = OnlineSubsystemSteamworks(class'GameEngine'.static.GetOnlineSubsystem()); - - if (SW == None) - SetTimer(0.1f, false, nameof(GetOnlineSubsystem)); - else - ClearTimer(nameof(GetOnlineSubsystem)); -} - -public function StartFirstTimeReplication() -{ - `callstack(); - - ClientAddSettings(Settings); - SetTimer(0.01f, true, nameof(ReplicateCustomRanks)); - SetTimer(0.01f, true, nameof(ReplicateSteamGroupRelations)); -} - -private reliable client function ClientAddSettings(YASSettings Set) -{ - `callstack(); - - Settings = Set; - ClientApplySettings(); -} - -private reliable client function ClientApplySettings() -{ - `callstack(); - - if (SC == None) - { - SetTimer(0.1f, false, nameof(ClientApplySettings)); - return; - } - - ClearTimer(nameof(ClientApplySettings)); - - if (class'ScoreboardStyleClient'.default.bEnabled) - Settings.Style = class'ScoreboardStyleClient'.static.Settings(); - - SC.Settings = Settings; -} - -private reliable client function ClientApplyCustomRanks() -{ - `callstack(); - - if (SC == None) - { - SetTimer(0.1f, false, nameof(ClientApplyCustomRanks)); - return; - } - - ClearTimer(nameof(ClientApplyCustomRanks)); - SC.CustomRanks = CustomRanks; -} - -private reliable client function ClientApplyRankRelations() -{ - `callstack(); - - if (SC == None) - { - SetTimer(0.1f, false, nameof(ClientApplyRankRelations)); - return; - } - - ClearTimer(nameof(ClientApplyRankRelations)); - SC.RankRelations = RankRelations; -} - -private function ReplicateCustomRanks() -{ - `callstack(); - - if (WorldInfo.NetMode != NM_StandAlone && CustomRanksRepProgress < CustomRanks.Length) - { - ClientAddCustomRank(CustomRanks[CustomRanksRepProgress]); - ++CustomRanksRepProgress; - } - else - { - ClearTimer(nameof(ReplicateCustomRanks)); - ClientApplyCustomRanks(); - } -} - -private reliable client function ClientAddCustomRank(RankInfo Rank) -{ - `callstack(); - - CustomRanks.AddItem(Rank); -} - -private function ReplicateSteamGroupRelations() -{ - `callstack(); - - if (WorldInfo.NetMode != NM_StandAlone && SteamGroupsRepProgress < SteamGroupRelations.Length) - { - ClientAddSteamGroupRelation(SteamGroupRelations[SteamGroupsRepProgress]); - ++SteamGroupsRepProgress; - } - else - { - ClearTimer(nameof(ReplicateSteamGroupRelations)); - if (RankRelation.RankID == INDEX_NONE) - FindMyRankInSteamGroups(); - } -} - -private reliable client function ClientAddSteamGroupRelation(UIDRankRelation Rel) -{ - `callstack(); - - SteamGroupRelations.AddItem(Rel); -} - -private reliable client function FindMyRankInSteamGroups() -{ - local UIDRankRelation SteamGroupRel; - - `callstack(); - - foreach SteamGroupRelations(SteamGroupRel) - if (SW.CheckPlayerGroup(SteamGroupRel.UID) && (RankRelation.RankID < 0 || SteamGroupRel.RankID < RankRelation.RankID)) - RankRelation.RankID = SteamGroupRel.RankID; - - if (RankRelation.RankID != INDEX_NONE) - ServerApplyRank(RankRelation.RankID); -} - -private reliable server function ServerApplyRank(int RankID) -{ - `callstack(); - - RankRelation.RankID = RankID; - Mut.UpdatePlayerRank(RankRelation); -} - -public function AddRankRelation(UIDRankRelation Rel) -{ - `callstack(); - - ClientAddRankRelation(Rel); -} - -private reliable client function ClientAddRankRelation(UIDRankRelation Rel) -{ - `callstack(); - - RankRelations.AddItem(Rel); - ClientApplyRankRelations(); -} - -public function RemoveRankRelation(UIDRankRelation Rel) -{ - `callstack(); - - ClientRemoveRankRelation(Rel); -} - -private reliable client function ClientRemoveRankRelation(UIDRankRelation Rel) -{ - `callstack(); - - RankRelations.RemoveItem(Rel); - ClientApplyRankRelations(); -} - -public function UpdateRankRelation(UIDRankRelation Rel) -{ - `callstack(); - - ClientUpdateRankRelation(Rel); -} - -private reliable client function ClientUpdateRankRelation(UIDRankRelation Rel) -{ - local int Index; - - `callstack(); - - Index = RankRelations.Find('UID', Rel.UID); - - if (Index != INDEX_NONE) - RankRelations[Index] = Rel; - else - RankRelations.AddItem(Rel); - - ClientApplyRankRelations(); -} - -defaultproperties -{ - bAlwaysRelevant = false; - bOnlyRelevantToOwner = true; - Role = ROLE_Authority; - RemoteRole = ROLE_SimulatedProxy; - bSkipActorPropertyReplication = false; // This is needed, otherwise the client-to-server RPC fails - - CustomRanksRepProgress = 0; - SteamGroupsRepProgress = 0; -} \ No newline at end of file diff --git a/YAS/Classes/YASHUD.uc b/YAS/Classes/YAS_HUD.uc similarity index 89% rename from YAS/Classes/YASHUD.uc rename to YAS/Classes/YAS_HUD.uc index 2ba7915..8323233 100644 --- a/YAS/Classes/YASHUD.uc +++ b/YAS/Classes/YAS_HUD.uc @@ -1,16 +1,12 @@ -class YASHUD extends KFGFxHudWrapper - config(YASMut); - -`include(Build.uci) -`include(Logger.uci) +class YAS_HUD extends KFGFxHudWrapper; const HUDBorderSize = 3; var float ScaledBorderSize; var array HUDWidgets; -var class ScoreboardClass; -var KFScoreBoard Scoreboard; +var class ScoreboardClass; +var YAS_ScoreBoard Scoreboard; var transient KF2GUIController GUIController; var transient GUIStyleBase GUIStyle; @@ -58,7 +54,7 @@ function PostRender() function LaunchHUDMenus() { - Scoreboard = KFScoreBoard(GUIController.InitializeHUDWidget(ScoreboardClass)); + Scoreboard = YAS_ScoreBoard(GUIController.InitializeHUDWidget(ScoreboardClass)); Scoreboard.SetVisibility(false); } @@ -110,5 +106,5 @@ exec function SetShowScores(bool bNewValue) defaultproperties { - ScoreboardClass=class'KFScoreBoard' + ScoreboardClass=class'YAS_ScoreBoard' } \ No newline at end of file diff --git a/YAS/Classes/YAS_RepInfo.uc b/YAS/Classes/YAS_RepInfo.uc new file mode 100644 index 0000000..a68e835 --- /dev/null +++ b/YAS/Classes/YAS_RepInfo.uc @@ -0,0 +1,68 @@ +class YAS_RepInfo extends ReplicationInfo; + +// Server +var public YASMut Mut; +var public E_LogLevel LogLevel; + +// Client +var private YAS_ScoreBoard SC; +var private OnlineSubsystemSteamworks SW; + +public simulated function bool SafeDestroy() +{ + `Log_Trace(); + + return (bPendingDelete || bDeleteMe || Destroy()); +} + +public simulated event PreBeginPlay() +{ + if (bPendingDelete || bDeleteMe) return; + + Super.PreBeginPlay(); + + if (Role < ROLE_Authority || WorldInfo.NetMode == NM_StandAlone) + { + GetScoreboard(); + GetOnlineSubsystem(); + } +} + +public simulated event PostBeginPlay() +{ + if (bPendingDelete || bDeleteMe) return; + + Super.PostBeginPlay(); +} + +private reliable client function GetScoreboard() // TODO: ! +{ + if (SC == None) + { + SC = YAS_HUD(GetALocalPlayerController().myHUD).Scoreboard; // GetKFPC? + } + + if (SC == None) + { + SetTimer(0.1f, false, nameof(GetScoreboard)); + } + else + { + ClearTimer(nameof(GetScoreboard)); + } +} + +private reliable client function GetOnlineSubsystem() +{ + // TODO: ! +} + +defaultproperties +{ + Role = ROLE_Authority + RemoteRole = ROLE_SimulatedProxy + + bAlwaysRelevant = false + bOnlyRelevantToOwner = true + bSkipActorPropertyReplication = false +} \ No newline at end of file diff --git a/YAS/Classes/KFScoreBoard.uc b/YAS/Classes/YAS_ScoreBoard.uc similarity index 80% rename from YAS/Classes/KFScoreBoard.uc rename to YAS/Classes/YAS_ScoreBoard.uc index cd94bdf..c44bef0 100644 --- a/YAS/Classes/KFScoreBoard.uc +++ b/YAS/Classes/YAS_ScoreBoard.uc @@ -1,10 +1,7 @@ -class KFScoreBoard extends KFGUI_Page - dependson(Types); +class YAS_ScoreBoard extends KFGUI_Page + dependson(YAS_Types); -`include(Build.uci) -`include(Logger.uci) - -const HeaderWidthRatio = 0.35f; +const HeaderWidthRatio = 0.35f; const PlayerListWidthRatio = 0.6f; var transient float HealthXPos, RankXPos, PlayerXPos, LevelXPos, PerkXPos, DoshXPos, KillsXPos, AssistXPos, PingXPos, ScrollXPos; @@ -27,27 +24,10 @@ var float PingBars; // Cache var array PerkNames; -// Ranks -var array CustomRanks; -var array RankRelations; - -var YASSettings Settings; - -// Localization -var localized string Players; -var localized string Spectators; -var localized string Rank; -var localized string State; -var localized string NoPerk; -var localized string Ready; -var localized string NotReady; -var localized string Unknown; -var localized string Dead; +var YAS_Settings Settings; function InitMenu() { - `callstack(); - Super.InitMenu(); PlayersList = KFGUI_List(FindComponentID('PlayerList')); OwnerPC = KFPlayerController(GetPlayer()); @@ -153,8 +133,8 @@ function DrawMenu() local float XPos, YPos, YL, XL, FontScalar, XPosCenter, BoxW, BoxX, BoxH, MinBoxW, DoshSize, ScrollBarWidth; local int i, j, NumSpec, NumAlivePlayer, Width; local float BorderSize; - local ColorRGBA ColorTmp; - + local Color ColorTMP; + PC = GetPlayer(); if (KFGRI == None) { @@ -228,10 +208,10 @@ function DrawMenu() BoxH = YL + BorderSize; // Top Rect (Server name) - SetDrawColor(Canvas, Settings.Style.ServerNameBoxColor); + Canvas.SetDrawColorStruct(Settings.Style.ServerNameBoxColor); Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, Settings.Style.EdgeSize, Settings.Style.ShapeServerNameBox); - SetDrawColor(Canvas, Settings.Style.ServerNameTextColor); + Canvas.SetDrawColorStruct(Settings.Style.ServerNameTextColor); S = ServerName(); DrawTextShadowHVCenter(S, BoxX, YPos, BoxW, FontScalar); @@ -240,10 +220,10 @@ function DrawMenu() // Mid Left Rect (Info) BoxW = Width * 0.7; // TODO ? BoxH = YL * 2 + BorderSize * 2; - SetDrawColor(Canvas, Settings.Style.GameInfoBoxColor); + Canvas.SetDrawColorStruct(Settings.Style.GameInfoBoxColor); Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, Settings.Style.EdgeSize, Settings.Style.ShapeGameInfoBox); - SetDrawColor(Canvas, Settings.Style.GameInfoTextColor); + Canvas.SetDrawColorStruct(Settings.Style.GameInfoTextColor); S = class'KFCommon_LocalizedStrings'.static.GetFriendlyMapName(PC.WorldInfo.GetMapName(true)); DrawTextShadowHLeftVCenter(S, BoxX + Settings.Style.EdgeSize, YPos, FontScalar); @@ -253,10 +233,10 @@ function DrawMenu() // Mid Right Rect (Wave) BoxX = BoxX + BoxW; BoxW = Width - BoxW; - SetDrawColor(Canvas, Settings.Style.WaveBoxColor); + Canvas.SetDrawColorStruct(Settings.Style.WaveBoxColor); Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, Settings.Style.EdgeSize, Settings.Style.ShapeWaveInfoBox); - SetDrawColor(Canvas, Settings.Style.WaveTextColor); + Canvas.SetDrawColorStruct(Settings.Style.WaveTextColor); S = class'KFGFxHUD_ScoreboardMapInfoContainer'.default.WaveString; DrawTextShadowHVCenter(S, BoxX, YPos, BoxW, FontScalar); DrawTextShadowHVCenter(WaveText(), BoxX, YPos + YL, BoxW, FontScalar); @@ -267,11 +247,11 @@ function DrawMenu() BoxX = XPos; BoxW = Width; BoxH = YL + BorderSize; - SetDrawColor(Canvas, Settings.Style.PlayerCountBoxColor); + Canvas.SetDrawColorStruct(Settings.Style.PlayerCountBoxColor); Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, Settings.Style.EdgeSize, Settings.Style.ShapePlayersCountBox); - SetDrawColor(Canvas, Settings.Style.PlayerCountTextColor); - S = Players$": " $ NumPlayer $ " / " $ KFGRI.MaxHumanCount $ " " $ Spectators $ ": " $ NumSpec; + Canvas.SetDrawColorStruct(Settings.Style.PlayerCountTextColor); + S = NumPlayer $ " / " $ KFGRI.MaxHumanCount; // $ " " $ Spectators $ ": " $ NumSpec; Canvas.TextSize(S, XL, YL, FontScalar, FontScalar); DrawTextShadowHLeftVCenter(S, BoxX + Settings.Style.EdgeSize, YPos, FontScalar); @@ -285,7 +265,7 @@ function DrawMenu() XPos = (Canvas.ClipX - Width) * 0.5; YPos += YL; BoxH = YL + BorderSize; - SetDrawColor(Canvas, Settings.Style.ListHeaderBoxColor); + Canvas.SetDrawColorStruct(Settings.Style.ListHeaderBoxColor); Owner.CurrentStyle.DrawRectBox( XPos - BorderSize * 2, YPos, Width + BorderSize * 4, @@ -339,7 +319,7 @@ function DrawMenu() LevelXPos = PerkXPos - LevelWBox; // Header texts - SetDrawColor(Canvas, Settings.Style.ListHeaderTextColor); + Canvas.SetDrawColorStruct(Settings.Style.ListHeaderTextColor); DrawTextShadowHLeftVCenter(class'KFGFxHUD_ScoreboardWidget'.default.PlayerString, XPos + PlayerXPos, YPos, FontScalar); DrawTextShadowHLeftVCenter(class'KFGFxMenu_Inventory'.default.PerkFilterString, XPos + PerkXPos, YPos, FontScalar); DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.KillsString, XPos + KillsXPos, YPos, KillsWBox, FontScalar); @@ -347,9 +327,9 @@ function DrawMenu() DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.DoshString, XPos + DoshXPos, YPos, DoshWBox, FontScalar); DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.PingString, XPos + PingXPos, YPos, PingWBox, FontScalar); - ColorTmp = Settings.Style.ListHeaderTextColor; - ColorTmp.A = 150; - SetDrawColor(Canvas, ColorTmp); + ColorTMP = Settings.Style.ListHeaderTextColor; + ColorTMP.A = 150; + Canvas.SetDrawColorStruct(ColorTmp); DrawHealthIcon(XPos + HealthXPos, YPos, HealthWBox, BoxH); @@ -405,11 +385,6 @@ function DrawTextShadowHRightVCenter(string Str, float XPos, float YPos, float B Owner.CurrentStyle.DrawTextShadow(Str, XPos + BoxWidth - TextWidth, YPos, 1, FontScalar); } -function SetDrawColor(Canvas C, ColorRGBA RGBA) -{ - C.SetDrawColor(RGBA.R, RGBA.G, RGBA.B, RGBA.A); -} - function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float Width, bool bFocus) { local string S, StrValue; @@ -420,56 +395,21 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float local bool bIsZED; local int Ping; - local RankInfo CurrentRank; - local bool HasRank; - local int PlayerInfoIndex, PlayerRankIndex; local float BorderSize; local int Shape, ShapeHealth; - local ColorRGBA HealthBoxColor, HealthTextColor; + local Color HealthBoxColor, HealthTextColor; BorderSize = Owner.HUDOwner.ScaledBorderSize; YOffset *= 1.05; KFPRI = KFPRIArray[Index]; - - HasRank = false; - - PlayerInfoIndex = RankRelations.Find('UID', KFPRI.UniqueId); - if (PlayerInfoIndex != INDEX_NONE && RankRelations[PlayerInfoIndex].RankID != INDEX_NONE) - { - PlayerRankIndex = CustomRanks.Find('ID', RankRelations[PlayerInfoIndex].RankID); - if (PlayerRankIndex != INDEX_NONE) - { - HasRank = true; - CurrentRank = CustomRanks[PlayerRankIndex]; - } - } - - if (KFPRI.bAdmin) - { - if (!HasRank || (HasRank && !CurrentRank.OverrideAdminRank)) - { - CurrentRank.Rank = Settings.Admin.Rank; - CurrentRank.TextColor = Settings.Admin.TextColor; - CurrentRank.ApplyColorToFields = Settings.Admin.ApplyColorToFields; - HasRank = true; - } - } - else // Player - { - if (!HasRank) - { - CurrentRank.Rank = Settings.Player.Rank; - CurrentRank.TextColor = Settings.Player.TextColor; - CurrentRank.ApplyColorToFields = Settings.Player.ApplyColorToFields; - HasRank = true; - } - } if (KFGRI.bVersusGame) + { bIsZED = KFTeamInfo_Zeds(KFPRI.Team) != None; + } XPos = 0.f; @@ -547,7 +487,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float } // Health box - SetDrawColor(C, HealthBoxColor); + C.SetDrawColorStruct(HealthBoxColor); Owner.CurrentStyle.DrawRectBox(XPos, YOffset, HealthWBox, @@ -555,19 +495,20 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float Settings.Style.EdgeSize, ShapeHealth); - if (CurrentRank.ApplyColorToFields.Health) - SetDrawColor(C, CurrentRank.TextColor); - else - SetDrawColor(C, HealthTextColor); + C.SetDrawColorStruct(HealthTextColor); + if (KFPRI.PlayerHealth > 0) + { DrawTextShadowHVCenter(String(KFPRI.PlayerHealth), HealthXPos, TextYOffset, HealthWBox, FontScalar); + } + XPos += HealthWBox; // PlayerBox if (PlayerIndex == Index) - SetDrawColor(C, Settings.Style.PlayerOwnerBoxColor); + C.SetDrawColorStruct(Settings.Style.PlayerOwnerBoxColor); else - SetDrawColor(C, Settings.Style.PlayerBoxColor); + C.SetDrawColorStruct(Settings.Style.PlayerBoxColor); if (KFPRIArray.Length > 1 && Index == 0) Shape = Settings.Style.ShapePlayerBoxTopPlayer; @@ -590,7 +531,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float Shape = Settings.Style.ShapeStatsBoxMidPlayer; BoxWidth = Width - XPos; - SetDrawColor(C, Settings.Style.StatsBoxColor); + C.SetDrawColorStruct(Settings.Style.StatsBoxColor); Owner.CurrentStyle.DrawRectBox( XPos, YOffset, BoxWidth, @@ -602,10 +543,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float RealPlayerWBox = PlayerWBox; if (bIsZED) { - if (CurrentRank.ApplyColorToFields.Perk) - SetDrawColor(C, CurrentRank.TextColor); - else - SetDrawColor(C, Settings.Style.ZedTextColor); + C.SetDrawColorStruct(Settings.Style.ZedTextColor); C.SetPos (PerkXPos, YOffset - ((Height-5) * 0.5f)); C.DrawRect (Height-5, Height-5, Texture2D'UI_Widgets.MenuBarWidget_SWF_IF'); @@ -615,7 +553,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float } else { - if (KFPRI.CurrentPerkClass != None) + if (KFPRI.CurrentPerkclass != None) { PrestigeLevel = KFPRI.GetActivePerkPrestigeLevel(); Level = KFPRI.GetActivePerkLevel(); @@ -642,49 +580,32 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float C.DrawTile(KFPRI.CurrentPerkClass.default.PerkIcon, PerkIconSize, PerkIconSize, 0, 0, 256, 256); } - if (CurrentRank.ApplyColorToFields.Level) - SetDrawColor(C, CurrentRank.TextColor); + + if (Level < Settings.Level.Low[KFGRI.GameDifficulty]) + C.SetDrawColorStruct(Settings.Style.LevelTextColorLow); + else if (Level < Settings.Level.High[KFGRI.GameDifficulty]) + C.SetDrawColorStruct(Settings.Style.LevelTextColorMid); else - { - if (Level < Settings.Level.Low[KFGRI.GameDifficulty]) - SetDrawColor(C, Settings.Style.LevelTextColorLow); - else if (Level < Settings.Level.High[KFGRI.GameDifficulty]) - SetDrawColor(C, Settings.Style.LevelTextColorMid); - else - SetDrawColor(C, Settings.Style.LevelTextColorHigh); - } + C.SetDrawColorStruct(Settings.Style.LevelTextColorHigh); + S = String(Level); DrawTextShadowHLeftVCenter(S, LevelXPos, TextYOffset, FontScalar); - if (CurrentRank.ApplyColorToFields.Level) - SetDrawColor(C, CurrentRank.TextColor); - - if (CurrentRank.ApplyColorToFields.Perk) - SetDrawColor(C, CurrentRank.TextColor); - else - SetDrawColor(C, Settings.Style.PerkNoneTextColor); + C.SetDrawColorStruct(Settings.Style.PerkNoneTextColor); S = KFPRI.CurrentPerkClass.default.PerkName; DrawTextShadowHLeftVCenter(S, PerkXPos, TextYOffset, FontScalar); } else { - if (CurrentRank.ApplyColorToFields.Perk) - SetDrawColor(C, CurrentRank.TextColor); - else - SetDrawColor(C, Settings.Style.PerkNoneTextColor); - S = NoPerk; + C.SetDrawColorStruct(Settings.Style.PerkNoneTextColor); + S = ""; DrawTextShadowHLeftVCenter(S, PerkXPos, TextYOffset, FontScalar); RealPlayerWBox = PerkXPos - PlayerXPos; } } // Rank - if (CurrentRank.ApplyColorToFields.Rank) - SetDrawColor(C, CurrentRank.TextColor); - else - SetDrawColor(C, Settings.Style.PerkNoneTextColor); - S = CurrentRank.Rank; - DrawTextShadowHRightVCenter(S, PlayerXPos, TextYOffset, PerkIconPosX - PlayerXPos - (BorderSize * 2), FontScalar); + DrawTextShadowHRightVCenter("", PlayerXPos, TextYOffset, PerkIconPosX - PlayerXPos - (BorderSize * 2), FontScalar); // Avatar if (KFPRI.Avatar != None) @@ -701,10 +622,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float CheckAvatar(KFPRI, OwnerPC); // Player - if (CurrentRank.ApplyColorToFields.Player) - SetDrawColor(C, CurrentRank.TextColor); - else - SetDrawColor(C, Settings.Style.PlayerNameTextColor); + C.SetDrawColorStruct(Settings.Style.PlayerNameTextColor); S = KFPRI.PlayerName; Canvas.TextSize(S, XL, YL, FontScalar, FontScalar); while (XL > RealPlayerWBox) @@ -715,31 +633,22 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float DrawTextShadowHLeftVCenter(S, PlayerXPos, TextYOffset, FontScalar); // Kill - if (CurrentRank.ApplyColorToFields.Kills) - SetDrawColor(C, CurrentRank.TextColor); - else - SetDrawColor(C, Settings.Style.KillsTextColorMid); // TODO + C.SetDrawColorStruct(Settings.Style.KillsTextColorMid); // TODO DrawTextShadowHVCenter(string (KFPRI.Kills), KillsXPos, TextYOffset, KillsWBox, FontScalar); // Assist - if (CurrentRank.ApplyColorToFields.Assists) - SetDrawColor(C, CurrentRank.TextColor); - else - SetDrawColor(C, Settings.Style.AssistsTextColorMid); // TODO + C.SetDrawColorStruct(Settings.Style.AssistsTextColorMid); // TODO DrawTextShadowHVCenter(string (KFPRI.Assists), AssistXPos, TextYOffset, AssistWBox, FontScalar); // Dosh if (bIsZED) { - SetDrawColor(C, Settings.Style.ZedTextColor); + C.SetDrawColorStruct(Settings.Style.ZedTextColor); StrValue = "-"; } else { - if (CurrentRank.ApplyColorToFields.Dosh) - SetDrawColor(C, CurrentRank.TextColor); - else - SetDrawColor(C, Settings.Style.DoshTextColorMid); // TODO + C.SetDrawColorStruct(Settings.Style.DoshTextColorMid); // TODO StrValue = GetNiceSize(int(KFPRI.Score)); } DrawTextShadowHVCenter(StrValue, DoshXPos, TextYOffset, DoshWBox, FontScalar); @@ -747,21 +656,19 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float // Ping if (KFPRI.bBot) { - SetDrawColor(C, Settings.Style.PingTextColorNone); + C.SetDrawColorStruct(Settings.Style.PingTextColorNone); S = "-"; } else { Ping = int(KFPRI.Ping * `PING_SCALE); - if (CurrentRank.ApplyColorToFields.Ping) - SetDrawColor(C, CurrentRank.TextColor); - else if (Ping <= Settings.Ping.Low) - SetDrawColor(C, Settings.Style.PingTextColorLow); + if (Ping <= Settings.Ping.Low) + C.SetDrawColorStruct(Settings.Style.PingTextColorLow); else if (Ping <= Settings.Ping.High) - SetDrawColor(C, Settings.Style.PingTextColorMid); + C.SetDrawColorStruct(Settings.Style.PingTextColorMid); else - SetDrawColor(C, Settings.Style.PingTextColorHigh); + C.SetDrawColorStruct(Settings.Style.PingTextColorHigh); S = string(Ping); } diff --git a/YAS/Classes/Types.uc b/YAS/Classes/YAS_Types.uc similarity index 63% rename from YAS/Classes/Types.uc rename to YAS/Classes/YAS_Types.uc index 30b4e27..c2dc859 100644 --- a/YAS/Classes/Types.uc +++ b/YAS/Classes/YAS_Types.uc @@ -1,20 +1,4 @@ -class Types extends Object; - -`include(Build.uci) -`include(Logger.uci) - -struct ColorRGBA -{ - var byte R, G, B, A; - - Structdefaultproperties - { - R = 250 - G = 250 - B = 250 - A = 255 - } -}; +class YAS_Types extends Object; struct Fields { @@ -42,66 +26,7 @@ struct Fields } }; -struct RankInfo -{ - var int ID; - var string Rank; - var ColorRGBA TextColor; - var bool OverrideAdminRank; - var Fields ApplyColorToFields; -}; - -struct RankRelation -{ - var string ObjectID; - var int RankID; - - Structdefaultproperties - { - RankID = -999 - } -}; - -struct UIDRankRelation -{ - var UniqueNetId UID; - var int RankID; - - Structdefaultproperties - { - RankID = -999 - } -}; - -struct YASSettingsAdmin -{ - var string Rank; - var ColorRGBA TextColor; - var Fields ApplyColorToFields; - - Structdefaultproperties - { - Rank = "Admin" - TextColor = (R=250, G=0, B=0, A=255) - ApplyColorToFields = (Rank=True, Player=True, Level=False, Perk=False, Dosh=False, Kills=False, Assists=False, Health=False, Ping=False) - } -}; - -struct YASSettingsPlayer -{ - var string Rank; - var ColorRGBA TextColor; - var Fields ApplyColorToFields; - - Structdefaultproperties - { - Rank = "Player" - TextColor = (R=250, G=250, B=250, A=255) - ApplyColorToFields = (Rank=True, Player=True, Level=False, Perk=False, Dosh=False, Kills=False, Assists=False, Health=False, Ping=False) - } -}; - -struct YASSettingsHealth +struct YAS_SettingsHealth { var int Low; var int High; @@ -113,7 +38,7 @@ struct YASSettingsHealth } }; -struct YASSettingsPing +struct YAS_SettingsPing { var int Low; var int High; @@ -125,7 +50,7 @@ struct YASSettingsPing } }; -struct YASSettingsLevel +struct YAS_SettingsLevel { var int Low [4]; var int High[4]; @@ -143,7 +68,7 @@ struct YASSettingsLevel } }; -struct YASStyle +struct YAS_Style { // Box shapes var int EdgeSize; @@ -163,100 +88,100 @@ struct YASStyle var int ShapeStatsBoxBottomPlayer; // Server box - var ColorRGBA ServerNameBoxColor; - var ColorRGBA ServerNameTextColor; + var Color ServerNameBoxColor; + var Color ServerNameTextColor; // Game info box - var ColorRGBA GameInfoBoxColor; - var ColorRGBA GameInfoTextColor; + var Color GameInfoBoxColor; + var Color GameInfoTextColor; // Wave info box - var ColorRGBA WaveBoxColor; - var ColorRGBA WaveTextColor; + var Color WaveBoxColor; + var Color WaveTextColor; // Player count box - var ColorRGBA PlayerCountBoxColor; - var ColorRGBA PlayerCountTextColor; + var Color PlayerCountBoxColor; + var Color PlayerCountTextColor; // Header box - var ColorRGBA ListHeaderBoxColor; - var ColorRGBA ListHeaderTextColor; + var Color ListHeaderBoxColor; + var Color ListHeaderTextColor; // State box - var ColorRGBA StateBoxColorLobby; - var ColorRGBA StateBoxColorReady; - var ColorRGBA StateBoxColorNotReady; - var ColorRGBA StateBoxColorSpectator; - var ColorRGBA StateBoxColorDead; - var ColorRGBA StateBoxColorNone; - var ColorRGBA StateBoxColorHealthLow; - var ColorRGBA StateBoxColorHealthMid; - var ColorRGBA StateBoxColorHealthHigh; + var Color StateBoxColorLobby; + var Color StateBoxColorReady; + var Color StateBoxColorNotReady; + var Color StateBoxColorSpectator; + var Color StateBoxColorDead; + var Color StateBoxColorNone; + var Color StateBoxColorHealthLow; + var Color StateBoxColorHealthMid; + var Color StateBoxColorHealthHigh; // Player box - var ColorRGBA PlayerOwnerBoxColor; - var ColorRGBA PlayerBoxColor; + var Color PlayerOwnerBoxColor; + var Color PlayerBoxColor; // Stats box - var ColorRGBA StatsOwnerBoxColor; - var ColorRGBA StatsBoxColor; + var Color StatsOwnerBoxColor; + var Color StatsBoxColor; // State text - var ColorRGBA StateTextColorLobby; - var ColorRGBA StateTextColorReady; - var ColorRGBA StateTextColorNotReady; - var ColorRGBA StateTextColorSpectator; - var ColorRGBA StateTextColorDead; - var ColorRGBA StateTextColorNone; - var ColorRGBA StateTextColorHealthLow; - var ColorRGBA StateTextColorHealthMid; - var ColorRGBA StateTextColorHealthHigh; + var Color StateTextColorLobby; + var Color StateTextColorReady; + var Color StateTextColorNotReady; + var Color StateTextColorSpectator; + var Color StateTextColorDead; + var Color StateTextColorNone; + var Color StateTextColorHealthLow; + var Color StateTextColorHealthMid; + var Color StateTextColorHealthHigh; // Rank text - var ColorRGBA RankTextColor; + var Color RankTextColor; // Player text - var ColorRGBA PlayerNameTextColor; + var Color PlayerNameTextColor; // Level text - var ColorRGBA LevelTextColorLow; - var ColorRGBA LevelTextColorMid; - var ColorRGBA LevelTextColorHigh; + var Color LevelTextColorLow; + var Color LevelTextColorMid; + var Color LevelTextColorHigh; // Perk text - var ColorRGBA ZedTextColor; - var ColorRGBA PerkNoneTextColor; - var ColorRGBA PerkBerserkerTextColor; - var ColorRGBA PerkCommandoTextColor; - var ColorRGBA PerkSupportTextColor; - var ColorRGBA PerkFieldMedicTextColor; - var ColorRGBA PerkDemolitionistTextColor; - var ColorRGBA PerkFirebugTextColor; - var ColorRGBA PerkGunslingerTextColor; - var ColorRGBA PerkSharpshooterTextColor; - var ColorRGBA PerkSwatTextColor; - var ColorRGBA PerkSurvivalistTextColor; + var Color ZedTextColor; + var Color PerkNoneTextColor; + var Color PerkBerserkerTextColor; + var Color PerkCommandoTextColor; + var Color PerkSupportTextColor; + var Color PerkFieldMedicTextColor; + var Color PerkDemolitionistTextColor; + var Color PerkFirebugTextColor; + var Color PerkGunslingerTextColor; + var Color PerkSharpshooterTextColor; + var Color PerkSwatTextColor; + var Color PerkSurvivalistTextColor; // Dosh text - var ColorRGBA DoshTextColorLow; - var ColorRGBA DoshTextColorMid; - var ColorRGBA DoshTextColorHigh; + var Color DoshTextColorLow; + var Color DoshTextColorMid; + var Color DoshTextColorHigh; // Kills text - var ColorRGBA KillsTextColorLow; - var ColorRGBA KillsTextColorMid; - var ColorRGBA KillsTextColorHigh; + var Color KillsTextColorLow; + var Color KillsTextColorMid; + var Color KillsTextColorHigh; // Assists text - var ColorRGBA AssistsTextColorLow; - var ColorRGBA AssistsTextColorMid; - var ColorRGBA AssistsTextColorHigh; + var Color AssistsTextColorLow; + var Color AssistsTextColorMid; + var Color AssistsTextColorHigh; // Ping text - var ColorRGBA PingTextColorNone; - var ColorRGBA PingTextColorLow; - var ColorRGBA PingTextColorMid; - var ColorRGBA PingTextColorHigh; + var Color PingTextColorNone; + var Color PingTextColorLow; + var Color PingTextColorMid; + var Color PingTextColorHigh; // Other settings var bool ShowPingBars; @@ -386,23 +311,14 @@ struct YASStyle // Other settings ShowPingBars = true - HealthBoxSmoothColorChange = true - HealthTextSmoothColorChange = false - LevelTextSmoothColorChange = false - DoshTextSmoothColorChange = false - KillsTextSmoothColorChange = false - AssistsTextSmoothColorChange = false - PingTextSmoothColorChange = false } }; -struct YASSettings +struct YAS_Settings { - var YASStyle Style; - var YASSettingsAdmin Admin; - var YASSettingsPlayer Player; - var YASSettingsPing Ping; - var YASSettingsLevel Level; - var YASSettingsHealth Health; + var YAS_Style Style; + var YAS_SettingsPing Ping; + var YAS_SettingsLevel Level; + var YAS_SettingsHealth Health; }; diff --git a/YAS/Classes/_Logger.uc b/YAS/Classes/_Logger.uc new file mode 100644 index 0000000..93fc28a --- /dev/null +++ b/YAS/Classes/_Logger.uc @@ -0,0 +1,20 @@ +class _Logger extends Object + abstract; + +enum E_LogLevel +{ + LL_WrongLevel, + LL_None, + LL_Fatal, + LL_Error, + LL_Warning, + LL_Info, + LL_Debug, + LL_Trace, + LL_All +}; + +defaultproperties +{ + +} diff --git a/YAS/Constants.uci b/YAS/Constants.uci new file mode 100644 index 0000000..67902a9 --- /dev/null +++ b/YAS/Constants.uci @@ -0,0 +1,50 @@ +// Constants +`define NO_CONFIG 0 + +// Scoreboard +`define BOX_INNERBORDER 0 +`define BOX_INNERBORDER_TRANSPARENT 1 +`define BOX_MEDIUM 2 +`define BOX_MEDIUM_SLIGHTTRANSPARENT 3 +`define BOX_MEDIUM_TRANSPARENT 4 +`define BOX_LARGE 5 +`define BOX_LARGE_SLIGHTTRANSPARENT 6 +`define BOX_LARGE_TRANSPARENT 7 +`define BOX_SMALL 8 +`define BOX_SMALL_SLIGHTTRANSPARENT 9 +`define BOX_SMALL_TRANSPARENT 10 +`define BOX_CORNER_8 11 +`define BOX_CORNER_16 12 +`define BOX_CORNER_32 13 +`define BOX_CORNER_64 14 +`define BOX_CORNER_512 15 + +`define ITEMBOX_NORMAL 0 +`define ITEMBOX_DISABLED 1 +`define ITEMBOX_HIGHLIGHTED 2 + +`define CHECKMARK_NORMAL 0 +`define CHECKMARK_DISABLED 1 +`define CHECKMARK_HIGHLIGHTED 2 + +`define ARROW_DOWN 0 +`define ARROW_LEFT 1 +`define ARROW_RIGHT 2 +`define ARROW_UP 3 + +`define BUTTON_NORMAL 0 +`define BUTTON_DISABLED 1 +`define BUTTON_HIGHLIGHTED 2 +`define BUTTON_PRESSED 3 + +`define TAB_TOP 0 +`define TAB_BOTTOM 1 + +`define PEN_WHITE 0 +`define PEN_BLACK 1 +`define PEN_GRAY 2 + +`define CURSOR_DEFAULT 0 +`define CURSOR_SELECTION 1 +`define CURSOR_RESIZEVERT 2 +`define CURSOR_RESIZEHORZ 3 diff --git a/YAS/Globals.uci b/YAS/Globals.uci index 1c80c22..a48ac52 100644 --- a/YAS/Globals.uci +++ b/YAS/Globals.uci @@ -1,46 +1,3 @@ -`define BOX_INNERBORDER 0 -`define BOX_INNERBORDER_TRANSPARENT 1 -`define BOX_MEDIUM 2 -`define BOX_MEDIUM_SLIGHTTRANSPARENT 3 -`define BOX_MEDIUM_TRANSPARENT 4 -`define BOX_LARGE 5 -`define BOX_LARGE_SLIGHTTRANSPARENT 6 -`define BOX_LARGE_TRANSPARENT 7 -`define BOX_SMALL 8 -`define BOX_SMALL_SLIGHTTRANSPARENT 9 -`define BOX_SMALL_TRANSPARENT 10 -`define BOX_CORNER_8 11 -`define BOX_CORNER_16 12 -`define BOX_CORNER_32 13 -`define BOX_CORNER_64 14 -`define BOX_CORNER_512 15 - -`define ITEMBOX_NORMAL 0 -`define ITEMBOX_DISABLED 1 -`define ITEMBOX_HIGHLIGHTED 2 - -`define CHECKMARK_NORMAL 0 -`define CHECKMARK_DISABLED 1 -`define CHECKMARK_HIGHLIGHTED 2 - -`define ARROW_DOWN 0 -`define ARROW_LEFT 1 -`define ARROW_RIGHT 2 -`define ARROW_UP 3 - -`define BUTTON_NORMAL 0 -`define BUTTON_DISABLED 1 -`define BUTTON_HIGHLIGHTED 2 -`define BUTTON_PRESSED 3 - -`define TAB_TOP 0 -`define TAB_BOTTOM 1 - -`define PEN_WHITE 0 -`define PEN_BLACK 1 -`define PEN_GRAY 2 - -`define CURSOR_DEFAULT 0 -`define CURSOR_SELECTION 1 -`define CURSOR_RESIZEVERT 2 -`define CURSOR_RESIZEHORZ 3 +// Imports +`include(Logger.uci) +`include(Constants.uci) diff --git a/YAS/Logger.uci b/YAS/Logger.uci index 5e94290..75aef65 100644 --- a/YAS/Logger.uci +++ b/YAS/Logger.uci @@ -1,9 +1,15 @@ -`define scelog(text, cond) `log(`text, `cond, 'YetAnotherScoreboard') - -`define info(text) `scelog("[INFO]"@`text, true) -`define warning(text) `scelog("[WARNING]"@`text, true) -`define error(text) `scelog("[ERROR]"@`text, true) - -`define debug(text) if (`bEnableDebug) { `scelog("[DEBUG]"@`text, `bEnableDebug); } -`define callstack() if (`bEnableCallstack) { `scelog("[CALLSTACK]"@`Location, `bEnableCallstack); } -`define callstack_static(text) if (`bEnableCallstack) { `scelog("[CALLSTACK]"@`text, `bEnableCallstack); } \ No newline at end of file +// Logger +`define Log_Tag 'YAS' + +`define LocationStatic "`{ClassName}::" $ GetFuncName() + +`define Log_Base(msg, cond) `log(`msg `if(`cond), `cond`{endif}, `Log_Tag) + +`define Log_Fatal(msg) `log("FATAL:" @ `msg, (LogLevel >= LL_Fatal), `Log_Tag) +`define Log_Error(msg) `log("ERROR:" @ `msg, (LogLevel >= LL_Error), `Log_Tag) +`define Log_Warn(msg) `log("WARN:" @ `msg, (LogLevel >= LL_Warning), `Log_Tag) +`define Log_Info(msg) `log("INFO:" @ `msg, (LogLevel >= LL_Info), `Log_Tag) +`define Log_Debug(msg) `log("DEBUG:" @ `msg, (LogLevel >= LL_Debug), `Log_Tag) + +`define Log_Trace(msg) `log("TRACE:" @ `Location `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag) +`define Log_TraceStatic(msg) `log("TRACE:" @ `LocationStatic `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag)