health and armor

This commit is contained in:
GenZmeY 2021-07-11 22:36:55 +03:00
parent 2d6e6aa743
commit e8cdfe11f4
3 changed files with 121 additions and 45 deletions

View File

@ -449,9 +449,12 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
local RankInfo CurrentRank; local RankInfo CurrentRank;
local bool HasRank; local bool HasRank;
local int PlayerInfoIndex, PlayerRankIndex; local int PlayerInfoIndex, PlayerRankIndex;
local int Shape;
local float BorderSize; local float BorderSize;
local int Shape, ShapeHealth, ShapeArmor;
local int Health, MaxHealth;
local int Armor, MaxArmor; local int Armor, MaxArmor;
local string TextHealth, TextArmor, TextState;
local ColorRGBA HealthBoxColor, ArmorBoxColor, HealthTextColor, ArmorTextColor; local ColorRGBA HealthBoxColor, ArmorBoxColor, HealthTextColor, ArmorTextColor;
@ -505,11 +508,20 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
TextYOffset = YOffset + (Height * 0.5f) - (YL * 0.5f); TextYOffset = YOffset + (Height * 0.5f) - (YL * 0.5f);
if (KFPRIArray.Length > 1 && Index == 0) if (KFPRIArray.Length > 1 && Index == 0)
Shape = Settings.Style.ShapeStateHealthBoxTopPlayer; {
ShapeHealth = Settings.Style.ShapeStateHealthBoxTopPlayer;
ShapeArmor = Settings.Style.ShapeStateArmorBoxTopPlayer;
}
else if (KFPRIArray.Length > 1 && Index == KFPRIArray.Length - 1) else if (KFPRIArray.Length > 1 && Index == KFPRIArray.Length - 1)
Shape = Settings.Style.ShapeStateHealthBoxBottomPlayer; {
ShapeHealth = Settings.Style.ShapeStateHealthBoxBottomPlayer;
ShapeArmor = Settings.Style.ShapeStateArmorBoxBottomPlayer;
}
else else
Shape = Settings.Style.ShapeStateHealthBoxMidPlayer; {
ShapeHealth = Settings.Style.ShapeStateHealthBoxMidPlayer;
ShapeArmor = Settings.Style.ShapeStateArmorBoxMidPlayer;
}
if (!KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun) if (!KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun)
{ {
@ -517,7 +529,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
ArmorBoxColor = Settings.Style.StateBoxColorLobby; ArmorBoxColor = Settings.Style.StateBoxColorLobby;
HealthTextColor = Settings.Style.StateTextColorLobby; HealthTextColor = Settings.Style.StateTextColorLobby;
ArmorTextColor = Settings.Style.StateTextColorLobby; ArmorTextColor = Settings.Style.StateTextColorLobby;
S = class'KFGFxMenu_ServerBrowser'.default.InLobbyString;; TextState = class'KFGFxMenu_ServerBrowser'.default.InLobbyString;;
} }
else if (!KFGRI.bMatchHasBegun) else if (!KFGRI.bMatchHasBegun)
{ {
@ -527,7 +539,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
ArmorBoxColor = Settings.Style.StateBoxColorReady; ArmorBoxColor = Settings.Style.StateBoxColorReady;
HealthTextColor = Settings.Style.StateBoxColorReady; HealthTextColor = Settings.Style.StateBoxColorReady;
ArmorTextColor = Settings.Style.StateBoxColorReady; ArmorTextColor = Settings.Style.StateBoxColorReady;
S = Ready; TextState = Ready;
} }
else else
{ {
@ -535,7 +547,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
ArmorBoxColor = Settings.Style.StateBoxColorNotReady; ArmorBoxColor = Settings.Style.StateBoxColorNotReady;
HealthTextColor = Settings.Style.StateBoxColorNotReady; HealthTextColor = Settings.Style.StateBoxColorNotReady;
ArmorTextColor = Settings.Style.StateBoxColorNotReady; ArmorTextColor = Settings.Style.StateBoxColorNotReady;
S = NotReady; TextState = NotReady;
} }
} }
else if (bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None) else if (bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None)
@ -544,7 +556,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
ArmorBoxColor = Settings.Style.StateTextColorNone; ArmorBoxColor = Settings.Style.StateTextColorNone;
HealthTextColor = Settings.Style.StateTextColorNone; HealthTextColor = Settings.Style.StateTextColorNone;
ArmorTextColor = Settings.Style.StateTextColorNone; ArmorTextColor = Settings.Style.StateTextColorNone;
S = Unknown; TextState = Unknown;
} }
else if (KFPRI.PlayerHealth <= 0 || KFPRI.PlayerHealthPercent <= 0) else if (KFPRI.PlayerHealth <= 0 || KFPRI.PlayerHealthPercent <= 0)
{ {
@ -554,7 +566,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
ArmorBoxColor = Settings.Style.StateTextColorSpectator; ArmorBoxColor = Settings.Style.StateTextColorSpectator;
HealthTextColor = Settings.Style.StateTextColorSpectator; HealthTextColor = Settings.Style.StateTextColorSpectator;
ArmorTextColor = Settings.Style.StateTextColorSpectator; ArmorTextColor = Settings.Style.StateTextColorSpectator;
S = class'KFCommon_LocalizedStrings'.default.SpectatorString; TextState = class'KFCommon_LocalizedStrings'.default.SpectatorString;
} }
else else
{ {
@ -562,42 +574,27 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
ArmorBoxColor = Settings.Style.StateTextColorDead; ArmorBoxColor = Settings.Style.StateTextColorDead;
HealthTextColor = Settings.Style.StateTextColorDead; HealthTextColor = Settings.Style.StateTextColorDead;
ArmorTextColor = Settings.Style.StateTextColorDead; ArmorTextColor = Settings.Style.StateTextColorDead;
S = Dead; TextState = Dead;
} }
// Health
Owner.CurrentStyle.DrawRectBox(XPos,
YOffset,
HealthWBox,
Height,
Settings.Style.EdgeSize,
Shape);
} }
else else
{ {
if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.Health.High) / 100.0) if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.Health.High) / 100.0)
SetDrawColor(C, Settings.Style.StateTextColorHealthHigh); {
else if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.Health.Low) / 100.0) HealthBoxColor = Settings.Style.StateBoxColorHealthHigh;
SetDrawColor(C, Settings.Style.StateTextColorHealthMid); HealthTextColor = Settings.Style.StateTextColorHealthHigh;
else
SetDrawColor(C, Settings.Style.StateTextColorHealthLow);
S = String(KFPRI.PlayerHealth);
} }
else if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.Health.Low) / 100.0)
if (CurrentRank.ApplyColorToFields.Health) {
SetDrawColor(C, CurrentRank.TextColor); HealthBoxColor = Settings.Style.StateBoxColorHealthMid;
DrawTextShadowHVCenter(S, HealthXPos, TextYOffset, HealthWBox, FontScalar); HealthTextColor = Settings.Style.StateTextColorHealthMid;
}
XPos += HealthWBox; else
{
// Armor HealthBoxColor = Settings.Style.StateBoxColorHealthLow;
C.SetDrawColor(0, 0, 200, 200); HealthTextColor = Settings.Style.StateTextColorHealthLow;
Owner.CurrentStyle.DrawRectBox(XPos, }
YOffset, TextHealth = String(KFPRI.PlayerHealth);
ArmorWBox,
Height,
Settings.Style.EdgeSize,
Shape);
KFPC = KFPlayerController(KFPRI.Owner); KFPC = KFPlayerController(KFPRI.Owner);
if (KFPC != None) if (KFPC != None)
@ -605,14 +602,75 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
KFPH = KFPawn_Human(KFPC.Pawn); KFPH = KFPawn_Human(KFPC.Pawn);
if (KFPH != None) if (KFPH != None)
{ {
Armor = int(KFPH.Armor); TextArmor = String(KFPH.Armor);
MaxArmor = int(KFPH.MaxArmor); 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;
} }
} }
C.SetDrawColor(250, 250, 250, 250); }
S = String(Armor); }
DrawTextShadowHVCenter(S, ArmorXPos, TextYOffset, HealthWBox, FontScalar);
// Health box
SetDrawColor(C, HealthBoxColor);
Owner.CurrentStyle.DrawRectBox(XPos,
YOffset,
HealthWBox,
Height,
Settings.Style.EdgeSize,
ShapeHealth);
// Armor box
SetDrawColor(C, ArmorBoxColor);
Owner.CurrentStyle.DrawRectBox(XPos + ArmorWBox,
YOffset,
ArmorWBox,
Height,
Settings.Style.EdgeSize,
ShapeArmor);
if (TextState != "")
{
SetDrawColor(C, HealthTextColor);
if (CurrentRank.ApplyColorToFields.Health)
SetDrawColor(C, CurrentRank.TextColor);
DrawTextShadowHVCenter(TextState, HealthXPos, TextYOffset, HealthWBox + ArmorWBox, FontScalar);
XPos += (HealthWBox + ArmorWBox);
}
else
{
if (CurrentRank.ApplyColorToFields.Health)
SetDrawColor(C, CurrentRank.TextColor);
else
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; XPos += ArmorWBox;
}
// PlayerBox // PlayerBox
if (PlayerIndex == Index) if (PlayerIndex == Index)
@ -761,11 +819,15 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
// Kill // Kill
if (CurrentRank.ApplyColorToFields.Kills) if (CurrentRank.ApplyColorToFields.Kills)
SetDrawColor(C, CurrentRank.TextColor); SetDrawColor(C, CurrentRank.TextColor);
else
SetDrawColor(C, Settings.Style.KillsTextColorMid); // TODO
DrawTextShadowHVCenter(string (KFPRI.Kills), KillsXPos, TextYOffset, KillsWBox, FontScalar); DrawTextShadowHVCenter(string (KFPRI.Kills), KillsXPos, TextYOffset, KillsWBox, FontScalar);
// Assist // Assist
if (CurrentRank.ApplyColorToFields.Assists) if (CurrentRank.ApplyColorToFields.Assists)
SetDrawColor(C, CurrentRank.TextColor); SetDrawColor(C, CurrentRank.TextColor);
else
SetDrawColor(C, Settings.Style.AssistsTextColorMid); // TODO
DrawTextShadowHVCenter(string (KFPRI.Assists), AssistXPos, TextYOffset, AssistWBox, FontScalar); DrawTextShadowHVCenter(string (KFPRI.Assists), AssistXPos, TextYOffset, AssistWBox, FontScalar);
// Dosh // Dosh
@ -778,6 +840,8 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
{ {
if (CurrentRank.ApplyColorToFields.Dosh) if (CurrentRank.ApplyColorToFields.Dosh)
SetDrawColor(C, CurrentRank.TextColor); SetDrawColor(C, CurrentRank.TextColor);
else
SetDrawColor(C, Settings.Style.DoshTextColorMid); // TODO
StrValue = String(int(KFPRI.Score)); //StrValue = GetNiceSize(int(KFPRI.Score)); StrValue = String(int(KFPRI.Score)); //StrValue = GetNiceSize(int(KFPRI.Score));
} }
DrawTextShadowHVCenter(StrValue, DoshXPos, TextYOffset, DoshWBox, FontScalar); DrawTextShadowHVCenter(StrValue, DoshXPos, TextYOffset, DoshWBox, FontScalar);

View File

@ -58,6 +58,7 @@ var config ColorRGBA StateBoxColorHealthHigh;
var config ColorRGBA StateBoxColorArmorLow; var config ColorRGBA StateBoxColorArmorLow;
var config ColorRGBA StateBoxColorArmorMid; var config ColorRGBA StateBoxColorArmorMid;
var config ColorRGBA StateBoxColorArmorHigh; var config ColorRGBA StateBoxColorArmorHigh;
var config ColorRGBA StateBoxColorArmorNone;
// Player box // Player box
var config ColorRGBA PlayerOwnerBoxColor; var config ColorRGBA PlayerOwnerBoxColor;
@ -80,6 +81,7 @@ var config ColorRGBA StateTextColorHealthHigh;
var config ColorRGBA StateTextColorArmorLow; var config ColorRGBA StateTextColorArmorLow;
var config ColorRGBA StateTextColorArmorMid; var config ColorRGBA StateTextColorArmorMid;
var config ColorRGBA StateTextColorArmorHigh; var config ColorRGBA StateTextColorArmorHigh;
var config ColorRGBA StateTextColorArmorNone;
// Rank text // Rank text
var config ColorRGBA RankTextColor; var config ColorRGBA RankTextColor;
@ -187,6 +189,7 @@ public static function InitConfig(int ConfigVersion)
default.StateBoxColorArmorHigh = DefaultStyle.StateBoxColorArmorHigh; default.StateBoxColorArmorHigh = DefaultStyle.StateBoxColorArmorHigh;
default.StateBoxColorArmorLow = DefaultStyle.StateBoxColorArmorLow; default.StateBoxColorArmorLow = DefaultStyle.StateBoxColorArmorLow;
default.StateBoxColorArmorMid = DefaultStyle.StateBoxColorArmorMid; default.StateBoxColorArmorMid = DefaultStyle.StateBoxColorArmorMid;
default.StateBoxColorArmorNone = DefaultStyle.StateBoxColorArmorNone;
default.StateBoxColorDead = DefaultStyle.StateBoxColorDead; default.StateBoxColorDead = DefaultStyle.StateBoxColorDead;
default.StateBoxColorNone = DefaultStyle.StateBoxColorNone; default.StateBoxColorNone = DefaultStyle.StateBoxColorNone;
default.StateBoxColorHealthHigh = DefaultStyle.StateBoxColorHealthHigh; default.StateBoxColorHealthHigh = DefaultStyle.StateBoxColorHealthHigh;
@ -199,6 +202,7 @@ public static function InitConfig(int ConfigVersion)
default.StateTextColorArmorHigh = DefaultStyle.StateTextColorArmorHigh; default.StateTextColorArmorHigh = DefaultStyle.StateTextColorArmorHigh;
default.StateTextColorArmorLow = DefaultStyle.StateTextColorArmorLow; default.StateTextColorArmorLow = DefaultStyle.StateTextColorArmorLow;
default.StateTextColorArmorMid = DefaultStyle.StateTextColorArmorMid; default.StateTextColorArmorMid = DefaultStyle.StateTextColorArmorMid;
default.StateTextColorArmorNone = DefaultStyle.StateTextColorArmorNone;
default.StateTextColorNone = DefaultStyle.StateTextColorNone; default.StateTextColorNone = DefaultStyle.StateTextColorNone;
default.StateTextColorHealthHigh = DefaultStyle.StateTextColorHealthHigh; default.StateTextColorHealthHigh = DefaultStyle.StateTextColorHealthHigh;
default.StateTextColorHealthLow = DefaultStyle.StateTextColorHealthLow; default.StateTextColorHealthLow = DefaultStyle.StateTextColorHealthLow;
@ -287,6 +291,7 @@ public static function YASStyle Settings()
Settings.StateBoxColorArmorLow = default.StateBoxColorArmorLow; Settings.StateBoxColorArmorLow = default.StateBoxColorArmorLow;
Settings.StateBoxColorArmorMid = default.StateBoxColorArmorMid; Settings.StateBoxColorArmorMid = default.StateBoxColorArmorMid;
Settings.StateBoxColorArmorHigh = default.StateBoxColorArmorHigh; Settings.StateBoxColorArmorHigh = default.StateBoxColorArmorHigh;
Settings.StateBoxColorArmorNone = default.StateBoxColorArmorNone;
// Player box // Player box
Settings.PlayerOwnerBoxColor = default.PlayerOwnerBoxColor; Settings.PlayerOwnerBoxColor = default.PlayerOwnerBoxColor;
@ -309,6 +314,7 @@ public static function YASStyle Settings()
Settings.StateTextColorArmorLow = default.StateTextColorArmorLow; Settings.StateTextColorArmorLow = default.StateTextColorArmorLow;
Settings.StateTextColorArmorMid = default.StateTextColorArmorMid; Settings.StateTextColorArmorMid = default.StateTextColorArmorMid;
Settings.StateTextColorArmorHigh = default.StateTextColorArmorHigh; Settings.StateTextColorArmorHigh = default.StateTextColorArmorHigh;
Settings.StateTextColorArmorNone = default.StateTextColorArmorNone;
// Rank text // Rank text
Settings.RankTextColor = default.RankTextColor; Settings.RankTextColor = default.RankTextColor;
@ -428,6 +434,7 @@ public static function WriteSettings(YASStyle Settings)
default.StateBoxColorArmorLow = Settings.StateBoxColorArmorLow; default.StateBoxColorArmorLow = Settings.StateBoxColorArmorLow;
default.StateBoxColorArmorMid = Settings.StateBoxColorArmorMid; default.StateBoxColorArmorMid = Settings.StateBoxColorArmorMid;
default.StateBoxColorArmorHigh = Settings.StateBoxColorArmorHigh; default.StateBoxColorArmorHigh = Settings.StateBoxColorArmorHigh;
default.StateBoxColorArmorNone = Settings.StateBoxColorArmorNone;
// Player box // Player box
default.PlayerOwnerBoxColor = Settings.PlayerOwnerBoxColor; default.PlayerOwnerBoxColor = Settings.PlayerOwnerBoxColor;
@ -450,6 +457,7 @@ public static function WriteSettings(YASStyle Settings)
default.StateTextColorArmorLow = Settings.StateTextColorArmorLow; default.StateTextColorArmorLow = Settings.StateTextColorArmorLow;
default.StateTextColorArmorMid = Settings.StateTextColorArmorMid; default.StateTextColorArmorMid = Settings.StateTextColorArmorMid;
default.StateTextColorArmorHigh = Settings.StateTextColorArmorHigh; default.StateTextColorArmorHigh = Settings.StateTextColorArmorHigh;
default.StateTextColorArmorNone = Settings.StateTextColorArmorNone;
// Rank text // Rank text
default.RankTextColor = Settings.RankTextColor; default.RankTextColor = Settings.RankTextColor;

View File

@ -212,6 +212,7 @@ struct YASStyle
var ColorRGBA StateBoxColorArmorLow; var ColorRGBA StateBoxColorArmorLow;
var ColorRGBA StateBoxColorArmorMid; var ColorRGBA StateBoxColorArmorMid;
var ColorRGBA StateBoxColorArmorHigh; var ColorRGBA StateBoxColorArmorHigh;
var ColorRGBA StateBoxColorArmorNone;
// Player box // Player box
var ColorRGBA PlayerOwnerBoxColor; var ColorRGBA PlayerOwnerBoxColor;
@ -234,6 +235,7 @@ struct YASStyle
var ColorRGBA StateTextColorArmorLow; var ColorRGBA StateTextColorArmorLow;
var ColorRGBA StateTextColorArmorMid; var ColorRGBA StateTextColorArmorMid;
var ColorRGBA StateTextColorArmorHigh; var ColorRGBA StateTextColorArmorHigh;
var ColorRGBA StateTextColorArmorNone;
// Rank text // Rank text
var ColorRGBA RankTextColor; var ColorRGBA RankTextColor;
@ -349,6 +351,7 @@ struct YASStyle
StateBoxColorArmorLow = (R=0, G=0, B=150, A=150) StateBoxColorArmorLow = (R=0, G=0, B=150, A=150)
StateBoxColorArmorMid = (R=0, G=0, B=150, A=150) StateBoxColorArmorMid = (R=0, G=0, B=150, A=150)
StateBoxColorArmorHigh = (R=0, G=0, B=150, A=150) StateBoxColorArmorHigh = (R=0, G=0, B=150, A=150)
StateBoxColorArmorNone = (R=30, G=30, B=30, A=150)
// Player box // Player box
PlayerOwnerBoxColor = (R=100, G=10, B=10, A=150) PlayerOwnerBoxColor = (R=100, G=10, B=10, A=150)
@ -371,6 +374,7 @@ struct YASStyle
StateTextColorArmorLow = (R=250, G=250, B=250, A=255) StateTextColorArmorLow = (R=250, G=250, B=250, A=255)
StateTextColorArmorMid = (R=250, G=250, B=250, A=255) StateTextColorArmorMid = (R=250, G=250, B=250, A=255)
StateTextColorArmorHigh = (R=250, G=250, B=250, A=255) StateTextColorArmorHigh = (R=250, G=250, B=250, A=255)
StateTextColorArmorNone = (R=0, G=0, B=0 , A=0 )
// Rank text // Rank text
RankTextColor = (R=250, G=250, B=250, A=255) RankTextColor = (R=250, G=250, B=250, A=255)