From a2b6ec001be075c57eeead6be2b075ae85fe6227 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Sat, 16 Dec 2023 08:54:35 +0100 Subject: [PATCH] Draw boss healthbar with the same scaling factor as other healthbars. --- language.version | 4 ++-- zscript/handler/swwm_handler_vanillaboss.zsc | 14 +++++++------- zscript/hud/swwm_hud.zsc | 2 +- zscript/hud/swwm_hud_messages.zsc | 6 +----- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/language.version b/language.version index e162b83b0..4ae3c6b50 100644 --- a/language.version +++ b/language.version @@ -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-"; diff --git a/zscript/handler/swwm_handler_vanillaboss.zsc b/zscript/handler/swwm_handler_vanillaboss.zsc index fd1011774..45e5d91c2 100644 --- a/zscript/handler/swwm_handler_vanillaboss.zsc +++ b/zscript/handler/swwm_handler_vanillaboss.zsc @@ -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 diff --git a/zscript/hud/swwm_hud.zsc b/zscript/hud/swwm_hud.zsc index 427429e57..de740817a 100644 --- a/zscript/hud/swwm_hud.zsc +++ b/zscript/hud/swwm_hud.zsc @@ -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(); diff --git a/zscript/hud/swwm_hud_messages.zsc b/zscript/hud/swwm_hud_messages.zsc index ce849b897..17c36f4d0 100644 --- a/zscript/hud/swwm_hud_messages.zsc +++ b/zscript/hud/swwm_hud_messages.zsc @@ -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-- ) {