From 2237113a7741d41c96bb0ad8b7f9b66e1cef9f71 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 10 Oct 2020 00:51:26 +0200 Subject: [PATCH] - fixed font scaling in RR's confirmation screens. --- source/core/console/c_console.cpp | 3 +++ wadsrc/static/zscript/base.zs | 1 + wadsrc/static/zscript/ui/menu/messagebox.zs | 11 ++++++----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/source/core/console/c_console.cpp b/source/core/console/c_console.cpp index 1e5cbc651..9a22a59d2 100644 --- a/source/core/console/c_console.cpp +++ b/source/core/console/c_console.cpp @@ -67,6 +67,7 @@ #include "gstrings.h" #include "menustate.h" #include "i_interface.h" +#include "vm.h" #define LEFTMARGIN 8 #define RIGHTMARGIN 8 @@ -110,6 +111,8 @@ constate_e ConsoleState = c_up; double NotifyFontScale = 1; +DEFINE_GLOBAL(NotifyFontScale) + void C_SetNotifyFontScale(double scale) { NotifyFontScale = scale; diff --git a/wadsrc/static/zscript/base.zs b/wadsrc/static/zscript/base.zs index 65d3d47b2..223ac495f 100644 --- a/wadsrc/static/zscript/base.zs +++ b/wadsrc/static/zscript/base.zs @@ -178,6 +178,7 @@ struct _ native // These are the global variables, the struct is only here to av native readonly int GameTicRate; native MenuDelegateBase menuDelegate; native readonly int consoleplayer; + native readonly double NotifyFontScale; } struct MusPlayingInfo native diff --git a/wadsrc/static/zscript/ui/menu/messagebox.zs b/wadsrc/static/zscript/ui/menu/messagebox.zs index e8a97bf67..3bae3c27a 100644 --- a/wadsrc/static/zscript/ui/menu/messagebox.zs +++ b/wadsrc/static/zscript/ui/menu/messagebox.zs @@ -89,7 +89,7 @@ class MessageBoxMenu : Menu int mr2 = destWidth/2 + 10 + textFont.StringWidth(Stringtable.Localize("$TXT_NO")); mMouseRight = MAX(mr1, mr2); mParentMenu = parent; - mMessage = textFont.BreakLines(Stringtable.Localize(message), generic_ui? 600 : 300); + mMessage = textFont.BreakLines(Stringtable.Localize(message), 300/NotifyFontScale); mMessageMode = messagemode; if (playsound) { @@ -107,7 +107,7 @@ class MessageBoxMenu : Menu override void Drawer () { int i, y; - int fontheight = textFont.GetHeight(); + int fontheight = textFont.GetHeight() * NotifyFontScale; y = destHeight / 2; @@ -116,7 +116,8 @@ class MessageBoxMenu : Menu for (i = 0; i < c; i++) { - screen.DrawText (textFont, Font.CR_UNTRANSLATED, destWidth/2 - mMessage.StringWidth(i)/2, y, mMessage.StringAt(i), DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true); + screen.DrawText (textFont, Font.CR_UNTRANSLATED, destWidth/2 - mMessage.StringWidth(i)*NotifyFontScale/2, y, mMessage.StringAt(i), DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true, + DTA_ScaleX, NotifyFontScale, DTA_ScaleY, NotifyFontScale); y += fontheight; } @@ -124,8 +125,8 @@ class MessageBoxMenu : Menu { y += fontheight; mMouseY = y; - screen.DrawText(textFont, messageSelection == 0? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, destWidth / 2, y, Stringtable.Localize("$TXT_YES"), DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true); - screen.DrawText(textFont, messageSelection == 1? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, destWidth / 2, y + fontheight, Stringtable.Localize("$TXT_NO"), DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true); + screen.DrawText(textFont, messageSelection == 0? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, destWidth / 2, y, Stringtable.Localize("$TXT_YES"), DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true, DTA_ScaleX, NotifyFontScale, DTA_ScaleY, NotifyFontScale); + screen.DrawText(textFont, messageSelection == 1? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, destWidth / 2, y + fontheight, Stringtable.Localize("$TXT_NO"), DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true, DTA_ScaleX, NotifyFontScale, DTA_ScaleY, NotifyFontScale); if (messageSelection >= 0) {