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 bool HasRank;
local int PlayerInfoIndex, PlayerRankIndex;
local int Shape;
local float BorderSize;
local int Shape, ShapeHealth, ShapeArmor;
local int Health, MaxHealth;
local int Armor, MaxArmor;
local string TextHealth, TextArmor, TextState;
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);
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)
Shape = Settings.Style.ShapeStateHealthBoxBottomPlayer;
{
ShapeHealth = Settings.Style.ShapeStateHealthBoxBottomPlayer;
ShapeArmor = Settings.Style.ShapeStateArmorBoxBottomPlayer;
}
else
Shape = Settings.Style.ShapeStateHealthBoxMidPlayer;
{
ShapeHealth = Settings.Style.ShapeStateHealthBoxMidPlayer;
ShapeArmor = Settings.Style.ShapeStateArmorBoxMidPlayer;
}
if (!KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun)
{
@ -517,7 +529,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
ArmorBoxColor = Settings.Style.StateBoxColorLobby;
HealthTextColor = Settings.Style.StateTextColorLobby;
ArmorTextColor = Settings.Style.StateTextColorLobby;
S = class'KFGFxMenu_ServerBrowser'.default.InLobbyString;;
TextState = class'KFGFxMenu_ServerBrowser'.default.InLobbyString;;
}
else if (!KFGRI.bMatchHasBegun)
{
@ -527,7 +539,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
ArmorBoxColor = Settings.Style.StateBoxColorReady;
HealthTextColor = Settings.Style.StateBoxColorReady;
ArmorTextColor = Settings.Style.StateBoxColorReady;
S = Ready;
TextState = Ready;
}
else
{
@ -535,7 +547,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
ArmorBoxColor = Settings.Style.StateBoxColorNotReady;
HealthTextColor = Settings.Style.StateBoxColorNotReady;
ArmorTextColor = Settings.Style.StateBoxColorNotReady;
S = NotReady;
TextState = NotReady;
}
}
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;
HealthTextColor = Settings.Style.StateTextColorNone;
ArmorTextColor = Settings.Style.StateTextColorNone;
S = Unknown;
TextState = Unknown;
}
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;
HealthTextColor = Settings.Style.StateTextColorSpectator;
ArmorTextColor = Settings.Style.StateTextColorSpectator;
S = class'KFCommon_LocalizedStrings'.default.SpectatorString;
TextState = class'KFCommon_LocalizedStrings'.default.SpectatorString;
}
else
{
@ -562,57 +574,103 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
ArmorBoxColor = Settings.Style.StateTextColorDead;
HealthTextColor = Settings.Style.StateTextColorDead;
ArmorTextColor = Settings.Style.StateTextColorDead;
S = Dead;
TextState = Dead;
}
// Health
Owner.CurrentStyle.DrawRectBox(XPos,
YOffset,
HealthWBox,
Height,
Settings.Style.EdgeSize,
Shape);
}
else
{
if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.Health.High) / 100.0)
SetDrawColor(C, Settings.Style.StateTextColorHealthHigh);
{
HealthBoxColor = Settings.Style.StateBoxColorHealthHigh;
HealthTextColor = Settings.Style.StateTextColorHealthHigh;
}
else if (ByteToFloat(KFPRI.PlayerHealthPercent) >= float(Settings.Health.Low) / 100.0)
SetDrawColor(C, Settings.Style.StateTextColorHealthMid);
{
HealthBoxColor = Settings.Style.StateBoxColorHealthMid;
HealthTextColor = Settings.Style.StateTextColorHealthMid;
}
else
SetDrawColor(C, Settings.Style.StateTextColorHealthLow);
S = String(KFPRI.PlayerHealth);
{
HealthBoxColor = Settings.Style.StateBoxColorHealthLow;
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;
}
}
}
}
if (CurrentRank.ApplyColorToFields.Health)
SetDrawColor(C, CurrentRank.TextColor);
DrawTextShadowHVCenter(S, HealthXPos, TextYOffset, HealthWBox, FontScalar);
XPos += HealthWBox;
// Armor
C.SetDrawColor(0, 0, 200, 200);
// 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,
Shape);
KFPC = KFPlayerController(KFPRI.Owner);
if (KFPC != None)
ShapeArmor);
if (TextState != "")
{
KFPH = KFPawn_Human(KFPC.Pawn);
if (KFPH != None)
{
Armor = int(KFPH.Armor);
MaxArmor = int(KFPH.MaxArmor);
}
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;
}
C.SetDrawColor(250, 250, 250, 250);
S = String(Armor);
DrawTextShadowHVCenter(S, ArmorXPos, TextYOffset, HealthWBox, FontScalar);
XPos += ArmorWBox;
// PlayerBox
if (PlayerIndex == Index)
@ -761,11 +819,15 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
// Kill
if (CurrentRank.ApplyColorToFields.Kills)
SetDrawColor(C, CurrentRank.TextColor);
else
SetDrawColor(C, 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
DrawTextShadowHVCenter(string (KFPRI.Assists), AssistXPos, TextYOffset, AssistWBox, FontScalar);
// Dosh
@ -778,6 +840,8 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
{
if (CurrentRank.ApplyColorToFields.Dosh)
SetDrawColor(C, CurrentRank.TextColor);
else
SetDrawColor(C, Settings.Style.DoshTextColorMid); // TODO
StrValue = String(int(KFPRI.Score)); //StrValue = GetNiceSize(int(KFPRI.Score));
}
DrawTextShadowHVCenter(StrValue, DoshXPos, TextYOffset, DoshWBox, FontScalar);

View File

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

View File

@ -212,6 +212,7 @@ struct YASStyle
var ColorRGBA StateBoxColorArmorLow;
var ColorRGBA StateBoxColorArmorMid;
var ColorRGBA StateBoxColorArmorHigh;
var ColorRGBA StateBoxColorArmorNone;
// Player box
var ColorRGBA PlayerOwnerBoxColor;
@ -234,6 +235,7 @@ struct YASStyle
var ColorRGBA StateTextColorArmorLow;
var ColorRGBA StateTextColorArmorMid;
var ColorRGBA StateTextColorArmorHigh;
var ColorRGBA StateTextColorArmorNone;
// Rank text
var ColorRGBA RankTextColor;
@ -342,13 +344,14 @@ struct YASStyle
StateBoxColorNotReady = (R=150, G=150, B=150, A=150)
StateBoxColorSpectator = (R=150, G=150, B=150, A=150)
StateBoxColorDead = (R=200, G=0, B=0, A=150)
StateBoxColorNone = (R=150, G=150, B=150, A=150)
StateBoxColorNone = (R=150, G=150, B=150, A=150)
StateBoxColorHealthLow = (R=200, G=50, B=50, A=150)
StateBoxColorHealthMid = (R=200, G=200, B=0, A=150)
StateBoxColorHealthHigh = (R=0, G=200, B=0, A=150)
StateBoxColorArmorLow = (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)
StateBoxColorArmorNone = (R=30, G=30, B=30, A=150)
// Player box
PlayerOwnerBoxColor = (R=100, G=10, B=10, A=150)
@ -371,6 +374,7 @@ struct YASStyle
StateTextColorArmorLow = (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)
StateTextColorArmorNone = (R=0, G=0, B=0 , A=0 )
// Rank text
RankTextColor = (R=250, G=250, B=250, A=255)