draw bleed / poison icons for everyone

This commit is contained in:
Shtoyan 2022-01-23 17:26:23 +04:00
parent 6f460b93f2
commit 8847ec0449

View File

@ -12,10 +12,14 @@ var float size;
var float InventoryBoxWidth;
var float InventoryBoxHeight;
var float BorderSize;
event NotifyLevelChange(){
event NotifyLevelChange()
{
Master.RemoveInteraction(self);
}
function RegisterMutator(NicePack activePack){
function RegisterMutator(NicePack activePack)
{
NicePackMutator = activePack;
}
@ -58,10 +62,16 @@ function PostRender(Canvas C)
local NiceWeapon niceWeap;
local NicePlayerController nicePlayer;
local ScrnHUD scrnHUDInstance;
// TODO maybe use scrnhud?
local HUDKillingFloor kfHud;
local Texture barTexture;
local int x, y, center, barWidth, offset;
local int missesWidth, missesHeight, missesSpace;
local int missesX, missesY;
local Vector CamPos, ViewDir;
local Rotator CamRot;
local float OffsetX, BarLength, BarHeight, XL, YL, posY;
if(C == none) return;
if(C.ViewPort == none) return;
if(C.ViewPort.Actor == none) return;
@ -72,7 +82,7 @@ function PostRender(Canvas C)
return;
scrnHUDInstance = ScrnHUD(nicePlayer.myHUD);
//// Draw bleed and poison icons
//// Draw bleed and poison icons for OWNER
offset = 4;
// BLEED!!!
if (bIsBleeding(ScrnHumanPawn(C.ViewPort.Actor.Pawn)))
@ -92,8 +102,49 @@ function PostRender(Canvas C)
C.DrawTile(poisonIcon, size, size, 0, 0, poisonIcon.MaterialUSize(), poisonIcon.MaterialVSize());
}
// draw bleed and poison icons for TEAMMATES
C.GetCAmeraLocation(CamPos, CamRot);
ViewDir = vector(CamRot);
kfHud = HUDKillingFloor(ViewportOwner.Actor.myHUD);
OffsetX = (36.f * kfHud.default.VeterancyMatScaleFactor * 0.6) - (kfHud.default.HealthIconSize + 2.0);
BarLength = FMin(kfHud.default.BarLength * (float(C.SizeX) / 1024.f), kfHud.default.BarLength);
BarHeight = FMin(kfHud.default.BarHeight * (float(C.SizeX) / 1024.f), kfHud.default.BarHeight);
for (i = 0; i < kfHUD.PlayerInfoPawns.Length; i++)
{
if (kfHUD.PlayerInfoPawns[i].Pawn != none && kfHUD.PlayerInfoPawns[i].Pawn.Health > 0 &&
(kfHUD.PlayerInfoPawns[i].Pawn.Location - kfHUD.PawnOwner.Location) dot ViewDir > 0.8 &&
kfHUD.PlayerInfoPawns[i].RendTime > ViewportOwner.Actor.Level.TimeSeconds)
{
C.StrLen(Left(kfHUD.PlayerInfoPawns[i].Pawn.PlayerReplicationInfo.PlayerName, 16), XL, YL);
if (kfHUD.PlayerInfoPawns[i].Pawn.ShieldStrength <= 0)
{
posY = (kfHUD.PlayerInfoPawns[i].PlayerInfoScreenPosY - YL) - 2.75 * BarHeight -
kfHUD.default.ArmorIconSize * 0.5;
}
else
{
posY = (kfHUD.PlayerInfoPawns[i].PlayerInfoScreenPosY - YL) - 3.8 * BarHeight -
kfHUD.default.ArmorIconSize * 0.5;
}
offset = 0;
if(niceWeap != none && niceWeap.bShowSecondaryCharge && scrnHUDInstance != none){
if (bIsBleeding(ScrnHumanPawn(C.ViewPort.Actor.Pawn)))
{
C.SetPos(kfHUD.PlayerInfoPawns[i].PlayerInfoScreenPosX - OffsetX - 0.15 * BarLength -
kfHUD.default.ArmorIconSize - 2.0, posY);
C.DrawTileScaled(bleedIcon, 0.1875, 0.1875);
}
if (bIsPoisoned(ScrnHumanPawn(C.ViewPort.Actor.Pawn)))
{
C.SetPos(kfHUD.PlayerInfoPawns[i].PlayerInfoScreenPosX - OffsetX + 0.15 * BarLength -
kfHUD.default.ArmorIconSize - 2.0, posY);
C.DrawTileScaled(poisonIcon, 0.1875, 0.1875);
}
}
}
if (niceWeap != none && niceWeap.bShowSecondaryCharge && scrnHUDInstance != none)
{
C.ColorModulate.X = 1;
C.ColorModulate.Y = 1;
C.ColorModulate.Z = 1;
@ -104,11 +155,13 @@ function PostRender(Canvas C)
scrnHUDInstance.SecondaryClipsDigits.value = niceWeap.secondaryCharge;
scrnHUDInstance.DrawNumericWidget(C, scrnHUDInstance.SecondaryClipsDigits, scrnHUDInstance.DigitsSmall);
}
niceMutator = class'NicePack'.static.Myself(C.ViewPort.Actor.Pawn.Level);
if (niceMutator == none)
return;
//// Draw counters
if(nicePlayer != none && nicePlayer.bFlagDisplayCounters){
if(nicePlayer != none && nicePlayer.bFlagDisplayCounters)
{
x = C.ClipX * 0.5 - (64 + 2) * niceMutator.GetVisibleCountersAmount();
y = C.ClipY * 0.01;
for(i = 0;i < niceMutator.niceCounterSet.Length;i ++)
@ -118,7 +171,8 @@ function PostRender(Canvas C)
}
}
//// Draw weapons progress bars
if(nicePlayer != none && nicePlayer.bFlagDisplayWeaponProgress){
if(nicePlayer != none && nicePlayer.bFlagDisplayWeaponProgress)
{
x = C.ClipX - InventoryBoxWidth * C.ClipX - 5;
y = C.ClipY * 0.5 - 0.5 * (InventoryBoxHeight * C.ClipX + 4) * niceMutator.niceWeapProgressSet.Length;
for(i = 0;i < niceMutator.niceWeapProgressSet.Length;i ++){
@ -129,7 +183,8 @@ function PostRender(Canvas C)
}
//// Draw invincibility bar
nicePawn = NiceHumanPawn(nicePlayer.pawn);
if(nicePawn != none && nicePawn.invincibilityTimer != 0.0){
if(nicePawn != none && nicePawn.invincibilityTimer != 0.0)
{
C.SetDrawColor(255, 255, 255);
if(nicePawn.invincibilityTimer > 0)
barTexture = greenBar;
@ -174,6 +229,7 @@ function PostRender(Canvas C)
for(i = 0;i < nicePlayer.abilityManager.currentAbilitiesAmount;i ++)
DrawAbilityCooldown(C, i);
}
function DrawCounter(Canvas C, NicePack.CounterDisplay counter, int x, int y, TeamInfo team){
local float borderSpace;
local Texture textureToDraw;