diff --git a/source/common/utility/utf8.cpp b/source/common/utility/utf8.cpp index 2341d575c33..b0b225ae5cd 100644 --- a/source/common/utility/utf8.cpp +++ b/source/common/utility/utf8.cpp @@ -354,6 +354,8 @@ int getAlternative(int code) default: return code; + case '{': return '('; + case '}': return ')'; case 0x17f: return 's'; // The 'long s' can be safely remapped to the regular variant, not that this gets used in any real text... case 0x218: return 0x15e; // Romanian S with comma below may get remapped to S with cedilla. case 0x219: return 0x15f; diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index e831f8897b3..90ed5e05259 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -82,6 +82,9 @@ CVAR(Bool, autoloadlights, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(Bool, autoloadbrightmaps, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Bool, autoloadwidescreen, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +// Note: For the automap label there is a separate option "am_textfont". +CVARD(Bool, hud_textfont, false, CVAR_ARCHIVE, "Use the regular text font as replacement for the tiny 3x5 font for HUD messages whenever possible") + EXTERN_CVAR(Bool, ui_generic) CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG) diff --git a/source/core/gamecontrol.h b/source/core/gamecontrol.h index 67317518f5d..748a5d80bf2 100644 --- a/source/core/gamecontrol.h +++ b/source/core/gamecontrol.h @@ -12,6 +12,8 @@ #include "i_time.h" #include "palentry.h" +EXTERN_CVAR(Bool, hud_textfont) + extern bool sendsave; extern FString savedescription; extern FString savegamefile; diff --git a/source/games/sw/src/menus.h b/source/games/sw/src/menus.h index 6ee40e181cb..0a973affb84 100644 --- a/source/games/sw/src/menus.h +++ b/source/games/sw/src/menus.h @@ -32,8 +32,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -void MNU_DrawSmallString(int x, int y, const char* string, int shade, int pal, int align = -1, double alpha = 1); - END_SW_NS #endif diff --git a/source/games/sw/src/sbar.cpp b/source/games/sw/src/sbar.cpp index 403cca123f0..019552680d9 100644 --- a/source/games/sw/src/sbar.cpp +++ b/source/games/sw/src/sbar.cpp @@ -74,15 +74,6 @@ static void UpdateFrame(void) // //--------------------------------------------------------------------------- -void DrawConString(int x, int y, const char* string, double alpha) -{ - x = x * 2 - SmallFont->StringWidth(string) / 2; - y *= 2; - DrawText(twod, SmallFont, CR_TAN, x, y, string, DTA_FullscreenScale, FSMode_Fit640x400, DTA_Alpha, alpha, TAG_DONE); - -} - - void UpdateStatusBar() { if (hud_size <= Hud_Stbar) @@ -105,13 +96,23 @@ void UpdateStatusBar() { const int MESSAGE_LINE = 142; // Used to be 164 - if (!SmallFont2->CanPrint(pp->cookieQuote)) - DrawConString(160, MESSAGE_LINE, pp->cookieQuote, clamp(pp->cookieTime / 60., 0., 1.)); + if (hud_textfont || !SmallFont2->CanPrint(pp->cookieQuote)) + { + int x = 320 - SmallFont->StringWidth(pp->cookieQuote) / 2; + DrawText(twod, SmallFont, CR_UNDEFINED, x, MESSAGE_LINE*2, pp->cookieQuote, DTA_FullscreenScale, FSMode_Fit640x400, + DTA_Alpha, clamp(pp->cookieTime / 60., 0., 1.), TAG_DONE); + } else - MNU_DrawSmallString(160, MESSAGE_LINE, pp->cookieQuote, 0, 0, 0, clamp(pp->cookieTime / 60., 0., 1.)); + { + int x = 160 - SmallFont2->StringWidth(pp->cookieQuote) / 2; + DrawText(twod, SmallFont2, CR_UNDEFINED, x, MESSAGE_LINE, pp->cookieQuote, DTA_FullscreenScale, FSMode_Fit320x200, + DTA_Alpha, clamp(pp->cookieTime / 60., 0., 1.), TAG_DONE); + + } } } + END_SW_NS diff --git a/source/games/sw/src/text.cpp b/source/games/sw/src/text.cpp index 53d806abcae..1d69c4e1335 100644 --- a/source/games/sw/src/text.cpp +++ b/source/games/sw/src/text.cpp @@ -102,25 +102,6 @@ void InitFonts() BigFont->SetKerning(1); } -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -void MNU_DrawSmallString(int x, int y, const char* string, int shade, int pal, int align, double alpha) -{ - if (align > -1) - { - int w = SmallFont2->StringWidth(string); - if (align == 0) x -= w / 2; - else x -= w; - } - DrawText(twod, SmallFont2, CR_UNDEFINED, x, y, string, DTA_FullscreenScale, FSMode_Fit320x200, - DTA_Color, shadeToLight(shade), DTA_TranslationIndex, TRANSLATION(Translation_Remap, pal), DTA_Alpha, alpha, TAG_DONE); - -} - //--------------------------------------------------------------------------- // // Notification messages. Native SW-style display should later be diff --git a/wadsrc/static/zscript/games/blood/ui/screens.zs b/wadsrc/static/zscript/games/blood/ui/screens.zs index 0419255f857..8bb8282f23d 100644 --- a/wadsrc/static/zscript/games/blood/ui/screens.zs +++ b/wadsrc/static/zscript/games/blood/ui/screens.zs @@ -123,6 +123,20 @@ struct BloodScreen } + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- + + static void DrawLocalizedText(int x, int y, String text, int position = 1) + { + let text = StringTable.Localize(text); + if (hud_textfont || !SmallFont2.CanPrint(text)) + DrawText(SmallFont, text, x, y, 1); + else + DrawText(SmallFont2, text, x, y, 1, shadow: true); + } } //--------------------------------------------------------------------------- @@ -184,9 +198,7 @@ class BloodSummaryScreen : SummaryScreenBase BloodScreen.DrawCaption("$TXTB_LEVELSTATS", 0, true); if (stats.cheated) { - let text = StringTable.Localize("$TXTB_CHEATED"); - let font = SmallFont2.CanPrint(text)? SmallFont2 : SmallFont; - BloodScreen.DrawText(font, text, 160, 32, 1, shadow:font == SmallFont2); + BloodScreen.DrawLocalizedText(160, 32, "$TXTB_CHEATED"); } DrawKills(); DrawSecrets(); @@ -194,9 +206,7 @@ class BloodSummaryScreen : SummaryScreenBase int myclock = ticks * 120 / GameTicRate; if ((myclock & 32)) { - let text = StringTable.Localize("$PRESSKEY"); - let font = SmallFont2.CanPrint(text)? SmallFont2 : SmallFont; - BloodScreen.DrawText(font, text, 160, 134, 1, shadow:font == SmallFont2); + BloodScreen.DrawLocalizedText(160, 134, "$PRESSKEY"); } } @@ -227,37 +237,10 @@ class BloodMPSummaryScreen : SkippableScreenJob Blood.sndStartSample(268, 128, -1, false, CHANF_UI); } - void DrawKills() - { - String pBuffer; - BloodScreen.DrawText(SmallFont2, "#", 85, 35); - BloodScreen.DrawText(SmallFont2, "$NAME", 100, 35); - BloodScreen.DrawText(SmallFont2, "$FRAGS", 210, 35); - - for (int i = 0; i < numplayers; i++) - { - pBuffer = String.Format( "%-2d", i); - BloodScreen.DrawText(SmallFont2, pBuffer, 85, 50 + 8 * i); - pBuffer = String.Format( "%s", Raze.PlayerName(i)); - BloodScreen.DrawText(SmallFont2, pBuffer, 100, 50 + 8 * i); - pBuffer = String.Format( "%d", Raze.playerFrags(i, -1)); - BloodScreen.DrawText(SmallFont2, pBuffer, 210, 50 + 8 * i); - } - } - override void Draw(double sr) { BloodScreen.DrawBackground(); - BloodScreen.DrawCaption("$TXTB_FRAGSTATS", 0, true); - DrawKills(); - - int myclock = ticks * 120 / GameTicRate; - if ((myclock & 32)) - { - let text = StringTable.Localize("$PRESSKEY"); - let font = SmallFont2.CanPrint(text)? SmallFont2 : SmallFont; - BloodScreen.DrawText(font, text, 160, 134, 1, shadow:font == SmallFont2); - } + Raze.DrawScoreboard(60); } } @@ -293,10 +276,7 @@ class BloodLoadScreen : ScreenJob BloodScreen.DrawBackground(); BloodScreen.DrawCaption(loadtext, 0, true); BloodScreen.DrawText(BigFont, rec.DisplayName(), 160, 50, 1); - - let text = StringTable.Localize("$TXTB_PLSWAIT"); - let font = SmallFont2.CanPrint(text)? SmallFont2 : SmallFont; - BloodScreen.DrawText(font, text, 160, 134, 1, shadow:font == SmallFont2); + BloodScreen.DrawLocalizedText(160, 134, "$TXTB_PLSWAIT"); } } diff --git a/wadsrc/static/zscript/games/duke/dukegame.zs b/wadsrc/static/zscript/games/duke/dukegame.zs index 6445ee80bc0..d6fe70d8665 100644 --- a/wadsrc/static/zscript/games/duke/dukegame.zs +++ b/wadsrc/static/zscript/games/duke/dukegame.zs @@ -110,21 +110,6 @@ struct Duke native if (align != -1) x -= SmallFont.StringWidth(t) * (align == 0 ? 0.5 : 1); Screen.DrawText(SmallFont, Font.CR_UNDEFINED, x, y + 2, t, DTA_FullscreenScale, fsmode, DTA_TranslationIndex, Translation.MakeID(Translation_Remap, trans), DTA_Color, Raze.shadeToLight(shade)); } - - static void MiniText(double x, double y, String t, int shade, int align = -1, int trans = 0) - { - int fsmode = FSMode_Fit320x200; - if (Raze.isRR()) - { - x *= 2; - y *= 2; - fsmode = FSMode_Fit640x400; - } - if (align != -1) x -= SmallFont2.StringWidth(t) * (align == 0 ? 0.5 : 1); - Screen.DrawText(SmallFont2, Font.CR_UNDEFINED, x, y, t, DTA_FullscreenScale, fsmode, DTA_TranslationIndex, Translation.MakeID(Translation_Remap, trans), DTA_Color, Raze.shadeToLight(shade)); - } - - } struct DukePlayer diff --git a/wadsrc/static/zscript/games/duke/ui/screens.zs b/wadsrc/static/zscript/games/duke/ui/screens.zs index 21b40210323..2988e7588d9 100644 --- a/wadsrc/static/zscript/games/duke/ui/screens.zs +++ b/wadsrc/static/zscript/games/duke/ui/screens.zs @@ -473,75 +473,7 @@ class DukeMultiplayerBonusScreen : SkippableScreenJob Screen.DrawTexture(TexMan.CheckForTexture("INGAMEDUKETHREEDEE"), true, 160, 34, DTA_FullscreenScale, FSMode_Fit320x200, DTA_CenterOffsetRel, true, DTA_ScaleX, titlescale, DTA_ScaleY, titlescale); if (Raze.isPlutoPak()) Screen.DrawTexture(TexMan.CheckForTexture("MENUPLUTOPAKSPRITE"), true, 260, 36, DTA_FullscreenScale, FSMode_Fit320x200, DTA_CenterOffsetRel, true); - Duke.GameText(160, isRR? 58 : 58 + 2, "$Multiplayer Totals", 0, 0); - Duke.GameText(160, 58 + 10, currentLevel.DisplayName(), 0, 0); - Duke.GameText(160, 165, "$Presskey", 8 - int(sin(currentclock / 10.) * 8), 0); - - int t = 0; - - Duke.MiniText(38, 80, "$Name", 0, -1, isRR? 0 : 8); - Duke.MiniText(269+20, 80, "$Kills", 0, 1, isRR? 0: 8); - - for (int i = 0; i < playerswhenstarted; i++) - { - tempbuf = String.Format("%-4d", i + 1); - Duke.MiniText(92 + (i * 23), 80, tempbuf, 0, -1, isRR? 0: 3); - } - - for (int i = 0; i < playerswhenstarted; i++) - { - int xfragtotal = 0; - tempbuf = String.Format("%d", i + 1); - - Duke.MiniText(30, 90 + t, tempbuf, 0); - Duke.MiniText(38, 90 + t, Raze.PlayerName(i), 0, -1, Raze.playerPalette(i)); - - for (int y = 0; y < playerswhenstarted; y++) - { - int frag = Raze.playerFrags(i, y); - if (i == y) - { - int fraggedself = Raze.playerFraggedSelf(y); - tempbuf = String.Format("%-4d", fraggedself); - Duke.MiniText(92 + (y * 23), 90 + t, tempbuf, 0, -1, isRR? 0: 2); - xfragtotal -= fraggedself; - } - else - { - tempbuf = String.Format("%-4d", frag); - Duke.MiniText(92 + (y * 23), 90 + t, tempbuf, 0); - xfragtotal += frag; - } - /* - if (myconnectindex == connecthead) - { - tempbuf = String.Format("stats %ld killed %ld %ld\n", i + 1, y + 1, frag); - sendscore(tempbuf); - } - */ - } - - tempbuf = String.Format("%-4d", xfragtotal); - Duke.MiniText(101 + (8 * 23), 90 + t, tempbuf, 0, -1, isRR? 0: 2); - - t += 7; - } - - for (int y = 0; y < playerswhenstarted; y++) - { - int yfragtotal = 0; - for (int i = 0; i < playerswhenstarted; i++) - { - if (i == y) - yfragtotal += Raze.playerFraggedself(i); - int frag = Raze.playerFrags(i, y); - yfragtotal += frag; - } - tempbuf = String.Format("%-4d", yfragtotal); - Duke.MiniText(92 + (y * 23), 96 + (8 * 7), tempbuf, 0, -1, isRR? 0: 2); - } - - Duke.MiniText(45, 96 + (8 * 7), "$Deaths", 0, -1, isRR? 0: 8); + Raze.DrawScoreboard(60); } } diff --git a/wadsrc/static/zscript/games/sw/swgame.zs b/wadsrc/static/zscript/games/sw/swgame.zs index 66217368ae3..c243632cef9 100644 --- a/wadsrc/static/zscript/games/sw/swgame.zs +++ b/wadsrc/static/zscript/games/sw/swgame.zs @@ -137,21 +137,6 @@ struct SW native Screen.DrawText(SmallFont, Font.CR_UNDEFINED, x, y, text, DTA_FullscreenScale, FSMode_Fit320x200, DTA_Color, Raze.shadeToLight(shade), DTA_TranslationIndex, Translation.MakeID(Translation_Remap, pal)); } - - //--------------------------------------------------------------------------- - // - // - // - //--------------------------------------------------------------------------- - - static void DrawSmallString(int x, int y, String text, int shade, int pal, int align = -1, double alpha = 1.) - { - if (align != -1) x -= SmallFont2.StringWidth(text) * (align == 0 ? 0.5 : 1); - Screen.DrawText(SmallFont2, Font.CR_UNDEFINED, x, y, text, DTA_FullscreenScale, FSMode_Fit320x200, - DTA_Color, Raze.shadeToLight(shade), DTA_TranslationIndex, Translation.MakeID(Translation_Remap, pal), DTA_Alpha, alpha); - } - - } diff --git a/wadsrc/static/zscript/games/sw/ui/screens.zs b/wadsrc/static/zscript/games/sw/ui/screens.zs index e51ccb05ecf..7fcc76e05da 100644 --- a/wadsrc/static/zscript/games/sw/ui/screens.zs +++ b/wadsrc/static/zscript/games/sw/ui/screens.zs @@ -325,102 +325,8 @@ class SWMultiSummaryScreen : SkippableScreenJob override void Draw(double sr) { - int death_total[MAXPLAYERS]; - int kills[MAXPLAYERS]; - Screen.DrawTexture(TexMan.CheckForTexture("STAT_SCREEN_PIC", TexMan.Type_Any), true, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_LegacyRenderStyle, STYLE_Normal); - SW.DrawString(160, 68, "$MULTIPLAYER TOTALS", 0, 0); - SW.DrawString(160, 189, "$PRESSKEY", 0, 0, 0); - - int x = STAT_START_X; - int y = STAT_START_Y; - - // Hm.... how to translate this without messing up the formatting? - SW.DrawSmallString(x, y, " NAME 1 2 3 4 5 6 7 8 KILLS", 0, 0); - int rows = numplayers; - int cols = numplayers; - - y += STAT_HEADER_Y; - - String ds; - for (int i = 0; i < rows; i++) - { - x = STAT_START_X; - - ds = String.Format("%d", i + 1); - SW.DrawSmallString(x, y, ds, 0, 0); - - ds = String.Format(" %-13s", Raze.PlayerName(i)); - SW.DrawSmallString(x, y, ds, 0, Raze.playerPalette(i)); - - x = STAT_TABLE_X; - for (int j = 0; j < cols; j++) - { - int pal = 0; - int frags = Raze.PlayerFrags(i, j); - death_total[j] += frags; - - if (i == j) - { - // don't add kill for self or team player - pal = PALETTE_PLAYER0 + 4; - kills[i] -= frags; // subtract self kills - } - else if (false/*gNet.TeamPlay*/) - { - if (Raze.playerPalette(i) == Raze.playerPalette(j)) - { - // don't add kill for self or team player - pal = PALETTE_PLAYER0 + 4; - kills[i] -= frags; // subtract self kills - } - else - kills[i] += frags; // kills added here - } - else - { - kills[i] += frags; // kills added here - } - - ds = String.Format("%d", frags); - SW.DrawSmallString(x, y, ds, 0, pal); - x += STAT_TABLE_XOFF; - } - - y += STAT_OFF_Y; - } - - - // Deaths - - x = STAT_START_X; - y += STAT_OFF_Y; - - ds = String.Format(" %s", StringTable.Localize("$DEATHS")); - SW.DrawSmallString(x, y, ds, 0, 0); - x = STAT_TABLE_X; - - for (int j = 0; j < cols; j++) - { - ds = String.Format("%d", death_total[j]); - SW.DrawSmallString(x, y, ds, 0, 0); - x += STAT_TABLE_XOFF; - } - - x = STAT_START_X; - y += STAT_OFF_Y; - - // Kills - x = STAT_TABLE_X + 200; - y = STAT_START_Y + STAT_HEADER_Y; - - for (int i = 0; i < rows; i++) - { - ds = String.Format("%d", kills[i]); //pp.Kills); - SW.DrawSmallString(x, y, ds, 0, 0); - - y += STAT_OFF_Y; - } + Raze.DrawScoreboard(60); } } diff --git a/wadsrc/static/zscript/razebase.zs b/wadsrc/static/zscript/razebase.zs index a801d7b20d4..6a37bbd8bac 100644 --- a/wadsrc/static/zscript/razebase.zs +++ b/wadsrc/static/zscript/razebase.zs @@ -209,6 +209,12 @@ struct Raze { return 0; } + + static void DrawScoreboard(int top) + { + // todo: reimplement this in a game independent fashion based on GZDoom's code. + // Right now, with no MP support there is no need, though. + } }