"Niceify" usage of BrokenLines in many spots.
This commit is contained in:
parent
15d259be36
commit
cb7aa8b333
10 changed files with 161 additions and 120 deletions
|
|
@ -11,6 +11,8 @@ Class SWWMHandler : EventHandler
|
|||
int trackers_cnt, scorenums_cnt, damnums_cnt, intpoints_cnt;
|
||||
|
||||
transient int slotstrictwarn;
|
||||
transient ui String sswstr;
|
||||
transient ui BrokenLines sswl;
|
||||
|
||||
// optimization
|
||||
OnFire fires;
|
||||
|
|
@ -223,17 +225,22 @@ Class SWWMHandler : EventHandler
|
|||
if ( slotstrictwarn && (gametic < slotstrictwarn) )
|
||||
{
|
||||
String str = StringTable.Localize("$SWWM_SETSLOTSTRICT");
|
||||
if ( sswstr != str )
|
||||
{
|
||||
sswstr = str;
|
||||
if ( sswl ) sswl.Destroy();
|
||||
}
|
||||
double t = (slotstrictwarn-(gametic+e.FracTic))/20.;
|
||||
double alph = clamp(t,0.,1.);
|
||||
BrokenLines l = newsmallfont.BreakLines(str,300);
|
||||
double yy = (200-l.Count()*newsmallfont.GetHeight())/2;
|
||||
for ( int i=0; i<l.Count(); i++ )
|
||||
if ( !sswl ) sswl = newsmallfont.BreakLines(sswstr,300);
|
||||
double yy = (200-sswl.Count()*newsmallfont.GetHeight())/2;
|
||||
for ( int i=0; i<sswl.Count(); i++ )
|
||||
{
|
||||
double xx = (320-l.StringWidth(i))/2;
|
||||
Screen.DrawText(newsmallfont,Font.CR_UNTRANSLATED,xx,yy,l.StringAt(i),DTA_Clean,true,DTA_Alpha,alph);
|
||||
double xx = (320-sswl.StringWidth(i))/2;
|
||||
Screen.DrawText(newsmallfont,Font.CR_UNTRANSLATED,xx,yy,sswl.StringAt(i),DTA_Clean,true,DTA_Alpha,alph);
|
||||
yy += newsmallfont.GetHeight();
|
||||
}
|
||||
l.Destroy();
|
||||
sswl.Destroy();
|
||||
}
|
||||
// weapon underlays
|
||||
if ( players[consoleplayer].ReadyWeapon is 'SWWMWeapon' )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue