From c74cbb68684b59c8836f43cf8ae3b6e179158373 Mon Sep 17 00:00:00 2001
From: spherallic <spherallic@gmail.com>
Date: Mon, 5 Sep 2022 17:18:26 +0200
Subject: [PATCH] Remove HU_ prefix from font start/end/size defines

---
 src/console.c  |  4 ++--
 src/hu_stuff.c | 34 +++++++++++++++++-----------------
 src/hu_stuff.h |  8 ++++----
 src/m_menu.c   |  2 +-
 src/v_video.c  | 36 ++++++++++++++++++------------------
 5 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/src/console.c b/src/console.c
index 062e9de387..ae17e2bf04 100644
--- a/src/console.c
+++ b/src/console.c
@@ -1714,11 +1714,11 @@ static void CON_DrawHudlines(void)
 			}
 			if (c >= con_width)
 				break;
-			if (*p < HU_FONTSTART)
+			if (*p < FONTSTART)
 				;//charwidth = 4 * con_scalefactor;
 			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);
 			}
 		}
diff --git a/src/hu_stuff.c b/src/hu_stuff.c
index b621c61daa..95d06969f4 100644
--- a/src/hu_stuff.c
+++ b/src/hu_stuff.c
@@ -186,8 +186,8 @@ void HU_LoadGraphics(void)
 	if (dedicated)
 		return;
 
-	j = HU_FONTSTART;
-	for (i = 0; i < HU_FONTSIZE; i++, j++)
+	j = FONTSTART;
+	for (i = 0; i < FONTSIZE; i++, j++)
 	{
 		// cache the heads-up font for entire game execution
 		sprintf(buffer, "STCFN%.3d", j);
@@ -1137,7 +1137,7 @@ boolean HU_Responder(event_t *ev)
 			else
 				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
 		{
 			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))
 			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;
 			lastusablespace = i;
@@ -1267,7 +1267,7 @@ static void HU_drawMiniChat(void)
 
 		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.
 				{
@@ -1333,7 +1333,7 @@ static void HU_drawMiniChat(void)
 
 		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.
 				{
@@ -1432,7 +1432,7 @@ static void HU_drawChatLog(INT32 offset)
 		UINT8 *colormap = NULL;
 		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.
 				{
@@ -1460,7 +1460,7 @@ static void HU_drawChatLog(INT32 offset)
 			}
 
 			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;
 				dy += charheight;
@@ -1550,7 +1550,7 @@ static void HU_DrawChat(void)
 
 	while (talk[i])
 	{
-		if (talk[i] < HU_FONTSTART)
+		if (talk[i] < FONTSTART)
 			++i;
 		else
 		{
@@ -1592,7 +1592,7 @@ static void HU_DrawChat(void)
 		}
 
 		//Hurdler: isn't it better like that?
-		if (w_chat[i] < HU_FONTSTART)
+		if (w_chat[i] < FONTSTART)
 			++i;
 		else
 			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;
 	const char *ntalk = "Say: ", *ttalk = "Say-Team: ";
 	const char *talk = ntalk;
-	INT32 charwidth = 8 * con_scalefactor; //(hu_font.chars['A'-HU_FONTSTART]->width) * con_scalefactor;
-	INT32 charheight = 8 * con_scalefactor; //(hu_font.chars['A'-HU_FONTSTART]->height) * con_scalefactor;
+	INT32 charwidth = 8 * con_scalefactor; //(hu_font.chars['A'-FONTSTART]->width) * con_scalefactor;
+	INT32 charheight = 8 * con_scalefactor; //(hu_font.chars['A'-FONTSTART]->height) * con_scalefactor;
 	if (teamtalk)
 	{
 		talk = ttalk;
@@ -1706,14 +1706,14 @@ static void HU_DrawChat_Old(void)
 
 	while (talk[i])
 	{
-		if (talk[i] < HU_FONTSTART)
+		if (talk[i] < FONTSTART)
 		{
 			++i;
 			//charwidth = 4 * con_scalefactor;
 		}
 		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);
 		}
 		c += charwidth;
@@ -1734,14 +1734,14 @@ static void HU_DrawChat_Old(void)
 		}
 
 		//Hurdler: isn't it better like that?
-		if (w_chat[i] < HU_FONTSTART)
+		if (w_chat[i] < FONTSTART)
 		{
 			++i;
 			//charwidth = 4 * con_scalefactor;
 		}
 		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);
 		}
 
diff --git a/src/hu_stuff.h b/src/hu_stuff.h
index 371fc0e626..ee73395897 100644
--- a/src/hu_stuff.h
+++ b/src/hu_stuff.h
@@ -21,9 +21,9 @@
 //------------------------------------
 //           Fonts & stuff
 //------------------------------------
-#define HU_FONTSTART '\x16' // the first font character
-#define HU_FONTEND '~'
-#define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1)
+#define FONTSTART '\x16' // the first font character
+#define FONTEND '~'
+#define FONTSIZE (FONTEND - FONTSTART + 1)
 
 #define HU_CROSSHAIRS 3 // maximum of 9 - see HU_Init();
 
@@ -32,7 +32,7 @@ extern char english_shiftxform[];
 
 typedef struct
 {
-	patch_t *chars[HU_FONTSIZE];
+	patch_t *chars[FONTSIZE];
 	INT32 kerning;
 	UINT32 spacewidth;
 	UINT32 linespacing;
diff --git a/src/m_menu.c b/src/m_menu.c
index 5389f728a0..764e1a79bd 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -7905,7 +7905,7 @@ static void M_DrawSoundTest(void)
 				{
 					V_DrawFill(165+140-9, y-4, 8, 16, 150);
 					//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++;
diff --git a/src/v_video.c b/src/v_video.c
index efe70f7c4c..5d308d92ed 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -1981,10 +1981,10 @@ void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed)
 	flags = c & ~(V_CHARCOLORMASK | V_PARAMMASK);
 	c &= 0x7f;
 	if (lowercaseallowed)
-		c -= HU_FONTSTART;
+		c -= FONTSTART;
 	else
-		c = toupper(c) - HU_FONTSTART;
-	if (c < 0 || c >= HU_FONTSIZE || !hu_font.chars[c])
+		c = toupper(c) - FONTSTART;
+	if (c < 0 || c >= FONTSIZE || !hu_font.chars[c])
 		return;
 
 	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);
 	c &= 0x7f;
 	if (lowercaseallowed)
-		c -= HU_FONTSTART;
+		c -= FONTSTART;
 	else
-		c = toupper(c) - HU_FONTSTART;
-	if (c < 0 || c >= HU_FONTSIZE || !hu_font.chars[c])
+		c = toupper(c) - FONTSTART;
+	if (c < 0 || c >= FONTSIZE || !hu_font.chars[c])
 		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.
@@ -2067,9 +2067,9 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
 
 		if (!(option & V_ALLOWLOWERCASE))
 			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;
 			lastusablespace = i;
@@ -2219,9 +2219,9 @@ void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale,
 		c = *ch;
 		if (!lowercase)
 			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);
 			continue;
@@ -2384,10 +2384,10 @@ static void V_DrawNameTagLine(INT32 x, INT32 y, INT32 option, fixed_t scale, UIN
 		}
 
 		c = toupper(*ch);
-		c -= HU_FONTSTART;
+		c -= FONTSTART;
 
 		// 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);
 			continue;
@@ -2530,8 +2530,8 @@ INT32 V_NameTagWidth(const char *string)
 
 	for (i = 0; i < strlen(string); i++)
 	{
-		c = toupper(string[i]) - HU_FONTSTART;
-		if (c < 0 || c >= HU_FONTSIZE || !ntb_font.chars[c] || !nto_font.chars[c])
+		c = toupper(string[i]) - FONTSTART;
+		if (c < 0 || c >= FONTSIZE || !ntb_font.chars[c] || !nto_font.chars[c])
 			w += ntb_font.spacewidth;
 		else
 			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)
 			continue;
-		c = ((option & V_ALLOWLOWERCASE ? string[i] : toupper(string[i])) - HU_FONTSTART);
-		if (c < 0 || c >= HU_FONTSIZE || !font.chars[c])
+		c = ((option & V_ALLOWLOWERCASE ? string[i] : toupper(string[i])) - FONTSTART);
+		if (c < 0 || c >= FONTSIZE || !font.chars[c])
 			w += spacewidth;
 		else
 			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++)
 	{
-		c = string[i] - HU_FONTSTART;
-		if (c < 0 || c >= HU_FONTSIZE || !font.chars[c])
+		c = string[i] - FONTSTART;
+		if (c < 0 || c >= FONTSIZE || !font.chars[c])
 			continue;
 
 		if (font.chars[c]->height > h)
-- 
GitLab