Add option to always show map stats in HUD.

Fix broken propagation of cvars in combat trackers if some are dormant.
This commit is contained in:
Mari the Deer 2020-12-22 16:13:54 +01:00
commit 4cff29ab73
7 changed files with 49 additions and 25 deletions

View file

@ -900,6 +900,19 @@ Class SWWMCombatTracker : Thinker
override void Tick()
{
// only the first tracker accesses the CVars, saves on perf
if ( !prev )
{
if ( !damagebars ) damagebars = CVar.GetCVar('swwm_damagetarget',players[consoleplayer]);
if ( !maxdist ) maxdist = CVar.GetCVar('swwm_maxtargetdist',players[consoleplayer]);
dbar = damagebars.GetInt();
mxdist = maxdist.GetInt();
}
if ( next )
{
next.dbar = dbar;
next.mxdist = mxdist;
}
// is target gone or dead?
if ( !mytarget || (mytarget.Health <= 0) )
{
@ -972,19 +985,6 @@ Class SWWMCombatTracker : Thinker
lasthealth = mytarget.Health;
intp.Update(lasthealth);
// special update conditions
// only the first tracker accesses the CVars, saves on perf
if ( !prev )
{
if ( !damagebars ) damagebars = CVar.GetCVar('swwm_damagetarget',players[consoleplayer]);
if ( !maxdist ) maxdist = CVar.GetCVar('swwm_maxtargetdist',players[consoleplayer]);
dbar = damagebars.GetInt();
mxdist = maxdist.GetInt();
}
if ( next )
{
next.dbar = dbar;
next.mxdist = mxdist;
}
if ( dbar )
{
if ( (dbar == 2) && (lasthealth >= maxhealth) )