multitasker fix

This commit is contained in:
Shtoyan 2022-07-19 19:26:56 +04:00
commit 605d020251
3 changed files with 60 additions and 57 deletions

View file

@ -13,6 +13,16 @@ var float InventoryBoxWidth;
var float InventoryBoxHeight;
var float BorderSize;
// weapons list for `MultiTasker` skill
struct WeaponProgressDisplay
{
var class<NiceWeapon> weapClass;
var float progress;
var bool bShowCounter;
var int counter;
};
var array<WeaponProgressDisplay> niceWeapProgressSet;
event NotifyLevelChange()
{
Master.RemoveInteraction(self);
@ -53,6 +63,30 @@ final private function bool bIsBleeding(ScrnHumanPawn pwn)
return false;
}
final private function UpdateNiceWeapProgressSet(NiceHumanPawn pwn)
{
local Inventory I;
local NiceWeapon niceWeap;
local WeaponProgressDisplay newProgress;
if (pwn != none && pwn.Inventory != none)
{
for (I = pwn.Inventory; I != none; I = I.Inventory)
{
niceWeap = NiceWeapon(I);
if (niceWeap != none && niceWeap != pwn.weapon && !niceWeap.IsMagazineFull())
{
newProgress.weapClass = niceWeap.class;
newProgress.progress = niceWeap.holsteredCompletition;
newProgress.bShowCounter = true;
newProgress.counter = niceWeap.GetMagazineAmmo();
niceWeapProgressSet[niceWeapProgressSet.Length] = newProgress;
}
}
}
}
function PostRender(Canvas C)
{
local int i;
@ -171,22 +205,27 @@ function PostRender(Canvas C)
}
}
nicePawn = NiceHumanPawn(nicePlayer.pawn);
//// Draw weapons progress bars
if (class'NiceVeterancyTypes'.static.hasSkill(nicePlayer, class'NiceSkillEnforcerMultitasker')
&& nicePlayer.bFlagDisplayWeaponProgress && niceMutator.niceWeapProgressSet.length > 0)
// at first update weapon info
niceWeapProgressSet.Length = 0;
UpdateNiceWeapProgressSet(nicePawn);
if (nicePawn != none && class'NiceVeterancyTypes'.static.hasSkill(nicePlayer, class'NiceSkillEnforcerMultitasker')
&& nicePlayer.bFlagDisplayWeaponProgress && niceWeapProgressSet.length > 0)
{
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 ++)
y = C.ClipY * 0.5 - 0.5 * (InventoryBoxHeight * C.ClipX + 4) * niceWeapProgressSet.Length;
for (i = 0; i < niceWeapProgressSet.Length; i++)
{
DrawWeaponProgress(C, niceMutator.niceWeapProgressSet[i], x, y,
C.ViewPort.Actor.Pawn.PlayerReplicationInfo.Team);
DrawWeaponProgress(C, niceWeapProgressSet[i], x, y, nicePawn.PlayerReplicationInfo.Team);
y += (InventoryBoxHeight * C.ClipX + 4);
}
}
//// Draw invincibility bar
nicePawn = NiceHumanPawn(nicePlayer.pawn);
if(nicePawn != none && nicePawn.invincibilityTimer != 0.0)
{
C.SetDrawColor(255, 255, 255);
@ -360,9 +399,9 @@ function DrawCalibrationStars(Canvas C){
}
}
function DrawWeaponProgress(Canvas C, NicePack.WeaponProgressDisplay weapProgress, int x, int y, TeamInfo team)
function DrawWeaponProgress(Canvas C, WeaponProgressDisplay weapProgress, int x, int y, TeamInfo team)
{
local float textWidth, textHeight;
local float textWidth, textHeight;
local string textToDraw;
local float TempWidth, TempHeight, TempBorder;