I gave in and did the font cleanup already.

This commit is contained in:
Mari the Deer 2021-12-16 22:07:20 +01:00
commit 7f70eb03af
31 changed files with 494 additions and 737 deletions

View file

@ -6,7 +6,6 @@ extend Class SWWMHandler
transient ui String kstr, klingerstr;
transient ui bool kfail;
transient ui int rss;
transient ui Font kfnt;
ui bool nostalgic;
transient int sewercnt;
@ -519,19 +518,18 @@ extend Class SWWMHandler
double shine = clamp((klinger-(gametic+e.fractic+40))/20.,0.,1.);
int col = (kcode>4)?0:(kfail)?2:1;
int tlen = chstr.CodePointCount();
if ( !kfnt ) kfnt = Font.GetFont('TewiShadedOutline');
int width = (kfnt.StringWidth(chstr)+2*(tlen-1))*2;
int width = (bigfont.StringWidth(chstr)+6*(tlen-1));
int xx = int((ss.x-width)/2.);
int yy = int((ss.y-kfnt.GetHeight())/2.);
int yy = int((ss.y-bigfont.GetHeight())/2.);
rss = (kcode>4)?gametic:klinger;
for ( int i=0, pos=0; i<tlen; i++ )
{
int ch;
[ch, pos] = chstr.GetNextCodePoint(pos);
if ( col == 0 ) Screen.DrawChar(kfnt,Font.CR_DARKGRAY,xx+RandomShiver(),yy+RandomShiver(),ch,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ScaleX,2.,DTA_ScaleY,2.);
else if ( col == 1 ) Screen.DrawChar(kfnt,Font.CR_SAPPHIRE,xx,yy,ch,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ScaleX,2.,DTA_ScaleY,2.,DTA_Alpha,alph,DTA_ColorOverlay,Color(int(shine*255),255,255,255));
else if ( col == 2 ) Screen.DrawChar(kfnt,Font.CR_RED,xx,yy+RandomFall()*(1.-alph),ch,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ScaleX,2.,DTA_ScaleY,2.,DTA_Alpha,alph);
xx += kfnt.GetCharWidth(ch)*2;
if ( col == 0 ) Screen.DrawChar(bigfont,Font.CR_DARKGRAY,xx+RandomShiver(),yy+RandomShiver(),ch,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
else if ( col == 1 ) Screen.DrawChar(bigfont,Font.CR_SAPPHIRE,xx,yy,ch,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ColorOverlay,Color(int(shine*255),255,255,255));
else if ( col == 2 ) Screen.DrawChar(bigfont,Font.CR_RED,xx,yy+RandomFall()*(1.-alph),ch,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph);
xx += bigfont.GetCharWidth(ch)+bigfont.GetDefaultKerning()+6;
}
}
}