From 1fb0b7a7f563b6b55a65250dc85c028c7fc22c97 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Sat, 25 Nov 2023 17:23:23 +0100 Subject: [PATCH] Tweak color range of healthbar values. Also, add healthbar values to player healthbars as well. --- language.version | 4 ++-- zscript/hud/swwm_hud_target.zsc | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/language.version b/language.version index d4ae3a281..813b4fd00 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1017 \cu(Sat 25 Nov 17:22:43 CET 2023)\c-"; -SWWM_SHORTVER="\cw1.3pre r1017 \cu(2023-11-25 17:22:43)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1018 \cu(Sat 25 Nov 17:23:23 CET 2023)\c-"; +SWWM_SHORTVER="\cw1.3pre r1018 \cu(2023-11-25 17:23:23)\c-"; diff --git a/zscript/hud/swwm_hud_target.zsc b/zscript/hud/swwm_hud_target.zsc index 87e54de3c..d0870993d 100644 --- a/zscript/hud/swwm_hud_target.zsc +++ b/zscript/hud/swwm_hud_target.zsc @@ -184,7 +184,7 @@ extend Class SWWMStatusBar int valw = MiniHUDFontOutline.StringWidth(val); val = String.Format("%d \c[MiniWhite]%d",ct.lasthealth,ct.maxhealth); int ofsw = valw-MiniHUDFontOutline.StringWidth(val); - int col = (ct.lasthealth>ct.maxhealth)?mhudfontcol[MCR_BRASS]:(ct.lasthealth>=(ct.maxhealth/2))?mhudfontcol[MCR_WHITE]:(ct.lasthealth>=(ct.maxhealth/10))?mhudfontcol[MCR_RED]:mhudfontcol[MCR_SAYAHUD]; + int col = (ct.lasthealth>ct.maxhealth)?mhudfontcol[MCR_BRASS]:(ct.lasthealth>=(ct.maxhealth/2))?mhudfontcol[MCR_WHITE]:(ct.lasthealth>=(ct.maxhealth/5))?mhudfontcol[MCR_TOMATO]:(ct.lasthealth>=(ct.maxhealth/10))?mhudfontcol[MCR_RED]:mhudfontcol[MCR_SAYAHUD]; Screen.DrawText(MiniHUDFontOutline,col,vpos.x-int((valw/2)-ofsw),barpos.y-(MiniHUDFontOutline.GetHeight()+2),val,DTA_VirtualWidthF,ss1.x,DTA_VirtualHeightF,ss1.y,DTA_KeepRatio,true,DTA_Alpha,alph); Screen.DrawChar(MiniHUDFontOutline,mhudfontcol[MCR_IBUKIHUD],vpos.x-3,barpos.y-(MiniHUDFontOutline.GetHeight()+2),0x2F,DTA_VirtualWidthF,ss1.x,DTA_VirtualHeightF,ss1.y,DTA_KeepRatio,true,DTA_Alpha,alph); } @@ -257,6 +257,17 @@ extend Class SWWMStatusBar double fout = clamp(ct.lifespan-fractic,0.,25.)/25.; double alph = fin*fout; Vector2 barpos = vpos-(27,15); + if ( drawvalues ) + { + // player health values are drawn as a single number + // font color is the same as in the status box + String val = String.Format("%d",ct.lasthealth); + int valw = MiniHUDFontOutline.StringWidth(val); + int col = (ct.lasthealth>500)?mhudfontcol[MCR_YELLOW]:(ct.lasthealth>200)?mhudfontcol[MCR_PURPLE]:(ct.lasthealth>100)?mhudfontcol[MCR_AQUA]:mhudfontcol[MCR_RED]; + if ( ct.Owner.bINVULNERABLE || (ct.Owner.player.cheats&(CF_GODMODE|CF_GODMODE2)) || ct.Owner.FindInventory("InvinciballPower") ) + col = mhudfontcol[MCR_WHITE]; + Screen.DrawText(MiniHUDFontOutline,col,vpos.x-(valw/2),barpos.y-(MiniHUDFontOutline.GetHeight()+2),val,DTA_VirtualWidthF,ss1.x,DTA_VirtualHeightF,ss1.y,DTA_KeepRatio,true,DTA_Alpha,alph); + } Font fnt = swwm_bigtags?mSmallFontOutline:mTinyFontOutline; int col = Font.CR_WHITE; if ( teamplay ) @@ -265,7 +276,8 @@ extend Class SWWMStatusBar if ( team != -1 ) col = Font.FindFontColor(Teams[team].mName); // this works in practice because team names are the same as their text colors if ( col == -1 ) col = Font.CR_WHITE; } - Screen.DrawText(fnt,col,vpos.x-fnt.StringWidth(ct.mytag)/2,barpos.y-(fnt.GetHeight()+2),ct.mytag,DTA_VirtualWidthF,ss1.x,DTA_VirtualHeightF,ss1.y,DTA_KeepRatio,true,DTA_Alpha,alph); + int ofsh = drawvalues?(MiniHUDFontOutline.GetHeight()+4):2; + Screen.DrawText(fnt,col,vpos.x-fnt.StringWidth(ct.mytag)/2,barpos.y-(fnt.GetHeight()+ofsh),ct.mytag,DTA_VirtualWidthF,ss1.x,DTA_VirtualHeightF,ss1.y,DTA_KeepRatio,true,DTA_Alpha,alph); Screen.DrawTexture(EnemyBTex,false,barpos.x,barpos.y,DTA_VirtualWidthF,ss1.x,DTA_VirtualHeightF,ss1.y,DTA_KeepRatio,true,DTA_Alpha,alph); double ht = clamp(ct.intp.GetValue(fractic),0,ct.maxhealth*100); double hw = (ht*50.)/ct.maxhealth; @@ -299,7 +311,7 @@ extend Class SWWMStatusBar else { ht = clamp(ct.intpl.GetValue(fractic),0,ct.maxhealth); - hw = (ht*50.)/ct.maxhealth; + hw = min((ht*50.)/ct.maxhealth,100.); Screen.DrawTexture(EnemyHTex[2],false,barpos.x+2,barpos.y+2,DTA_VirtualWidthF,ss1.x,DTA_VirtualHeightF,ss1.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_WindowLeftF,ohw,DTA_WindowRightF,hw); } if ( ct.cummdamage <= 0 ) continue;