From b2f3355b7b902c0edcc34c86c332336e87608575 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Mon, 20 Nov 2023 11:51:49 +0100 Subject: [PATCH] Adjust scaling of statscreen to be "tighter". --- language.version | 4 +- zscript/menu/swwm_inter.zsc | 201 ++++++++++++++++++++---------------- 2 files changed, 114 insertions(+), 91 deletions(-) diff --git a/language.version b/language.version index f97cae198..db5c4f532 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1010 \cu(Mon 20 Nov 11:51:34 CET 2023)\c-"; -SWWM_SHORTVER="\cw1.3pre r1010 \cu(2023-11-20 11:51:34)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1011 \cu(Mon 20 Nov 11:51:49 CET 2023)\c-"; +SWWM_SHORTVER="\cw1.3pre r1011 \cu(2023-11-20 11:51:49)\c-"; diff --git a/zscript/menu/swwm_inter.zsc b/zscript/menu/swwm_inter.zsc index d688a28fd..7f8c7a15b 100644 --- a/zscript/menu/swwm_inter.zsc +++ b/zscript/menu/swwm_inter.zsc @@ -12,6 +12,14 @@ Class SWWMStatScreen : StatusScreen double FracTic; // for smooth animations bool bNoDrawNextLoc; int tipflash; // for switching + int tipheight; // total height of tip box w/ padding + int mtipheight; // precalculated on start, minimum tip height to always + // shift up for + int topheight; // precalculated on start, maximum potential height of + // level finished + stats + entering level w/ padding + // + // both of these are used to "shift up" the top + // elements in case they could overlap with the tip box // customizable colors int lnamecolor, lauthcolor; // name / author text @@ -22,8 +30,7 @@ Class SWWMStatScreen : StatusScreen Color glarecolor; // for the eye glare when advancing int flashcolor, tipflashcolor; - double hs, hs2; - Vector2 ss, ss2, origin, origin2; + int hs, oldhs, oldwidth; Font mSmallFont; double bgfade; bool bFade; @@ -40,6 +47,7 @@ Class SWWMStatScreen : StatusScreen int iof; for ( int i=0; i<=1; i++ ) { + if ( authortexts[i] != "" ) continue; if ( (iof = lnametexts[i].RightIndexOf(" - by: ")) != -1 ) // 20 heretics, spooktober { authortexts[i] = lnametexts[i].Mid(iof+7); @@ -59,6 +67,14 @@ Class SWWMStatScreen : StatusScreen lnametexts[i].StripRight(); } tipalpha = -1.; + hs = CleanXFac_1; + oldhs = hs; + oldwidth = Screen.GetWidth(); + int statheight = TewiFont.GetHeight()*(8+(!!wbs.partime)+(wbs.totaltime!=Plrs[me].stime))+32; + int lfheight = (authortexts[0]!="")?(MiniwiFont.GetHeight()+TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2):(TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2); + int elheight = (wbs.next=="")?0:((authortexts[1]!="")?(MiniwiFont.GetHeight()+TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2):(TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2)); + topheight = (statheight+lfheight+elheight+32); + mtipheight = (4*TewiFont.GetHeight()+32); // most tips don't generally go past 4 lines in height // defaults lnamecolor = Font.CR_WHITE; lauthcolor = Font.CR_DARKGRAY; @@ -107,154 +123,160 @@ Class SWWMStatScreen : StatusScreen 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)); + int rw = int(SWWMUtility.Lerp(-10*hs,w,xfact)); + int rh = int(SWWMUtility.Lerp(-5*hs,h,yfact)); if ( intp <= 0. ) return; int rx = int(x+(w-rw)/2); int ry = int(y+(h-rh)/2); // dim padding - rx -= 4*CleanXFac_1; - ry -= 2*CleanYFac_1; - rw += 8*CleanXFac_1; - rh += 4*CleanYFac_1; + rx -= 4*hs; + ry -= 2*hs; + rw += 8*hs; + rh += 4*hs; 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,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,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,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,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); + rx -= hs; + ry -= hs; + rw += 2*hs; + rh += 2*hs; + Screen.DrawTexture(FrameTex,false,rx,ry,DTA_SrcX,0.,DTA_SrcY,0.,DTA_SrcWidth,1.,DTA_SrcHeight,1.,DTA_DestWidth,hs,DTA_DestHeight,hs); + if ( rw > 2*hs ) Screen.DrawTexture(FrameTex,false,rx+hs,ry,DTA_SrcX,1.,DTA_SrcY,0.,DTA_SrcWidth,1.,DTA_SrcHeight,1.,DTA_DestWidth,rw-2*hs,DTA_DestHeight,hs); + if ( rh > 2*hs ) Screen.DrawTexture(FrameTex,false,rx,ry+hs,DTA_SrcX,0.,DTA_SrcY,1.,DTA_SrcWidth,1.,DTA_SrcHeight,1.,DTA_DestWidth,hs,DTA_DestHeight,rh-2*hs); + Screen.DrawTexture(FrameTex,false,(rx+rw)-hs,ry,DTA_SrcX,2.,DTA_SrcY,0.,DTA_SrcWidth,1.,DTA_SrcHeight,1.,DTA_DestWidth,hs,DTA_DestHeight,hs); + Screen.DrawTexture(FrameTex,false,rx,(ry+rh)-hs,DTA_SrcX,0.,DTA_SrcY,2.,DTA_SrcWidth,1.,DTA_SrcHeight,1.,DTA_DestWidth,hs,DTA_DestHeight,hs); + if ( rh > 2*hs ) Screen.DrawTexture(FrameTex,false,(rx+rw)-hs,ry+hs,DTA_SrcX,2.,DTA_SrcY,1.,DTA_SrcWidth,2.,DTA_SrcHeight,1.,DTA_DestWidth,2*hs,DTA_DestHeight,rh-2*hs); + if ( rw > 2*hs ) Screen.DrawTexture(FrameTex,false,rx+hs,(ry+rh)-hs,DTA_SrcX,1.,DTA_SrcY,2.,DTA_SrcWidth,1.,DTA_SrcHeight,2.,DTA_DestWidth,rw-2*hs,DTA_DestHeight,2*hs); + Screen.DrawTexture(FrameTex,false,(rx+rw)-hs,(ry+rh)-hs,DTA_SrcX,2.,DTA_SrcY,2.,DTA_SrcWidth,2.,DTA_SrcHeight,2.,DTA_DestWidth,2*hs,DTA_DestHeight,2*hs); } override int DrawLF() { if ( sp_state < 1 ) return 0; double GameSecs = (bcnt+FracTic)/double(GameTicRate); - int th = (TewiFont.GetHeight()*(8+(!!wbs.partime)+(wbs.totaltime!=Plrs[me].stime))+32)*CleanYFac_1; // height of the stats box + margin - int bh = ((authortexts[0]!="")?(MiniwiFont.GetHeight()+TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2):(TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2))*CleanYFac_1; // height of the "level finished" box + int th = (TewiFont.GetHeight()*(8+(!!wbs.partime)+(wbs.totaltime!=Plrs[me].stime))+32)*hs; // height of the stats box + margin + int bh = ((authortexts[0]!="")?(MiniwiFont.GetHeight()+TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2):(TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2))*hs; // height of the "level finished" box double xx = Screen.GetWidth()/2; double yy = (Screen.GetHeight()-th)/2; - if ( (Screen.GetHeight()/CleanYFac_1) < 480 ) + // shift up if we overlap w/ tip box + int tipyy = Screen.GetHeight()-max(tipheight,mtipheight)*hs; + int topyy = (Screen.GetHeight()+topheight*hs)/2; + if ( topyy > tipyy ) { // upshift to fit tips - int fct = int(clamp(480-(Screen.GetHeight()/CleanYFac_1),0,80)*.75); - yy -= fct; + yy -= topyy-tipyy; } yy -= bh; String str = StringTable.Localize("$SWWM_INTERDONE"); int bw = max(TewiFont.StringWidth(lnametexts[0])*2,TewiFontOutline.StringWidth(str)*2); if ( authortexts[0] != "" ) bw = max(bw,MiniwiFont.StringWidth(authortexts[0])); bw += 4; - bw *= CleanXFac_1; + bw *= hs; 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; + Screen.DrawText(TewiFont,lnamecolor,xx-TewiFont.StringWidth(lnametexts[0])*hs,yy,lnametexts[0],DTA_ScaleX,hs*2,DTA_ScaleY,hs*2); + yy += TewiFont.GetHeight()*2*hs; if ( authortexts[0] != "" ) { - 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; + Screen.DrawText(MiniwiFont,lauthcolor,xx-MiniwiFont.StringWidth(authortexts[0])*hs/2,yy,authortexts[0],DTA_ScaleX,hs,DTA_ScaleY,hs); + yy += MiniwiFont.GetHeight()*hs; } - Screen.DrawText(TewiFontOutline,lsubcolor,xx-TewiFontOutline.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1*2,DTA_ScaleY,CleanYFac_1*2); + Screen.DrawText(TewiFontOutline,lsubcolor,xx-TewiFontOutline.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs*2,DTA_ScaleY,hs*2); if ( (glarestr > 0) && (sp_state < 2) ) { double alf = clamp((glarestr-FracTic)/20.,0.,1.)**2; - Screen.DrawText(TewiFontOutline,flashcolor,xx-TewiFontOutline.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1*2,DTA_ScaleY,CleanYFac_1*2,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alf); + Screen.DrawText(TewiFontOutline,flashcolor,xx-TewiFontOutline.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs*2,DTA_ScaleY,hs*2,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alf); } return 0; } override void DrawEL() { - int th = (TewiFont.GetHeight()*(8+(!!wbs.partime)+(wbs.totaltime!=Plrs[me].stime))+32)*CleanYFac_1; // height of the stats box + margin - int bh = ((authortexts[1]!="")?(MiniwiFont.GetHeight()+TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2):(TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2))*CleanYFac_1; // height of the "level finished" box + int th = (TewiFont.GetHeight()*(8+(!!wbs.partime)+(wbs.totaltime!=Plrs[me].stime))+32)*hs; // height of the stats box + margin + int bh = ((authortexts[1]!="")?(MiniwiFont.GetHeight()+TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2):(TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2))*hs; // height of the "level finished" box double xx = Screen.GetWidth()/2; double yy = (Screen.GetHeight()+th)/2; - if ( (Screen.GetHeight()/CleanYFac_1) < 480 ) + // shift up if we overlap w/ tip box + int tipyy = Screen.GetHeight()-max(tipheight,mtipheight)*hs; + int topyy = (Screen.GetHeight()+topheight*hs)/2; + if ( topyy > tipyy ) { // upshift to fit tips - int fct = int(clamp(480-(Screen.GetHeight()/CleanYFac_1),0,80)*.75); - yy -= fct; + yy -= topyy-tipyy; } String str = StringTable.Localize("$SWWM_INTERNEXT"); int bw = max(TewiFont.StringWidth(lnametexts[1])*2,TewiFontOutline.StringWidth(str)*2); if ( authortexts[1] != "" ) bw = max(bw,MiniwiFont.StringWidth(authortexts[1])); bw += 4; - bw *= CleanXFac_1; + bw *= hs; 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); + Screen.DrawText(TewiFontOutline,lsubcolor,xx-TewiFontOutline.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs*2,DTA_ScaleY,hs*2); if ( (glarestr > 0) && (sp_state >= 10) ) { double alf = clamp((glarestr-FracTic)/20.,0.,1.)**2; - Screen.DrawText(TewiFontOutline,flashcolor,xx-TewiFontOutline.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1*2,DTA_ScaleY,CleanYFac_1*2,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alf); + Screen.DrawText(TewiFontOutline,flashcolor,xx-TewiFontOutline.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs*2,DTA_ScaleY,hs*2,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alf); } - yy += TewiFontOutline.GetHeight()*2*CleanYFac_1; - Screen.DrawText(TewiFont,lnamecolor,xx-TewiFont.StringWidth(lnametexts[1])*CleanXFac_1,yy,lnametexts[1],DTA_ScaleX,CleanXFac_1*2,DTA_ScaleY,CleanXFac_1*2); - yy += TewiFont.GetHeight()*2*CleanYFac_1; + yy += TewiFontOutline.GetHeight()*2*hs; + Screen.DrawText(TewiFont,lnamecolor,xx-TewiFont.StringWidth(lnametexts[1])*hs,yy,lnametexts[1],DTA_ScaleX,hs*2,DTA_ScaleY,hs*2); + yy += TewiFont.GetHeight()*2*hs; if ( authortexts[0] == "" ) return; - Screen.DrawText(MiniwiFont,lauthcolor,xx-MiniwiFont.StringWidth(authortexts[1])*CleanXFac_1/2,yy,authortexts[1],DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1); + Screen.DrawText(MiniwiFont,lauthcolor,xx-MiniwiFont.StringWidth(authortexts[1])*hs/2,yy,authortexts[1],DTA_ScaleX,hs,DTA_ScaleY,hs); } override void drawStats( void ) { if ( sp_state < 2 ) return; int ne = (sp_state>=8)?(8+(!!wbs.partime)+(wbs.totaltime!=Plrs[me].stime)):(sp_state>=6)?6:(sp_state>=4)?4:2; - int th = (TewiFont.GetHeight()*ne)*CleanYFac_1; // height of the stats box + int th = (TewiFont.GetHeight()*ne)*hs; // height of the stats box double xx = Screen.GetWidth()/2; double yy = (Screen.GetHeight()-th)/2; - if ( (Screen.GetHeight()/CleanYFac_1) < 480 ) + // shift up if we overlap w/ tip box + int tipyy = Screen.GetHeight()-max(tipheight,mtipheight)*hs; + int topyy = (Screen.GetHeight()+topheight*hs)/2; + if ( topyy > tipyy ) { // upshift to fit tips - int fct = int(clamp(480-(Screen.GetHeight()/CleanYFac_1),0,80)*.75); - yy -= fct; + yy -= topyy-tipyy; } - DrawBox(xx-80.*CleanXFac_1,yy,160.*CleanXFac_1,th); + DrawBox(xx-80.*hs,yy,160.*hs,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; + Screen.DrawText(TewiFont,statbasecolor,xx-80*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); + yy += TewiFont.GetHeight()*hs; str = StatCnt(cnt_kills[0],wbs.maxkills); - Screen.DrawText(TewiFont,((wbs.maxkills>0)&&(cnt_kills[0]>=wbs.maxkills))?statcolor1:statcolor0,xx+80*CleanXFac_1-TewiFont.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1); + Screen.DrawText(TewiFont,((wbs.maxkills>0)&&(cnt_kills[0]>=wbs.maxkills))?statcolor1:statcolor0,xx+80*hs-TewiFont.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); if ( sp_state < 4 ) return; - yy += TewiFont.GetHeight()*CleanYFac_1; + yy += TewiFont.GetHeight()*hs; str = StringTable.Localize("$SWWM_INTERITEMS"); - Screen.DrawText(TewiFont,statbasecolor,xx-80*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1); - yy += TewiFont.GetHeight()*CleanYFac_1; + Screen.DrawText(TewiFont,statbasecolor,xx-80*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); + yy += TewiFont.GetHeight()*hs; str = StatCnt(cnt_items[0],wbs.maxitems); - Screen.DrawText(TewiFont,((wbs.maxitems>0)&&(cnt_items[0]>=wbs.maxitems))?statcolor1:statcolor0,xx+80*CleanXFac_1-TewiFont.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1); + Screen.DrawText(TewiFont,((wbs.maxitems>0)&&(cnt_items[0]>=wbs.maxitems))?statcolor1:statcolor0,xx+80*hs-TewiFont.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); if ( sp_state < 6 ) return; - yy += TewiFont.GetHeight()*CleanYFac_1; + yy += TewiFont.GetHeight()*hs; str = StringTable.Localize("$SWWM_INTERSECRETS"); - Screen.DrawText(TewiFont,statbasecolor,xx-80*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1); - yy += TewiFont.GetHeight()*CleanYFac_1; + Screen.DrawText(TewiFont,statbasecolor,xx-80*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); + yy += TewiFont.GetHeight()*hs; str = StatCnt(cnt_secret[0],wbs.maxsecret); - Screen.DrawText(TewiFont,((wbs.maxsecret>0)&&(cnt_secret[0]>=wbs.maxsecret))?statcolor1:statcolor0,xx+80*CleanXFac_1-TewiFont.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1); + Screen.DrawText(TewiFont,((wbs.maxsecret>0)&&(cnt_secret[0]>=wbs.maxsecret))?statcolor1:statcolor0,xx+80*hs-TewiFont.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); if ( sp_state < 8 ) return; - yy += TewiFont.GetHeight()*CleanYFac_1; + yy += TewiFont.GetHeight()*hs; str = "┈┈┄┄╌╌────╌╌┄┄┈┈"; - Screen.DrawText(TewiFont,statbasecolor,xx-TewiFont.StringWidth(str)*CleanXFac_1/2,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1); - yy += TewiFont.GetHeight()*CleanYFac_1; + Screen.DrawText(TewiFont,statbasecolor,xx-TewiFont.StringWidth(str)*hs/2,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); + yy += TewiFont.GetHeight()*hs; str = StringTable.Localize("$SWWM_INTERTIME"); - Screen.DrawText(TewiFont,statbasecolor,xx-80*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1); + Screen.DrawText(TewiFont,statbasecolor,xx-80*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); str = TimeStr(max(cnt_time,0)); - Screen.DrawText(TewiFont,(wbs.partime&&(cnt_time<=(wbs.partime/GameTicRate)))?statcolor1:((wbs.sucktime>0)&&(cnt_time>(wbs.sucktime*3600)))?statcolor2:statcolor0,xx+80*CleanXFac_1-TewiFont.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1); + Screen.DrawText(TewiFont,(wbs.partime&&(cnt_time<=(wbs.partime/GameTicRate)))?statcolor1:((wbs.sucktime>0)&&(cnt_time>(wbs.sucktime*3600)))?statcolor2:statcolor0,xx+80*hs-TewiFont.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); if ( wbs.partime ) { - yy += TewiFont.GetHeight()*CleanYFac_1; + yy += TewiFont.GetHeight()*hs; str = StringTable.Localize("$SWWM_INTERPAR"); - Screen.DrawText(TewiFont,statbasecolor,xx-80*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1); + Screen.DrawText(TewiFont,statbasecolor,xx-80*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); str = TimeStr(max(cnt_par,0)); - Screen.DrawText(TewiFont,statcolor0,xx+80*CleanXFac_1-TewiFont.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1); + Screen.DrawText(TewiFont,statcolor0,xx+80*hs-TewiFont.StringWidth(str)*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); } if ( wbs.totaltime == Plrs[me].stime ) return; - yy += TewiFont.GetHeight()*CleanYFac_1; + yy += TewiFont.GetHeight()*hs; str = StringTable.Localize("$SWWM_INTERTOTAL"); - Screen.DrawText(TewiFont,statbasecolor,xx-80*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1); + Screen.DrawText(TewiFont,statbasecolor,xx-80*hs,yy,str,DTA_ScaleX,hs,DTA_ScaleY,hs); str = TimeStr(max(cnt_total_time,0)); - Screen.DrawText(TewiFont,statcolor0,xx+80*CleanXFac_1-TewiFont.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1); + Screen.DrawText(TewiFont,statcolor0,xx+80*hs-TewiFont.StringWidth(str)*hs,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,hs); } private void drawSWWMBg() @@ -338,34 +360,33 @@ Class SWWMStatScreen : StatusScreen if ( tipl ) tipl.Destroy(); shnd.lasttip.Push(whichtip); } + if ( ((hs != oldhs) || (Screen.GetWidth() != oldwidth)) && tipl ) tipl.Destroy(); + oldhs = hs; + oldwidth = Screen.GetWidth(); + int maxw = min(600,Screen.GetWidth()/hs-48); + if ( !tipl ) tipl = TewiFont.BreakLines(tipstr,maxw); + // height of the entire box plus padding + tipheight = (tipl.Count()*TewiFont.GetHeight()+32); if ( tipalpha <= 0. ) return; double alf = clamp(tipalpha+(tipalphastate*fractic)/GameTicRate,0.,1.); - if ( !tipl ) tipl = TewiFontOutline.BreakLines(tipstr,600); int lw = 0; for ( int i=0; i lw ) lw = tipl.StringWidth(i); - double xx = (Screen.GetWidth()-lw*CleanXFac_1)/2; - double yy = Screen.GetHeight()-60*CleanYFac_1; - if ( (Screen.GetHeight()/CleanYFac_1) < 480 ) - { - // downshift to fit tips - int fct = clamp(480-(Screen.GetHeight()/CleanYFac_1),0,80)/3; - yy += fct; - } - yy -= (tipl.Count()-1)*TewiFontOutline.GetHeight(); + double xx = (Screen.GetWidth()-lw*hs)/2; + double yy = Screen.GetHeight()-(tipheight-16)*hs; 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); + xx -= 8*hs; + DrawBox(xx,yy,(lw+16)*hs,tipl.Count()*TewiFont.GetHeight()*hs,alf); if ( alf < 1. ) return; for ( int i=0; i 0 ) Screen.Dim(glarecolor,(clamp((glarestr-fractic)/20.,0.,1.)**2)*.3,0,0,Screen.GetWidth(),Screen.GetHeight());