From 6dc25af5a1357ecbd24cb230df48253a987d5022 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Thu, 28 Sep 2023 18:48:26 +0200 Subject: [PATCH] Draw Stat Screen using Demolitionist UI frames instead of gradients. --- language.version | 4 +-- zscript/menu/swwm_inter.zsc | 66 +++++++++++++++++++++++++++---------- 2 files changed, 50 insertions(+), 20 deletions(-) diff --git a/language.version b/language.version index a851f9af5..0c80175db 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r964 \cu(Thu 28 Sep 11:14:27 CEST 2023)\c-"; -SWWM_SHORTVER="\cw1.3pre r964 \cu(2023-09-28 11:14:27)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r965 \cu(Thu 28 Sep 18:48:26 CEST 2023)\c-"; +SWWM_SHORTVER="\cw1.3pre r965 \cu(2023-09-28 18:48:26)\c-"; diff --git a/zscript/menu/swwm_inter.zsc b/zscript/menu/swwm_inter.zsc index 55dea4027..4643ad036 100644 --- a/zscript/menu/swwm_inter.zsc +++ b/zscript/menu/swwm_inter.zsc @@ -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