Shorten boss bar by 50px when using tight scaling.

This commit is contained in:
Mari the Deer 2023-12-07 13:23:25 +01:00
commit cca0492de5
5 changed files with 19 additions and 13 deletions

View file

@ -89,7 +89,7 @@ extend Class SWWMHandler
bool initialized;
ui bool ui_initialized;
ui TextureID bbar_f, bbar_r, bbar_d;
ui TextureID bbar_f[2], bbar_r[2], bbar_d[2];
ui double bossalpha;
ui SmoothLinearValueInterpolator ihealth;
ui SmoothDynamicValueInterpolator ihealthr;
@ -561,23 +561,29 @@ extend Class SWWMHandler
if ( !ui_initialized || (bossalpha <= 0.) ) return;
if ( !mSmallFont ) mSmallFont = Font.GetFont('TewiFontOutline');
if ( !mTinyFont ) mTinyFont = Font.GetFont('MiniwiFontOutline');
if ( !bbar_f ) bbar_f = TexMan.CheckForTexture("graphics/HUD/BossHealthBarBox.png");
if ( !bbar_r ) bbar_r = TexMan.CheckForTexture("graphics/HUD/BossHealthBar.png");
if ( !bbar_d ) bbar_d = TexMan.CheckForTexture("graphics/HUD/BossHealthBarDecay.png");
Vector2 vpos = ((bar.ss.x-300)/2.,bar.ss.y-(bar.ymargin+50));
Screen.DrawTexture(bbar_f,false,vpos.x-2,vpos.y-2,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha);
if ( !bbar_f[0] ) bbar_f[0] = TexMan.CheckForTexture("graphics/HUD/BossHealthBarBox.png");
if ( !bbar_r[0] ) bbar_r[0] = TexMan.CheckForTexture("graphics/HUD/BossHealthBar.png");
if ( !bbar_d[0] ) bbar_d[0] = TexMan.CheckForTexture("graphics/HUD/BossHealthBarDecay.png");
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.);
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);
if ( hmax )
{
double rw = clamp((ihealthr.GetValue(bar.FracTic)*300.)/hmax,0.,300.);
double dw = clamp((ihealth.GetValue(bar.FracTic)*300.)/hmax,0.,300.);
Screen.DrawTexture(bbar_d,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,false,vpos.x,vpos.y,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha,DTA_WindowRightF,rw);
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);
}
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+300-mTinyFont.StringWidth(dnum),vpos.y-(mTinyFont.GetHeight()+2),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),vpos.y-(mTinyFont.GetHeight()+2),dnum,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha*calph);
}
String bname = bosstag;
if ( (bname.Left(1) == "$") && swwm_funtags )