Fix message scaling not following HUD.
This commit is contained in:
parent
e6b846bde7
commit
4685d3c8c5
1 changed files with 25 additions and 24 deletions
|
|
@ -667,7 +667,9 @@ Class UnrealHUD : BaseStatusBar
|
||||||
String str;
|
String str;
|
||||||
if ( amo1 && amo2 && (amo2 != amo1) ) str = String.Format(StringTable.Localize("$S_MINHUD2"),CPlayer.Health,(deathmatch||teamplay)?CPlayer.fragcount:CPlayer.killcount,AmmoAmount2,AmmoAmount1);
|
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);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if ( ClipX < 320 ) HudMode = 4;
|
if ( ClipX < 320 ) HudMode = 4;
|
||||||
|
|
@ -913,53 +915,52 @@ Class UnrealHUD : BaseStatusBar
|
||||||
|
|
||||||
override bool DrawChat( String txt )
|
override bool DrawChat( String txt )
|
||||||
{
|
{
|
||||||
int xpos = 4*CleanXFac_1;
|
CurX = 4;
|
||||||
int ypos = ((screenblocks<=10)||automapactive)?GetTopOfStatusBar():(Screen.GetHeight()-((screenblocks>11)?0:int(32*scalev.y)));
|
CurY = ((screenblocks<=10)||automapactive)?(GetTopOfStatusBar()/scalev.y):(ClipY-((screenblocks>11)?0:32));
|
||||||
ypos -= (WhiteFont.GetHeight()+4)*CleanYFac_1;
|
CurY -= WhiteFont.GetHeight()+4;
|
||||||
String fullstr = String.Format("(> Say %s%s",txt,WhiteFont.GetCursor());
|
String fullstr = String.Format("(> Say %s%s",txt,WhiteFont.GetCursor());
|
||||||
// cut out until it fits
|
// 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);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawMessages( int state )
|
private void DrawMessages( int state )
|
||||||
{
|
{
|
||||||
int xpos, ypos;
|
|
||||||
if ( (MidPrintStr.Length() > 0) && (MidPrintTic > gametic) )
|
if ( (MidPrintStr.Length() > 0) && (MidPrintTic > gametic) )
|
||||||
{
|
{
|
||||||
let mfnt = MidPrintLarge?UBigFont:WhiteFont;
|
let mfnt = MidPrintLarge?UBigFont:WhiteFont;
|
||||||
xpos = (Screen.GetWidth()-mfnt.StringWidth(MidPrintStr)*CleanXFac_1)/2;
|
CurX = (ClipX-mfnt.StringWidth(MidPrintStr))/2;
|
||||||
ypos = 96*CleanYFac_1;
|
CurY = 96;
|
||||||
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);
|
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 )
|
if ( PickupMsgTic > gametic )
|
||||||
{
|
{
|
||||||
xpos = (Screen.GetWidth()-WhiteFont.StringWidth(PickupMsg)*CleanXFac_1)/2;
|
CurX = (ClipX-WhiteFont.StringWidth(PickupMsg))/2;
|
||||||
if ( state == HUD_Statusbar ) ypos = GetTopOfStatusBar()-31*CleanYFac_1;
|
if ( state == HUD_Statusbar ) CurY = GetTopOfStatusBar()/scalev.y-31;
|
||||||
else ypos = Screen.GetHeight()-41*CleanYFac_1;
|
else CurY = ClipY-41;
|
||||||
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);
|
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 )
|
if ( ntagtic > gametic )
|
||||||
{
|
{
|
||||||
xpos = (Screen.GetWidth()-WhiteFont.StringWidth(ntagstr)*CleanXFac_1)/2;
|
CurX = (ClipX-WhiteFont.StringWidth(ntagstr))/2;
|
||||||
if ( state == HUD_Statusbar ) ypos = GetTopOfStatusBar()-15*CleanYFac_1;
|
if ( state == HUD_Statusbar ) CurY = GetTopOfStatusBar()/scalev.y-15;
|
||||||
else ypos = Screen.GetHeight()-25*CleanYFac_1;
|
else CurY = ClipY-25;
|
||||||
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);
|
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
|
// draw messages
|
||||||
xpos = 4*CleanXFac_1;
|
if ( (state == HUD_Fullscreen) && (HudMode < 2) && DrawArmor(0,0,false,true) ) CurY = 36;
|
||||||
ypos = 4*CleanYFac_1;
|
else CurY = 4;
|
||||||
if ( (state == HUD_Fullscreen) && (HudMode < 2) && DrawArmor(0,0,false,true) ) ypos += int(32*scalev.y);
|
CurX = 4;
|
||||||
for ( int i=3; i>=0; i-- )
|
for ( int i=3; i>=0; i-- )
|
||||||
{
|
{
|
||||||
if ( ShortMsgTic[i] < gametic ) continue;
|
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<lines.Count(); j++ )
|
for ( int j=0; j<lines.Count(); j++ )
|
||||||
{
|
{
|
||||||
Screen.DrawText(WhiteFont,ShortMsgCol[i],xpos,ypos,lines.StringAt(j),DTA_CleanNoMove_1,true);
|
Screen.DrawText(WhiteFont,ShortMsgCol[i],CurX,CurY,lines.StringAt(j),DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true);
|
||||||
ypos += (WhiteFont.GetHeight()+2)*CleanYFac_1;
|
CurY += WhiteFont.GetHeight()+2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue