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

@ -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