From 54831b173c635d70c8e2b634dcb39acfc5e2aa94 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Wed, 24 Jun 2020 12:26:03 +0200 Subject: [PATCH] Clean up help menu code. Adjusted fullscreen fuzz so it uses integer scaling. --- cvarinfo.txt | 1 - language.version | 2 +- zscript/swwm_help.zsc | 64 +++++++++++++++++------------------------- zscript/swwm_title.zsc | 11 +++----- 4 files changed, 31 insertions(+), 47 deletions(-) diff --git a/cvarinfo.txt b/cvarinfo.txt index 0a19b4091..4b946b1b3 100644 --- a/cvarinfo.txt +++ b/cvarinfo.txt @@ -59,5 +59,4 @@ server bool swwm_crouchjump = false; // allows crouch-jumping (which looks weir user noarchive int swwm_cbtlast = 0; // last selected ammo for the wallbuster server bool swwm_cbtall = true; // wallbuster breaks any wall, not just movable ones server bool swwm_doomfall = false; // monsters take fall damage outside of hexen -user noarchive int swwm_lasthelp = 0; // last selected page in the help menu server bool swwm_capmcrange = false; // cap ynykron chain reaction range diff --git a/language.version b/language.version index 501410295..408963e46 100644 --- a/language.version +++ b/language.version @@ -1,2 +1,2 @@ [default] -SWWM_MODVER="\chSWWM \cwGZ\c- r391 (Wed 24 Jun 12:07:57 CEST 2020)"; +SWWM_MODVER="\chSWWM \cwGZ\c- r391 (Wed 24 Jun 12:26:03 CEST 2020)"; diff --git a/zscript/swwm_help.zsc b/zscript/swwm_help.zsc index 90d46cfcb..f0bb2b4f3 100644 --- a/zscript/swwm_help.zsc +++ b/zscript/swwm_help.zsc @@ -45,7 +45,7 @@ Class SWWMHelpMenu : GenericMenu override void Init( Menu parent ) { - curpage = CVar.GetCVar('swwm_lasthelp',players[consoleplayer]).GetInt(); + curpage = 0; prevpage = -1; fadetic = gametic; pagedir = 0; @@ -66,7 +66,6 @@ Class SWWMHelpMenu : GenericMenu MenuSound("menu/choose"); prevpage = curpage; curpage++; - CVar.GetCVar('swwm_lasthelp',players[consoleplayer]).SetInt(curpage); pagedir = 1; fadetic = gametic; } @@ -81,7 +80,6 @@ Class SWWMHelpMenu : GenericMenu MenuSound("menu/choose"); prevpage = curpage; curpage--; - CVar.GetCVar('swwm_lasthelp',players[consoleplayer]).SetInt(curpage); pagedir = -1; fadetic = gametic; } @@ -145,54 +143,49 @@ Class SWWMHelpMenu : GenericMenu { Font fnt = LangFont(TewiFont); int h = fnt.GetHeight(); - String str = ""; + String hdr = "", txt = ""; BrokenLines l; int maxlen = 0, lh; double y = 0; switch ( page ) { case PAGE_STORY: - if ( gameinfo.gametype&GAME_Heretic ) str = StringTable.Localize("$SWWM_HELP_STORYHERETIC"); - else if ( gameinfo.gametype&GAME_Hexen ) str = StringTable.Localize("$SWWM_HELP_STORYHEXEN"); - else if ( gameinfo.gametype&GAME_Strife ) str = StringTable.Localize("$SWWM_HELP_STORYSTRIFE"); - else str = StringTable.Localize("$SWWM_HELP_STORYDOOM"); - l = fnt.BreakLines(str,600); - str = StringTable.Localize("$SWWM_HELP_STORY"); + hdr = StringTable.Localize("$SWWM_HELP_STORY"); + if ( gameinfo.gametype&GAME_Heretic ) txt = StringTable.Localize("$SWWM_HELP_STORYHERETIC"); + else if ( gameinfo.gametype&GAME_Hexen ) txt = StringTable.Localize("$SWWM_HELP_STORYHEXEN"); + else if ( gameinfo.gametype&GAME_Strife ) txt = StringTable.Localize("$SWWM_HELP_STORYSTRIFE"); + else txt = StringTable.Localize("$SWWM_HELP_STORYDOOM"); break; case PAGE_DEMO: - str = StringTable.Localize("$SWWM_HELP_DEMOTXT"); - l = fnt.BreakLines(str,600); - str = StringTable.Localize("$SWWM_HELP_DEMO"); + hdr = StringTable.Localize("$SWWM_HELP_DEMO"); + txt = StringTable.Localize("$SWWM_HELP_DEMOTXT"); break; case PAGE_ARSENAL1: - str = StringTable.Localize("$SWWM_HELP_ARSE1TXT"); - l = fnt.BreakLines(str,600); - str = StringTable.Localize("$SWWM_HELP_ARSE1"); + hdr = StringTable.Localize("$SWWM_HELP_ARSE1"); + txt = StringTable.Localize("$SWWM_HELP_ARSE1TXT"); break; case PAGE_ARSENAL2: - str = StringTable.Localize("$SWWM_HELP_ARSE2TXT"); - l = fnt.BreakLines(str,600); - str = StringTable.Localize("$SWWM_HELP_ARSE2"); + hdr = StringTable.Localize("$SWWM_HELP_ARSE2"); + txt = StringTable.Localize("$SWWM_HELP_ARSE2TXT"); break; case PAGE_ARSENAL3: - str = StringTable.Localize("$SWWM_HELP_ARSE3TXT"); - l = fnt.BreakLines(str,600); - str = StringTable.Localize("$SWWM_HELP_ARSE3"); + hdr = StringTable.Localize("$SWWM_HELP_ARSE3"); + txt = StringTable.Localize("$SWWM_HELP_ARSE3TXT"); break; case PAGE_KBASE: - str = StringTable.Localize("$SWWM_HELP_KBASETXT"); - l = fnt.BreakLines(str,600); - str = StringTable.Localize("$SWWM_HELP_KBASE"); + hdr = StringTable.Localize("$SWWM_HELP_KBASE"); + txt = StringTable.Localize("$SWWM_HELP_KBASETXT"); break; case PAGE_TECH: - str = StringTable.Localize("$SWWM_HELP_TECHTXT"); - l = fnt.BreakLines(str,600); - str = StringTable.Localize("$SWWM_HELP_TECH"); + hdr = StringTable.Localize("$SWWM_HELP_TECH"); + txt = StringTable.Localize("$SWWM_HELP_TECHTXT"); break; } - if ( str && (l.Count() > 0) ) + 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+200-(h*4+lh)/2,hdr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha); for ( int i=0; i ar ) vsize = (tsize.y*ar,tsize.y); - else vsize = tsize; + double zoom = max(ceil(Screen.GetWidth()/tsize.x),ceil(Screen.GetHeight()/tsize.y)); + Vector2 vsize = (Screen.GetWidth(),Screen.GetHeight())/zoom; 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); double hs; if ( (Screen.GetWidth() < 640) || (Screen.GetHeight() < 400) ) hs = max(min(floor(Screen.GetWidth()/320.),floor(Screen.GetHeight()/200.)),1.)/2.; diff --git a/zscript/swwm_title.zsc b/zscript/swwm_title.zsc index e678ef178..9f5775066 100644 --- a/zscript/swwm_title.zsc +++ b/zscript/swwm_title.zsc @@ -28,17 +28,14 @@ Class SWWMTitleStuff : EventHandler if ( !TewiFont ) TewiFont = Font.GetFont('TewiShadedInverse'); if ( !MPlusFont ) MPlusFont = Font.GetFont('MPlusShadedInverse'); Font fnt = LangFont(TewiFont); - double ar = Screen.GetAspectRatio(); Vector2 tsize = TexMan.GetScaledSize(tex[2]); - double sar = tsize.x/tsize.y; - Vector2 vsize; - if ( sar < ar ) vsize = (tsize.x,tsize.x/ar); - else if ( sar > ar ) vsize = (tsize.y*ar,tsize.y); - else vsize = tsize; + double zoom = max(ceil(Screen.GetWidth()/tsize.x),ceil(Screen.GetHeight()/tsize.y)); + Vector2 vsize = (Screen.GetWidth(),Screen.GetHeight())/zoom; Screen.DrawTexture(tex[2],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)); Screen.Dim("Black",clamp(1.-((level.maptime+e.FracTic)/Thinker.TICRATE)*.05,0.,1.),0,0,Screen.GetWidth(),Screen.GetHeight()); + double ar = Screen.GetAspectRatio(); tsize = TexMan.GetScaledSize(tex[0]); - sar = tsize.x/tsize.y; + double sar = tsize.x/tsize.y; if ( sar > ar ) vsize = (tsize.x,tsize.x/ar); else if ( sar < ar ) vsize = (tsize.y*ar,tsize.y); else vsize = tsize;