diff --git a/zscript/unrealhud.zsc b/zscript/unrealhud.zsc index 72d4ab5..f3fd8ea 100644 --- a/zscript/unrealhud.zsc +++ b/zscript/unrealhud.zsc @@ -667,7 +667,9 @@ Class UnrealHUD : BaseStatusBar String str; if ( amo1 && amo2 && (amo2 != amo1) ) str = String.Format(StringTable.Localize("$S_MINHUD2"),CPlayer.Health,(deathmatch||teamplay)?CPlayer.fragcount:CPlayer.killcount,AmmoAmount2,AmmoAmount1); else str = String.Format(StringTable.Localize("$S_MINHUD"),CPlayer.Health,(deathmatch||teamplay)?CPlayer.fragcount:CPlayer.killcount,AmmoAmount1); - Screen.DrawText(OldSmallFont,Font.CR_WHITE,(Screen.GetWidth()-OldSmallFont.StringWidth(str)*CleanXFac_1)/2,CleanYFac_1,str,DTA_CleanNoMove_1,true); + CurX = (ClipX-OldSmallFont.StringWidth(str))/2; + CurY = 1; + Screen.DrawText(OldSmallFont,Font.CR_WHITE,CurX,CurY,str,DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true); return; } if ( ClipX < 320 ) HudMode = 4; @@ -913,53 +915,52 @@ Class UnrealHUD : BaseStatusBar override bool DrawChat( String txt ) { - int xpos = 4*CleanXFac_1; - int ypos = ((screenblocks<=10)||automapactive)?GetTopOfStatusBar():(Screen.GetHeight()-((screenblocks>11)?0:int(32*scalev.y))); - ypos -= (WhiteFont.GetHeight()+4)*CleanYFac_1; + CurX = 4; + CurY = ((screenblocks<=10)||automapactive)?(GetTopOfStatusBar()/scalev.y):(ClipY-((screenblocks>11)?0:32)); + CurY -= WhiteFont.GetHeight()+4; String fullstr = String.Format("(> Say %s%s",txt,WhiteFont.GetCursor()); // cut out until it fits - while ( (WhiteFont.StringWidth(fullstr) > CleanWidth_1) && fullstr.Length() > 7 ) + while ( (WhiteFont.StringWidth(fullstr) > ClipX) && fullstr.Length() > 7 ) fullstr.Remove(7,1); - Screen.DrawText(WhiteFont,Font.CR_GREEN,xpos,ypos,fullstr,DTA_CleanNoMove_1,true); + Screen.DrawText(WhiteFont,Font.CR_GREEN,CurX,CurY,fullstr,DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true); return true; } private void DrawMessages( int state ) { - int xpos, ypos; if ( (MidPrintStr.Length() > 0) && (MidPrintTic > gametic) ) { let mfnt = MidPrintLarge?UBigFont:WhiteFont; - xpos = (Screen.GetWidth()-mfnt.StringWidth(MidPrintStr)*CleanXFac_1)/2; - ypos = 96*CleanYFac_1; - Screen.DrawText(mfnt,Font.FindFontColor('UTHudText'),xpos,ypos,MidPrintStr,DTA_CleanNoMove_1,true,DTA_Alpha,clamp((MidPrintTic-gametic+fractic)*0.05,0,1),DTA_LegacyRenderStyle,STYLE_Add); + CurX = (ClipX-mfnt.StringWidth(MidPrintStr))/2; + CurY = 96; + Screen.DrawText(mfnt,Font.FindFontColor('UTHudText'),CurX,CurY,MidPrintStr,DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true,DTA_Alpha,clamp((MidPrintTic-gametic+fractic)*0.05,0,1),DTA_LegacyRenderStyle,STYLE_Add); } if ( PickupMsgTic > gametic ) { - xpos = (Screen.GetWidth()-WhiteFont.StringWidth(PickupMsg)*CleanXFac_1)/2; - if ( state == HUD_Statusbar ) ypos = GetTopOfStatusBar()-31*CleanYFac_1; - else ypos = Screen.GetHeight()-41*CleanYFac_1; - Screen.DrawText(WhiteFont,Font.CR_WHITE,xpos,ypos,PickupMsg,DTA_CleanNoMove_1,true,DTA_Alpha,clamp((PickupMsgTic-gametic+fractic)*0.05,0,1),DTA_LegacyRenderStyle,STYLE_Add); + CurX = (ClipX-WhiteFont.StringWidth(PickupMsg))/2; + if ( state == HUD_Statusbar ) CurY = GetTopOfStatusBar()/scalev.y-31; + else CurY = ClipY-41; + Screen.DrawText(WhiteFont,Font.CR_WHITE,CurX,CurY,PickupMsg,DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true,DTA_Alpha,clamp((PickupMsgTic-gametic+fractic)*0.05,0,1),DTA_LegacyRenderStyle,STYLE_Add); } if ( ntagtic > gametic ) { - xpos = (Screen.GetWidth()-WhiteFont.StringWidth(ntagstr)*CleanXFac_1)/2; - if ( state == HUD_Statusbar ) ypos = GetTopOfStatusBar()-15*CleanYFac_1; - else ypos = Screen.GetHeight()-25*CleanYFac_1; - Screen.DrawText(WhiteFont,Font.CR_WHITE,xpos,ypos,ntagstr,DTA_CleanNoMove_1,true,DTA_Alpha,clamp((ntagtic-gametic+fractic)*0.05,0,1),DTA_LegacyRenderStyle,STYLE_Add); + CurX = (ClipX-WhiteFont.StringWidth(ntagstr))/2; + if ( state == HUD_Statusbar ) CurY = GetTopOfStatusBar()/scalev.y-15; + else CurY = ClipY-25; + Screen.DrawText(WhiteFont,Font.CR_WHITE,CurX,CurY,ntagstr,DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true,DTA_Alpha,clamp((ntagtic-gametic+fractic)*0.05,0,1),DTA_LegacyRenderStyle,STYLE_Add); } // draw messages - xpos = 4*CleanXFac_1; - ypos = 4*CleanYFac_1; - if ( (state == HUD_Fullscreen) && (HudMode < 2) && DrawArmor(0,0,false,true) ) ypos += int(32*scalev.y); + if ( (state == HUD_Fullscreen) && (HudMode < 2) && DrawArmor(0,0,false,true) ) CurY = 36; + else CurY = 4; + CurX = 4; for ( int i=3; i>=0; i-- ) { if ( ShortMsgTic[i] < gametic ) continue; - let lines = WhiteFont.BreakLines(ShortMsg[i],CleanWidth_1/2); + let lines = WhiteFont.BreakLines(ShortMsg[i],int(ClipX/2)); for ( int j=0; j