From 127440f03c532861134ddd004d9aa08ca10daca5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 13 Oct 2020 22:53:27 +0200 Subject: [PATCH] - fixed some menu alignment issues * the left selector in Duke was misplaced to the right. * some issues with incomplete handling of RR's downscaled fonts. * give SW's caption bar a little more space on the edges. --- wadsrc/static/zscript/games/duke/ui/menu.zs | 8 ++++---- wadsrc/static/zscript/games/sw/ui/menu.zs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wadsrc/static/zscript/games/duke/ui/menu.zs b/wadsrc/static/zscript/games/duke/ui/menu.zs index b0d343593..c8fe25b6d 100644 --- a/wadsrc/static/zscript/games/duke/ui/menu.zs +++ b/wadsrc/static/zscript/games/duke/ui/menu.zs @@ -9,13 +9,13 @@ class DukeMenuDelegate : RazeMenuDelegate let fonth = font.GetGlyphHeight("A"); if (drawit) { - int width = font.StringWidth(title); double scalex = (gameinfo.gameType & GAMEFLAG_RRALL)? 0.4 : 1.; + double width = font.StringWidth(title); double scaley = scalex; if (texid.isValid()) { screen.DrawTexture(texid, false, 160, 19, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_CenterOffsetRel, true, DTA_Color, 0xff808080); - if (texsize.X - 30 < width) scalex = (texsize.X - 30) / width; // Squash the text if it doesn't fit. + if (texsize.X - 30 < width * scalex) scalex = (texsize.X - 30) / (width); // Squash the text if it doesn't fit. } screen.DrawText(font, Font.CR_UNTRANSLATED, 160 - width / 2 * scalex, 19 - fonth / 2 * scaley, title, DTA_ScaleX, scalex, DTA_ScaleY, scaley, DTA_FullscreenScale, FSMode_Fit320x200Top); } @@ -49,7 +49,7 @@ class DukeMenuDelegate : RazeMenuDelegate double cursorScale = (gameinfo.gametype & GAMEFLAG_RRALL) ? 0.2 : 1.0; double ymid = desc.mItems[desc.mSelectedItem].GetY() + 7; // half height must be hardcoded or layouts will break. DrawCursor(160 + cursorOffset, ymid, cursorScale, false); - DrawCursor(169 - cursorOffset, ymid, cursorScale, true); + DrawCursor(160 - cursorOffset, ymid, cursorScale, true); return true; } @@ -143,7 +143,7 @@ class ListMenuItemDukeTextItem : ListMenuItemTextItem int trans = mColorSelected? Translation.MakeID(Translation_Remap, 1) : 0; Color pe; double scale = (gameinfo.gametype & GAMEFLAG_RRALL) ? 0.4 : 1.; - let xpos = mXpos - BigFont.StringWidth(mText) * scale * 0.5; + let xpos = 160 - BigFont.StringWidth(mText) * scale * 0.5; if (selected) { diff --git a/wadsrc/static/zscript/games/sw/ui/menu.zs b/wadsrc/static/zscript/games/sw/ui/menu.zs index 3b317e200..0793c04c8 100644 --- a/wadsrc/static/zscript/games/sw/ui/menu.zs +++ b/wadsrc/static/zscript/games/sw/ui/menu.zs @@ -17,13 +17,13 @@ class SWMenuDelegate : RazeMenuDelegate if (texsize.X - 60 < width) { // First start squashing the font down to 0.7x the original width. - fontscale = (texsize.X - 60) / width; + fontscale = (texsize.X - 66) / width; if (fontscale < 0.7) { // If that is not enough, extend the box. fontscale = 0.7; width *= 0.7; - scalex = width / (texsize.X - 60); + scalex = width / (texsize.X - 66); } else width *= fontscale; }