mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-05 07:51:42 +00:00
Add fontdef_t struct, move the width and height variables there.
This commit is contained in:
parent
7b3c89c989
commit
908fb8b026
6 changed files with 103 additions and 88 deletions
|
@ -60,8 +60,9 @@
|
||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
// heads up font
|
// heads up font
|
||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
patch_t *hu_font[HU_FONTSIZE];
|
fontdef_t hu_font;
|
||||||
patch_t *tny_font[HU_FONTSIZE];
|
fontdef_t tny_font;
|
||||||
|
|
||||||
patch_t *tallnum[10]; // 0-9
|
patch_t *tallnum[10]; // 0-9
|
||||||
patch_t *nightsnum[10]; // 0-9
|
patch_t *nightsnum[10]; // 0-9
|
||||||
|
|
||||||
|
@ -193,18 +194,24 @@ void HU_LoadGraphics(void)
|
||||||
// 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);
|
||||||
if (W_CheckNumForName(buffer) == LUMPERROR)
|
if (W_CheckNumForName(buffer) == LUMPERROR)
|
||||||
hu_font[i] = NULL;
|
hu_font.chars[i] = NULL;
|
||||||
else
|
else
|
||||||
hu_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
hu_font.chars[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||||
|
|
||||||
// tiny version of the heads-up font
|
// tiny version of the heads-up font
|
||||||
sprintf(buffer, "TNYFN%.3d", j);
|
sprintf(buffer, "TNYFN%.3d", j);
|
||||||
if (W_CheckNumForName(buffer) == LUMPERROR)
|
if (W_CheckNumForName(buffer) == LUMPERROR)
|
||||||
tny_font[i] = NULL;
|
tny_font.chars[i] = NULL;
|
||||||
else
|
else
|
||||||
tny_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
tny_font.chars[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hu_font.width = 8;
|
||||||
|
hu_font.height = 12;
|
||||||
|
|
||||||
|
tny_font.width = 5;
|
||||||
|
tny_font.height = 12;
|
||||||
|
|
||||||
j = LT_FONTSTART;
|
j = LT_FONTSTART;
|
||||||
for (i = 0; i < LT_FONTSIZE; i++)
|
for (i = 0; i < LT_FONTSIZE; i++)
|
||||||
{
|
{
|
||||||
|
@ -864,7 +871,7 @@ static inline boolean HU_keyInChatString(char *s, char ch)
|
||||||
{
|
{
|
||||||
size_t l;
|
size_t l;
|
||||||
|
|
||||||
if ((ch >= HU_FONTSTART && ch <= HU_FONTEND && hu_font[ch-HU_FONTSTART])
|
if ((ch >= HU_FONTSTART && ch <= HU_FONTEND && hu_font.chars[ch-HU_FONTSTART])
|
||||||
|| ch == ' ') // Allow spaces, of course
|
|| ch == ' ') // Allow spaces, of course
|
||||||
{
|
{
|
||||||
l = strlen(s);
|
l = strlen(s);
|
||||||
|
@ -1314,7 +1321,7 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
||||||
c = toupper(c);
|
c = toupper(c);
|
||||||
c -= HU_FONTSTART;
|
c -= HU_FONTSTART;
|
||||||
|
|
||||||
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
|
if (c < 0 || c >= HU_FONTSIZE || !hu_font.chars[c])
|
||||||
{
|
{
|
||||||
chw = spacewidth;
|
chw = spacewidth;
|
||||||
lastusablespace = i;
|
lastusablespace = i;
|
||||||
|
@ -1796,8 +1803,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['A'-HU_FONTSTART]->width) * con_scalefactor;
|
INT32 charwidth = 8 * con_scalefactor; //(hu_font.chars['A'-HU_FONTSTART]->width) * con_scalefactor;
|
||||||
INT32 charheight = 8 * con_scalefactor; //(hu_font['A'-HU_FONTSTART]->height) * con_scalefactor;
|
INT32 charheight = 8 * con_scalefactor; //(hu_font.chars['A'-HU_FONTSTART]->height) * con_scalefactor;
|
||||||
if (teamtalk)
|
if (teamtalk)
|
||||||
{
|
{
|
||||||
talk = ttalk;
|
talk = ttalk;
|
||||||
|
@ -1818,7 +1825,7 @@ static void HU_DrawChat_Old(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//charwidth = (hu_font[talk[i]-HU_FONTSTART]->width) * con_scalefactor;
|
//charwidth = (hu_font.chars[talk[i]-HU_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;
|
||||||
|
@ -1846,7 +1853,7 @@ static void HU_DrawChat_Old(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//charwidth = (hu_font[w_chat[i]-HU_FONTSTART]->width) * con_scalefactor;
|
//charwidth = (hu_font.chars[w_chat[i]-HU_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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,15 @@
|
||||||
extern char *shiftxform; // english translation shift table
|
extern char *shiftxform; // english translation shift table
|
||||||
extern char english_shiftxform[];
|
extern char english_shiftxform[];
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
patch_t *chars[HU_FONTSIZE];
|
||||||
|
INT32 width;
|
||||||
|
INT32 height;
|
||||||
|
} fontdef_t;
|
||||||
|
|
||||||
|
extern fontdef_t hu_font, tny_font;
|
||||||
|
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
// sorted player lines
|
// sorted player lines
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
|
@ -78,7 +87,6 @@ void HU_AddChatText(const char *text, boolean playsound);
|
||||||
// set true when entering a chat message
|
// set true when entering a chat message
|
||||||
extern boolean chat_on;
|
extern boolean chat_on;
|
||||||
|
|
||||||
extern patch_t *hu_font[HU_FONTSIZE], *tny_font[HU_FONTSIZE];
|
|
||||||
extern patch_t *tallnum[10];
|
extern patch_t *tallnum[10];
|
||||||
extern patch_t *nightsnum[10];
|
extern patch_t *nightsnum[10];
|
||||||
extern patch_t *lt_font[LT_FONTSIZE];
|
extern patch_t *lt_font[LT_FONTSIZE];
|
||||||
|
|
|
@ -6256,7 +6256,7 @@ static void M_DrawMessageMenu(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
V_DrawString((BASEVIDWIDTH - V_StringWidth(string, 0))/2,y,V_ALLOWLOWERCASE,string);
|
V_DrawString((BASEVIDWIDTH - V_StringWidth(string, 0))/2,y,V_ALLOWLOWERCASE,string);
|
||||||
y += 8; //hu_font[0]->height;
|
y += 8; //hu_font.chars[0]->height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7903,7 +7903,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['\x19'-HU_FONTSTART], V_GetStringColormap(V_YELLOWMAP));
|
V_DrawFixedPatch((165+140-9)<<FRACBITS, (y<<FRACBITS)-(bounce*4), FRACUNIT, 0, hu_font.chars['\x19'-HU_FONTSTART], V_GetStringColormap(V_YELLOWMAP));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t++;
|
t++;
|
||||||
|
|
|
@ -505,10 +505,10 @@ static void ST_drawDebugInfo(void)
|
||||||
V_DrawRightAlignedThinString(320, 8+lowh, VFLAGS|V_REDMAP, "SOME INFO NOT VISIBLE");\
|
V_DrawRightAlignedThinString(320, 8+lowh, VFLAGS|V_REDMAP, "SOME INFO NOT VISIBLE");\
|
||||||
return;\
|
return;\
|
||||||
}\
|
}\
|
||||||
V_DrawRightAlignedFontString(320, height, 8, 12, VFLAGS, textscale, textscale, str, hu_font);\
|
V_DrawRightAlignedFontString(320, height, VFLAGS, textscale, textscale, str, hu_font);\
|
||||||
height += h;
|
height += h;
|
||||||
|
|
||||||
#define V_DrawDebugFlag(f, str) V_DrawRightAlignedFontString(width, height, 8, 12, VFLAGS|f, textscale, textscale, str, hu_font);\
|
#define V_DrawDebugFlag(f, str) V_DrawRightAlignedFontString(width, height, VFLAGS|f, textscale, textscale, str, hu_font);\
|
||||||
width -= w
|
width -= w
|
||||||
|
|
||||||
if (cv_debug & DBG_MEMORY)
|
if (cv_debug & DBG_MEMORY)
|
||||||
|
|
|
@ -2033,17 +2033,17 @@ void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed)
|
||||||
c -= HU_FONTSTART;
|
c -= HU_FONTSTART;
|
||||||
else
|
else
|
||||||
c = toupper(c) - HU_FONTSTART;
|
c = toupper(c) - HU_FONTSTART;
|
||||||
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
|
if (c < 0 || c >= HU_FONTSIZE || !hu_font.chars[c])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
w = hu_font[c]->width;
|
w = hu_font.chars[c]->width;
|
||||||
if (x + w > vid.width)
|
if (x + w > vid.width)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (colormap != NULL)
|
if (colormap != NULL)
|
||||||
V_DrawMappedPatch(x, y, flags, hu_font[c], colormap);
|
V_DrawMappedPatch(x, y, flags, hu_font.chars[c], colormap);
|
||||||
else
|
else
|
||||||
V_DrawScaledPatch(x, y, flags, hu_font[c]);
|
V_DrawScaledPatch(x, y, flags, hu_font.chars[c]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Writes a single character for the chat. (draw WHITE if bit 7 set)
|
// Writes a single character for the chat. (draw WHITE if bit 7 set)
|
||||||
|
@ -2060,14 +2060,14 @@ void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UI
|
||||||
c -= HU_FONTSTART;
|
c -= HU_FONTSTART;
|
||||||
else
|
else
|
||||||
c = toupper(c) - HU_FONTSTART;
|
c = toupper(c) - HU_FONTSTART;
|
||||||
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
|
if (c < 0 || c >= HU_FONTSIZE || !hu_font.chars[c])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
w = (vid.width < 640 ) ? ((hu_font[c]->width / 2)) : (hu_font[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.
|
||||||
if (x + w > vid.width)
|
if (x + w > vid.width)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, (vid.width < 640) ? (FRACUNIT) : (FRACUNIT/2), flags, hu_font[c], colormap);
|
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, (vid.width < 640) ? (FRACUNIT) : (FRACUNIT/2), flags, hu_font.chars[c], colormap);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2120,13 +2120,13 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
||||||
c = toupper(c);
|
c = toupper(c);
|
||||||
c -= HU_FONTSTART;
|
c -= HU_FONTSTART;
|
||||||
|
|
||||||
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
|
if (c < 0 || c >= HU_FONTSIZE || !hu_font.chars[c])
|
||||||
{
|
{
|
||||||
chw = spacewidth;
|
chw = spacewidth;
|
||||||
lastusablespace = i;
|
lastusablespace = i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
chw = (charwidth ? charwidth : hu_font[c]->width);
|
chw = (charwidth ? charwidth : hu_font.chars[c]->width);
|
||||||
|
|
||||||
x += chw;
|
x += chw;
|
||||||
|
|
||||||
|
@ -2143,30 +2143,30 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
||||||
|
|
||||||
// Draw a string, using a supplied font and scale.
|
// Draw a string, using a supplied font and scale.
|
||||||
// NOTE: The text is centered for screens larger than the base width.
|
// NOTE: The text is centered for screens larger than the base width.
|
||||||
void V_DrawFontString(INT32 x, INT32 y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font)
|
void V_DrawFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font)
|
||||||
{
|
{
|
||||||
V_DrawFontStringAtFixed((fixed_t)x<<FRACBITS, (fixed_t)y<<FRACBITS, width, height, option, pscale, vscale, string, font);
|
V_DrawFontStringAtFixed((fixed_t)x<<FRACBITS, (fixed_t)y<<FRACBITS, option, pscale, vscale, string, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
void V_DrawCenteredFontString(INT32 x, INT32 y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font)
|
void V_DrawCenteredFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font)
|
||||||
{
|
{
|
||||||
V_DrawCenteredFontStringAtFixed((fixed_t)x<<FRACBITS, (fixed_t)y<<FRACBITS, width, height, option, pscale, vscale, string, font);
|
V_DrawCenteredFontStringAtFixed((fixed_t)x<<FRACBITS, (fixed_t)y<<FRACBITS, option, pscale, vscale, string, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
void V_DrawRightAlignedFontString(INT32 x, INT32 y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font)
|
void V_DrawRightAlignedFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font)
|
||||||
{
|
{
|
||||||
V_DrawRightAlignedFontStringAtFixed((fixed_t)x<<FRACBITS, (fixed_t)y<<FRACBITS, width, height, option, pscale, vscale, string, font);
|
V_DrawRightAlignedFontStringAtFixed((fixed_t)x<<FRACBITS, (fixed_t)y<<FRACBITS, option, pscale, vscale, string, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write a string, using a supplied font and scale, at fixed_t coordinates.
|
// Write a string, using a supplied font and scale, at fixed_t coordinates.
|
||||||
// NOTE: The text is centered for screens larger than the base width.
|
// NOTE: The text is centered for screens larger than the base width.
|
||||||
void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font)
|
void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font)
|
||||||
{
|
{
|
||||||
fixed_t cx = x, cy = y;
|
fixed_t cx = x, cy = y;
|
||||||
INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0;
|
INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0;
|
||||||
const char *ch = string;
|
const char *ch = string;
|
||||||
INT32 charflags = (option & V_CHARCOLORMASK);
|
INT32 charflags = (option & V_CHARCOLORMASK);
|
||||||
INT32 spacewidth = width/2, charwidth = 0;
|
INT32 spacewidth = font.width/2, charwidth = 0;
|
||||||
|
|
||||||
INT32 lowercase = (option & V_ALLOWLOWERCASE);
|
INT32 lowercase = (option & V_ALLOWLOWERCASE);
|
||||||
option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE...
|
option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE...
|
||||||
|
@ -2192,10 +2192,10 @@ void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, IN
|
||||||
switch (option & V_SPACINGMASK) // TODO: drop support for these crusty flags in the next major update
|
switch (option & V_SPACINGMASK) // TODO: drop support for these crusty flags in the next major update
|
||||||
{
|
{
|
||||||
case V_MONOSPACE:
|
case V_MONOSPACE:
|
||||||
spacewidth = width;
|
spacewidth = font.width;
|
||||||
/* FALLTHRU */
|
/* FALLTHRU */
|
||||||
case V_OLDSPACING:
|
case V_OLDSPACING:
|
||||||
charwidth = width;
|
charwidth = font.width;
|
||||||
break;
|
break;
|
||||||
case V_6WIDTHSPACE:
|
case V_6WIDTHSPACE:
|
||||||
spacewidth = 6;
|
spacewidth = 6;
|
||||||
|
@ -2221,7 +2221,7 @@ void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, IN
|
||||||
if (option & V_RETURN8)
|
if (option & V_RETURN8)
|
||||||
cy += FixedMul((8<<FRACBITS), dupy);
|
cy += FixedMul((8<<FRACBITS), dupy);
|
||||||
else
|
else
|
||||||
cy += FixedMul((height<<FRACBITS), dupy);
|
cy += FixedMul((font.height<<FRACBITS), dupy);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2231,7 +2231,7 @@ void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, IN
|
||||||
c = toupper(c);
|
c = toupper(c);
|
||||||
c -= HU_FONTSTART;
|
c -= HU_FONTSTART;
|
||||||
|
|
||||||
if (c < 0 || c >= HU_FONTSIZE || !font[c])
|
if (c < 0 || c >= HU_FONTSIZE || !font.chars[c])
|
||||||
{
|
{
|
||||||
cx += FixedMul((spacewidth<<FRACBITS), dupx);
|
cx += FixedMul((spacewidth<<FRACBITS), dupx);
|
||||||
continue;
|
continue;
|
||||||
|
@ -2240,10 +2240,10 @@ void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, IN
|
||||||
if (charwidth)
|
if (charwidth)
|
||||||
{
|
{
|
||||||
w = FixedMul((charwidth<<FRACBITS), dupx);
|
w = FixedMul((charwidth<<FRACBITS), dupx);
|
||||||
center = w/2 - FixedMul(font[c]->width<<FRACBITS, (dupx/2));
|
center = w/2 - FixedMul(font.chars[c]->width<<FRACBITS, (dupx/2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
w = FixedMul(font[c]->width<<FRACBITS, dupx);
|
w = FixedMul(font.chars[c]->width<<FRACBITS, dupx);
|
||||||
|
|
||||||
if ((cx>>FRACBITS) > scrwidth)
|
if ((cx>>FRACBITS) > scrwidth)
|
||||||
continue;
|
continue;
|
||||||
|
@ -2253,22 +2253,22 @@ void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, IN
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
V_DrawStretchyFixedPatch(cx + center, cy, pscale, vscale, option, font[c], V_GetStringColormap(charflags));
|
V_DrawStretchyFixedPatch(cx + center, cy, pscale, vscale, option, font.chars[c], V_GetStringColormap(charflags));
|
||||||
|
|
||||||
cx += w;
|
cx += w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void V_DrawCenteredFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font)
|
void V_DrawCenteredFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font)
|
||||||
{
|
{
|
||||||
x -= (V_FontStringWidth(string, option, width, font)*pscale)/2;
|
x -= (V_FontStringWidth(string, option, font)*pscale)/2;
|
||||||
V_DrawFontStringAtFixed(x, y, width, height, option, pscale, vscale, string, font);
|
V_DrawFontStringAtFixed(x, y, option, pscale, vscale, string, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
void V_DrawRightAlignedFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font)
|
void V_DrawRightAlignedFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font)
|
||||||
{
|
{
|
||||||
x -= V_FontStringWidth(string, option, width, font)*pscale;
|
x -= V_FontStringWidth(string, option, font)*pscale;
|
||||||
V_DrawFontStringAtFixed(x, y, width, height, option, pscale, vscale, string, font);
|
V_DrawFontStringAtFixed(x, y, option, pscale, vscale, string, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draws a tallnum. Replaces two functions in y_inter and st_stuff
|
// Draws a tallnum. Replaces two functions in y_inter and st_stuff
|
||||||
|
@ -2739,19 +2739,19 @@ INT16 V_LevelActNumWidth(UINT8 num)
|
||||||
|
|
||||||
// Find string width from supplied font characters & character width.
|
// Find string width from supplied font characters & character width.
|
||||||
//
|
//
|
||||||
INT32 V_FontStringWidth(const char *string, INT32 option, INT32 width, patch_t **font)
|
INT32 V_FontStringWidth(const char *string, INT32 option, fontdef_t font)
|
||||||
{
|
{
|
||||||
INT32 c, w = 0;
|
INT32 c, w = 0;
|
||||||
INT32 spacewidth = width/2, charwidth = 0;
|
INT32 spacewidth = font.width/2, charwidth = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
switch (option & V_SPACINGMASK)
|
switch (option & V_SPACINGMASK)
|
||||||
{
|
{
|
||||||
case V_MONOSPACE:
|
case V_MONOSPACE:
|
||||||
spacewidth = width;
|
spacewidth = font.width;
|
||||||
/* FALLTHRU */
|
/* FALLTHRU */
|
||||||
case V_OLDSPACING:
|
case V_OLDSPACING:
|
||||||
charwidth = width;
|
charwidth = font.width;
|
||||||
break;
|
break;
|
||||||
case V_6WIDTHSPACE:
|
case V_6WIDTHSPACE:
|
||||||
spacewidth = 6;
|
spacewidth = 6;
|
||||||
|
@ -2764,10 +2764,10 @@ INT32 V_FontStringWidth(const char *string, INT32 option, INT32 width, patch_t *
|
||||||
if (string[i] & 0x80)
|
if (string[i] & 0x80)
|
||||||
continue;
|
continue;
|
||||||
c = toupper(string[i]) - HU_FONTSTART;
|
c = toupper(string[i]) - HU_FONTSTART;
|
||||||
if (c < 0 || c >= HU_FONTSIZE || !font[c])
|
if (c < 0 || c >= HU_FONTSIZE || !font.chars[c])
|
||||||
w += spacewidth;
|
w += spacewidth;
|
||||||
else
|
else
|
||||||
w += (charwidth ? charwidth : (font[c]->width));
|
w += (charwidth ? charwidth : (font.chars[c]->width));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (option & (V_NOSCALESTART|V_NOSCALEPATCH))
|
if (option & (V_NOSCALESTART|V_NOSCALEPATCH))
|
||||||
|
|
|
@ -210,48 +210,48 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string);
|
||||||
UINT8 *V_GetStringColormap(INT32 colorflags);
|
UINT8 *V_GetStringColormap(INT32 colorflags);
|
||||||
|
|
||||||
// Draw a string, using a supplied font and scale.
|
// Draw a string, using a supplied font and scale.
|
||||||
void V_DrawFontString(INT32 x, INT32 y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font);
|
void V_DrawFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
|
||||||
void V_DrawCenteredFontString(INT32 x, INT32 y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font);
|
void V_DrawCenteredFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
|
||||||
void V_DrawRightAlignedFontString(INT32 x, INT32 y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font);
|
void V_DrawRightAlignedFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
|
||||||
// Draw a string, using a supplied font and scale, at fixed_t coordinates.
|
// Draw a string, using a supplied font and scale, at fixed_t coordinates.
|
||||||
void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font);
|
void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
|
||||||
void V_DrawCenteredFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font);
|
void V_DrawCenteredFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
|
||||||
void V_DrawRightAlignedFontStringAtFixed(fixed_t x, fixed_t y, INT32 width, INT32 height, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, patch_t **font);
|
void V_DrawRightAlignedFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
|
||||||
// width = "average" character width (divided by 2 for space width), height = distance between two lines. TODO: incorporate these in the supplied font, somehow
|
// width = "average" character width (divided by 2 for space width), height = distance between two lines. TODO: incorporate these in the supplied font, somehow
|
||||||
|
|
||||||
// Defines for old string drawers.
|
// Defines for old string drawers.
|
||||||
// draw a string using the hu_font
|
// draw a string using the hu_font
|
||||||
#define V_DrawString(x,y,o,str) V_DrawFontString(x,y,8,12,o,FRACUNIT,FRACUNIT,str,hu_font)
|
#define V_DrawString(x,y,o,str) V_DrawFontString(x,y,o,FRACUNIT,FRACUNIT,str,hu_font)
|
||||||
#define V_DrawCenteredString(x,y,o,str) V_DrawCenteredFontString(x,y,8,12,o,FRACUNIT,FRACUNIT,str,hu_font)
|
#define V_DrawCenteredString(x,y,o,str) V_DrawCenteredFontString(x,y,o,FRACUNIT,FRACUNIT,str,hu_font)
|
||||||
#define V_DrawRightAlignedString(x,y,o,str) V_DrawRightAlignedFontString(x,y,8,12,o,FRACUNIT,FRACUNIT,str,hu_font)
|
#define V_DrawRightAlignedString(x,y,o,str) V_DrawRightAlignedFontString(x,y,o,FRACUNIT,FRACUNIT,str,hu_font)
|
||||||
// draw a string using the hu_font, 0.5x scale
|
// draw a string using the hu_font, 0.5x scale
|
||||||
#define V_DrawSmallString(x,y,o,str) V_DrawFontString(x,y,8,12,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
|
#define V_DrawSmallString(x,y,o,str) V_DrawFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
|
||||||
#define V_DrawCenteredSmallString(x,y,o,str) V_DrawCenteredFontString(x,y,8,12,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
|
#define V_DrawCenteredSmallString(x,y,o,str) V_DrawCenteredFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
|
||||||
#define V_DrawRightAlignedSmallString(x,y,o,str) V_DrawRightAlignedFontString(x,y,8,12,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
|
#define V_DrawRightAlignedSmallString(x,y,o,str) V_DrawRightAlignedFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
|
||||||
// Write a string using the tny_font
|
// Write a string using the tny_font
|
||||||
#define V_DrawThinString(x,y,o,str) V_DrawFontString(x,y,5,12,o,FRACUNIT,FRACUNIT,str,tny_font)
|
#define V_DrawThinString(x,y,o,str) V_DrawFontString(x,y,o,FRACUNIT,FRACUNIT,str,tny_font)
|
||||||
#define V_DrawCenteredThinString(x,y,o,str) V_DrawCenteredFontString(x,y,5,12,o,FRACUNIT,FRACUNIT,str,tny_font)
|
#define V_DrawCenteredThinString(x,y,o,str) V_DrawCenteredFontString(x,y,o,FRACUNIT,FRACUNIT,str,tny_font)
|
||||||
#define V_DrawRightAlignedThinString(x,y,o,str) V_DrawRightAlignedFontString(x,y,5,12,o,FRACUNIT,FRACUNIT,str,tny_font)
|
#define V_DrawRightAlignedThinString(x,y,o,str) V_DrawRightAlignedFontString(x,y,o,FRACUNIT,FRACUNIT,str,tny_font)
|
||||||
// draw a string using the tny_font, 0.5x scale
|
// draw a string using the tny_font, 0.5x scale
|
||||||
#define V_DrawSmallThinString(x,y,o,str) V_DrawFontString(x,y,5,12,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
|
#define V_DrawSmallThinString(x,y,o,str) V_DrawFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
|
||||||
#define V_DrawCenteredSmallThinString(x,y,o,str) V_DrawCenteredFontString(x,y,5,12,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
|
#define V_DrawCenteredSmallThinString(x,y,o,str) V_DrawCenteredFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
|
||||||
#define V_DrawRightAlignedSmallThinString(x,y,o,str) V_DrawRightAlignedFontString(x,y,5,12,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
|
#define V_DrawRightAlignedSmallThinString(x,y,o,str) V_DrawRightAlignedFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
|
||||||
// draw a string using the hu_font at fixed_t coordinates
|
// draw a string using the hu_font at fixed_t coordinates
|
||||||
#define V_DrawStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,8,12,o,FRACUNIT,FRACUNIT,str,hu_font)
|
#define V_DrawStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,hu_font)
|
||||||
#define V_DrawCenteredStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,8,12,o,FRACUNIT,FRACUNIT,str,hu_font)
|
#define V_DrawCenteredStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,hu_font)
|
||||||
#define V_DrawRightAlignedStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,8,12,o,FRACUNIT,FRACUNIT,str,hu_font)
|
#define V_DrawRightAlignedStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,hu_font)
|
||||||
// draw a string using the hu_font at fixed_t coordinates, 0.5x scale
|
// draw a string using the hu_font at fixed_t coordinates, 0.5x scale
|
||||||
#define V_DrawSmallStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,8,12,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
|
#define V_DrawSmallStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
|
||||||
#define V_DrawCenteredSmallStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,8,12,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
|
#define V_DrawCenteredSmallStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
|
||||||
#define V_DrawRightAlignedSmallStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,8,12,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
|
#define V_DrawRightAlignedSmallStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
|
||||||
// draw a string using the tny_font at fixed_t coordinates
|
// draw a string using the tny_font at fixed_t coordinates
|
||||||
#define V_DrawThinStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,5,12,o,FRACUNIT,FRACUNIT,str,tny_font)
|
#define V_DrawThinStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,tny_font)
|
||||||
#define V_DrawCenteredThinStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,5,12,o,FRACUNIT,FRACUNIT,str,tny_font)
|
#define V_DrawCenteredThinStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,tny_font)
|
||||||
#define V_DrawRightAlignedThinStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,5,12,o,FRACUNIT,FRACUNIT,str,tny_font)
|
#define V_DrawRightAlignedThinStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,tny_font)
|
||||||
// draw a string using the tny_font at fixed_t coordinates, 0.5x scale
|
// draw a string using the tny_font at fixed_t coordinates, 0.5x scale
|
||||||
#define V_DrawSmallThinStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,5,12,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
|
#define V_DrawSmallThinStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
|
||||||
#define V_DrawCenteredSmallThinStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,5,12,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
|
#define V_DrawCenteredSmallThinStringAtFixed(x,y,o,str) V_DrawCenteredFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
|
||||||
#define V_DrawRightAlignedSmallThinStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,5,12,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
|
#define V_DrawRightAlignedSmallThinStringAtFixed(x,y,o,str) V_DrawRightAlignedFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
|
||||||
|
|
||||||
// Draw tall nums, used for menu, HUD, intermission
|
// Draw tall nums, used for menu, HUD, intermission
|
||||||
void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num);
|
void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num);
|
||||||
|
@ -272,13 +272,13 @@ INT32 V_CountNameTagLines(const char *string);
|
||||||
INT32 V_NameTagWidth(const char *string);
|
INT32 V_NameTagWidth(const char *string);
|
||||||
|
|
||||||
// Find string width from supplied font chars
|
// Find string width from supplied font chars
|
||||||
INT32 V_FontStringWidth(const char *string, INT32 option, INT32 width, patch_t **font);
|
INT32 V_FontStringWidth(const char *string, INT32 option, fontdef_t font);
|
||||||
|
|
||||||
// Defines for old string width functions.
|
// Defines for old string width functions.
|
||||||
#define V_StringWidth(str,o) V_FontStringWidth(str,o,8,hu_font)
|
#define V_StringWidth(str,o) V_FontStringWidth(str,o,hu_font)
|
||||||
#define V_SmallStringWidth(str,o) V_FontStringWidth(str,o,8,hu_font)/2
|
#define V_SmallStringWidth(str,o) V_FontStringWidth(str,o,hu_font)/2
|
||||||
#define V_ThinStringWidth(str,o) V_FontStringWidth(str,o,5,tny_font)
|
#define V_ThinStringWidth(str,o) V_FontStringWidth(str,o,tny_font)
|
||||||
#define V_SmallThinStringWidth(str,o) V_FontStringWidth(str,o,5,tny_font)/2
|
#define V_SmallThinStringWidth(str,o) V_FontStringWidth(str,o,tny_font)/2
|
||||||
|
|
||||||
void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param);
|
void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue