From 087353f00b5ec929cc827e05c55adddb34b92af3 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 14 Mar 2019 14:53:24 +0200 Subject: [PATCH 01/34] - fixed dynamic lights flickering with GL3 render path https://forum.zdoom.org/viewtopic.php?t=63755 --- src/rendering/hwrenderer/dynlights/hw_lightbuffer.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rendering/hwrenderer/dynlights/hw_lightbuffer.h b/src/rendering/hwrenderer/dynlights/hw_lightbuffer.h index 9522ccc45..1db32f646 100644 --- a/src/rendering/hwrenderer/dynlights/hw_lightbuffer.h +++ b/src/rendering/hwrenderer/dynlights/hw_lightbuffer.h @@ -59,6 +59,7 @@ public: void BindBase() { mBuffer->BindBase(); + mLastMappedIndex = UINT_MAX; } }; From 50ebca20bb3882f535f32de78b0008a8be5df63c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 14 Mar 2019 21:42:02 +0100 Subject: [PATCH 02/34] - do not use iswspace to check raw UTF-8. At least under MSVC this function reports 0x85 as whitespace, but it is a continuation byte for UTF-8 sequences and may not be treated as whitespace. --- src/gamedata/fonts/v_text.cpp | 11 +++++++---- src/gamedata/stringtable.cpp | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gamedata/fonts/v_text.cpp b/src/gamedata/fonts/v_text.cpp index 76afe04ae..ac176e12a 100644 --- a/src/gamedata/fonts/v_text.cpp +++ b/src/gamedata/fonts/v_text.cpp @@ -75,6 +75,9 @@ TArray V_BreakLines (FFont *font, int maxwidth, const uint8_t *str bool lastWasSpace = false; int kerning = font->GetDefaultKerning (); + // The real isspace is a bit too badly defined, so use our own one + auto myisspace = [](int ch) { return ch == '\t' || ch == '\r' || ch == '\n' || ch == ' '; }; + w = 0; while ( (c = GetCharFromString(string)) ) @@ -104,7 +107,7 @@ TArray V_BreakLines (FFont *font, int maxwidth, const uint8_t *str continue; } - if (iswspace(c)) + if (myisspace(c)) { if (!lastWasSpace) { @@ -137,12 +140,12 @@ TArray V_BreakLines (FFont *font, int maxwidth, const uint8_t *str start = space; space = NULL; - while (*start && iswspace (*start) && *start != '\n') + while (*start && myisspace (*start) && *start != '\n') start++; if (*start == '\n') start++; else - while (*start && iswspace (*start)) + while (*start && myisspace (*start)) start++; string = start; } @@ -160,7 +163,7 @@ TArray V_BreakLines (FFont *font, int maxwidth, const uint8_t *str while (s < string) { // If there is any non-white space in the remainder of the string, add it. - if (!iswspace (*s++)) + if (!myisspace (*s++)) { auto i = Lines.Reserve(1); breakit (&Lines[i], font, start, string, linecolor); diff --git a/src/gamedata/stringtable.cpp b/src/gamedata/stringtable.cpp index 8d3344a0e..b70727c75 100644 --- a/src/gamedata/stringtable.cpp +++ b/src/gamedata/stringtable.cpp @@ -150,13 +150,15 @@ bool FStringTable::readSheetIntoTable(xlsxioreader reader, const char *sheetname int column = 0; char *value; table.Reserve(1); + auto myisspace = [](int ch) { return ch == '\t' || ch == '\r' || ch == '\n' || ch == ' '; }; + while ((value = xlsxioread_sheet_next_cell(sheet)) != nullptr) { auto vcopy = value; if (table.Size() <= (unsigned)row) table.Reserve(1); - while (*vcopy && iswspace((unsigned char)*vcopy)) vcopy++; // skip over leaading whitespace; + while (*vcopy && myisspace((unsigned char)*vcopy)) vcopy++; // skip over leaading whitespace; auto vend = vcopy + strlen(vcopy); - while (vend > vcopy && iswspace((unsigned char)vend[-1])) *--vend = 0; // skip over trailing whitespace + while (vend > vcopy && myisspace((unsigned char)vend[-1])) *--vend = 0; // skip over trailing whitespace ProcessEscapes(vcopy); table[row].Push(vcopy); column++; From c0d843b5967bba506bbda10188156bcd7aa03c13 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 15 Mar 2019 13:12:53 +0200 Subject: [PATCH 03/34] - fixed crash on startup inside userinfo_t::GetGender() This function is required for localization handling but when it's called userinfo_t may not be fully initialized yet https://forum.zdoom.org/viewtopic.php?t=63959 --- src/d_player.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 4eae01926..d52e35979 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -250,8 +250,8 @@ struct userinfo_t : TMap } int GetGender() const { - auto cvar = static_cast(*CheckKey(NAME_Gender)); - return cvar? *cvar : 0; + auto cvar = CheckKey(NAME_Gender); + return cvar ? *static_cast(*cvar) : 0; } bool GetNoAutostartMap() const { From 2573ca8ac40ce3031be4a8b688c32df12696cc98 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 15 Mar 2019 00:16:08 +0100 Subject: [PATCH 04/34] - disabled the error message spam from the demo loop These messages are useful for the playdemo CCMD, but since the demo loop is mostly non-functional anyway they better be disabled there. --- src/d_main.cpp | 1 + src/fragglescript/t_func.cpp | 2 +- src/g_game.cpp | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index ebb17e3d6..6cc176a3b 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1292,6 +1292,7 @@ void D_DoAdvanceDemo (void) } else { + singledemo = false; G_DeferedPlayDemo (demoname); demosequence = 2; break; diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index c53bade0e..c0804ffba 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -573,7 +573,7 @@ void FParser::SF_Include(void) void FParser::SF_Input(void) { - Printf(PRINT_BOLD,"input() function not available in doom\n"); + Printf(PRINT_BOLD,"input() function not available in Doom\n"); } //========================================================================== diff --git a/src/g_game.cpp b/src/g_game.cpp index 6018628e9..cfdfc2a45 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -2727,7 +2727,7 @@ void G_DoPlayDemo (void) } demo_p = demobuffer; - Printf ("Playing demo %s\n", defdemoname.GetChars()); + if (singledemo) Printf ("Playing demo %s\n", defdemoname.GetChars()); C_BackupCVars (); // [RH] Save cvars that might be affected by demo @@ -2744,7 +2744,7 @@ void G_DoPlayDemo (void) } else { - Printf (PRINT_BOLD, "%s", eek); + //Printf (PRINT_BOLD, "%s", eek); gameaction = ga_nothing; } } From 04281d4a0b8efc661e0b563dd37f1723b0e0d141 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 15 Mar 2019 20:22:40 +0100 Subject: [PATCH 05/34] - fixed positoning issues in the load/save menu. --- wadsrc/static/zscript/ui/menu/loadsavemenu.zs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/wadsrc/static/zscript/ui/menu/loadsavemenu.zs b/wadsrc/static/zscript/ui/menu/loadsavemenu.zs index 971cb322c..b9c6fa12c 100644 --- a/wadsrc/static/zscript/ui/menu/loadsavemenu.zs +++ b/wadsrc/static/zscript/ui/menu/loadsavemenu.zs @@ -146,7 +146,6 @@ class LoadSaveMenu : ListMenu commentRight = commentLeft + commentWidth; commentBottom = commentTop + commentHeight; commentRows = commentHeight / rowHeight; - } @@ -206,7 +205,7 @@ class LoadSaveMenu : ListMenu for(int i = 0; i < numlinestoprint; i++) { screen.DrawText(NewConsoleFont, Font.CR_ORANGE, commentLeft / FontScale, (commentTop + rowHeight * i) / FontScale, BrokenSaveComment.StringAt(i), - DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale); + DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale, DTA_KeepRatio, true); } @@ -220,7 +219,7 @@ class LoadSaveMenu : ListMenu int textlen = SmallFont.StringWidth(text) * CleanXfac; screen.DrawText (NewConsoleFont, Font.CR_GOLD, (listboxLeft+(listboxWidth-textlen)/2) / FontScale, (listboxTop+(listboxHeight-rowHeight)/2) / FontScale, text, - DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale); + DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale, DTA_KeepRatio, true); return; } @@ -255,7 +254,7 @@ class LoadSaveMenu : ListMenu if (!mEntering) { screen.DrawText (NewConsoleFont, colr, (listboxLeft+1) / FontScale, (listboxTop+rowHeight*i + FontScale) / FontScale, node.SaveTitle, - DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale); + DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale, DTA_KeepRatio, true); } else { @@ -263,13 +262,13 @@ class LoadSaveMenu : ListMenu int length = NewConsoleFont.StringWidth(s) * FontScale; int displacement = min(0, listboxWidth - 2 - length); screen.DrawText (NewConsoleFont, Font.CR_WHITE, (listboxLeft + 1 + displacement) / FontScale, (listboxTop+rowHeight*i + FontScale) / FontScale, s, - DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale); + DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale, DTA_KeepRatio, true); } } else { screen.DrawText (NewConsoleFont, colr, (listboxLeft+1) / FontScale, (listboxTop+rowHeight*i + FontScale) / FontScale, node.SaveTitle, - DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale); + DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale, DTA_KeepRatio, true); } screen.ClearClipRect(); j++; @@ -475,6 +474,7 @@ class SaveMenu : LoadSaveMenu manager.InsertNewSaveNode(); TopItem = 0; Selected = manager.ExtractSaveData (-1); + UpdateSaveComment(); } //============================================================================= @@ -614,7 +614,7 @@ class LoadMenu : LoadSaveMenu Super.Init(parent, desc); TopItem = 0; Selected = manager.ExtractSaveData (-1); - + UpdateSaveComment(); } //============================================================================= From dbd6c2eabf7d89faf75317ac534295037db190f4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 16 Mar 2019 00:07:18 +0100 Subject: [PATCH 06/34] - removed the automatic system language detection for Windows. Default language is now always American English, just like on Linux and macOS. --- src/c_cmds.cpp | 8 ++-- src/g_cvars.cpp | 1 - src/gamedata/stringtable.cpp | 15 +++--- src/gamedata/textures/texturemanager.cpp | 19 ++++---- src/posix/cocoa/i_system.mm | 15 ------ src/posix/i_system.h | 10 ---- src/posix/sdl/i_system.cpp | 14 ------ src/win32/i_system.cpp | 59 ------------------------ src/win32/i_system.h | 11 ----- 9 files changed, 25 insertions(+), 127 deletions(-) diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index aa0af97b3..3f927a54f 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -1243,10 +1243,12 @@ CCMD(secret) FString levelname; level_info_t *info = FindLevelInfo(mapname); const char *ln = !(info->flags & LEVEL_LOOKUPLEVELNAME)? info->LevelName.GetChars() : GStrings[info->LevelName.GetChars()]; - levelname.Format("%s - %s\n", mapname, ln); - size_t llen = levelname.Len() - 1; + levelname.Format("%s - %s", mapname, ln); + Printf(TEXTCOLOR_YELLOW "%s\n", levelname.GetChars()); + size_t llen = levelname.Len(); + levelname = ""; for(size_t ii=0; ii 3) ? + MAKE_ID('e', 'n', 'u', '\0') : + MAKE_ID(language[0], language[1], language[2], '\0'); + currentLanguageSet.Clear(); auto checkone = [&](uint32_t lang_id) @@ -389,11 +395,8 @@ void FStringTable::UpdateLanguage() checkone(dehacked_table); checkone(global_table); - for (int i = 0; i < 4; ++i) - { - checkone(LanguageIDs[i]); - checkone(LanguageIDs[i] & MAKE_ID(0xff, 0xff, 0, 0)); - } + checkone(LanguageID); + checkone(LanguageID & MAKE_ID(0xff, 0xff, 0, 0)); checkone(default_table); } diff --git a/src/gamedata/textures/texturemanager.cpp b/src/gamedata/textures/texturemanager.cpp index d1f0ba91c..9ae7989a0 100644 --- a/src/gamedata/textures/texturemanager.cpp +++ b/src/gamedata/textures/texturemanager.cpp @@ -1300,17 +1300,20 @@ int FTextureManager::PalCheck(int tex) // FTextureManager :: PalCheck // //========================================================================== +EXTERN_CVAR(String, language) int FTextureManager::ResolveLocalizedTexture(int tex) { - for(int i = 0; i < 4; i++) - { - uint32_t lang = LanguageIDs[i]; - uint64_t index = (uint64_t(lang) << 32) + tex; - if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex; - index = (uint64_t(lang & MAKE_ID(255, 255, 0, 0)) << 32) + tex; - if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex; - } + size_t langlen = strlen(language); + int lang = (langlen < 2 || langlen > 3) ? + MAKE_ID('e', 'n', 'u', '\0') : + MAKE_ID(language[0], language[1], language[2], '\0'); + + uint64_t index = (uint64_t(lang) << 32) + tex; + if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex; + index = (uint64_t(lang & MAKE_ID(255, 255, 0, 0)) << 32) + tex; + if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex; + return tex; } diff --git a/src/posix/cocoa/i_system.mm b/src/posix/cocoa/i_system.mm index 8ef18d985..04a645540 100644 --- a/src/posix/cocoa/i_system.mm +++ b/src/posix/cocoa/i_system.mm @@ -68,21 +68,6 @@ ticcmd_t* I_BaseTiccmd() -// -// SetLanguageIDs -// -void SetLanguageIDs() -{ - size_t langlen = strlen(language); - - uint32_t lang = (langlen < 2 || langlen > 3) - ? MAKE_ID('e', 'n', 'u', '\0') - : MAKE_ID(language[0], language[1], language[2], '\0'); - - LanguageIDs[3] = LanguageIDs[2] = LanguageIDs[1] = LanguageIDs[0] = lang; -} - - double PerfToSec, PerfToMillisec; static void CalculateCPUSpeed() diff --git a/src/posix/i_system.h b/src/posix/i_system.h index 7e6837824..e6cd95cf8 100644 --- a/src/posix/i_system.h +++ b/src/posix/i_system.h @@ -45,16 +45,6 @@ struct WadStuff; #define SHARE_DIR "/usr/local/share/" #endif -// Index values into the LanguageIDs array -enum -{ - LANGIDX_UserPreferred, - LANGIDX_UserDefault, - LANGIDX_SysPreferred, - LANGIDX_SysDefault -}; -extern uint32_t LanguageIDs[4]; -extern void SetLanguageIDs (); // Called by DoomMain. void I_Init (void); diff --git a/src/posix/sdl/i_system.cpp b/src/posix/sdl/i_system.cpp index a9c94ba1f..2b8fd9155 100644 --- a/src/posix/sdl/i_system.cpp +++ b/src/posix/sdl/i_system.cpp @@ -92,20 +92,6 @@ void I_EndRead(void) } -// -// SetLanguageIDs -// -void SetLanguageIDs () -{ - size_t langlen = strlen(language); - - uint32_t lang = (langlen < 2 || langlen > 3) ? - MAKE_ID('e','n','u','\0') : - MAKE_ID(language[0],language[1],language[2],'\0'); - - LanguageIDs[3] = LanguageIDs[2] = LanguageIDs[1] = LanguageIDs[0] = lang; -} - // // I_Init // diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 4087e1ec9..cc7727cd0 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -273,65 +273,6 @@ void I_DetectOS(void) info.dwBuildNumber, info.szCSDVersion); } -//========================================================================== -// -// SubsetLanguageIDs -// -// Helper function for SetLanguageIDs. -// -//========================================================================== - -static void SubsetLanguageIDs(LCID id, LCTYPE type, int idx) -{ - char buf[8]; - LCID langid; - char *idp; - - if (!GetLocaleInfoA(id, type, buf, 8)) - return; - langid = MAKELCID(strtoul(buf, NULL, 16), SORT_DEFAULT); - if (!GetLocaleInfoA(langid, LOCALE_SABBREVLANGNAME, buf, 8)) - return; - idp = (char *)(&LanguageIDs[idx]); - memset (idp, 0, 4); - idp[0] = tolower(buf[0]); - idp[1] = tolower(buf[1]); - idp[2] = tolower(buf[2]); - idp[3] = 0; -} - -//========================================================================== -// -// SetLanguageIDs -// -//========================================================================== - -void SetLanguageIDs() -{ - size_t langlen = strlen(language); - - if (langlen < 2 || langlen > 3) - { - memset(LanguageIDs, 0, sizeof(LanguageIDs)); - SubsetLanguageIDs(LOCALE_USER_DEFAULT, LOCALE_ILANGUAGE, 0); - SubsetLanguageIDs(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTLANGUAGE, 1); - SubsetLanguageIDs(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, 2); - SubsetLanguageIDs(LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTLANGUAGE, 3); - } - else - { - uint32_t lang = 0; - - ((uint8_t *)&lang)[0] = (language)[0]; - ((uint8_t *)&lang)[1] = (language)[1]; - ((uint8_t *)&lang)[2] = (language)[2]; - LanguageIDs[0] = lang; - LanguageIDs[1] = lang; - LanguageIDs[2] = lang; - LanguageIDs[3] = lang; - } -} - //========================================================================== // // CalculateCPUSpeed diff --git a/src/win32/i_system.h b/src/win32/i_system.h index d03f21044..5a5b663f9 100644 --- a/src/win32/i_system.h +++ b/src/win32/i_system.h @@ -34,17 +34,6 @@ struct ticcmd_t; struct WadStuff; -// Index values into the LanguageIDs array -enum -{ - LANGIDX_UserPreferred, - LANGIDX_UserDefault, - LANGIDX_SysPreferred, - LANGIDX_SysDefault -}; -extern uint32_t LanguageIDs[4]; -extern void SetLanguageIDs (); - // [RH] Detects the OS the game is running under. void I_DetectOS (void); From 714c656753a2e6997f8e5c22eeb25d6d8cf075e5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 16 Mar 2019 10:50:53 +0100 Subject: [PATCH 07/34] - set a Unicode capable font for the Windows console. The default raster font only contains the OEM 437 code page which is quite useless. --- src/win32/i_main.cpp | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/win32/i_main.cpp b/src/win32/i_main.cpp index e6a63980c..ee43eab0c 100644 --- a/src/win32/i_main.cpp +++ b/src/win32/i_main.cpp @@ -878,12 +878,7 @@ void DoMain (HINSTANCE hInstance) } if (StdOut == NULL) { - // AttachConsole was introduced with Windows XP. (OTOH, since we - // have to share the console with the shell, I'm not sure if it's - // a good idea to actually attach to it.) - typedef BOOL (WINAPI *ac)(DWORD); - ac attach_console = kernel != NULL ? (ac)GetProcAddress(kernel, "AttachConsole") : NULL; - if (attach_console != NULL && attach_console(ATTACH_PARENT_PROCESS)) + if (AttachConsole(ATTACH_PARENT_PROCESS)) { StdOut = GetStdHandle(STD_OUTPUT_HANDLE); DWORD foo; WriteFile(StdOut, "\n", 1, &foo, NULL); @@ -893,6 +888,29 @@ void DoMain (HINSTANCE hInstance) { StdOut = GetStdHandle(STD_OUTPUT_HANDLE); } + + // These two functions do not exist in Windows XP. + BOOL (WINAPI* p_GetCurrentConsoleFontEx)(HANDLE hConsoleOutput, BOOL bMaximumWindow, PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx); + BOOL (WINAPI* p_SetCurrentConsoleFontEx)(HANDLE hConsoleOutput, BOOL bMaximumWindow, PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx); + + p_SetCurrentConsoleFontEx = (decltype(p_SetCurrentConsoleFontEx))GetProcAddress(kernel, "SetCurrentConsoleFontEx"); + p_GetCurrentConsoleFontEx = (decltype(p_GetCurrentConsoleFontEx))GetProcAddress(kernel, "GetCurrentConsoleFontEx"); + if (p_SetCurrentConsoleFontEx && p_GetCurrentConsoleFontEx) + { + CONSOLE_FONT_INFOEX cfi; + cfi.cbSize = sizeof(cfi); + + if (p_GetCurrentConsoleFontEx(StdOut, false, &cfi)) + { + if (*cfi.FaceName == 0) // If the face name is empty, the default (useless) raster font is actoive. + { + //cfi.dwFontSize = { 8, 14 }; + wcscpy(cfi.FaceName, L"Lucida Console"); + cfi.FontFamily = FF_DONTCARE; + p_SetCurrentConsoleFontEx(StdOut, false, &cfi); + } + } + } FancyStdOut = true; } } From 669b13ab8a50cc6bebad03e5655300d875d59d43 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 16 Mar 2019 13:02:38 +0100 Subject: [PATCH 08/34] - cleanup and fixes in console code * consolidated C_MidPrint and C_MidPrintBold. * removed some unused code from the console buffer. * handle console output of centered messages to ensure they get written to the log file and to stdout. * replaced the non-standard bar strings with simple '-'s. These were making things needlessly complicated when redirecting console output and the new font does not have the characters anyway. * removed some old code from a time when during console drawing new network events could come and have more text printed. This can not happen anymore with how 2D elements are being handled now so all this code was redundant. --- src/c_console.cpp | 159 ++++++++++++------------------------ src/c_console.h | 5 +- src/c_consolebuffer.cpp | 140 +------------------------------ src/c_consolebuffer.h | 9 +- src/doomtype.h | 5 +- src/g_level.cpp | 8 +- src/gamedata/fonts/v_text.h | 1 + src/p_acs.cpp | 20 +---- src/p_actionfunctions.cpp | 2 +- src/p_conversation.cpp | 3 +- src/p_user.cpp | 4 +- 11 files changed, 73 insertions(+), 283 deletions(-) diff --git a/src/c_console.cpp b/src/c_console.cpp index e717ecba8..77afd6a29 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -131,8 +131,6 @@ static GameAtExit *ExitCmdList; EXTERN_CVAR (Bool, show_messages) -static bool ConsoleDrawing; - // Buffer for AddToConsole() static char *work = NULL; static int worklen = 0; @@ -586,49 +584,6 @@ CUSTOM_CVAR (Int, msgmidcolor2, 4, CVAR_ARCHIVE) setmsgcolor (PRINTLEVELS+1, self); } -struct TextQueue -{ - TextQueue (bool notify, int printlevel, const char *text) - : Next(NULL), bNotify(notify), PrintLevel(printlevel), Text(text) - { - } - TextQueue *Next; - bool bNotify; - int PrintLevel; - FString Text; -}; - -TextQueue *EnqueuedText, **EnqueuedTextTail = &EnqueuedText; - -void EnqueueConsoleText (bool notify, int printlevel, const char *text) -{ - TextQueue *queued = new TextQueue (notify, printlevel, text); - *EnqueuedTextTail = queued; - EnqueuedTextTail = &queued->Next; -} - -void DequeueConsoleText () -{ - TextQueue *queued = EnqueuedText; - - while (queued != NULL) - { - TextQueue *next = queued->Next; - if (queued->bNotify) - { - NotifyStrings.AddString(queued->PrintLevel, queued->Text); - } - else - { - AddToConsole (queued->PrintLevel, queued->Text); - } - delete queued; - queued = next; - } - EnqueuedText = NULL; - EnqueuedTextTail = &EnqueuedText; -} - EColorRange C_GetDefaultFontColor() { // Ideally this should analyze the SmallFont and pick a matching color. @@ -827,12 +782,6 @@ void FNotifyBuffer::AddString(int printlevel, FString source) con_notifylines == 0) return; - if (ConsoleDrawing) - { - EnqueueConsoleText (true, printlevel, source); - return; - } - width = DisplayWidth / active_con_scaletext(con_consolefont); FFont *font = *con_consolefont ? NewConsoleFont : SmallFont; @@ -888,11 +837,51 @@ void FNotifyBuffer::AddString(int printlevel, FString source) void AddToConsole (int printlevel, const char *text) { - conbuffer->AddText(printlevel, MakeUTF8(text), Logfile); + conbuffer->AddText(printlevel, MakeUTF8(text)); } -int PrintString (int printlevel, const char *outline) +//========================================================================== +// +// +// +//========================================================================== + +void WriteLineToLog(FILE *LogFile, const char *outline) { + // Strip out any color escape sequences before writing to the log file + TArray copy(strlen(outline) + 1); + const char * srcp = outline; + char * dstp = copy.Data(); + + while (*srcp != 0) + { + + if (*srcp != TEXTCOLOR_ESCAPE) + { + *dstp++ = *srcp++; + } + else if (srcp[1] == '[') + { + srcp += 2; + while (*srcp != ']' && *srcp != 0) srcp++; + if (*srcp == ']') srcp++; + } + else + { + if (srcp[1] != 0) srcp += 2; + else break; + } + } + *dstp = 0; + + fputs(copy.Data(), LogFile); + fflush(LogFile); +} + + +int PrintString (int iprintlevel, const char *outline) +{ + int printlevel = iprintlevel & PRINT_TYPES; if (printlevel < msglevel || *outline == '\0') { return 0; @@ -907,16 +896,15 @@ int PrintString (int printlevel, const char *outline) { I_PrintStr(outline); - conbuffer->AddText(printlevel, outline, Logfile); - if (vidactive && screen && SmallFont) + conbuffer->AddText(printlevel, outline); + if (vidactive && screen && SmallFont && !(iprintlevel & PRINT_NONOTIFY)) { NotifyStrings.AddString(printlevel, outline); } } - else if (Logfile != nullptr) + if (Logfile != nullptr && !(iprintlevel & PRINT_NOLOG)) { - fputs(outline, Logfile); - fflush(Logfile); + WriteLineToLog(Logfile, outline); } return count; } @@ -1220,8 +1208,6 @@ void C_DrawConsole () int bottomline = ConBottom / textScale - CurrentConsoleFont->GetHeight()*2 - 4; - ConsoleDrawing = true; - for(FBrokenLines *p = printline; p >= blines && lines > 0; p--, lines--) { if (textScale == 1) @@ -1237,8 +1223,6 @@ void C_DrawConsole () } } - ConsoleDrawing = false; - if (ConBottom >= 20) { if (gamestate != GS_STARTUP) @@ -1758,27 +1742,19 @@ CCMD (echo) /* Printing in the middle of the screen */ -CVAR (Float, con_midtime, 3.f, CVAR_ARCHIVE) +CVAR(Float, con_midtime, 3.f, CVAR_ARCHIVE) -static const char bar1[] = TEXTCOLOR_RED "\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36" - "\36\36\36\36\36\36\36\36\36\36\36\36\37" TEXTCOLOR_TAN "\n"; -static const char bar2[] = TEXTCOLOR_RED "\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36" - "\36\36\36\36\36\36\36\36\36\36\36\36\37" TEXTCOLOR_GREEN "\n"; -static const char bar3[] = TEXTCOLOR_RED "\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36" - "\36\36\36\36\36\36\36\36\36\36\36\36\37" TEXTCOLOR_NORMAL "\n"; +const char *console_bar = "----------------------------------------"; -void C_MidPrint (FFont *font, const char *msg) +void C_MidPrint (FFont *font, const char *msg, bool bold) { - if (StatusBar == NULL || screen == NULL) + if (StatusBar == nullptr || screen == nullptr) return; - if (msg != NULL) + if (msg != nullptr) { - AddToConsole (-1, bar1); - AddToConsole (-1, msg); - AddToConsole (-1, bar3); - - auto color = (EColorRange)PrintColors[PRINTLEVELS]; + auto color = (EColorRange)PrintColors[bold? PRINTLEVELS+1 : PRINTLEVELS]; + Printf(PRINT_NONOTIFY, TEXTCOLOR_ESCAPESTR "%c%s\n%s\n%s\n", color, console_bar, msg, console_bar); bool altscale = false; if (font == nullptr) @@ -1797,32 +1773,6 @@ void C_MidPrint (FFont *font, const char *msg) } } -void C_MidPrintBold (FFont *font, const char *msg) -{ - if (msg) - { - AddToConsole (-1, bar2); - AddToConsole (-1, msg); - AddToConsole (-1, bar3); - - auto color = (EColorRange)PrintColors[PRINTLEVELS+1]; - bool altscale = false; - if (font == nullptr) - { - altscale = con_midconsolefont; - font = altscale ? NewConsoleFont : SmallFont; - if (altscale && color == CR_UNTRANSLATED) color = C_GetDefaultFontColor(); - } - - StatusBar->AttachMessage (Create (font, msg, 1.5f, 0.375f, 0, 0, - color, con_midtime, altscale), MAKE_ID('C','N','T','R')); - } - else - { - StatusBar->DetachMessage (MAKE_ID('C','N','T','R')); - } -} - DEFINE_ACTION_FUNCTION(_Console, MidPrint) { PARAM_PROLOGUE; @@ -1831,8 +1781,7 @@ DEFINE_ACTION_FUNCTION(_Console, MidPrint) PARAM_BOOL(bold); const char *txt = text[0] == '$'? GStrings(&text[1]) : text.GetChars(); - if (!bold) C_MidPrint(fnt, txt); - else C_MidPrintBold(fnt, txt); + C_MidPrint(fnt, txt, bold); return 0; } diff --git a/src/c_console.h b/src/c_console.h index 41fcd1eb0..276c8b793 100644 --- a/src/c_console.h +++ b/src/c_console.h @@ -78,8 +78,7 @@ void C_AdjustBottom (void); void C_FlushDisplay (void); class FFont; -void C_MidPrint (FFont *font, const char *message); -void C_MidPrintBold (FFont *font, const char *message); +void C_MidPrint (FFont *font, const char *message, bool bold = false); bool C_Responder (event_t *ev); @@ -87,4 +86,6 @@ void C_AddTabCommand (const char *name); void C_RemoveTabCommand (const char *name); void C_ClearTabCommands(); // Removes all tab commands +extern const char *console_bar; + #endif diff --git a/src/c_consolebuffer.cpp b/src/c_consolebuffer.cpp index 0d0d0bc03..2c8f99de0 100644 --- a/src/c_consolebuffer.cpp +++ b/src/c_consolebuffer.cpp @@ -55,33 +55,6 @@ FConsoleBuffer::FConsoleBuffer() mBrokenStart.Push(0); } -//========================================================================== -// -// -// -//========================================================================== - -FConsoleBuffer::~FConsoleBuffer() -{ - FreeBrokenText(); -} - -//========================================================================== -// -// -// -//========================================================================== - -void FConsoleBuffer::FreeBrokenText(unsigned start, unsigned end) -{ - if (end > m_BrokenConsoleText.Size()) end = m_BrokenConsoleText.Size(); - for (unsigned i = start; i < end; i++) - { - m_BrokenConsoleText[i].Clear(); - m_BrokenConsoleText[i].ShrinkToFit(); - } -} - //========================================================================== // // Adds a new line of text to the console @@ -95,7 +68,7 @@ void FConsoleBuffer::FreeBrokenText(unsigned start, unsigned end) // //========================================================================== -void FConsoleBuffer::AddText(int printlevel, const char *text, FILE *logfile) +void FConsoleBuffer::AddText(int printlevel, const char *text) { FString build = TEXTCOLOR_TAN; @@ -135,117 +108,9 @@ void FConsoleBuffer::AddText(int printlevel, const char *text, FILE *logfile) mAddType = APPENDLINE; } - // don't bother about linefeeds etc. inside the text, we'll let the formatter sort this out later. + // don't bother with linefeeds etc. inside the text, we'll let the formatter sort this out later. build.AppendCStrPart(text, textsize); mConsoleText.Push(build); - if (logfile != NULL) WriteLineToLog(logfile, text); -} - -//========================================================================== -// -// -// -//========================================================================== - -void FConsoleBuffer::WriteLineToLog(FILE *LogFile, const char *outline) -{ - // Strip out any color escape sequences before writing to the log file - TArray copy(strlen(outline)+1); - const char * srcp = outline; - char * dstp = copy.Data(); - - while (*srcp != 0) - { - - if (*srcp != TEXTCOLOR_ESCAPE) - { - switch (*srcp) - { - case '\35': - *dstp++ = '<'; - break; - - case '\36': - *dstp++ = '-'; - break; - - case '\37': - *dstp++ = '>'; - break; - - default: - *dstp++=*srcp; - break; - } - srcp++; - } - else if (srcp[1] == '[') - { - srcp+=2; - while (*srcp != ']' && *srcp != 0) srcp++; - if (*srcp == ']') srcp++; - } - else - { - if (srcp[1]!=0) srcp+=2; - else break; - } - } - *dstp=0; - - fputs (copy.Data(), LogFile); - fflush (LogFile); -} - -//========================================================================== -// -// -// -//========================================================================== - -void FConsoleBuffer::WriteContentToLog(FILE *LogFile) -{ - if (LogFile != NULL) - { - for (unsigned i = 0; i < mConsoleText.Size(); i++) - { - WriteLineToLog(LogFile, mConsoleText[i]); - } - } -} - -//========================================================================== -// -// ensures that the following text is not appended to the current line. -// -//========================================================================== - -void FConsoleBuffer::Linefeed(FILE *Logfile) -{ - if (mAddType != NEWLINE && Logfile != NULL) fputc('\n', Logfile); - mAddType = NEWLINE; -} - -//========================================================================== -// -// -// -//========================================================================== - -static const char bar1[] = TEXTCOLOR_RED "\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36" - "\36\36\36\36\36\36\36\36\36\36\36\36\37" TEXTCOLOR_TAN "\n"; -static const char bar2[] = TEXTCOLOR_RED "\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36" - "\36\36\36\36\36\36\36\36\36\36\36\36\37" TEXTCOLOR_GREEN "\n"; -static const char bar3[] = TEXTCOLOR_RED "\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36" - "\36\36\36\36\36\36\36\36\36\36\36\36\37" TEXTCOLOR_NORMAL "\n"; - -void FConsoleBuffer::AddMidText(const char *string, bool bold, FILE *Logfile) -{ - Linefeed(Logfile); - AddText (-1, bold? bar2 : bar1, Logfile); - AddText (-1, string, Logfile); - Linefeed(Logfile); - AddText(-1, bar3, Logfile); } //========================================================================== @@ -258,7 +123,6 @@ void FConsoleBuffer::FormatText(FFont *formatfont, int displaywidth) { if (formatfont != mLastFont || displaywidth != mLastDisplayWidth || mBufferWasCleared) { - FreeBrokenText(); m_BrokenConsoleText.Clear(); mBrokenStart.Clear(); mBrokenStart.Push(0); diff --git a/src/c_consolebuffer.h b/src/c_consolebuffer.h index 1b46156b2..98a42b42e 100644 --- a/src/c_consolebuffer.h +++ b/src/c_consolebuffer.h @@ -61,19 +61,12 @@ class FConsoleBuffer int mLastDisplayWidth; bool mLastLineNeedsUpdate; - void WriteLineToLog(FILE *LogFile, const char *outline); - void FreeBrokenText(unsigned int start = 0, unsigned int end = INT_MAX); - - void Linefeed(FILE *Logfile); public: FConsoleBuffer(); - ~FConsoleBuffer(); - void AddText(int printlevel, const char *string, FILE *logfile = NULL); - void AddMidText(const char *string, bool bold, FILE *logfile); + void AddText(int printlevel, const char *string); void FormatText(FFont *formatfont, int displaywidth); void ResizeBuffer(unsigned newsize); - void WriteContentToLog(FILE *logfile); void Clear() { mBufferWasCleared = true; diff --git a/src/doomtype.h b/src/doomtype.h index a5f38e2d0..47a636552 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -89,7 +89,10 @@ enum PRINT_CHAT, // chat messages PRINT_TEAMCHAT, // chat messages from a teammate PRINT_LOG, // only to logfile - PRINT_BOLD = 200 // What Printf_Bold used + PRINT_BOLD = 200, // What Printf_Bold used + PRINT_TYPES = 1023, // Bitmask. + PRINT_NONOTIFY = 1024, // Flag - do not add to notify buffer + PRINT_NOLOG = 2048, // Flag - do not print to log file }; enum diff --git a/src/g_level.cpp b/src/g_level.cpp index 66a8b9c57..6f90326b3 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1062,12 +1062,8 @@ void FLevelLocals::DoLoadLevel(const FString &nextmapname, int position, bool au if (isPrimaryLevel()) { FString mapname = nextmapname; - mapname.ToLower(); - Printf( - "\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36" - "\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n" - TEXTCOLOR_BOLD "%s - %s\n\n", - mapname.GetChars(), LevelName.GetChars()); + mapname.ToUpper(); + Printf("\n%s\n\n" TEXTCOLOR_BOLD "%s - %s\n\n", console_bar, mapname.GetChars(), LevelName.GetChars()); } // Set the sky map. diff --git a/src/gamedata/fonts/v_text.h b/src/gamedata/fonts/v_text.h index 90c38d44c..365674b52 100644 --- a/src/gamedata/fonts/v_text.h +++ b/src/gamedata/fonts/v_text.h @@ -44,6 +44,7 @@ struct FBrokenLines }; #define TEXTCOLOR_ESCAPE '\034' +#define TEXTCOLOR_ESCAPESTR "\034" #define TEXTCOLOR_BRICK "\034A" #define TEXTCOLOR_TAN "\034B" diff --git a/src/p_acs.cpp b/src/p_acs.cpp index e5c338b00..76d26b742 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -536,8 +536,6 @@ -extern FILE *Logfile; - FRandom pr_acs ("ACS"); // I imagine this much stack space is probably overkill, but it could @@ -8614,10 +8612,7 @@ scriptwait: if (pcd == PCD_ENDPRINTBOLD || screen == NULL || screen->CheckLocalView()) { - if (pcd == PCD_ENDPRINTBOLD && (gameinfo.correctprintbold || (Level->flags2 & LEVEL2_HEXENHACK))) - C_MidPrintBold(activefont, work); - else - C_MidPrint (activefont, work); + C_MidPrint (activefont, work, pcd == PCD_ENDPRINTBOLD && (gameinfo.correctprintbold || (Level->flags2 & LEVEL2_HEXENHACK))); } STRINGBUILDER_FINISH(work); } @@ -8720,17 +8715,8 @@ scriptwait: (type & HUDMSG_LAYER_MASK) >> HUDMSG_LAYER_SHIFT); if (type & HUDMSG_LOG) { - static const char bar[] = TEXTCOLOR_ORANGE "\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36" - "\36\36\36\36\36\36\36\36\36\36\36\36\37" TEXTCOLOR_NORMAL "\n"; - char consolecolor[3]; - - consolecolor[0] = '\x1c'; - consolecolor[1] = color >= CR_BRICK && color <= CR_YELLOW ? color + 'A' : '-'; - consolecolor[2] = '\0'; - AddToConsole (-1, bar); - AddToConsole (-1, consolecolor); - AddToConsole (-1, work); - AddToConsole (-1, bar); + int consolecolor = color >= CR_BRICK && color <= CR_YELLOW ? color + 'A' : '-'; + Printf(PRINT_NONOTIFY, "\n" TEXTCOLOR_ESCAPESTR "%c%s\n%s\n%s\n", consolecolor, console_bar, work, console_bar); } } } diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index 24f4d68b8..afd704909 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -1341,7 +1341,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PrintBold) con_midtime = float(time); } FString formatted = strbin1(text); - C_MidPrintBold(font, formatted.GetChars()); + C_MidPrint(font, formatted.GetChars(), true); con_midtime = saved; return 0; } diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index b94d19535..6f3bec89b 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -695,8 +695,7 @@ static void TerminalResponse (const char *str) if (StatusBar != NULL) { - AddToConsole(-1, str); - AddToConsole(-1, "\n"); + Printf(PRINT_NONOTIFY, "%s\n", str); // The message is positioned a bit above the menu choices, because // merchants can tell you something like this but continue to show // their dialogue screen. I think most other conversations use this diff --git a/src/p_user.cpp b/src/p_user.cpp index 183364124..baaafc540 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -426,9 +426,7 @@ void player_t::SetLogText (const char *text) if (mo && mo->CheckLocalView()) { // Print log text to console - AddToConsole(-1, TEXTCOLOR_GOLD); - AddToConsole(-1, LogText[0] == '$'? GStrings(text+1) : text ); - AddToConsole(-1, "\n"); + Printf(PRINT_NONOTIFY, TEXTCOLOR_GOLD, "%s\n", LogText[0] == '$' ? GStrings(text + 1) : text); } } From ac9a4281966189794a4757edadb10d057c042175 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 16 Mar 2019 14:39:29 +0200 Subject: [PATCH 09/34] - fixed compilation error with some versions of GCC and Clang src/p_acs.cpp:8719:100: error: cannot pass non-trivial object of type 'FString' to variadic function; expected type from format string was 'char *' [-Wnon-pod-varargs] --- src/p_acs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 76d26b742..f230f57cb 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -8716,7 +8716,7 @@ scriptwait: if (type & HUDMSG_LOG) { int consolecolor = color >= CR_BRICK && color <= CR_YELLOW ? color + 'A' : '-'; - Printf(PRINT_NONOTIFY, "\n" TEXTCOLOR_ESCAPESTR "%c%s\n%s\n%s\n", consolecolor, console_bar, work, console_bar); + Printf(PRINT_NONOTIFY, "\n" TEXTCOLOR_ESCAPESTR "%c%s\n%s\n%s\n", consolecolor, console_bar, work.GetChars(), console_bar); } } } From 540e180fb135d63807f596a50b96961b9b875817 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 16 Mar 2019 14:45:16 +0200 Subject: [PATCH 10/34] - fixed log text output to console src/p_user.cpp:429:42: warning: data argument not used by format string [-Wformat-extra-args] --- src/p_user.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.cpp b/src/p_user.cpp index baaafc540..f854d5c8c 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -426,7 +426,7 @@ void player_t::SetLogText (const char *text) if (mo && mo->CheckLocalView()) { // Print log text to console - Printf(PRINT_NONOTIFY, TEXTCOLOR_GOLD, "%s\n", LogText[0] == '$' ? GStrings(text + 1) : text); + Printf(PRINT_NONOTIFY, TEXTCOLOR_GOLD "%s\n", LogText[0] == '$' ? GStrings(text + 1) : text); } } From 73d81d3983c2875e43e646644042a205cb4f0c43 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sat, 16 Mar 2019 14:46:48 +0700 Subject: [PATCH 11/34] added option search menu --- src/g_cvars.cpp | 4 +- wadsrc/static/menudef.txt | 20 ++ wadsrc/static/zscript.txt | 4 + wadsrc/static/zscript/ui/menu/search/menu.zs | 212 ++++++++++++++++++ wadsrc/static/zscript/ui/menu/search/query.zs | 78 +++++++ .../zscript/ui/menu/search/searchfield.zs | 51 +++++ 6 files changed, 368 insertions(+), 1 deletion(-) create mode 100644 wadsrc/static/zscript/ui/menu/search/menu.zs create mode 100644 wadsrc/static/zscript/ui/menu/search/query.zs create mode 100644 wadsrc/static/zscript/ui/menu/search/searchfield.zs diff --git a/src/g_cvars.cpp b/src/g_cvars.cpp index 3d1a9167d..433b88888 100644 --- a/src/g_cvars.cpp +++ b/src/g_cvars.cpp @@ -51,6 +51,9 @@ CVAR(Int, developer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // [RH] Feature control cvars CVAR(Bool, var_friction, true, CVAR_SERVERINFO); +// Option Search +CVAR(Bool, os_isanyof, true, CVAR_ARCHIVE); + @@ -138,4 +141,3 @@ CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOB if (Level->info != nullptr) Level->LevelName = Level->info->LookupLevelName(); } } - diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 403123db7..5c4b02bf6 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -378,6 +378,8 @@ OptionMenu "OptionsMenu" protected Submenu "$OPTMNU_DISPLAY", "VideoOptions" Submenu "$OPTMNU_VIDEO", "VideoModeMenu" StaticText " " + Submenu "$OS_TITLE", "os_Menu" + StaticText " " SafeCommand "$OPTMNU_DEFAULTS", "reset2defaults" SafeCommand "$OPTMNU_RESETTOSAVED", "reset2saved" Command "$OPTMNU_CONSOLE", "menuconsole" @@ -2606,3 +2608,21 @@ OptionString "LanguageOptions" "ptb", "Português do Brasil (PTB)" "rus", "Русский (RU)" } + +/*======================================= + * + * Option Search menu + * + *=======================================*/ + +OptionMenu "os_Menu" +{ + Class "os_Menu" + Title "$OS_TITLE" +} + +OptionValue "os_isanyof_values" +{ + 0, "$OS_ALL" + 1, "$OS_ANY" +} diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index 705f29798..54e5f00b8 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -253,6 +253,10 @@ version "3.8" #include "zscript/ui/menu/reverbedit.zs" #include "zscript/ui/menu/textentermenu.zs" +#include "zscript/ui/menu/search/menu.zs" +#include "zscript/ui/menu/search/searchfield.zs" +#include "zscript/ui/menu/search/query.zs" + #include "zscript/ui/statscreen/statscreen.zs" #include "zscript/ui/statscreen/statscreen_coop.zs" #include "zscript/ui/statscreen/statscreen_dm.zs" diff --git a/wadsrc/static/zscript/ui/menu/search/menu.zs b/wadsrc/static/zscript/ui/menu/search/menu.zs new file mode 100644 index 000000000..f8cd06e82 --- /dev/null +++ b/wadsrc/static/zscript/ui/menu/search/menu.zs @@ -0,0 +1,212 @@ +//============================================================================= +// +// Option Search Menu class. +// This menu contains search field, and is dynamically filled with search +// results. +// +//============================================================================= + +class os_Menu : OptionMenu +{ + override void Init(Menu parent, OptionMenuDescriptor desc) + { + Super.Init(parent, desc); + + mDesc.mItems.clear(); + + addSearchField(); + + mDesc.mScrollPos = 0; + mDesc.mSelectedItem = 0; + mDesc.CalcIndent(); + } + + void search(os_Query query) + { + mDesc.mItems.clear(); + + addSearchField(query.getText()); + + string path = StringTable.Localize("$OPTMNU_TITLE"); + bool isAnyTermMatches = mIsAnyOfItem.mCVar.GetBool(); + bool found = listOptions(mDesc, "MainMenu", query, path, isAnyTermMatches); + + if (!found) { addNoResultsItem(mDesc); } + + mDesc.CalcIndent(); + } + + private void addSearchField(string query = "") + { + string searchLabel = StringTable.Localize("$OS_LABEL"); + let searchField = new("os_SearchField").Init(searchLabel, self, query); + + mIsAnyOfItem = new("OptionMenuItemOption").Init("", "os_isanyof", "os_isanyof_values"); + + mDesc.mItems.push(searchField); + mDesc.mItems.push(mIsAnyOfItem); + addEmptyLine(mDesc); + } + + private static bool listOptions(OptionMenuDescriptor targetDesc, + string menuName, + os_Query query, + string path, + bool isAnyTermMatches) + { + let desc = MenuDescriptor.GetDescriptor(menuName); + let listMenuDesc = ListMenuDescriptor(desc); + + if (listMenuDesc) + { + return listOptionsListMenu(listMenuDesc, targetDesc, query, path, isAnyTermMatches); + } + + let optionMenuDesc = OptionMenuDescriptor(desc); + + if (optionMenuDesc) + { + return listOptionsOptionMenu(optionMenuDesc, targetDesc, query, path, isAnyTermMatches); + } + + return false; + } + + private static bool listOptionsListMenu(ListMenuDescriptor sourceDesc, + OptionMenuDescriptor targetDesc, + os_Query query, + string path, + bool isAnyTermMatches) + { + int nItems = sourceDesc.mItems.size(); + bool found = false; + + for (int i = 0; i < nItems; ++i) + { + let item = sourceDesc.mItems[i]; + string actionN = item.GetAction(); + string newPath = (actionN == "Optionsmenu") + ? StringTable.Localize("$OPTMNU_TITLE") + : StringTable.Localize("$OS_MAIN"); + + found |= listOptions(targetDesc, actionN, query, newPath, isAnyTermMatches); + } + + return found; + } + + private static bool listOptionsOptionMenu(OptionMenuDescriptor sourceDesc, + OptionMenuDescriptor targetDesc, + os_Query query, + string path, + bool isAnyTermMatches) + { + if (sourceDesc == targetDesc) { return false; } + + int nItems = sourceDesc.mItems.size(); + bool first = true; + bool found = false; + + for (int i = 0; i < nItems; ++i) + { + let item = sourceDesc.mItems[i]; + + if (item is "OptionMenuItemStaticText") { continue; } + + string label = StringTable.Localize(item.mLabel); + + if (!query.matches(label, isAnyTermMatches)) { continue; } + + found = true; + + if (first) + { + addEmptyLine(targetDesc); + addPathItem(targetDesc, path); + + first = false; + } + + let itemOptionBase = OptionMenuItemOptionBase(item); + + if (itemOptionBase) + { + itemOptionBase.mCenter = false; + } + + targetDesc.mItems.push(item); + } + + for (int i = 0; i < nItems; ++i) + { + let item = sourceDesc.mItems[i]; + string label = StringTable.Localize(item.mLabel); + string optionSearchTitle = StringTable.Localize("$OS_TITLE"); + + if (label == optionSearchTitle) { continue; } + + if (item is "OptionMenuItemSubMenu") + { + string newPath = makePath(path, label); + + found |= listOptions(targetDesc, item.GetAction(), query, newPath, isAnyTermMatches); + } + } + + return found; + } + + private static string makePath(string path, string label) + { + int pathWidth = SmallFont.StringWidth(path .. "/" .. label); + int screenWidth = Screen.GetWidth(); + bool isTooWide = (pathWidth > screenWidth / 3); + string newPath = isTooWide + ? path .. "/" .. "\n" .. label + : path .. "/" .. label; + + return newPath; + } + + private static void addPathItem(OptionMenuDescriptor desc, string path) + { + Array lines; + path.split(lines, "\n"); + + int nLines = lines.size(); + + for (int i = 0; i < nLines; ++i) + { + OptionMenuItemStaticText text = new("OptionMenuItemStaticText").Init(lines[i], 1); + + desc.mItems.push(text); + } + } + + private static void addEmptyLine(OptionMenuDescriptor desc) + { + int nItems = desc.mItems.size(); + + if (nItems > 0) + { + let staticText = OptionMenuItemStaticText(desc.mItems[nItems - 1]); + + if (staticText != null && staticText.mLabel == "") { return; } + } + + let item = new("OptionMenuItemStaticText").Init(""); + + desc.mItems.push(item); + } + + private static void addNoResultsItem(OptionMenuDescriptor desc) + { + string noResults = StringTable.Localize("$OS_NO_RESULTS"); + let text = new("OptionMenuItemStaticText").Init(noResults, 0); + + addEmptyLine(desc); + desc.mItems.push(text); + } + + private OptionMenuItemOption mIsAnyOfItem; +} diff --git a/wadsrc/static/zscript/ui/menu/search/query.zs b/wadsrc/static/zscript/ui/menu/search/query.zs new file mode 100644 index 000000000..75e1d8395 --- /dev/null +++ b/wadsrc/static/zscript/ui/menu/search/query.zs @@ -0,0 +1,78 @@ +//============================================================================= +// +// Option Search Query class represents a search query. +// A search query consists constists of one or more terms (words). +// +// Query matching deponds on "os_is_any_of" variable. +// If this variable is "true", the text matches the query if any of the terms +// matches the query. +// If this variable is "false", the text matches the query only if all the +// terms match the query. +// +//============================================================================= + +class os_Query +{ + static os_Query fromString(string str) + { + let query = new("os_Query"); + + str.Split(query.mQueryParts, " ", TOK_SKIPEMPTY); + + query.mText = str; + + return query; + } + + bool matches(string text, bool isSearchForAny) + { + return isSearchForAny + ? matchesAny(text) + : matchesAll(text); + } + + string getText() { return mText; } + + // private: ////////////////////////////////////////////////////////////////// + + private bool matchesAny(string text) + { + int nParts = mQueryParts.size(); + + for (int i = 0; i < nParts; ++i) + { + string queryPart = mQueryParts[i]; + + if (contains(text, queryPart)) { return true; } + } + + return false; + } + + private bool matchesAll(string text) + { + int nParts = mQueryParts.size(); + + for (int i = 0; i < nParts; ++i) + { + string queryPart = mQueryParts[i]; + + if (!contains(text, queryPart)) { return false; } + } + + return true; + } + + private static bool contains(string str, string substr) + { + str .toLower(); + substr.toLower(); + + bool contains = (str.IndexOf(substr) != -1); + + return contains; + } + + private string mText; + private Array mQueryParts; +} diff --git a/wadsrc/static/zscript/ui/menu/search/searchfield.zs b/wadsrc/static/zscript/ui/menu/search/searchfield.zs new file mode 100644 index 000000000..194501022 --- /dev/null +++ b/wadsrc/static/zscript/ui/menu/search/searchfield.zs @@ -0,0 +1,51 @@ +//============================================================================= +// +// Option Search Field class. +// +// When the search query is entered, makes Search Menu perform a search. +// +//============================================================================= + +class os_SearchField : OptionMenuItemTextField +{ + os_SearchField Init(String label, os_Menu menu, string query) + { + Super.Init(label, ""); + + mMenu = menu; + + mText = query; + + return self; + } + + override bool MenuEvent(int mkey, bool fromcontroller) + { + if (mkey == Menu.MKEY_Enter) + { + Menu.MenuSound("menu/choose"); + mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), SmallFont, mText, -1, fromcontroller); + mEnter.ActivateMenu(); + return true; + } + if (mkey == Menu.MKEY_Input) + { + string text = mEnter.GetText(); + let query = os_Query.fromString(text); + + mMenu.search(query); + } + + return Super.MenuEvent(mkey, fromcontroller); + } + + override String Represent() + { + return mEnter + ? mEnter.GetText() .. SmallFont.GetCursor() + : mText; + } + + private os_Menu mMenu; + private string mText; +} From 9b76c47dbeeb49732e6a54ed865d6feac11d87b1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 16 Mar 2019 18:56:20 +0100 Subject: [PATCH 12/34] - added some placeholder strings to language.def. This is in preparation for the spreadsheet based text handling. --- wadsrc/static/language.def | 236 ++++++++++++++++++++++++++++++++++++- 1 file changed, 234 insertions(+), 2 deletions(-) diff --git a/wadsrc/static/language.def b/wadsrc/static/language.def index 5e629dc97..d9367eb08 100644 --- a/wadsrc/static/language.def +++ b/wadsrc/static/language.def @@ -75,9 +75,7 @@ MUSIC_READ_M = "read_m"; MUSIC_DM2TTL = "dm2ttl"; MUSIC_DM2INT = "dm2int"; - // MBF (BOOM?) narration backgrounds - bgflatE1 = "FLOOR4_8"; bgflatE2 = "SFLR6_1"; bgflatE3 = "MFLR8_4"; @@ -93,3 +91,237 @@ bgcastcall = "BOSSBACK"; TAG_QUEST4 = "quest4"; TAG_QUEST5 = "quest5"; TAG_QUEST6 = "quest4"; + +// For printing a custom banner to the console. Must be overridden by mods. +STARTUP1 = ""; +STARTUP2 = ""; +STARTUP3 = ""; +STARTUP4 = ""; +STARTUP5 = ""; + +// Placeholder definitions for strings that are in the game content table where the labels are needed even when that file is not loaded. + +// Level names +HUSTR_E1M1 = ""; +HUSTR_E1M2 = ""; +HUSTR_E1M3 = ""; +HUSTR_E1M4 = ""; +HUSTR_E1M5 = ""; +HUSTR_E1M6 = ""; +HUSTR_E1M7 = ""; +HUSTR_E1M8 = ""; +HUSTR_E1M9 = ""; +HUSTR_E2M1 = ""; +HUSTR_E2M2 = ""; +HUSTR_E2M3 = ""; +HUSTR_E2M4 = ""; +HUSTR_E2M5 = ""; +HUSTR_E2M6 = ""; +HUSTR_E2M7 = ""; +HUSTR_E2M8 = ""; +HUSTR_E2M9 = ""; +HUSTR_E3M1 = ""; +HUSTR_E3M2 = ""; +HUSTR_E3M3 = ""; +HUSTR_E3M4 = ""; +HUSTR_E3M5 = ""; +HUSTR_E3M6 = ""; +HUSTR_E3M7 = ""; +HUSTR_E3M8 = ""; +HUSTR_E3M9 = ""; +HUSTR_E4M1 = ""; +HUSTR_E4M2 = ""; +HUSTR_E4M3 = ""; +HUSTR_E4M4 = ""; +HUSTR_E4M5 = ""; +HUSTR_E4M6 = ""; +HUSTR_E4M7 = ""; +HUSTR_E4M8 = ""; +HUSTR_E4M9 = ""; + +HHUSTR_E1M1 = ""; +HHUSTR_E1M2 = ""; +HHUSTR_E1M3 = ""; +HHUSTR_E1M4 = ""; +HHUSTR_E1M5 = ""; +HHUSTR_E1M6 = ""; +HHUSTR_E1M7 = ""; +HHUSTR_E1M8 = ""; +HHUSTR_E1M9 = ""; +HHUSTR_E2M1 = ""; +HHUSTR_E2M2 = ""; +HHUSTR_E2M3 = ""; +HHUSTR_E2M4 = ""; +HHUSTR_E2M5 = ""; +HHUSTR_E2M6 = ""; +HHUSTR_E2M7 = ""; +HHUSTR_E2M8 = ""; +HHUSTR_E2M9 = ""; +HHUSTR_E3M1 = ""; +HHUSTR_E3M2 = ""; +HHUSTR_E3M3 = ""; +HHUSTR_E3M4 = ""; +HHUSTR_E3M5 = ""; +HHUSTR_E3M6 = ""; +HHUSTR_E3M7 = ""; +HHUSTR_E3M8 = ""; +HHUSTR_E3M9 = ""; +HHUSTR_E4M1 = ""; +HHUSTR_E4M2 = ""; +HHUSTR_E4M3 = ""; +HHUSTR_E4M4 = ""; +HHUSTR_E4M5 = ""; +HHUSTR_E4M6 = ""; +HHUSTR_E4M7 = ""; +HHUSTR_E4M8 = ""; +HHUSTR_E4M9 = ""; +HHUSTR_E5M1 = ""; +HHUSTR_E5M2 = ""; +HHUSTR_E5M3 = ""; +HHUSTR_E5M4 = ""; +HHUSTR_E5M5 = ""; +HHUSTR_E5M6 = ""; +HHUSTR_E5M7 = ""; +HHUSTR_E5M8 = ""; +HHUSTR_E5M9 = ""; + +HUSTR_1 = ""; +HUSTR_2 = ""; +HUSTR_3 = ""; +HUSTR_4 = ""; +HUSTR_5 = ""; +HUSTR_6 = ""; +HUSTR_7 = ""; +HUSTR_8 = ""; +HUSTR_9 = ""; +HUSTR_10 = ""; +HUSTR_11 = ""; +HUSTR_12 = ""; +HUSTR_13 = ""; +HUSTR_14 = ""; +HUSTR_15 = ""; +HUSTR_16 = ""; +HUSTR_17 = ""; +HUSTR_18 = ""; +HUSTR_19 = ""; +HUSTR_20 = ""; +HUSTR_21 = ""; +HUSTR_22 = ""; +HUSTR_23 = ""; +HUSTR_24 = ""; +HUSTR_25 = ""; +HUSTR_26 = ""; +HUSTR_27 = ""; +HUSTR_28 = ""; +HUSTR_29 = ""; +HUSTR_30 = ""; +HUSTR_31 = ""; +HUSTR_32 = ""; +HUSTR_31B = ""; +HUSTR_32B = ""; +HUSTR_33 = ""; + +NHUSTR_1 = ""; +NHUSTR_2 = ""; +NHUSTR_3 = ""; +NHUSTR_4 = ""; +NHUSTR_5 = ""; +NHUSTR_6 = ""; +NHUSTR_7 = ""; +NHUSTR_8 = ""; +NHUSTR_9 = ""; + +PHUSTR_1 = ""; +PHUSTR_2 = ""; +PHUSTR_3 = ""; +PHUSTR_4 = ""; +PHUSTR_5 = ""; +PHUSTR_6 = ""; +PHUSTR_7 = ""; +PHUSTR_8 = ""; +PHUSTR_9 = ""; +PHUSTR_10 = ""; +PHUSTR_11 = ""; +PHUSTR_12 = ""; +PHUSTR_13 = ""; +PHUSTR_14 = ""; +PHUSTR_15 = ""; +PHUSTR_16 = ""; +PHUSTR_17 = ""; +PHUSTR_18 = ""; +PHUSTR_19 = ""; +PHUSTR_20 = ""; +PHUSTR_21 = ""; +PHUSTR_22 = ""; +PHUSTR_23 = ""; +PHUSTR_24 = ""; +PHUSTR_25 = ""; +PHUSTR_26 = ""; +PHUSTR_27 = ""; +PHUSTR_28 = ""; +PHUSTR_29 = ""; +PHUSTR_30 = ""; +PHUSTR_31 = ""; +PHUSTR_32 = ""; + +THUSTR_1 = ""; +THUSTR_2 = ""; +THUSTR_3 = ""; +THUSTR_4 = ""; +THUSTR_5 = ""; +THUSTR_6 = ""; +THUSTR_7 = ""; +THUSTR_8 = ""; +THUSTR_9 = ""; +THUSTR_10 = ""; +THUSTR_11 = ""; +THUSTR_12 = ""; +THUSTR_13 = ""; +THUSTR_14 = ""; +THUSTR_15 = ""; +THUSTR_16 = ""; +THUSTR_17 = ""; +THUSTR_18 = ""; +THUSTR_19 = ""; +THUSTR_20 = ""; +THUSTR_21 = ""; +THUSTR_22 = ""; +THUSTR_23 = ""; +THUSTR_24 = ""; +THUSTR_25 = ""; +THUSTR_26 = ""; +THUSTR_27 = ""; +THUSTR_28 = ""; +THUSTR_29 = ""; +THUSTR_30 = ""; +THUSTR_31 = ""; +THUSTR_32 = ""; + +E1TEXT = ""; +E2TEXT = ""; +E3TEXT = ""; +E4TEXT = ""; +C1TEXT = ""; +C2TEXT = ""; +C3TEXT = ""; +C4TEXT = ""; +C5TEXT = ""; +C6TEXT = ""; +P1TEXT = ""; +P2TEXT = ""; +P3TEXT = ""; +P4TEXT = ""; +P5TEXT = ""; +P6TEXT = ""; +T1TEXT = ""; +T2TEXT = ""; +T3TEXT = ""; +T4TEXT = ""; +T5TEXT = ""; +T6TEXT = ""; +NERVETEXT = ""; +HE1TEXT = ""; +HE2TEXT = ""; +HE3TEXT = ""; +HE4TEXT = ""; +HE5TEXT = ""; From 3fde5535c7cdb5989bfc00b8a784148b3bafe72e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 16 Mar 2019 19:00:56 +0100 Subject: [PATCH 13/34] - replaced the "or" in the keybind menu with a darker comma so that this part is language neutral. --- src/c_bind.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/c_bind.cpp b/src/c_bind.cpp index 0427d5c45..14e2f5e05 100644 --- a/src/c_bind.cpp +++ b/src/c_bind.cpp @@ -46,6 +46,7 @@ #include "vm.h" #include "i_time.h" #include "menu/menu.h" +#include "v_text.h" const char *KeyNames[NUM_KEYS] = { @@ -297,7 +298,7 @@ void C_NameKeys (char *str, int first, int second) c++; strcpy (str, KeyName (first)); if (second) - strcat (str, " or "); + strcat (str, TEXTCOLOR_BLACK ", " TEXTCOLOR_NORMAL); } if (second) From aa9c484b3b2d886e220f92343e24f93b9af3519f Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 17 Mar 2019 00:42:13 +0700 Subject: [PATCH 14/34] automap options readability changes --- wadsrc/static/menudef.txt | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 5c4b02bf6..11d29e2f0 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1218,30 +1218,43 @@ OptionString MapMarkFont OptionMenu AutomapOptions protected { Title "$AUTOMAPMNU_TITLE" + Option "$AUTOMAPMNU_COLORSET", "am_colorset", "MapColorTypes" Option "$AUTOMAPMNU_CUSTOMCOLORS", "am_customcolors", "YesNo" Submenu "$AUTOMAPMNU_SETCUSTOMCOLORS", "MapColorMenu" + + StaticText "" Submenu "$AUTOMAPMNU_CONTROLS", "MapControlsMenu" - StaticText " " + + StaticText "" Option "$AUTOMAPMNU_ROTATE", "am_rotate", "RotateTypes" Option "$AUTOMAPMNU_OVERLAY", "am_overlay", "OverlayTypes" Option "$AUTOMAPMNU_TEXTURED", "am_textured", "OnOff" Option "$AUTOMAPMNU_FOLLOW", "am_followplayer", "OnOff" - Option "$AUTOMAPMNU_PTOVERLAY", "am_portaloverlay", "OnOff" - Slider "$AUTOMAPMNU_EMPTYSPACEMARGIN", "am_emptyspacemargin", 0, 90, 5, 0 - StaticText " " + + StaticText "" Option "$AUTOMAPMNU_SHOWITEMS", "am_showitems", "OnOff" Option "$AUTOMAPMNU_SHOWMONSTERS", "am_showmonsters", "OnOff" Option "$AUTOMAPMNU_SHOWSECRETS", "am_showsecrets", "OnOff" Option "$AUTOMAPMNU_SHOWTIME", "am_showtime", "OnOff" Option "$AUTOMAPMNU_SHOWTOTALTIME", "am_showtotaltime", "OnOff" - Option "$AUTOMAPMNU_MAPSECRETS", "am_map_secrets", "SecretTypes" Option "$AUTOMAPMNU_SHOWMAPLABEL", "am_showmaplabel", "MaplabelTypes" - Option "$AUTOMAPMNU_DRAWMAPBACK", "am_drawmapback", "MapBackTypes" + + StaticText "" Option "$AUTOMAPMNU_SHOWKEYS", "am_showkeys", "OnOff" + Option "$AUTOMAPMNU_SHOWKEYS_ALWAYS", "am_showkeys_always", "OnOff" + + StaticText "" + Option "$AUTOMAPMNU_MAPSECRETS", "am_map_secrets", "SecretTypes" + Option "$AUTOMAPMNU_DRAWMAPBACK", "am_drawmapback", "MapBackTypes" Option "$AUTOMAPMNU_SHOWTRIGGERLINES", "am_showtriggerlines", "MapTriggers" Option "$AUTOMAPMNU_SHOWTHINGSPRITES", "am_showthingsprites", "STSTypes" - StaticText " " + + StaticText "" + Option "$AUTOMAPMNU_PTOVERLAY", "am_portaloverlay", "OnOff" + Slider "$AUTOMAPMNU_EMPTYSPACEMARGIN", "am_emptyspacemargin", 0, 90, 5, 0 + + StaticText "" Option "$AUTOMAPMNU_MARKFONT", "am_markfont", "MapMarkFont" Option "$AUTOMAPMNU_MARKCOLOR", "am_markcolor", "TextColors" } @@ -1257,18 +1270,24 @@ OptionMenu MapControlsMenu protected Title "$MAPCNTRLMNU_TITLE" ScrollTop 2 StaticTextSwitchable "$CNTRLMNU_SWITCHTEXT1", "$CNTRLMNU_SWITCHTEXT2", "ControlMessage" - StaticText "" - StaticText "$MAPCNTRLMNU_CONTROLS", 1 + + StaticText "" MapControl "$MAPCNTRLMNU_PANLEFT", "+am_panleft" MapControl "$MAPCNTRLMNU_PANRIGHT", "+am_panright" MapControl "$MAPCNTRLMNU_PANUP", "+am_panup" MapControl "$MAPCNTRLMNU_PANDOWN", "+am_pandown" + + StaticText "" MapControl "$MAPCNTRLMNU_ZOOMIN", "+am_zoomin" MapControl "$MAPCNTRLMNU_ZOOMOUT", "+am_zoomout" + + StaticText "" MapControl "$MAPCNTRLMNU_TOGGLEZOOM", "am_gobig" MapControl "$MAPCNTRLMNU_TOGGLEFOLLOW", "am_togglefollow" MapControl "$MAPCNTRLMNU_TOGGLEGRID", "am_togglegrid" MapControl "$MAPCNTRLMNU_TOGGLETEXTURE", "am_toggletexture" + + StaticText "" MapControl "$MAPCNTRLMNU_SETMARK", "am_setmark" MapControl "$MAPCNTRLMNU_CLEARMARK", "am_clearmarks" } From ba13a540e4c84d0bcbf30ed85af80662d95db0e7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 09:27:07 +0100 Subject: [PATCH 15/34] - changed default graphics substitution rules to be more localization friendly. The default was changed to replace graphics if only known content is affected. This also required blocking the feature for Hacx, Harmony and Action Doom 2 which have no localization yet and would fall back on Doom's texts if not blocked. --- src/gamedata/gi.cpp | 1 + src/gamedata/gi.h | 1 + src/gamedata/textures/texturemanager.cpp | 12 +++++++----- src/menu/menu.cpp | 6 +++--- src/posix/sdl/hardware.cpp | 4 ++-- wadsrc/static/mapinfo/hacx.txt | 1 + wadsrc/static/mapinfo/harmony.txt | 1 + wadsrc/static/mapinfo/urbanbrawl.txt | 1 + 8 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/gamedata/gi.cpp b/src/gamedata/gi.cpp index ebced3c7c..f80d80749 100644 --- a/src/gamedata/gi.cpp +++ b/src/gamedata/gi.cpp @@ -397,6 +397,7 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_BOOL(dontcrunchcorpses, "dontcrunchcorpses") GAMEINFOKEY_BOOL(correctprintbold, "correctprintbold") GAMEINFOKEY_BOOL(forcetextinmenus, "forcetextinmenus") + GAMEINFOKEY_BOOL(forcenogfxsubstitution, "forcenogfxsubstitution") GAMEINFOKEY_BOOL(intermissioncounter, "intermissioncounter") GAMEINFOKEY_BOOL(nightmarefast, "nightmarefast") GAMEINFOKEY_COLOR(dimcolor, "dimcolor") diff --git a/src/gamedata/gi.h b/src/gamedata/gi.h index b5572da73..10bc411c0 100644 --- a/src/gamedata/gi.h +++ b/src/gamedata/gi.h @@ -121,6 +121,7 @@ struct gameinfo_t bool dontcrunchcorpses; bool correctprintbold; bool forcetextinmenus; + bool forcenogfxsubstitution; TArray creditPages; TArray finalePages; TArray infoPages; diff --git a/src/gamedata/textures/texturemanager.cpp b/src/gamedata/textures/texturemanager.cpp index 9ae7989a0..a53a14c58 100644 --- a/src/gamedata/textures/texturemanager.cpp +++ b/src/gamedata/textures/texturemanager.cpp @@ -403,9 +403,11 @@ FTexture *FTextureManager::FindTexture(const char *texname, ETextureType usetype // 3: Only replace if the string is not the default and the graphic comes from the IWAD. Never replace a localized graphic. // 4: Like 1, but lets localized graphics pass. // +// The default is 3, which only replaces known content with non-default texts. +// //========================================================================== -CUSTOM_CVAR(Int, cl_localizationmode,0, CVAR_ARCHIVE) +CUSTOM_CVAR(Int, cl_gfxlocalization, 3, CVAR_ARCHIVE) { if (self < 0 || self > 4) self = 0; } @@ -421,8 +423,8 @@ bool FTextureManager::OkForLocalization(FTextureID texnum, const char *substitut if (!texnum.isValid()) return false; // First the unconditional settings, 0='never' and 1='always'. - if (cl_localizationmode == 1 || gameinfo.forcetextinmenus) return false; - if (cl_localizationmode == 0) return true; + if (cl_gfxlocalization == 1 || gameinfo.forcetextinmenus) return false; + if (cl_gfxlocalization == 0 || gameinfo.forcenogfxsubstitution) return true; uint32_t langtable = 0; if (*substitute == '$') substitute = GStrings.GetString(substitute+1, &langtable); @@ -433,11 +435,11 @@ bool FTextureManager::OkForLocalization(FTextureID texnum, const char *substitut if (localizedTex != texnum.GetIndex()) return true; // Do not substitute a localized variant of the graphics patch. // For mode 4 we are done now. - if (cl_localizationmode == 4) return false; + if (cl_gfxlocalization == 4) return false; // Mode 2 and 3 must reject any text replacement from the default language tables. if ((langtable & MAKE_ID(255,0,0,0)) == MAKE_ID('*', 0, 0, 0)) return true; // Do not substitute if the string comes from the default table. - if (cl_localizationmode == 2) return false; + if (cl_gfxlocalization == 2) return false; // Mode 3 must also reject substitutions for non-IWAD content. int file = Wads.GetLumpFile(Textures[texnum.GetIndex()].Texture->SourceLump); diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index 6e2339d11..008f13b55 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -405,7 +405,7 @@ DEFINE_ACTION_FUNCTION(DMenu, ActivateMenu) // //============================================================================= -EXTERN_CVAR(Int, cl_localizationmode) +EXTERN_CVAR(Int, cl_gfxlocalization) void M_SetMenu(FName menu, int param) @@ -420,7 +420,7 @@ void M_SetMenu(FName menu, int param) { menu = NAME_MainmenuTextOnly; } - else + else if (cl_gfxlocalization != 0 && !gameinfo.forcenogfxsubstitution) { // For these games we must check up-front if they get localized because in that case another template must be used. DMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_Mainmenu); @@ -429,7 +429,7 @@ void M_SetMenu(FName menu, int param) if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor))) { DListMenuDescriptor *ld = static_cast(*desc); - if (ld->mFromEngine && cl_localizationmode != 0) + if (ld->mFromEngine) { // This assumes that replacing one graphic will replace all of them. // So this only checks the "New game" entry for localization capability. diff --git a/src/posix/sdl/hardware.cpp b/src/posix/sdl/hardware.cpp index 61d36abf0..4ea04f4e0 100644 --- a/src/posix/sdl/hardware.cpp +++ b/src/posix/sdl/hardware.cpp @@ -149,11 +149,11 @@ void I_SetFPSLimit(int limit) { FPSLimitTimerEnabled = true; if(timer_create(CLOCK_REALTIME, &FPSLimitEvent, &FPSLimitTimer) == -1) - Printf(DMSG_WARNING, "Failed to create FPS limitter event\n"); + Printf(DMSG_WARNING, "Failed to create FPS limiter event\n"); itimerspec period = { {0, 0}, {0, 0} }; period.it_value.tv_nsec = period.it_interval.tv_nsec = 1000000000 / limit; if(timer_settime(FPSLimitTimer, 0, &period, NULL) == -1) - Printf(DMSG_WARNING, "Failed to set FPS limitter timer\n"); + Printf(DMSG_WARNING, "Failed to set FPS limiter timer\n"); DPrintf(DMSG_NOTIFY, "FPS timer set to %u ms\n", (unsigned int) period.it_interval.tv_nsec / 1000000); } } diff --git a/wadsrc/static/mapinfo/hacx.txt b/wadsrc/static/mapinfo/hacx.txt index 45a511a81..ec6b0bc2e 100644 --- a/wadsrc/static/mapinfo/hacx.txt +++ b/wadsrc/static/mapinfo/hacx.txt @@ -3,5 +3,6 @@ include "mapinfo/doom2.txt" gameinfo { cursorpic = "cursor" + forcenogfxsubstitution = true } diff --git a/wadsrc/static/mapinfo/harmony.txt b/wadsrc/static/mapinfo/harmony.txt index b96689c9f..117d5d175 100644 --- a/wadsrc/static/mapinfo/harmony.txt +++ b/wadsrc/static/mapinfo/harmony.txt @@ -4,5 +4,6 @@ gameinfo { cursorpic = "cursor" statusbarclass = "HarmonyStatusBar" + forcenogfxsubstitution = true } diff --git a/wadsrc/static/mapinfo/urbanbrawl.txt b/wadsrc/static/mapinfo/urbanbrawl.txt index 949be059e..07ddd02da 100644 --- a/wadsrc/static/mapinfo/urbanbrawl.txt +++ b/wadsrc/static/mapinfo/urbanbrawl.txt @@ -4,5 +4,6 @@ gameinfo { swapmenu = true cursorpic = "cursor" + forcenogfxsubstitution = true } From 0ff703c36162e62ea05426531a1bb62f703db412 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 10:11:02 +0100 Subject: [PATCH 16/34] - fixed: Doom's episode names were not translatable. --- src/gamedata/statistics.cpp | 2 +- wadsrc/static/mapinfo/chex.txt | 2 +- wadsrc/static/mapinfo/doom1.txt | 8 ++++---- wadsrc/static/mapinfo/doom2.txt | 4 ++-- wadsrc/static/mapinfo/plutonia.txt | 2 +- wadsrc/static/mapinfo/tnt.txt | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gamedata/statistics.cpp b/src/gamedata/statistics.cpp index db1720130..0c6375934 100644 --- a/src/gamedata/statistics.cpp +++ b/src/gamedata/statistics.cpp @@ -464,7 +464,7 @@ void STAT_ChangeLevel(const char *newl, FLevelLocals *Level) section.ToUpper(); const char *ep_name = StartEpisode->mEpisodeName; - if (*ep_name == '$') ep_name = GStrings[ep_name+1]; + if (*ep_name == '$') ep_name = GStrings(ep_name+1); FStatistics *sl = GetStatisticsList(EpisodeStatistics, section, ep_name); int statvals[6] = {0,0,0,0,0,0}; diff --git a/wadsrc/static/mapinfo/chex.txt b/wadsrc/static/mapinfo/chex.txt index 62da7476e..01782eedd 100644 --- a/wadsrc/static/mapinfo/chex.txt +++ b/wadsrc/static/mapinfo/chex.txt @@ -189,7 +189,7 @@ clearepisodes episode e1m1 { picname = "M_EPI1" - name = "Chex Quest" + name = "$TXT_CHEX_EP" key = "k" } diff --git a/wadsrc/static/mapinfo/doom1.txt b/wadsrc/static/mapinfo/doom1.txt index f767e1c38..738c93c4a 100644 --- a/wadsrc/static/mapinfo/doom1.txt +++ b/wadsrc/static/mapinfo/doom1.txt @@ -21,28 +21,28 @@ clearepisodes episode e1m1 { picname = "M_EPI1" - name = "Knee-Deep in the Dead" + name = "$TXT_D1E1" key = "k" } episode e2m1 { picname = "M_EPI2" - name = "The Shores of Hell" + name = "$TXT_D1E2" key = "t" } episode e3m1 { picname = "M_EPI3" - name = "Inferno" + name = "$TXT_D1E3" key = "i" } episode e4m1 { picname = "M_EPI4" - name = "Thy Flesh Consumed" + name = "$TXT_D1E4" key = "t" optional } diff --git a/wadsrc/static/mapinfo/doom2.txt b/wadsrc/static/mapinfo/doom2.txt index 6268f52c9..e9853c8c4 100644 --- a/wadsrc/static/mapinfo/doom2.txt +++ b/wadsrc/static/mapinfo/doom2.txt @@ -4,13 +4,13 @@ include "mapinfo/doomcommon.txt" clearepisodes episode map01 { - name = "Hell On Earth" + name = "$TXT_D2E1" key = "h" } episode level01 { - name = "No Rest for the Living" + name = "$TXT_D1E2" key = "n" optional } diff --git a/wadsrc/static/mapinfo/plutonia.txt b/wadsrc/static/mapinfo/plutonia.txt index d4fefba86..d248377f6 100644 --- a/wadsrc/static/mapinfo/plutonia.txt +++ b/wadsrc/static/mapinfo/plutonia.txt @@ -6,7 +6,7 @@ include "mapinfo/doomcommon.txt" clearepisodes episode map01 { - name = "The Plutonia Experiment" + name = "$TXT_PLUT_EP" key = "t" } diff --git a/wadsrc/static/mapinfo/tnt.txt b/wadsrc/static/mapinfo/tnt.txt index 12768a5c3..df10bfa7e 100644 --- a/wadsrc/static/mapinfo/tnt.txt +++ b/wadsrc/static/mapinfo/tnt.txt @@ -6,7 +6,7 @@ include "mapinfo/doomcommon.txt" clearepisodes episode map01 { - name = "TNT: Evilution" + name = "$TXT_TNT_EP" key = "t" } From 4f7ad5b130a6d2e7f32b8eb8d30da830a0db251d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 12:06:09 +0100 Subject: [PATCH 17/34] - make the clean scaling system more consistent. Now, all menus will use the same scale, i.e. it only depends on the screen width and a base size of 640. This nearly universally yields better results than trying to make a 320x200 screen fit. The only exceptions to this are the intermission screens and the level summary. These, unlike the menu need to try to make a 320x200 screen fit, but without all the hackery that was present to adjust the menu display. Note that since this affects globally visible script variables, both the intermission and summary drawers will not use their own set but instead temporarily override the global setting as long as they run their own code. Changing the use of variables here might cause much worse problems with menu code so it wasn't attempted --- src/intermission/intermission.cpp | 6 +++ src/v_video.cpp | 65 +++++-------------------------- src/v_video.h | 31 +++++++++++++++ src/wi_stuff.cpp | 3 ++ 4 files changed, 49 insertions(+), 56 deletions(-) diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index f1dd8b9a0..cc2482220 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -847,6 +847,7 @@ void DIntermissionController::OnDestroy () void F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme, uint8_t state) { + ScaleOverrider s; if (DIntermissionController::CurrentIntermission != NULL) { DIntermissionController::CurrentIntermission->Destroy(); @@ -892,6 +893,7 @@ void F_StartIntermission(FName seq, uint8_t state) bool F_Responder (event_t* ev) { + ScaleOverrider s; if (DIntermissionController::CurrentIntermission != NULL) { return DIntermissionController::CurrentIntermission->Responder(ev); @@ -907,6 +909,7 @@ bool F_Responder (event_t* ev) void F_Ticker () { + ScaleOverrider s; if (DIntermissionController::CurrentIntermission != NULL) { DIntermissionController::CurrentIntermission->Ticker(); @@ -921,6 +924,7 @@ void F_Ticker () void F_Drawer () { + ScaleOverrider s; if (DIntermissionController::CurrentIntermission != NULL) { DIntermissionController::CurrentIntermission->Drawer(); @@ -936,6 +940,7 @@ void F_Drawer () void F_EndFinale () { + ScaleOverrider s; if (DIntermissionController::CurrentIntermission != NULL) { DIntermissionController::CurrentIntermission->Destroy(); @@ -951,6 +956,7 @@ void F_EndFinale () void F_AdvanceIntermission() { + ScaleOverrider s; if (DIntermissionController::CurrentIntermission != NULL) { DIntermissionController::CurrentIntermission->mAdvance = true; diff --git a/src/v_video.cpp b/src/v_video.cpp index 61a9ceb7b..d82a24704 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -539,13 +539,10 @@ CCMD(clean) void V_UpdateModeSize (int width, int height) -{ - int cx1, cx2; - V_CalcCleanFacs(320, 200, width, height, &CleanXfac, &CleanYfac, &cx1, &cx2); - - CleanWidth = width / CleanXfac; - CleanHeight = height / CleanYfac; - assert(CleanWidth >= 320 && CleanHeight >= 200); +{ + // This calculates the menu scale. + // The optimal scale will always be to fit a virtual 640 pixel wide display onto the screen. + // Exceptions are made for a few ranges where the available virtual width is > 480. int w = screen->GetWidth(); int factor; @@ -554,9 +551,9 @@ void V_UpdateModeSize (int width, int height) else if (w >= 1600 && w < 1920) factor = 3; else factor = w / 640; - CleanXfac_1 = CleanYfac_1 = factor; - CleanWidth_1 = width / CleanXfac_1; - CleanHeight_1 = height / CleanYfac_1; + CleanXfac = CleanYfac = CleanXfac_1 = CleanYfac_1 = factor; + CleanWidth = CleanWidth_1 = width / CleanXfac_1; + CleanHeight = CleanHeight_1 = height / CleanYfac_1; DisplayWidth = width; DisplayHeight = height; @@ -581,52 +578,8 @@ void V_OutputResized (int width, int height) void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int realheight, int *cleanx, int *cleany, int *_cx1, int *_cx2) { - float ratio; - int cwidth; - int cheight; - int cx1, cy1, cx2, cy2; - - // For larger screems always use at least a 16:9 ratio for clean factor calculation, even if the actual ratio is narrower. - if (realwidth > 1280 && (double)realwidth / realheight < 16./9) - { - realheight = realwidth * 9 / 16; - } - - ratio = ActiveRatio(realwidth, realheight); - if (AspectTallerThanWide(ratio)) - { - cwidth = realwidth; - cheight = realheight * AspectMultiplier(ratio) / 48; - } - else - { - cwidth = realwidth * AspectMultiplier(ratio) / 48; - cheight = realheight; - } - // Use whichever pair of cwidth/cheight or width/height that produces less difference - // between CleanXfac and CleanYfac. - cx1 = MAX(cwidth / designwidth, 1); - cy1 = MAX(cheight / designheight, 1); - cx2 = MAX(realwidth / designwidth, 1); - cy2 = MAX(realheight / designheight, 1); - if (abs(cx1 - cy1) <= abs(cx2 - cy2) || MAX(cx1, cx2) >= 4) - { // e.g. 640x360 looks better with this. - *cleanx = cx1; - *cleany = cy1; - } - else - { // e.g. 720x480 looks better with this. - *cleanx = cx2; - *cleany = cy2; - } - - if (*cleanx < *cleany) - *cleany = *cleanx; - else - *cleanx = *cleany; - - if (_cx1 != NULL) *_cx1 = cx1; - if (_cx2 != NULL) *_cx2 = cx2; + if (designheight < 240 && realheight >= 480) designheight = 240; + *cleanx = *cleany = std::min(realwidth / designwidth, realheight / designheight); } bool IVideo::SetResolution () diff --git a/src/v_video.h b/src/v_video.h index 06295b1a8..7f35f3322 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -628,4 +628,35 @@ inline int active_con_scale() } +class ScaleOverrider +{ + int savedxfac, savedyfac, savedwidth, savedheight; + +public: + // This is to allow certain elements to use an optimal fullscreen scale which for the menu would be too large. + // The old code contained far too much mess to compensate for the menus which negatively affected everything else. + // However, for compatibility reasons the currently used variables cannot be changed so they have to be overridden temporarily. + // This class provides a safe interface for this because it ensures that the values get restored afterward. + // Currently, the intermission and the level summary screen use this. + ScaleOverrider() + { + savedxfac = CleanXfac; + savedyfac = CleanYfac; + savedwidth = CleanWidth; + savedheight = CleanHeight; + V_CalcCleanFacs(320, 200, screen->GetWidth(), screen->GetHeight(), &CleanXfac, &CleanYfac); + CleanWidth = screen->GetWidth() / CleanXfac; + CleanHeight = screen->GetHeight() / CleanYfac; + } + + ~ScaleOverrider() + { + CleanXfac = savedxfac; + CleanYfac = savedyfac; + CleanWidth = savedwidth; + CleanHeight = savedheight; + } +}; + + #endif // __V_VIDEO_H__ diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index dedda4602..1e319a146 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -701,6 +701,7 @@ void WI_Ticker() { if (WI_Screen) { + ScaleOverrider s; IFVIRTUALPTRNAME(WI_Screen, "StatusScreen", Ticker) { VMValue self = WI_Screen; @@ -720,6 +721,7 @@ void WI_Drawer() { if (WI_Screen) { + ScaleOverrider s; IFVIRTUALPTRNAME(WI_Screen, "StatusScreen", Drawer) { VMValue self = WI_Screen; @@ -767,6 +769,7 @@ void WI_Start(wbstartstruct_t *wbstartstruct) SN_StopAllSequences(Level); } WI_Screen = cls->CreateNew(); + ScaleOverrider s; IFVIRTUALPTRNAME(WI_Screen, "StatusScreen", Start) { VMValue val[2] = { WI_Screen, wbstartstruct }; From 7d93983669fabec4c732908c7b28ad0ac3e57545 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 13:19:17 +0100 Subject: [PATCH 18/34] - fixed: SpawnShootDecal tried to get the current level from a value that could point to actor defaults which do not have a level. --- src/p_map.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index c8ba45470..6b7888674 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -98,7 +98,7 @@ CVAR(Int, sv_smartaim, 0, CVAR_ARCHIVE | CVAR_SERVERINFO) CVAR(Bool, cl_doautoaim, false, CVAR_ARCHIVE) static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, DVector2 * posforwindowcheck = NULL); -static void SpawnShootDecal(AActor *t1, const FTraceResults &trace); +static void SpawnShootDecal(AActor *t1, AActor *defaults, const FTraceResults &trace); static void SpawnDeepSplash(AActor *t1, const FTraceResults &trace, AActor *puff); static FRandom pr_tracebleed("TraceBleed"); @@ -4568,20 +4568,20 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, { // [ZK] If puff has FORCEDECAL set, do not use the weapon's decal if (puffDefaults->flags7 & MF7_FORCEDECAL && puff != NULL && puff->DecalGenerator) - SpawnShootDecal(puff, trace); + SpawnShootDecal(puff, puff, trace); else - SpawnShootDecal(t1, trace); + SpawnShootDecal(t1, t1, trace); } // Else, look if the bulletpuff has a decal defined. else if (puff != NULL && puff->DecalGenerator) { - SpawnShootDecal(puff, trace); + SpawnShootDecal(puff, puff, trace); } else { - SpawnShootDecal(t1, trace); + SpawnShootDecal(t1, t1, trace); } } else if (puff != NULL && @@ -5268,9 +5268,9 @@ void P_RailAttack(FRailParams *p) puff->Destroy(); } if (puffDefaults != nullptr && puffDefaults->flags7 & MF7_FORCEDECAL && puffDefaults->DecalGenerator) - SpawnShootDecal(puffDefaults, trace); + SpawnShootDecal(source, puffDefaults, trace); else - SpawnShootDecal(source, trace); + SpawnShootDecal(source, source, trace); } if (trace.HitType == TRACE_HitFloor || trace.HitType == TRACE_HitCeiling) @@ -6746,19 +6746,19 @@ bool P_ChangeSector(sector_t *sector, int crunch, double amt, int floorOrCeil, b // //========================================================================== -void SpawnShootDecal(AActor *t1, const FTraceResults &trace) +void SpawnShootDecal(AActor *t1, AActor *defaults, const FTraceResults &trace) { - FDecalBase *decalbase = NULL; + FDecalBase *decalbase = nullptr; - if (t1->player != NULL && t1->player->ReadyWeapon != NULL) + if (defaults->player != nullptr && defaults->player->ReadyWeapon != nullptr) { - decalbase = t1->player->ReadyWeapon->DecalGenerator; + decalbase = defaults->player->ReadyWeapon->DecalGenerator; } else { - decalbase = t1->DecalGenerator; + decalbase = defaults->DecalGenerator; } - if (decalbase != NULL) + if (decalbase != nullptr) { DImpactDecal::StaticCreate(t1->Level, decalbase->GetDecal(), trace.HitPos, trace.Line->sidedef[trace.Side], trace.ffloor); From b59b092c4908aa22ecf1122426bf6cd0c3b9a627 Mon Sep 17 00:00:00 2001 From: Nemrtvi Date: Sun, 17 Mar 2019 11:45:14 +0100 Subject: [PATCH 19/34] Russian/Spanish quotation marks for BIGFONT + Better back buttons The quotation marks were made by combining the < and > signs. Because the back buttons in the menu look quite similar, they were also retouched for all games. --- .../filter/game-doom/fonts/bigfont/003C.lmp | Bin 161 -> 161 bytes .../filter/game-doom/fonts/bigfont/00AB.lmp | Bin 0 -> 259 bytes .../filter/game-doom/fonts/bigfont/00BB.lmp | Bin 0 -> 259 bytes .../filter/game-doom/fonts/bigupper/003C.lmp | Bin 186 -> 186 bytes .../filter/game-doom/fonts/bigupper/00AB.lmp | Bin 0 -> 294 bytes .../filter/game-doom/fonts/bigupper/00BB.lmp | Bin 0 -> 294 bytes .../game-heretic/fonts/defbigfont/00AB.lmp | Bin 0 -> 308 bytes .../game-heretic/fonts/defbigfont/00BB.lmp | Bin 0 -> 308 bytes .../filter/game-hexen/fonts/defbigfont/00AB.lmp | Bin 0 -> 308 bytes .../filter/game-hexen/fonts/defbigfont/00BB.lmp | Bin 0 -> 308 bytes .../filter/game-strife/fonts/bigfont/00AB.lmp | Bin 316 -> 316 bytes .../filter/game-strife/fonts/bigfont/00BB.lmp | Bin 316 -> 316 bytes wadsrc_extra/static/graphics/m_back_d.png | Bin 204 -> 274 bytes wadsrc_extra/static/graphics/m_back_h.png | Bin 213 -> 330 bytes wadsrc_extra/static/graphics/m_back_s.png | Bin 235 -> 308 bytes wadsrc_extra/static/graphics/m_back_x.png | Bin 169 -> 287 bytes 16 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 wadsrc_extra/static/filter/game-doom/fonts/bigfont/00AB.lmp create mode 100644 wadsrc_extra/static/filter/game-doom/fonts/bigfont/00BB.lmp create mode 100644 wadsrc_extra/static/filter/game-doom/fonts/bigupper/00AB.lmp create mode 100644 wadsrc_extra/static/filter/game-doom/fonts/bigupper/00BB.lmp create mode 100644 wadsrc_extra/static/filter/game-heretic/fonts/defbigfont/00AB.lmp create mode 100644 wadsrc_extra/static/filter/game-heretic/fonts/defbigfont/00BB.lmp create mode 100644 wadsrc_extra/static/filter/game-hexen/fonts/defbigfont/00AB.lmp create mode 100644 wadsrc_extra/static/filter/game-hexen/fonts/defbigfont/00BB.lmp diff --git a/wadsrc_extra/static/filter/game-doom/fonts/bigfont/003C.lmp b/wadsrc_extra/static/filter/game-doom/fonts/bigfont/003C.lmp index 7a664bb048e77709555597f246e905f5f8a99ae1..4541779456ed71180b405b6da979ac64708cd355 100644 GIT binary patch delta 114 zcmXAg+YNvq6hlRP#(f-w81V^$5R$r#D=?{Ev_Cy<)5s#b`)dOpUINCfM0pMDi~pFl q#FKJfD_XJ+7=&J7y+2Z>kC;cGB5)z3ssN+}YVy;jf+MN^A delta 114 zcmZ3;xR7yzS$23<)_-Q!tgP_#03eHr9mtALj0K4@a)Q|LsSq9mH;@+@nVOXvn+TF+ n0O|<}ip|Pm12WRn(m_HjSy>@K5q2P*o(K|P&H@1r2=yNTWs@nm diff --git a/wadsrc_extra/static/filter/game-doom/fonts/bigfont/00AB.lmp b/wadsrc_extra/static/filter/game-doom/fonts/bigfont/00AB.lmp new file mode 100644 index 0000000000000000000000000000000000000000..dcbc89ed8d3600face4e18f08e33814284ae9f2e GIT binary patch literal 259 zcmaiu!3}~y6a^On(U4e^CyyS85fl|cHYD$836@|9mS6>zU=Oz7eH~%r)lFvqd)e&d z&rE8Jac<7NfF%^r!Wk}bg&W-A0Z(|r8{$Bci$ZC~3}dOTOVTKj_FLQMU`j3yt*s8c zm{eM2RjJ0>qwm>f&HuLRe9!Y)K_vq6J&-UK6`&FWS;oqk2j@F0 zrNC;luHnkAVIEAGm)l+K55q06ENb7HxPMKf^UWaSZxgnE*+$9FrC~pTb&NPI?HUKx F;RAx`Q)B=D literal 0 HcmV?d00001 diff --git a/wadsrc_extra/static/filter/game-doom/fonts/bigupper/003C.lmp b/wadsrc_extra/static/filter/game-doom/fonts/bigupper/003C.lmp index 5caa691577aaf3b423743bd6adb33241f51f35d5..09c814b42e5c5464b05b63b5748e6c4361f84119 100644 GIT binary patch delta 136 zcmXAh*A0L$3`7Ynl#LhzAwmz$igZh`0`p`!u)#m~?ww?>yt=Dv0-iVlwrymJG%yeJ zahNlA%Sm?OMU~R*h@D7!kOEC@TR=0Nj#iQUsP5Ti42N@~V!#+6=R9^15#)+L)bj#{ CuQ81P literal 186 zcmXAiOA5j;6h&X{&sN-vBZrP1N-0POp+ty*J9HD>gIjQq#uF1bxu1~tMmw6>H=Vf8 zaDgk#@PHR=@P-d`m88_x(j9GDG~RG^k6XRV?QY0^4JB2Fk`&zk)jIOB1gXbG=kph1 Z&@?$|kBQHit45k>1~mFyu#__vNk2x_H?;r& diff --git a/wadsrc_extra/static/filter/game-doom/fonts/bigupper/00AB.lmp b/wadsrc_extra/static/filter/game-doom/fonts/bigupper/00AB.lmp new file mode 100644 index 0000000000000000000000000000000000000000..6df87047cb5ed89e5c24f0542c774e3fe9941ed7 GIT binary patch literal 294 zcmZXP+X=!j7={1Zn^lUBF65JsL0Yx7wU+ID<1dgCn?v@79wxf?(jwe{upJ z$wFcgdG{;sYobU_PUK83%PhICh$1I)CKqxgH*zNr@+7V!G9`1eAmYKU@uwK^f%O51S<4zQ5&&t+WW=V_ zosB|Zv(1@B>BA$97jL!#J6HLI*DAv%i_r3uvL|ljf literal 0 HcmV?d00001 diff --git a/wadsrc_extra/static/filter/game-heretic/fonts/defbigfont/00AB.lmp b/wadsrc_extra/static/filter/game-heretic/fonts/defbigfont/00AB.lmp new file mode 100644 index 0000000000000000000000000000000000000000..1aec36d6cdc02947d5ab6c6547e890fae6765d03 GIT binary patch literal 308 zcmait%?-jZ429jFv=mf{6DzO^CytyMfC(6Z8JK|?7y+q{ow^buFac6{NfB2LU*o>K z_*+v?MDMu6cMlHW2u|P(F5n7o;0_+(30|Noh&Esgn!?PYtH#l$Db~(x(lk|VnpDzU zcIb$D4e75~;YL&juenKmY6j27NPNi0243*GjOgP%Zlnwzz9sh2uy$!UQ)!B!`HYk zFaEaF6VW^F@jZYeIDs>`fGfCx0Pf%cp5O(lf@lW@&=h7CT{TTM&#`u9v!G+vBl%XVqi4>IGV46 c+lGG{w`h3fQkFe+_Hc)D(Uj2ex`cw`2OM>izyJUM literal 0 HcmV?d00001 diff --git a/wadsrc_extra/static/filter/game-hexen/fonts/defbigfont/00BB.lmp b/wadsrc_extra/static/filter/game-hexen/fonts/defbigfont/00BB.lmp new file mode 100644 index 0000000000000000000000000000000000000000..3117384c47de6aae6e96faffeb71ecbe1efd7849 GIT binary patch literal 308 zcma)$!41MN3`L!`X(?5t4#1fsbFcs_umejl0>{XStfgp)Z+;wOLKh1%xpMaTsbwW+xJT?bL(~rAJparfRtSZXUCGxCE=l aY#RHYqaCWT`Z~>ZH)q`<#XY^Uxbg?B36m)R literal 0 HcmV?d00001 diff --git a/wadsrc_extra/static/filter/game-strife/fonts/bigfont/00AB.lmp b/wadsrc_extra/static/filter/game-strife/fonts/bigfont/00AB.lmp index 24e73edd0ba7c1a25d2c1e6cf0ad9b42ff996eab..de9aecf8e62c0d2ba9de11e4263febd8a4c34079 100644 GIT binary patch literal 316 zcmYk1!3}~i7=?d8AjXh*a0w@|K=J6=0i3`iw2*js12}^-ID;cNf_D%2C{;`H!Fzw{ z*K{p~h`dL|_nsWck(|hxT*#H&$eldMle|bAiEPN0WD$TdO#s91A_Z(cr6gynYTYr% zOQ0`VT#Ht0s;r=O({j~!?w`99z_3%!)3`t8iP!xnKWAW>4hgN5@!eZX3!_7;3MUy) T?t2U5OkLMHF|XvF{2Rs(#X@ti literal 316 zcmYk1y$!-J5QQ%ZNrX@&3YK6JoJ66da=`#hK$*XS;s#&_W?%+JU<7KK@WlyWOP}w( zv;9t9OC}=k!LaY)07p2%87^>z8{FXmPk2EXh-_dBNua7j9I3X{MNBOlRFtZAMQKMJ zF3~y0*0^A$+MB#kYb($5e)5uWzB4YTayO>V9QW`1GQE^>h@V=tv!7G*RvYW58o!e; Ux$ipF6xGzV3+791rC%|805^hkivR!s diff --git a/wadsrc_extra/static/filter/game-strife/fonts/bigfont/00BB.lmp b/wadsrc_extra/static/filter/game-strife/fonts/bigfont/00BB.lmp index 7afb1e282167176c3a9252355aaf5302f368d8cd..6fb84af8bd634a5c6b044ad425a24398c4b8075f 100644 GIT binary patch literal 316 zcmZvX%MHRX5JcC6BmxwPBL#5gNDJg!0ZmXtY=_&ND1j2Fff}fR65y~5i6cP5(zA9) z_FL^zG7))d&U;S|q$MYECKqxgH*zNrGB+YCvL+j{B__sj(y>rUfMeHrAZ2B3+X5;X z!(Co@xVmZnCuRY3c~QE$?q7_375d(Rt|%E;d>rshEWWMqmBTP6Sm5w$MX*k0oEn_a VC`Hggr(EgnfyNQ|ADS30t1mxdbHD%q literal 316 zcmZvX%?-jZ422y^8v&}skpVb!WCi-8PC$oXhBWE%ofv@;n1LCXff0H!kJ3Vsi1fww zll4hnODZCrX8e!jL>xJj3%QaTxswO!$kK>x$d>HLo|qW#XU9e*0opbMz_M$cbAU?9 z@Q~#mO4xr%3NDTSxG(?rC$QOMq@;@O1TaS?83{ F1OP!VUnBqk delta 188 zcmV;t07L(h0?YxB7=Hu<0000|mGc(>000|MOjJb#{`@-u0_y?>&H@Hm0RyoD1(N~< zb^!w(0Rb-{%`N}{00DGTPE!Ct=GbNc003V}L_t(|+BMBV3V8l_`N{bQY*n@H!Xy>8ve`&pn4|&&$1B%?GpjFImkh+k~Or1f@Xvq(0rf*ydw0M qY`knd8PzPrBQ<45T(0{}7{5Nwz8+-u6a3Zy0000AVQTDfP!g!;P*DwF0wUHWEmM9N{Z5-^d9PYraHD$J zxAO8(FU=!=ubU>H3;g`>fBgFwC^NbR6gp22WQ% Jmvv4FO#rWzb*lgX delta 197 zcmX@bbd_;}L_G^L0|P_Q)X(BTN+rN2#FgdW9}y!S5hD?oNhUIOA~sDrI!P)jK{7H< zA|dNseCFAh6zT98?U?{n&sY-V7tG-B>_!@p6YuHb7*cUd^|T^ig8@(L!|4kih|KAl zm{6#3M};#hLgusYF`YF@(;u6v%+L6@jX_~HRr zIAhmS8T;1ahSNujLM)C>DBvq76YT$KmviVG=btpj#fJ>pT8b0I4Ng3_S*P(vrhIq9 p!^Jw9Z{%WD{RmvilNZaO|7*?{!vn8x#R8qr;OXk;vd$@?2>|AccX9v# delta 219 zcmV<103`pk0_y>g7=Hu<0000|mGc(>001gbOjJb#{`_a+n zJOTt<1_UGm1ax9dq?&Xz0t6Ha4E=2t)Bpeg0d!JMQvg8b*k%9#0B=b|K~#9!V_;xl z;JwRm_X3E%wd(GwwLr$Lg|e#zfec<1mrE`#x(p1LI(juaI#hHSc$1B<85^hFWw=&e zn_gaa7pNrW%+)hzLV>KSXU@i)ITH&M+Bx&~%$a+E=G@*ncQ=^9dwciY-5>_UE&$e& VE>GYMGxh)g002ovPDHLkV1gE@RdoOW diff --git a/wadsrc_extra/static/graphics/m_back_x.png b/wadsrc_extra/static/graphics/m_back_x.png index d785b6788a3306ea75414bcfd6f19664be3181ed..332ffa191fa4728a22d1c33a76c215d189a77b8d 100644 GIT binary patch delta 272 zcmZ3H~~Y5MPi{CBMn z``9&G4)`TU9gmcD;yBjDkzopr0F2veY5)KL delta 153 zcmbQww32axL_G^L0|P_Q)X(BTia)?7#FgdWA8SUYNJi$#Oe|%L%(v#8-wl*vED7=p zW^j0RBMr#$@N{tuskjw;>LBL<10I%xtxFi1FE=QNp2#}T{(HUV^gTWaa>u-w3q*e||e{4XHHD_*$mY$VW722WQ%mvv4F FO#s)|IxPSI From 2e260c6367da31b316f530d1633d8600c1631982 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 14:40:06 +0100 Subject: [PATCH 20/34] - use the new console font for the options menu to gain space and better character support. So far this is just an experiment, this needs a bit of work to become viable. --- src/v_video.cpp | 10 +++++-- wadsrc/static/menudef.txt | 4 ++- wadsrc/static/zscript/ui/menu/menu.zs | 2 +- wadsrc/static/zscript/ui/menu/optionmenu.zs | 10 +++---- .../static/zscript/ui/menu/optionmenuitems.zs | 30 +++++++++---------- wadsrc/static/zscript/ui/menu/reverbedit.zs | 8 ++--- .../static/zscript/ui/menu/textentermenu.zs | 2 +- 7 files changed, 36 insertions(+), 30 deletions(-) diff --git a/src/v_video.cpp b/src/v_video.cpp index d82a24704..536c08ed5 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -551,9 +551,13 @@ void V_UpdateModeSize (int width, int height) else if (w >= 1600 && w < 1920) factor = 3; else factor = w / 640; - CleanXfac = CleanYfac = CleanXfac_1 = CleanYfac_1 = factor; - CleanWidth = CleanWidth_1 = width / CleanXfac_1; - CleanHeight = CleanHeight_1 = height / CleanYfac_1; + CleanXfac = CleanYfac = factor; + CleanWidth = width / CleanXfac; + CleanHeight = height / CleanYfac; + + CleanYfac_1 = CleanXfac_1 = MAX(1, int (CleanXfac * 0.7)); + CleanWidth_1 = width / CleanXfac_1; + CleanHeight_1 = height / CleanYfac_1; DisplayWidth = width; DisplayHeight = height; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 11d29e2f0..8cf3d0ea2 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -344,11 +344,13 @@ OptionValue AutoOffOn OptionMenuSettings { // These can be overridden if a different menu fonts requires it. - Linespacing 8 + Linespacing 17 + /* IfGame(Heretic, Hexen) { Linespacing 9 } + */ } DefaultOptionMenu diff --git a/wadsrc/static/zscript/ui/menu/menu.zs b/wadsrc/static/zscript/ui/menu/menu.zs index 2746f5585..3b3a0f597 100644 --- a/wadsrc/static/zscript/ui/menu/menu.zs +++ b/wadsrc/static/zscript/ui/menu/menu.zs @@ -285,7 +285,7 @@ class Menu : Object native ui version("2.4") static void DrawConText (int color, int x, int y, String str) { - screen.DrawText (ConFont, color, x, y, str, DTA_CellX, 8 * CleanXfac_1, DTA_CellY, 8 * CleanYfac_1); + screen.DrawText (NewConsoleFont, color, x, y, str, DTA_CellX, 9 * CleanXfac_1/2, DTA_CellY, 8 * CleanYfac_1); } } diff --git a/wadsrc/static/zscript/ui/menu/optionmenu.zs b/wadsrc/static/zscript/ui/menu/optionmenu.zs index c06abf723..9173e0cf9 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenu.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenu.zs @@ -451,7 +451,7 @@ class OptionMenu : Menu } int ytop = y + mDesc.mScrollTop * 8 * CleanYfac_1; - int lastrow = screen.GetHeight() - SmallFont.GetHeight() * CleanYfac_1; + int lastrow = screen.GetHeight() - NewConsoleFont.GetHeight() * CleanYfac_1; int i; for (i = 0; i < mDesc.mItems.Size() && y <= lastrow; i++) @@ -519,8 +519,8 @@ class GameplayMenu : OptionMenu Super.Drawer(); String s = String.Format("dmflags = %d dmflags2 = %d", dmflags, dmflags2); - screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, - (screen.GetWidth() - SmallFont.StringWidth (s) * CleanXfac_1) / 2, 0, s, + screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, + (screen.GetWidth() - NewConsoleFont.StringWidth (s) * CleanXfac_1) / 2, 0, s, DTA_CleanNoMove_1, true); } } @@ -532,8 +532,8 @@ class CompatibilityMenu : OptionMenu Super.Drawer(); String s = String.Format("compatflags = %d compatflags2 = %d", compatflags, compatflags2); - screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, - (screen.GetWidth() - SmallFont.StringWidth (s) * CleanXfac_1) / 2, 0, s, + screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, + (screen.GetWidth() - NewConsoleFont.StringWidth (s) * CleanXfac_1) / 2, 0, s, DTA_CleanNoMove_1, true); } } diff --git a/wadsrc/static/zscript/ui/menu/optionmenuitems.zs b/wadsrc/static/zscript/ui/menu/optionmenuitems.zs index df955bb78..8509aad1c 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenuitems.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenuitems.zs @@ -51,10 +51,10 @@ class OptionMenuItem : MenuItemBase int overlay = grayed? Color(96,48,0,0) : 0; int x; - int w = SmallFont.StringWidth(label) * CleanXfac_1; + int w = NewConsoleFont.StringWidth(label) * CleanXfac_1; if (!mCentered) x = indent - w; else x = (screen.GetWidth() - w) / 2; - screen.DrawText (SmallFont, color, x, y, label, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); + screen.DrawText (NewConsoleFont, color, x, y, label, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); return x; } @@ -71,7 +71,7 @@ class OptionMenuItem : MenuItemBase override int GetIndent() { if (mCentered) return 0; - return SmallFont.StringWidth(Stringtable.Localize(mLabel)); + return NewConsoleFont.StringWidth(Stringtable.Localize(mLabel)); } override bool MouseEvent(int type, int x, int y) @@ -140,7 +140,7 @@ class OptionMenuItemLabeledSubmenu : OptionMenuItemSubmenu String text = mLabelCVar.GetString(); if (text.Length() == 0) text = Stringtable.Localize("$notset"); - screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); + screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); return indent; } @@ -298,7 +298,7 @@ class OptionMenuItemOptionBase : OptionMenuItem int Selection = GetSelection(); String text = StringTable.Localize(OptionValues.GetText(mValues, Selection)); if (text.Length() == 0) text = "Unknown"; - screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); + screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); return indent; } @@ -506,7 +506,7 @@ class OptionMenuItemControlBase : OptionMenuItem } else { - screen.DrawText(SmallFont, Font.CR_BLACK, indent + CursorSpace(), y + (OptionMenuSettings.mLinespacing-8)*CleanYfac_1, "---", DTA_CleanNoMove_1, true); + screen.DrawText(NewConsoleFont, Font.CR_BLACK, indent + CursorSpace(), y + (OptionMenuSettings.mLinespacing-8)*CleanYfac_1, "---", DTA_CleanNoMove_1, true); } return indent; } @@ -644,9 +644,9 @@ class OptionMenuItemStaticTextSwitchable : OptionMenuItem override int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected) { String txt = StringTable.Localize(mCurrent? mAltText : mLabel); - int w = SmallFont.StringWidth(txt) * CleanXfac_1; + int w = NewConsoleFont.StringWidth(txt) * CleanXfac_1; int x = (screen.GetWidth() - w) / 2; - screen.DrawText (SmallFont, mColor, x, y, txt, DTA_CleanNoMove_1, true); + screen.DrawText (NewConsoleFont, mColor, x, y, txt, DTA_CleanNoMove_1, true); return -1; } @@ -731,7 +731,7 @@ class OptionMenuSliderBase : OptionMenuItem if (fracdigits >= 0) { textbuf = String.format(formater, max); - maxlen = SmallFont.StringWidth(textbuf) * CleanXfac_1; + maxlen = NewConsoleFont.StringWidth(textbuf) * CleanXfac_1; } mSliderShort = right + maxlen > screen.GetWidth(); @@ -752,7 +752,7 @@ class OptionMenuSliderBase : OptionMenuItem if (fracdigits >= 0 && right + maxlen <= screen.GetWidth()) { textbuf = String.format(formater, cur); - screen.DrawText(SmallFont, Font.CR_DARKGRAY, right, y, textbuf, DTA_CleanNoMove_1, true); + screen.DrawText(NewConsoleFont, Font.CR_DARKGRAY, right, y, textbuf, DTA_CleanNoMove_1, true); } } @@ -973,7 +973,7 @@ class OptionMenuFieldBase : OptionMenuItem drawLabel(indent, y, selected ? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, grayed); int overlay = grayed? Color(96, 48, 0, 0) : 0; - screen.DrawText(SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, Represent(), DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); + screen.DrawText(NewConsoleFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, Represent(), DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); return indent; } @@ -1022,7 +1022,7 @@ class OptionMenuItemTextField : OptionMenuFieldBase override String Represent() { - if (mEnter) return mEnter.GetText() .. SmallFont.GetCursor(); + if (mEnter) return mEnter.GetText() .. NewConsoleFont.GetCursor(); else return GetCVarString(); } @@ -1032,7 +1032,7 @@ class OptionMenuItemTextField : OptionMenuFieldBase { // reposition the text so that the cursor is visible when in entering mode. String text = Represent(); - int tlen = SmallFont.StringWidth(text) * CleanXfac_1; + int tlen = NewConsoleFont.StringWidth(text) * CleanXfac_1; int newindent = screen.GetWidth() - tlen - CursorSpace(); if (newindent < indent) indent = newindent; } @@ -1044,7 +1044,7 @@ class OptionMenuItemTextField : OptionMenuFieldBase if (mkey == Menu.MKEY_Enter) { Menu.MenuSound("menu/choose"); - mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), SmallFont, GetCVarString(), -1, fromcontroller); + mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), NewConsoleFont, GetCVarString(), -1, fromcontroller); mEnter.ActivateMenu(); return true; } @@ -1156,7 +1156,7 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider if ((Selection == 0 || Selection == -1) && mClickVal <= 0) { String text = Selection == 0? TextZero : Selection == -1? TextNegOne : ""; - screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); + screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); } else { diff --git a/wadsrc/static/zscript/ui/menu/reverbedit.zs b/wadsrc/static/zscript/ui/menu/reverbedit.zs index 7bc799797..2b4b4572f 100644 --- a/wadsrc/static/zscript/ui/menu/reverbedit.zs +++ b/wadsrc/static/zscript/ui/menu/reverbedit.zs @@ -132,7 +132,7 @@ class OptionMenuItemReverbSelect : OptionMenuItemSubMenu int x = drawLabel(indent, y, selected? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor); String text = ReverbEdit.GetSelectedEnvironment(); - screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); + screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); return indent; } @@ -210,7 +210,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase virtual String Represent() { - return mEnter.GetText() .. SmallFont.GetCursor(); + return mEnter.GetText() .. NewConsoleFont.GetCursor(); } //============================================================================= @@ -221,7 +221,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase mDrawX = indent + CursorSpace(); if (mEnter) { - screen.DrawText(SmallFont, OptionMenuSettings.mFontColorValue, mDrawX, y, Represent(), DTA_CleanNoMove_1, true); + screen.DrawText(NewConsoleFont, OptionMenuSettings.mFontColorValue, mDrawX, y, Represent(), DTA_CleanNoMove_1, true); } else { @@ -235,7 +235,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase if (mkey == Menu.MKEY_Enter) { Menu.MenuSound("menu/choose"); - mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), SmallFont, String.Format("%.3f", GetSliderValue()), -1, fromcontroller); + mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), NewConsoleFont, String.Format("%.3f", GetSliderValue()), -1, fromcontroller); mEnter.ActivateMenu(); return true; } diff --git a/wadsrc/static/zscript/ui/menu/textentermenu.zs b/wadsrc/static/zscript/ui/menu/textentermenu.zs index 328c7aa94..e39b40763 100644 --- a/wadsrc/static/zscript/ui/menu/textentermenu.zs +++ b/wadsrc/static/zscript/ui/menu/textentermenu.zs @@ -84,7 +84,7 @@ class TextEnterMenu : Menu deprecated("3.8") static TextEnterMenu Open(Menu parent, String textbuffer, int maxlen, int sizemode, bool showgrid = false, bool allowcolors = false) { let me = new("TextEnterMenu"); - me.Init(parent, SmallFont, textbuffer, maxlen*8, showgrid, allowcolors); + me.Init(parent, NewConsoleFont, textbuffer, maxlen*8, showgrid, allowcolors); return me; } From 2227c150108cd8160e3c2387ebfd1440a265805a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 16:22:38 +0100 Subject: [PATCH 21/34] - create a second font based on the VGA glyphs that is stylistically more similar to the SmallFont and use that for the option menus. --- src/gamedata/fonts/hexfont.cpp | 247 ++++++++++++++---- src/gamedata/fonts/v_font.cpp | 4 +- src/gamedata/fonts/v_font.h | 2 +- src/v_video.cpp | 3 +- wadsrc/static/zscript/base.zs | 1 + wadsrc/static/zscript/ui/menu/menu.zs | 2 +- wadsrc/static/zscript/ui/menu/optionmenu.zs | 10 +- .../static/zscript/ui/menu/optionmenuitems.zs | 36 +-- wadsrc/static/zscript/ui/menu/reverbedit.zs | 8 +- .../static/zscript/ui/menu/textentermenu.zs | 2 +- 10 files changed, 239 insertions(+), 76 deletions(-) diff --git a/src/gamedata/fonts/hexfont.cpp b/src/gamedata/fonts/hexfont.cpp index 4567cc324..2980af2c9 100644 --- a/src/gamedata/fonts/hexfont.cpp +++ b/src/gamedata/fonts/hexfont.cpp @@ -42,6 +42,51 @@ #include "fontinternals.h" + +struct HexDataSource +{ + int FirstChar = INT_MAX, LastChar = INT_MIN; + TArray glyphdata; + unsigned glyphmap[65536] = {}; + + //========================================================================== + // + // parse a HEX font + // + //========================================================================== + + void ParseDefinition(int lumpnum) + { + FScanner sc; + + sc.OpenLumpNum(lumpnum); + sc.SetCMode(true); + glyphdata.Push(0); // ensure that index 0 can be used as 'not present'. + while (sc.GetString()) + { + int codepoint = (int)strtoull(sc.String, nullptr, 16); + sc.MustGetStringName(":"); + sc.MustGetString(); + if (codepoint >= 0 && codepoint < 65536 && !sc.Compare("00000000000000000000000000000000")) // don't set up empty glyphs. + { + unsigned size = (unsigned)strlen(sc.String); + unsigned offset = glyphdata.Reserve(size / 2 + 1); + glyphmap[codepoint] = offset; + glyphdata[offset++] = size / 2; + for (unsigned i = 0; i < size; i += 2) + { + char hex[] = { sc.String[i], sc.String[i + 1], 0 }; + glyphdata[offset++] = (uint8_t)strtoull(hex, nullptr, 16); + } + if (codepoint < FirstChar) FirstChar = codepoint; + if (codepoint > LastChar) LastChar = codepoint; + } + } + } +}; + +static HexDataSource hexdata; + // This is a font character that reads RLE compressed data. class FHexFontChar : public FImageSource { @@ -113,51 +158,78 @@ TArray FHexFontChar::CreatePalettedPixels(int) return Pixels; } +class FHexFontChar2 : public FHexFontChar +{ +public: + FHexFontChar2(uint8_t *sourcedata, int swidth, int width, int height); + + TArray CreatePalettedPixels(int conversion) override; +}; + + +//========================================================================== +// +// FHexFontChar :: FHexFontChar +// +// Used by HEX fonts. +// +//========================================================================== + +FHexFontChar2::FHexFontChar2(uint8_t *sourcedata, int swidth, int width, int height) + : FHexFontChar(sourcedata, swidth, width, height) +{ +} + +//========================================================================== +// +// FHexFontChar :: Get8BitPixels +// +// The render style has no relevance here. +// +//========================================================================== + +TArray FHexFontChar2::CreatePalettedPixels(int) +{ + int destSize = Width * Height; + TArray Pixels(destSize, true); + uint8_t *dest_p = Pixels.Data(); + + auto drawLayer = [&](int ix, int iy, int color) + { + const uint8_t *src_p = SourceData; + for (int y = 0; y < Height-2; y++) + { + for (int x = 0; x < SourceWidth; x++) + { + int byte = *src_p++; + uint8_t *pixelstart = dest_p + (ix + 8 * x) * Height + (iy+y); + for (int bit = 0; bit < 8; bit++) + { + if (byte & (128 >> bit)) + { + pixelstart[bit*Height] = color; + } + } + } + } + }; + memset(dest_p, 0, destSize); + + const int darkcolor = 3; + const int brightcolor = 14; + for (int xx=0;xx<3;xx++) for (int yy=0;yy<3;yy++) if (xx !=1 || yy != 1) + drawLayer(xx, yy, darkcolor); + drawLayer(1, 1, brightcolor); + + return Pixels; +} + class FHexFont : public FFont { - TArray glyphdata; - unsigned glyphmap[65536] = {}; public: - //========================================================================== - // - // parse a HEX font - // - //========================================================================== - - void ParseDefinition(int lumpnum) - { - FScanner sc; - - FirstChar = INT_MAX; - LastChar = INT_MIN; - sc.OpenLumpNum(lumpnum); - sc.SetCMode(true); - glyphdata.Push(0); // ensure that index 0 can be used as 'not present'. - while (sc.GetString()) - { - int codepoint = (int)strtoull(sc.String, nullptr, 16); - sc.MustGetStringName(":"); - sc.MustGetString(); - if (codepoint >= 0 && codepoint < 65536 && !sc.Compare("00000000000000000000000000000000")) // don't set up empty glyphs. - { - unsigned size = (unsigned)strlen(sc.String); - unsigned offset = glyphdata.Reserve(size/2 + 1); - glyphmap[codepoint] = offset; - glyphdata[offset++] = size / 2; - for(unsigned i = 0; i < size; i+=2) - { - char hex[] = { sc.String[i], sc.String[i+1], 0 }; - glyphdata[offset++] = (uint8_t)strtoull(hex, nullptr, 16); - } - if (codepoint < FirstChar) FirstChar = codepoint; - if (codepoint > LastChar) LastChar = codepoint; - } - } - } - //========================================================================== // // FHexFont :: FHexFont @@ -173,7 +245,8 @@ public: FontName = fontname; - ParseDefinition(lump); + FirstChar = hexdata.FirstChar; + LastChar = hexdata.LastChar; Next = FirstFont; FirstFont = this; @@ -208,11 +281,11 @@ public: Chars.Resize(LastChar - FirstChar + 1); for (int i = FirstChar; i <= LastChar; i++) { - if (glyphmap[i] > 0) + if (hexdata.glyphmap[i] > 0) { - auto offset = glyphmap[i]; - int size = glyphdata[offset] / 16; - Chars[i - FirstChar].TranslatedPic = new FImageTexture(new FHexFontChar (&glyphdata[offset+1], size, size * 9, 16)); + auto offset = hexdata.glyphmap[i]; + int size = hexdata.glyphdata[offset] / 16; + Chars[i - FirstChar].TranslatedPic = new FImageTexture(new FHexFontChar (&hexdata.glyphdata[offset+1], size, size * 9, 16)); Chars[i - FirstChar].TranslatedPic->SetUseType(ETextureType::FontChar); Chars[i - FirstChar].XMove = size * spacing; TexMan.AddTexture(Chars[i - FirstChar].TranslatedPic); @@ -226,6 +299,79 @@ public: }; +class FHexFont2 : public FFont +{ + +public: + //========================================================================== + // + // FHexFont :: FHexFont + // + // Loads a HEX font + // + //========================================================================== + + FHexFont2(const char *fontname, int lump) + : FFont(lump) + { + assert(lump >= 0); + + FontName = fontname; + + FirstChar = hexdata.FirstChar; + LastChar = hexdata.LastChar; + + Next = FirstFont; + FirstFont = this; + FontHeight = 18; + SpaceWidth = 10; + GlobalKerning = -1; + translateUntranslated = true; + + LoadTranslations(); + } + + //========================================================================== + // + // FHexFont :: LoadTranslations + // + //========================================================================== + + void LoadTranslations() + { + const int spacing = 9; + double luminosity[256]; + + memset(PatchRemap, 0, 256); + for (int i = 0; i < 18; i++) + { + // Create a gradient similar to the old console font. + PatchRemap[i] = i; + luminosity[i] = i / 17.; + } + ActiveColors = 18; + + Chars.Resize(LastChar - FirstChar + 1); + for (int i = FirstChar; i <= LastChar; i++) + { + if (hexdata.glyphmap[i] > 0) + { + auto offset = hexdata.glyphmap[i]; + int size = hexdata.glyphdata[offset] / 16; + Chars[i - FirstChar].TranslatedPic = new FImageTexture(new FHexFontChar2(&hexdata.glyphdata[offset + 1], size, 2 + size * 8, 18)); + Chars[i - FirstChar].TranslatedPic->SetUseType(ETextureType::FontChar); + Chars[i - FirstChar].XMove = size * spacing; + TexMan.AddTexture(Chars[i - FirstChar].TranslatedPic); + } + else Chars[i - FirstChar].XMove = spacing; + + } + BuildTranslations(luminosity, nullptr, &TranslationParms[0][0], ActiveColors, nullptr); + } + +}; + + //========================================================================== // // @@ -234,5 +380,18 @@ public: FFont *CreateHexLumpFont (const char *fontname, int lump) { + if (hexdata.FirstChar == INT_MAX) hexdata.ParseDefinition(lump); return new FHexFont(fontname, lump); } + +//========================================================================== +// +// +// +//========================================================================== + +FFont *CreateHexLumpFont2(const char *fontname, int lump) +{ + if (hexdata.FirstChar == INT_MAX) hexdata.ParseDefinition(lump); + return new FHexFont2(fontname, lump); +} diff --git a/src/gamedata/fonts/v_font.cpp b/src/gamedata/fonts/v_font.cpp index 0ed18de51..d05dd93f6 100644 --- a/src/gamedata/fonts/v_font.cpp +++ b/src/gamedata/fonts/v_font.cpp @@ -1449,10 +1449,12 @@ void V_InitFonts() V_InitCustomFonts(); FFont *CreateHexLumpFont(const char *fontname, int lump); + FFont *CreateHexLumpFont2(const char *fontname, int lump); auto lump = Wads.CheckNumForFullName("newconsolefont.hex", 0); // This is always loaded from gzdoom.pk3 to prevent overriding it with incomplete replacements. if (lump == -1) I_FatalError("newconsolefont.hex not found"); // This font is needed - do not start up without it. NewConsoleFont = CreateHexLumpFont("NewConsoleFont", lump); + NewSmallFont = CreateHexLumpFont2("NewSmallFont", lump); CurrentConsoleFont = NewConsoleFont; // load the heads-up font @@ -1540,6 +1542,6 @@ void V_ClearFonts() delete FFont::FirstFont; } FFont::FirstFont = nullptr; - CurrentConsoleFont = NewConsoleFont = SmallFont = SmallFont2 = BigFont = ConFont = IntermissionFont = nullptr; + CurrentConsoleFont = NewSmallFont = NewConsoleFont = SmallFont = SmallFont2 = BigFont = ConFont = IntermissionFont = nullptr; } diff --git a/src/gamedata/fonts/v_font.h b/src/gamedata/fonts/v_font.h index 8ba1debc6..a26b72044 100644 --- a/src/gamedata/fonts/v_font.h +++ b/src/gamedata/fonts/v_font.h @@ -164,7 +164,7 @@ protected: }; -extern FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont, *NewConsoleFont, *CurrentConsoleFont; +extern FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont, *NewConsoleFont, *NewSmallFont, *CurrentConsoleFont; void V_InitFonts(); void V_ClearFonts(); diff --git a/src/v_video.cpp b/src/v_video.cpp index 536c08ed5..212ae1f0a 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -145,7 +145,7 @@ public: int DisplayWidth, DisplayHeight; -FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont, *NewConsoleFont, *CurrentConsoleFont; +FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont, *NewConsoleFont, *NewSmallFont, *CurrentConsoleFont; uint32_t Col2RGB8[65][256]; uint32_t *Col2RGB8_LessPrecision[65]; @@ -908,6 +908,7 @@ DEFINE_GLOBAL(SmallFont2) DEFINE_GLOBAL(BigFont) DEFINE_GLOBAL(ConFont) DEFINE_GLOBAL(NewConsoleFont) +DEFINE_GLOBAL(NewSmallFont) DEFINE_GLOBAL(IntermissionFont) DEFINE_GLOBAL(CleanXfac) DEFINE_GLOBAL(CleanYfac) diff --git a/wadsrc/static/zscript/base.zs b/wadsrc/static/zscript/base.zs index 6ff140ca7..ad01ca9a0 100644 --- a/wadsrc/static/zscript/base.zs +++ b/wadsrc/static/zscript/base.zs @@ -23,6 +23,7 @@ struct _ native // These are the global variables, the struct is only here to av native readonly Font bigfont; native readonly Font confont; native readonly Font NewConsoleFont; + native readonly Font NewSmallFont; native readonly Font intermissionfont; native readonly int CleanXFac; native readonly int CleanYFac; diff --git a/wadsrc/static/zscript/ui/menu/menu.zs b/wadsrc/static/zscript/ui/menu/menu.zs index 3b3a0f597..3c8211717 100644 --- a/wadsrc/static/zscript/ui/menu/menu.zs +++ b/wadsrc/static/zscript/ui/menu/menu.zs @@ -285,7 +285,7 @@ class Menu : Object native ui version("2.4") static void DrawConText (int color, int x, int y, String str) { - screen.DrawText (NewConsoleFont, color, x, y, str, DTA_CellX, 9 * CleanXfac_1/2, DTA_CellY, 8 * CleanYfac_1); + screen.DrawText (ConFont, color, x, y, str, DTA_CellX, 8 * CleanXfac, DTA_CellY, 8 * CleanYfac); } } diff --git a/wadsrc/static/zscript/ui/menu/optionmenu.zs b/wadsrc/static/zscript/ui/menu/optionmenu.zs index 9173e0cf9..0e6203f22 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenu.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenu.zs @@ -451,7 +451,7 @@ class OptionMenu : Menu } int ytop = y + mDesc.mScrollTop * 8 * CleanYfac_1; - int lastrow = screen.GetHeight() - NewConsoleFont.GetHeight() * CleanYfac_1; + int lastrow = screen.GetHeight() - NewSmallFont.GetHeight() * CleanYfac_1; int i; for (i = 0; i < mDesc.mItems.Size() && y <= lastrow; i++) @@ -519,8 +519,8 @@ class GameplayMenu : OptionMenu Super.Drawer(); String s = String.Format("dmflags = %d dmflags2 = %d", dmflags, dmflags2); - screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, - (screen.GetWidth() - NewConsoleFont.StringWidth (s) * CleanXfac_1) / 2, 0, s, + screen.DrawText (NewSmallFont, OptionMenuSettings.mFontColorValue, + (screen.GetWidth() - NewSmallFont.StringWidth (s) * CleanXfac_1) / 2, 0, s, DTA_CleanNoMove_1, true); } } @@ -532,8 +532,8 @@ class CompatibilityMenu : OptionMenu Super.Drawer(); String s = String.Format("compatflags = %d compatflags2 = %d", compatflags, compatflags2); - screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, - (screen.GetWidth() - NewConsoleFont.StringWidth (s) * CleanXfac_1) / 2, 0, s, + screen.DrawText (NewSmallFont, OptionMenuSettings.mFontColorValue, + (screen.GetWidth() - NewSmallFont.StringWidth (s) * CleanXfac_1) / 2, 0, s, DTA_CleanNoMove_1, true); } } diff --git a/wadsrc/static/zscript/ui/menu/optionmenuitems.zs b/wadsrc/static/zscript/ui/menu/optionmenuitems.zs index 8509aad1c..c0008fc3b 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenuitems.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenuitems.zs @@ -51,10 +51,10 @@ class OptionMenuItem : MenuItemBase int overlay = grayed? Color(96,48,0,0) : 0; int x; - int w = NewConsoleFont.StringWidth(label) * CleanXfac_1; + int w = NewSmallFont.StringWidth(label) * CleanXfac_1; if (!mCentered) x = indent - w; else x = (screen.GetWidth() - w) / 2; - screen.DrawText (NewConsoleFont, color, x, y, label, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); + screen.DrawText (NewSmallFont, color, x, y, label, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); return x; } @@ -71,7 +71,7 @@ class OptionMenuItem : MenuItemBase override int GetIndent() { if (mCentered) return 0; - return NewConsoleFont.StringWidth(Stringtable.Localize(mLabel)); + return NewSmallFont.StringWidth(Stringtable.Localize(mLabel)); } override bool MouseEvent(int type, int x, int y) @@ -140,7 +140,7 @@ class OptionMenuItemLabeledSubmenu : OptionMenuItemSubmenu String text = mLabelCVar.GetString(); if (text.Length() == 0) text = Stringtable.Localize("$notset"); - screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); + screen.DrawText (NewSmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); return indent; } @@ -298,7 +298,7 @@ class OptionMenuItemOptionBase : OptionMenuItem int Selection = GetSelection(); String text = StringTable.Localize(OptionValues.GetText(mValues, Selection)); if (text.Length() == 0) text = "Unknown"; - screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); + screen.DrawText (NewSmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); return indent; } @@ -502,11 +502,11 @@ class OptionMenuItemControlBase : OptionMenuItem description = KeyBindings.NameKeys (Key1, Key2); if (description.Length() > 0) { - Menu.DrawConText(Font.CR_WHITE, indent + CursorSpace(), y + (OptionMenuSettings.mLinespacing-8)*CleanYfac_1, description); + screen.DrawText(NewSmallFont, Font.CR_WHITE, indent + CursorSpace(), y, description, DTA_CleanNoMove_1, true); } else { - screen.DrawText(NewConsoleFont, Font.CR_BLACK, indent + CursorSpace(), y + (OptionMenuSettings.mLinespacing-8)*CleanYfac_1, "---", DTA_CleanNoMove_1, true); + screen.DrawText(NewSmallFont, Font.CR_BLACK, indent + CursorSpace(), y, "---", DTA_CleanNoMove_1, true); } return indent; } @@ -644,9 +644,9 @@ class OptionMenuItemStaticTextSwitchable : OptionMenuItem override int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected) { String txt = StringTable.Localize(mCurrent? mAltText : mLabel); - int w = NewConsoleFont.StringWidth(txt) * CleanXfac_1; + int w = NewSmallFont.StringWidth(txt) * CleanXfac_1; int x = (screen.GetWidth() - w) / 2; - screen.DrawText (NewConsoleFont, mColor, x, y, txt, DTA_CleanNoMove_1, true); + screen.DrawText (NewSmallFont, mColor, x, y, txt, DTA_CleanNoMove_1, true); return -1; } @@ -723,7 +723,7 @@ class OptionMenuSliderBase : OptionMenuItem double range; int maxlen = 0; int right = x + (12*8 + 4) * CleanXfac_1; - int cy = y + (OptionMenuSettings.mLinespacing-8)*CleanYfac_1; + int cy = y; range = max - min; double ccur = clamp(cur, min, max) - min; @@ -731,7 +731,7 @@ class OptionMenuSliderBase : OptionMenuItem if (fracdigits >= 0) { textbuf = String.format(formater, max); - maxlen = NewConsoleFont.StringWidth(textbuf) * CleanXfac_1; + maxlen = NewSmallFont.StringWidth(textbuf) * CleanXfac_1; } mSliderShort = right + maxlen > screen.GetWidth(); @@ -746,13 +746,13 @@ class OptionMenuSliderBase : OptionMenuItem // On 320x200 we need a shorter slider Menu.DrawConText(Font.CR_WHITE, x, cy, "\x10\x11\x11\x11\x11\x11\x12"); Menu.DrawConText(Font.FindFontColor(gameinfo.mSliderColor), x + int((5 + ((ccur * 38) / range)) * CleanXfac_1), cy, "\x13"); - right -= 5*8*CleanXfac_1; + right -= 5*8*CleanXfac; } if (fracdigits >= 0 && right + maxlen <= screen.GetWidth()) { textbuf = String.format(formater, cur); - screen.DrawText(NewConsoleFont, Font.CR_DARKGRAY, right, y, textbuf, DTA_CleanNoMove_1, true); + screen.DrawText(NewSmallFont, Font.CR_DARKGRAY, right, y, textbuf, DTA_CleanNoMove_1, true); } } @@ -973,7 +973,7 @@ class OptionMenuFieldBase : OptionMenuItem drawLabel(indent, y, selected ? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, grayed); int overlay = grayed? Color(96, 48, 0, 0) : 0; - screen.DrawText(NewConsoleFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, Represent(), DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); + screen.DrawText(NewSmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, Represent(), DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); return indent; } @@ -1022,7 +1022,7 @@ class OptionMenuItemTextField : OptionMenuFieldBase override String Represent() { - if (mEnter) return mEnter.GetText() .. NewConsoleFont.GetCursor(); + if (mEnter) return mEnter.GetText() .. NewSmallFont.GetCursor(); else return GetCVarString(); } @@ -1032,7 +1032,7 @@ class OptionMenuItemTextField : OptionMenuFieldBase { // reposition the text so that the cursor is visible when in entering mode. String text = Represent(); - int tlen = NewConsoleFont.StringWidth(text) * CleanXfac_1; + int tlen = NewSmallFont.StringWidth(text) * CleanXfac_1; int newindent = screen.GetWidth() - tlen - CursorSpace(); if (newindent < indent) indent = newindent; } @@ -1044,7 +1044,7 @@ class OptionMenuItemTextField : OptionMenuFieldBase if (mkey == Menu.MKEY_Enter) { Menu.MenuSound("menu/choose"); - mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), NewConsoleFont, GetCVarString(), -1, fromcontroller); + mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), NewSmallFont, GetCVarString(), -1, fromcontroller); mEnter.ActivateMenu(); return true; } @@ -1156,7 +1156,7 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider if ((Selection == 0 || Selection == -1) && mClickVal <= 0) { String text = Selection == 0? TextZero : Selection == -1? TextNegOne : ""; - screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); + screen.DrawText (NewSmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); } else { diff --git a/wadsrc/static/zscript/ui/menu/reverbedit.zs b/wadsrc/static/zscript/ui/menu/reverbedit.zs index 2b4b4572f..ca136cf9a 100644 --- a/wadsrc/static/zscript/ui/menu/reverbedit.zs +++ b/wadsrc/static/zscript/ui/menu/reverbedit.zs @@ -132,7 +132,7 @@ class OptionMenuItemReverbSelect : OptionMenuItemSubMenu int x = drawLabel(indent, y, selected? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor); String text = ReverbEdit.GetSelectedEnvironment(); - screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); + screen.DrawText (NewSmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); return indent; } @@ -210,7 +210,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase virtual String Represent() { - return mEnter.GetText() .. NewConsoleFont.GetCursor(); + return mEnter.GetText() .. NewSmallFont.GetCursor(); } //============================================================================= @@ -221,7 +221,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase mDrawX = indent + CursorSpace(); if (mEnter) { - screen.DrawText(NewConsoleFont, OptionMenuSettings.mFontColorValue, mDrawX, y, Represent(), DTA_CleanNoMove_1, true); + screen.DrawText(NewSmallFont, OptionMenuSettings.mFontColorValue, mDrawX, y, Represent(), DTA_CleanNoMove_1, true); } else { @@ -235,7 +235,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase if (mkey == Menu.MKEY_Enter) { Menu.MenuSound("menu/choose"); - mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), NewConsoleFont, String.Format("%.3f", GetSliderValue()), -1, fromcontroller); + mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), NewSmallFont, String.Format("%.3f", GetSliderValue()), -1, fromcontroller); mEnter.ActivateMenu(); return true; } diff --git a/wadsrc/static/zscript/ui/menu/textentermenu.zs b/wadsrc/static/zscript/ui/menu/textentermenu.zs index e39b40763..0fd1a4b26 100644 --- a/wadsrc/static/zscript/ui/menu/textentermenu.zs +++ b/wadsrc/static/zscript/ui/menu/textentermenu.zs @@ -84,7 +84,7 @@ class TextEnterMenu : Menu deprecated("3.8") static TextEnterMenu Open(Menu parent, String textbuffer, int maxlen, int sizemode, bool showgrid = false, bool allowcolors = false) { let me = new("TextEnterMenu"); - me.Init(parent, NewConsoleFont, textbuffer, maxlen*8, showgrid, allowcolors); + me.Init(parent, NewSmallFont, textbuffer, maxlen*8, showgrid, allowcolors); return me; } From 59f0a377d4f201929c4d55015e1eaf20384f460d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 16:58:10 +0100 Subject: [PATCH 22/34] - consolidate the dependencies on the font in the option menu. --- wadsrc/static/zscript/ui/menu/menu.zs | 22 +++++++ wadsrc/static/zscript/ui/menu/optionmenu.zs | 10 ++-- .../static/zscript/ui/menu/optionmenuitems.zs | 59 +++++++++++-------- wadsrc/static/zscript/ui/menu/reverbedit.zs | 9 ++- .../static/zscript/ui/menu/textentermenu.zs | 2 +- 5 files changed, 65 insertions(+), 37 deletions(-) diff --git a/wadsrc/static/zscript/ui/menu/menu.zs b/wadsrc/static/zscript/ui/menu/menu.zs index 3c8211717..447b052dc 100644 --- a/wadsrc/static/zscript/ui/menu/menu.zs +++ b/wadsrc/static/zscript/ui/menu/menu.zs @@ -287,6 +287,28 @@ class Menu : Object native ui version("2.4") { screen.DrawText (ConFont, color, x, y, str, DTA_CellX, 8 * CleanXfac, DTA_CellY, 8 * CleanYfac); } + + static int OptionColor(int color) + { + if (color != Font.CR_UNTRANSLATED) return color; + // This needs fixing for mods with custom fonts. + return gameinfo.gametype == GAME_Doom ? Font.CR_RED : gameinfo.gametype == GAME_Chex ? Font.CR_GREEN : gameinfo.gametype == GAME_Strife ? Font.CR_GOLD : Font.CR_GRAY; + } + + static Font OptionFont() + { + return NewSmallFont; + } + + static int OptionHeight() + { + return OptionFont().GetHeight(); + } + + static int OptionWidth(String s) + { + return OptionFont().StringWidth(s); + } } diff --git a/wadsrc/static/zscript/ui/menu/optionmenu.zs b/wadsrc/static/zscript/ui/menu/optionmenu.zs index 0e6203f22..e86303562 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenu.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenu.zs @@ -451,7 +451,7 @@ class OptionMenu : Menu } int ytop = y + mDesc.mScrollTop * 8 * CleanYfac_1; - int lastrow = screen.GetHeight() - NewSmallFont.GetHeight() * CleanYfac_1; + int lastrow = screen.GetHeight() - OptionHeight() * CleanYfac_1; int i; for (i = 0; i < mDesc.mItems.Size() && y <= lastrow; i++) @@ -519,8 +519,8 @@ class GameplayMenu : OptionMenu Super.Drawer(); String s = String.Format("dmflags = %d dmflags2 = %d", dmflags, dmflags2); - screen.DrawText (NewSmallFont, OptionMenuSettings.mFontColorValue, - (screen.GetWidth() - NewSmallFont.StringWidth (s) * CleanXfac_1) / 2, 0, s, + screen.DrawText (OptionFont(), OptionMenuSettings.mFontColorValue, + (screen.GetWidth() - OptionWidth (s) * CleanXfac_1) / 2, 0, s, DTA_CleanNoMove_1, true); } } @@ -532,8 +532,8 @@ class CompatibilityMenu : OptionMenu Super.Drawer(); String s = String.Format("compatflags = %d compatflags2 = %d", compatflags, compatflags2); - screen.DrawText (NewSmallFont, OptionMenuSettings.mFontColorValue, - (screen.GetWidth() - NewSmallFont.StringWidth (s) * CleanXfac_1) / 2, 0, s, + screen.DrawText (OptionFont(), OptionMenuSettings.mFontColorValue, + (screen.GetWidth() - OptionWidth (s) * CleanXfac_1) / 2, 0, s, DTA_CleanNoMove_1, true); } } diff --git a/wadsrc/static/zscript/ui/menu/optionmenuitems.zs b/wadsrc/static/zscript/ui/menu/optionmenuitems.zs index c0008fc3b..53051ca9a 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenuitems.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenuitems.zs @@ -44,19 +44,32 @@ class OptionMenuItem : MenuItemBase mCentered = center; } - protected int drawLabel(int indent, int y, int color, bool grayed = false) + protected void drawText(int x, int y, int color, String text, bool grayed = false) { String label = Stringtable.Localize(mLabel); int overlay = grayed? Color(96,48,0,0) : 0; - + + screen.DrawText (Menu.OptionFont(), Menu.OptionColor(color), x, y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); + } + + protected int drawLabel(int indent, int y, int color, bool grayed = false) + { + String label = Stringtable.Localize(mLabel); + int x; - int w = NewSmallFont.StringWidth(label) * CleanXfac_1; + int w = Menu.OptionWidth(label) * CleanXfac_1; if (!mCentered) x = indent - w; else x = (screen.GetWidth() - w) / 2; - screen.DrawText (NewSmallFont, color, x, y, label, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); + DrawText(x, y, color, label, grayed); return x; } + + protected void drawValue(int indent, int y, int color, String text, bool grayed = false) + { + DrawText(indent + CursorSpace(), y, color, text, grayed); + } + int CursorSpace() { @@ -71,11 +84,11 @@ class OptionMenuItem : MenuItemBase override int GetIndent() { if (mCentered) return 0; - return NewSmallFont.StringWidth(Stringtable.Localize(mLabel)); + return Menu.OptionWidth(Stringtable.Localize(mLabel)); } override bool MouseEvent(int type, int x, int y) - { +{ if (Selectable() && type == Menu.MOUSE_Release) { return Menu.GetCurrentMenu().MenuEvent(Menu.MKEY_Enter, true); @@ -140,8 +153,7 @@ class OptionMenuItemLabeledSubmenu : OptionMenuItemSubmenu String text = mLabelCVar.GetString(); if (text.Length() == 0) text = Stringtable.Localize("$notset"); - screen.DrawText (NewSmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); - + drawValue(indent, y, OptionMenuSettings.mFontColorValue, text); return indent; } } @@ -286,19 +298,16 @@ class OptionMenuItemOptionBase : OptionMenuItem //============================================================================= override int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected) { - bool grayed = isGrayed(); - if (mCenter) { indent = (screen.GetWidth() / 2); } - drawLabel(indent, y, selected? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, grayed); + drawLabel(indent, y, selected? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, isGrayed()); - int overlay = grayed? Color(96,48,0,0) : 0; int Selection = GetSelection(); String text = StringTable.Localize(OptionValues.GetText(mValues, Selection)); if (text.Length() == 0) text = "Unknown"; - screen.DrawText (NewSmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); + drawValue(indent, y, OptionMenuSettings.mFontColorValue, text, isGrayed()); return indent; } @@ -502,11 +511,11 @@ class OptionMenuItemControlBase : OptionMenuItem description = KeyBindings.NameKeys (Key1, Key2); if (description.Length() > 0) { - screen.DrawText(NewSmallFont, Font.CR_WHITE, indent + CursorSpace(), y, description, DTA_CleanNoMove_1, true); + drawValue(indent, y, Font.CR_WHITE, description); } else { - screen.DrawText(NewSmallFont, Font.CR_BLACK, indent + CursorSpace(), y, "---", DTA_CleanNoMove_1, true); + drawValue(indent, y, Font.CR_BLACK, "---"); } return indent; } @@ -644,9 +653,9 @@ class OptionMenuItemStaticTextSwitchable : OptionMenuItem override int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected) { String txt = StringTable.Localize(mCurrent? mAltText : mLabel); - int w = NewSmallFont.StringWidth(txt) * CleanXfac_1; + int w = Menu.OptionWidth(txt) * CleanXfac_1; int x = (screen.GetWidth() - w) / 2; - screen.DrawText (NewSmallFont, mColor, x, y, txt, DTA_CleanNoMove_1, true); + drawText(x, y, mColor, txt); return -1; } @@ -731,7 +740,7 @@ class OptionMenuSliderBase : OptionMenuItem if (fracdigits >= 0) { textbuf = String.format(formater, max); - maxlen = NewSmallFont.StringWidth(textbuf) * CleanXfac_1; + maxlen = Menu.OptionWidth(textbuf) * CleanXfac_1; } mSliderShort = right + maxlen > screen.GetWidth(); @@ -752,7 +761,7 @@ class OptionMenuSliderBase : OptionMenuItem if (fracdigits >= 0 && right + maxlen <= screen.GetWidth()) { textbuf = String.format(formater, cur); - screen.DrawText(NewSmallFont, Font.CR_DARKGRAY, right, y, textbuf, DTA_CleanNoMove_1, true); + drawText(right, y, Font.CR_DARKGRAY, textbuf); } } @@ -971,9 +980,7 @@ class OptionMenuFieldBase : OptionMenuItem { bool grayed = mGrayCheck != null && !mGrayCheck.GetInt(); drawLabel(indent, y, selected ? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, grayed); - int overlay = grayed? Color(96, 48, 0, 0) : 0; - - screen.DrawText(NewSmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, Represent(), DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); + drawValue(indent, y, OptionMenuSettings.mFontColorValue, Represent(), grayed); return indent; } @@ -1022,7 +1029,7 @@ class OptionMenuItemTextField : OptionMenuFieldBase override String Represent() { - if (mEnter) return mEnter.GetText() .. NewSmallFont.GetCursor(); + if (mEnter) return mEnter.GetText() .. Menu.OptionFont().GetCursor(); else return GetCVarString(); } @@ -1032,7 +1039,7 @@ class OptionMenuItemTextField : OptionMenuFieldBase { // reposition the text so that the cursor is visible when in entering mode. String text = Represent(); - int tlen = NewSmallFont.StringWidth(text) * CleanXfac_1; + int tlen = Menu.OptionWidth(text) * CleanXfac_1; int newindent = screen.GetWidth() - tlen - CursorSpace(); if (newindent < indent) indent = newindent; } @@ -1044,7 +1051,7 @@ class OptionMenuItemTextField : OptionMenuFieldBase if (mkey == Menu.MKEY_Enter) { Menu.MenuSound("menu/choose"); - mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), NewSmallFont, GetCVarString(), -1, fromcontroller); + mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), Menu.OptionFont(), GetCVarString(), -1, fromcontroller); mEnter.ActivateMenu(); return true; } @@ -1156,7 +1163,7 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider if ((Selection == 0 || Selection == -1) && mClickVal <= 0) { String text = Selection == 0? TextZero : Selection == -1? TextNegOne : ""; - screen.DrawText (NewSmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); + drawValue(indent, y, OptionMenuSettings.mFontColorValue, text); } else { diff --git a/wadsrc/static/zscript/ui/menu/reverbedit.zs b/wadsrc/static/zscript/ui/menu/reverbedit.zs index ca136cf9a..65fa5158e 100644 --- a/wadsrc/static/zscript/ui/menu/reverbedit.zs +++ b/wadsrc/static/zscript/ui/menu/reverbedit.zs @@ -132,8 +132,7 @@ class OptionMenuItemReverbSelect : OptionMenuItemSubMenu int x = drawLabel(indent, y, selected? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor); String text = ReverbEdit.GetSelectedEnvironment(); - screen.DrawText (NewSmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); - + drawValue(indent, y, OptionMenuSettings.mFontColorValue, text); return indent; } } @@ -210,7 +209,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase virtual String Represent() { - return mEnter.GetText() .. NewSmallFont.GetCursor(); + return mEnter.GetText() .. Menu.OptionFont().GetCursor(); } //============================================================================= @@ -221,7 +220,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase mDrawX = indent + CursorSpace(); if (mEnter) { - screen.DrawText(NewSmallFont, OptionMenuSettings.mFontColorValue, mDrawX, y, Represent(), DTA_CleanNoMove_1, true); + drawText(mDrawX, y, OptionMenuSettings.mFontColorValue, Represent()); } else { @@ -235,7 +234,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase if (mkey == Menu.MKEY_Enter) { Menu.MenuSound("menu/choose"); - mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), NewSmallFont, String.Format("%.3f", GetSliderValue()), -1, fromcontroller); + mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), Menu.OptionFont(), String.Format("%.3f", GetSliderValue()), -1, fromcontroller); mEnter.ActivateMenu(); return true; } diff --git a/wadsrc/static/zscript/ui/menu/textentermenu.zs b/wadsrc/static/zscript/ui/menu/textentermenu.zs index 0fd1a4b26..f910eb8f4 100644 --- a/wadsrc/static/zscript/ui/menu/textentermenu.zs +++ b/wadsrc/static/zscript/ui/menu/textentermenu.zs @@ -84,7 +84,7 @@ class TextEnterMenu : Menu deprecated("3.8") static TextEnterMenu Open(Menu parent, String textbuffer, int maxlen, int sizemode, bool showgrid = false, bool allowcolors = false) { let me = new("TextEnterMenu"); - me.Init(parent, NewSmallFont, textbuffer, maxlen*8, showgrid, allowcolors); + me.Init(parent, Menu.OptionFont(), textbuffer, maxlen*8, showgrid, allowcolors); return me; } From a6051c8231b039f7452153eb0d89caad31ed33b4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 17:08:44 +0100 Subject: [PATCH 23/34] - moved the flag display in the gameplay and compatibility menus down below the headline. --- wadsrc/static/menudef.txt | 10 ++++++++++ wadsrc/static/zscript/ui/menu/optionmenu.zs | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 8cf3d0ea2..cfed6b614 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1491,6 +1491,7 @@ OptionValue JumpCrouchFreeLook OptionMenu GameplayOptions protected { + Position -35 Title "$GMPLYMNU_TITLE" //Indent 222 Submenu "$GMPLYMNU_DEATHMATCH", "DeathmatchOptions" @@ -1533,6 +1534,7 @@ OptionMenu GameplayOptions protected OptionMenu DeathmatchOptions protected { + Position -35 Title "$GMPLYMNU_DEATHMATCH" Option "$GMPLYMNU_WEAPONSSTAY", "sv_weaponstay", "YesNo" @@ -1553,6 +1555,7 @@ OptionMenu DeathmatchOptions protected OptionMenu CoopOptions protected { + Position -35 Title "$GMPLYMNU_COOPERATIVE" Option "$GMPLYMNU_MULTIPLAYERWEAPONS", "sv_noweaponspawn", "NoYes" @@ -1587,6 +1590,7 @@ OptionValue CompatModes OptionMenu "CompatibilityOptions" protected { + Position -35 Title "$CMPTMNU_TITLE" Option "$CMPTMNU_MODE", "compatmode", "CompatModes", "", 1 StaticText " " @@ -1601,6 +1605,7 @@ OptionMenu "CompatibilityOptions" protected OptionMenu "CompatActorMenu" protected { + Position -35 Title "$CMPTMNU_ACTORBEHAVIOR" Option "$CMPTMNU_CORPSEGIBS", "compat_CORPSEGIBS", "YesNo" Option "$CMPTMNU_NOBLOCKFRIENDS", "compat_NOBLOCKFRIENDS", "YesNo" @@ -1616,6 +1621,7 @@ OptionMenu "CompatActorMenu" protected OptionMenu "CompatDehackedMenu" protected { + Position -35 Title "$CMPTMNU_DEHACKEDBEHAVIOR" Option "$CMPTMNU_DEHHEALTH", "compat_DEHHEALTH", "YesNo" Option "$CMPTMNU_MUSHROOM", "compat_MUSHROOM", "YesNo" @@ -1624,6 +1630,7 @@ OptionMenu "CompatDehackedMenu" protected OptionMenu "CompatMapMenu" protected { + Position -35 Title "$CMPTMNU_MAPACTIONBEHAVIOR" Option "$CMPTMNU_USEBLOCKING", "compat_USEBLOCKING", "YesNo" Option "$CMPTMNU_ANYBOSSDEATH", "compat_ANYBOSSDEATH", "YesNo" @@ -1642,6 +1649,7 @@ OptionMenu "CompatMapMenu" protected OptionMenu "CompatPhysicsMenu" protected { + Position -35 Title "$CMPTMNU_PHYSICSBEHAVIOR" Option "$CMPTMNU_NOPASSOVER", "compat_nopassover", "YesNo" Option "$CMPTMNU_BOOMSCROLL", "compat_BOOMSCROLL", "YesNo" @@ -1657,6 +1665,7 @@ OptionMenu "CompatPhysicsMenu" protected OptionMenu "CompatRenderMenu" protected { + Position -35 Title "$CMPTMNU_RENDERINGBEHAVIOR" Option "$CMPTMNU_POLYOBJ", "compat_POLYOBJ", "YesNo" Option "$CMPTMNU_MASKEDMIDTEX", "compat_MASKEDMIDTEX", "YesNo" @@ -1666,6 +1675,7 @@ OptionMenu "CompatRenderMenu" protected OptionMenu "CompatSoundMenu" protected { + Position -35 Title "$CMPTMNU_SOUNDBEHAVIOR" Option "$CMPTMNU_SOUNDSLOTS", "compat_soundslots", "YesNo" Option "$CMPTMNU_SILENTPICKUP", "compat_SILENTPICKUP", "YesNo" diff --git a/wadsrc/static/zscript/ui/menu/optionmenu.zs b/wadsrc/static/zscript/ui/menu/optionmenu.zs index e86303562..dc389ac95 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenu.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenu.zs @@ -520,7 +520,7 @@ class GameplayMenu : OptionMenu String s = String.Format("dmflags = %d dmflags2 = %d", dmflags, dmflags2); screen.DrawText (OptionFont(), OptionMenuSettings.mFontColorValue, - (screen.GetWidth() - OptionWidth (s) * CleanXfac_1) / 2, 0, s, + (screen.GetWidth() - OptionWidth (s) * CleanXfac_1) / 2, 35 * CleanXfac_1, s, DTA_CleanNoMove_1, true); } } @@ -533,7 +533,7 @@ class CompatibilityMenu : OptionMenu String s = String.Format("compatflags = %d compatflags2 = %d", compatflags, compatflags2); screen.DrawText (OptionFont(), OptionMenuSettings.mFontColorValue, - (screen.GetWidth() - OptionWidth (s) * CleanXfac_1) / 2, 0, s, + (screen.GetWidth() - OptionWidth (s) * CleanXfac_1) / 2, 35 * CleanXfac_1, s, DTA_CleanNoMove_1, true); } } From 81801ccac08dd157a0081aabca4891c1efba0e9f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 17:13:30 +0100 Subject: [PATCH 24/34] - use NewSmallFont instead of NewConsoleFont for on-screen messages if enabled. --- src/c_console.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/c_console.cpp b/src/c_console.cpp index 77afd6a29..1786e94c5 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -784,7 +784,7 @@ void FNotifyBuffer::AddString(int printlevel, FString source) width = DisplayWidth / active_con_scaletext(con_consolefont); - FFont *font = *con_consolefont ? NewConsoleFont : SmallFont; + FFont *font = *con_consolefont ? NewSmallFont : SmallFont; if (AddType == APPENDLINE && Text.Size() > 0 && Text[Text.Size() - 1].PrintLevel == printlevel) { @@ -1067,7 +1067,7 @@ void FNotifyBuffer::Draw() line = Top; canskip = true; - FFont *font = *con_consolefont ? NewConsoleFont : SmallFont; + FFont *font = *con_consolefont ? NewSmallFont : SmallFont; lineadv = font->GetHeight (); for (unsigned i = 0; i < Text.Size(); ++ i) @@ -1760,7 +1760,7 @@ void C_MidPrint (FFont *font, const char *msg, bool bold) if (font == nullptr) { altscale = con_midconsolefont; - font = altscale ? NewConsoleFont : SmallFont; + font = altscale ? NewSmallFont : SmallFont; if (altscale && color == CR_UNTRANSLATED) color = C_GetDefaultFontColor(); } From 1beaa8da589905814fd9709b6d0724113eaa9687 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 17:49:19 +0100 Subject: [PATCH 25/34] - deleted obsolete and broken font characters. --- .../filter/game-doom/graphics/stcfn191.png | Bin 1151 -> 0 bytes .../filter/game-doom/graphics/stcfn193.png | Bin 1174 -> 0 bytes .../filter/game-doom/graphics/stcfn196.png | Bin 1150 -> 0 bytes .../filter/game-doom/graphics/stcfn197.png | Bin 1153 -> 0 bytes .../filter/game-doom/graphics/stcfn201.png | Bin 1172 -> 0 bytes .../filter/game-doom/graphics/stcfn205.png | Bin 1166 -> 0 bytes .../filter/game-doom/graphics/stcfn209.png | Bin 1161 -> 0 bytes .../filter/game-doom/graphics/stcfn211.png | Bin 1176 -> 0 bytes .../filter/game-doom/graphics/stcfn214.png | Bin 1154 -> 0 bytes .../filter/game-doom/graphics/stcfn218.png | Bin 1174 -> 0 bytes .../filter/game-doom/graphics/stcfn220.png | Bin 1147 -> 0 bytes .../filter/game-doom/graphics/stcfn223.png | Bin 1147 -> 0 bytes .../filter/game-raven/graphics/fonta164.png | Bin 1154 -> 0 bytes .../filter/game-raven/graphics/fonta165.png | Bin 1164 -> 0 bytes .../filter/game-raven/graphics/fonta182.png | Bin 1152 -> 0 bytes .../filter/game-raven/graphics/fonta188.png | Bin 1153 -> 0 bytes .../filter/game-raven/graphics/fonta191.png | Bin 1159 -> 0 bytes .../filter/game-raven/graphics/fonta60.png | Bin 892 -> 0 bytes .../filter/game-raven/graphics/fonta61.png | Bin 892 -> 0 bytes .../filter/game-raven/graphics/fonta62.png | Bin 869 -> 0 bytes .../filter/game-raven/graphics/fonta63.png | Bin 892 -> 0 bytes 21 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 wadsrc/static/filter/game-doom/graphics/stcfn191.png delete mode 100644 wadsrc/static/filter/game-doom/graphics/stcfn193.png delete mode 100644 wadsrc/static/filter/game-doom/graphics/stcfn196.png delete mode 100644 wadsrc/static/filter/game-doom/graphics/stcfn197.png delete mode 100644 wadsrc/static/filter/game-doom/graphics/stcfn201.png delete mode 100644 wadsrc/static/filter/game-doom/graphics/stcfn205.png delete mode 100644 wadsrc/static/filter/game-doom/graphics/stcfn209.png delete mode 100644 wadsrc/static/filter/game-doom/graphics/stcfn211.png delete mode 100644 wadsrc/static/filter/game-doom/graphics/stcfn214.png delete mode 100644 wadsrc/static/filter/game-doom/graphics/stcfn218.png delete mode 100644 wadsrc/static/filter/game-doom/graphics/stcfn220.png delete mode 100644 wadsrc/static/filter/game-doom/graphics/stcfn223.png delete mode 100644 wadsrc/static/filter/game-raven/graphics/fonta164.png delete mode 100644 wadsrc/static/filter/game-raven/graphics/fonta165.png delete mode 100644 wadsrc/static/filter/game-raven/graphics/fonta182.png delete mode 100644 wadsrc/static/filter/game-raven/graphics/fonta188.png delete mode 100644 wadsrc/static/filter/game-raven/graphics/fonta191.png delete mode 100644 wadsrc/static/filter/game-raven/graphics/fonta60.png delete mode 100644 wadsrc/static/filter/game-raven/graphics/fonta61.png delete mode 100644 wadsrc/static/filter/game-raven/graphics/fonta62.png delete mode 100644 wadsrc/static/filter/game-raven/graphics/fonta63.png diff --git a/wadsrc/static/filter/game-doom/graphics/stcfn191.png b/wadsrc/static/filter/game-doom/graphics/stcfn191.png deleted file mode 100644 index c8e4dfd4a2ed1b5076f31b1cfe53404f79f4a0a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1151 zcmd^7F{|5F6h1G3%6aNTgP=;QK?DsRG^n6Kg9@V23(Bj?Q-}hhsGtWLJgA_83K}%1 zM1u(~Xz*ZK6*PFzV5kcsc<`VhPz{Ef;=utA9#Zh&!9xmJT2Ajve?~9&+{-Z= zeJ`F|n-}MwoCCnc)#J;jmRbb6dj4n?sa4tHs~iQ`omc0tg3-qLj&+n$?d zt?N@wD-~rT%Y`J3L@^hHjOP=Mi&-{gm;p`u6y;HrLs2$>319%=agT2{xa)AU#C3yR zjctj`F*fbkCN+r?thG|g-_tLwU|s>x(B9*;+(QJ&{n zmL*9NMNt@rK@fPJ=en+K+oow6hM{Sis;aUq_xpWO6cdc1(_pao{k7}0wlg=aN;k%; zp37=1$${8+c){Q}g<(aS=BTzV7S(V*$?77hhEbV?<1`q>ULLw>U?;v6xyHcJeM@x> z#nI&|4~oReLo4z1fune)WNV_K@M#uAu{#KDFEAZfGi^mTB~|Yu#>btzT^g@Sd7cWT z#|{lDmVjuDyB#i^#$$LKhys>DSEhHL^uFbDwY&H+LI=a%=l!|f8g5}OpK9u^vA{M(p2M$CS| zY<+s=Qm<@Sm@qfq&xu>a2C+a45luu95o#SO6~;0QMPkmrA@i!p$~;Xd-djlnkO4#h z4uB*9D+3P}rlb|uu&$ttAgsgi_dhSb062s1o?biuk=;)C|6J#jzdj>hb?@89UlEmQ z_BPJor=RbWp%idUSpH J%fp-J{{pR@VXpuH diff --git a/wadsrc/static/filter/game-doom/graphics/stcfn193.png b/wadsrc/static/filter/game-doom/graphics/stcfn193.png deleted file mode 100644 index 7371f34660df6feb5bc999f347b884b71455fc29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1174 zcmd^8v8&r=5Wn!CdVRvUMT0_B(4fJCpb7}0K?Nn%3(Bj)Q-}hhh@enGJ!nv=3W917 zM1v_VXz*ZK6*PFzAgCcKnBu{d3?2+M#e)Y89#SyHgA1=E)kep{} zwo93&iHID>F$_b~G(}O8!V6-T<*6X9$NN0r4F+wJY@%ot z1WVsvxbEC>8q1m*Mx|*JRV`$BEJ?X24h13O`IO^gmW>!D=yv-w?NO9VQ8qkKmZoVO$6*)-LE!to>$;BPSe9iNhOXiNm8%Z69gf~Fg*7A zJI`A??!vOChFNO*NYOG$iA2d4dN#-FEGu^zfu>n%QRTC8Fde5=9+!i#NP|)04N2bSv_wxb%BtQn%B z^$?>&>ul%xt3sM4eBm+!or**tT4USde2ztdNrIk-nua`&07rn=09$|+zyhEFr~nFp zAwUWc0rUY}03sRDYrn_k66+fC9HR(r8x@6Y5uqW6&=3wnK+qXL0AQc`9$MVaaamxK z;KapT#gw~=*hARe^}Ab-UOCh&3uXpP^|y247O_Fh5d%a6Q9y)BgHnN!1OtIAXHS~-8=XG?A-b0?7Mef-hJ;2 Y0Pbhu{b#>^bOOWGgX_zmK6(D)U$shQ`2YX_ diff --git a/wadsrc/static/filter/game-doom/graphics/stcfn196.png b/wadsrc/static/filter/game-doom/graphics/stcfn196.png deleted file mode 100644 index 00a24710fcbf715ce8acec34eb612ec1edebe06a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmd^7F{`9j6h1Gn@a4G=3n4DCFvMaC3kwSi17_n}+!w=hSr;T&xWQry7YrD%un;0- z5~i@2z$7tXU;-9Grm&b|3X3f)X2}#&Okj#BHZYJWrr5wXfs^|-KO>iW?&TiN`M$&b zzV9C2npcH?eGqh>w{+dsw&$i< z>-tR7N=2E3Umdwh=E#XHh33FFL`N4a zmDgoXkyuG&PN&o1aMRb^Qo3+XKq@RZcJ1? zm(^I3199N+g28bL!-_P`QC(dus?mI!)kRW`qB097X)unxJap5*PJAnJjiICamg*Xc zqsvtu6p53ER^sbJNAXO_)d_fgkT5D?%5@CslHumb1+T7Vj$1Q-Kk05QN2zylzX5xouv z?0ak)EDDTcbR1Mw;vxb=Hi01+1b}qs03m>L$9vr2c8Pt7ZHhAw3k@^=b<7X~B#4TcrSRjUoCZdQ4wGNdE6B$M#G3UULc~xX(o+cD;t)v0S03rYf zK$3u!fd>my(u!+XS5QU})?xVjpI4s(oWWO5Zk_+g?k4w*LeU$B_M1p@{wEQA;s z!UQY^G9(5prm!$%0v1zDVX+X4flM*Q1T3c5z!XzVv4JhJaB|<~XXJ9vz1+h&-*>p* z_ub=LUi_?65%=5!!(kIC-iZ(&e`F`uVYsYCUYiSsj zrY%&pkmb1~<)SzhgpB7?j*D3~Vwhk!9MiN%Q7%Q<6lDPz06GAk4)|h+eTTa>ZX4_> zYzth^u*qK4$$1eSi{LQx_fvP9*_+gA6SIkoI@A||R`_b}DHBIdZ7H_Iz!-VDU~9ao zaGJ!*A|ndJ^Z9%{9uJ2@-}k%SZnN2RUDvklYPD*brmpL%s>-sQ&*!t*Y&xB0S(c`0 z9LHf820`HazU#V<<5-qu7>2Ivs;VlAB1zI{G!g_M#xOjO#|O{bI&N#(OT#QReWqxc zq(q|R3nQE3b(WQfj6l;Y)mHhcoGj;QmB-~IEYe_>_|wSE0w?jU*fT>%AKRK|DvmDO znp9?f9@|-9#-28|W!DfbRnTQFN&PT##)0MfhV7_^C2NMLXd}ev)I0mN{=ATu317I( zM5iJVh}PKmxL#vXV3MHcp{60vBfuHp1;8F)1JD9A02M$1Fa<~fB7iY~3qT|zdL570 zby(M!=NLt3+o&kSMFfUy0z)te0O`&E0s#A-_tfKlja`9Ff(sXO6;tkI#Gb<8VLaS> z^v0o{Td*=shyo&18k7pmB$x=qoFiT06oHXAnozv4k_sRJ2mmYq zNdlHS9!*S0D{f(1LJ>kx1;HPGU407h0KR^5YyU@fKjHs#UC#ghkbKoUUp@MQs7y2W z@c@4M`CXFaZmvImdhw%wcX#*aZ(j}ugKyt%KKKZ}|Gfiv_WJ$L_rLt}11W=>hqu?i IescHCzoPJDm;e9( diff --git a/wadsrc/static/filter/game-doom/graphics/stcfn201.png b/wadsrc/static/filter/game-doom/graphics/stcfn201.png deleted file mode 100644 index b3704e56c20069d780151c29585c2a3c3cf2f0b0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1172 zcmd^8v8&r=5WnySy*^=FDyTv z?NX*`A|l6e48zbgO;MDj@PgQ7d8*5TrHY0uXd;KR*_+Aac04|eM*E`J_4{p_ZsK?q zhD+aHxbEC>8q1m*My+XMRV`(CBuRxR4g?|R`HbTdmW>%E>~;g1_9)7wD4U`z00Te= zz{3t-Z?IkBW{&Fymo+X*oDZ?d-%QfuINq1xZs>0Z?mD+unYBpGCN?IKJ`T0gR|`++ zJ91`Ai6w?c&(j54<4uLrBvuv~QRp6z$Nhf4+wI!6-E20i)oQt1E*6W~Y}Pc*WHPDi zx~i(tXfzxS2ZKSL=UJ8|NfJd-7>2&@yRPdvj%8VfVd%Q9s;Z(Wk|gzdJwXr>jG|)@ z>^yJnxC_gk8fK;GLq*FaB^D)L=-C{vv#i`@1e#{4MP1CQ{&bYpMN;*nG7E>PKZxBt zbW-0+JTr3iz}7rdadg?%q$>A|#Lh!A@wC8}T|=}~L6^BS^P|`aLd*3H+ffZm)(lb6 zdWi9%b+&W;RVhtVzI2(sPQ@Y+uCZ-#KF6}eG)2!tO+%hXfFr#K{DU0^=BM8x@6Y5rH9xzz_@qK&o?q5Wqh5J+!!;`t70}>8gP{&+@ZiCeP&^pw!Gi-DJfz^kg9B-s@%lOaGkSdY9d~fQJHFrV z`|$Q_}zL{x>9^?9SiwuU-S3!Q;=LJ|MZk z(HuirmW7Bs&$BE`(=)Ktu^SA!G~LAU zDh!uFu<*RO>$bK%HO)rX$C_3t%1D+ANg9e`E(jUVCma{EY{)Qun)WHmqbP@>YycC$ z0KmfzUv02k;%1KP7MBe!Dx8BuNxSVHgHM;CY_wy0&ebrfC?4rfI6G%Cg++^+ZujFp7@- z{?7N;uD7tAscF@^QL1__tFa^pV$b0PgX0v26=|BI7ELj$2h&m36iGdZsw^ziU>JLO z=%#_4_*Uc^eMk2#)io4Hm+L$z5+@I>#Mk?d;+c}IiH5?bSrEl;KeWBTbX?7}72T9n zy@wbdI(IuaUR3fl6)KM%7*s3);TpRR=X0zoOjGoI)O8dD1ULe`0@wnq02Tl(Km$+# z3;{BL7@!Z}0T9XvU;8~SmpGYVQD7XS0Hiwy2mzea+(U=kIW8+~ zQyhC(XqfSDV(t(zyFRn^>6J^puwiDx)OfciZV_9=0x?815k*93bf{G*Wf+J=oIOM4 zRgsl>nv8fSB@I9Z5CJ# z&u-1D%MULB;Oged^>gAc&U$g5*t_3ue>n%kZy$X{{8{e(v;5*ufcx<5(-)6PEO0c( zP?lvOBG2^YBZl_b&*t~sLaAi8jNEv58X7d z6W@wlW9aCpM_>pB0U*^mKnUQR`yPATEpb(1o8rvF zLc@%|i@9UO?1#+Gr`Im^+J=P*bK~8dxI=6a3&ar7L=+LB)}c~iBEv`|$2l-$UKLrH zr%8)myQi>bcR8U3`)?xVTA6HMwmw@k{-#Y&_J5Tukl*{Sg zACpx*_~yyygk_pN>pgh&(?gPEZmu7_xcD*n9o~EYgO479{Fn6E*AIRmI|jIUe0%-# ICttq&7n1p6Gynhq diff --git a/wadsrc/static/filter/game-doom/graphics/stcfn211.png b/wadsrc/static/filter/game-doom/graphics/stcfn211.png deleted file mode 100644 index 5330d959cff9d84730a71e1d0d46093943bcdfe7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1176 zcmd^8v8&`{5TC~tdA_);5FujF6e+ey5hY@Z2=UB2a?czu$K@bMkQ}B+ks^l?Qlto6 zidD7 z?NX*`A|l6e48zbgO;MDj@PgQ7d8*5TrHY0uXd;Kx>5Hbh8IKR6(Y`2l{r)yh*KxcI z!-en9U3ca*ss+O`mlB7Zu2ZE6Ee8zDJ%f<{7cDn&hdlcnTluc09lRzrfKTB zuBvJ@8V!fT!C;W*d6s2Kl0;DyhN18KuIoCEV_BAA7`m>js;Vf8BuTwqPY{Fzqv#j} zJI`A=?%c8`hFNL)P|n%UKi74-uFG` z`@XxqF)q(PJO_Zw>nB%F$$dtGI(tCQ_eO8O0(bzoUp#wEo;*vleabXVMC3S*VHldG zDT$<9{ilRu8G#Cs7L5ML7Ps8Ef^EQsVvh2BGmYP0M zv`kVWQSya>&G9qLhNx%*#OT;LyQTiJkmdh!`%|w0-FS9F6Jtx-0O%vhW-7p zzw_v|L%pfzTmKzWwztQU}+M MZ?1m+?C#rt0o6cbtN;K2 diff --git a/wadsrc/static/filter/game-doom/graphics/stcfn218.png b/wadsrc/static/filter/game-doom/graphics/stcfn218.png deleted file mode 100644 index 995fa7d928a7bb5aa7949ddc7239923b5b35d3e7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1174 zcmd^8v8&r=5WkQ?uTL0HqG<4-K>K`;I&Aes_Go z`<_3!Fj}YYp8`PZ{NdSCVo#2Ga+};YuP%N%I^D1Ce?ja~Zv8X+{4app@Z{062gK)D znr&02X(A%WaSX%IG)+;Ir0{~+W_ha3f~AUvENCK!)9IV>_+~WP4~M%v-}ZV z83YU8pS$kNacaw&7)GUOBULSAc_>M_DE0**utm~~`~Lwyuzg|FtG z(sSh0mSRf`jE<)Zw#J(Zr%9|VGNRBv91gqPZoAz!O|xFFm&@g1v6#>2)9JLX>+yJ8 zRaIG*!{Kl+81(!7EX&d~jpH~B!ypKJ-*;WtaU9FC48zcMT~$>@Q6x#~bUK0{#2AK$ zZg=Z>E61H%_QWttO&=&)CMl69`9jC$c%5bCHY3n9OUa zRJ0Cav~QfvOusIqNx~N{)6=O)1j02o4bEm*6qqFFd8lc~^9XPNcnz=tSOUxeYJdu$ z0O$jx01-eJzy%e_;-0Tcc0oVY=(5p%=<(LfXsq0*pKU?4$HAj{d& zB~B3-iK9u2x2vQANB{x=3qXQ^rH(rj6HY_n)17?_a`Ii~I22$A7l&y!-3V*O%YE cy7w5ae*fU*o$r46hUCHdgNw5lpIl!33jsW7cmMzZ diff --git a/wadsrc/static/filter/game-doom/graphics/stcfn220.png b/wadsrc/static/filter/game-doom/graphics/stcfn220.png deleted file mode 100644 index d79993a27facf03059bb4dabfdf4f09d194faf39..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1147 zcmd^7zpL9;6h3JvdU@(YgD48oAgBfp8dOk0g9@V63(Bj?Q-}hhXi$m<4=O02f(8wO zs9=f*4IWIZQVkw780tZT2M-GQfhdN0@Zf?54=H%?;30)9h12`eKckm>?&TiN`M$&b zz8@c6n-}Nz&H>=!>cQnBa-Wf)&TfJ9P%i_m@YRv4WR9HJQfLl*Lv(b( zQh8nG6p58Y=5#t84u}1I-}n7?yIrr>UDvg3yId}trkT&@bzN6gHJwf;lgW5I&htFW zvLs2OCh5RaKVd!C)YYVuDe08V>iqzj3|Rb{3{p>BdCW zb6JfgIS>a9FBlxBFsw+^9M#svvKlR>SzRR6C@QmXk_O}0%R@H}?8LVs*BCmwZ>g@K zIJ#WrL6JClXeGWrbQI5&Y)v#2KFxwCc88(u1*YR_rmg6vr0N62_}II+16HB>-IAJiC5Q?+Y5t#Upw?9R2eRz$3W(^2Jm76nT~(Ft%+Yq96zy$FVHS zFpQ#!l04u=X264^%a$q`vVhCwyZQX>Y<8MXk7aonjruIxCCP@6E)3Vczw*4+aTb=< z7{*N3D^;B;N-4`@Nh(A!7lf4O6OJQ;LBz5F!}tv2GK>RY0hj=II^dff_8sn4xNWg( za9!bQf^G3`o}FjOu_A{_xF7r5!rkP~I$>%Ny<9Haww=%CP1DqMJ)KS`lgW5IE{Y=0 z^E6H4I3|RIVd(q5=Xs9fSe9j)rmpLnrYVXt91bN(N->VlQFI7`t>>>DcVXGJVNNuo zP_#r=LTTsfRk93XVy)*tVfG!-jr!QimRMVvT&UE1@W@bNdr6f%*ZtYTk}lS zHI%vt%hWB1od!nas=g&Vx@4+CmWOfTMa1z#%k^~2Q4LGhj3Huj>b?ESd{rrnOssrv zWHN~iRBP;eT&=LGFv~Cq&@fOG5#S8)24D}c0aydH01ZF|Fb2p05`YN62cVKsy^crh zI-Jk3EHO#Yby3r(izp1;6oz6@0NPyu5CHd{_tfKlgI;Ae@ZIxU_dl}x3ICt#a{BjY^s7Gn_Sx4|WtO{- z2k_I+pVH(fH`kxPxcD)A`6qnv(cRMc3aCXXqNpHRy`cA^@D!qeC>j*d;6Z}|DrnFk zs0I@}Xz*ZK1vGfjV5kWiJeZ&%g9bxQ@!*064=H%?U}#D+o?fRvqnCT`;X!<6@SL7$)fT1~lzaluJ=IMOgp_fDV9%9lqUQ*WzZ0>l)h% zn*x_(th4vC{V(tiCIU+EYzogR`_b}DMLq2Z7H_I!03CrU~9ao zaGJ!*A|ndDVzH>}dN!L?RaKVdWHK3#$D`3G%d#|0 z<2Vk(FbD$Q_g&X@9LKUO!!UGRS5;L}6iJf${k|XwF^1uBFxYwC+Ho7po*QPV>0?F9 zBqb6hU+CK$ud}S&V+5LJsiw*o<#0Ypt2{1;VUY&o#2-a&7C4D-#hw{D`oPvaQ*m_J z)}%7?^VrS;GxoHBExU$jse&$ZN$Q7@GYBl#H*7~WELk%|Me8F*htAn9^*4nyPx!)R zhB_6AK(xlL!{ri-0+R$i4>b*W9s!O3Z;43&Rsan^4Nw6T03(1DAOaWwxBx^lqSt

?bbn6s}-oFXt1M-z$H{i!7*YumD(x2I3y`Q;BpWtus~ z4fy5dCnWjV)x~#DZ~yE+`vX3@b9wL9qgUr&+`D!EtNX7%zXLD-`ttX0z8<|Gb#V3I L`r_B`pZ)YN4ryW7 diff --git a/wadsrc/static/filter/game-raven/graphics/fonta165.png b/wadsrc/static/filter/game-raven/graphics/fonta165.png deleted file mode 100644 index b149c3790c54225415adde11e153a10ef65aadb1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1164 zcmd^9F^l6y82vVzoGz;@DpV*$g+c@|K>-yiR45=4?V;OKSRJPY5mab%DqN`0fdVR2 z=r{#TaG^qlNfc1wLJ&iIpu&X<6E4IMLtMCUzz`P~aN)wm9=Y<%`0_I{%s0b)@ZS62 zJ?6WISLXTI2WJ3qetG}m5xL(z*4GIti4Jxi@NHb;>$4D~9|3SaHHO6JIkErn*sH$+Dl zES1+~PLWtiWDbYJZnxWRx0}sowOTC}i}`#$o6RPZN!zxg(Wq&fx~>O@+&DJFGqJjj|Nse4hCg=HG_V=oWgG_Vujid>`X=)R@8 zhT`aQod-qY1rQ?fPDQ1~-dXQ}lh*brb{yH~_pPApuwb%m7+|2A~4y17rX(Ko`IRAeIro zb~~KUaWulBz&J+7K~*IwA~a+Z8p1&c2s#G{0i2`meuL{N&MRzF9C}!2nDMtUw~v@@ zms$Jt!lho=Ffn0lyqOc%h%I7)7$Ta8A|f<8)GCxR^h6TQjv@1^$jUrTB;G_x1CRkk z01kjO0c!(y7N!J>OIX%WMG!V&_{ZPp4**W!n@3m9e`3c8|DWq@@anVUC-LO|SHxwS zJ=O{Q@Zq2) z+@GG^7#HUc&jH}#`svkka({S=v-{-SSpPf*xDU_1x_v^PJWI1Z$}~+xcqFjoyDaryc0CWI6?C{MRw;iq*xN5Mg zuq|*g#wL4LC&y{DFM{3J-;CTQJ8sTH&j?rwkoAwWZh+1EcThg01nU z!f6sKi;O7rj>qGEzu)b4+wFF}UN4u+uIt*iozLe@)6{icRaIG*lgVT}9*;(&EX&d~ zjpH~B!ypKJ-*;WtaU9FC48zcMT~$>@Q6x#~_xpk%#2ALh!C>ckE5~guduEuWrjHdZ zlaxr5e4%f1yw0+6j}d5^rP?Z=m&4g4t@5}WhD92T6Mq!BS>PnT6?@Ckuw=~;6|IjL9k$M9p}#JqS;7}C zGt{X_1fn%=x42kfQDBmw=b@${&m+JQ;0-Yez!IPZXaFjJ0$>D?0z?1<02hErM)cb6 zvFos|G0!oI(6&)gh>Hje*#w4Q5CGDh0R#Z{iTAL@%>ugun*^sW<|?M#+lW1cz1^U< z@#v*Py|!R(z)XKXCvFfM#2hg|G!O+us5B@Q7)vk|h&lVZ#3=$JaWtWLZzUB#0uTUL z0FneOb=;enkXBs5s)QnhpbCQD|GM}R;2!+&{Ko!|>@?y3bDdBA{`B-oymPx#=$w`Z4kcb^SDx~0DVx0Vv@KZVG0W&Q&>zfg@i3E1~SEvOu%A_4NNh`6dSVT$(_y5$mO1UxrcMU@4)wQ zzkhURTwQ*A2>@5O4{sim`~7oV+$ZPG`sW(pK0NyB$piA_S(+VCrfDJ~$8ik9&@@d^ zl%(*2IAD2dz=EZUhAe0zhs))gx_&*MA7`^ep6|!wK1sGwv<`yK_gmLpIZk6)3&W^1 zZLX??EYBn<7sZJnWIUg8T+Ff&!vurDh^9S?aw*EDC=0*<&;jtc$5&hIJKU~t(_mL& zTi|MnP4=cvPV?wc1pBGKo4A|IUZ+-@m`!BVp*|0^!dG)o89Q=nOR*&e#?aFRTjNcI z(-DJTAv!kp|PmpG0mJIEin?o*6p&$kseladg?% zq%!mK*vW7gt3M|(*Y)3ULSu;dM8zM%>-r246mxZ)Q_`+qz zIu(gPw8p;2)e4IOlLS2vH4S+l0Zss~h)Dp}04+cRPyrMG6Mz&T0vG|f07NpP*WrL& zhjop4j!}fRjfz5CL}17!Fa(1DknRj10I<)z#~ybp>Pvuo@ci+e{U6zR!vE*Goc;aj`IGqi;ZveA&79*N z{Pf}@lH_i0K7VrYqyOwrc=v;g4_|yo|Gd7wc>eUgA3lRW-udL4-+#TPNEzHdxV!n~ Ii)Y{d3&=%cHvj+t diff --git a/wadsrc/static/filter/game-raven/graphics/fonta191.png b/wadsrc/static/filter/game-raven/graphics/fonta191.png deleted file mode 100644 index 250badae66c936f8d2a504f0228613c250864918..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1159 zcmd^7F^l6?5T0d^=x%k33Ka?wK`bg0uFo=gto@xCZ_gF%<3n>b#D;W7wX&s(@|W7{*+ ztaW{&X{Dl!Wx0@~p(y5pknw!NaWTt=4AZA+pQ1d9awy6MFaZnzJnZn*2D>G07PxM3 zSz}w`VuVfpW||%+@xBaqqhLGq*15CF>^8NU*qlbjB-G15D|~g}Dw!iEwiKE@-w+*L zuvA``IYnY6kvSfZ`~7~m+jU*H*=$y;)pEIP+jc&mH%&90PV2g^s%ktQk4B^6aG2+L zmSstjL{SumVGsnK=ee$H+qP+%hGA%$rmCte%e`Jt6vYIi=-BV?e1GkFt?kTAtI~~; zs^_vAOL8Fg99}RuPGMM)ra7vui+MGejkCH)szFp{;V2D;v6qK#8rX?%MXu3zbl*~4 zLveJu%7Y?t^3Y0rz3(WVDcPE6D14d)QSA0Z+Y3y`)l6H_O-a>zi1DFww+rKCDbG@& z^w@zx#S##$vFmWLz_P?NMc+qVM?pYpv?1cLyO?i?TlaPD{y9c~x6EU`&(;$fj-#=nlaL&WU* z%+{w@F7?uexd}7l?VPwpY!C~?5Ya>w5uw(hQeh;+KqThu88WYmtjyDd;;of502x38 z-~dPwurhFOVM5J#T{r=(NB>(>F58(asqlZzZ~p~8CS@xC diff --git a/wadsrc/static/filter/game-raven/graphics/fonta60.png b/wadsrc/static/filter/game-raven/graphics/fonta60.png deleted file mode 100644 index 30afe2549ef6aee4b84ece43a4e4cb6d80c137d5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 892 zcmW+!F{q?g6urwY{8{&}g#<$+SXfM9z`}rqg>3wb`(s#_xL|^XAr`YB!6X(I7Q$K# z%M=Et7!nsOrm&D?3X363VX+X4flM*Q1T3c5gej(&Vv7%HZr)#b_Z_(B-E;5bo>$MF znpgKfz7GIbH&3p=B1nCtxt0TKWE^!q=^;|qB9<@3iRC2%yy zP?lv8j^}xnWoeqGC`wiZQDQiOVmPoh$y7vL;&HXQZJKwB#c4i27R6yQ8PaqY$D1(h zgP`-gwd=OFy)?~Q*B6>rD#~1z3rU)aVlD_7&nFxgvuwyPW199U%A+WUqHF*Yz##LT z4)}J5Lyx;PZd>eY>`GkEu+49q^t_0VWq6nc`>D6holRzUsny126B&z8F9WUc)rqTQ zj-1$1XpVeCbacT|d0pldiIqg=d_EtK$HU<;48v}>+iW&{-*;WNTCLi)ZJMU8>#C~e z^Z9Hxn@*>Bo@ZH>BuNxSVHgHM;CY_wy0&ebrfC?4rfI6G%CbBfjYLsQFpAFO@xk}E zuGiVl(zGhwn5lX$tFa^p;>h6zgX0v26=|BIy1H0ZljS_Ci=>)FWfsoTU>bXQ=%#_4 z_*Uc^V@LNb)io4Hm#aJ|5+@I>#Mj4;;+c}IiH5?bSrEnUIJCXMbX?7}72T9neS{dF z26w+U-jwn(6-tkt7*s6X`2dFj*J~_GOjGoI)O8dD1ULh{1=s^@06Kscpav)brT`g0 z3@`@p0LaS7zK%!idu$pk3XEfP98^`}A|gW$ks%sHfK=xIA%Jt&_cY*sjeUu2iVF`5 z4Kw~-%$*|UFlP2Xy>Y2GHmpoo8t>=CJz|SkAclx0qKF8!4wVWs873kz=g5$GRb*wJ zCN17uNdu4pL;wzeBmpY}j~1q+6t}Rgpo}1_!|<3wb`(s#_xL|^XAr`YB!6X(I7Q$K# z%M=Et7!nsOrm&D?3X363VX+X4flM*Q1T3c5gej(&Vv7%HZr)#b_Z_(B-E;5bo>$MF znpgKfz7GIbH&3p=B1nCtxt0TKWE^!q=^;|qB9<@3iRC2%yy zP?lv8j^}xnWoeqGC`wiZQDQiOVmPoh$y7vL;&HXQZJKwB#c4i27R6yQ8PaqY$D1(h zgP`-gwd=OFy)?~Q*B6>rD#~1z3rU)aVlD_7&nFxgvuwyPW199U%A+WUqHF*Yz##LT z4)}J5Lyx;PZd>eY>`GkEu+49q^t_0VWq6nc`>D6holRzUsny126B&z8F9WUc)rqTQ zj-1$1XpVeCbacT|d0pldiIqg=d_EtK$HU<;48v}>+iW&{-*;WNTCLi)ZJMU8>#C~e z^Z9Hxn@*>Bo@ZH>BuNxSVHgHM;CY_wy0&ebrfC?4rfI6G%CbBfjYLsQFpAFO@xk}E zuGiVl(zGhwn5lX$tFa^p;>h6zgX0v26=|BIy1H0ZljS_Ci=>)FWfsoTU>bXQ=%#_4 z_*Uc^V@LNb)io4Hm#aJ|5+@I>#Mj4;;+c}IiH5?bSrEnUIJCXMbX?7}72T9neS{dF z26w+U-jwn(6-tkt7*s6X`2dFj*J~_GOjGoI)O8dD1ULh{1=s^@06Kscpav)brT`g0 z3@`@p0LaS7zK%!idu$pk3XEfP98^`}A|gW$ks%sHfK=xIA%Jt&_cY*sjeUu2iVF`5 z4Kw~-%$*|UFlP2Xy>Y2GHmpoo8t>=CJz|SkAclx0qKF8!4wVWs873kz=g5$GRb*wJ zCN17uNdu4pL;wzeBmpY}j~1q+6t}Rgpo}1_!|<sp5fKp)q0L{izbTugSqMu+wnU70B87;Eh(JRb z%7};&Lz_axh=`OJJ4^Ske9enjKu$zysy{8#=B@EBfx_v#saN&+izjN>?nD2gJ_^DN6U45R9j ztZ;(Fa00l7Vr#Ogh`8B&Y}*g3)n&Onm*r_T8?)??Bs)TeDC&b?>-(MSu5G(9&6QzP znzmHcQc>ozTu4$bim4zZJWn`o%CaHD1PtRbj0<1`SO9oA;kyHl10J@x?{H|auW-A- zuK3ty*Hv<^$Y~KB=fS@4cDdVUPM6qiY^{h{MMfFwGhfR+HFXtYPeM!fOv%wjQx!CY zS7h#by`InK)9Eyhqh2h>0de>XqPHkEX-7Hi+QPfDD zc%ozpg2wSO%L+{2l$(0CUgk}i*0Z?E$s&v9Nl*|!i`+DHV&9s2X6Wd?rFo`W7g3pd z1#!~QoO)VdE3P41nwaHLocL4X29fRghV5#mt?1?iF}aNXacezP>N=CEfS*}Rq5#zz z#}T(%tSZbh3_~VWGlIrskYjs;JAnDzbFMXDb;1Du4_i08kLHw(#s= zMq6ekNJGfK?{B}Q+_s?G3{rSzCpZ*6K=3JQo diff --git a/wadsrc/static/filter/game-raven/graphics/fonta63.png b/wadsrc/static/filter/game-raven/graphics/fonta63.png deleted file mode 100644 index 30afe2549ef6aee4b84ece43a4e4cb6d80c137d5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 892 zcmW+!F{q?g6urwY{8{&}g#<$+SXfM9z`}rqg>3wb`(s#_xL|^XAr`YB!6X(I7Q$K# z%M=Et7!nsOrm&D?3X363VX+X4flM*Q1T3c5gej(&Vv7%HZr)#b_Z_(B-E;5bo>$MF znpgKfz7GIbH&3p=B1nCtxt0TKWE^!q=^;|qB9<@3iRC2%yy zP?lv8j^}xnWoeqGC`wiZQDQiOVmPoh$y7vL;&HXQZJKwB#c4i27R6yQ8PaqY$D1(h zgP`-gwd=OFy)?~Q*B6>rD#~1z3rU)aVlD_7&nFxgvuwyPW199U%A+WUqHF*Yz##LT z4)}J5Lyx;PZd>eY>`GkEu+49q^t_0VWq6nc`>D6holRzUsny126B&z8F9WUc)rqTQ zj-1$1XpVeCbacT|d0pldiIqg=d_EtK$HU<;48v}>+iW&{-*;WNTCLi)ZJMU8>#C~e z^Z9Hxn@*>Bo@ZH>BuNxSVHgHM;CY_wy0&ebrfC?4rfI6G%CbBfjYLsQFpAFO@xk}E zuGiVl(zGhwn5lX$tFa^p;>h6zgX0v26=|BIy1H0ZljS_Ci=>)FWfsoTU>bXQ=%#_4 z_*Uc^V@LNb)io4Hm#aJ|5+@I>#Mj4;;+c}IiH5?bSrEnUIJCXMbX?7}72T9neS{dF z26w+U-jwn(6-tkt7*s6X`2dFj*J~_GOjGoI)O8dD1ULh{1=s^@06Kscpav)brT`g0 z3@`@p0LaS7zK%!idu$pk3XEfP98^`}A|gW$ks%sHfK=xIA%Jt&_cY*sjeUu2iVF`5 z4Kw~-%$*|UFlP2Xy>Y2GHmpoo8t>=CJz|SkAclx0qKF8!4wVWs873kz=g5$GRb*wJ zCN17uNdu4pL;wzeBmpY}j~1q+6t}Rgpo}1_!|< Date: Sun, 17 Mar 2019 18:14:12 +0100 Subject: [PATCH 26/34] - fixed the spacing for the sliders. - moved the scroll indicators in the menu to the right and use a brighter color for them - the old ones were only barely visible. --- wadsrc/static/zscript/ui/menu/menu.zs | 8 ++++++++ wadsrc/static/zscript/ui/menu/optionmenu.zs | 4 ++-- wadsrc/static/zscript/ui/menu/optionmenuitems.zs | 12 ++++-------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/wadsrc/static/zscript/ui/menu/menu.zs b/wadsrc/static/zscript/ui/menu/menu.zs index 447b052dc..6feee5467 100644 --- a/wadsrc/static/zscript/ui/menu/menu.zs +++ b/wadsrc/static/zscript/ui/menu/menu.zs @@ -309,6 +309,14 @@ class Menu : Object native ui version("2.4") { return OptionFont().StringWidth(s); } + + static void DrawOptionText(int x, int y, int color, String text, bool grayed = false) + { + String label = Stringtable.Localize(text); + int overlay = grayed? Color(96,48,0,0) : 0; + screen.DrawText (OptionFont(), OptionColor(color), x, y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); + } + } diff --git a/wadsrc/static/zscript/ui/menu/optionmenu.zs b/wadsrc/static/zscript/ui/menu/optionmenu.zs index dc389ac95..97e25af6d 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenu.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenu.zs @@ -480,11 +480,11 @@ class OptionMenu : Menu if (CanScrollUp) { - DrawConText(Font.CR_ORANGE, 3 * CleanXfac_1, ytop, "\x1a"); + DrawOptionText(screen.GetWidth() - 11 * CleanXfac_1, ytop, Font.CR_UNTRANSLATED, "▲"); } if (CanScrollDown) { - DrawConText(Font.CR_ORANGE, 3 * CleanXfac_1, y - 8*CleanYfac_1, "\x1b"); + DrawOptionText(screen.GetWidth() - 11 * CleanXfac_1 , y - 8*CleanYfac_1, Font.CR_UNTRANSLATED, "▼"); } Super.Drawer(); } diff --git a/wadsrc/static/zscript/ui/menu/optionmenuitems.zs b/wadsrc/static/zscript/ui/menu/optionmenuitems.zs index 53051ca9a..58ac07cdd 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenuitems.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenuitems.zs @@ -46,11 +46,7 @@ class OptionMenuItem : MenuItemBase protected void drawText(int x, int y, int color, String text, bool grayed = false) { - String label = Stringtable.Localize(mLabel); - - int overlay = grayed? Color(96,48,0,0) : 0; - - screen.DrawText (Menu.OptionFont(), Menu.OptionColor(color), x, y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); + Menu.DrawOptionText(x, y, color, text, grayed); } protected int drawLabel(int indent, int y, int color, bool grayed = false) @@ -61,13 +57,13 @@ class OptionMenuItem : MenuItemBase int w = Menu.OptionWidth(label) * CleanXfac_1; if (!mCentered) x = indent - w; else x = (screen.GetWidth() - w) / 2; - DrawText(x, y, color, label, grayed); + Menu.DrawOptionText(x, y, color, label, grayed); return x; } protected void drawValue(int indent, int y, int color, String text, bool grayed = false) { - DrawText(indent + CursorSpace(), y, color, text, grayed); + Menu.DrawOptionText(indent + CursorSpace(), y, color, text, grayed); } @@ -731,7 +727,7 @@ class OptionMenuSliderBase : OptionMenuItem String textbuf; double range; int maxlen = 0; - int right = x + (12*8 + 4) * CleanXfac_1; + int right = x + (12*8 + 4) * CleanXfac; // length of slider. This uses the old ConFont and int cy = y; range = max - min; From a3103588f3d4812b5acf38d979fbe11fde03cea7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 18:31:01 +0100 Subject: [PATCH 27/34] - fixed: The software renderer was destroying global state when initializing a camera texture. As a result the HUD wasn't drawn. --- src/r_utility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_utility.cpp b/src/r_utility.cpp index b8a45900f..c258d0df8 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -223,9 +223,9 @@ void R_SetWindow (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, int wind else { viewwindow.WidescreenRatio = ActiveRatio(fullWidth, fullHeight); + DrawFSHUD = (windowSize == 11); } - DrawFSHUD = (windowSize == 11); // [RH] Sky height fix for screens not 200 (or 240) pixels tall R_InitSkyMap (); From 099ddea0e1fefce186bcf7688016b33cfc123147 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 19:02:15 +0100 Subject: [PATCH 28/34] - use the console font for printing sound debug info. The unscaled small font is simply far too small for this on modern displays. --- src/s_sound.cpp | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/s_sound.cpp b/src/s_sound.cpp index b6aefd868..4027adc2d 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -183,21 +183,21 @@ void S_NoiseDebug (void) int y, color; y = 32 * CleanYfac; - screen->DrawText (SmallFont, CR_YELLOW, 0, y, "*** SOUND DEBUG INFO ***", TAG_DONE); - y += 8; + screen->DrawText (NewConsoleFont, CR_YELLOW, 0, y, "*** SOUND DEBUG INFO ***", TAG_DONE); + y += NewConsoleFont->GetHeight(); - screen->DrawText (SmallFont, CR_GOLD, 0, y, "name", TAG_DONE); - screen->DrawText (SmallFont, CR_GOLD, 70, y, "x", TAG_DONE); - screen->DrawText (SmallFont, CR_GOLD, 120, y, "y", TAG_DONE); - screen->DrawText (SmallFont, CR_GOLD, 170, y, "z", TAG_DONE); - screen->DrawText (SmallFont, CR_GOLD, 220, y, "vol", TAG_DONE); - screen->DrawText (SmallFont, CR_GOLD, 260, y, "dist", TAG_DONE); - screen->DrawText (SmallFont, CR_GOLD, 300, y, "chan", TAG_DONE); - screen->DrawText (SmallFont, CR_GOLD, 340, y, "pri", TAG_DONE); - screen->DrawText (SmallFont, CR_GOLD, 380, y, "flags", TAG_DONE); - screen->DrawText (SmallFont, CR_GOLD, 460, y, "aud", TAG_DONE); - screen->DrawText (SmallFont, CR_GOLD, 520, y, "pos", TAG_DONE); - y += 8; + screen->DrawText (NewConsoleFont, CR_GOLD, 0, y, "name", TAG_DONE); + screen->DrawText (NewConsoleFont, CR_GOLD, 70, y, "x", TAG_DONE); + screen->DrawText (NewConsoleFont, CR_GOLD, 120, y, "y", TAG_DONE); + screen->DrawText (NewConsoleFont, CR_GOLD, 170, y, "z", TAG_DONE); + screen->DrawText (NewConsoleFont, CR_GOLD, 220, y, "vol", TAG_DONE); + screen->DrawText (NewConsoleFont, CR_GOLD, 260, y, "dist", TAG_DONE); + screen->DrawText (NewConsoleFont, CR_GOLD, 300, y, "chan", TAG_DONE); + screen->DrawText (NewConsoleFont, CR_GOLD, 340, y, "pri", TAG_DONE); + screen->DrawText (NewConsoleFont, CR_GOLD, 380, y, "flags", TAG_DONE); + screen->DrawText (NewConsoleFont, CR_GOLD, 460, y, "aud", TAG_DONE); + screen->DrawText (NewConsoleFont, CR_GOLD, 520, y, "pos", TAG_DONE); + y += NewConsoleFont->GetHeight(); if (Channels == NULL) { @@ -220,52 +220,52 @@ void S_NoiseDebug (void) // Name Wads.GetLumpName (temp, S_sfx[chan->SoundID].lumpnum); temp[8] = 0; - screen->DrawText (SmallFont, color, 0, y, temp, TAG_DONE); + screen->DrawText (NewConsoleFont, color, 0, y, temp, TAG_DONE); if (!(chan->ChanFlags & CHAN_IS3D)) { - screen->DrawText(SmallFont, color, 70, y, "---", TAG_DONE); // X - screen->DrawText(SmallFont, color, 120, y, "---", TAG_DONE); // Y - screen->DrawText(SmallFont, color, 170, y, "---", TAG_DONE); // Z - screen->DrawText(SmallFont, color, 260, y, "---", TAG_DONE); // Distance + screen->DrawText(NewConsoleFont, color, 70, y, "---", TAG_DONE); // X + screen->DrawText(NewConsoleFont, color, 120, y, "---", TAG_DONE); // Y + screen->DrawText(NewConsoleFont, color, 170, y, "---", TAG_DONE); // Z + screen->DrawText(NewConsoleFont, color, 260, y, "---", TAG_DONE); // Distance } else { // X coordinate mysnprintf(temp, countof(temp), "%.0f", origin.X); - screen->DrawText(SmallFont, color, 70, y, temp, TAG_DONE); + screen->DrawText(NewConsoleFont, color, 70, y, temp, TAG_DONE); // Y coordinate mysnprintf(temp, countof(temp), "%.0f", origin.Z); - screen->DrawText(SmallFont, color, 120, y, temp, TAG_DONE); + screen->DrawText(NewConsoleFont, color, 120, y, temp, TAG_DONE); // Z coordinate mysnprintf(temp, countof(temp), "%.0f", origin.Y); - screen->DrawText(SmallFont, color, 170, y, temp, TAG_DONE); + screen->DrawText(NewConsoleFont, color, 170, y, temp, TAG_DONE); // Distance if (chan->DistanceScale > 0) { mysnprintf(temp, countof(temp), "%.0f", (origin - listener).Length()); - screen->DrawText(SmallFont, color, 260, y, temp, TAG_DONE); + screen->DrawText(NewConsoleFont, color, 260, y, temp, TAG_DONE); } else { - screen->DrawText(SmallFont, color, 260, y, "---", TAG_DONE); + screen->DrawText(NewConsoleFont, color, 260, y, "---", TAG_DONE); } } // Volume mysnprintf(temp, countof(temp), "%.2g", chan->Volume); - screen->DrawText(SmallFont, color, 220, y, temp, TAG_DONE); + screen->DrawText(NewConsoleFont, color, 220, y, temp, TAG_DONE); // Channel mysnprintf(temp, countof(temp), "%d", chan->EntChannel); - screen->DrawText(SmallFont, color, 300, y, temp, TAG_DONE); + screen->DrawText(NewConsoleFont, color, 300, y, temp, TAG_DONE); // Priority mysnprintf(temp, countof(temp), "%d", chan->Priority); - screen->DrawText(SmallFont, color, 340, y, temp, TAG_DONE); + screen->DrawText(NewConsoleFont, color, 340, y, temp, TAG_DONE); // Flags mysnprintf(temp, countof(temp), "%s3%sZ%sU%sM%sN%sA%sL%sE%sV", @@ -278,18 +278,18 @@ void S_NoiseDebug (void) (chan->ChanFlags & CHAN_LOOP) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHAN_EVICTED) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHAN_VIRTUAL) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK); - screen->DrawText(SmallFont, color, 380, y, temp, TAG_DONE); + screen->DrawText(NewConsoleFont, color, 380, y, temp, TAG_DONE); // Audibility mysnprintf(temp, countof(temp), "%.4f", GSnd->GetAudibility(chan)); - screen->DrawText(SmallFont, color, 460, y, temp, TAG_DONE); + screen->DrawText(NewConsoleFont, color, 460, y, temp, TAG_DONE); // Position mysnprintf(temp, countof(temp), "%u", GSnd->GetPosition(chan)); - screen->DrawText(SmallFont, color, 520, y, temp, TAG_DONE); + screen->DrawText(NewConsoleFont, color, 520, y, temp, TAG_DONE); - y += 8; + y += NewConsoleFont->GetHeight(); if (chan->PrevChan == &Channels) { break; From 478eef56285ecc3298eaa65e30739da2e05d80f5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 19:10:25 +0100 Subject: [PATCH 29/34] - fixed positioning of "no files" message on load game screen. --- wadsrc/static/zscript/ui/menu/loadsavemenu.zs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wadsrc/static/zscript/ui/menu/loadsavemenu.zs b/wadsrc/static/zscript/ui/menu/loadsavemenu.zs index b9c6fa12c..02375e6b4 100644 --- a/wadsrc/static/zscript/ui/menu/loadsavemenu.zs +++ b/wadsrc/static/zscript/ui/menu/loadsavemenu.zs @@ -190,9 +190,9 @@ class LoadSaveMenu : ListMenu if (manager.SavegameCount() > 0) { String text = (Selected == -1 || !manager.GetSavegame(Selected).bOldVersion)? Stringtable.Localize("$MNU_NOPICTURE") : Stringtable.Localize("$MNU_DIFFVERSION"); - int textlen = SmallFont.StringWidth(text) * CleanXfac; + int textlen = NewSmallFont.StringWidth(text) * CleanXfac; - screen.DrawText (SmallFont, Font.CR_GOLD, savepicLeft+(savepicWidth-textlen)/2, + screen.DrawText (NewSmallFont, Font.CR_GOLD, savepicLeft+(savepicWidth-textlen)/2, savepicTop+(savepicHeight-rowHeight)/2, text, DTA_CleanNoMove, true); } } @@ -216,7 +216,7 @@ class LoadSaveMenu : ListMenu if (manager.SavegameCount() == 0) { String text = Stringtable.Localize("$MNU_NOFILES"); - int textlen = SmallFont.StringWidth(text) * CleanXfac; + int textlen = NewConsoleFont.StringWidth(text) * FontScale; screen.DrawText (NewConsoleFont, Font.CR_GOLD, (listboxLeft+(listboxWidth-textlen)/2) / FontScale, (listboxTop+(listboxHeight-rowHeight)/2) / FontScale, text, DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale, DTA_KeepRatio, true); From b515ac662e2c3ade6f5879ac5dfcce6c0f6f6a1d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 20:28:12 +0100 Subject: [PATCH 30/34] - cleaned up the coop summary screen. This was one of the pieces that suffered badly from the proportions of the game provided SmallFonts, so now it uses the NewSmallFont. --- .../zscript/ui/statscreen/statscreen.zs | 47 ++++++++++++++++ .../zscript/ui/statscreen/statscreen_coop.zs | 56 ++++++++++--------- 2 files changed, 78 insertions(+), 25 deletions(-) diff --git a/wadsrc/static/zscript/ui/statscreen/statscreen.zs b/wadsrc/static/zscript/ui/statscreen/statscreen.zs index 1cf100198..fe9becad9 100644 --- a/wadsrc/static/zscript/ui/statscreen/statscreen.zs +++ b/wadsrc/static/zscript/ui/statscreen/statscreen.zs @@ -353,6 +353,53 @@ class StatusScreen abstract play version("2.5") } } + //==================================================================== + // + // + //==================================================================== + + void drawTextScaled (Font fnt, double x, double y, String text, double scale, int translation = Font.CR_UNTRANSLATED) + { + screen.DrawText(fnt, translation, x / scale, y / scale, text, DTA_VirtualWidthF, screen.GetWidth() / scale, DTA_VirtualHeightF, screen.GetHeight() / scale); + } + + //==================================================================== + // + // + //==================================================================== + + void drawNumScaled (Font fnt, int x, int y, double scale, int n, int digits, int translation = Font.CR_UNTRANSLATED) + { + String s = String.Format("%d", n); + drawTextScaled(fnt, x - fnt.StringWidth(s) * scale, y, s, scale, translation); + } + + //==================================================================== + // + // + // + //==================================================================== + + void drawPercentScaled (Font fnt, int x, int y, int p, int b, double scale, bool show_total = true, int color = Font.CR_UNTRANSLATED) + { + if (p < 0) return; + + String s; + if (wi_percents) + { + s = String.Format("%d%%", b == 0 ? 100 : p * 100 / b); + } + else if (show_total) + { + s = String.Format("%d/%3d", p, b); + } + else + { + s = String.Format("%d", p); + } + drawTextScaled(fnt, x - fnt.StringWidth(s) * scale, y, s, scale, color); + } + //==================================================================== // // Display level completion time and par, or "sucks" message if overflow. diff --git a/wadsrc/static/zscript/ui/statscreen/statscreen_coop.zs b/wadsrc/static/zscript/ui/statscreen/statscreen_coop.zs index fb82cb36b..3c19243d4 100644 --- a/wadsrc/static/zscript/ui/statscreen/statscreen_coop.zs +++ b/wadsrc/static/zscript/ui/statscreen/statscreen_coop.zs @@ -2,6 +2,9 @@ class CoopStatusScreen : StatusScreen { int textcolor; + double FontScale; + int RowHeight; + Font displayFont; //==================================================================== // @@ -11,11 +14,14 @@ class CoopStatusScreen : StatusScreen override void initStats () { - textcolor = (gameinfo.gametype & GAME_Raven) ? Font.CR_GREEN : Font.CR_UNTRANSLATED; + textcolor = Font.CR_GRAY; CurState = StatCount; acceleratestage = 0; ng_state = 1; + displayFont = NewSmallFont; + FontScale = max(screen.GetHeight() / 480, 1); + RowHeight = max((displayFont.GetHeight() + 1) * FontScale, 1); cnt_pause = Thinker.TICRATE; @@ -223,7 +229,7 @@ class CoopStatusScreen : StatusScreen Vector2 readyoffset = TexMan.GetScaledOffset(readyico); height = int(readysize.Y - readyoffset.Y); maxiconheight = MAX(height, maxiconheight); - height = SmallFont.GetHeight() * CleanYfac; + height = displayFont.GetHeight() * FontScale; lineheight = MAX(height, maxiconheight * CleanYfac); ypadding = (lineheight - height + 1) / 2; y += CleanYfac; @@ -232,11 +238,11 @@ class CoopStatusScreen : StatusScreen text_secret = Stringtable.Localize("$SCORE_SECRET"); text_kills = Stringtable.Localize("$SCORE_KILLS"); - icon_x = 8 * CleanXfac; - name_x = icon_x + maxscorewidth * CleanXfac; - kills_x = name_x + (maxnamewidth + MAX(SmallFont.StringWidth("XXXXX"), SmallFont.StringWidth(text_kills)) + 8) * CleanXfac; - bonus_x = kills_x + ((bonus_len = SmallFont.StringWidth(text_bonus)) + 8) * CleanXfac; - secret_x = bonus_x + ((secret_len = SmallFont.StringWidth(text_secret)) + 8) * CleanXfac; + icon_x = 8 * FontScale; + name_x = icon_x + maxscorewidth * FontScale; + kills_x = name_x + (maxnamewidth + 1 + MAX(displayFont.StringWidth("XXXXXXXXXX"), displayFont.StringWidth(text_kills)) + 16) * FontScale; + bonus_x = kills_x + ((bonus_len = displayFont.StringWidth(text_bonus)) + 16) * FontScale; + secret_x = bonus_x + ((secret_len = displayFont.StringWidth(text_secret)) + 16) * FontScale; x = (screen.GetWidth() - secret_x) >> 1; icon_x += x; @@ -246,11 +252,11 @@ class CoopStatusScreen : StatusScreen secret_x += x; - screen.DrawText(SmallFont, textcolor, name_x, y, Stringtable.Localize("$SCORE_NAME"), DTA_CleanNoMove, true); - screen.DrawText(SmallFont, textcolor, kills_x - SmallFont.StringWidth(text_kills)*CleanXfac, y, text_kills, DTA_CleanNoMove, true); - screen.DrawText(SmallFont, textcolor, bonus_x - bonus_len*CleanXfac, y, text_bonus, DTA_CleanNoMove, true); - screen.DrawText(SmallFont, textcolor, secret_x - secret_len*CleanXfac, y, text_secret, DTA_CleanNoMove, true); - y += height + 6 * CleanYfac; + drawTextScaled(displayFont, name_x, y, Stringtable.Localize("$SCORE_NAME"), FontScale, textcolor); + drawTextScaled(displayFont, kills_x - displayFont.StringWidth(text_kills) * FontScale, y, text_kills, FontScale, textcolor); + drawTextScaled(displayFont, bonus_x - bonus_len * FontScale, y, text_bonus, FontScale, textcolor); + drawTextScaled(displayFont, secret_x - secret_len * FontScale, y, text_secret, FontScale, textcolor); + y += height + 6 * FontScale; missed_kills = wbs.maxkills; missed_items = wbs.maxitems; @@ -274,16 +280,16 @@ class CoopStatusScreen : StatusScreen { screen.DrawTexture(player.mo.ScoreIcon, true, icon_x, y, DTA_CleanNoMove, true); } - screen.DrawText(SmallFont, thiscolor, name_x, y + ypadding, player.GetUserName(), DTA_CleanNoMove, true); - drawPercent(SmallFont, kills_x, y + ypadding, cnt_kills[i], wbs.maxkills, false, thiscolor, true); + drawTextScaled(displayFont, name_x, y + ypadding, player.GetUserName(), FontScale, thiscolor); + drawPercentScaled(displayFont, kills_x, y + ypadding, cnt_kills[i], wbs.maxkills, FontScale, thiscolor); missed_kills -= cnt_kills[i]; if (ng_state >= 4) { - drawPercent(SmallFont, bonus_x, y + ypadding, cnt_items[i], wbs.maxitems, false, thiscolor, true); + drawPercentScaled(displayFont, bonus_x, y + ypadding, cnt_items[i], wbs.maxitems, FontScale, thiscolor); missed_items -= cnt_items[i]; if (ng_state >= 6) { - drawPercent(SmallFont, secret_x, y + ypadding, cnt_secret[i], wbs.maxsecret, false, thiscolor, true); + drawPercentScaled(displayFont, secret_x, y + ypadding, cnt_secret[i], wbs.maxsecret, FontScale, thiscolor); missed_secrets -= cnt_secret[i]; } } @@ -292,28 +298,28 @@ class CoopStatusScreen : StatusScreen // Draw "MISSED" line y += 3 * CleanYfac; - screen.DrawText(SmallFont, Font.CR_DARKGRAY, name_x, y, Stringtable.Localize("$SCORE_MISSED"), DTA_CleanNoMove, true); - drawPercent(SmallFont, kills_x, y, missed_kills, wbs.maxkills, false, Font.CR_DARKGRAY, true); + drawTextScaled(displayFont, name_x, y, Stringtable.Localize("$SCORE_MISSED"), FontScale, Font.CR_DARKGRAY); + drawPercentScaled(displayFont, kills_x, y, missed_kills, wbs.maxkills, FontScale, Font.CR_DARKGRAY); if (ng_state >= 4) { - drawPercent(SmallFont, bonus_x, y, missed_items, wbs.maxitems, false, Font.CR_DARKGRAY, true); + drawPercentScaled(displayFont, bonus_x, y, missed_items, wbs.maxitems, FontScale, Font.CR_DARKGRAY); if (ng_state >= 6) { - drawPercent(SmallFont, secret_x, y, missed_secrets, wbs.maxsecret, false, Font.CR_DARKGRAY, true); + drawPercentScaled(displayFont, secret_x, y, missed_secrets, wbs.maxsecret, FontScale, Font.CR_DARKGRAY); } } // Draw "TOTAL" line y += height + 3 * CleanYfac; - screen.DrawText(SmallFont, textcolor, name_x, y, Stringtable.Localize("$SCORE_TOTAL"), DTA_CleanNoMove, true); - drawNum(SmallFont, kills_x, y, wbs.maxkills, 0, false, textcolor, true); + drawTextScaled(displayFont, name_x, y, Stringtable.Localize("$SCORE_TOTAL"), FontScale, textcolor); + drawNumScaled(displayFont, kills_x, y, FontScale, wbs.maxkills, 0, textcolor); if (ng_state >= 4) { - drawNum(SmallFont, bonus_x, y, wbs.maxitems, 0, false, textcolor, true); + drawNumScaled(displayFont, bonus_x, y, FontScale, wbs.maxitems, 0, textcolor); if (ng_state >= 6) { - drawNum(SmallFont, secret_x, y, wbs.maxsecret, 0, false, textcolor, true); + drawNumScaled(displayFont, secret_x, y, FontScale, wbs.maxsecret, 0, textcolor); } } } -} \ No newline at end of file +} From dbb93d6c08d75670641a27877648fd3200f141ee Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 17 Mar 2019 16:17:12 +0700 Subject: [PATCH 31/34] option search improvements 1. Top-level menu names are now properly handled. 2. Changing "Any or All terms" option now immediately updates the results. 3. Reformatted menu.zs to have tabs instead of spaces. --- wadsrc/static/zscript.txt | 1 + .../zscript/ui/menu/search/anyoralloption.zs | 33 ++ wadsrc/static/zscript/ui/menu/search/menu.zs | 306 +++++++++--------- wadsrc/static/zscript/ui/menu/search/query.zs | 5 - .../zscript/ui/menu/search/searchfield.zs | 7 +- 5 files changed, 194 insertions(+), 158 deletions(-) create mode 100644 wadsrc/static/zscript/ui/menu/search/anyoralloption.zs diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index 54e5f00b8..510adc8f5 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -256,6 +256,7 @@ version "3.8" #include "zscript/ui/menu/search/menu.zs" #include "zscript/ui/menu/search/searchfield.zs" #include "zscript/ui/menu/search/query.zs" +#include "zscript/ui/menu/search/anyoralloption.zs" #include "zscript/ui/statscreen/statscreen.zs" #include "zscript/ui/statscreen/statscreen_coop.zs" diff --git a/wadsrc/static/zscript/ui/menu/search/anyoralloption.zs b/wadsrc/static/zscript/ui/menu/search/anyoralloption.zs new file mode 100644 index 000000000..69c1f53f9 --- /dev/null +++ b/wadsrc/static/zscript/ui/menu/search/anyoralloption.zs @@ -0,0 +1,33 @@ +//============================================================================= +// +// os_AnyOrAllOption class represents an Option Item for Option Search menu. +// Changing the value of this option causes the menu to refresh the search +// results. +// +//============================================================================= + +class os_AnyOrAllOption : OptionMenuItemOption +{ + os_AnyOrAllOption Init(os_Menu menu) + { + Super.Init("", "os_isanyof", "os_isanyof_values"); + + mMenu = menu; + + return self; + } + + override bool MenuEvent(int mkey, bool fromcontroller) + { + bool result = Super.MenuEvent(mkey, fromcontroller); + + if (mKey == Menu.MKEY_Left || mKey == Menu.MKEY_Right) + { + mMenu.search(); + } + + return result; + } + + private os_Menu mMenu; +} diff --git a/wadsrc/static/zscript/ui/menu/search/menu.zs b/wadsrc/static/zscript/ui/menu/search/menu.zs index f8cd06e82..423be0250 100644 --- a/wadsrc/static/zscript/ui/menu/search/menu.zs +++ b/wadsrc/static/zscript/ui/menu/search/menu.zs @@ -8,205 +8,211 @@ class os_Menu : OptionMenu { - override void Init(Menu parent, OptionMenuDescriptor desc) - { - Super.Init(parent, desc); + override void Init(Menu parent, OptionMenuDescriptor desc) + { + Super.Init(parent, desc); - mDesc.mItems.clear(); + mDesc.mItems.clear(); - addSearchField(); + addSearchField(); - mDesc.mScrollPos = 0; - mDesc.mSelectedItem = 0; - mDesc.CalcIndent(); - } + mDesc.mScrollPos = 0; + mDesc.mSelectedItem = 0; + mDesc.CalcIndent(); + } - void search(os_Query query) - { - mDesc.mItems.clear(); + void search() + { + string text = mSearchField.GetText(); + let query = os_Query.fromString(text); + bool isAnyTermMatches = mIsAnyOfItem.mCVar.GetBool(); - addSearchField(query.getText()); + mDesc.mItems.clear(); - string path = StringTable.Localize("$OPTMNU_TITLE"); - bool isAnyTermMatches = mIsAnyOfItem.mCVar.GetBool(); - bool found = listOptions(mDesc, "MainMenu", query, path, isAnyTermMatches); + addSearchField(text); - if (!found) { addNoResultsItem(mDesc); } + bool found = listOptions(mDesc, "MainMenu", query, "", isAnyTermMatches); - mDesc.CalcIndent(); - } + if (!found) { addNoResultsItem(mDesc); } - private void addSearchField(string query = "") - { - string searchLabel = StringTable.Localize("$OS_LABEL"); - let searchField = new("os_SearchField").Init(searchLabel, self, query); + mDesc.CalcIndent(); + } - mIsAnyOfItem = new("OptionMenuItemOption").Init("", "os_isanyof", "os_isanyof_values"); + private void addSearchField(string query = "") + { + string searchLabel = StringTable.Localize("$OS_LABEL"); - mDesc.mItems.push(searchField); - mDesc.mItems.push(mIsAnyOfItem); - addEmptyLine(mDesc); - } + mSearchField = new("os_SearchField").Init(searchLabel, self, query); + mIsAnyOfItem = new("os_AnyOrAllOption").Init(self); - private static bool listOptions(OptionMenuDescriptor targetDesc, - string menuName, - os_Query query, - string path, - bool isAnyTermMatches) - { - let desc = MenuDescriptor.GetDescriptor(menuName); - let listMenuDesc = ListMenuDescriptor(desc); + mDesc.mItems.push(mSearchField); + mDesc.mItems.push(mIsAnyOfItem); + addEmptyLine(mDesc); + } - if (listMenuDesc) - { - return listOptionsListMenu(listMenuDesc, targetDesc, query, path, isAnyTermMatches); - } + private static bool listOptions(OptionMenuDescriptor targetDesc, + string menuName, + os_Query query, + string path, + bool isAnyTermMatches) + { + let desc = MenuDescriptor.GetDescriptor(menuName); + let listMenuDesc = ListMenuDescriptor(desc); - let optionMenuDesc = OptionMenuDescriptor(desc); + if (listMenuDesc) + { + return listOptionsListMenu(listMenuDesc, targetDesc, query, path, isAnyTermMatches); + } - if (optionMenuDesc) - { - return listOptionsOptionMenu(optionMenuDesc, targetDesc, query, path, isAnyTermMatches); - } + let optionMenuDesc = OptionMenuDescriptor(desc); - return false; - } + if (optionMenuDesc) + { + return listOptionsOptionMenu(optionMenuDesc, targetDesc, query, path, isAnyTermMatches); + } - private static bool listOptionsListMenu(ListMenuDescriptor sourceDesc, - OptionMenuDescriptor targetDesc, - os_Query query, - string path, - bool isAnyTermMatches) - { - int nItems = sourceDesc.mItems.size(); - bool found = false; + return false; + } - for (int i = 0; i < nItems; ++i) - { - let item = sourceDesc.mItems[i]; - string actionN = item.GetAction(); - string newPath = (actionN == "Optionsmenu") - ? StringTable.Localize("$OPTMNU_TITLE") - : StringTable.Localize("$OS_MAIN"); + private static bool listOptionsListMenu(ListMenuDescriptor sourceDesc, + OptionMenuDescriptor targetDesc, + os_Query query, + string path, + bool isAnyTermMatches) + { + int nItems = sourceDesc.mItems.size(); + bool found = false; - found |= listOptions(targetDesc, actionN, query, newPath, isAnyTermMatches); - } + for (int i = 0; i < nItems; ++i) + { + let item = sourceDesc.mItems[i]; + string actionN = item.GetAction(); + let textItem = ListMenuItemTextItem(item); + string newPath = textItem + ? makePath(path, textItem.mText) + : path; - return found; - } + found |= listOptions(targetDesc, actionN, query, newPath, isAnyTermMatches); + } - private static bool listOptionsOptionMenu(OptionMenuDescriptor sourceDesc, - OptionMenuDescriptor targetDesc, - os_Query query, - string path, - bool isAnyTermMatches) - { - if (sourceDesc == targetDesc) { return false; } + return found; + } - int nItems = sourceDesc.mItems.size(); - bool first = true; - bool found = false; + private static bool listOptionsOptionMenu(OptionMenuDescriptor sourceDesc, + OptionMenuDescriptor targetDesc, + os_Query query, + string path, + bool isAnyTermMatches) + { + if (sourceDesc == targetDesc) { return false; } - for (int i = 0; i < nItems; ++i) - { - let item = sourceDesc.mItems[i]; + int nItems = sourceDesc.mItems.size(); + bool first = true; + bool found = false; - if (item is "OptionMenuItemStaticText") { continue; } + for (int i = 0; i < nItems; ++i) + { + let item = sourceDesc.mItems[i]; - string label = StringTable.Localize(item.mLabel); + if (item is "OptionMenuItemStaticText") { continue; } - if (!query.matches(label, isAnyTermMatches)) { continue; } + string label = StringTable.Localize(item.mLabel); - found = true; + if (!query.matches(label, isAnyTermMatches)) { continue; } - if (first) - { - addEmptyLine(targetDesc); - addPathItem(targetDesc, path); + found = true; - first = false; - } + if (first) + { + addEmptyLine(targetDesc); + addPathItem(targetDesc, path); - let itemOptionBase = OptionMenuItemOptionBase(item); + first = false; + } - if (itemOptionBase) - { - itemOptionBase.mCenter = false; - } + let itemOptionBase = OptionMenuItemOptionBase(item); - targetDesc.mItems.push(item); - } + if (itemOptionBase) + { + itemOptionBase.mCenter = false; + } - for (int i = 0; i < nItems; ++i) - { - let item = sourceDesc.mItems[i]; - string label = StringTable.Localize(item.mLabel); - string optionSearchTitle = StringTable.Localize("$OS_TITLE"); + targetDesc.mItems.push(item); + } - if (label == optionSearchTitle) { continue; } + for (int i = 0; i < nItems; ++i) + { + let item = sourceDesc.mItems[i]; + string label = StringTable.Localize(item.mLabel); + string optionSearchTitle = StringTable.Localize("$OS_TITLE"); - if (item is "OptionMenuItemSubMenu") - { - string newPath = makePath(path, label); + if (label == optionSearchTitle) { continue; } - found |= listOptions(targetDesc, item.GetAction(), query, newPath, isAnyTermMatches); - } - } + if (item is "OptionMenuItemSubMenu") + { + string newPath = makePath(path, label); - return found; - } + found |= listOptions(targetDesc, item.GetAction(), query, newPath, isAnyTermMatches); + } + } - private static string makePath(string path, string label) - { - int pathWidth = SmallFont.StringWidth(path .. "/" .. label); - int screenWidth = Screen.GetWidth(); - bool isTooWide = (pathWidth > screenWidth / 3); - string newPath = isTooWide - ? path .. "/" .. "\n" .. label - : path .. "/" .. label; + return found; + } - return newPath; - } + private static string makePath(string path, string label) + { + if (path.length() == 0) { return label; } - private static void addPathItem(OptionMenuDescriptor desc, string path) - { - Array lines; - path.split(lines, "\n"); + int pathWidth = SmallFont.StringWidth(path .. "/" .. label); + int screenWidth = Screen.GetWidth(); + bool isTooWide = (pathWidth > screenWidth / 3); + string newPath = isTooWide + ? path .. "/" .. "\n" .. label + : path .. "/" .. label; - int nLines = lines.size(); + return newPath; + } - for (int i = 0; i < nLines; ++i) - { - OptionMenuItemStaticText text = new("OptionMenuItemStaticText").Init(lines[i], 1); + private static void addPathItem(OptionMenuDescriptor desc, string path) + { + Array lines; + path.split(lines, "\n"); - desc.mItems.push(text); - } - } + int nLines = lines.size(); - private static void addEmptyLine(OptionMenuDescriptor desc) - { - int nItems = desc.mItems.size(); + for (int i = 0; i < nLines; ++i) + { + OptionMenuItemStaticText text = new("OptionMenuItemStaticText").Init(lines[i], 1); - if (nItems > 0) - { - let staticText = OptionMenuItemStaticText(desc.mItems[nItems - 1]); + desc.mItems.push(text); + } + } - if (staticText != null && staticText.mLabel == "") { return; } - } + private static void addEmptyLine(OptionMenuDescriptor desc) + { + int nItems = desc.mItems.size(); - let item = new("OptionMenuItemStaticText").Init(""); + if (nItems > 0) + { + let staticText = OptionMenuItemStaticText(desc.mItems[nItems - 1]); - desc.mItems.push(item); - } + if (staticText != null && staticText.mLabel == "") { return; } + } - private static void addNoResultsItem(OptionMenuDescriptor desc) - { - string noResults = StringTable.Localize("$OS_NO_RESULTS"); - let text = new("OptionMenuItemStaticText").Init(noResults, 0); + let item = new("OptionMenuItemStaticText").Init(""); - addEmptyLine(desc); - desc.mItems.push(text); - } + desc.mItems.push(item); + } - private OptionMenuItemOption mIsAnyOfItem; + private static void addNoResultsItem(OptionMenuDescriptor desc) + { + string noResults = StringTable.Localize("$OS_NO_RESULTS"); + let text = new("OptionMenuItemStaticText").Init(noResults, 0); + + addEmptyLine(desc); + desc.mItems.push(text); + } + + private os_AnyOrAllOption mIsAnyOfItem; + private os_SearchField mSearchField; } diff --git a/wadsrc/static/zscript/ui/menu/search/query.zs b/wadsrc/static/zscript/ui/menu/search/query.zs index 75e1d8395..691a85b59 100644 --- a/wadsrc/static/zscript/ui/menu/search/query.zs +++ b/wadsrc/static/zscript/ui/menu/search/query.zs @@ -19,8 +19,6 @@ class os_Query str.Split(query.mQueryParts, " ", TOK_SKIPEMPTY); - query.mText = str; - return query; } @@ -31,8 +29,6 @@ class os_Query : matchesAll(text); } - string getText() { return mText; } - // private: ////////////////////////////////////////////////////////////////// private bool matchesAny(string text) @@ -73,6 +69,5 @@ class os_Query return contains; } - private string mText; private Array mQueryParts; } diff --git a/wadsrc/static/zscript/ui/menu/search/searchfield.zs b/wadsrc/static/zscript/ui/menu/search/searchfield.zs index 194501022..8a0d962bb 100644 --- a/wadsrc/static/zscript/ui/menu/search/searchfield.zs +++ b/wadsrc/static/zscript/ui/menu/search/searchfield.zs @@ -30,10 +30,9 @@ class os_SearchField : OptionMenuItemTextField } if (mkey == Menu.MKEY_Input) { - string text = mEnter.GetText(); - let query = os_Query.fromString(text); + mtext = mEnter.GetText(); - mMenu.search(query); + mMenu.search(); } return Super.MenuEvent(mkey, fromcontroller); @@ -46,6 +45,8 @@ class os_SearchField : OptionMenuItemTextField : mText; } + String GetText() { return mText; } + private os_Menu mMenu; private string mText; } From b839da45ecacc4cb622a53c10840de7466928222 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 20:56:49 +0100 Subject: [PATCH 32/34] - Found two more unlocalized texts in the color picker. Due to space constraints a proper localization is not possible so these were replaced by a non-text. --- wadsrc/static/zscript/ui/menu/colorpickermenu.zs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wadsrc/static/zscript/ui/menu/colorpickermenu.zs b/wadsrc/static/zscript/ui/menu/colorpickermenu.zs index d7ed52057..b8d9f6444 100644 --- a/wadsrc/static/zscript/ui/menu/colorpickermenu.zs +++ b/wadsrc/static/zscript/ui/menu/colorpickermenu.zs @@ -327,8 +327,7 @@ class ColorpickerMenu : OptionMenu screen.Clear (x + 48*CleanXfac_1, y, x + 48*2*CleanXfac_1, y + 48*CleanYfac_1, newColor); y += 49*CleanYfac_1; - screen.DrawText (SmallFont, Font.CR_GRAY, x+(24-SmallFont.StringWidth("Old")/2)*CleanXfac_1, y, "Old", DTA_CleanNoMove_1, true); - screen.DrawText (SmallFont, Font.CR_WHITE, x+(48+24-SmallFont.StringWidth("New")/2)*CleanXfac_1, y, "New", DTA_CleanNoMove_1, true); + screen.DrawText (SmallFont, Font.CR_GRAY, x+(48-SmallFont.StringWidth("---->")/2)*CleanXfac_1, y, "---->", DTA_CleanNoMove_1, true); } override void OnDestroy() From 13f3bf2331e78d581ff2da85045f43bc60db1483 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 21:35:33 +0100 Subject: [PATCH 33/34] - add an option to print the kill, item and secret stats on the alternative HUD with the NewSmallFont. This has to be set in the console, the default is still the regular small font. Mainly added because some mods have really hard to read fonts where it is not easy to decipher the numbers. --- src/g_statusbar/shared_hud.cpp | 1 + wadsrc/static/zscript/ui/statusbar/alt_hud.zs | 30 ++++++++++++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/g_statusbar/shared_hud.cpp b/src/g_statusbar/shared_hud.cpp index 998d3f514..7a3350c46 100644 --- a/src/g_statusbar/shared_hud.cpp +++ b/src/g_statusbar/shared_hud.cpp @@ -55,6 +55,7 @@ CVAR(Int,hud_althudscale, 0, CVAR_ARCHIVE) // Scale the hud to 640x400? CVAR(Bool,hud_althud, false, CVAR_ARCHIVE) // Enable/Disable the alternate HUD +CVAR(Bool, hud_althudfont, false, CVAR_ARCHIVE) // Enable/Disable the alternate HUD // These are intentionally not the same as in the automap! CVAR (Bool, hud_showsecrets, true,CVAR_ARCHIVE); // Show secrets on HUD CVAR (Bool, hud_showmonsters, true,CVAR_ARCHIVE); // Show monster stats on HUD diff --git a/wadsrc/static/zscript/ui/statusbar/alt_hud.zs b/wadsrc/static/zscript/ui/statusbar/alt_hud.zs index f8befa09f..f3161df8d 100644 --- a/wadsrc/static/zscript/ui/statusbar/alt_hud.zs +++ b/wadsrc/static/zscript/ui/statusbar/alt_hud.zs @@ -170,14 +170,30 @@ class AltHud ui void DrawStatLine(int x, in out int y, String prefix, String text) { - y -= SmallFont.GetHeight()-1; - screen.DrawText(SmallFont, hudcolor_statnames, x, y, prefix, - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75); + if (!hud_althudfont) + { + y -= SmallFont.GetHeight()-1; + screen.DrawText(SmallFont, hudcolor_statnames, x, y, prefix, + DTA_KeepRatio, true, + DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75); - screen.DrawText(SmallFont, hudcolor_stats, x+statspace, y, text, - DTA_KeepRatio, true, - DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75); + screen.DrawText(SmallFont, hudcolor_stats, x+statspace, y, text, + DTA_KeepRatio, true, + DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75); + } + else + { + double horzscale = 1.5; + int downscale = 2; + y -= NewSmallFont.GetHeight() / downscale; + screen.DrawText(NewSmallFont, hudcolor_statnames, x * horzscale, y * downscale, prefix, + DTA_KeepRatio, true, + DTA_VirtualWidthF, hudwidth * horzscale, DTA_VirtualHeight, hudheight * downscale, DTA_Alpha, 0.75); + + screen.DrawText(NewSmallFont, hudcolor_stats, (x+statspace) * horzscale, y * downscale, text, + DTA_KeepRatio, true, + DTA_VirtualWidthF, hudwidth * horzscale, DTA_VirtualHeight, hudheight * downscale, DTA_Alpha, 0.75); + } } void DrawStatus(PlayerInfo CPlayer, int x, int y) From 54f5076b0fe584d9a2261ce74ac692d34b1fea4a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 22:00:28 +0100 Subject: [PATCH 34/34] - fixed option menu selector and slider bar positioning. --- wadsrc/static/zscript/ui/menu/optionmenu.zs | 2 +- wadsrc/static/zscript/ui/menu/optionmenuitems.zs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wadsrc/static/zscript/ui/menu/optionmenu.zs b/wadsrc/static/zscript/ui/menu/optionmenu.zs index 97e25af6d..c3b7dab52 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenu.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenu.zs @@ -468,7 +468,7 @@ class OptionMenu : Menu { if (((MenuTime() % 8) < 6) || GetCurrentMenu() != self) { - DrawConText(OptionMenuSettings.mFontColorSelection, cur_indent + 3 * CleanXfac_1, y+fontheight-9*CleanYfac_1, "\xd"); + DrawOptionText(cur_indent + 3 * CleanXfac_1, y, Font.CR_UNTRANSLATED, "◄"); } } y += fontheight; diff --git a/wadsrc/static/zscript/ui/menu/optionmenuitems.zs b/wadsrc/static/zscript/ui/menu/optionmenuitems.zs index 58ac07cdd..19fb0429d 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenuitems.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenuitems.zs @@ -728,7 +728,7 @@ class OptionMenuSliderBase : OptionMenuItem double range; int maxlen = 0; int right = x + (12*8 + 4) * CleanXfac; // length of slider. This uses the old ConFont and - int cy = y; + int cy = y + CleanYFac; range = max - min; double ccur = clamp(cur, min, max) - min;