Safeguard against possible divide by zero in boss healthbar.

This commit is contained in:
Mari the Deer 2021-07-01 10:09:16 +02:00
commit 2278e50a31
2 changed files with 9 additions and 6 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r566 \cu(Wed 30 Jun 19:55:45 CEST 2021)\c-";
SWWM_SHORTVER="\cw0.9.11b-pre r566 \cu(2021-06-30 19:55:45)\c-";
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r567 \cu(Thu 1 Jul 10:09:16 CEST 2021)\c-";
SWWM_SHORTVER="\cw0.9.11b-pre r567 \cu(2021-07-01 10:09:16)\c-";

View file

@ -392,10 +392,13 @@ extend Class SWWMHandler
if ( !bbar_d ) bbar_d = TexMan.CheckForTexture("graphics/HUD/BossHealthBarDecay.png",TexMan.Type_Any);
Vector2 vpos = ((bar.ss.x-300)/2.,bar.ss.y-(bar.margin+35));
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);
int rw = int(clamp((ihealthr.GetValue()*300.)/hmax,0.,300.));
int dw = int(clamp((ihealth.GetValue()*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_WindowRight,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_WindowRight,rw);
if ( hmax )
{
int rw = int(clamp((ihealthr.GetValue()*300.)/hmax,0.,300.));
int dw = int(clamp((ihealth.GetValue()*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_WindowRight,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_WindowRight,rw);
}
Font barfnt = bar.LangFont(bar.mTewiFont);
Font dmgfnt = bar.mTewiFont.mFont;
if ( (cummdamage > 0) && (gametic < lastcummtic+150) )