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;
}
}
}

View file

@ -3,7 +3,6 @@
extend Class SWWMHandler
{
ui SWWMProjectionData projdata;
transient ui Font dbgfont;
private ui void DrawWorldLine( RenderEvent e, Vector3 apos, Vector3 bpos, Color col )
{
@ -97,8 +96,7 @@ extend Class SWWMHandler
Vector2 vpos = SWWMUtility.NDCToViewport(projdata,ndc);
String tag = a.player?a.player.GetUserName():a.GetTag();
if ( tag == a.GetClassName() ) SWWMUtility.BeautifyClassName(tag);
if ( !dbgfont ) dbgfont = Font.GetFont('TewiShadedOutline');
Screen.DrawText(dbgfont,Font.CR_RED,vpos.x-dbgfont.StringWidth(tag)/2,vpos.y-NewSmallFont.GetHeight()/2,tag);
Screen.DrawText(NewSmallFont,Font.CR_RED,vpos.x-NewSmallFont.StringWidth(tag)/2,vpos.y-NewSmallFont.GetHeight()/2,tag);
}
private ui void DrawDebug( RenderEvent e )

View file

@ -499,15 +499,13 @@ extend Class SWWMHandler
Screen.DrawTexture(bbar_d,false,vpos.x,vpos.y,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha,DTA_WindowRight,dw);
Screen.DrawTexture(bbar_r,false,vpos.x,vpos.y,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha,DTA_WindowRight,rw);
}
Font barfnt = bar.LangFont(bar.mTewiFont);
Font dmgfnt = bar.mTewiFont.mFont;
if ( (cummdamage > 0) && (gametic < lastcummtic+150) )
{
double calph = clamp(((lastcummtic+150)-gametic)/50.,0.,1.);
string dnum = String.Format("%d",cummdamage);
Screen.DrawText(dmgfnt,Font.CR_RED,vpos.x+300-dmgfnt.StringWidth(dnum),vpos.y-(dmgfnt.GetHeight()+2),dnum,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha*calph);
Screen.DrawText(smallfont,Font.CR_RED,vpos.x+300-smallfont.StringWidth(dnum),vpos.y-(smallfont.GetHeight()+2),dnum,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha*calph);
}
Screen.DrawText(barfnt,Font.CR_WHITE,vpos.x,vpos.y-(barfnt.GetHeight()+2),StringTable.Localize(swwm_funtags?(bosstag.."_FUN"):bosstag),DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha);
Screen.DrawText(smallfont,Font.CR_WHITE,vpos.x,vpos.y-(smallfont.GetHeight()+2),StringTable.Localize(swwm_funtags?(bosstag.."_FUN"):bosstag),DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha);
}
// can't use this until I actually figure out how to make those walls damageable