Draw Stat Screen using Demolitionist UI frames instead of gradients.

This commit is contained in:
Mari the Deer 2023-09-28 18:48:26 +02:00
commit 6dc25af5a1
2 changed files with 50 additions and 20 deletions

View file

@ -1,7 +1,7 @@
// Custom intermission screens
Class SWWMStatScreen : StatusScreen
{
TextureID gradtex, arttex, bgtex;
TextureID frametex, arttex, bgtex;
int glarestr, sndcnt;
int whichart, whichtip;
int tipalphastate;
@ -101,6 +101,38 @@ Class SWWMStatScreen : StatusScreen
return (a*100)/b;
}
// recycled KBase code, heh
private void DrawBox( double x, double y, double w, double h, double intp = 1. )
{
if ( !frametex ) frametex = TexMan.CheckForTexture("graphics/KBase/FrameTex.png");
double xfact = clamp(intp*2.,0.,1.)**2.;
double yfact = clamp(intp,0.,1.)**5.;
int rw = int(SWWMUtility.Lerp(-10*CleanXFac_1,w,xfact));
int rh = int(SWWMUtility.Lerp(-5*CleanXFac_1,h,yfact));
if ( intp <= 0. ) return;
int rx = x+int(w-rw)/2;
int ry = y+int(h-rh)/2;
// dim padding
rx -= 4.*CleanXFac_1;
ry -= 2.*CleanYFac_1;
rw += 8.*CleanXFac_1;
rh += 4.*CleanYFac_1;
Screen.Dim("Black",.8,rx,ry,rw,rh);
// border outside
rx -= CleanXFac_1;
ry -= CleanYFac_1;
rw += 2.*CleanXFac_1;
rh += 2.*CleanYFac_1;
Screen.DrawTexture(FrameTex,false,rx,ry,DTA_SrcX,0.,DTA_SrcY,0.,DTA_SrcWidth,1.,DTA_SrcHeight,1.,DTA_DestWidth,CleanXFac_1,DTA_DestHeight,CleanYFac_1);
if ( rw > 2*CleanXFac_1 ) Screen.DrawTexture(FrameTex,false,rx+CleanXFac_1,ry,DTA_SrcX,1.,DTA_SrcY,0.,DTA_SrcWidth,1.,DTA_SrcHeight,1.,DTA_DestWidth,int(rw-2*CleanXFac_1),DTA_DestHeight,CleanYFac_1);
if ( rh > 2*CleanYFac_1 ) Screen.DrawTexture(FrameTex,false,rx,ry+CleanYFac_1,DTA_SrcX,0.,DTA_SrcY,1.,DTA_SrcWidth,1.,DTA_SrcHeight,1.,DTA_DestWidth,CleanXFac_1,DTA_DestHeight,int(rh-2*CleanYFac_1));
Screen.DrawTexture(FrameTex,false,(rx+rw)-CleanXFac_1,ry,DTA_SrcX,2.,DTA_SrcY,0.,DTA_SrcWidth,1.,DTA_SrcHeight,1.,DTA_DestWidth,CleanXFac_1,DTA_DestHeight,CleanYFac_1);
Screen.DrawTexture(FrameTex,false,rx,(ry+rh)-CleanYFac_1,DTA_SrcX,0.,DTA_SrcY,2.,DTA_SrcWidth,1.,DTA_SrcHeight,1.,DTA_DestWidth,CleanXFac_1,DTA_DestHeight,CleanYFac_1);
if ( rh > 2*CleanYFac_1 ) Screen.DrawTexture(FrameTex,false,(rx+rw)-CleanXFac_1,ry+CleanYFac_1,DTA_SrcX,2.,DTA_SrcY,1.,DTA_SrcWidth,2.,DTA_SrcHeight,1.,DTA_DestWidth,2*CleanXFac_1,DTA_DestHeight,int(rh-2*CleanYFac_1));
if ( rw > 2*CleanXFac_1 ) Screen.DrawTexture(FrameTex,false,rx+CleanXFac_1,(ry+rh)-CleanYFac_1,DTA_SrcX,1.,DTA_SrcY,2.,DTA_SrcWidth,1.,DTA_SrcHeight,2.,DTA_DestWidth,int(rw-2*CleanXFac_1),DTA_DestHeight,2*CleanYFac_1);
Screen.DrawTexture(FrameTex,false,(rx+rw)-CleanXFac_1,(ry+rh)-CleanYFac_1,DTA_SrcX,2.,DTA_SrcY,2.,DTA_SrcWidth,2.,DTA_SrcHeight,2.,DTA_DestWidth,2*CleanXFac_1,DTA_DestHeight,2*CleanYFac_1);
}
override int DrawLF()
{
if ( sp_state < 1 ) return 0;
@ -116,9 +148,11 @@ Class SWWMStatScreen : StatusScreen
yy -= fct;
}
yy -= bh;
if ( !gradtex ) gradtex = TexMan.CheckForTexture("graphics/M_GRAD.png");
Screen.DrawTexture(gradtex,false,xx,yy+bh/2,DTA_DestWidth,150*CleanXFac_1,DTA_DestHeight,bh+4*CleanYFac_1,DTA_Rotate,90,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8,DTA_TopOffset,256,DTA_LeftOffset,128);
Screen.DrawTexture(gradtex,false,xx,yy+bh/2,DTA_DestWidth,150*CleanXFac_1,DTA_DestHeight,bh+4*CleanYFac_1,DTA_Rotate,270,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8,DTA_TopOffset,256,DTA_LeftOffset,128);
String str = StringTable.Localize("$SWWM_INTERDONE");
int bw = max(TewiFont.StringWidth(lnametexts[0])*2,TewiFont.StringWidth(str)*2);
if ( authortexts[0] != "" ) bw = max(bw,MiniwiFont.StringWidth(authortexts[0]));
bw *= CleanXFac_1;
DrawBox(xx-bw/2,yy,bw,bh);
Screen.DrawText(TewiFont,lnamecolor,xx-TewiFont.StringWidth(lnametexts[0])*CleanXFac_1,yy,lnametexts[0],DTA_ScaleX,CleanXFac_1*2,DTA_ScaleY,CleanYFac_1*2);
yy += TewiFont.GetHeight()*2*CleanYFac_1;
if ( authortexts[0] != "" )
@ -126,7 +160,6 @@ Class SWWMStatScreen : StatusScreen
Screen.DrawText(MiniwiFont,lauthcolor,xx-MiniwiFont.StringWidth(authortexts[0])*CleanXFac_1/2,yy,authortexts[0],DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
yy += MiniwiFont.GetHeight()*CleanYFac_1;
}
String str = StringTable.Localize("$SWWM_INTERDONE");
Screen.DrawText(TewiFontOutline,lsubcolor,xx-TewiFontOutline.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1*2,DTA_ScaleY,CleanYFac_1*2);
if ( (glarestr > 0) && (sp_state < 2) )
{
@ -147,10 +180,11 @@ Class SWWMStatScreen : StatusScreen
int fct = int(clamp(480-(Screen.GetHeight()/CleanYFac_1),0,80)*.75);
yy -= fct;
}
if ( !gradtex ) gradtex = TexMan.CheckForTexture("graphics/M_GRAD.png");
Screen.DrawTexture(gradtex,false,xx,yy+bh/2,DTA_DestWidth,150*CleanXFac_1,DTA_DestHeight,bh+4*CleanYFac_1,DTA_Rotate,90,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8,DTA_TopOffset,256,DTA_LeftOffset,128);
Screen.DrawTexture(gradtex,false,xx,yy+bh/2,DTA_DestWidth,150*CleanXFac_1,DTA_DestHeight,bh+4*CleanYFac_1,DTA_Rotate,270,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8,DTA_TopOffset,256,DTA_LeftOffset,128);
String str = StringTable.Localize("$SWWM_INTERNEXT");
int bw = max(TewiFont.StringWidth(lnametexts[1])*2,TewiFont.StringWidth(str)*2);
if ( authortexts[1] != "" ) bw = max(bw,MiniwiFont.StringWidth(authortexts[1]));
bw *= CleanXFac_1;
DrawBox(xx-bw/2,yy,bw,bh);
Screen.DrawText(TewiFontOutline,lsubcolor,xx-TewiFontOutline.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1*2,DTA_ScaleY,CleanYFac_1*2);
if ( (glarestr > 0) && (sp_state >= 10) )
{
@ -176,9 +210,7 @@ Class SWWMStatScreen : StatusScreen
int fct = int(clamp(480-(Screen.GetHeight()/CleanYFac_1),0,80)*.75);
yy -= fct;
}
if ( !gradtex ) gradtex = TexMan.CheckForTexture("graphics/M_GRAD.png");
Screen.DrawTexture(gradtex,false,xx,yy+th/2,DTA_DestWidth,150*CleanXFac_1,DTA_DestHeight,th+4*CleanYFac_1,DTA_Rotate,90,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8,DTA_TopOffset,256,DTA_LeftOffset,128);
Screen.DrawTexture(gradtex,false,xx,yy+th/2,DTA_DestWidth,150*CleanXFac_1,DTA_DestHeight,th+4*CleanYFac_1,DTA_Rotate,270,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8,DTA_TopOffset,256,DTA_LeftOffset,128);
DrawBox(xx-80.*CleanXFac_1,yy,160.*CleanXFac_1,th);
String str = StringTable.Localize("$SWWM_INTERKILLS");
Screen.DrawText(TewiFont,statbasecolor,xx-80*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
yy += TewiFont.GetHeight()*CleanYFac_1;
@ -272,7 +304,6 @@ Class SWWMStatScreen : StatusScreen
else vsize = tsize;
Screen.DrawTexture(arttex,false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true);
}
Screen.Dim("Black",.25,0,0,Screen.GetWidth(),Screen.GetHeight());
}
private void drawSWWMFg()
{
@ -321,17 +352,16 @@ Class SWWMStatScreen : StatusScreen
yy += fct;
}
yy -= (tipl.Count()-1)*TewiFontOutline.GetHeight();
if ( !gradtex ) gradtex = TexMan.CheckForTexture("graphics/M_GRAD.png");
Screen.DrawTexture(gradtex,false,Screen.GetWidth()/2,yy+TewiFontOutline.GetHeight()*tipl.Count()*CleanYFac_1/2.,DTA_DestWidth,450*CleanXFac_1,DTA_DestHeight,(TewiFontOutline.GetHeight()*tipl.Count()+8)*CleanYFac_1,DTA_Rotate,90,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8*alf,DTA_TopOffset,256,DTA_LeftOffset,128);
Screen.DrawTexture(gradtex,false,Screen.GetWidth()/2,yy+TewiFontOutline.GetHeight()*tipl.Count()*CleanYFac_1/2.,DTA_DestWidth,450*CleanXFac_1,DTA_DestHeight,(TewiFontOutline.GetHeight()*tipl.Count()+8)*CleanYFac_1,DTA_Rotate,270,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8*alf,DTA_TopOffset,256,DTA_LeftOffset,128);
double alph;
if ( tipflash && (gametic < tipflash) ) alph = max((tipflash-(gametic+fractic))/25.,0.)**1.5;
xx -= 8*CleanXFac_1;
DrawBox(xx,yy,(lw+16)*CleanXFac_1,tipl.Count()*TewiFontOutline.GetHeight()*CleanYFac_1,alf);
if ( alf < 1. ) return;
for ( int i=0; i<tipl.Count(); i++ )
{
Screen.DrawText(TewiFontOutline,(i==0)?tipcolor0:tipcolor1,xx,yy,tipl.StringAt(i),DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1,DTA_Alpha,alf);
Screen.DrawText(TewiFontOutline,(i==0)?tipcolor0:tipcolor1,xx,yy,tipl.StringAt(i),DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
if ( tipflash && (gametic < tipflash) )
Screen.DrawText(TewiFontOutline,tipflashcolor,xx,yy,tipl.StringAt(i),DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alf*alph);
Screen.DrawText(TewiFontOutline,tipflashcolor,xx,yy,tipl.StringAt(i),DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alph);
yy += TewiFontOutline.GetHeight()*CleanYFac_1;
if ( i == 0 ) xx += 16*CleanXFac_1;
}
@ -388,7 +418,7 @@ Class SWWMStatScreen : StatusScreen
switch (CurState)
{
case StatCount:
tipalphastate = 1;
tipalphastate = 2;
updateStats();
break;
case ShowNextLoc: