Add slider for healthbar fade distance.
This commit is contained in:
parent
02ae172777
commit
e6d1808218
7 changed files with 25 additions and 7 deletions
|
|
@ -1467,6 +1467,7 @@ Class SWWMStatusBar : BaseStatusBar
|
|||
else cti.Reinit();
|
||||
SWWMQuickCombatTracker ct;
|
||||
bool onlyfriends = (swwm_targeter >= 2);
|
||||
int fadedist = swwm_bardist;
|
||||
while ( ct = SWWMQuickCombatTracker(cti.Next()) )
|
||||
{
|
||||
// this ensures that projection data isn't cached if there are no target array elements, to avoid needless GC thrashing
|
||||
|
|
@ -1492,6 +1493,9 @@ Class SWWMStatusBar : BaseStatusBar
|
|||
Vector3 smpos = level.Vec3Offset(SWWMUtility.LerpVector3(ct.Owner.prev,ct.Owner.pos,fractic),(0,0,ct.lvheight));
|
||||
Vector3 tdir = level.Vec3Diff(viewpos,smpos);
|
||||
if ( viewvec dot tdir < 0 ) continue;
|
||||
// ignore trackers that are too far away
|
||||
double dist = tdir.length();
|
||||
if ( (fadedist > 0) && (dist > fadedist*1.5) ) continue;
|
||||
Vector3 ndc = SWWMUtility.ProjectPoint(projdata,viewpos+tdir);
|
||||
if ( ndc.z >= 1. ) continue;
|
||||
Vector2 vpos = SWWMUtility.NDCToViewport(projdata,ndc)/hs1;
|
||||
|
|
@ -1499,6 +1503,11 @@ Class SWWMStatusBar : BaseStatusBar
|
|||
double fin = clamp(ct.fadein+fractic,0.,5.)/5.;
|
||||
double fout = clamp(ct.lifespan-fractic,0.,25.)/25.;
|
||||
double alph = fin*fout;
|
||||
if ( fadedist > 0 )
|
||||
{
|
||||
double df = 1.-(clamp((dist-fadedist)/fadedist,0.,.5)*2.);
|
||||
alph *= df;
|
||||
}
|
||||
Vector2 barpos = vpos-(27,7);
|
||||
if ( swwm_targettags && (ct.mytag != "") )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -356,15 +356,18 @@ Class SWWMQuickCombatTracker : Inventory
|
|||
t = tt;
|
||||
break;
|
||||
}
|
||||
// must exclude players (unless they're voodoo dolls)
|
||||
// this is mainly for deathmatch so players you hit don't become easy to track when out of view
|
||||
bool realmonster = target.bISMONSTER&&(!target.player||(target.player&&(target.player.mo!=target)));
|
||||
if ( t )
|
||||
{
|
||||
// re-fade in
|
||||
if ( t.lifespan < 20 ) t.fadein = t.lifespan/4;
|
||||
t.lifespan = max(t.lifespan,target.bISMONSTER?((damage>0)?700:70):((damage>0)?140:35));
|
||||
t.lifespan = max(t.lifespan,realmonster?((damage>0)?700:70):((damage>0)?140:35));
|
||||
if ( damage > 0 )
|
||||
{
|
||||
t.cummdamage += damage;
|
||||
t.cummspan = target.bISMONSTER?120:30;
|
||||
t.cummspan = realmonster?120:30;
|
||||
t.cummflash = 15;
|
||||
}
|
||||
return t;
|
||||
|
|
@ -381,12 +384,12 @@ Class SWWMQuickCombatTracker : Inventory
|
|||
if ( damage > 0 )
|
||||
{
|
||||
t.cummdamage = damage;
|
||||
t.cummspan = target.bISMONSTER?120:30;
|
||||
t.cummspan = realmonster?120:30;
|
||||
t.cummflash = 15;
|
||||
}
|
||||
t.intp = SmoothDynamicValueInterpolator.Create(t.lasthealth,.5);
|
||||
t.intpl = SmoothLinearValueInterpolator.Create(t.laghealth[9],max(1,t.maxhealth/50));
|
||||
t.lifespan = target.bISMONSTER?((damage>0)?700:70):((damage>0)?140:35);
|
||||
t.lifespan = realmonster?((damage>0)?700:70):((damage>0)?140:35);
|
||||
t.fadein = 0;
|
||||
t.lvheight = target.Height;
|
||||
t.UpdateTag(hnd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue