From 86784ae91af299d75fbf1e81eb13ff0bef42439e Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 9 Jul 2023 20:56:25 +0100 Subject: [PATCH] Add Menu Font (without using it anywhere) Content of commit was originally written by Sal, but as a monolithic commit. The author of this commit is chunking it up for easier review. Adds the additional font. This requires a little cleanup before we can use it as the primary menu font, but worth at least putting this in the relevant places for later. --- src/hu_stuff.c | 4 ++++ src/hu_stuff.h | 1 + src/v_video.cpp | 16 ++++++++++++++++ src/v_video.h | 9 +++++++++ 4 files changed, 30 insertions(+) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 9ff155e8b..d41bd60c9 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -255,6 +255,10 @@ void HU_Init(void) PR ("STCFN"); REG; + + PR ("MNUFN"); + REG; + PR ("TNYFN"); REG; diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 86024d979..92ecdbc41 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -67,6 +67,7 @@ extern "C" { enum { X (HU), + X (MENU), X (TINY), X (FILE), diff --git a/src/v_video.cpp b/src/v_video.cpp index 971afa013..25903e390 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -2291,6 +2291,7 @@ void V_DrawStringScaled( { default: case HU_FONT: + case MENU_FONT: spacew = 4; switch (spacing) { @@ -2361,6 +2362,7 @@ void V_DrawStringScaled( { default: case HU_FONT: + case MENU_FONT: case TINY_FONT: case KART_FONT: lfh = 12; @@ -2603,6 +2605,7 @@ fixed_t V_StringScaledWidth( { default: case HU_FONT: + case MENU_FONT: spacew = 4; switch (spacing) { @@ -2671,6 +2674,7 @@ fixed_t V_StringScaledWidth( { default: case HU_FONT: + case MENU_FONT: case TINY_FONT: case KART_FONT: lfh = 12; @@ -2913,6 +2917,18 @@ void V_DrawRightAlignedTimerString(INT32 x, INT32 y, INT32 option, const char *s V_DrawTimerString(x, y, option, string); } +void V_DrawCenteredMenuString(INT32 x, INT32 y, INT32 option, const char *string) +{ + x -= V_MenuStringWidth(string, option)/2; + V_DrawMenuString(x, y, option, string); +} + +void V_DrawRightAlignedMenuString(INT32 x, INT32 y, INT32 option, const char *string) +{ + x -= V_MenuStringWidth(string, option); + V_DrawMenuString(x, y, option, string); +} + void V_DrawCenteredGamemodeString(INT32 x, INT32 y, INT32 option, const UINT8 *colormap, const char *string) { x -= V_GamemodeStringWidth(string, option)/2; diff --git a/src/v_video.h b/src/v_video.h index 441f23c0b..eeaf5d288 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -374,6 +374,15 @@ void V_DrawProfileNum(INT32 x, INT32 y, INT32 flags, UINT8 num); void V_DrawCenteredTimerString(INT32 x, INT32 y, INT32 option, const char *string); void V_DrawRightAlignedTimerString(INT32 x, INT32 y, INT32 option, const char *string); +#define V_DrawMenuString( x,y,option,string ) \ + V__DrawDupxString (x,y,FRACUNIT,option,NULL,MENU_FONT,string) + +#define V_MenuStringWidth( string,option ) \ + V__IntegerStringWidth ( FRACUNIT,option,MENU_FONT,string ) + +void V_DrawCenteredMenuString(INT32 x, INT32 y, INT32 option, const char *string); +void V_DrawRightAlignedMenuString(INT32 x, INT32 y, INT32 option, const char *string); + #define V_DrawGamemodeString( x,y,option,cm,string ) \ V__DrawDupxString (x,y,FRACUNIT,option,cm,GM_FONT,string)