diff --git a/FuturePlans.md b/FuturePlans.md index 004d41fb2..0cfbeda0b 100644 --- a/FuturePlans.md +++ b/FuturePlans.md @@ -97,12 +97,6 @@ A couple extra weapons, not enough for a full batch, but still worthy additions. All the hard stuff *(some of these aren't guaranteed)*. -* **Font cleanup *(like in the Common Library)*** - - Remove Japanese fonts, but keep fullwidth alphanumeric support - - Replace default fonts rather than have them separate - - TewiShadedOutline → BigFont/BigUpper - - TewiShaded → SmallFont - - MiniwiShaded → SmallFont2 * **DLC Gameset:** - **[Doom]** Demo Land Adventure *(platformer with shooty gameplay)* - **[Heretic]** Interstellar Demolitionist *(a somewhat simple vertical SHMUP, kinda Touhou styled)* diff --git a/fonts.wad b/fonts.wad index 4b1871f3a..8ed1a28f5 100644 Binary files a/fonts.wad and b/fonts.wad differ diff --git a/language.version b/language.version index 527f7fc03..05fe26c57 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\chSWWM \czGZ\c- \cw1.2pre r80 \cu(Tue 14 Dec 22:45:29 CET 2021)\c-"; -SWWM_SHORTVER="\cw1.2pre r80 \cu(2021-12-14 22:45:29)\c-"; +SWWM_MODVER="\chSWWM \czGZ\c- \cw1.2pre r81 \cu(Thu 16 Dec 22:07:20 CET 2021)\c-"; +SWWM_SHORTVER="\cw1.2pre r81 \cu(2021-12-16 22:07:20)\c-"; diff --git a/zscript/handler/swwm_handler_cheats.zsc b/zscript/handler/swwm_handler_cheats.zsc index e62c9aad0..bbf46cbf0 100644 --- a/zscript/handler/swwm_handler_cheats.zsc +++ b/zscript/handler/swwm_handler_cheats.zsc @@ -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 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 diff --git a/zscript/hud/swwm_hud.zsc b/zscript/hud/swwm_hud.zsc index 60e7a226b..953160d94 100644 --- a/zscript/hud/swwm_hud.zsc +++ b/zscript/hud/swwm_hud.zsc @@ -11,7 +11,6 @@ Class SWWMStatusBar : BaseStatusBar TextureID StatusTex, WeaponTex, ScoreTex[3], InventoryTex, ChatTex[6], HealthTex[6], FuelTex[2], DashTex, EnemyBTex, EnemyHTex[6], GenericAmmoTex[3], MiniBox, AutoPage, PauseTex, bgtex; - HUDFont mTewiFont, mMiniwiFont, mMPlusFont, mk6x8Font; Array MainQueue, PickupQueue; @@ -77,19 +76,6 @@ Class SWWMStatusBar : BaseStatusBar Array teamactive; Array teamscore; - // if playing in Japanese, returns an alternate font of the same height - // Tewi -> MPlus - // Miniwi -> k6x8 - Font LangFont( HUDFont req ) - { - if ( language ~== "jp" ) - { - if ( req == mMiniwiFont ) return mk6x8Font.mFont; - return mMPlusFont.mFont; - } - return req.mFont; - } - override void FlushNotify() { // flush interpolators (useful since this virtual gets called @@ -1165,10 +1151,6 @@ Class SWWMStatusBar : BaseStatusBar PauseTex = TexMan.CheckForTexture("graphics/swwmpause.png",TexMan.Type_Any); bgtex = TexMan.CheckForTexture("graphics/tempbg.png",TexMan.Type_Any); minimapzoom = oldminimapzoom = 1.; - mTewiFont = HUDFont.Create("TewiShaded"); - mMiniwiFont = HUDFont.Create("MiniwiShaded"); - mMPlusFont = HUDFont.Create("MPlusShaded"); - mk6x8Font = HUDFont.Create("k6x8Shaded"); HealthInter = DynamicValueInterpolator.Create(100,.1,1,100); ScoreInter = DynamicValueInterpolator.Create(0,.1,1,999999999); ScoreInter2 = DynamicValueInterpolator.Create(0,.1,1,999999999); @@ -1237,10 +1219,9 @@ Class SWWMStatusBar : BaseStatusBar else tag = String.Format("\cy%s\c-",StringTable.Localize("$SWWM_NEXIT")); } } - Font fnt = LangFont(mMiniwiFont); - Screen.DrawText(fnt,Font.CR_WHITE,(vpos.x-hsi.x*fnt.StringWidth(tag)/2.)/hsi.x,(vpos.y-hsi.y*fnt.GetHeight()/2.)/hsi.y,tag,DTA_VirtualWidthF,ssi.x,DTA_VirtualHeightF,ssi.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,Font.CR_WHITE,(vpos.x-hsi.x*smallfont2.StringWidth(tag)/2.)/hsi.x,(vpos.y-hsi.y*smallfont2.GetHeight()/2.)/hsi.y,tag,DTA_VirtualWidthF,ssi.x,DTA_VirtualHeightF,ssi.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); tag = String.Format("\cu(%s\cu)\c-",FormatDist(tdir.length())); - Screen.DrawText(fnt,Font.CR_WHITE,(vpos.x-hsi.x*fnt.StringWidth(tag)/2.)/hsi.x,(vpos.y+hsi.y*fnt.GetHeight()/2.)/hsi.y,tag,DTA_VirtualWidthF,ssi.x,DTA_VirtualHeightF,ssi.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,Font.CR_WHITE,(vpos.x-hsi.x*smallfont2.StringWidth(tag)/2.)/hsi.x,(vpos.y+hsi.y*smallfont2.GetHeight()/2.)/hsi.y,tag,DTA_VirtualWidthF,ssi.x,DTA_VirtualHeightF,ssi.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); } } // sensed items @@ -1255,18 +1236,17 @@ Class SWWMStatusBar : BaseStatusBar Vector3 ndc = SWWMUtility.ProjectPoint(projdata,ViewPos+tdir); if ( ndc.z >= 1. ) continue; Vector2 vpos = SWWMUtility.NDCToViewport(projdata,ndc); - Font fnt = LangFont(mMiniwiFont); int mtime = thesight?70:35; double alph = clamp(((s.updated+mtime)-(level.maptime+fractic))/35.,0.,1.); alph *= clamp(1.5-1.5*(tdir.length()/(thesight?1200.:800.)),0.,1.); tag = s.tag; - Screen.DrawText(fnt,s.vipitem?Font.CR_PURPLE:s.scoreitem?Font.CR_GOLD:Font.CR_GREEN,(vpos.x-hsd.x*fnt.StringWidth(tag)/2.)/hsd.x,(vpos.y-hsd.y*fnt.GetHeight()/2.)/hsd.y,tag,DTA_VirtualWidthF,ssd.x,DTA_VirtualHeightF,ssd.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,s.vipitem?Font.CR_PURPLE:s.scoreitem?Font.CR_GOLD:Font.CR_GREEN,(vpos.x-hsd.x*smallfont2.StringWidth(tag)/2.)/hsd.x,(vpos.y-hsd.y*smallfont2.GetHeight()/2.)/hsd.y,tag,DTA_VirtualWidthF,ssd.x,DTA_VirtualHeightF,ssd.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); tag = String.Format("\cu(%s\cu)\c-",FormatDist(tdir.length())); - Screen.DrawText(fnt,Font.CR_WHITE,(vpos.x-hsd.x*fnt.StringWidth(tag)/2.)/hsd.x,(vpos.y+hsd.y*fnt.GetHeight()/2.)/hsd.y,tag,DTA_VirtualWidthF,ssd.x,DTA_VirtualHeightF,ssd.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,Font.CR_WHITE,(vpos.x-hsd.x*smallfont2.StringWidth(tag)/2.)/hsd.x,(vpos.y+hsd.y*smallfont2.GetHeight()/2.)/hsd.y,tag,DTA_VirtualWidthF,ssd.x,DTA_VirtualHeightF,ssd.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); if ( s.item is 'SWWMRespawnTimer' ) { tag = String.Format(StringTable.Localize("$SWWM_TRESPAWN"),s.item.special2/GameTicRate); - Screen.DrawText(fnt,Font.CR_WHITE,(vpos.x-hsd.x*fnt.StringWidth(tag)/2.)/hsd.x,(vpos.y+hsd.y*fnt.GetHeight()*2)/hsd.y,tag,DTA_VirtualWidthF,ssd.x,DTA_VirtualHeightF,ssd.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,Font.CR_WHITE,(vpos.x-hsd.x*smallfont2.StringWidth(tag)/2.)/hsd.x,(vpos.y+hsd.y*smallfont2.GetHeight()*2)/hsd.y,tag,DTA_VirtualWidthF,ssd.x,DTA_VirtualHeightF,ssd.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); } } } @@ -1297,7 +1277,7 @@ Class SWWMStatusBar : BaseStatusBar barsiz.y *= hsb.y; Vector2 barpos = vpos-(barsiz/2.); barpos.y -= 16.; - Font fnt = LangFont(swwm_bigtags?mTewiFont:mMiniwiFont); + Font fnt = swwm_bigtags?smallfont:smallfont2; int col = Font.CR_WHITE; if ( teamplay ) { @@ -1376,21 +1356,19 @@ Class SWWMStatusBar : BaseStatusBar fo.y = snum.initialspan-(snum.lifespan-fractic); isscore = true; } - Font fnt = mMiniwiFont.mFont; Vector2 hs0 = isscore?hss:hsn; Vector2 ss0 = isscore?sss:ssn; - Screen.DrawText(fnt,snum.tcolor,(vpos.x-hs0.x*(fo.x+fnt.StringWidth(tag)/2.))/hs0.x,(vpos.y-hs0.y*(fo.y+(fnt.GetHeight()/2.)))/hs0.y,tag,DTA_VirtualWidthF,ss0.x,DTA_VirtualHeightF,ss0.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,snum.tcolor,(vpos.x-hs0.x*(fo.x+smallfont2.StringWidth(tag)/2.))/hs0.x,(vpos.y-hs0.y*(fo.y+(smallfont2.GetHeight()/2.)))/hs0.y,tag,DTA_VirtualWidthF,ss0.x,DTA_VirtualHeightF,ss0.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); // extra strings (if available) if ( !swwm_scorebonus ) continue; - fo.y += fnt.GetHeight(); - fnt = LangFont(mMiniwiFont); + fo.y += smallfont2.GetHeight(); for ( int i=0; i 0 ) tag.AppendFormat(" x%d",snum.xscore[i]); - Screen.DrawText(fnt,snum.xtcolor[i],(vpos.x-hss.x*(fo.x+fnt.StringWidth(tag)/2.))/hss.x,(vpos.y-hss.y*(fo.y+(fnt.GetHeight()/2.)))/hss.y,tag,DTA_VirtualWidthF,sss.x,DTA_VirtualHeightF,sss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - fo.y += fnt.GetHeight(); + Screen.DrawText(smallfont2,snum.xtcolor[i],(vpos.x-hss.x*(fo.x+smallfont2.StringWidth(tag)/2.))/hss.x,(vpos.y-hss.y*(fo.y+(smallfont2.GetHeight()/2.)))/hss.y,tag,DTA_VirtualWidthF,sss.x,DTA_VirtualHeightF,sss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + fo.y += smallfont2.GetHeight(); } } } @@ -1398,8 +1376,7 @@ Class SWWMStatusBar : BaseStatusBar override void DrawMyPos() { String str = String.Format("(%d,%d,%d)",CPlayer.mo.pos.X,CPlayer.mo.pos.Y,CPlayer.mo.pos.Z); - let fnt = LangFont(mMiniwiFont); - Screen.DrawText(fnt,Font.CR_GREEN,(ss.x-fnt.StringWidth(str))/2,4,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont2,Font.CR_GREEN,(ss.x-smallfont2.StringWidth(str))/2,4,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } override void DrawAutomapHUD( double ticFrac ) @@ -2047,7 +2024,7 @@ Class SWWMStatusBar : BaseStatusBar xx -= 6; } Screen.DrawTexture(ScoreTex[2],false,ss.x-(margin+xx),margin,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - Screen.DrawText(mTewiFont.mFont,Font.CR_FIRE,ss.x-(margin+4+6*digits),margin+1,sstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,ss.x-(margin+4+6*digits),margin+1,sstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); int yy = margin+19; // obviously, don't draw the minimap if the automap is open if ( !automapactive && swwm_mm_enable ) @@ -2078,7 +2055,6 @@ Class SWWMStatusBar : BaseStatusBar { xx = int(ss.x-(margin+2)); String str; - Font fnt; if ( automapactive || (fstats > 1) ) { int label = am_showmaplabel; @@ -2087,44 +2063,42 @@ Class SWWMStatusBar : BaseStatusBar if ( iof != -1 ) ln.Truncate(iof); if ( !label || ((level.clusterflags&level.CLUSTER_HUB) && (label == 2)) ) str = ln; else str = String.Format("%s - %s",level.mapname.MakeUpper(),ln); - fnt = LangFont(mTewiFont); - Screen.DrawText(fnt,Font.CR_FIRE,xx-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - yy += fnt.GetHeight(); + Screen.DrawText(smallfont,Font.CR_FIRE,xx-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + yy += smallfont.GetHeight(); } - fnt = LangFont(mMiniwiFont); if ( (level.total_monsters > 0) && am_showmonsters && !deathmatch ) { str = String.Format("\cxK \c-%d\cu/\c-%d",level.killed_monsters,level.total_monsters); - Screen.DrawText(fnt,(level.killed_monsters>=level.total_monsters)?Font.CR_GOLD:Font.CR_WHITE,xx-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - yy += fnt.GetHeight(); + Screen.DrawText(smallfont2,(level.killed_monsters>=level.total_monsters)?Font.CR_GOLD:Font.CR_WHITE,xx-smallfont2.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + yy += smallfont2.GetHeight(); } if ( (level.total_items > 0) && am_showitems && !deathmatch ) { str = String.Format("\cxI \c-%d\cu/\c-%d",level.found_items,level.total_items); - Screen.DrawText(fnt,(level.found_items>=level.total_items)?Font.CR_GOLD:Font.CR_WHITE,xx-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - yy += fnt.GetHeight(); + Screen.DrawText(smallfont2,(level.found_items>=level.total_items)?Font.CR_GOLD:Font.CR_WHITE,xx-smallfont2.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + yy += smallfont2.GetHeight(); } if ( (level.total_secrets > 0) && am_showsecrets && !deathmatch ) { str = String.Format("\cxS \c-%d\cu/\c-%d",level.found_secrets,level.total_secrets); - Screen.DrawText(fnt,(level.found_secrets>=level.total_secrets)?Font.CR_GOLD:Font.CR_WHITE,xx-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - yy += fnt.GetHeight(); + Screen.DrawText(smallfont2,(level.found_secrets>=level.total_secrets)?Font.CR_GOLD:Font.CR_WHITE,xx-smallfont2.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + yy += smallfont2.GetHeight(); } int sec; if ( am_showtime ) { sec = Thinker.Tics2Seconds(level.maptime); str = String.Format("\cxT \c-%02d\cu:\c-%02d\cu:\c-%02d",sec/3600,(sec%3600)/60,sec%60); - Screen.DrawText(fnt,((level.sucktime>0)&&(sec>=(level.sucktime*3600)))?Font.CR_RED:(sec<=level.partime)?Font.CR_GOLD:Font.CR_WHITE,xx-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - yy += fnt.GetHeight(); + Screen.DrawText(smallfont2,((level.sucktime>0)&&(sec>=(level.sucktime*3600)))?Font.CR_RED:(sec<=level.partime)?Font.CR_GOLD:Font.CR_WHITE,xx-smallfont2.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + yy += smallfont2.GetHeight(); } // don't show total time if it's equal to map time if ( am_showtotaltime && (level.totaltime != level.maptime) ) { sec = Thinker.Tics2Seconds(level.totaltime); str = String.Format("\cxTT \c-%02d\cu:\c-%02d\cu:\c-%02d",sec/3600,(sec%3600)/60,sec%60); - Screen.DrawText(fnt,Font.CR_WHITE,xx-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - yy += fnt.GetHeight(); + Screen.DrawText(smallfont2,Font.CR_WHITE,xx-smallfont2.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + yy += smallfont2.GetHeight(); } yy += 3; } @@ -2134,7 +2108,6 @@ Class SWWMStatusBar : BaseStatusBar if ( playercount <= 1 ) return; xx = int(ss.x-(margin+2)); String str; - Font fnt = LangFont(mTewiFont); if ( teamplay ) { // draw team scores @@ -2142,8 +2115,8 @@ Class SWWMStatusBar : BaseStatusBar { if ( !teamactive[i] ) continue; str = String.Format("\cx%s \c-%d",Teams[i].mName,teamscore[i]); - Screen.DrawText(fnt,Font.CR_WHITE,xx-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - yy += fnt.GetHeight(); + Screen.DrawText(smallfont,Font.CR_WHITE,xx-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + yy += smallfont.GetHeight(); } } else @@ -2151,19 +2124,19 @@ Class SWWMStatusBar : BaseStatusBar // draw rank and spread like in UT if ( tiedscore ) str = String.Format("\cx%s \cg%d\cr/\cg%d\c-",StringTable.Localize("$SWWM_DMRANK"),rank,playercount); else str = String.Format("\cx%s \cj%d\cu/\cj%d\c-",StringTable.Localize("$SWWM_DMRANK"),rank,playercount); - Screen.DrawText(fnt,Font.CR_WHITE,xx-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - yy += fnt.GetHeight(); + Screen.DrawText(smallfont,Font.CR_WHITE,xx-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + yy += smallfont.GetHeight(); if ( lead > 0 ) str = String.Format("\cx%s \cj+%d\c-",StringTable.Localize("$SWWM_DMSPREAD"),lead); else str = String.Format("\cx%s \cj%d\c-",StringTable.Localize("$SWWM_DMSPREAD"),lead); - Screen.DrawText(fnt,Font.CR_WHITE,xx-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - yy += fnt.GetHeight()+3; + Screen.DrawText(smallfont,Font.CR_WHITE,xx-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + yy += smallfont.GetHeight()+3; // draw top 3 players for ( int i=0; i 99999) && !forceamt ) nstr = "99999"; else nstr = String.Format("%d",i.Amount); - int len = mTewiFont.mFont.StringWidth(nstr); - Screen.DrawText(mTewiFont.mFont,Font.CR_FIRE,(xx+30)-len,(yy+30)-11,nstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha); + int len = smallfont.StringWidth(nstr); + Screen.DrawText(smallfont,Font.CR_FIRE,(xx+30)-len,(yy+30)-11,nstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha); } return true; } @@ -2351,7 +2324,7 @@ Class SWWMStatusBar : BaseStatusBar Screen.DrawTexture(GenericAmmoTex[1],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } Screen.DrawTexture(GenericAmmoTex[0],false,xx-3,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - Screen.DrawText(mTewiFont.mFont,Font.CR_FIRE,xx,yy,astr2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,xx,yy,astr2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); yy += 14; } xx = ss.x-(margin+13); @@ -2364,7 +2337,7 @@ Class SWWMStatusBar : BaseStatusBar Screen.DrawTexture(GenericAmmoTex[1],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } Screen.DrawTexture(GenericAmmoTex[0],false,xx-3,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - Screen.DrawText(mTewiFont.mFont,Font.CR_FIRE,xx,yy,astr1,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,xx,yy,astr1,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } } Screen.DrawTexture(WeaponTex,false,ss.x-(margin+60),ss.y-(margin+28),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); @@ -2402,7 +2375,7 @@ Class SWWMStatusBar : BaseStatusBar } if ( !hasammo ) ncolor = Font.CR_RED; } - Screen.DrawText(mTewiFont.mFont,ncolor,xx,yy,String.Format("%d",(i%10)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,ncolor,xx,yy,String.Format("%d",(i%10)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); xx += 12; if ( i == 5 ) { @@ -2464,17 +2437,16 @@ Class SWWMStatusBar : BaseStatusBar tst = "AAA"; SWWMUtility.ObscureText(tst,(gametic-trl)/3); trl--; - Screen.DrawText(mTewiFont.mFont,Font.CR_WHITE,margin+108,ss.y-(margin+15),tst,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,falph*alph,DTA_LegacyRenderStyle,STYLE_Add); + Screen.DrawText(smallfont,Font.CR_WHITE,margin+108,ss.y-(margin+15),tst,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,falph*alph,DTA_LegacyRenderStyle,STYLE_Add); } - Screen.DrawText(mTewiFont.mFont,hcolor,margin+108,ss.y-(margin+15),String.Format("%3d",clamp(ht,0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,1.-falph); + Screen.DrawText(smallfont,hcolor,margin+108,ss.y-(margin+15),String.Format("%3d",clamp(ht,0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,1.-falph); } - else Screen.DrawText(mTewiFont.mFont,hcolor,margin+108,ss.y-(margin+15),String.Format("%3d",clamp(ht,0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + else Screen.DrawText(smallfont,hcolor,margin+108,ss.y-(margin+15),String.Format("%3d",clamp(ht,0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } private void DrawPickups() { - Font fnt = LangFont(mTewiFont); - int h = fnt.GetHeight(); + int h = smallfont.GetHeight(); // draw nametags below them double yy; double nalph = 0.; @@ -2485,10 +2457,10 @@ Class SWWMStatusBar : BaseStatusBar yy = ss.y-(margin+50); // shift up if boss healthbar is present if ( hnd && (hnd.bossalpha > 0.) ) yy -= int(25*clamp(hnd.bossalpha*2.,0.,1.)); - int len = fnt.StringWidth(ntagstr); + int len = smallfont.StringWidth(ntagstr); double xx = (ss.x-len)/2.; Screen.Dim("Black",.8*nalph,int((xx-6)*hs.x),int(yy*hs.y),int((len+12)*hs.x),int((h+4)*hs.y)); - Screen.DrawText(fnt,ntagcol,int(xx),yy+2,ntagstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,nalph); + Screen.DrawText(smallfont,ntagcol,int(xx),yy+2,ntagstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,nalph); } if ( PickupQueue.Size() <= 0 ) return; // reverse order since they're drawn bottom to top @@ -2497,27 +2469,27 @@ Class SWWMStatusBar : BaseStatusBar // shift up if boss healthbar is present if ( hnd && (hnd.bossalpha > 0.) ) yy -= int(25*clamp(hnd.bossalpha*2.,0.,1.)); // shift up again if nametag is present - if ( nalph > 0. ) yy -= int((fnt.GetHeight()+6)*clamp(nalph*2.,0.,1.)); + if ( nalph > 0. ) yy -= int((smallfont.GetHeight()+6)*clamp(nalph*2.,0.,1.)); for ( int i=PickupQueue.Size()-1; i>=mend; i-- ) { String cstr = PickupQueue[i].str; if ( PickupQueue[i].rep > 1 ) cstr.AppendFormat(" (x%d)",PickupQueue[i].rep); double curtime = (PickupQueue[i].tic+GameTicRate*swwm_pickduration)-(level.totaltime+fractic); double alph = clamp(curtime/20.,0.,1.); - BrokenLines l = fnt.BreakLines(cstr,int(ss.x*.75)); + BrokenLines l = smallfont.BreakLines(cstr,int(ss.x*.75)); int maxlen = 0; for ( int j=0; j maxlen ) maxlen = len; } double xx = (ss.x-maxlen)/2.; Screen.Dim("Black",.8*alph,int((xx-6)*hs.x),int((yy-h*(l.Count()-1))*hs.y),int((maxlen+12)*hs.x),int((h*l.Count()+4)*hs.y)); for ( int j=l.Count()-1; j>=0; j-- ) { - int len = fnt.StringWidth(l.StringAt(j)); + int len = smallfont.StringWidth(l.StringAt(j)); xx = int((ss.x-len)/2.); - Screen.DrawText(fnt,msg0color,xx,yy+2,l.StringAt(j),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph); + Screen.DrawText(smallfont,msg0color,xx,yy+2,l.StringAt(j),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph); yy -= h; } l.Destroy(); @@ -2527,7 +2499,6 @@ Class SWWMStatusBar : BaseStatusBar private void DrawMessages( double boxalph = 1. ) { - Font fnt = LangFont(mTewiFont); double xx, yy; if ( midstr != "" ) { @@ -2536,19 +2507,19 @@ Class SWWMStatusBar : BaseStatusBar int col = (midtype&2)?msgmidcolor2:msgmidcolor; double curtime = (midtic+int(GameTicRate*con_midtime))-(level.totaltime+fractic); double alph = clamp(curtime/20.,0.,1.); - BrokenLines l = fnt.BreakLines(midstr,int(ss.x*ssp)); - int h = fnt.GetHeight(); + BrokenLines l = smallfont.BreakLines(midstr,int(ss.x*ssp)); + int h = smallfont.GetHeight(); int maxlen = 0; - for ( int i=0; i ss.x-4 ) { // draw trailing dots - Screen.DrawText(fnt,Font.CR_WHITE,xx,yy,"...",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_WHITE,xx,yy,"...",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); // shift back xx -= w-(ss.x-4); // draw trimmed - Screen.DrawText(fnt,Font.CR_WHITE,xx,yy,fullstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ClipLeft,int(26*hs.x)); + Screen.DrawText(smallfont,Font.CR_WHITE,xx,yy,fullstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ClipLeft,int(26*hs.x)); } - else Screen.DrawText(fnt,Font.CR_WHITE,xx,yy,fullstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + else Screen.DrawText(smallfont,Font.CR_WHITE,xx,yy,fullstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); return true; } @@ -2625,12 +2595,11 @@ Class SWWMStatusBar : BaseStatusBar Screen.DrawTexture(PauseTex,false,Screen.GetWidth()/2,Screen.GetHeight()/2,DTA_CleanNoMove,true,DTA_CenterOffset,true); if ( multiplayer && (player != -1) ) { - Font fnt = LangFont(mTewiFont); String str = String.Format(StringTable.Localize("$TXT_BY"),players[player].GetUserName()); Vector2 sz = TexMan.GetScaledSize(PauseTex); - double xx = (Screen.GetWidth()-fnt.StringWidth(str)*CleanXFac)/2; + double xx = (Screen.GetWidth()-smallfont.StringWidth(str)*CleanXFac)/2; double yy = (Screen.GetHeight()+(sz.y+4)*CleanYFac)/2; - Screen.DrawText(fnt,Font.CR_WHITE,xx,yy,str,DTA_CleanNoMove,true); + Screen.DrawText(smallfont,Font.CR_WHITE,xx,yy,str,DTA_CleanNoMove,true); } // TODO draw something extra to make the screen more visually interesting, maybe return true; @@ -2651,7 +2620,6 @@ Class SWWMStatusBar : BaseStatusBar double alph; int len; double xx, yy; - Font fnt; double deadtimer = (goner?goner.deadtimer:demo.deadtimer)+fractic; if ( goner || (demo.player.viewheight <= 6) ) { @@ -2661,56 +2629,51 @@ Class SWWMStatusBar : BaseStatusBar { Screen.Dim("Red",clamp((demo.revivefail-(level.maptime+fractic))/60.,0.,.2),0,0,Screen.GetWidth(),Screen.GetHeight()); str = StringTable.Localize("$SWWM_REFAIL"); - fnt = LangFont(mTewiFont); - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); xx = int((ss.x-len)/2.); yy = ss.y-48; if ( ((demo.revivefail-level.maptime)%16) < 8 ) - Screen.DrawText(fnt,Font.CR_RED,xx,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_RED,xx,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } alph = clamp((deadtimer-60)/60.,0.,1.); String nam = CPlayer.GetUserName(); if ( nam == "Player" ) str = StringTable.Localize("$SWWM_URDED_GEN"); else str = String.Format(StringTable.Localize("$SWWM_URDED"),nam); - fnt = LangFont(mTewiFont); - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); xx = int((ss.x-len)/2.); - yy = (ss.y-fnt.GetHeight()*4)/2.; + yy = (ss.y-smallfont.GetHeight()*4)/2.; // shift down if scoreboard is shown if ( (deathmatch && sb_deathmatch_enable && (!teamplay || sb_teamdeathmatch_enable)) || (multiplayer && sb_cooperative_enable) ) - yy += ss.y/3.+fnt.GetHeight(); - Screen.DrawText(fnt,Font.CR_RED,xx,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph); + yy += ss.y/3.+smallfont.GetHeight(); + Screen.DrawText(smallfont,Font.CR_RED,xx,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph); if ( multiplayer || level.AllowRespawn || sv_singleplayerrespawn || G_SkillPropertyInt(SKILLP_PlayerRespawn) ) { if ( sv_norespawn ) return (1.-dimalph); alph = clamp((deadtimer-90)/60.,0.,1.); str = String.Format(StringTable.Localize("$SWWM_URDEDMP")); - fnt = LangFont(mTewiFont); - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); xx = int((ss.x-len)/2.); yy = ss.y/2.; // shift down if scoreboard is shown if ( (deathmatch && sb_deathmatch_enable && (!teamplay || sb_teamdeathmatch_enable)) || (multiplayer && sb_cooperative_enable) ) yy += ss.y/3.; - Screen.DrawText(fnt,Font.CR_WHITE,xx,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph); + Screen.DrawText(smallfont,Font.CR_WHITE,xx,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph); return (1.-dimalph); } alph = clamp((deadtimer-140)/60.,0.,1.); str = String.Format(StringTable.Localize("$SWWM_URDED2")); - fnt = LangFont(mTewiFont); - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); xx = int((ss.x-len)/2.); yy = ss.y/2.; - Screen.DrawText(fnt,Font.CR_WHITE,xx,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph); + Screen.DrawText(smallfont,Font.CR_WHITE,xx,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph); if ( goner || !swwm_revive ) return (1.-dimalph); alph = clamp((deadtimer-160)/60.,0.,1.); str = String.Format(StringTable.Localize("$SWWM_URDED3")); - fnt = LangFont(mTewiFont); - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); xx = int((ss.x-len)/2.); - yy = (ss.y+fnt.GetHeight()*2)/2.; - Screen.DrawText(fnt,Font.CR_WHITE,xx,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph); + yy = (ss.y+smallfont.GetHeight()*2)/2.; + Screen.DrawText(smallfont,Font.CR_WHITE,xx,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph); return (1.-dimalph); } return 1.; diff --git a/zscript/hud/swwm_hudextra.zsc b/zscript/hud/swwm_hudextra.zsc index 48059c812..effbc79a8 100644 --- a/zscript/hud/swwm_hudextra.zsc +++ b/zscript/hud/swwm_hudextra.zsc @@ -5,7 +5,6 @@ Class PayRespects : HUDMessageBase { Vector2 basepos; int lifespan, initialspan, starttic; - transient Font TewiFont; double scale; Vector2 hs, ss; int seed, seed2; @@ -39,8 +38,7 @@ Class PayRespects : HUDMessageBase override void Draw( int bottom, int visibility ) { Vector2 realpos = (basepos.x*ss.x,basepos.y*ss.y); - if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded'); - Vector2 fo = (TewiFont.StringWidth("F")/2.,-TewiFont.GetHeight()); + Vector2 fo = (smallfont.StringWidth("F")/2.,-smallfont.GetHeight()); // F rise up int initspd = (128-seed); if ( (initspd >= 0) && (initspd < 32) ) initspd = 32; @@ -50,7 +48,7 @@ Class PayRespects : HUDMessageBase fo.x += (.15*initspd)*((initialspan-(lifespan-fractic))**.6); fo.y += ((initialspan-(lifespan-fractic))**1.6)-boostup*sin((90./initialspan)*(level.maptime+fractic-starttic)); double alph = clamp((lifespan+fractic)/double(initialspan),0.,1.); - Screen.DrawText(TewiFont,Font.CR_GREEN,realpos.x-fo.x,realpos.y-fo.y,"F",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph); + Screen.DrawText(smallfont,Font.CR_GREEN,realpos.x-fo.x,realpos.y-fo.y,"F",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph); } } @@ -59,7 +57,6 @@ Class SWWMOneLiner : HUDMessageBase { String whichline; int lifespan, curtime; - transient Font TewiFont, MPlusFont; static SWWMOneLiner Make( String whichline, int lifespan ) { @@ -78,8 +75,6 @@ Class SWWMOneLiner : HUDMessageBase override void Draw( int bottom, int visibility ) { - if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded'); - if ( !MPlusFont ) MPlusFont = Font.GetFont('MPlusShaded'); int margin = swwm_hudmargin; Vector2 hs; if ( swwm_hudscale <= 0 ) hs = StatusBar.GetHUDScale(); @@ -89,17 +84,15 @@ Class SWWMOneLiner : HUDMessageBase String loc = StringTable.Localize(whichline); if ( loc.Length() <= 0 ) return; // don't draw empty strings String locs = StringTable.Localize("$SWWM_LQUOTE")..loc..StringTable.Localize("$SWWM_RQUOTE"); - Font fnt = TewiFont; - if ( language ~== "jp" ) fnt = MPlusFont; // split so it can fit - BrokenLines l = fnt.BreakLines(locs,int(ss.x*.5)); + BrokenLines l = smallfont.BreakLines(locs,int(ss.x*.5)); int maxlen = 0; for ( int i=0; i maxlen ) maxlen = len; } - int h = fnt.GetHeight(); + int h = smallfont.GetHeight(); int fh = h*l.Count(); double fractic = SWWMStatusBar(statusbar)?SWWMStatusBar(statusbar).fractic:0; double fcurtime = curtime-fractic; @@ -109,8 +102,8 @@ Class SWWMOneLiner : HUDMessageBase int yy = margin+fh; for ( int i=0; i w ) w = lw; } int cw = int(ceil((max(max(w1,w2),w)+8)/6.))*6; - Screen.Dim("Black",.5*alpha,int((pos.x-(cw+4)/2)*hs.x),int((pos.y-(h+6))*hs.y),int((cw+4)*hs.x),int((8+h+4+fnt.GetHeight()+8+fnt2.GetHeight()*l.Count())*hs.y)); + Screen.Dim("Black",.5*alpha,int((pos.x-(cw+4)/2)*hs.x),int((pos.y-(h+6))*hs.y),int((cw+4)*hs.x),int((8+h+4+smallfont.GetHeight()+8+smallfont2.GetHeight()*l.Count())*hs.y)); Screen.DrawTexture(icon,false,pos.x,pos.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_CenterBottomOffset,true); pos.y += 4; - Screen.DrawText(fnt,Font.CR_FIRE,pos.x-w1/2,pos.y,wpn,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha); + Screen.DrawText(smallfont,Font.CR_FIRE,pos.x-w1/2,pos.y,wpn,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha); for ( int i=0; i seqcnt) ) return; EventHandler.SendNetworkEvent("swwmstoremessage."..chrname..": "..txt,level.totaltime,PRINT_CHAT,consoleplayer); @@ -403,8 +368,6 @@ Class SWWMDirectMessage : HUDMessageBase private void DrawText() { - if ( !fnt ) fnt = Font.GetFont('TewiShaded'); - if ( !jpfnt ) jpfnt = Font.GetFont('MPlusShaded'); if ( !l ) SetText(); int cur = charcnt; Vector2 pos = origin+(47,2); @@ -412,7 +375,7 @@ Class SWWMDirectMessage : HUDMessageBase { if ( cur <= 0 ) break; String part = l.StringAt(i).Left(cur); - Screen.DrawText((language~=="jp")?jpfnt:fnt,Font.CR_WHITE,pos.x,pos.y,part,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_WHITE,pos.x,pos.y,part,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); pos.y += 13; cur -= l.StringAt(i).Length(); } diff --git a/zscript/kbase/swwm_kbase.zsc b/zscript/kbase/swwm_kbase.zsc index c31e3f8ed..a55f96f56 100644 --- a/zscript/kbase/swwm_kbase.zsc +++ b/zscript/kbase/swwm_kbase.zsc @@ -35,8 +35,6 @@ enum EKMouseButton Class DemolitionistMenu : GenericMenu { - Font TewiFont, MPlusFont, MiniwiFont, k6x8Font; - Font LargeFont, SmallFont; TextureID FancyBg, FrameTex, VSepTex, HSepTex; // for resolution scaling and such double hs; @@ -169,20 +167,6 @@ Class DemolitionistMenu : GenericMenu else if ( th >= 360. ) ws.y = 360.; else ws.y = 266.;*/ origin = (int(ss.x-ws.x)/2,int(ss.y-ws.y)/2); - TewiFont = Font.GetFont('TewiShaded'); - MPlusFont = Font.GetFont('MPlusShaded'); - MiniwiFont = Font.GetFont('MiniwiShaded'); - k6x8Font = Font.GetFont('k6x8Shaded'); - if ( language ~== "jp" ) - { - LargeFont = MPlusFont; - SmallFont = k6x8Font; - } - else - { - LargeFont = TewiFont; - SmallFont = MiniwiFont; - } MenuSound("menu/demoopen"); [ikey[0], ikey[1]] = Bindings.GetKeysForCommand("event swwmdemomenu"); mkey[0] = Bindings.NameKeys(ikey[0],0); @@ -368,7 +352,7 @@ Class DemolitionistMenu : GenericMenu { if ( tabs[i].bHidden ) continue; str = StringTable.Localize(tabs[i].title); - len = LargeFont.StringWidth(str)+6; + len = smallfont.StringWidth(str)+6; if ( (mpos.x >= xx) && (mpos.x < xx+len) ) { if ( curtab == i ) break; @@ -541,23 +525,23 @@ Class DemolitionistMenu : GenericMenu { if ( tabs[i].bHidden ) continue; str = StringTable.Localize(tabs[i].title); - Screen.DrawText(LargeFont,(curtab==i)?Font.CR_FIRE:Font.CR_DARKGRAY,origin.x+xx,origin.y+yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - xx += LargeFont.StringWidth(str)+6; + Screen.DrawText(smallfont,(curtab==i)?Font.CR_FIRE:Font.CR_DARKGRAY,origin.x+xx,origin.y+yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + xx += smallfont.StringWidth(str)+6; DrawVSeparator(xx-3,0,14); } // draw money - xx = 637-TewiFont.StringWidth(munstr); - Screen.DrawText(TewiFont,Font.CR_FIRE,origin.x+xx,origin.y+yy,munstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + xx = 637-smallfont.StringWidth(munstr); + Screen.DrawText(smallfont,Font.CR_FIRE,origin.x+xx,origin.y+yy,munstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); yy = ws.y-14; // draw clock / messages if ( gametic < tmsgtic ) str = tmsg; else str = clockstr; xx = 4; - Screen.DrawText(LargeFont,Font.CR_WHITE,origin.x+xx,origin.y+yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_WHITE,origin.x+xx,origin.y+yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); // draw os version str = "DemolitionOS v1.0"; - xx = 637-LargeFont.StringWidth(str); - Screen.DrawText(LargeFont,Font.CR_WHITE,origin.x+xx,origin.y+yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + xx = 637-smallfont.StringWidth(str); + Screen.DrawText(smallfont,Font.CR_WHITE,origin.x+xx,origin.y+yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); // draw tab contents if ( (tabs.Size() <= 0) || (curtab == -1) || !tabs[curtab] ) return; tabs[curtab].Drawer(); diff --git a/zscript/kbase/swwm_kbase_list.zsc b/zscript/kbase/swwm_kbase_list.zsc index cb7f2c6a2..bfcba218b 100644 --- a/zscript/kbase/swwm_kbase_list.zsc +++ b/zscript/kbase/swwm_kbase_list.zsc @@ -72,12 +72,12 @@ Class DemolitionistMenuListItem ui virtual int GetWidth() { - return master.LargeFont.StringWidth(label); + return smallfont.StringWidth(label); } virtual int GetHeight() { - return master.LargeFont.GetHeight(); + return smallfont.GetHeight(); } // checks if the mouse position is within bounds of the item @@ -98,7 +98,7 @@ Class DemolitionistMenuListItem ui virtual void Drawer( Vector2 pos, bool selected, int cliptop, int clipbottom, int clipleft, int clipright ) { - Screen.DrawText(master.LargeFont,selected?Font.CR_FIRE:Font.CR_WHITE,master.origin.x+pos.x,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont,selected?Font.CR_FIRE:Font.CR_WHITE,master.origin.x+pos.x,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); } } @@ -125,9 +125,9 @@ Class DemolitionistMenuKillItem : DemolitionistMenuListItem override void Drawer( Vector2 pos, bool selected, int cliptop, int clipbottom, int clipleft, int clipright ) { - Screen.DrawText(master.LargeFont,Font.CR_FIRE,master.origin.x+pos.x,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont,Font.CR_FIRE,master.origin.x+pos.x,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); String str = String.Format("%d",s.kills); - Screen.DrawText(master.LargeFont,Font.CR_WHITE,master.origin.x+pos.x+width-master.LargeFont.StringWidth(str),master.origin.y+pos.y,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont,Font.CR_WHITE,master.origin.x+pos.x+width-smallfont.StringWidth(str),master.origin.y+pos.y,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); } } @@ -151,26 +151,26 @@ Class DemolitionistMenuMapStatItem : DemolitionistMenuListItem { String str = label; if ( selected ) str = "\cd▸\c- "..str; - bool smallname = master.LargeFont.StringWidth(str)>(width-(maxlen[3]+maxlen[2]+maxlen[1]+maxlen[0]+24)); - Screen.DrawText(smallname?master.SmallFont:master.LargeFont,Font.CR_FIRE,master.origin.x+pos.x,master.origin.y+pos.y+smallname*2,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + bool smallname = smallfont.StringWidth(str)>(width-(maxlen[3]+maxlen[2]+maxlen[1]+maxlen[0]+24)); + Screen.DrawText(smallname?smallfont2:smallfont,Font.CR_FIRE,master.origin.x+pos.x,master.origin.y+pos.y+smallname*2,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); double xx = pos.x+width; double yy = pos.y+2; int sec = Thinker.Tics2Seconds(s.time); str = String.Format("%02d\cu:\c-%02d\cu:\c-%02d",sec/3600,(sec%3600)/60,sec%60); - Screen.DrawText(master.SmallFont,((s.suck>0)&&(sec>=(s.suck*3600)))?Font.CR_RED:(sec<=s.par)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-master.SmallFont.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - Screen.DrawText(master.SmallFont,Font.CR_FIRE,master.origin.x+xx-maxlen[0],master.origin.y+yy,"T",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,((s.suck>0)&&(sec>=(s.suck*3600)))?Font.CR_RED:(sec<=s.par)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-smallfont2.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,Font.CR_FIRE,master.origin.x+xx-maxlen[0],master.origin.y+yy,"T",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); xx -= maxlen[0]+8; str = String.Format("%d\cu/\c-%d",s.scount,s.stotal); - Screen.DrawText(master.SmallFont,(s.scount>=s.stotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-master.SmallFont.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - Screen.DrawText(master.SmallFont,Font.CR_FIRE,master.origin.x+xx-maxlen[1],master.origin.y+yy,"S",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,(s.scount>=s.stotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-smallfont2.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,Font.CR_FIRE,master.origin.x+xx-maxlen[1],master.origin.y+yy,"S",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); xx -= maxlen[1]+8; str = String.Format("%d\cu/\c-%d",s.icount,s.itotal); - Screen.DrawText(master.SmallFont,(s.icount>=s.itotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-master.SmallFont.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - Screen.DrawText(master.SmallFont,Font.CR_FIRE,master.origin.x+xx-maxlen[2],master.origin.y+yy,"I",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,(s.icount>=s.itotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-smallfont2.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,Font.CR_FIRE,master.origin.x+xx-maxlen[2],master.origin.y+yy,"I",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); xx -= maxlen[2]+8; str = String.Format("%d\cu/\c-%d",s.kcount,s.ktotal); - Screen.DrawText(master.SmallFont,(s.kcount>=s.ktotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-master.SmallFont.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - Screen.DrawText(master.SmallFont,Font.CR_FIRE,master.origin.x+xx-maxlen[3],master.origin.y+yy,"K",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,(s.kcount>=s.ktotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-smallfont2.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,Font.CR_FIRE,master.origin.x+xx-maxlen[3],master.origin.y+yy,"K",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); } } diff --git a/zscript/kbase/swwm_kbase_tab.zsc b/zscript/kbase/swwm_kbase_tab.zsc index 03f4490c7..cd41acee7 100644 --- a/zscript/kbase/swwm_kbase_tab.zsc +++ b/zscript/kbase/swwm_kbase_tab.zsc @@ -42,9 +42,8 @@ Class DemolitionistMenuTab ui abstract virtual void Drawer() { // placeholder (so don't call super) - Font fnt = master.LargeFont; String str = "NOT IMPLEMENTED"; - Screen.DrawText(fnt,Font.CR_RED,int(master.ss.x-fnt.StringWidth(str))/2,int(master.ss.y-fnt.GetHeight())/2,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_RED,int(master.ss.x-smallfont.StringWidth(str))/2,int(master.ss.y-smallfont.GetHeight())/2,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); } } diff --git a/zscript/kbase/swwm_kbase_textbox.zsc b/zscript/kbase/swwm_kbase_textbox.zsc index 2ec44fe06..3828227e2 100644 --- a/zscript/kbase/swwm_kbase_textbox.zsc +++ b/zscript/kbase/swwm_kbase_textbox.zsc @@ -21,13 +21,12 @@ Class DemolitionistMenuTextBox ui else self.txt = txt; ofs = 0; // break lines - let fnt = master.LargeFont; - l = fnt.BreakLines(self.txt,self.w-12); + l = smallfont.BreakLines(self.txt,self.w-12); int h = l.Count()*13; if ( h > (master.ws.y-34) ) { l.Destroy(); - l = fnt.BreakLines(self.txt,self.w-20); + l = smallfont.BreakLines(self.txt,self.w-20); scrollbar = true; maxofs = int((l.Count()*13)-(master.ws.y-34)); } @@ -71,19 +70,18 @@ Class DemolitionistMenuTextBox ui double yy = 17-smofs; int miny = int((master.origin.y+17)*master.hs); int maxy = int((master.origin.y+(master.ws.y-17))*master.hs); - let fnt = master.LargeFont; for ( int i=0; i= master.ws.y-17 ) continue; - Screen.DrawText(master.LargeFont,Font.CR_WHITE,master.origin.x+xx,master.origin.y+yy,l.StringAt(i),DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,dark?Color(96,0,0,0):Color(0,0,0,0),DTA_ClipTop,miny,DTA_ClipBottom,maxy); + Screen.DrawText(smallfont,Font.CR_WHITE,master.origin.x+xx,master.origin.y+yy,l.StringAt(i),DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,dark?Color(96,0,0,0):Color(0,0,0,0),DTA_ClipTop,miny,DTA_ClipBottom,maxy); } if ( !scrollbar ) return; xx = x+(w-8); master.DrawVSeparator(xx,14,master.ws.y-28); xx += 2; yy = floor(smofs*((master.ws.y-39)/maxofs))+13; - Screen.DrawText(master.TewiFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,"▮",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,"▮",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); } } diff --git a/zscript/kbase/swwm_kbasetab_mission.zsc b/zscript/kbase/swwm_kbasetab_mission.zsc index 3e555b6a5..3c76e4da3 100644 --- a/zscript/kbase/swwm_kbasetab_mission.zsc +++ b/zscript/kbase/swwm_kbasetab_mission.zsc @@ -241,7 +241,7 @@ Class DemolitionistMissionTab : DemolitionistMenuTab double xx = master.ws.x-(mtext[sel].scrollbar?11:3); double yy = master.ws.y-25; String str = String.Format("%d \cf/\c- %d",sel+1,mtext.Size()); - Screen.DrawText(master.MiniwiFont,Font.CR_FIRE,(master.origin.x+xx)-master.MiniwiFont.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont2,Font.CR_FIRE,(master.origin.x+xx)-smallfont2.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); } } diff --git a/zscript/kbase/swwm_kbasetab_stats.zsc b/zscript/kbase/swwm_kbasetab_stats.zsc index b05428a06..55ab33c48 100644 --- a/zscript/kbase/swwm_kbasetab_stats.zsc +++ b/zscript/kbase/swwm_kbasetab_stats.zsc @@ -20,7 +20,7 @@ Class DemolitionistStatsTab : DemolitionistMenuTab for ( int i=0; i<4; i++ ) { sname[i] = StringTable.Localize("$SWWM_STATTAB"..i); - lwidth = max(lwidth,master.LargeFont.StringWidth(sname[i])); + lwidth = max(lwidth,smallfont.StringWidth(sname[i])); lists[i] = new("DemolitionistMenuList"); lists[i].selected = -1; } @@ -285,16 +285,16 @@ Class DemolitionistStatsTab : DemolitionistMenuTab // and calculate "max lengths" int sec = Thinker.Tics2Seconds(l.s.time); str = String.Format("T %02d:%02d:%02d",sec/3600,(sec%3600)/60,sec%60); - len[0] = master.SmallFont.StringWidth(str); + len[0] = smallfont2.StringWidth(str); if ( len[0] > maxlen[0] ) maxlen[0] = len[0]; str = String.Format("S %d/%d",l.s.scount,l.s.stotal); - len[1] = master.SmallFont.StringWidth(str); + len[1] = smallfont2.StringWidth(str); if ( len[1] > maxlen[1] ) maxlen[1] = len[1]; str = String.Format("I %d/%d",l.s.icount,l.s.itotal); - len[2] = master.SmallFont.StringWidth(str); + len[2] = smallfont2.StringWidth(str); if ( len[2] > maxlen[2] ) maxlen[2] = len[2]; str = String.Format("K %d/%d",l.s.kcount,l.s.ktotal); - len[3] = master.SmallFont.StringWidth(str); + len[3] = smallfont2.StringWidth(str); if ( len[3] > maxlen[3] ) maxlen[3] = len[3]; } // second pass to propagate the "max lengths" @@ -379,7 +379,7 @@ Class DemolitionistStatsTab : DemolitionistMenuTab for ( int i=0; i<4; i++ ) { if ( pos.x < 9 ) continue; - if ( pos.x > 9+master.LargeFont.StringWidth(sname[i]) ) continue; + if ( pos.x > 9+smallfont.StringWidth(sname[i]) ) continue; if ( pos.y < 23+16*i ) continue; if ( pos.y > 36+16*i ) continue; if ( section != i ) @@ -427,7 +427,7 @@ Class DemolitionistStatsTab : DemolitionistMenuTab double yy = 23; for ( int i=0; i<4; i++ ) { - Screen.DrawText(master.LargeFont,(i==section)?Font.CR_FIRE:Font.CR_WHITE,master.origin.x+xx,master.origin.y+yy,sname[i],DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,(i==section)?Font.CR_FIRE:Font.CR_WHITE,master.origin.x+xx,master.origin.y+yy,sname[i],DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); yy += 16; } master.DrawVSeparator(lwidth,14,master.ws.y-28); @@ -450,7 +450,7 @@ Class DemolitionistStatsTab : DemolitionistMenuTab master.DrawVSeparator(xx,14,master.ws.y-28); xx += 2; yy = floor(smofs[section]*((master.ws.y-39)/maxofs[section]))+13; - Screen.DrawText(master.TewiFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,"▮",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,"▮",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); } } } diff --git a/zscript/menu/swwm_credits.zsc b/zscript/menu/swwm_credits.zsc index b272d5661..868fbb2d3 100644 --- a/zscript/menu/swwm_credits.zsc +++ b/zscript/menu/swwm_credits.zsc @@ -6,11 +6,10 @@ Class SWWMCreditsEntry ui TextureID MariSprite[15]; int tics, cur; BrokenLines btext; - Font fnt; int width, height; int titlecol, btextcol; - SWWMCreditsEntry Init( Font f, String t, String b = "", int c1 = Font.CR_SAPPHIRE, int c2 = Font.CR_WHITE, bool mari = false ) + SWWMCreditsEntry Init( String t, String b = "", int c1 = Font.CR_SAPPHIRE, int c2 = Font.CR_WHITE, bool mari = false ) { if ( mari ) { @@ -20,7 +19,6 @@ Class SWWMCreditsEntry ui tics = 3; cur = 0; } - fnt = f; titlecol = c1; btextcol = c2; title = StringTable.Localize(t); @@ -31,7 +29,7 @@ Class SWWMCreditsEntry ui return self; } String b2 = StringTable.Localize(b); - btext = fnt.BreakLines(b2,320); + btext = smallfont.BreakLines(b2,320); width = CalcWidth(); height = CalcHeight(); return self; @@ -45,7 +43,7 @@ Class SWWMCreditsEntry ui private int CalcWidth() { - int len = fnt.StringWidth(title); + int len = smallfont.StringWidth(title); if ( !btext ) return len; for ( int i=0; i cdev, cassets, cmusic, cvoice, cfanart, clocal, cpatrons, cthanks; String oldlang; - transient Font sfnt, bfnt; Vector2 ss; double hs; int logow, logoh; @@ -131,13 +128,6 @@ Class SWWMCreditsMenu : GenericMenu double spos, speed; int theight; - void UpdateFonts() - { - String curlang = language; - if ( !sfnt || (curlang != oldlang) ) sfnt = (curlang ~== "jp")?Font.GetFont('MPlusShaded'):Font.GetFont('TewiShaded'); - if ( !bfnt || (curlang != oldlang) ) bfnt = (curlang ~== "jp")?Font.GetFont('MPlusShadedOutline'):Font.GetFont('TewiShadedOutline'); - oldlang = curlang; - } void UpdateSize() { hs = max(1.,min(floor(Screen.GetWidth()/640),floor(Screen.GetHeight()/266))); @@ -148,7 +138,6 @@ Class SWWMCreditsMenu : GenericMenu { Super.Init(parent); bgtex = TexMan.CheckForTexture("graphics/tempbg.png",TexMan.Type_Any); - UpdateFonts(); UpdateSize(); logo = TexMan.CheckForTexture("graphics/M_SWWM.png",TexMan.Type_Any); [logow, logoh] = TexMan.GetSize(logo); @@ -162,69 +151,69 @@ Class SWWMCreditsMenu : GenericMenu slocal = StringTable.Localize("$SWWM_CLOCAL"); spatrons = StringTable.Localize("$SWWM_CPATRON"); sthanks = StringTable.Localize("$SWWM_CTHANK"); - cdev.Push(new("SWWMCreditsEntry").Init(sfnt,"Marisa Kirisame","$SWWM_CDEV2",mari:true)); - cassets.Push(new("SWWMCreditsEntry").Init(sfnt,"Bethesda Game Studios","Fallout: New Vegas\nFallout 4")); - cassets.Push(new("SWWMCreditsEntry").Init(sfnt,"Epic Games","Unreal\nUnreal Tournament\nUnreal Tournament 2004\nUnreal Tournament 3")); - cassets.Push(new("SWWMCreditsEntry").Init(sfnt,"Ion Storm","Deus Ex")); - cassets.Push(new("SWWMCreditsEntry").Init(sfnt,"Looking Glass Studios","Thief\nSystem Shock 2")); - cassets.Push(new("SWWMCreditsEntry").Init(sfnt,"People Can Fly","Painkiller")); - cassets.Push(new("SWWMCreditsEntry").Init(sfnt,"Tripwire Interactive","Killing Floor")); - cassets.Push(new("SWWMCreditsEntry").Init(sfnt,"From Software","Dark Souls\nDark Souls II\nDark Souls III")); - cassets.Push(new("SWWMCreditsEntry").Init(sfnt,"Amuscaria","$SWWM_ASSBARONS")); - cassets.Push(new("SWWMCreditsEntry").Init(sfnt,"Ryan Cordell","$SWWM_ASSOTHERS")); - cassets.Push(new("SWWMCreditsEntry").Init(sfnt,"Blox","$SWWM_ASSEXTRA")); - cassets.Push(new("SWWMCreditsEntry").Init(sfnt,"SiFi270","$SWWM_ASSKEEN")); - cassets.Push(new("SWWMCreditsEntry").Init(sfnt,"Nash","WidePix")); - cmusic.Push(new("SWWMCreditsEntry").Init(sfnt,"Teque","Traumatic State\nDragony\nHidden Tune #242\nHypercardish 1.1")); - cmusic.Push(new("SWWMCreditsEntry").Init(sfnt,"BouncyTEM","Solitary Apprehension")); - cvoice.Push(new("SWWMCreditsEntry").Init(sfnt,"Vyolette","$SWWM_VOICENAME_DEFAULT")); - cfanart.Push(new("SWWMCreditsEntry").Init(sfnt,"Substance20 (@S20TBL)")); - cfanart.Push(new("SWWMCreditsEntry").Init(sfnt,"Captain J (@Jho7835)")); - cfanart.Push(new("SWWMCreditsEntry").Init(sfnt,"Redead-ITA")); - cfanart.Push(new("SWWMCreditsEntry").Init(sfnt,"Sgt. Shivers (@Sgt_Shivers_)")); - cfanart.Push(new("SWWMCreditsEntry").Init(sfnt,"Moa Dixøn / Endie (@MoaDixon)")); - clocal.Push(new("SWWMCreditsEntry").Init(sfnt,"Marisa Kirisame","$SWWM_LOCES")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"Snacks")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"john")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"Jonas Höglund")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"Alexa Jones-Gonzales")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"Corey Hectus")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"Dac")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"Pietro Gagliardi")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"Ryan Weatherman")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"Xada Xephron")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"John")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"VoanHead")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"NekoMithos")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"Ceyne Taikato")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"bouncytem")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"Brett Saltzer")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"Clint Walker")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"Figo")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"m8f")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"Namsan")); - cpatrons.Push(new("SWWMCreditsEntry").Init(sfnt,"YaGirlJuniper")); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"Marrub","$SWWM_CMAB2",Font.FindFontColor('Heliotrope'),Font.FindFontColor('BlushPink'))); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"KynikossDragonn","$SWWM_CDRAGON2")); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"Lucy","$SWWM_CLUCY2")); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"Gutawer","$SWWM_CGUTA2")); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"Mikolah","$SWWM_CMIKO2")); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"KeksDose","$SWWM_CKEKS2")); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"ZZYZX & Nash","$SWWM_CZN2")); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"Val Pal","$SWWM_CVAL2")); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"Kaffy Kathy","$SWWM_CKATHY2")); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"BouncyTEM","$SWWM_CBOUNCY2")); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"\ctCptSledge\c- & \cdBunray\c-","$SWWM_CSLEDGE2")); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"a1337spy","$SWWM_CSPY2")); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"$SWWM_CINSP1","$SWWM_CINSP2")); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"$SWWM_CCOMMUNITY1","$SWWM_CCOMMUNITY2")); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"$SWWM_CDEVS1","$SWWM_CDEVS2")); - cthanks.Push(new("SWWMCreditsEntry").Init(sfnt,"$SWWM_CYOU1","$SWWM_CYOU2")); + cdev.Push(new("SWWMCreditsEntry").Init("Marisa Kirisame","$SWWM_CDEV2",mari:true)); + cassets.Push(new("SWWMCreditsEntry").Init("Bethesda Game Studios","Fallout: New Vegas\nFallout 4")); + cassets.Push(new("SWWMCreditsEntry").Init("Epic Games","Unreal\nUnreal Tournament\nUnreal Tournament 2004\nUnreal Tournament 3")); + cassets.Push(new("SWWMCreditsEntry").Init("Ion Storm","Deus Ex")); + cassets.Push(new("SWWMCreditsEntry").Init("Looking Glass Studios","Thief\nSystem Shock 2")); + cassets.Push(new("SWWMCreditsEntry").Init("People Can Fly","Painkiller")); + cassets.Push(new("SWWMCreditsEntry").Init("Tripwire Interactive","Killing Floor")); + cassets.Push(new("SWWMCreditsEntry").Init("From Software","Dark Souls\nDark Souls II\nDark Souls III")); + cassets.Push(new("SWWMCreditsEntry").Init("Amuscaria","$SWWM_ASSBARONS")); + cassets.Push(new("SWWMCreditsEntry").Init("Ryan Cordell","$SWWM_ASSOTHERS")); + cassets.Push(new("SWWMCreditsEntry").Init("Blox","$SWWM_ASSEXTRA")); + cassets.Push(new("SWWMCreditsEntry").Init("SiFi270","$SWWM_ASSKEEN")); + cassets.Push(new("SWWMCreditsEntry").Init("Nash","WidePix")); + cmusic.Push(new("SWWMCreditsEntry").Init("Teque","Traumatic State\nDragony\nHidden Tune #242\nHypercardish 1.1")); + cmusic.Push(new("SWWMCreditsEntry").Init("BouncyTEM","Solitary Apprehension")); + cvoice.Push(new("SWWMCreditsEntry").Init("Vyolette","$SWWM_VOICENAME_DEFAULT")); + cfanart.Push(new("SWWMCreditsEntry").Init("Substance20 (@S20TBL)")); + cfanart.Push(new("SWWMCreditsEntry").Init("Captain J (@Jho7835)")); + cfanart.Push(new("SWWMCreditsEntry").Init("Redead-ITA")); + cfanart.Push(new("SWWMCreditsEntry").Init("Sgt. Shivers (@Sgt_Shivers_)")); + cfanart.Push(new("SWWMCreditsEntry").Init("Moa Dixøn / Endie (@MoaDixon)")); + clocal.Push(new("SWWMCreditsEntry").Init("Marisa Kirisame","$SWWM_LOCES")); + cpatrons.Push(new("SWWMCreditsEntry").Init("Snacks")); + cpatrons.Push(new("SWWMCreditsEntry").Init("john")); + cpatrons.Push(new("SWWMCreditsEntry").Init("Jonas Höglund")); + cpatrons.Push(new("SWWMCreditsEntry").Init("Alexa Jones-Gonzales")); + cpatrons.Push(new("SWWMCreditsEntry").Init("Corey Hectus")); + cpatrons.Push(new("SWWMCreditsEntry").Init("Dac")); + cpatrons.Push(new("SWWMCreditsEntry").Init("Pietro Gagliardi")); + cpatrons.Push(new("SWWMCreditsEntry").Init("Ryan Weatherman")); + cpatrons.Push(new("SWWMCreditsEntry").Init("Xada Xephron")); + cpatrons.Push(new("SWWMCreditsEntry").Init("John")); + cpatrons.Push(new("SWWMCreditsEntry").Init("VoanHead")); + cpatrons.Push(new("SWWMCreditsEntry").Init("NekoMithos")); + cpatrons.Push(new("SWWMCreditsEntry").Init("Ceyne Taikato")); + cpatrons.Push(new("SWWMCreditsEntry").Init("bouncytem")); + cpatrons.Push(new("SWWMCreditsEntry").Init("Brett Saltzer")); + cpatrons.Push(new("SWWMCreditsEntry").Init("Clint Walker")); + cpatrons.Push(new("SWWMCreditsEntry").Init("Figo")); + cpatrons.Push(new("SWWMCreditsEntry").Init("m8f")); + cpatrons.Push(new("SWWMCreditsEntry").Init("Namsan")); + cpatrons.Push(new("SWWMCreditsEntry").Init("YaGirlJuniper")); + cthanks.Push(new("SWWMCreditsEntry").Init("Marrub","$SWWM_CMAB2",Font.FindFontColor('Heliotrope'),Font.FindFontColor('BlushPink'))); + cthanks.Push(new("SWWMCreditsEntry").Init("KynikossDragonn","$SWWM_CDRAGON2")); + cthanks.Push(new("SWWMCreditsEntry").Init("Lucy","$SWWM_CLUCY2")); + cthanks.Push(new("SWWMCreditsEntry").Init("Gutawer","$SWWM_CGUTA2")); + cthanks.Push(new("SWWMCreditsEntry").Init("Mikolah","$SWWM_CMIKO2")); + cthanks.Push(new("SWWMCreditsEntry").Init("KeksDose","$SWWM_CKEKS2")); + cthanks.Push(new("SWWMCreditsEntry").Init("ZZYZX & Nash","$SWWM_CZN2")); + cthanks.Push(new("SWWMCreditsEntry").Init("Val Pal","$SWWM_CVAL2")); + cthanks.Push(new("SWWMCreditsEntry").Init("Kaffy Kathy","$SWWM_CKATHY2")); + cthanks.Push(new("SWWMCreditsEntry").Init("BouncyTEM","$SWWM_CBOUNCY2")); + cthanks.Push(new("SWWMCreditsEntry").Init("\ctCptSledge\c- & \cdBunray\c-","$SWWM_CSLEDGE2")); + cthanks.Push(new("SWWMCreditsEntry").Init("a1337spy","$SWWM_CSPY2")); + cthanks.Push(new("SWWMCreditsEntry").Init("$SWWM_CINSP1","$SWWM_CINSP2")); + cthanks.Push(new("SWWMCreditsEntry").Init("$SWWM_CCOMMUNITY1","$SWWM_CCOMMUNITY2")); + cthanks.Push(new("SWWMCreditsEntry").Init("$SWWM_CDEVS1","$SWWM_CDEVS2")); + cthanks.Push(new("SWWMCreditsEntry").Init("$SWWM_CYOU1","$SWWM_CYOU2")); speed = 16.; spos = ss.y-logoh; // calc total height theight = logoh; - theight += 8*(SECTION_PAD+bfnt.GetHeight()*3); + theight += 8*(SECTION_PAD+bigfont.GetHeight()); for ( int i=0; i ss.y) ) return logoh; Screen.DrawTexture(logo,true,x-logow/2,y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - Screen.DrawText(sfnt,Font.CR_SAPPHIRE,x-sfnt.StringWidth(stitle)/2,y+(logoh-28),stitle,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_SAPPHIRE,x-smallfont.StringWidth(stitle)/2,y+(logoh-28),stitle,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); // underline - int w = max(sfnt.StringWidth(stitle),sfnt.StringWidth(stitle2)); + int w = max(smallfont.StringWidth(stitle),smallfont.StringWidth(stitle2)); int cw = int(ceil((w+8)/6.))*6; double xx = x-cw/2; for ( int i=0; i ss.y) ) return bfnt.GetHeight()*3; - Screen.DrawText(bfnt,Font.CR_BLUE,x-bfnt.StringWidth(txt)*1.5,y,txt,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ScaleX,3.,DTA_ScaleY,3.); - return bfnt.GetHeight()*3; + if ( (y+bigfont.GetHeight() < 0) || (y > ss.y) ) return bigfont.GetHeight(); + Screen.DrawText(bigfont,Font.CR_BLUE,x-bigfont.StringWidth(txt)/2,y,txt,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + return bigfont.GetHeight(); } override void Drawer() { @@ -305,7 +294,6 @@ Class SWWMCreditsMenu : GenericMenu Screen.DrawTexture(bgtex,false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true,DTA_ColorOverlay,Color(192,0,0,0),DTA_Alpha,.8); } else Screen.Dim("Black",.8,0,0,Screen.GetWidth(),Screen.GetHeight()); - UpdateFonts(); UpdateSize(); // logo double yy = spos; diff --git a/zscript/menu/swwm_help.zsc b/zscript/menu/swwm_help.zsc index c54911811..ccfc42d8c 100644 --- a/zscript/menu/swwm_help.zsc +++ b/zscript/menu/swwm_help.zsc @@ -5,7 +5,6 @@ Class SWWMHelpMenu : GenericMenu int curpage, prevpage; int fadetic; TextureID bgtex; - transient Font TewiFont, MPlusFont; bool isrclick; int pagedir; @@ -22,13 +21,6 @@ Class SWWMHelpMenu : GenericMenu NUM_HELP_PAGES }; - // returns MPlus if we're playing in Japanese, otherwise returns the requested font - Font LangFont( Font req ) - { - if ( language ~== "jp" ) return MPlusFont; - return req; - } - override void Init( Menu parent ) { Super.Init(parent); @@ -126,10 +118,9 @@ Class SWWMHelpMenu : GenericMenu } // big bulk of code - private void DrawPage( int page, Vector2 ss, Vector2 origin, double alpha = 1. ) + private void DrawPage( int page, double xofs = 0., double alpha = 1. ) { - Font fnt = LangFont(TewiFont); - int h = fnt.GetHeight(); + int h = smallfont.GetHeight(); String hdr = "", txt = ""; BrokenLines l; int maxlen = 0, lh; @@ -172,32 +163,30 @@ Class SWWMHelpMenu : GenericMenu txt = StringTable.Localize("$SWWM_HELP_TIPSTXT"); break; } - if ( txt && hdr ) + if ( !txt || !hdr ) { - l = fnt.BreakLines(txt,480); - lh = l.Count()*h; - Screen.DrawText(fnt,Font.CR_FIRE,origin.x+320-fnt.StringWidth(hdr)/2,origin.y+133-(h*3+lh)/2,hdr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha); - for ( int i=0; i maxlen ) maxlen = len; - } - for ( int i=0; i maxlen ) maxlen = len; + } + for ( int i=0; i= 1.) ) DrawPage(curpage,ss,origin); + if ( (prevpage == -1) || (alph >= 1.) ) DrawPage(curpage); else { - DrawPage(prevpage,ss,origin-(pagedir*alph*32,0),(1.-alph)**3); - DrawPage(curpage,ss,origin+(pagedir*(1.-alph)*32,0),alph**3); + DrawPage(prevpage,-(pagedir*alph*32)*CleanXFac_1,(1.-alph)**3); + DrawPage(curpage,(pagedir*(1.-alph)*32)*CleanXFac_1,alph**3); } - int h = TewiFont.GetHeight(); - double y = ss.y/2-(h*2); + int h = smallfont.GetHeight(); + double y = Screen.GetHeight()/2-(h*2)*CleanYFac_1; for ( int i=0; i<4; i++ ) { if ( curpage > 0 ) - Screen.DrawText(TewiFont,Font.CR_GOLD,12,y,"<",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_GOLD,12*CleanXFac_1,y,"<",DTA_CleanNoMove_1,true); if ( curpage < NUM_HELP_PAGES-1 ) - Screen.DrawText(TewiFont,Font.CR_GOLD,ss.x-18,y,">",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - y += h; + Screen.DrawText(smallfont,Font.CR_GOLD,Screen.GetWidth()-18*CleanXFac_1,y,">",DTA_CleanNoMove_1,true); + y += h*CleanYFac_1; } Super.Drawer(); } diff --git a/zscript/menu/swwm_inter.zsc b/zscript/menu/swwm_inter.zsc index 78a90acca..2831e9928 100644 --- a/zscript/menu/swwm_inter.zsc +++ b/zscript/menu/swwm_inter.zsc @@ -8,18 +8,11 @@ Class SWWMStatScreenData : Thinker Class SWWMStatScreen : StatusScreen abstract { transient TextureID bgtex, arttex; - transient Font TewiFont, MPlusFont; int whichart, whichtip; double hs, hs2; Vector2 ss, ss2, origin, origin2; double bgfade; - // returns MPlus if we're playing in Japanese, otherwise returns the requested font - Font LangFont( Font req ) - { - if ( language ~== "jp" ) return MPlusFont; - return req; - } override void Start( wbstartstruct wbstartstruct ) { Super.Start(wbstartstruct); @@ -89,7 +82,6 @@ Class SWWMStatScreen : StatusScreen abstract else vsize = tsize; Screen.DrawTexture(bgtex,false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true); } - Font fnt = LangFont(TewiFont); // background pics if ( whichart ) { @@ -105,10 +97,10 @@ Class SWWMStatScreen : StatusScreen abstract if ( semic != -1 ) { String bstr = String.Format("\cx%s\c- %s",StringTable.Localize("$SWWM_FANART"),artstr.Mid(semic+1)); - int len = fnt.StringWidth(bstr); - int bw = int((len+8)*hs), bh = int((fnt.GetHeight()+4)*hs); + int len = smallfont.StringWidth(bstr); + int bw = int((len+8)*hs), bh = int((smallfont.GetHeight()+4)*hs); Screen.Dim("Black",.8,Screen.GetWidth()-bw,Screen.GetHeight()-bh,bw,bh); - Screen.DrawText(fnt,Font.CR_GOLD,ss.x-(len+4),ss.y-(fnt.GetHeight()+2),bstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_GOLD,ss.x-(len+4),ss.y-(smallfont.GetHeight()+2),bstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } } // intermission tips at the bottom @@ -147,70 +139,68 @@ Class SWWMStatScreen : StatusScreen abstract } if ( swwm_nointertips ) return; String tipstr = "\cd"..String.Format(StringTable.Localize("$SWWM_INTERTIP"),whichtip).."\c-\n"..StringTable.Localize(String.Format("$SWWM_INTERTIP%d",whichtip)); - BrokenLines l = fnt.BreakLines(tipstr,400); + BrokenLines l = smallfont.BreakLines(tipstr,400); int lw = 0; for ( int i=0; i lw ) lw = l.StringWidth(i); - int bw = int((lw+12)*hs), bh = int((fnt.GetHeight()*l.Count()+8)*hs); - double xx = 8, yy = (ss.y-8)-(fnt.GetHeight()*l.Count()); + int bw = int((lw+12)*hs), bh = int((smallfont.GetHeight()*l.Count()+8)*hs); + double xx = 8, yy = (ss.y-8)-(smallfont.GetHeight()*l.Count()); Screen.Dim("Black",.8,int((xx-4)*hs),int((yy-4)*hs),bw,bh); for ( int i=0; i0); - Screen.Dim("Black",.8,int((Screen.GetWidth()-dimlen)/2.),int(4*hs2),dimlen,int((fnt.GetHeight()+(auth?2:4))*hs2)); - Screen.DrawText(fnt,Font.CR_GREEN,int((ss2.x-len[0])/2.),6,lnametexts[0],DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); - double foy = fnt.GetHeight()+(auth?6:8); + Screen.Dim("Black",.8,int((Screen.GetWidth()-dimlen)/2.),int(4*hs2),dimlen,int((smallfont.GetHeight()+(auth?2:4))*hs2)); + Screen.DrawText(smallfont,Font.CR_GREEN,int((ss2.x-len[0])/2.),6,lnametexts[0],DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + double foy = smallfont.GetHeight()+(auth?6:8); if ( auth ) { double oy = foy*(hs2/hs); - Screen.Dim("Black",.8,int((Screen.GetWidth()-dimlen)/2.),int(oy*hs),dimlen,int((fnt.GetHeight()+2)*hs)); - Screen.DrawText(fnt,Font.CR_WHITE,int((ss.x-len[1])/2.),oy,authortexts[0],DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - foy += (fnt.GetHeight()+2)*(hs/hs2); + Screen.Dim("Black",.8,int((Screen.GetWidth()-dimlen)/2.),int(oy*hs),dimlen,int((smallfont.GetHeight()+2)*hs)); + Screen.DrawText(smallfont,Font.CR_WHITE,int((ss.x-len[1])/2.),oy,authortexts[0],DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + foy += (smallfont.GetHeight()+2)*(hs/hs2); } foy += 4.; String str = StringTable.Localize("$WI_FINISHED"); - len[0] = fnt.StringWidth(str); - Screen.Dim("Black",.8,int((ss2.x-len[0]-8)/2*hs2),int(foy*hs2),int((len[0]+8)*hs2),int((fnt.GetHeight()+4)*hs2)); - Screen.DrawText(fnt,Font.CR_FIRE,int((ss2.x-len[0])/2.),foy+2,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + len[0] = smallfont.StringWidth(str); + Screen.Dim("Black",.8,int((ss2.x-len[0]-8)/2*hs2),int(foy*hs2),int((len[0]+8)*hs2),int((smallfont.GetHeight()+4)*hs2)); + Screen.DrawText(smallfont,Font.CR_FIRE,int((ss2.x-len[0])/2.),foy+2,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); // return not used return 0; } override void DrawEL() { - Font fnt = LangFont(TewiFont); String str = StringTable.Localize("$WI_ENTERING"); // remove trailing colon (usually appearing on Heretic) if ( str.RightIndexOf(":") == (str.length()-1) ) str.Truncate(str.length()-1); int len[2]; - len[0] = fnt.StringWidth(str); - Screen.Dim("Black",.8,int((ss2.x-len[0]-8)/2*hs2),int(4*hs2),int((len[0]+8)*hs2),int((fnt.GetHeight()+4)*hs2)); - Screen.DrawText(fnt,Font.CR_FIRE,int((ss2.x-len[0])/2.),6,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); - double foy = fnt.GetHeight()+12; - len[0] = fnt.StringWidth(lnametexts[1]); - len[1] = fnt.StringWidth(authortexts[1]); + len[0] = smallfont.StringWidth(str); + Screen.Dim("Black",.8,int((ss2.x-len[0]-8)/2*hs2),int(4*hs2),int((len[0]+8)*hs2),int((smallfont.GetHeight()+4)*hs2)); + Screen.DrawText(smallfont,Font.CR_FIRE,int((ss2.x-len[0])/2.),6,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + double foy = smallfont.GetHeight()+12; + len[0] = smallfont.StringWidth(lnametexts[1]); + len[1] = smallfont.StringWidth(authortexts[1]); int dimlen = max(int((len[0]+8)*hs2),int((len[1]+8)*hs)); bool auth = (authortexts[1].Length()>0); - Screen.Dim("Black",.8,int((Screen.GetWidth()-dimlen)/2.),int(foy*hs2),dimlen,int((fnt.GetHeight()+(auth?2:4))*hs2)); - Screen.DrawText(fnt,Font.CR_GREEN,int((ss2.x-len[0])/2.),foy+2,lnametexts[1],DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + Screen.Dim("Black",.8,int((Screen.GetWidth()-dimlen)/2.),int(foy*hs2),dimlen,int((smallfont.GetHeight()+(auth?2:4))*hs2)); + Screen.DrawText(smallfont,Font.CR_GREEN,int((ss2.x-len[0])/2.),foy+2,lnametexts[1],DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); if ( auth ) { - double oy = (foy+fnt.GetHeight()+2)*(hs2/hs); - Screen.Dim("Black",.8,int((Screen.GetWidth()-dimlen)/2.),int(oy*hs),dimlen,int((fnt.GetHeight()+2)*hs)); - Screen.DrawText(fnt,Font.CR_WHITE,int((ss.x-len[1])/2.),oy,authortexts[1],DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + double oy = (foy+smallfont.GetHeight()+2)*(hs2/hs); + Screen.Dim("Black",.8,int((Screen.GetWidth()-dimlen)/2.),int(oy*hs),dimlen,int((smallfont.GetHeight()+2)*hs)); + Screen.DrawText(smallfont,Font.CR_WHITE,int((ss.x-len[1])/2.),oy,authortexts[1],DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } } override void drawShowNextLoc( void ) @@ -220,8 +210,6 @@ Class SWWMStatScreen : StatusScreen abstract } override void Drawer( void ) { - if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded'); - if ( !MPlusFont ) MPlusFont = Font.GetFont('MPlusShaded'); hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/400.)),1.); hs2 = max(min(floor(Screen.GetWidth()/320.),floor(Screen.GetHeight()/200.)),1.); ss = (Screen.GetWidth(),Screen.GetHeight())/hs; @@ -459,75 +447,74 @@ Class SWWMStatScreen_SP : SWWMStatScreen override void drawStats( void ) { drawLF(); - Font fnt = LangFont(TewiFont); // estimate max width of the whole stat counter int maxlen, maxlenl = 0, maxlenr = 0; // left strings String str = StringTable.Localize("$TXT_IMKILLS")..":"; - int len = fnt.StringWidth(str); + int len = smallfont.StringWidth(str); maxlenl = len; str = StringTable.Localize("$TXT_IMITEMS")..":"; - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); if ( len > maxlenl ) maxlenl = len; str = StringTable.Localize("$TXT_IMSECRETS")..":"; - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); if ( len > maxlenl ) maxlenl = len; str = StringTable.Localize("$TXT_IMTIME")..":"; - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); if ( len > maxlenl ) maxlenl = len; if ( wi_showtotaltime ) { str = StringTable.Localize("$SCORE_TOTAL")..":"; // hey, as long as it works - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); if ( len > maxlenl ) maxlenl = len; } if ( wbs.partime ) { str = StringTable.Localize("$TXT_IMPAR")..":"; - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); if ( len > maxlenl ) maxlenl = len; } // right strings if ( wi_percents ) { str = String.Format("%d%%",GetPct(Plrs[me].skills,wbs.maxkills)); - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); maxlenr = len; str = String.Format("%d%%",GetPct(Plrs[me].sitems,wbs.maxitems)); - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); if ( len > maxlenr ) maxlenr = len; str = String.Format("%d%%",GetPct(Plrs[me].ssecret,wbs.maxsecret)); - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); if ( len > maxlenr ) maxlenr = len; } else { str = String.Format("%d / %d",Plrs[me].skills,wbs.maxkills); - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); maxlenr = len; str = String.Format("%d / %d",Plrs[me].sitems,wbs.maxitems); - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); if ( len > maxlenr ) maxlenr = len; str = String.Format("%d / %d",Plrs[me].ssecret,wbs.maxsecret); - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); if ( len > maxlenr ) maxlenr = len; } str = TimeStr(Thinker.Tics2Seconds(Plrs[me].stime)); - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); if ( len > maxlenr ) maxlenr = len; if ( wi_showtotaltime ) { str = TimeStr(Thinker.Tics2Seconds(wbs.totaltime)); - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); if ( len > maxlenr ) maxlenr = len; } if ( wbs.partime ) { str = TimeStr(wbs.partime/GameTicRate); - len = fnt.StringWidth(str); + len = smallfont.StringWidth(str); if ( len > maxlenr ) maxlenr = len; } - int step = fnt.GetHeight()+1; + int step = smallfont.GetHeight()+1; int nl = clamp(sp_state/2,0,4); if ( (nl == 4) ) { @@ -539,20 +526,20 @@ Class SWWMStatScreen_SP : SWWMStatScreen // draw the whole damn thing if ( sp_state >= 2 ) Screen.Dim("Black",.8,int((ss2.x-maxlen-8)*.5*hs2),int((ss2.y-nl-8)*.5*hs2),int((maxlen+8)*hs2),int((nl+8)*hs2)); int xx = int((ss2.x-maxlen)/2), yy = int((ss2.y-nl)/2); - if ( sp_state >= 2 ) Screen.DrawText(fnt,Font.CR_GREEN,xx,yy,StringTable.Localize("$TXT_IMKILLS")..":",DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + if ( sp_state >= 2 ) Screen.DrawText(smallfont,Font.CR_GREEN,xx,yy,StringTable.Localize("$TXT_IMKILLS")..":",DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); yy += step; - if ( sp_state >= 4 ) Screen.DrawText(fnt,Font.CR_GREEN,xx,yy,StringTable.Localize("$TXT_IMITEMS")..":",DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + if ( sp_state >= 4 ) Screen.DrawText(smallfont,Font.CR_GREEN,xx,yy,StringTable.Localize("$TXT_IMITEMS")..":",DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); yy += step; - if ( sp_state >= 6 ) Screen.DrawText(fnt,Font.CR_GREEN,xx,yy,StringTable.Localize("$TXT_IMSECRETS")..":",DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + if ( sp_state >= 6 ) Screen.DrawText(smallfont,Font.CR_GREEN,xx,yy,StringTable.Localize("$TXT_IMSECRETS")..":",DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); yy += step; - if ( sp_state >= 8 ) Screen.DrawText(fnt,Font.CR_GREEN,xx,yy,StringTable.Localize("$TXT_IMTIME")..":",DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + if ( sp_state >= 8 ) Screen.DrawText(smallfont,Font.CR_GREEN,xx,yy,StringTable.Localize("$TXT_IMTIME")..":",DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); yy += step; if ( wi_showtotaltime ) { - if ( sp_state >= 8 ) Screen.DrawText(fnt,Font.CR_GREEN,xx,yy,StringTable.Localize("$SCORE_TOTAL")..":",DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + if ( sp_state >= 8 ) Screen.DrawText(smallfont,Font.CR_GREEN,xx,yy,StringTable.Localize("$SCORE_TOTAL")..":",DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); yy += step; } - if ( wbs.partime && (sp_state >= 8) ) Screen.DrawText(fnt,Font.CR_GREEN,xx,yy,StringTable.Localize("$TXT_IMPAR")..":",DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + if ( wbs.partime && (sp_state >= 8) ) Screen.DrawText(smallfont,Font.CR_GREEN,xx,yy,StringTable.Localize("$TXT_IMPAR")..":",DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); xx = int((ss2.x+maxlen)/2); yy = int((ss2.y-nl)/2); if ( wi_percents ) @@ -560,22 +547,22 @@ Class SWWMStatScreen_SP : SWWMStatScreen if ( cnt_kills[0] >= 0 ) { str = String.Format("%d\cu%%\c-",GetPct(cnt_kills[0],wbs.maxkills)); - len = fnt.StringWidth(str); - Screen.DrawText(fnt,(!wbs.maxkills||(cnt_kills[0]>=wbs.maxkills))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + len = smallfont.StringWidth(str); + Screen.DrawText(smallfont,(!wbs.maxkills||(cnt_kills[0]>=wbs.maxkills))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); } yy += step; if ( cnt_items[0] >= 0 ) { str = String.Format("%d\cu%%\c-",GetPct(cnt_items[0],wbs.maxitems)); - len = fnt.StringWidth(str); - Screen.DrawText(fnt,(!wbs.maxitems||(cnt_items[0]>=wbs.maxitems))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + len = smallfont.StringWidth(str); + Screen.DrawText(smallfont,(!wbs.maxitems||(cnt_items[0]>=wbs.maxitems))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); } yy += step; if ( cnt_secret[0] >= 0 ) { str = String.Format("%d\cu%%\c-",GetPct(cnt_secret[0],wbs.maxsecret)); - len = fnt.StringWidth(str); - Screen.DrawText(fnt,(!wbs.maxsecret||(cnt_secret[0]>=wbs.maxsecret))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + len = smallfont.StringWidth(str); + Screen.DrawText(smallfont,(!wbs.maxsecret||(cnt_secret[0]>=wbs.maxsecret))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); } yy += step; } @@ -584,30 +571,30 @@ Class SWWMStatScreen_SP : SWWMStatScreen if ( cnt_kills[0] >= 0 ) { str = String.Format("%d \cu/\c- \cj%d\c-",max(cnt_kills[0],0),wbs.maxkills); - len = fnt.StringWidth(str); - Screen.DrawText(fnt,(wbs.maxkills&&(cnt_kills[0]>=wbs.maxkills))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + len = smallfont.StringWidth(str); + Screen.DrawText(smallfont,(wbs.maxkills&&(cnt_kills[0]>=wbs.maxkills))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); } yy += step; if ( cnt_items[0] >= 0 ) { str = String.Format("%d \cu/\c- \cj%d\c-",max(cnt_items[0],0),wbs.maxitems); - len = fnt.StringWidth(str); - Screen.DrawText(fnt,(wbs.maxitems&&(cnt_items[0]>=wbs.maxitems))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + len = smallfont.StringWidth(str); + Screen.DrawText(smallfont,(wbs.maxitems&&(cnt_items[0]>=wbs.maxitems))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); } yy += step; if ( cnt_secret[0] >= 0 ) { str = String.Format("%d \cu/\c- \cj%d\c-",max(cnt_secret[0],0),wbs.maxsecret); - len = fnt.StringWidth(str); - Screen.DrawText(fnt,(wbs.maxsecret&&(cnt_secret[0]>=wbs.maxsecret))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + len = smallfont.StringWidth(str); + Screen.DrawText(smallfont,(wbs.maxsecret&&(cnt_secret[0]>=wbs.maxsecret))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); } yy += step; } if ( cnt_time >= 0 ) { str = TimeStr(cnt_time); - len = fnt.StringWidth(str); - Screen.DrawText(fnt,(wbs.partime&&(cnt_time<=(wbs.partime/GameTicRate)))?Font.CR_GOLD:((wbs.sucktime>0)&&(cnt_time>(wbs.sucktime*3600)))?Font.CR_RED:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + len = smallfont.StringWidth(str); + Screen.DrawText(smallfont,(wbs.partime&&(cnt_time<=(wbs.partime/GameTicRate)))?Font.CR_GOLD:((wbs.sucktime>0)&&(cnt_time>(wbs.sucktime*3600)))?Font.CR_RED:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); } yy += step; if ( wi_showtotaltime ) @@ -615,16 +602,16 @@ Class SWWMStatScreen_SP : SWWMStatScreen if ( cnt_total_time >= 0 ) { str = TimeStr(cnt_total_time); - len = fnt.StringWidth(str); - Screen.DrawText(fnt,Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + len = smallfont.StringWidth(str); + Screen.DrawText(smallfont,Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); } yy += step; } if ( wbs.partime && (cnt_par >= 0) ) { str = TimeStr(cnt_par); - len = fnt.StringWidth(str); - Screen.DrawText(fnt,Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); + len = smallfont.StringWidth(str); + Screen.DrawText(smallfont,Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true); } } } @@ -764,20 +751,19 @@ Class SWWMStatScreen_Coop : SWWMStatScreen override void drawStats( void ) { drawLF(); - Font fnt = LangFont(TewiFont); - int checkmark = 0x2714; // "✔", only available on Tewi + int checkmark = 0x2714; // "✔" String namestr = StringTable.Localize("$SCORE_NAME"); String itemsstr = StringTable.Localize((gameinfo.gametype&GAME_Raven)?"$SCORE_BONUS":"$SCORE_ITEMS"); String secretstr = StringTable.Localize("$SCORE_SECRET"); String killsstr = StringTable.Localize("$SCORE_KILLS"); String missedstr = StringTable.Localize("$SCORE_MISSED"); String totalstr = StringTable.Localize("$SCORE_TOTAL"); - int namelen = max(max(fnt.StringWidth(namestr),fnt.StringWidth("XXXXXXXXXX")),max(fnt.StringWidth(missedstr),fnt.StringWidth(totalstr))); + int namelen = max(max(smallfont.StringWidth(namestr),smallfont.StringWidth("XXXXXXXXXX")),max(smallfont.StringWidth(missedstr),smallfont.StringWidth(totalstr))); int nplayers = 0; for ( int i=0; i= 4 ) { str = String.Format("%3d\cu%%\c-",GetPct(cnt_items[i],wbs.maxitems)); - Screen.DrawText(fnt,(!wbs.maxitems||(cnt_items[i]>=wbs.maxitems))?Font.CR_GOLD:Font.CR_WHITE,xx+itemslen-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,(!wbs.maxitems||(cnt_items[i]>=wbs.maxitems))?Font.CR_GOLD:Font.CR_WHITE,xx+itemslen-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); misseditems -= cnt_items[i]; } xx += itemslen+spc; if ( ng_state >= 6 ) { str = String.Format("%3d\cu%%\c-",GetPct(cnt_secret[i],wbs.maxsecret)); - Screen.DrawText(fnt,(!wbs.maxsecret||(cnt_secret[i]>=wbs.maxsecret))?Font.CR_GOLD:Font.CR_WHITE,xx+secretlen-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,(!wbs.maxsecret||(cnt_secret[i]>=wbs.maxsecret))?Font.CR_GOLD:Font.CR_WHITE,xx+secretlen-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); missedsecret -= cnt_secret[i]; } xx += secretlen+spc; str = String.Format("%3d\cu%%\c-",GetPct(cnt_kills[i],wbs.maxkills)); - Screen.DrawText(fnt,(!wbs.maxkills||(cnt_kills[i]>=wbs.maxkills))?Font.CR_GOLD:Font.CR_WHITE,xx+killslen-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,(!wbs.maxkills||(cnt_kills[i]>=wbs.maxkills))?Font.CR_GOLD:Font.CR_WHITE,xx+killslen-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); missedkills -= cnt_kills[i]; yy += lineh+lspc; } xx = int((ss.x-boxwidth)/2+pad+pad+rwidth); yy += hspc; - Screen.DrawText(fnt,Font.CR_GREEN,xx,yy,missedstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_GREEN,xx,yy,missedstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); xx += namelen+spc; if ( ng_state >= 4 ) { str = String.Format("%3d\cu%%\c-",GetPct(misseditems,wbs.maxitems,true)); - Screen.DrawText(fnt,(wbs.maxitems&&(misseditems>0))?Font.CR_WHITE:Font.CR_GOLD,xx+itemslen-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,(wbs.maxitems&&(misseditems>0))?Font.CR_WHITE:Font.CR_GOLD,xx+itemslen-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } xx += itemslen+spc; if ( ng_state >= 6 ) { str = String.Format("%3d\cu%%\c-",GetPct(missedsecret,wbs.maxsecret,true)); - Screen.DrawText(fnt,(wbs.maxsecret&&(missedsecret>0))?Font.CR_WHITE:Font.CR_GOLD,xx+secretlen-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,(wbs.maxsecret&&(missedsecret>0))?Font.CR_WHITE:Font.CR_GOLD,xx+secretlen-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } xx += secretlen+spc; str = String.Format("%3d\cu%%\c-",GetPct(missedkills,wbs.maxkills,true)); - Screen.DrawText(fnt,(wbs.maxkills&&(missedkills>0))?Font.CR_WHITE:Font.CR_GOLD,xx+killslen-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,(wbs.maxkills&&(missedkills>0))?Font.CR_WHITE:Font.CR_GOLD,xx+killslen-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); yy += lineh+lspc; xx = int((ss.x-boxwidth)/2+pad+pad+rwidth); - Screen.DrawText(fnt,Font.CR_GREEN,xx,yy,totalstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_GREEN,xx,yy,totalstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); xx += namelen+spc; if ( ng_state >= 4 ) { str = String.Format("%d",wbs.maxitems); - Screen.DrawText(fnt,Font.CR_WHITE,xx+itemslen-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_WHITE,xx+itemslen-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } xx += itemslen+spc; if ( ng_state >= 6 ) { str = String.Format("%d",wbs.maxsecret); - Screen.DrawText(fnt,Font.CR_WHITE,xx+secretlen-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_WHITE,xx+secretlen-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } xx += secretlen+spc; str = String.Format("%d",wbs.maxkills); - Screen.DrawText(fnt,Font.CR_WHITE,xx+killslen-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_WHITE,xx+killslen-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } } @@ -987,43 +972,41 @@ Class SWWMStatScreen_DM : SWWMStatScreen override void drawStats( void ) { drawLF(); - Font fnt = LangFont(TewiFont); - int checkmark = 0x2714; // "✔", only available on Tewi + int checkmark = 0x2714; // "✔" String namestr = StringTable.Localize("$SCORE_NAME"); String deathsstr = StringTable.Localize("$SCORE_DEATHS"); String fragsstr = StringTable.Localize("$SCORE_FRAGS"); String totalstr = StringTable.Localize("$SCORE_TOTAL"); - int namelen = max(max(fnt.StringWidth(namestr),fnt.StringWidth("XXXXXXXXXX")),fnt.StringWidth(totalstr)); + int namelen = max(max(smallfont.StringWidth(namestr),smallfont.StringWidth("XXXXXXXXXX")),smallfont.StringWidth(totalstr)); int nplayers = 0; for ( int i=0; i sorted; @@ -1035,31 +1018,31 @@ Class SWWMStatScreen_DM : SWWMStatScreen xx = int((ss.x-boxwidth)/2+pad); Screen.Dim(players[i].GetDisplayColor(),.4,int(xx*hs),int(yy*hs),int(linew*hs),int(lineh*hs)); xx += pad; - if ( playerready[i] || players[i].Bot ) Screen.DrawChar(TewiFont,Font.CR_GREEN,xx,yy+ryofs,checkmark,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + if ( playerready[i] || players[i].Bot ) Screen.DrawChar(smallfont,Font.CR_GREEN,xx,yy,checkmark,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); xx += rwidth; - Screen.DrawText(fnt,GetRowColor(players[i],i==me),xx,yy,players[i].GetUserName(),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,GetRowColor(players[i],i==me),xx,yy,players[i].GetUserName(),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); xx += namelen+spc; if ( ng_state >= 2 ) { str = String.Format("%d",cnt_deaths[i]); - Screen.DrawText(fnt,Font.CR_WHITE,xx+deathslen-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_WHITE,xx+deathslen-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } xx += deathslen+spc; str = String.Format("%d",cnt_frags[i]); - Screen.DrawText(fnt,Font.CR_WHITE,xx+fragslen-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_WHITE,xx+fragslen-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); yy += lineh+lspc; } xx = int((ss.x-boxwidth)/2+pad+pad+rwidth); yy += hspc; - Screen.DrawText(fnt,Font.CR_GREEN,xx,yy,totalstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_GREEN,xx,yy,totalstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); xx += namelen+spc; if ( ng_state >= 4 ) { str = String.Format("%d",total_deaths); - Screen.DrawText(fnt,Font.CR_WHITE,xx+deathslen-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_WHITE,xx+deathslen-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } xx += deathslen+spc; str = String.Format("%d",total_frags); - Screen.DrawText(fnt,Font.CR_WHITE,xx+fragslen-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_WHITE,xx+fragslen-smallfont.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } } diff --git a/zscript/menu/swwm_menus.zsc b/zscript/menu/swwm_menus.zsc index 45f64c7af..98da5f063 100644 --- a/zscript/menu/swwm_menus.zsc +++ b/zscript/menu/swwm_menus.zsc @@ -176,7 +176,6 @@ Class OptionMenuItemSWWMPlayTime : OptionMenuItem Class SWWMOptionMenu : OptionMenu { private String ttip; - transient Font TewiFont, MPlusFont; override void Init( Menu parent, OptionMenuDescriptor desc ) { @@ -235,12 +234,8 @@ Class SWWMOptionMenu : OptionMenu break; } } - if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded'); - if ( !MPlusFont ) MPlusFont = Font.GetFont('MPlusShaded'); - Font fnt = TewiFont; - if ( language ~== "jp" ) fnt = MPlusFont; - let lines = fnt.BreakLines(ttip,CleanWidth_1-8); - int height = (4+fnt.GetHeight()*lines.Count())*CleanYFac_1; + let lines = smallfont.BreakLines(ttip,CleanWidth_1-8); + int height = (4+smallfont.GetHeight()*lines.Count())*CleanYFac_1; // draw at the bottom unless the selected option could be covered by the tooltip int ypos = Screen.GetHeight()-height; if ( cy > ypos ) ypos = 0; @@ -248,8 +243,8 @@ Class SWWMOptionMenu : OptionMenu ypos += 2*CleanYFac_1; for ( int i=0; i 0 ) { - if ( isclean ) Screen.DrawText(markfont,Font.CR_FIRE,x,y+30*CleanYFac_1,str,DTA_CleanNoMove_1,true); - else Screen.DrawText(markfont,Font.CR_FIRE,x,y+30,str,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43); + if ( isclean ) Screen.DrawText(smallfont,Font.CR_FIRE,x,y+30*CleanYFac_1,str,DTA_CleanNoMove_1,true); + else Screen.DrawText(smallfont,Font.CR_FIRE,x,y+30,str,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43); } if ( ofs < (mDesc.mItems.Size()-8) ) { str = "⌄ ⌄ ⌄"; - if ( isclean ) Screen.DrawText(markfont,Font.CR_FIRE,x,y+296*CleanYFac_1,str,DTA_CleanNoMove_1,true); - else Screen.DrawText(markfont,Font.CR_FIRE,x,y+296,str,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43); + if ( isclean ) Screen.DrawText(smallfont,Font.CR_FIRE,x,y+296*CleanYFac_1,str,DTA_CleanNoMove_1,true); + else Screen.DrawText(smallfont,Font.CR_FIRE,x,y+296,str,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43); } for ( int i=0; i=0)?color:desc.mFontColor; } @@ -519,28 +509,26 @@ Class ListMenuItemSWWMStaticTextM : ListMenuItem Super.Init(x,y); mText = text; mFont = font; - mAltFont = Font.GetFont('MPlusShadedOutline'); mColor = color; } override void Draw( bool selected, ListMenuDescriptor desc ) { if ( mText.Length() == 0 ) return; - let fnt = (language ~== "jp")?mAltFont:mFont; String text = Stringtable.Localize(mText); int w = desc?desc.DisplayWidth():ListMenuDescriptor.CleanScale; int h = desc?desc.DisplayHeight():-1; if ( w == ListMenuDescriptor.CleanScale ) { - double x = (320-fnt.StringWidth(text)*3)/2; + double x = (320-mFont.StringWidth(text))/2; double y = mYpos; SWWMUtility.AdjustClean_1(x,y); - Screen.DrawText(fnt,mColor,x,y,text,DTA_ScaleX,3.*CleanXFac_1,DTA_ScaleY,3.*CleanYFac_1); + Screen.DrawText(mFont,mColor,x,y,text,DTA_CleanNoMove_1,true); } else { - double x = (w-fnt.StringWidth(text)*3)/2; - Screen.DrawText(fnt,mColor,x,mYpos,text,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_ScaleX,3.,DTA_ScaleY,3.); + double x = (w-mFont.StringWidth(text))/2; + Screen.DrawText(mFont,mColor,x,mYpos,text,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43); } } } @@ -581,16 +569,26 @@ class ListMenuItemSWWMLogo : ListMenuItem } } -// message box that enforces newsmallfont and changes text color to match menus +// message box that changes text color to match menus and applies special scaling Class SWWMMessageBox : MessageBoxMenu { override void Init( Menu parent, String message, int messagemode, bool playsound, Name cmd, voidptr native_handler ) { Super.Init(parent,message,messagemode,playsound,cmd,native_handler); - destWidth = CleanWidth_1; - destHeight = CleanHeight_1; - textfont = (language~=="jp")?Font.GetFont('MPlusShadedOutline'):Font.GetFont('TewiShadedOutline'); - mMessage = textfont.BreakLines(Stringtable.Localize(message),200); + if ( generic_ui ) + { + destWidth = CleanWidth_1; + destHeight = CleanHeight_1; + textfont = newsmallfont; + mMessage = textfont.BreakLines(Stringtable.Localize(message),480); + } + else + { + destWidth = CleanWidth_1*3; + destHeight = CleanHeight_1*3; + textfont = bigfont; + mMessage = textfont.BreakLines(Stringtable.Localize(message),640); + } } override void Drawer() @@ -600,22 +598,31 @@ Class SWWMMessageBox : MessageBoxMenu int c = mMessage.Count(); int theight = 0; int l1 = c; + int l2 = c-1; for ( int i=0; il1)?1:3; + int scl; + if ( generic_ui ) scl = ((i>=l2)||(mMessage.StringWidth(i)==0))?1:(i>l1)?1:2; + else scl = ((i>=l2)||(mMessage.StringWidth(i)==0))?2:(i>l1)?1:3; theight += fontheight*scl; } y -= theight/2; for ( int i=0; il1)?1.:3.; - Screen.DrawText(textfont,OptionMenuSettings.mFontColorValue,destWidth/2-mMessage.StringWidth(i)*(scl/2.),y,mMessage.StringAt(i),DTA_VirtualWidth,destWidth,DTA_VirtualHeight,destHeight,DTA_KeepRatio,true,DTA_ScaleX,scl,DTA_ScaleY,scl); + double scl; + if ( generic_ui ) scl = ((i>=l2)||(mMessage.StringWidth(i)==0))?1.:(i>l1)?1.:2.; + else scl = ((i>=l2)||(mMessage.StringWidth(i)==0))?2.:(i>l1)?1.:3.; + Screen.DrawText(textfont,OptionMenuSettings.mFontColorValue,int(destWidth/2-mMessage.StringWidth(i)*(scl/2.)),y,mMessage.StringAt(i),DTA_VirtualWidth,destWidth,DTA_VirtualHeight,destHeight,DTA_KeepRatio,true,DTA_ScaleX,scl,DTA_ScaleY,scl); y += fontheight*scl; } if ( mMessageMode != 0 ) return; @@ -623,11 +630,22 @@ Class SWWMMessageBox : MessageBoxMenu mMouseY = int(y); String stryes = Stringtable.Localize("$TXT_YES"); String strno = Stringtable.Localize("$TXT_NO"); - Screen.DrawText(textfont,messageSelection==0?OptionMenuSettings.mFontColorSelection:OptionMenuSettings.mFontColor,(destWidth-2*textfont.StringWidth(stryes))/2,y,stryes, DTA_VirtualWidth,destWidth,DTA_VirtualHeight,destHeight,DTA_KeepRatio,true,DTA_ScaleX,2.,DTA_ScaleY,2.); - Screen.DrawText(textfont,messageSelection==1?OptionMenuSettings.mFontColorSelection:OptionMenuSettings.mFontColor,(destWidth-2*textfont.StringWidth(strno))/2,y+fontheight*2,strno,DTA_VirtualWidth,destWidth,DTA_VirtualHeight,destHeight,DTA_KeepRatio,true,DTA_ScaleX,2.,DTA_ScaleY,2.); - if ( (messageSelection < 0) || ((MenuTime()%8) >= 4) ) return; - Screen.DrawText(textfont,OptionMenuSettings.mFontColorSelection,(destWidth-2*textfont.StringWidth(messageSelection?strno:stryes))/2-24,y+fontheight*2*messageSelection,"►",DTA_VirtualWidth,destWidth,DTA_VirtualHeight,destHeight,DTA_KeepRatio,true,DTA_ScaleX,2.,DTA_ScaleY,2.); - Screen.DrawText(textfont,OptionMenuSettings.mFontColorSelection,(destWidth+2*textfont.StringWidth(messageSelection?strno:stryes))/2+8,y+fontheight*2*messageSelection,"◄",DTA_VirtualWidth,destWidth,DTA_VirtualHeight,destHeight,DTA_KeepRatio,true,DTA_ScaleX,2.,DTA_ScaleY,2.); + if ( generic_ui ) + { + Screen.DrawText(textfont,messageSelection==0?OptionMenuSettings.mFontColorSelection:OptionMenuSettings.mFontColor,(destWidth-textfont.StringWidth(stryes))/2,y,stryes, DTA_VirtualWidth,destWidth,DTA_VirtualHeight,destHeight,DTA_KeepRatio,true); + Screen.DrawText(textfont,messageSelection==1?OptionMenuSettings.mFontColorSelection:OptionMenuSettings.mFontColor,(destWidth-textfont.StringWidth(strno))/2,y+fontheight,strno,DTA_VirtualWidth,destWidth,DTA_VirtualHeight,destHeight,DTA_KeepRatio,true); + if ( (messageSelection < 0) || ((MenuTime()%8) >= 4) ) return; + Screen.DrawText(textfont,OptionMenuSettings.mFontColorSelection,(destWidth-textfont.StringWidth(messageSelection?strno:stryes))/2-16,y+fontheight*messageSelection,"►",DTA_VirtualWidth,destWidth,DTA_VirtualHeight,destHeight,DTA_KeepRatio,true); + Screen.DrawText(textfont,OptionMenuSettings.mFontColorSelection,(destWidth+textfont.StringWidth(messageSelection?strno:stryes))/2+8,y+fontheight*messageSelection,"◄",DTA_VirtualWidth,destWidth,DTA_VirtualHeight,destHeight,DTA_KeepRatio,true); + } + else + { + Screen.DrawText(textfont,messageSelection==0?OptionMenuSettings.mFontColorSelection:OptionMenuSettings.mFontColor,(destWidth-2*textfont.StringWidth(stryes))/2,y,stryes, DTA_VirtualWidth,destWidth,DTA_VirtualHeight,destHeight,DTA_KeepRatio,true,DTA_ScaleX,2.,DTA_ScaleY,2.); + Screen.DrawText(textfont,messageSelection==1?OptionMenuSettings.mFontColorSelection:OptionMenuSettings.mFontColor,(destWidth-2*textfont.StringWidth(strno))/2,y+fontheight*2,strno,DTA_VirtualWidth,destWidth,DTA_VirtualHeight,destHeight,DTA_KeepRatio,true,DTA_ScaleX,2.,DTA_ScaleY,2.); + if ( (messageSelection < 0) || ((MenuTime()%8) >= 4) ) return; + Screen.DrawText(textfont,OptionMenuSettings.mFontColorSelection,(destWidth-2*textfont.StringWidth(messageSelection?strno:stryes))/2-72,y+fontheight*2*messageSelection,"►",DTA_VirtualWidth,destWidth,DTA_VirtualHeight,destHeight,DTA_KeepRatio,true,DTA_ScaleX,2.,DTA_ScaleY,2.); + Screen.DrawText(textfont,OptionMenuSettings.mFontColorSelection,(destWidth+2*textfont.StringWidth(messageSelection?strno:stryes))/2+24,y+fontheight*2*messageSelection,"◄",DTA_VirtualWidth,destWidth,DTA_VirtualHeight,destHeight,DTA_KeepRatio,true,DTA_ScaleX,2.,DTA_ScaleY,2.); + } } override bool MouseEvent( int type, int x, int y ) @@ -641,11 +659,11 @@ Class SWWMMessageBox : MessageBoxMenu else { int sel = -1; - int fh = (textfont.GetHeight()-2)*2; + int fh = (textfont.GetHeight()-2)*(generic_ui?1:2); // convert x/y from screen to virtual coordinates, according to CleanX/Yfac use in DrawTexture x = x*destWidth/screen.GetWidth(); y = y*destHeight/screen.GetHeight(); - if ( (y >= mMouseY) && (y < mMouseY+2*fh) ) + if ( (y >= mMouseY) && (y < mMouseY+(generic_ui?1:2)*fh) ) { sel = (y >= mMouseY+fh); // are we actually selecting the text? @@ -666,32 +684,15 @@ Class SWWMMessageBox : MessageBoxMenu class ListMenuItemSWWMTextItemM : ListMenuItemSelectable { String mText; - Font mFont, mAltFont; - bool wantdie; + Font mFont; int mColor; int mColorSelected; - // gross hack to use an appropriate font for the I WANT DIE difficulty - private bool IsFullWidthText( String str ) - { - int tlen = str.CodePointCount(); - for ( int i=0, pos=0; i= 0xFF00) && (ch <= 0xFFFF) ) - return true; - } - return false; - } - void Init( ListMenuDescriptor desc, String text, String hotkey, Name child, int param = 0 ) { Super.Init(desc.mXpos,desc.mYpos,desc.mLinespacing,child,param); mText = text; - wantdie = IsFullWidthText(StringTable.Localize(mText)); mFont = desc.mFont; - mAltFont = Font.GetFont('MPlusShadedOutline'); mColor = desc.mFontColor; mColorSelected = desc.mFontcolor2; mHotkey = hotkey.GetNextCodePoint(0); @@ -701,9 +702,7 @@ class ListMenuItemSWWMTextItemM : ListMenuItemSelectable { Super.Init(x,y,height,child,param); mText = text; - wantdie = IsFullWidthText(StringTable.Localize(mText)); mFont = font; - mAltFont = Font.GetFont('MPlusShadedOutline'); mColor = color; mColorSelected = color2; mHotkey = hotkey; @@ -711,38 +710,40 @@ class ListMenuItemSWWMTextItemM : ListMenuItemSelectable override int GetWidth() { - let fnt = ((language ~== "jp") || wantdie)?mAltFont:mFont; - return max(1,3*fnt.StringWidth(StringTable.Localize(mText))); + let font = menuDelegate.PickFont(mFont); + return max(1,font.StringWidth(StringTable.Localize(mText))); } override void Draw( bool selected, ListMenuDescriptor desc ) { - let fnt = ((language ~== "jp") || wantdie)?mAltFont:mFont; int w = desc?desc.DisplayWidth():ListMenuDescriptor.CleanScale; int h = desc?desc.DisplayHeight():-1; String text = StringTable.Localize(mText); + let font = menuDelegate.PickFont(mFont); double x; // centered - if ( w == ListMenuDescriptor.CleanScale ) x = (320-fnt.StringWidth(text)*3)/2; - else x = (w-fnt.StringWidth(text)*3)/2; - double y = mYPos-4.5; // slight baseline offset + if ( w == ListMenuDescriptor.CleanScale ) x = (320-font.StringWidth(text))/2; + else x = (w-font.StringWidth(text))/2; + double y = mYpos; + // slight baseline offset + if ( generic_ui ) y += 4.; + else y -= 4.5; if ( selected ) { double xx = x; SWWMUtility.StripColor(text); int tlen = text.CodePointCount(); + int kern = font.GetDefaultKerning(); if ( w == ListMenuDescriptor.CleanScale ) { - // due to specifics of how DTA_Clean works we can't combine with with DTA_ScaleX/Y - // so we have to set the scaling manually SWWMUtility.AdjustClean_1(xx,y); for ( int i=0, pos=0; i scrolls; transient ui int sline; transient ui double sbase; transient ui String lastlang; - // returns MPlus if we're playing in Japanese, otherwise returns the requested font - private ui Font LangFont( Font req ) - { - if ( language ~== "jp" ) return MPlusFont; - return req; - } - override void WorldTick() { if ( level.maptime == 1 ) S_ChangeMusic("music/TRAUMATI.XM"); @@ -36,9 +28,6 @@ Class SWWMTitleStuff : EventHandler if ( !tex[0] ) tex[0] = TexMan.CheckForTexture("graphics/UnSXLogo.png",TexMan.Type_Any); if ( !tex[1] ) tex[1] = TexMan.CheckForTexture("graphics/SWWMGZLogo.png",TexMan.Type_Any); if ( !tex[2] ) tex[2] = TexMan.CheckForTexture("graphics/tempbg.png",TexMan.Type_Any); - if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded'); - if ( !MPlusFont ) MPlusFont = Font.GetFont('MPlusShaded'); - Font fnt = LangFont(TewiFont); Vector2 tsize, vsize; if ( swwm_fuzz ) { @@ -63,11 +52,11 @@ Class SWWMTitleStuff : EventHandler String str = StringTable.Localize("$SWWM_TITLEPRESENTS"); alf = clamp(((level.maptime+e.FracTic)/GameTicRate)-10,0.,1.); alf *= 1.-clamp(((level.maptime+e.FracTic)/GameTicRate)-16,0.,1.); - Screen.DrawText(fnt,Font.CR_WHITE,(ss.x-fnt.StringWidth(str))/2,(ss.y-fnt.GetHeight())/2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alf); + Screen.DrawText(smallfont,Font.CR_WHITE,(ss.x-smallfont.StringWidth(str))/2,(ss.y-smallfont.GetHeight())/2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alf); str = StringTable.Localize("$SWWM_TITLEMODBY"); alf = clamp(((level.maptime+e.FracTic)/GameTicRate)-18,0.,1.); alf *= 1.-clamp(((level.maptime+e.FracTic)/GameTicRate)-24,0.,1.); - Screen.DrawText(fnt,Font.CR_WHITE,(ss.x-fnt.StringWidth(str))/2,(ss.y-fnt.GetHeight())/2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alf); + Screen.DrawText(smallfont,Font.CR_WHITE,(ss.x-smallfont.StringWidth(str))/2,(ss.y-smallfont.GetHeight())/2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alf); tsize = TexMan.GetScaledSize(tex[1]); sar = tsize.x/tsize.y; if ( sar > ar ) vsize = (tsize.x,tsize.x/ar); @@ -87,7 +76,7 @@ Class SWWMTitleStuff : EventHandler } lastlang = language; // estimate scrool length - double llen = fnt.StringWidth(scrolls[sline]); + double llen = smallfont.StringWidth(scrolls[sline]); double soffset = 40*((level.maptime+e.FracTic)/GameTicRate-sbase); if ( soffset > llen+ss.x ) { @@ -110,15 +99,15 @@ Class SWWMTitleStuff : EventHandler alf = max(0,1.-abs((ss.x/2)-xx)/(ss.x/2))**.5; alf *= .2*trl; double xxofs = 5*sin(15*i+120*(level.maptime+e.FracTic)/GameTicRate-90.*(1.-trl))-16*(1.-trl); - Screen.DrawChar(fnt,Font.CR_BLUE,xx-xxofs,yy,ch,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alf,DTA_LegacyRenderStyle,STYLE_Add); + Screen.DrawChar(smallfont,Font.CR_BLUE,xx-xxofs,yy,ch,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alf,DTA_LegacyRenderStyle,STYLE_Add); } double yy = (ss.y-40)+10*sin(15*i+160*(level.maptime+e.FracTic)/GameTicRate); alf = max(0,1.-abs((ss.x/2)-xx)/(ss.x/2))**.5; double xxofs = 5*sin(15*i+120*(level.maptime+e.FracTic)/GameTicRate); Color c = Color(int(127.5+127.5*sin(10*i+80*(level.maptime+e.FracTic)/GameTicRate)),0,0); - Screen.DrawChar(fnt,Font.CR_SAPPHIRE,xx-xxofs,yy,ch,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alf); + Screen.DrawChar(smallfont,Font.CR_SAPPHIRE,xx-xxofs,yy,ch,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alf); } - xx += fnt.GetCharWidth(ch)-1; // keming + xx += smallfont.GetCharWidth(ch)+smallfont.GetDefaultKerning(); } } } diff --git a/zscript/swwm_statichandler.zsc b/zscript/swwm_statichandler.zsc index 5c3e4c0cb..910a611e1 100644 --- a/zscript/swwm_statichandler.zsc +++ b/zscript/swwm_statichandler.zsc @@ -89,14 +89,6 @@ Class SWWMStaticHandler : StaticEventHandler override void OnRegister() { - // preload various fonts - Font.GetFont('k6x8Shaded'); - Font.GetFont('MiniwiShaded'); - Font.GetFont('MPlusShaded'); - Font.GetFont('TewiShaded'); - // used for "big text" - Font.GetFont('MPlusShadedOutline'); - Font.GetFont('TewiShadedOutline'); // fix voice type cvar int lmp; Array types; diff --git a/zscript/weapons/swwm_blazeit.zsc b/zscript/weapons/swwm_blazeit.zsc index 99b78fb0f..bf23dcfcc 100644 --- a/zscript/weapons/swwm_blazeit.zsc +++ b/zscript/weapons/swwm_blazeit.zsc @@ -103,7 +103,6 @@ Class Hellblazer : SWWMWeapon Property ClipCount : clipcount; transient ui TextureID WeaponBox, AmmoIcon[4], LoadedIcon[4], LockIcon[4]; - transient ui Font TewiFont; transient ui SWWMProjectionData projdata; override void RenderUnderlay( RenderEvent e ) @@ -146,7 +145,6 @@ Class Hellblazer : SWWMWeapon override void DrawWeapon( double TicFrac, double bx, double by, Vector2 hs, Vector2 ss ) { static const Class types[] = {"HellblazerMissiles","HellblazerCrackshots","HellblazerRavagers","HellblazerWarheads"}; - if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded'); if ( !WeaponBox ) { WeaponBox = TexMan.CheckForTexture("graphics/HUD/HellblazerDisplay.png",TexMan.Type_Any); @@ -174,7 +172,7 @@ Class Hellblazer : SWWMWeapon { int amt = Owner.CountInv(types[i]); String amtstr = String.Format("%3d",amt); - Screen.DrawText(TewiFont,Font.CR_FIRE,bx+xx,by+yy,amtstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,(types[i]==nextammo)?Color(0,0,0,0):Color(128,0,0,0)); + Screen.DrawText(smallfont,Font.CR_FIRE,bx+xx,by+yy,amtstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,(types[i]==nextammo)?Color(0,0,0,0):Color(128,0,0,0)); Screen.DrawTexture(AmmoIcon[i],false,bx+xx+19,by+yy+1,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,(types[i]==nextammo)?Color(0,0,0,0):Color(128,0,0,0)); yy += 13; if ( i%2 ) diff --git a/zscript/weapons/swwm_cbt.zsc b/zscript/weapons/swwm_cbt.zsc index aaa97ddeb..498019e96 100644 --- a/zscript/weapons/swwm_cbt.zsc +++ b/zscript/weapons/swwm_cbt.zsc @@ -15,7 +15,6 @@ Class Wallbuster : SWWMWeapon transient bool clearout; transient ui TextureID WeaponBox, AmmoIcon[4], LoadIcon[4], UsedIcon[4], EmptyIcon; - transient ui Font TewiFont; Class curobt; ui Vector3 cpos25[25]; @@ -64,7 +63,6 @@ Class Wallbuster : SWWMWeapon 8,14,18,14, 8, 31,35,31,25,25 }; - if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded'); if ( !WeaponBox ) { WeaponBox = TexMan.CheckForTexture("graphics/HUD/WallbusterDisplay.png",TexMan.Type_Any); @@ -89,7 +87,7 @@ Class Wallbuster : SWWMWeapon { Screen.DrawTexture(AmmoIcon[i],false,bx-ox,by-oy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); String astr = String.Format("%3d",Owner.CountInv(types[i])); - Screen.DrawText(TewiFont,Font.CR_FIRE,bx-ox-(TewiFont.StringWidth(astr)+1),by-oy-2,astr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-ox-(smallfont.StringWidth(astr)+1),by-oy-2,astr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); oy += 10; if ( i == 1 ) { diff --git a/zscript/weapons/swwm_cbt_ui.zsc b/zscript/weapons/swwm_cbt_ui.zsc index fed868595..1d9503138 100644 --- a/zscript/weapons/swwm_cbt_ui.zsc +++ b/zscript/weapons/swwm_cbt_ui.zsc @@ -2,26 +2,12 @@ Class WallbusterReloadMenu : GenericMenu { - transient Font TewiFont, MPlusFont, MiniwiFont, k6x8Font; TextureID MainWindow, AmmoIcon[4]; int sel0; Array queue; int AmmoSets[4]; bool isrclick, ismclick; - // if playing in Japanese, returns an alternate font of the same height - // Tewi -> MPlus - // Miniwi -> k6x8 - Font LangFont( Font req ) - { - if ( language ~== "jp" ) - { - if ( req == MiniwiFont ) return k6x8Font; - return MPlusFont; - } - return req; - } - override void Init( Menu parent ) { Super.Init(parent); @@ -31,10 +17,6 @@ Class WallbusterReloadMenu : GenericMenu Close(); return; } - TewiFont = Font.GetFont('TewiShaded'); - MPlusFont = Font.GetFont('MPlusShaded'); - MiniwiFont = Font.GetFont('MiniwiShaded'); - k6x8Font = Font.GetFont('k6x8Shaded'); MainWindow = TexMan.CheckForTexture("graphics/HUD/WallbusterMenu.png",TexMan.Type_Any); AmmoIcon[0] = TexMan.CheckForTexture("graphics/HUD/RedShell.png",TexMan.Type_Any); AmmoIcon[1] = TexMan.CheckForTexture("graphics/HUD/GreenShell.png",TexMan.Type_Any); @@ -306,11 +288,11 @@ Class WallbusterReloadMenu : GenericMenu { Screen.DrawTexture(AmmoIcon[i],false,origin.x+ox,origin.y+oy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,(i==sel0)?Color(0,0,0,0):Color(128,0,0,0)); String astr = String.Format("%3d",players[consoleplayer].mo.CountInv(types[i])-AmmoSets[i]); - Screen.DrawText(TewiFont,Font.CR_FIRE,origin.x+ox-(TewiFont.StringWidth(astr)+1),origin.y+oy-2,astr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,(i==sel0)?Color(0,0,0,0):Color(128,0,0,0)); + Screen.DrawText(smallfont,Font.CR_FIRE,origin.x+ox-(smallfont.StringWidth(astr)+1),origin.y+oy-2,astr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,(i==sel0)?Color(0,0,0,0):Color(128,0,0,0)); ox += 33; } // pointer (▸) - Screen.DrawChar(TewiFont,Font.CR_GREEN,origin.x+2+33*sel0,origin.y,0x25B8,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawChar(smallfont,Font.CR_GREEN,origin.x+2+33*sel0,origin.y,0x25B8,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); int siz = queue.Size()-1; ox = 2+siz*5+(siz/5); oy = 15; @@ -322,35 +304,29 @@ Class WallbusterReloadMenu : GenericMenu } // text stuff String str; - Font fnt; int boxw, sw; double x, y; - fnt = LangFont(TewiFont); str = StringTable.Localize("$SWWM_BUSTERTITLE"); - sw = fnt.StringWidth(str); + sw = smallfont.StringWidth(str); boxw = sw; - fnt = LangFont(MiniwiFont); str = "(C)2148 Akari Labs"; - sw = fnt.StringWidth(str); + sw = smallfont2.StringWidth(str); if ( sw > boxw ) boxw = sw; x = floor((ss.x-boxw)/2.); y = origin.y-30; Screen.Dim("Black",.8,int((x-2)*hs),int((y-1)*hs),int((boxw+4)*hs),int(25*hs)); - fnt = LangFont(TewiFont); str = StringTable.Localize("$SWWM_BUSTERTITLE"); - sw = fnt.StringWidth(str); + sw = smallfont.StringWidth(str); x = floor((ss.x-sw)/2.); - Screen.DrawText(fnt,Font.CR_FIRE,x,y,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,x,y,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); y += 14; - fnt = LangFont(MiniwiFont); str = "(C)2148 Akari Labs"; - sw = fnt.StringWidth(str); + sw = smallfont2.StringWidth(str); x = floor((ss.x-sw)/2.); - Screen.DrawText(fnt,Font.CR_GOLD,x,y,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont2,Font.CR_GOLD,x,y,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); y = origin.y+36; - fnt = LangFont(MiniwiFont); str = StringTable.Localize("$SWWM_BUSTERKEYS"); - BrokenLines l = fnt.BreakLines(str,300); + BrokenLines l = smallfont2.BreakLines(str,300); boxw = 0; for ( int i=0; igametic)&&((failtime-gametic)%16>=8); if ( doublestacc ) diff --git a/zscript/weapons/swwm_splode.zsc b/zscript/weapons/swwm_splode.zsc index c9ada6329..ee5817c16 100644 --- a/zscript/weapons/swwm_splode.zsc +++ b/zscript/weapons/swwm_splode.zsc @@ -9,7 +9,6 @@ Class ExplodiumGun : SWWMWeapon bool firstselect; double casex, casey; transient ui TextureID WeaponBox; - transient ui Font TewiFont; int deadeyecnt; Property ClipCount : ClipCount; @@ -17,10 +16,9 @@ Class ExplodiumGun : SWWMWeapon override void DrawWeapon( double TicFrac, double bx, double by, Vector2 hs, Vector2 ss ) { if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/ExplodiumDisplay.png",TexMan.Type_Any); - if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded'); Screen.DrawTexture(WeaponBox,false,bx-24,by-22,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - if ( chambered ) Screen.DrawText(TewiFont,Font.CR_FIRE,bx-22,by-21,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); - Screen.DrawText(TewiFont,Font.CR_FIRE,bx-19,by-14,String.Format("%d",max(clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + if ( chambered ) Screen.DrawText(smallfont,Font.CR_FIRE,bx-22,by-21,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-19,by-14,String.Format("%d",max(clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } override void HudTick() @@ -584,19 +582,17 @@ Class DualExplodiumGun : SWWMWeapon bool chambered; double casex, casey, lcasex, lcasey; transient ui TextureID WeaponBox; - transient ui Font TewiFont; Property ClipCount : ClipCount; override void DrawWeapon( double TicFrac, double bx, double by, Vector2 hs, Vector2 ss ) { if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/DualExplodiumDisplay.png",TexMan.Type_Any); - if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded'); Screen.DrawTexture(WeaponBox,false,bx-48,by-22,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - if ( ExplodiumGun(SisterWeapon).chambered ) Screen.DrawText(TewiFont,Font.CR_FIRE,bx-22,by-21,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); - Screen.DrawText(TewiFont,Font.CR_FIRE,bx-19,by-14,String.Format("%d",max(ExplodiumGun(SisterWeapon).clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - if ( chambered ) Screen.DrawText(TewiFont,Font.CR_FIRE,bx-46,by-21,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); - Screen.DrawText(TewiFont,Font.CR_FIRE,bx-43,by-14,String.Format("%d",max(clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + if ( ExplodiumGun(SisterWeapon).chambered ) Screen.DrawText(smallfont,Font.CR_FIRE,bx-22,by-21,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-19,by-14,String.Format("%d",max(ExplodiumGun(SisterWeapon).clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + if ( chambered ) Screen.DrawText(smallfont,Font.CR_FIRE,bx-46,by-21,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-43,by-14,String.Format("%d",max(clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } override void RenderUnderlay( RenderEvent e ) diff --git a/zscript/weapons/swwm_tastytreat.zsc b/zscript/weapons/swwm_tastytreat.zsc index 3ea3c7c47..ce35bffe5 100644 --- a/zscript/weapons/swwm_tastytreat.zsc +++ b/zscript/weapons/swwm_tastytreat.zsc @@ -7,7 +7,6 @@ Class CandyGun : SWWMWeapon bool chambered; double casex, casey; transient ui TextureID WeaponBox; - transient ui Font TewiFont; bool tospecial; Property ClipCount : ClipCount; @@ -87,20 +86,19 @@ Class CandyGun : SWWMWeapon { if ( Amount <= 0 ) return; if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/CandygunDisplay.png",TexMan.Type_Any); - if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded'); Screen.DrawTexture(WeaponBox,false,bx-51,by-44,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - if ( chambered ) Screen.DrawText(TewiFont,Font.CR_FIRE,bx-22,by-21,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); - Screen.DrawText(TewiFont,Font.CR_FIRE,bx-19,by-14,String.Format("%d",max(clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + if ( chambered ) Screen.DrawText(smallfont,Font.CR_FIRE,bx-22,by-21,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-19,by-14,String.Format("%d",max(clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); int cx = (Ammo1.Amount>9)?48:45; int sb = Owner.CountInv("CandyGunBullets"); if ( sb > 0 ) { int cbx = (sb>9)?50:47; - Screen.DrawText(TewiFont,Font.CR_FIRE,bx-cbx,by-21,String.Format("⁺%s",SWWMUtility.SuperscriptNum(sb)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); - Screen.DrawText(TewiFont,Font.CR_FIRE,bx-cx,by-14,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-cbx,by-21,String.Format("⁺%s",SWWMUtility.SuperscriptNum(sb)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-14,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } - else Screen.DrawText(TewiFont,Font.CR_FIRE,bx-cx,by-18,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - Screen.DrawText(TewiFont,Font.CR_FIRE,bx-37,by-40,String.Format("%d",Ammo2.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + else Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-18,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-37,by-40,String.Format("%d",Ammo2.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } override Vector3 GetTraceOffset() diff --git a/zscript/weapons/swwm_thiccboolet.zsc b/zscript/weapons/swwm_thiccboolet.zsc index 2f3f24d44..749fcc48e 100644 --- a/zscript/weapons/swwm_thiccboolet.zsc +++ b/zscript/weapons/swwm_thiccboolet.zsc @@ -225,7 +225,6 @@ Class SilverBullet : SWWMWeapon int nkills; transient ui TextureID WeaponBox[2], ZoomBar, BulletIcon[2], AmmoIcon[2]; - transient ui Font TewiFont; transient ui DynamicValueInterpolator ZoomInter; bool zoomed; @@ -253,7 +252,6 @@ Class SilverBullet : SWWMWeapon if ( !AmmoIcon[0] ) AmmoIcon[0] = TexMan.CheckForTexture("graphics/HUD/SilverBulletXSBMag.png",TexMan.Type_Any); if ( !AmmoIcon[1] ) AmmoIcon[1] = TexMan.CheckForTexture("graphics/HUD/SilverBulletFCBMag.png",TexMan.Type_Any); if ( !ZoomBar ) ZoomBar = TexMan.CheckForTexture("graphics/HUD/SilverBulletZoomBar.png",TexMan.Type_Any); - if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded'); int zl = clamp(ZoomInter?ZoomInter.GetValue():int(zoomlevel*10),0,160); if ( zl >= 10 ) { @@ -272,19 +270,19 @@ Class SilverBullet : SWWMWeapon if ( sb > 0 ) { int cbx = (sb>9)?34:30; - Screen.DrawText(TewiFont,Font.CR_FIRE,bx-cbx,by-21,String.Format("⁺%s",SWWMUtility.SuperscriptNum(sb)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1,DTA_ColorOverlay,fcbselected?Color(128,0,0,0):Color(0,0,0,0)); - Screen.DrawText(TewiFont,Font.CR_FIRE,bx-cx,by-14,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(128,0,0,0):Color(0,0,0,0)); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-cbx,by-21,String.Format("⁺%s",SWWMUtility.SuperscriptNum(sb)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1,DTA_ColorOverlay,fcbselected?Color(128,0,0,0):Color(0,0,0,0)); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-14,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(128,0,0,0):Color(0,0,0,0)); } - else Screen.DrawText(TewiFont,Font.CR_FIRE,bx-cx,by-18,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(128,0,0,0):Color(0,0,0,0)); + else Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-18,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(128,0,0,0):Color(0,0,0,0)); cx = (Ammo2.Amount>9)?32:29; sb = Owner.CountInv("SilverBullets2"); if ( sb > 0 ) { int cbx = (sb>9)?34:30; - Screen.DrawText(TewiFont,Font.CR_FIRE,bx-cbx,by-43,String.Format("⁺%s",SWWMUtility.SuperscriptNum(sb)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1,DTA_ColorOverlay,fcbselected?Color(0,0,0,0):Color(128,0,0,0)); - Screen.DrawText(TewiFont,Font.CR_FIRE,bx-cx,by-36,String.Format("%d",Ammo2.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(0,0,0,0):Color(128,0,0,0)); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-cbx,by-43,String.Format("⁺%s",SWWMUtility.SuperscriptNum(sb)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1,DTA_ColorOverlay,fcbselected?Color(0,0,0,0):Color(128,0,0,0)); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-36,String.Format("%d",Ammo2.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(0,0,0,0):Color(128,0,0,0)); } - else Screen.DrawText(TewiFont,Font.CR_FIRE,bx-cx,by-40,String.Format("%d",Ammo2.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(0,0,0,0):Color(128,0,0,0)); + else Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-40,String.Format("%d",Ammo2.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(0,0,0,0):Color(128,0,0,0)); } override void HudTick() {