Remove HU_ prefix from font start/end/size defines

This commit is contained in:
spherallic 2022-09-05 17:18:26 +02:00
parent 53896603b7
commit c74cbb6868
5 changed files with 42 additions and 42 deletions

View file

@ -1714,11 +1714,11 @@ static void CON_DrawHudlines(void)
} }
if (c >= con_width) if (c >= con_width)
break; break;
if (*p < HU_FONTSTART) if (*p < FONTSTART)
;//charwidth = 4 * con_scalefactor; ;//charwidth = 4 * con_scalefactor;
else else
{ {
//charwidth = (hu_font.chars['A'-HU_FONTSTART]->width) * con_scalefactor; //charwidth = (hu_font.chars['A'-FONTSTART]->width) * con_scalefactor;
V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, true); V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, true);
} }
} }

View file

@ -186,8 +186,8 @@ void HU_LoadGraphics(void)
if (dedicated) if (dedicated)
return; return;
j = HU_FONTSTART; j = FONTSTART;
for (i = 0; i < HU_FONTSIZE; i++, j++) for (i = 0; i < FONTSIZE; i++, j++)
{ {
// cache the heads-up font for entire game execution // cache the heads-up font for entire game execution
sprintf(buffer, "STCFN%.3d", j); sprintf(buffer, "STCFN%.3d", j);
@ -1137,7 +1137,7 @@ boolean HU_Responder(event_t *ev)
else else
c_input++; c_input++;
} }
else if ((c >= HU_FONTSTART && c <= HU_FONTEND && hu_font.chars[c-HU_FONTSTART]) else if ((c >= FONTSTART && c <= FONTEND && hu_font.chars[c-FONTSTART])
|| c == ' ') // Allow spaces, of course || c == ' ') // Allow spaces, of course
{ {
if (CHAT_MUTE || strlen(w_chat) >= HU_MAXMSGLEN) if (CHAT_MUTE || strlen(w_chat) >= HU_MAXMSGLEN)
@ -1207,9 +1207,9 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
if (!(option & V_ALLOWLOWERCASE)) if (!(option & V_ALLOWLOWERCASE))
c = toupper(c); c = toupper(c);
c -= HU_FONTSTART; c -= FONTSTART;
if (c < 0 || c >= HU_FONTSIZE || !hu_font.chars[c]) if (c < 0 || c >= FONTSIZE || !hu_font.chars[c])
{ {
chw = spacewidth; chw = spacewidth;
lastusablespace = i; lastusablespace = i;
@ -1267,7 +1267,7 @@ static void HU_drawMiniChat(void)
while(msg[j]) // iterate through msg while(msg[j]) // iterate through msg
{ {
if (msg[j] < HU_FONTSTART) // don't draw if (msg[j] < FONTSTART) // don't draw
{ {
if (msg[j] == '\n') // get back down. if (msg[j] == '\n') // get back down.
{ {
@ -1333,7 +1333,7 @@ static void HU_drawMiniChat(void)
while(msg[j]) // iterate through msg while(msg[j]) // iterate through msg
{ {
if (msg[j] < HU_FONTSTART) // don't draw if (msg[j] < FONTSTART) // don't draw
{ {
if (msg[j] == '\n') // get back down. if (msg[j] == '\n') // get back down.
{ {
@ -1432,7 +1432,7 @@ static void HU_drawChatLog(INT32 offset)
UINT8 *colormap = NULL; UINT8 *colormap = NULL;
while(msg[j]) // iterate through msg while(msg[j]) // iterate through msg
{ {
if (msg[j] < HU_FONTSTART) // don't draw if (msg[j] < FONTSTART) // don't draw
{ {
if (msg[j] == '\n') // get back down. if (msg[j] == '\n') // get back down.
{ {
@ -1460,7 +1460,7 @@ static void HU_drawChatLog(INT32 offset)
} }
dx += charwidth; dx += charwidth;
if (dx >= boxw-charwidth-2 && i<chat_nummsg_log && msg[j] >= HU_FONTSTART) // end of message shouldn't count, nor should invisible characters!!!! if (dx >= boxw-charwidth-2 && i<chat_nummsg_log && msg[j] >= FONTSTART) // end of message shouldn't count, nor should invisible characters!!!!
{ {
dx = 0; dx = 0;
dy += charheight; dy += charheight;
@ -1550,7 +1550,7 @@ static void HU_DrawChat(void)
while (talk[i]) while (talk[i])
{ {
if (talk[i] < HU_FONTSTART) if (talk[i] < FONTSTART)
++i; ++i;
else else
{ {
@ -1592,7 +1592,7 @@ static void HU_DrawChat(void)
} }
//Hurdler: isn't it better like that? //Hurdler: isn't it better like that?
if (w_chat[i] < HU_FONTSTART) if (w_chat[i] < FONTSTART)
++i; ++i;
else else
V_DrawChatCharacter(chatx + c + 2, y, w_chat[i++] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, true, NULL); V_DrawChatCharacter(chatx + c + 2, y, w_chat[i++] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, true, NULL);
@ -1691,8 +1691,8 @@ static void HU_DrawChat_Old(void)
size_t i = 0; size_t i = 0;
const char *ntalk = "Say: ", *ttalk = "Say-Team: "; const char *ntalk = "Say: ", *ttalk = "Say-Team: ";
const char *talk = ntalk; const char *talk = ntalk;
INT32 charwidth = 8 * con_scalefactor; //(hu_font.chars['A'-HU_FONTSTART]->width) * con_scalefactor; INT32 charwidth = 8 * con_scalefactor; //(hu_font.chars['A'-FONTSTART]->width) * con_scalefactor;
INT32 charheight = 8 * con_scalefactor; //(hu_font.chars['A'-HU_FONTSTART]->height) * con_scalefactor; INT32 charheight = 8 * con_scalefactor; //(hu_font.chars['A'-FONTSTART]->height) * con_scalefactor;
if (teamtalk) if (teamtalk)
{ {
talk = ttalk; talk = ttalk;
@ -1706,14 +1706,14 @@ static void HU_DrawChat_Old(void)
while (talk[i]) while (talk[i])
{ {
if (talk[i] < HU_FONTSTART) if (talk[i] < FONTSTART)
{ {
++i; ++i;
//charwidth = 4 * con_scalefactor; //charwidth = 4 * con_scalefactor;
} }
else else
{ {
//charwidth = (hu_font.chars[talk[i]-HU_FONTSTART]->width) * con_scalefactor; //charwidth = (hu_font.chars[talk[i]-FONTSTART]->width) * con_scalefactor;
V_DrawCharacter(HU_INPUTX + c, y, talk[i++] | cv_constextsize.value | V_NOSCALESTART, true); V_DrawCharacter(HU_INPUTX + c, y, talk[i++] | cv_constextsize.value | V_NOSCALESTART, true);
} }
c += charwidth; c += charwidth;
@ -1734,14 +1734,14 @@ static void HU_DrawChat_Old(void)
} }
//Hurdler: isn't it better like that? //Hurdler: isn't it better like that?
if (w_chat[i] < HU_FONTSTART) if (w_chat[i] < FONTSTART)
{ {
++i; ++i;
//charwidth = 4 * con_scalefactor; //charwidth = 4 * con_scalefactor;
} }
else else
{ {
//charwidth = (hu_font.chars[w_chat[i]-HU_FONTSTART]->width) * con_scalefactor; //charwidth = (hu_font.chars[w_chat[i]-FONTSTART]->width) * con_scalefactor;
V_DrawCharacter(HU_INPUTX + c, y, w_chat[i++] | cv_constextsize.value | V_NOSCALESTART | t, true); V_DrawCharacter(HU_INPUTX + c, y, w_chat[i++] | cv_constextsize.value | V_NOSCALESTART | t, true);
} }

View file

@ -21,9 +21,9 @@
//------------------------------------ //------------------------------------
// Fonts & stuff // Fonts & stuff
//------------------------------------ //------------------------------------
#define HU_FONTSTART '\x16' // the first font character #define FONTSTART '\x16' // the first font character
#define HU_FONTEND '~' #define FONTEND '~'
#define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1) #define FONTSIZE (FONTEND - FONTSTART + 1)
#define HU_CROSSHAIRS 3 // maximum of 9 - see HU_Init(); #define HU_CROSSHAIRS 3 // maximum of 9 - see HU_Init();
@ -32,7 +32,7 @@ extern char english_shiftxform[];
typedef struct typedef struct
{ {
patch_t *chars[HU_FONTSIZE]; patch_t *chars[FONTSIZE];
INT32 kerning; INT32 kerning;
UINT32 spacewidth; UINT32 spacewidth;
UINT32 linespacing; UINT32 linespacing;

View file

@ -7905,7 +7905,7 @@ static void M_DrawSoundTest(void)
{ {
V_DrawFill(165+140-9, y-4, 8, 16, 150); V_DrawFill(165+140-9, y-4, 8, 16, 150);
//V_DrawCharacter(165+140-8, y, '\x19' | V_YELLOWMAP, false); //V_DrawCharacter(165+140-8, y, '\x19' | V_YELLOWMAP, false);
V_DrawFixedPatch((165+140-9)<<FRACBITS, (y<<FRACBITS)-(bounce*4), FRACUNIT, 0, hu_font.chars['\x19'-HU_FONTSTART], V_GetStringColormap(V_YELLOWMAP)); V_DrawFixedPatch((165+140-9)<<FRACBITS, (y<<FRACBITS)-(bounce*4), FRACUNIT, 0, hu_font.chars['\x19'-FONTSTART], V_GetStringColormap(V_YELLOWMAP));
} }
} }
t++; t++;

View file

@ -1981,10 +1981,10 @@ void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed)
flags = c & ~(V_CHARCOLORMASK | V_PARAMMASK); flags = c & ~(V_CHARCOLORMASK | V_PARAMMASK);
c &= 0x7f; c &= 0x7f;
if (lowercaseallowed) if (lowercaseallowed)
c -= HU_FONTSTART; c -= FONTSTART;
else else
c = toupper(c) - HU_FONTSTART; c = toupper(c) - FONTSTART;
if (c < 0 || c >= HU_FONTSIZE || !hu_font.chars[c]) if (c < 0 || c >= FONTSIZE || !hu_font.chars[c])
return; return;
w = hu_font.chars[c]->width; w = hu_font.chars[c]->width;
@ -2008,10 +2008,10 @@ void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UI
flags = c & ~(V_CHARCOLORMASK | V_PARAMMASK); flags = c & ~(V_CHARCOLORMASK | V_PARAMMASK);
c &= 0x7f; c &= 0x7f;
if (lowercaseallowed) if (lowercaseallowed)
c -= HU_FONTSTART; c -= FONTSTART;
else else
c = toupper(c) - HU_FONTSTART; c = toupper(c) - FONTSTART;
if (c < 0 || c >= HU_FONTSIZE || !hu_font.chars[c]) if (c < 0 || c >= FONTSIZE || !hu_font.chars[c])
return; return;
w = (vid.width < 640 ) ? ((hu_font.chars[c]->width / 2)) : (hu_font.chars[c]->width); // use normal sized characters if we're using a terribly low resolution. w = (vid.width < 640 ) ? ((hu_font.chars[c]->width / 2)) : (hu_font.chars[c]->width); // use normal sized characters if we're using a terribly low resolution.
@ -2067,9 +2067,9 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
if (!(option & V_ALLOWLOWERCASE)) if (!(option & V_ALLOWLOWERCASE))
c = toupper(c); c = toupper(c);
c -= HU_FONTSTART; c -= FONTSTART;
if (c < 0 || c >= HU_FONTSIZE || !hu_font.chars[c]) if (c < 0 || c >= FONTSIZE || !hu_font.chars[c])
{ {
chw = spacewidth; chw = spacewidth;
lastusablespace = i; lastusablespace = i;
@ -2219,9 +2219,9 @@ void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale,
c = *ch; c = *ch;
if (!lowercase) if (!lowercase)
c = toupper(c); c = toupper(c);
c -= HU_FONTSTART; c -= FONTSTART;
if (c < 0 || c >= HU_FONTSIZE || !font.chars[c]) if (c < 0 || c >= FONTSIZE || !font.chars[c])
{ {
cx += FixedMul((spacewidth<<FRACBITS), dupx); cx += FixedMul((spacewidth<<FRACBITS), dupx);
continue; continue;
@ -2384,10 +2384,10 @@ static void V_DrawNameTagLine(INT32 x, INT32 y, INT32 option, fixed_t scale, UIN
} }
c = toupper(*ch); c = toupper(*ch);
c -= HU_FONTSTART; c -= FONTSTART;
// character does not exist or is a space // character does not exist or is a space
if (c < 0 || c >= HU_FONTSIZE || !ntb_font.chars[c] || !nto_font.chars[c]) if (c < 0 || c >= FONTSIZE || !ntb_font.chars[c] || !nto_font.chars[c])
{ {
cx += FixedMul((ntb_font.spacewidth * dupx)*FRACUNIT, scale); cx += FixedMul((ntb_font.spacewidth * dupx)*FRACUNIT, scale);
continue; continue;
@ -2530,8 +2530,8 @@ INT32 V_NameTagWidth(const char *string)
for (i = 0; i < strlen(string); i++) for (i = 0; i < strlen(string); i++)
{ {
c = toupper(string[i]) - HU_FONTSTART; c = toupper(string[i]) - FONTSTART;
if (c < 0 || c >= HU_FONTSIZE || !ntb_font.chars[c] || !nto_font.chars[c]) if (c < 0 || c >= FONTSIZE || !ntb_font.chars[c] || !nto_font.chars[c])
w += ntb_font.spacewidth; w += ntb_font.spacewidth;
else else
w += (ntb_font.chars[c]->width)+2; w += (ntb_font.chars[c]->width)+2;
@ -2566,8 +2566,8 @@ INT32 V_FontStringWidth(const char *string, INT32 option, fontdef_t font)
{ {
if (string[i] & 0x80) if (string[i] & 0x80)
continue; continue;
c = ((option & V_ALLOWLOWERCASE ? string[i] : toupper(string[i])) - HU_FONTSTART); c = ((option & V_ALLOWLOWERCASE ? string[i] : toupper(string[i])) - FONTSTART);
if (c < 0 || c >= HU_FONTSIZE || !font.chars[c]) if (c < 0 || c >= FONTSIZE || !font.chars[c])
w += spacewidth; w += spacewidth;
else else
w += (charwidth ? charwidth : (font.chars[c]->width)) + font.kerning; w += (charwidth ? charwidth : (font.chars[c]->width)) + font.kerning;
@ -2588,8 +2588,8 @@ INT32 V_FontStringHeight(const char *string, fontdef_t font)
for (i = 0; i < strlen(string); i++) for (i = 0; i < strlen(string); i++)
{ {
c = string[i] - HU_FONTSTART; c = string[i] - FONTSTART;
if (c < 0 || c >= HU_FONTSIZE || !font.chars[c]) if (c < 0 || c >= FONTSIZE || !font.chars[c])
continue; continue;
if (font.chars[c]->height > h) if (font.chars[c]->height > h)