Load titlecard font with font system

This commit is contained in:
James R 2021-12-17 01:40:58 -08:00
parent 8012d00684
commit 8de36a9ab0
3 changed files with 19 additions and 35 deletions

View file

@ -73,8 +73,6 @@
patch_t *pinggfx[5]; // small ping graphic
patch_t *mping[5]; // smaller ping graphic
patch_t *tc_font[2][LT_FONTSIZE]; // Special font stuff for titlecard
patch_t *framecounter;
patch_t *frameslash; // framerate stuff. Used in screen.c
@ -180,8 +178,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum);
void HU_LoadGraphics(void)
{
char buffer[9];
INT32 i, j;
INT32 i;
if (dedicated)
return;
@ -194,27 +191,6 @@ void HU_LoadGraphics(void)
emblemicon = HU_CachePatch("EMBLICON");
songcreditbg = HU_CachePatch("K_SONGCR");
// Cache titlecard font
j = LT_FONTSTART;
for (i = 0; i < LT_FONTSIZE; i++, j++)
{
// cache the titlecard font
// Bottom layer
sprintf(buffer, "GTOL%.3d", j);
if (W_CheckNumForName(buffer) == LUMPERROR)
tc_font[0][i] = NULL;
else
tc_font[0][i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
// Top layer
sprintf(buffer, "GTFN%.3d", j);
if (W_CheckNumForName(buffer) == LUMPERROR)
tc_font[1][i] = NULL;
else
tc_font[1][i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
}
// cache ping gfx:
for (i = 0; i < 5; i++)
{
@ -279,6 +255,16 @@ void HU_Init(void)
PR ("CRFNT");
REG;
DIG (3);
ADIM (LT);
PR ("GTOL");
REG;
PR ("GTFN");
REG;
DIG (1);
DIM (0, 10);

View file

@ -39,11 +39,6 @@
#define LT_FONTEND 'z' // the last font characters
#define LT_FONTSIZE (LT_FONTEND - LT_FONTSTART + 1)
// Under regular circumstances, we'd use the built in font stuff, however this font is a bit messy because of how we're gonna draw shit.
// tc_font[0][n] is used for the "bottom" layer
// tc_font[1][n] is used for the "top" layer
extern patch_t *tc_font[2][LT_FONTSIZE];
#define CRED_FONTSTART '!' // the first font character
#define CRED_FONTEND 'Z' // the last font character
#define CRED_FONTSIZE (CRED_FONTEND - CRED_FONTSTART + 1)
@ -59,6 +54,9 @@ enum
X (LT),
X (CRED),
X (GTOL),
X (GTFN),
X (TALLNUM),
X (NIGHTSNUM),
X (PINGNUM),

View file

@ -1701,13 +1701,13 @@ INT32 V_TitleCardStringWidth(const char *str)
c -= LT_FONTSTART;
// check if character exists, if not, it's a space.
if (c < 0 || c >= LT_FONTSIZE || !tc_font[0][(INT32)c])
if (c < 0 || c >= LT_FONTSIZE || !fontv[GTOL_FONT].font[(INT32)c])
{
xoffs += 10;
continue;
}
pp = tc_font[1][(INT32)c];
pp = fontv[GTFN_FONT].font[(INT32)c];
xoffs += pp->width-5;
}
@ -1768,14 +1768,14 @@ void V_DrawTitleCardString(INT32 x, INT32 y, const char *str, INT32 flags, boole
c -= LT_FONTSTART;
// check if character exists, if not, it's a space.
if (c < 0 || c >= LT_FONTSIZE || !tc_font[1][(INT32)c])
if (c < 0 || c >= LT_FONTSIZE || !fontv[GTFN_FONT].font[(INT32)c])
{
xoffs += 10;
continue;
}
ol = tc_font[0][(INT32)c];
pp = tc_font[1][(INT32)c];
ol = fontv[GTOL_FONT].font[(INT32)c];
pp = fontv[GTFN_FONT].font[(INT32)c];
if (timer)
{