From 9dd37033fcb75679c9780e0e1c757ace9bd1fea7 Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Sat, 3 Sep 2022 13:05:39 +0300 Subject: [PATCH] wip --- YAS/Classes/CustomRanks.uc | 2 +- YAS/Classes/KFScoreBoard.uc | 121 ++++++------------------- YAS/Classes/PlayerRankRelations.uc | 2 +- YAS/Classes/SettingsArmor.uc | 2 +- YAS/Classes/SettingsHealth.uc | 2 +- YAS/Classes/SettingsLevel.uc | 2 +- YAS/Classes/SettingsPing.uc | 2 +- YAS/Classes/SteamGroupRankRelations.uc | 2 +- YAS/Classes/SystemAdminRank.uc | 2 +- YAS/Classes/SystemPlayerRank.uc | 2 +- YAS/Classes/Types.uc | 22 ++--- YAS/Classes/YASMut.uc | 100 +++++++------------- 12 files changed, 79 insertions(+), 182 deletions(-) diff --git a/YAS/Classes/CustomRanks.uc b/YAS/Classes/CustomRanks.uc index 0b645b7..c422b47 100644 --- a/YAS/Classes/CustomRanks.uc +++ b/YAS/Classes/CustomRanks.uc @@ -41,7 +41,7 @@ public static function InitConfig(int ConfigVersion) } } -DefaultProperties +defaultproperties { } \ No newline at end of file diff --git a/YAS/Classes/KFScoreBoard.uc b/YAS/Classes/KFScoreBoard.uc index 66c7b72..70ae5a5 100644 --- a/YAS/Classes/KFScoreBoard.uc +++ b/YAS/Classes/KFScoreBoard.uc @@ -4,8 +4,8 @@ class KFScoreBoard extends KFGUI_Page `include(Build.uci) `include(Logger.uci) -var transient float HealthXPos, ArmorXPos, RankXPos, PlayerXPos, LevelXPos, PerkXPos, DoshXPos, KillsXPos, AssistXPos, PingXPos, ScrollXPos; -var transient float HealthWBox, ArmorWBox, RankWBox, PlayerWBox, LevelWBox, PerkWBox, DoshWBox, KillsWBox, AssistWBox, PingWBox, ScrollWBox; +var transient float HealthXPos, RankXPos, PlayerXPos, LevelXPos, PerkXPos, DoshXPos, KillsXPos, AssistXPos, PingXPos, ScrollXPos; +var transient float HealthWBox, RankWBox, PlayerWBox, LevelWBox, PerkWBox, DoshWBox, KillsWBox, AssistWBox, PingWBox, ScrollWBox; var transient float NextScoreboardRefresh; var transient int NumPlayer; @@ -136,6 +136,22 @@ function string WaveText() } } +function String ServerName() +{ + local KFOnlineGameSettings KFGS; + local KFGameInfo KFGI; + + KFGI = KFGameInfo(KFGRI.WorldInfo.Game); + + if (KFGI != None && KFGI.PlayfabInter != None && KFGI.PlayfabInter.GetGameSettings() != None) + { + KFGS = KFOnlineGameSettings(KFGI.PlayfabInter.GetGameSettings()); + return KFGS.OwningPlayerName; + } + + return KFGRI.ServerName; +} + function DrawMenu() { local string S; @@ -224,7 +240,7 @@ function DrawMenu() Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, BoxH, Settings.Style.EdgeSize, Settings.Style.ShapeServerNameBox); SetDrawColor(Canvas, Settings.Style.ServerNameTextColor); - S = KFGRI.ServerName; + S = ServerName(); DrawTextShadowHVCenter(S, BoxX, YPos, BoxW, FontScalar); YPos += BoxH; @@ -305,11 +321,7 @@ function DrawMenu() } HealthWBox = (BoxW < MinBoxW ? MinBoxW : BoxW) * 0.5 + BorderSize * 2; - // Armor - ArmorXPos = HealthXPos + HealthWBox; - ArmorWBox = HealthWBox; - - RankXPos = ArmorXPos + ArmorWBox + Settings.Style.EdgeSize; + RankXPos = HealthXPos + HealthWBox + Settings.Style.EdgeSize; PlayerXPos = Width * 0.30; // TODO @@ -362,8 +374,7 @@ function DrawMenu() SetDrawColor(Canvas, ColorTmp); DrawHealthIcon(XPos + HealthXPos, YPos, HealthWBox, BoxH); - DrawArmorIcon(XPos + ArmorXPos, YPos, ArmorWBox, BoxH); - + PlayersList.XPosition = ((Canvas.ClipX - Width) * 0.5) / InputPos[2]; PlayersList.YPosition = (YPos + YL + BorderSize * 4) / InputPos[3]; PlayersList.YSize = (1.f - PlayersList.YPosition) - 0.15; @@ -391,19 +402,6 @@ function DrawHealthIcon(float X, float Y, float W, float H) Owner.CurrentStyle.DrawRectBox(XPos, YPos, Part, Part, 4, 100); } -function DrawArmorIcon(float X, float Y, float W, float H) -{ - local float XPos, YPos, Size; - local int Edge; - - Edge = 6; - Size = H * 0.65; - - XPos = X + (W * 0.5 - Size * 0.5); - YPos = Y + (H * 0.5 - Size * 0.5); - Owner.CurrentStyle.DrawRectBox(XPos, YPos, Size, Size, Edge, 252); -} - function DrawTextShadowHVCenter(string Str, float XPos, float YPos, float BoxWidth, float FontScalar) { local float TextWidth; @@ -440,8 +438,6 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float local float FontScalar, TextYOffset, XL, YL, PerkIconPosX, PerkIconPosY, PerkIconSize, PrestigeIconScale; local float XPos, BoxWidth, RealPlayerWBox; local KFPlayerReplicationInfo KFPRI; - local KFPlayerController KFPC; - local KFPawn_Human KFPH; local byte Level, PrestigeLevel; local bool bIsZED; local int Ping; @@ -451,12 +447,10 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float local int PlayerInfoIndex, PlayerRankIndex; local float BorderSize; - local int Shape, ShapeHealth, ShapeArmor; - local int Health, MaxHealth; - local int Armor, MaxArmor; - local string TextHealth, TextArmor, TextState; + local int Shape, ShapeHealth; + local string TextHealth, TextState; - local ColorRGBA HealthBoxColor, ArmorBoxColor, HealthTextColor, ArmorTextColor; + local ColorRGBA HealthBoxColor, HealthTextColor; BorderSize = Owner.HUDOwner.ScaledBorderSize; @@ -510,25 +504,20 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float if (KFPRIArray.Length > 1 && Index == 0) { ShapeHealth = Settings.Style.ShapeStateHealthBoxTopPlayer; - ShapeArmor = Settings.Style.ShapeStateArmorBoxTopPlayer; } else if (KFPRIArray.Length > 1 && Index == KFPRIArray.Length - 1) { ShapeHealth = Settings.Style.ShapeStateHealthBoxBottomPlayer; - ShapeArmor = Settings.Style.ShapeStateArmorBoxBottomPlayer; } else { ShapeHealth = Settings.Style.ShapeStateHealthBoxMidPlayer; - ShapeArmor = Settings.Style.ShapeStateArmorBoxMidPlayer; } if (!KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun) { HealthBoxColor = Settings.Style.StateBoxColorLobby; - ArmorBoxColor = Settings.Style.StateBoxColorLobby; HealthTextColor = Settings.Style.StateTextColorLobby; - ArmorTextColor = Settings.Style.StateTextColorLobby; TextState = class'KFGFxMenu_ServerBrowser'.default.InLobbyString;; } else if (!KFGRI.bMatchHasBegun) @@ -536,26 +525,20 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float if (KFPRI.bReadyToPlay) { HealthBoxColor = Settings.Style.StateBoxColorReady; - ArmorBoxColor = Settings.Style.StateBoxColorReady; HealthTextColor = Settings.Style.StateBoxColorReady; - ArmorTextColor = Settings.Style.StateBoxColorReady; TextState = Ready; } else { HealthBoxColor = Settings.Style.StateBoxColorNotReady; - ArmorBoxColor = Settings.Style.StateBoxColorNotReady; HealthTextColor = Settings.Style.StateBoxColorNotReady; - ArmorTextColor = Settings.Style.StateBoxColorNotReady; TextState = NotReady; } } else if (bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None) { HealthBoxColor = Settings.Style.StateTextColorNone; - ArmorBoxColor = Settings.Style.StateTextColorNone; HealthTextColor = Settings.Style.StateTextColorNone; - ArmorTextColor = Settings.Style.StateTextColorNone; TextState = Unknown; } else if (KFPRI.PlayerHealth <= 0 || KFPRI.PlayerHealthPercent <= 0) @@ -563,17 +546,13 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float if (KFPRI.bOnlySpectator) { HealthBoxColor = Settings.Style.StateTextColorSpectator; - ArmorBoxColor = Settings.Style.StateTextColorSpectator; HealthTextColor = Settings.Style.StateTextColorSpectator; - ArmorTextColor = Settings.Style.StateTextColorSpectator; TextState = class'KFCommon_LocalizedStrings'.default.SpectatorString; } else { HealthBoxColor = Settings.Style.StateTextColorDead; - ArmorBoxColor = Settings.Style.StateTextColorDead; HealthTextColor = Settings.Style.StateTextColorDead; - ArmorTextColor = Settings.Style.StateTextColorDead; TextState = Dead; } } @@ -595,36 +574,6 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float HealthTextColor = Settings.Style.StateTextColorHealthLow; } TextHealth = String(KFPRI.PlayerHealth); - - KFPC = KFPlayerController(KFPRI.Owner); - if (KFPC != None) - { - KFPH = KFPawn_Human(KFPC.Pawn); - if (KFPH != None) - { - TextArmor = String(KFPH.Armor); - if (ByteToFloat(KFPH.Armor / KFPH.MaxArmor) >= float(Settings.Armor.High) / 100.0) - { - ArmorBoxColor = Settings.Style.StateBoxColorArmorHigh; - ArmorTextColor = Settings.Style.StateTextColorArmorHigh; - } - else if (ByteToFloat(KFPH.Armor / KFPH.MaxArmor) >= float(Settings.Armor.Low) / 100.0) - { - ArmorBoxColor = Settings.Style.StateBoxColorArmorMid; - ArmorTextColor = Settings.Style.StateTextColorArmorMid; - } - else if (KFPH.Armor > 0) - { - ArmorBoxColor = Settings.Style.StateBoxColorArmorLow; - ArmorTextColor = Settings.Style.StateTextColorArmorLow; - } - else - { - ArmorBoxColor = Settings.Style.StateBoxColorArmorNone; - ArmorTextColor = Settings.Style.StateTextColorArmorNone; - } - } - } } // Health box @@ -635,15 +584,6 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float Height, Settings.Style.EdgeSize, ShapeHealth); - - // Armor box - SetDrawColor(C, ArmorBoxColor); - Owner.CurrentStyle.DrawRectBox(XPos + ArmorWBox, - YOffset, - ArmorWBox, - Height, - Settings.Style.EdgeSize, - ShapeArmor); if (TextState != "") { @@ -651,9 +591,9 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float if (CurrentRank.ApplyColorToFields.Health) SetDrawColor(C, CurrentRank.TextColor); - DrawTextShadowHVCenter(TextState, HealthXPos, TextYOffset, HealthWBox + ArmorWBox, FontScalar); + DrawTextShadowHVCenter(TextState, HealthXPos, TextYOffset, HealthWBox, FontScalar); - XPos += (HealthWBox + ArmorWBox); + XPos += HealthWBox; } else { @@ -663,13 +603,6 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float SetDrawColor(C, HealthTextColor); DrawTextShadowHVCenter(TextHealth, HealthXPos, TextYOffset, HealthWBox, FontScalar); XPos += HealthWBox; - - if (CurrentRank.ApplyColorToFields.Armor) - SetDrawColor(C, CurrentRank.TextColor); - else - SetDrawColor(C, ArmorTextColor); - DrawTextShadowHVCenter(TextArmor, ArmorXPos, TextYOffset, HealthWBox, FontScalar); - XPos += ArmorWBox; } // PlayerBox @@ -685,7 +618,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float else Shape = Settings.Style.ShapePlayerBoxMidPlayer; - BoxWidth = DoshXPos - (HealthWBox + ArmorWBox) - BorderSize * 2; + BoxWidth = DoshXPos - HealthWBox - BorderSize * 2; Owner.CurrentStyle.DrawRectBox(XPos, YOffset, BoxWidth, Height, Settings.Style.EdgeSize, Shape); XPos += BoxWidth; diff --git a/YAS/Classes/PlayerRankRelations.uc b/YAS/Classes/PlayerRankRelations.uc index 2b7bf50..91f50d8 100644 --- a/YAS/Classes/PlayerRankRelations.uc +++ b/YAS/Classes/PlayerRankRelations.uc @@ -26,7 +26,7 @@ public static function InitConfig(int ConfigVersion) } } -DefaultProperties +defaultproperties { } \ No newline at end of file diff --git a/YAS/Classes/SettingsArmor.uc b/YAS/Classes/SettingsArmor.uc index e1fd454..3ff2808 100644 --- a/YAS/Classes/SettingsArmor.uc +++ b/YAS/Classes/SettingsArmor.uc @@ -52,7 +52,7 @@ public static function WriteSettings(YASSettingsArmor Settings) default.High = Settings.High; } -DefaultProperties +defaultproperties { } \ No newline at end of file diff --git a/YAS/Classes/SettingsHealth.uc b/YAS/Classes/SettingsHealth.uc index e4418df..562b7dc 100644 --- a/YAS/Classes/SettingsHealth.uc +++ b/YAS/Classes/SettingsHealth.uc @@ -52,7 +52,7 @@ public static function WriteSettings(YASSettingsHealth Settings) default.High = Settings.High; } -DefaultProperties +defaultproperties { } \ No newline at end of file diff --git a/YAS/Classes/SettingsLevel.uc b/YAS/Classes/SettingsLevel.uc index 02cad51..fae9cd4 100644 --- a/YAS/Classes/SettingsLevel.uc +++ b/YAS/Classes/SettingsLevel.uc @@ -70,7 +70,7 @@ public static function WriteSettings(YASSettingsLevel Settings) default.HellOnEarth_High = Settings.High[3]; } -DefaultProperties +defaultproperties { } \ No newline at end of file diff --git a/YAS/Classes/SettingsPing.uc b/YAS/Classes/SettingsPing.uc index 31356d9..774d6c1 100644 --- a/YAS/Classes/SettingsPing.uc +++ b/YAS/Classes/SettingsPing.uc @@ -52,7 +52,7 @@ public static function WriteSettings(YASSettingsPing Settings) default.High = Settings.High; } -DefaultProperties +defaultproperties { } \ No newline at end of file diff --git a/YAS/Classes/SteamGroupRankRelations.uc b/YAS/Classes/SteamGroupRankRelations.uc index ae656ea..918e15f 100644 --- a/YAS/Classes/SteamGroupRankRelations.uc +++ b/YAS/Classes/SteamGroupRankRelations.uc @@ -26,7 +26,7 @@ public static function InitConfig(int ConfigVersion) } } -DefaultProperties +defaultproperties { } \ No newline at end of file diff --git a/YAS/Classes/SystemAdminRank.uc b/YAS/Classes/SystemAdminRank.uc index 99ca4ae..7926a25 100644 --- a/YAS/Classes/SystemAdminRank.uc +++ b/YAS/Classes/SystemAdminRank.uc @@ -56,7 +56,7 @@ public static function WriteSettings(YASSettingsAdmin Settings) default.ApplyColorToFields = Settings.ApplyColorToFields; } -DefaultProperties +defaultproperties { } \ No newline at end of file diff --git a/YAS/Classes/SystemPlayerRank.uc b/YAS/Classes/SystemPlayerRank.uc index d27d468..2a6c1e4 100644 --- a/YAS/Classes/SystemPlayerRank.uc +++ b/YAS/Classes/SystemPlayerRank.uc @@ -56,7 +56,7 @@ public static function WriteSettings(YASSettingsPlayer Settings) default.ApplyColorToFields = Settings.ApplyColorToFields; } -DefaultProperties +defaultproperties { } \ No newline at end of file diff --git a/YAS/Classes/Types.uc b/YAS/Classes/Types.uc index 92d9889..502117f 100644 --- a/YAS/Classes/Types.uc +++ b/YAS/Classes/Types.uc @@ -7,7 +7,7 @@ struct ColorRGBA { var byte R, G, B, A; - StructDefaultProperties + Structdefaultproperties { R = 250 G = 250 @@ -29,7 +29,7 @@ struct Fields var bool Armor; var bool Ping; - StructDefaultProperties + Structdefaultproperties { Rank = true; Player = true; @@ -58,7 +58,7 @@ struct RankRelation var string ObjectID; var int RankID; - StructDefaultProperties + Structdefaultproperties { RankID = -999 } @@ -69,7 +69,7 @@ struct UIDRankRelation var UniqueNetId UID; var int RankID; - StructDefaultProperties + Structdefaultproperties { RankID = -999 } @@ -81,7 +81,7 @@ struct YASSettingsAdmin var ColorRGBA TextColor; var Fields ApplyColorToFields; - StructDefaultProperties + Structdefaultproperties { Rank = "Admin" TextColor = (R=250, G=0, B=0, A=255) @@ -95,7 +95,7 @@ struct YASSettingsPlayer var ColorRGBA TextColor; var Fields ApplyColorToFields; - StructDefaultProperties + Structdefaultproperties { Rank = "Player" TextColor = (R=250, G=250, B=250, A=255) @@ -108,7 +108,7 @@ struct YASSettingsHealth var int Low; var int High; - StructDefaultProperties + Structdefaultproperties { Low = 40 High = 80 @@ -120,7 +120,7 @@ struct YASSettingsArmor var int Low; var int High; - StructDefaultProperties + Structdefaultproperties { Low = 40 High = 80 @@ -132,7 +132,7 @@ struct YASSettingsPing var int Low; var int High; - StructDefaultProperties + Structdefaultproperties { Low = 60 High = 120 @@ -144,7 +144,7 @@ struct YASSettingsLevel var int Low [4]; var int High[4]; - StructDefaultProperties + Structdefaultproperties { Low [0] = 0 High[0] = 0 @@ -295,7 +295,7 @@ struct YASStyle var bool AssistsTextSmoothColorChange; var bool PingTextSmoothColorChange; - StructDefaultProperties + Structdefaultproperties { EdgeSize = 8 diff --git a/YAS/Classes/YASMut.uc b/YAS/Classes/YASMut.uc index 01b2643..c10f3fc 100644 --- a/YAS/Classes/YASMut.uc +++ b/YAS/Classes/YASMut.uc @@ -11,13 +11,7 @@ var config int ConfigVersion; var private OnlineSubsystem Steamworks; -struct SClient -{ - var YASRepInfo RepInfo; - var KFPlayerController KFPC; -}; - -var private array RepClients; +var private array RepInfos; var private array UIDRankRelationsPlayers; var private array UIDRankRelationsSteamGroups; var private array UIDRankRelationsActive; @@ -49,7 +43,8 @@ function NotifyLogin(Controller C) { `callstack(); - AddPlayer(C); + CreateRepInfo(C); + Super.NotifyLogin(C); } @@ -57,7 +52,8 @@ function NotifyLogout(Controller C) { `callstack(); - RemovePlayer(C); + DestroyRepInfo(C); + Super.NotifyLogout(C); } @@ -151,75 +147,43 @@ private function LoadRelations() } } -private function AddPlayer(Controller C) +private function CreateRepInfo(Controller C) { - local KFPlayerController KFPC; - local UIDRankRelation Relation; - local SClient RepClient, RepClientNew; + local YASRepInfo RepInfo; `callstack(); - KFPC = KFPlayerController(C); - if (KFPC == None) - return; + if (C == None) return; + + RepInfo = Spawn(class'YASRepInfo', C); + + RepInfo.Mut = Self; + RepInfo.Settings = Settings; - RepClientNew.KFPC = KFPC; - RepClientNew.RepInfo = Spawn(class'YASRepInfo', KFPC); - - RepClientNew.RepInfo.Mut = Self; - RepClientNew.RepInfo.CustomRanks = class'CustomRanks'.default.Rank; - RepClientNew.RepInfo.SteamGroupRelations = UIDRankRelationsSteamGroups; - RepClientNew.RepInfo.Settings = Settings; - RepClientNew.RepInfo.RankRelation.UID = KFPC.PlayerReplicationInfo.UniqueId; - RepClientNew.RepInfo.RankRelation.RankID = UIDRankRelationsPlayers.Find('UID', RepClientNew.RepInfo.RankRelation.UID); - - RepClients.AddItem(RepClientNew); - - foreach UIDRankRelationsActive(Relation) - RepClientNew.RepInfo.AddRankRelation(Relation); - - RepClientNew.RepInfo.StartFirstTimeReplication(); - - if (RepClientNew.RepInfo.RankRelation.RankID != INDEX_NONE) - { - UIDRankRelationsActive.AddItem(RepClientNew.RepInfo.RankRelation); - foreach RepClients(RepClient) - RepClient.RepInfo.AddRankRelation(RepClientNew.RepInfo.RankRelation); - } + RepInfos.AddItem(RepInfo); } -private function RemovePlayer(Controller C) +private function DestroyRepInfo(Controller C) { - local KFPlayerController KFPC; - local int Index, i; - local UniqueNetId UID; + local YASRepInfo RepInfo; `callstack(); - KFPC = KFPlayerController(C); - if (KFPC == None) - return; + if (C == None) return; - UID = KFPC.PlayerReplicationInfo.UniqueId; - Index = UIDRankRelationsActive.Find('UID', UID); - if (Index != INDEX_NONE) - for (i = 0; i < UIDRankRelationsActive.Length; ++i) - if (Index != i) - RepClients[i].RepInfo.RemoveRankRelation(UIDRankRelationsActive[Index]); - - Index = RepClients.Find('KFPC', KFPC); - if (Index == INDEX_NONE) - return; - - if (RepClients[Index].RepInfo != None) - RepClients[Index].RepInfo.Destroy(); - - RepClients.Remove(Index, 1); + foreach RepInfos(RepInfo) + { + if (RepInfo.Owner == C) + { + RepInfos.RemoveItem(RepInfo); + RepInfo.Destroy(); + } + } } public function UpdatePlayerRank(UIDRankRelation Rel) { - local SClient RepClient; + local YASRepInfo RepInfo; local int Index; `callstack(); @@ -230,21 +194,21 @@ public function UpdatePlayerRank(UIDRankRelation Rel) else UIDRankRelationsActive.AddItem(Rel); - foreach RepClients(RepClient) - RepClient.RepInfo.UpdateRankRelation(Rel); + foreach RepInfos(RepInfo) + RepInfo.UpdateRankRelation(Rel); } public function AddPlayerRank(UIDRankRelation Rel) { - local SClient RepClient; + local YASRepInfo RepInfo; `callstack(); - foreach RepClients(RepClient) - RepClient.RepInfo.AddRankRelation(Rel); + foreach RepInfos(RepInfo) + RepInfo.AddRankRelation(Rel); } -DefaultProperties +defaultproperties { } \ No newline at end of file