Draw boss healthbar with the same scaling factor as other healthbars.

This commit is contained in:
Mari the Deer 2023-12-16 08:54:35 +01:00
commit a2b6ec001b
4 changed files with 11 additions and 15 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1051 \cu(Thu 14 Dec 22:02:41 CET 2023)\c-";
SWWM_SHORTVER="\cw1.3pre r1051 \cu(2023-12-14 22:02:41)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1052 \cu(Sat 16 Dec 08:54:35 CET 2023)\c-";
SWWM_SHORTVER="\cw1.3pre r1052 \cu(2023-12-16 08:54:35)\c-";

View file

@ -567,23 +567,23 @@ extend Class SWWMHandler
if ( !bbar_f[1] ) bbar_f[1] = TexMan.CheckForTexture("graphics/HUD/BossHealthBarBoxSmol.png");
if ( !bbar_r[1] ) bbar_r[1] = TexMan.CheckForTexture("graphics/HUD/BossHealthBarSmol.png");
if ( !bbar_d[1] ) bbar_d[1] = TexMan.CheckForTexture("graphics/HUD/BossHealthBarDecaySmol.png");
bool bSmol = (bar.ss.x<640.);
bool bSmol = (bar.ss1.x<640.);
int intsz = bSmol?250:300;
double dblsz = bSmol?250.:300.;
Vector2 vpos = ((bar.ss.x-intsz)/2.,bar.ss.y-(bar.ymargin+50));
Screen.DrawTexture(bbar_f[bSmol],false,vpos.x-2,vpos.y-2,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha);
Vector2 vpos = ((bar.ss1.x-intsz)/2.,bar.ss1.y*.75);
Screen.DrawTexture(bbar_f[bSmol],false,vpos.x-2,vpos.y-2,DTA_VirtualWidthF,bar.ss1.x,DTA_VirtualHeightF,bar.ss1.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha);
if ( hmax )
{
double rw = clamp((ihealthr.GetValue(bar.FracTic)*dblsz)/hmax,0.,dblsz);
double dw = clamp((ihealth.GetValue(bar.FracTic)*dblsz)/hmax,0.,dblsz);
Screen.DrawTexture(bbar_d[bSmol],false,vpos.x,vpos.y,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha,DTA_WindowRightF,dw);
Screen.DrawTexture(bbar_r[bSmol],false,vpos.x,vpos.y,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha,DTA_WindowRightF,rw);
Screen.DrawTexture(bbar_d[bSmol],false,vpos.x,vpos.y,DTA_VirtualWidthF,bar.ss1.x,DTA_VirtualHeightF,bar.ss1.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha,DTA_WindowRightF,dw);
Screen.DrawTexture(bbar_r[bSmol],false,vpos.x,vpos.y,DTA_VirtualWidthF,bar.ss1.x,DTA_VirtualHeightF,bar.ss1.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha,DTA_WindowRightF,rw);
}
if ( (cummdamage > 0) && (gametic < lastcummtic+150) )
{
double calph = clamp(((lastcummtic+150)-gametic)/50.,0.,1.);
string dnum = String.Format("%d",cummdamage);
Screen.DrawText(mTinyFont,Font.CR_RED,(vpos.x+intsz)-(mTinyFont.StringWidth(dnum)+2),vpos.y-mTinyFont.GetHeight(),dnum,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha*calph);
Screen.DrawText(mTinyFont,Font.CR_RED,(vpos.x+intsz)-(mTinyFont.StringWidth(dnum)+2),vpos.y-mTinyFont.GetHeight(),dnum,DTA_VirtualWidthF,bar.ss1.x,DTA_VirtualHeightF,bar.ss1.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha*calph);
}
String bname = bosstag;
if ( (bname.Left(1) == "$") && swwm_funtags )
@ -591,7 +591,7 @@ extend Class SWWMHandler
String fun = bname.."_FUN";
if ( !(StringTable.Localize(fun) ~== fun.Mid(1)) ) bname = fun;
}
Screen.DrawText(mSmallFont,Font.CR_WHITE,vpos.x+3,vpos.y-mSmallFont.GetHeight(),StringTable.Localize(bname),DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha);
Screen.DrawText(mSmallFont,Font.CR_WHITE,vpos.x+3,vpos.y-mSmallFont.GetHeight(),StringTable.Localize(bname),DTA_VirtualWidthF,bar.ss1.x,DTA_VirtualHeightF,bar.ss1.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha);
}
// can't use this until I actually figure out how to make those walls damageable

View file

@ -665,8 +665,8 @@ Class SWWMStatusBar : BaseStatusBar
FracTic = TicFrac;
if ( (players[consoleplayer].Camera is 'Demolitionist') && (state <= HUD_Fullscreen) )
{
if ( hnd ) hnd.DrawBossBar(self);
DrawTarget();
if ( hnd ) hnd.DrawBossBar(self);
DrawTopStuff();
DrawInventory();
DrawStatus();

View file

@ -286,8 +286,6 @@ extend Class SWWMStatusBar
{
nalph = clamp(tagtime/20.,0.,1.);
yy = ss.y-(ymargin+50);
// shift up if boss healthbar is present
if ( hnd && (hnd.bossalpha > 0.) ) yy -= int(40*clamp(hnd.bossalpha*2.,0.,1.));
int len = mSmallFont.StringWidth(ntagstr);
double xx = (ss.x-len)/2.;
Screen.Dim("Black",.8*nalph,int((xx-6)*hs),int(yy*hs),int((len+12)*hs),int((h+4)*hs));
@ -297,9 +295,7 @@ extend Class SWWMStatusBar
// reverse order since they're drawn bottom to top
int mend = max(0,PickupQueue.Size()-MAXPICKUP);
yy = ss.y-(ymargin+50);
// shift up if boss healthbar is present
if ( hnd && (hnd.bossalpha > 0.) ) yy -= int(40*clamp(hnd.bossalpha*2.,0.,1.));
// shift up again if nametag is present
// shift up if nametag is present
if ( nalph > 0. ) yy -= int((mSmallFont.GetHeight()+6)*clamp(nalph*2.,0.,1.));
for ( int i=PickupQueue.Size()-1; i>=mend; i-- )
{