|
|
|
@ -1,31 +1,696 @@
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class StatusbarWidget ui
|
|
|
|
|
{
|
|
|
|
|
enum EAlign
|
|
|
|
|
{
|
|
|
|
|
TOP = 0x1,
|
|
|
|
|
VMIDDLE = 0x2,
|
|
|
|
|
BOTTOM = 0x4,
|
|
|
|
|
|
|
|
|
|
LEFT = 0x10,
|
|
|
|
|
RIGHT = 0x20,
|
|
|
|
|
HMIDDLE = 0x40,
|
|
|
|
|
|
|
|
|
|
CENTER = VMIDDLE|HMIDDLE,
|
|
|
|
|
CENTER_BOTTOM = BOTTOM|HMIDDLE
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
StatusbarWidget Next;
|
|
|
|
|
StatusbarWidget Prev;
|
|
|
|
|
StatusbarWidget Owner;
|
|
|
|
|
|
|
|
|
|
native vararg StatusbarWidget AppendWidget(class<StatusbarWidget> cls, ...);
|
|
|
|
|
native vararg StatusbarWidget BeginCondition(class<StatusbarCondition> cls, ...);
|
|
|
|
|
native StatusbarWidget EndCondition();
|
|
|
|
|
native void Finish();
|
|
|
|
|
|
|
|
|
|
void Init()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
StatusbarCondition EndCondition()
|
|
|
|
|
{
|
|
|
|
|
if (owner == null || !(owner is "StatusbarCondition"))
|
|
|
|
|
{
|
|
|
|
|
ThrowAbortException("No matching BeginCondition found for EndCondition");
|
|
|
|
|
}
|
|
|
|
|
return StatusbarCondition(owner);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusbarWidget ElseCondition()
|
|
|
|
|
{
|
|
|
|
|
let condi = StatusbarCondition(owner);
|
|
|
|
|
if (condi == null)
|
|
|
|
|
{
|
|
|
|
|
ThrowAbortException("No matching BeginCondition found for EndCondition");
|
|
|
|
|
}
|
|
|
|
|
if (condi.FalseChildren != null)
|
|
|
|
|
{
|
|
|
|
|
ThrowAbortException("Duplicate ElseCondition()");
|
|
|
|
|
}
|
|
|
|
|
condi.FalseChildren = new("StatusbarWidget");
|
|
|
|
|
condi.FalseChildren.Owner = condi;
|
|
|
|
|
return condi.FalseChildren;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusbarHead Finish()
|
|
|
|
|
{
|
|
|
|
|
if (owner == null || !(Owner is "StatusbarHead"))
|
|
|
|
|
{
|
|
|
|
|
ThrowAbortException("No matching Begin found for Finish");
|
|
|
|
|
}
|
|
|
|
|
return StatusbarHead(owner);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual void Draw(WidgetStatusBar stbar) {}
|
|
|
|
|
virtual void Reset() {}
|
|
|
|
|
virtual void Tick(WidgetStatusBar stbar, bool change) {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class StatusbarHead : StatusbarWidget
|
|
|
|
|
{
|
|
|
|
|
StatusbarWidget Children;
|
|
|
|
|
|
|
|
|
|
override void Draw(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
for(let p = Children; p != null; p = p.Next)
|
|
|
|
|
{
|
|
|
|
|
p.Draw(stbar);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
override void Reset()
|
|
|
|
|
{
|
|
|
|
|
for(let p = Children; p != null; p = p.Next)
|
|
|
|
|
{
|
|
|
|
|
p.Reset();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
override void Tick(WidgetStatusBar stbar, bool change)
|
|
|
|
|
{
|
|
|
|
|
for(let p = Children; p != null; p = p.Next)
|
|
|
|
|
{
|
|
|
|
|
p.Tick(stbar, change);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class StatusbarCondition : StatusbarWidget
|
|
|
|
|
{
|
|
|
|
|
StatusbarWidget Children;
|
|
|
|
|
StatusbarWidget TrueChildren;
|
|
|
|
|
StatusbarWidget FalseChildren;
|
|
|
|
|
bool LastCondition;
|
|
|
|
|
virtual int Condition(WidgetStatusBar stbar) { return -1; }
|
|
|
|
|
void Init()
|
|
|
|
|
{
|
|
|
|
|
LastCondition = true;
|
|
|
|
|
}
|
|
|
|
|
override void Draw(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
for(let p = LastCondition? TrueChildren : FalseChildren; p != null; p = p.Next)
|
|
|
|
|
{
|
|
|
|
|
p.Draw(stbar);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
override void Reset()
|
|
|
|
|
{
|
|
|
|
|
for(let p = TrueChildren; p != null; p = p.Next)
|
|
|
|
|
{
|
|
|
|
|
p.Reset();
|
|
|
|
|
}
|
|
|
|
|
for(let p = FalseChildren; p != null; p = p.Next)
|
|
|
|
|
{
|
|
|
|
|
p.Reset();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
override void Tick(WidgetStatusBar stbar, bool change)
|
|
|
|
|
{
|
|
|
|
|
for(let p = LastCondition? TrueChildren : FalseChildren; p != null; p = p.Next)
|
|
|
|
|
{
|
|
|
|
|
p.Tick(stbar, change);
|
|
|
|
|
}
|
|
|
|
|
int i = Condition(stbar);
|
|
|
|
|
if (i >= 0 && LastCondition != !!i)
|
|
|
|
|
{
|
|
|
|
|
LastCondition = !!i;
|
|
|
|
|
for(let p = LastCondition? TrueChildren : FalseChildren; p != null; p = p.Next)
|
|
|
|
|
{
|
|
|
|
|
p.Tick(stbar, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class SBConditionGamemode : StatusbarCondition
|
|
|
|
|
{
|
|
|
|
|
enum GameModes
|
|
|
|
|
{
|
|
|
|
|
SINGLEPLAYER = 0x1,
|
|
|
|
|
COOPERATIVE = 0x2,
|
|
|
|
|
DEATHMATCH = 0x4,
|
|
|
|
|
TEAMGAME = 0x8
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private int ValidModes;
|
|
|
|
|
|
|
|
|
|
void Init(int modemask)
|
|
|
|
|
{
|
|
|
|
|
ValidModes = modemask;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override int Condition(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
return (!multiplayer && (ValidModes & SINGLEPLAYER)) ||
|
|
|
|
|
(deathmatch && (ValidModes & DEATHMATCH)) ||
|
|
|
|
|
(multiplayer && !deathmatch && (ValidModes & COOPERATIVE)) ||
|
|
|
|
|
(teamplay && (ValidModes & TEAMGAME));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class SBConditionUsesAmmo : StatusbarCondition
|
|
|
|
|
{
|
|
|
|
|
enum AmmoModes
|
|
|
|
|
{
|
|
|
|
|
AMMO1,
|
|
|
|
|
AMMO2,
|
|
|
|
|
AMMO_ANY,
|
|
|
|
|
AMMO_BOTH
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private int ValidModes;
|
|
|
|
|
private bool Negate;
|
|
|
|
|
|
|
|
|
|
void Init(int modemask, bool neg = false)
|
|
|
|
|
{
|
|
|
|
|
ValidModes = modemask;
|
|
|
|
|
Negate = neg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override int Condition(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
if (stbar.CPlayer == null) return -1;
|
|
|
|
|
let w = stbar.CPlayer.ReadyWeapon;
|
|
|
|
|
if (w == null) return false;
|
|
|
|
|
bool usesammo1 = w.AmmoType1 != NULL;
|
|
|
|
|
bool usesammo2 = w.AmmoType2 != NULL;
|
|
|
|
|
|
|
|
|
|
if (ValidModes == AMMO1) return usesammo1 ^ Negate;
|
|
|
|
|
else if (ValidModes == AMMO2) return usesammo2 ^ Negate;
|
|
|
|
|
if (ValidModes == AMMO_ANY) return (usesammo1 || usesammo2) ^ Negate;
|
|
|
|
|
if (ValidModes == AMMO_BOTH) return (usesammo1 && usesammo2) ^ Negate;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class SBConditionInventoryBarVisible : StatusbarCondition
|
|
|
|
|
{
|
|
|
|
|
private bool Negate;
|
|
|
|
|
|
|
|
|
|
void Init(bool neg = false)
|
|
|
|
|
{
|
|
|
|
|
Negate = neg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override int Condition(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
if (stbar.CPlayer == null) return -1;
|
|
|
|
|
return (stbar.CPlayer.inventorytics <= 0 || level.NoInventoryBar) ^ Negate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class SBConditionAspectRatio : StatusbarCondition
|
|
|
|
|
{
|
|
|
|
|
private double MinValid, MaxValid;
|
|
|
|
|
private bool Negate;
|
|
|
|
|
|
|
|
|
|
void Init(double min, double max, bool neg = false)
|
|
|
|
|
{
|
|
|
|
|
MinValid = min;
|
|
|
|
|
MaxValid = max;
|
|
|
|
|
Negate = neg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override int Condition(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
if (stbar.CPlayer == null) return -1;
|
|
|
|
|
double aspect = screen.GetAspectRatio();
|
|
|
|
|
return (aspect >= MinValid && aspect < MaxValid) ^ Negate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// uses two names, like SBARINFO
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class SBConditionWeaponSelected : StatusbarCondition
|
|
|
|
|
{
|
|
|
|
|
private class<Weapon> Weap1, Weap2;
|
|
|
|
|
private bool Negate;
|
|
|
|
|
private bool CheckSister;
|
|
|
|
|
|
|
|
|
|
void Init(class<Weapon> w1, class<Weapon> w2, bool sister = false, bool neg = false)
|
|
|
|
|
{
|
|
|
|
|
Weap1 = w1;
|
|
|
|
|
Weap2 = w2;
|
|
|
|
|
CheckSister = sister;
|
|
|
|
|
Negate = neg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override int Condition(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
if (stbar.CPlayer == null) return -1;
|
|
|
|
|
let w = stbar.CPlayer.ReadyWeapon;
|
|
|
|
|
return (w != null && ((w.GetClass() == Weap1 || w.GetClass() == Weap2) || (CheckSister && w.SisterWeapon != null && (w.SisterWeapon.GetClass() == Weap1 || w.SisterWeapon.GetClass() == Weap2)))) ^ Negate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class SBConditionPlayerclass : StatusbarCondition
|
|
|
|
|
{
|
|
|
|
|
private Name PlayerClasses[6];
|
|
|
|
|
private bool Negate;
|
|
|
|
|
|
|
|
|
|
void Init(Name p1, Name p2 = 'none', Name p3 = 'none', Name p4 = 'none', Name p5 = 'none', Name p6 = 'none', bool neg = false)
|
|
|
|
|
{
|
|
|
|
|
PlayerClasses[0] = p1;
|
|
|
|
|
PlayerClasses[1] = p2;
|
|
|
|
|
PlayerClasses[2] = p3;
|
|
|
|
|
PlayerClasses[3] = p4;
|
|
|
|
|
PlayerClasses[4] = p5;
|
|
|
|
|
PlayerClasses[5] = p6;
|
|
|
|
|
Negate = neg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override int Condition(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
if (stbar.CPlayer == null) return -1;
|
|
|
|
|
Name dn = PlayerPawn.GetPrintableDisplayName(stbar.CPlayer.mo.GetClass());
|
|
|
|
|
for(int i=0; i<6; i++)
|
|
|
|
|
{
|
|
|
|
|
if (PlayerClasses[i] != 'none' && dn == PlayerPawn.GetPrintableDisplayName(PlayerClasses[i])) return !Negate;
|
|
|
|
|
}
|
|
|
|
|
return Negate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class SBConditionPlayerType : StatusbarCondition
|
|
|
|
|
{
|
|
|
|
|
private class<PlayerPawn> PlayerClasses[6];
|
|
|
|
|
private bool Negate;
|
|
|
|
|
|
|
|
|
|
void Init(class<PlayerPawn> p1, class<PlayerPawn> p2, class<PlayerPawn> p3, class<PlayerPawn> p4, class<PlayerPawn> p5, class<PlayerPawn> p6, bool neg = false)
|
|
|
|
|
{
|
|
|
|
|
PlayerClasses[0] = p1;
|
|
|
|
|
PlayerClasses[1] = p2;
|
|
|
|
|
PlayerClasses[2] = p3;
|
|
|
|
|
PlayerClasses[3] = p4;
|
|
|
|
|
PlayerClasses[4] = p5;
|
|
|
|
|
PlayerClasses[5] = p6;
|
|
|
|
|
Negate = neg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override int Condition(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
if (stbar.CPlayer == null) return -1;
|
|
|
|
|
for(int i=0; i<6; i++)
|
|
|
|
|
{
|
|
|
|
|
if (PlayerClasses[i] != null && stbar.CPlayer.mo is PlayerClasses[i]) return !Negate;
|
|
|
|
|
}
|
|
|
|
|
return Negate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class SBConditionHasWeaponPiece : StatusbarCondition
|
|
|
|
|
{
|
|
|
|
|
private class<Weapon> Weap1;
|
|
|
|
|
private int PieceNum;
|
|
|
|
|
private bool Negate;
|
|
|
|
|
|
|
|
|
|
void Init(class<Weapon> w1, int piecenum, bool neg = false)
|
|
|
|
|
{
|
|
|
|
|
Weap1 = w1;
|
|
|
|
|
PieceNum = piecenum - 1;
|
|
|
|
|
Negate = neg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override int Condition(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
if (stbar.CPlayer == null) return -1;
|
|
|
|
|
for(let inv = stbar.CPlayer.mo.Inv; inv != NULL; inv = inv.Inv)
|
|
|
|
|
{
|
|
|
|
|
let wh = WeaponHolder(inv);
|
|
|
|
|
if (wh.PieceWeapon == Weap1)
|
|
|
|
|
{
|
|
|
|
|
return (!!(wh.PieceMask & (1 << PieceNum))) ^ Negate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Negate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Checks if the current weapon uses the given ammo types.
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class SBConditionWeaponUsesAmmo : StatusbarCondition
|
|
|
|
|
{
|
|
|
|
|
enum AmmoModes
|
|
|
|
|
{
|
|
|
|
|
AMMO1,
|
|
|
|
|
AMMO2,
|
|
|
|
|
AMMO_ANY,
|
|
|
|
|
AMMO_BOTH
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private class<Ammo> AmmoType1, AmmoType2;
|
|
|
|
|
private int ValidModes;
|
|
|
|
|
private bool Negate;
|
|
|
|
|
|
|
|
|
|
void Init(class<Ammo> ammotype_1, class<Ammo> ammotype_2, int modemask, bool neg = false)
|
|
|
|
|
{
|
|
|
|
|
AmmoType1 = ammotype_1;
|
|
|
|
|
AmmoType2 = ammotype_2;
|
|
|
|
|
ValidModes = modemask;
|
|
|
|
|
Negate = neg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override int Condition(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
if (stbar.CPlayer == null) return -1;
|
|
|
|
|
let w = stbar.CPlayer.ReadyWeapon;
|
|
|
|
|
if (w == NULL) return false;
|
|
|
|
|
|
|
|
|
|
let WeapType1 = w.AmmoType1;
|
|
|
|
|
let WeapType2 = w.AmmoType2;
|
|
|
|
|
|
|
|
|
|
bool usesammo1 = WeapType1 != NULL;
|
|
|
|
|
bool usesammo2 = WeapType2 != NULL;
|
|
|
|
|
|
|
|
|
|
if(AmmoType2 != NULL)
|
|
|
|
|
{
|
|
|
|
|
bool match1 = ((usesammo1 && (AmmoType1 == WeapType1 || AmmoType2 == WeapType1)) || !usesammo1);
|
|
|
|
|
bool match2 = ((usesammo1 && (AmmoType1 == WeapType2 || AmmoType2 == WeapType2)) || !usesammo2);
|
|
|
|
|
|
|
|
|
|
if (ValidModes == AMMO1) return match1 ^ Negate;
|
|
|
|
|
if (ValidModes == AMMO2) return match2 ^ Negate;
|
|
|
|
|
if (ValidModes == AMMO_ANY) return (match1 || match2) ^ Negate;
|
|
|
|
|
if (ValidModes == AMMO_BOTH) return (match1 && match2) ^ Negate;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if((usesammo1 && (WeapType1 == AmmoType1)) || (usesammo2 && (WeapType2 == AmmoType1)))
|
|
|
|
|
{
|
|
|
|
|
return !Negate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Negate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class SBConditionHealth : StatusbarCondition
|
|
|
|
|
{
|
|
|
|
|
private int amount;
|
|
|
|
|
private bool Negate;
|
|
|
|
|
private bool percentage;
|
|
|
|
|
|
|
|
|
|
void Init(int amt, bool percent, bool neg = false)
|
|
|
|
|
{
|
|
|
|
|
amount = amt;
|
|
|
|
|
percentage = percent;
|
|
|
|
|
Negate = neg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override int Condition(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
if (stbar.CPlayer == null) return -1;
|
|
|
|
|
|
|
|
|
|
int phealth = percentage ? stbar.CPlayer.mo.health * 100 / stbar.CPlayer.mo.GetMaxHealth() : stbar.CPlayer.mo.health;
|
|
|
|
|
return (phealth >= Amount) ^ Negate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class SBConditionInvulnerable : StatusbarCondition
|
|
|
|
|
{
|
|
|
|
|
private bool Negate;
|
|
|
|
|
|
|
|
|
|
void Init(bool neg = false)
|
|
|
|
|
{
|
|
|
|
|
Negate = neg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override int Condition(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
if (stbar.CPlayer == null) return -1;
|
|
|
|
|
|
|
|
|
|
return ((stbar.CPlayer.mo.bInvulnerable) || (stbar.CPlayer.cheats & (CF_GODMODE | CF_GODMODE2))) ^ Negate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class SBConditionWaterLevel : StatusbarCondition
|
|
|
|
|
{
|
|
|
|
|
private int amount;
|
|
|
|
|
private bool Negate;
|
|
|
|
|
|
|
|
|
|
void Init(int amt, bool neg = false)
|
|
|
|
|
{
|
|
|
|
|
amount = amt;
|
|
|
|
|
Negate = neg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override int Condition(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
if (stbar.CPlayer == null) return -1;
|
|
|
|
|
|
|
|
|
|
return (stbar.CPlayer.mo.waterlevel >= amount) ^ Negate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class SBConditionCVarNumeric : StatusbarCondition
|
|
|
|
|
{
|
|
|
|
|
enum EOp
|
|
|
|
|
{
|
|
|
|
|
LESS,
|
|
|
|
|
LESSEQ,
|
|
|
|
|
EQ,
|
|
|
|
|
NEQ,
|
|
|
|
|
GREATEREQ,
|
|
|
|
|
GREATER
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private String cv;
|
|
|
|
|
private int Operator;
|
|
|
|
|
private double Value;
|
|
|
|
|
|
|
|
|
|
void Init(String cvname, int op, double val)
|
|
|
|
|
{
|
|
|
|
|
cv = cvname;
|
|
|
|
|
Operator = op;
|
|
|
|
|
Value = val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override int Condition(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
if (stbar.CPlayer == null) return -1;
|
|
|
|
|
let cvr = CVar.FindCVar(cv, stbar.CPlayer);
|
|
|
|
|
if (cvr == null) return -1;
|
|
|
|
|
double val = cvr.GetFloat();
|
|
|
|
|
switch (Operator)
|
|
|
|
|
{
|
|
|
|
|
case LESS:
|
|
|
|
|
return val < Value;
|
|
|
|
|
|
|
|
|
|
case LESSEQ:
|
|
|
|
|
return val <= Value;
|
|
|
|
|
|
|
|
|
|
case EQ:
|
|
|
|
|
return val ~== Value;
|
|
|
|
|
|
|
|
|
|
case NEQ:
|
|
|
|
|
return !(val ~== Value);
|
|
|
|
|
|
|
|
|
|
case GREATEREQ:
|
|
|
|
|
return val >= Value;
|
|
|
|
|
|
|
|
|
|
case GREATER:
|
|
|
|
|
return val > Value;
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class SBConditionInInventory : StatusbarCondition
|
|
|
|
|
{
|
|
|
|
|
enum AmmoModes
|
|
|
|
|
{
|
|
|
|
|
ITEM1,
|
|
|
|
|
ITEM2,
|
|
|
|
|
ITEM_ANY,
|
|
|
|
|
ITEM_BOTH
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private class<Inventory> InventoryType1, InventoryType2;
|
|
|
|
|
private int Amount1, Amount2;
|
|
|
|
|
private int ValidModes;
|
|
|
|
|
private bool Negate;
|
|
|
|
|
|
|
|
|
|
void Init(class<Inventory> Inventorytype_1, int am1, class<Inventory> Inventorytype_2, int am2, int modemask, bool neg = false)
|
|
|
|
|
{
|
|
|
|
|
InventoryType1 = Inventorytype_1;
|
|
|
|
|
InventoryType2 = Inventorytype_2;
|
|
|
|
|
Amount1 = am1;
|
|
|
|
|
Amount2 = am2;
|
|
|
|
|
ValidModes = modemask;
|
|
|
|
|
Negate = neg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override int Condition(WidgetStatusBar stbar)
|
|
|
|
|
{
|
|
|
|
|
if (stbar.CPlayer == null) return -1;
|
|
|
|
|
|
|
|
|
|
let it1 = stbar.CPlayer.mo.FindInventory(InventoryType1);
|
|
|
|
|
let it2 = stbar.CPlayer.mo.FindInventory(InventoryType2);
|
|
|
|
|
if (it1 != NULL && amount1 > 0 && it1.Amount < amount1) it1 = NULL;
|
|
|
|
|
if (it2 != NULL && amount2 > 0 && it2.Amount < amount2) it2 = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ValidModes == ITEM1) return (!!it1) ^ Negate;
|
|
|
|
|
if (ValidModes == ITEM2) return (!!it2) ^ Negate;
|
|
|
|
|
if (ValidModes == ITEM_ANY) return (it1 || it2) ^ Negate;
|
|
|
|
|
if (ValidModes == ITEM_BOTH) return (it1 && it2) ^ Negate;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class WidgetStatusBar : BaseStatusBar
|
|
|
|
|
{
|
|
|
|
|
private StatusbarWidget Head;
|
|
|
|
|
private StatusbarHead Head;
|
|
|
|
|
|
|
|
|
|
StatusbarWidget Begin()
|
|
|
|
|
{
|
|
|
|
|
Head = new("StatusbarWidget");
|
|
|
|
|
Head = new("StatusbarHead");
|
|
|
|
|
Head.Owner = Head;
|
|
|
|
|
return Head;
|
|
|
|
|
Head.Children = new ("StatusbarWidget");
|
|
|
|
|
Head.Children.Owner = Head;
|
|
|
|
|
return Head.Children;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// this is just copied from SBARINFO. We may need it.
|
|
|
|
|
static Vector2 adjustRelCenter(bool relX, bool relY, Vector2 pos, Vector3 scale)
|
|
|
|
|
{
|
|
|
|
|
Vector2 outvec;
|
|
|
|
|
if(relX)
|
|
|
|
|
outvec.X = pos.X + (screen.GetWidth()/(hud_scale ? Scale.X*2 : 2));
|
|
|
|
|
else
|
|
|
|
|
outvec.X = pos.X;
|
|
|
|
|
if(relY)
|
|
|
|
|
outvec.Y = pos.y + (screen.GetHeight()/(hud_scale ? Scale.Y*2 : 2));
|
|
|
|
|
else
|
|
|
|
|
outvec.Y = pos.y;
|
|
|
|
|
|
|
|
|
|
return outvec;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|