mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-04-20 09:11:01 +00:00
Remove old string drawing functions
This commit is contained in:
parent
e0b1f09834
commit
107c0c0387
2 changed files with 26 additions and 834 deletions
824
src/v_video.c
824
src/v_video.c
|
@ -2383,107 +2383,7 @@ void V_DrawStringScaled(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Write a string using the hu_font
|
||||
// NOTE: the text is centered for screens larger than the base width
|
||||
//
|
||||
void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, center = 0, left = 0;
|
||||
const char *ch = string;
|
||||
INT32 charflags = (option & V_CHARCOLORMASK);
|
||||
const UINT8 *colormap = NULL;
|
||||
INT32 spacewidth = 4, charwidth = 0;
|
||||
|
||||
INT32 lowercase = (option & V_ALLOWLOWERCASE);
|
||||
option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE...
|
||||
|
||||
if (option & V_NOSCALESTART)
|
||||
{
|
||||
dupx = vid.dupx;
|
||||
dupy = vid.dupy;
|
||||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dupx = dupy = 1;
|
||||
scrwidth = vid.width/vid.dupx;
|
||||
left = (scrwidth - BASEVIDWIDTH)/2;
|
||||
scrwidth -= left;
|
||||
}
|
||||
|
||||
switch (option & V_SPACINGMASK)
|
||||
{
|
||||
case V_MONOSPACE:
|
||||
spacewidth = 8;
|
||||
/* FALLTHRU */
|
||||
case V_OLDSPACING:
|
||||
charwidth = 8;
|
||||
break;
|
||||
case V_6WIDTHSPACE:
|
||||
spacewidth = 6;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (;;ch++)
|
||||
{
|
||||
if (!*ch)
|
||||
break;
|
||||
if (*ch & 0x80) //color parsing -x 2.16.09
|
||||
{
|
||||
// manually set flags override color codes
|
||||
if (!(option & V_CHARCOLORMASK))
|
||||
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||
continue;
|
||||
}
|
||||
if (*ch == '\n')
|
||||
{
|
||||
cx = x;
|
||||
|
||||
if (option & V_RETURN8)
|
||||
cy += 8*dupy;
|
||||
else
|
||||
cy += 12*dupy;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
c = *ch;
|
||||
if (!lowercase)
|
||||
c = toupper(c);
|
||||
c -= HU_FONTSTART;
|
||||
|
||||
// character does not exist or is a space
|
||||
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
|
||||
{
|
||||
cx += spacewidth * dupx;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (charwidth)
|
||||
{
|
||||
w = charwidth * dupx;
|
||||
center = w/2 - SHORT(hu_font[c]->width)*dupx/2;
|
||||
}
|
||||
else
|
||||
w = SHORT(hu_font[c]->width) * dupx;
|
||||
|
||||
if (cx > scrwidth)
|
||||
continue;
|
||||
if (cx+left + w < 0) //left boundary check
|
||||
{
|
||||
cx += w;
|
||||
continue;
|
||||
}
|
||||
|
||||
colormap = V_GetStringColormap(charflags);
|
||||
V_DrawFixedPatch((cx + center)<<FRACBITS, cy<<FRACBITS, FRACUNIT, option, hu_font[c], colormap);
|
||||
|
||||
cx += w;
|
||||
}
|
||||
}
|
||||
|
||||
void V_DrawCenteredString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
|
@ -2497,220 +2397,18 @@ void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string
|
|||
V_DrawString(x, y, option, string);
|
||||
}
|
||||
|
||||
//
|
||||
// Write a string using the hu_font, 0.5x scale
|
||||
// NOTE: the text is centered for screens larger than the base width
|
||||
//
|
||||
void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, center = 0, left = 0;
|
||||
const char *ch = string;
|
||||
INT32 charflags = 0;
|
||||
const UINT8 *colormap = NULL;
|
||||
INT32 spacewidth = 2, charwidth = 0;
|
||||
|
||||
INT32 lowercase = (option & V_ALLOWLOWERCASE);
|
||||
option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE...
|
||||
|
||||
if (option & V_NOSCALESTART)
|
||||
{
|
||||
dupx = vid.dupx;
|
||||
dupy = vid.dupy;
|
||||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dupx = dupy = 1;
|
||||
scrwidth = vid.width/vid.dupx;
|
||||
left = (scrwidth - BASEVIDWIDTH)/2;
|
||||
scrwidth -= left;
|
||||
}
|
||||
|
||||
charflags = (option & V_CHARCOLORMASK);
|
||||
|
||||
switch (option & V_SPACINGMASK)
|
||||
{
|
||||
case V_MONOSPACE:
|
||||
spacewidth = 4;
|
||||
/* FALLTHRU */
|
||||
case V_OLDSPACING:
|
||||
charwidth = 4;
|
||||
break;
|
||||
case V_6WIDTHSPACE:
|
||||
spacewidth = 3;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (;;ch++)
|
||||
{
|
||||
if (!*ch)
|
||||
break;
|
||||
if (*ch & 0x80) //color parsing -x 2.16.09
|
||||
{
|
||||
// manually set flags override color codes
|
||||
if (!(option & V_CHARCOLORMASK))
|
||||
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||
continue;
|
||||
}
|
||||
if (*ch == '\n')
|
||||
{
|
||||
cx = x;
|
||||
|
||||
if (option & V_RETURN8)
|
||||
cy += 4*dupy;
|
||||
else
|
||||
cy += 6*dupy;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
c = *ch;
|
||||
if (!lowercase)
|
||||
c = toupper(c);
|
||||
c -= HU_FONTSTART;
|
||||
|
||||
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
|
||||
{
|
||||
cx += spacewidth * dupx;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (charwidth)
|
||||
{
|
||||
w = charwidth * dupx;
|
||||
center = w/2 - SHORT(hu_font[c]->width)*dupx/4;
|
||||
}
|
||||
else
|
||||
w = SHORT(hu_font[c]->width) * dupx / 2;
|
||||
|
||||
if (cx > scrwidth)
|
||||
continue;
|
||||
if (cx+left + w < 0) //left boundary check
|
||||
{
|
||||
cx += w;
|
||||
continue;
|
||||
}
|
||||
|
||||
colormap = V_GetStringColormap(charflags);
|
||||
V_DrawFixedPatch((cx + center)<<FRACBITS, cy<<FRACBITS, FRACUNIT/2, option, hu_font[c], colormap);
|
||||
|
||||
cx += w;
|
||||
}
|
||||
}
|
||||
|
||||
void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
x -= V_SmallStringWidth(string, option)/2;
|
||||
V_DrawSmallString(x, y, option, string);
|
||||
}
|
||||
|
||||
|
||||
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
x -= V_SmallStringWidth(string, option);
|
||||
V_DrawSmallString(x, y, option, string);
|
||||
}
|
||||
|
||||
//
|
||||
// Write a string using the tny_font
|
||||
// NOTE: the text is centered for screens larger than the base width
|
||||
//
|
||||
void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, left = 0;
|
||||
const char *ch = string;
|
||||
INT32 charflags = 0;
|
||||
const UINT8 *colormap = NULL;
|
||||
INT32 spacewidth = 2, charwidth = 0;
|
||||
|
||||
INT32 lowercase = (option & V_ALLOWLOWERCASE);
|
||||
option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE...
|
||||
|
||||
if (option & V_NOSCALESTART)
|
||||
{
|
||||
dupx = vid.dupx;
|
||||
dupy = vid.dupy;
|
||||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dupx = dupy = 1;
|
||||
scrwidth = vid.width/vid.dupx;
|
||||
left = (scrwidth - BASEVIDWIDTH)/2;
|
||||
scrwidth -= left;
|
||||
}
|
||||
|
||||
charflags = (option & V_CHARCOLORMASK);
|
||||
|
||||
switch (option & V_SPACINGMASK)
|
||||
{
|
||||
case V_MONOSPACE:
|
||||
spacewidth = 5;
|
||||
/* FALLTHRU */
|
||||
case V_OLDSPACING:
|
||||
charwidth = 5;
|
||||
break;
|
||||
case V_6WIDTHSPACE:
|
||||
spacewidth = 3;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (;;ch++)
|
||||
{
|
||||
if (!*ch)
|
||||
break;
|
||||
if (*ch & 0x80) //color parsing -x 2.16.09
|
||||
{
|
||||
// manually set flags override color codes
|
||||
if (!(option & V_CHARCOLORMASK))
|
||||
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||
continue;
|
||||
}
|
||||
if (*ch == '\n')
|
||||
{
|
||||
cx = x;
|
||||
|
||||
if (option & V_RETURN8)
|
||||
cy += 8*dupy;
|
||||
else
|
||||
cy += 12*dupy;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
c = *ch;
|
||||
if (!lowercase || !tny_font[c-HU_FONTSTART])
|
||||
c = toupper(c);
|
||||
c -= HU_FONTSTART;
|
||||
|
||||
if (c < 0 || c >= HU_FONTSIZE || !tny_font[c])
|
||||
{
|
||||
cx += spacewidth * dupx;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (charwidth)
|
||||
w = charwidth * dupx;
|
||||
else
|
||||
w = (SHORT(tny_font[c]->width) * dupx);
|
||||
|
||||
if (cx > scrwidth)
|
||||
continue;
|
||||
if (cx+left + w < 0) //left boundary check
|
||||
{
|
||||
cx += w;
|
||||
continue;
|
||||
}
|
||||
|
||||
colormap = V_GetStringColormap(charflags);
|
||||
V_DrawFixedPatch(cx<<FRACBITS, cy<<FRACBITS, FRACUNIT, option, tny_font[c], colormap);
|
||||
|
||||
cx += w;
|
||||
}
|
||||
}
|
||||
|
||||
void V_DrawCenteredThinString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
x -= V_ThinStringWidth(string, option)/2;
|
||||
|
@ -2749,107 +2447,6 @@ void V_DrawRightAlignedSmallThinString(INT32 x, INT32 y, INT32 option, const cha
|
|||
V_DrawRightAlignedSmallThinStringAtFixed((fixed_t)x, (fixed_t)y, option, string);
|
||||
}
|
||||
|
||||
// Draws a string at a fixed_t location.
|
||||
void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
{
|
||||
fixed_t cx = x, cy = y;
|
||||
INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0;
|
||||
const char *ch = string;
|
||||
INT32 charflags = 0;
|
||||
const UINT8 *colormap = NULL;
|
||||
INT32 spacewidth = 4, charwidth = 0;
|
||||
|
||||
INT32 lowercase = (option & V_ALLOWLOWERCASE);
|
||||
option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE...
|
||||
|
||||
if (option & V_NOSCALESTART)
|
||||
{
|
||||
dupx = vid.dupx;
|
||||
dupy = vid.dupy;
|
||||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dupx = dupy = 1;
|
||||
scrwidth = vid.width/vid.dupx;
|
||||
left = (scrwidth - BASEVIDWIDTH)/2;
|
||||
scrwidth -= left;
|
||||
}
|
||||
|
||||
charflags = (option & V_CHARCOLORMASK);
|
||||
|
||||
switch (option & V_SPACINGMASK)
|
||||
{
|
||||
case V_MONOSPACE:
|
||||
spacewidth = 8;
|
||||
/* FALLTHRU */
|
||||
case V_OLDSPACING:
|
||||
charwidth = 8;
|
||||
break;
|
||||
case V_6WIDTHSPACE:
|
||||
spacewidth = 6;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (;;ch++)
|
||||
{
|
||||
if (!*ch)
|
||||
break;
|
||||
if (*ch & 0x80) //color ignoring
|
||||
{
|
||||
// manually set flags override color codes
|
||||
if (!(option & V_CHARCOLORMASK))
|
||||
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||
continue;
|
||||
}
|
||||
if (*ch == '\n')
|
||||
{
|
||||
cx = x;
|
||||
|
||||
if (option & V_RETURN8)
|
||||
cy += (8*dupy)<<FRACBITS;
|
||||
else
|
||||
cy += (12*dupy)<<FRACBITS;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
c = *ch;
|
||||
if (!lowercase)
|
||||
c = toupper(c);
|
||||
c -= HU_FONTSTART;
|
||||
|
||||
// character does not exist or is a space
|
||||
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
|
||||
{
|
||||
cx += (spacewidth * dupx)<<FRACBITS;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (charwidth)
|
||||
{
|
||||
w = charwidth * dupx;
|
||||
center = w/2 - SHORT(hu_font[c]->width)*(dupx/2);
|
||||
}
|
||||
else
|
||||
w = SHORT(hu_font[c]->width) * dupx;
|
||||
|
||||
if ((cx>>FRACBITS) > scrwidth)
|
||||
continue;
|
||||
if ((cx>>FRACBITS)+left + w < 0) //left boundary check
|
||||
{
|
||||
cx += w<<FRACBITS;
|
||||
continue;
|
||||
}
|
||||
|
||||
colormap = V_GetStringColormap(charflags);
|
||||
V_DrawFixedPatch(cx + (center<<FRACBITS), cy, FRACUNIT, option, hu_font[c], colormap);
|
||||
|
||||
cx += w<<FRACBITS;
|
||||
}
|
||||
}
|
||||
|
||||
void V_DrawCenteredStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
{
|
||||
x -= (V_StringWidth(string, option) / 2)<<FRACBITS;
|
||||
|
@ -2862,108 +2459,6 @@ void V_DrawRightAlignedStringAtFixed(fixed_t x, fixed_t y, INT32 option, const c
|
|||
V_DrawStringAtFixed(x, y, option, string);
|
||||
}
|
||||
|
||||
// Draws a small string at a fixed_t location.
|
||||
void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
{
|
||||
fixed_t cx = x, cy = y;
|
||||
INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0;
|
||||
const char *ch = string;
|
||||
INT32 charflags = 0;
|
||||
const UINT8 *colormap = NULL;
|
||||
INT32 spacewidth = 2, charwidth = 0;
|
||||
|
||||
INT32 lowercase = (option & V_ALLOWLOWERCASE);
|
||||
option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE...
|
||||
|
||||
if (option & V_NOSCALESTART)
|
||||
{
|
||||
dupx = vid.dupx;
|
||||
dupy = vid.dupy;
|
||||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dupx = dupy = 1;
|
||||
scrwidth = vid.width/vid.dupx;
|
||||
left = (scrwidth - BASEVIDWIDTH)/2;
|
||||
scrwidth -= left;
|
||||
}
|
||||
|
||||
charflags = (option & V_CHARCOLORMASK);
|
||||
|
||||
switch (option & V_SPACINGMASK)
|
||||
{
|
||||
case V_MONOSPACE:
|
||||
spacewidth = 4;
|
||||
/* FALLTHRU */
|
||||
case V_OLDSPACING:
|
||||
charwidth = 4;
|
||||
break;
|
||||
case V_6WIDTHSPACE:
|
||||
spacewidth = 3;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (;;ch++)
|
||||
{
|
||||
if (!*ch)
|
||||
break;
|
||||
if (*ch & 0x80) //color parsing -x 2.16.09
|
||||
{
|
||||
// manually set flags override color codes
|
||||
if (!(option & V_CHARCOLORMASK))
|
||||
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||
continue;
|
||||
}
|
||||
if (*ch == '\n')
|
||||
{
|
||||
cx = x;
|
||||
|
||||
if (option & V_RETURN8)
|
||||
cy += (4*dupy)<<FRACBITS;
|
||||
else
|
||||
cy += (6*dupy)<<FRACBITS;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
c = *ch;
|
||||
if (!lowercase)
|
||||
c = toupper(c);
|
||||
c -= HU_FONTSTART;
|
||||
|
||||
// character does not exist or is a space
|
||||
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
|
||||
{
|
||||
cx += (spacewidth * dupx)<<FRACBITS;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (charwidth)
|
||||
{
|
||||
w = charwidth * dupx;
|
||||
center = w/2 - SHORT(hu_font[c]->width)*(dupx/4);
|
||||
}
|
||||
else
|
||||
w = SHORT(hu_font[c]->width) * dupx / 2;
|
||||
|
||||
if ((cx>>FRACBITS) > scrwidth)
|
||||
break;
|
||||
if ((cx>>FRACBITS)+left + w < 0) //left boundary check
|
||||
{
|
||||
cx += w<<FRACBITS;
|
||||
continue;
|
||||
}
|
||||
|
||||
colormap = V_GetStringColormap(charflags);
|
||||
|
||||
V_DrawFixedPatch(cx + (center<<FRACBITS), cy, FRACUNIT/2, option, hu_font[c], colormap);
|
||||
|
||||
cx += w<<FRACBITS;
|
||||
}
|
||||
}
|
||||
|
||||
void V_DrawCenteredSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
{
|
||||
x -= (V_SmallStringWidth(string, option) / 2)<<FRACBITS;
|
||||
|
@ -2976,108 +2471,6 @@ void V_DrawRightAlignedSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, co
|
|||
V_DrawSmallStringAtFixed(x, y, option, string);
|
||||
}
|
||||
|
||||
// Draws a thin string at a fixed_t location.
|
||||
void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
{
|
||||
fixed_t cx = x, cy = y;
|
||||
INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0;
|
||||
const char *ch = string;
|
||||
INT32 charflags = 0;
|
||||
const UINT8 *colormap = NULL;
|
||||
INT32 spacewidth = 2, charwidth = 0;
|
||||
|
||||
INT32 lowercase = (option & V_ALLOWLOWERCASE);
|
||||
option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE...
|
||||
|
||||
if (option & V_NOSCALESTART)
|
||||
{
|
||||
dupx = vid.dupx;
|
||||
dupy = vid.dupy;
|
||||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dupx = dupy = 1;
|
||||
scrwidth = vid.width/vid.dupx;
|
||||
left = (scrwidth - BASEVIDWIDTH)/2;
|
||||
scrwidth -= left;
|
||||
}
|
||||
|
||||
charflags = (option & V_CHARCOLORMASK);
|
||||
|
||||
switch (option & V_SPACINGMASK)
|
||||
{
|
||||
case V_MONOSPACE:
|
||||
spacewidth = 8;
|
||||
/* FALLTHRU */
|
||||
case V_OLDSPACING:
|
||||
charwidth = 8;
|
||||
break;
|
||||
case V_6WIDTHSPACE:
|
||||
spacewidth = 6;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (;;ch++)
|
||||
{
|
||||
if (!*ch)
|
||||
break;
|
||||
if (*ch & 0x80) //color parsing -x 2.16.09
|
||||
{
|
||||
// manually set flags override color codes
|
||||
if (!(option & V_CHARCOLORMASK))
|
||||
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||
continue;
|
||||
}
|
||||
if (*ch == '\n')
|
||||
{
|
||||
cx = x;
|
||||
|
||||
if (option & V_RETURN8)
|
||||
cy += (8*dupy)<<FRACBITS;
|
||||
else
|
||||
cy += (12*dupy)<<FRACBITS;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
c = *ch;
|
||||
if (!lowercase || !tny_font[c-HU_FONTSTART])
|
||||
c = toupper(c);
|
||||
c -= HU_FONTSTART;
|
||||
|
||||
// character does not exist or is a space
|
||||
if (c < 0 || c >= HU_FONTSIZE || !tny_font[c])
|
||||
{
|
||||
cx += (spacewidth * dupx)<<FRACBITS;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (charwidth)
|
||||
{
|
||||
w = charwidth * dupx;
|
||||
center = w/2 - SHORT(tny_font[c]->width)*(dupx/2);
|
||||
}
|
||||
else
|
||||
w = SHORT(tny_font[c]->width) * dupx;
|
||||
|
||||
if ((cx>>FRACBITS) > scrwidth)
|
||||
break;
|
||||
if ((cx>>FRACBITS)+left + w < 0) //left boundary check
|
||||
{
|
||||
cx += w<<FRACBITS;
|
||||
continue;
|
||||
}
|
||||
|
||||
colormap = V_GetStringColormap(charflags);
|
||||
|
||||
V_DrawFixedPatch(cx + (center<<FRACBITS), cy, FRACUNIT, option, tny_font[c], colormap);
|
||||
|
||||
cx += w<<FRACBITS;
|
||||
}
|
||||
}
|
||||
|
||||
void V_DrawCenteredThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
{
|
||||
x -= (V_ThinStringWidth(string, option) / 2)<<FRACBITS;
|
||||
|
@ -3090,108 +2483,6 @@ void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, con
|
|||
V_DrawThinStringAtFixed(x, y, option, string);
|
||||
}
|
||||
|
||||
// Draws a small string at a fixed_t location.
|
||||
void V_DrawSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
{
|
||||
fixed_t cx = x, cy = y;
|
||||
INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0;
|
||||
const char *ch = string;
|
||||
INT32 charflags = 0;
|
||||
const UINT8 *colormap = NULL;
|
||||
INT32 spacewidth = 2<<FRACBITS, charwidth = 0;
|
||||
|
||||
INT32 lowercase = (option & V_ALLOWLOWERCASE);
|
||||
option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE...
|
||||
|
||||
if (option & V_NOSCALESTART)
|
||||
{
|
||||
dupx = vid.dupx<<FRACBITS;
|
||||
dupy = vid.dupy<<FRACBITS;
|
||||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dupx = dupy = FRACUNIT;
|
||||
scrwidth = FixedDiv(vid.width<<FRACBITS, vid.dupx);
|
||||
left = ((scrwidth - (BASEVIDWIDTH<<FRACBITS))/2);
|
||||
scrwidth -= left;
|
||||
}
|
||||
|
||||
charflags = (option & V_CHARCOLORMASK);
|
||||
|
||||
switch (option & V_SPACINGMASK)
|
||||
{
|
||||
case V_MONOSPACE:
|
||||
spacewidth = 4<<FRACBITS;
|
||||
/* FALLTHRU */
|
||||
case V_OLDSPACING:
|
||||
charwidth = 4<<FRACBITS;
|
||||
break;
|
||||
case V_6WIDTHSPACE:
|
||||
spacewidth = 3<<FRACBITS;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (;;ch++)
|
||||
{
|
||||
if (!*ch)
|
||||
break;
|
||||
if (*ch & 0x80) //color parsing -x 2.16.09
|
||||
{
|
||||
// manually set flags override color codes
|
||||
if (!(option & V_CHARCOLORMASK))
|
||||
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||
continue;
|
||||
}
|
||||
if (*ch == '\n')
|
||||
{
|
||||
cx = x;
|
||||
|
||||
if (option & V_RETURN8)
|
||||
cy += 4*dupy;
|
||||
else
|
||||
cy += 6*dupy;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
c = *ch;
|
||||
if (!lowercase)
|
||||
c = toupper(c);
|
||||
c -= HU_FONTSTART;
|
||||
|
||||
// character does not exist or is a space
|
||||
if (c < 0 || c >= HU_FONTSIZE || !tny_font[c])
|
||||
{
|
||||
cx += FixedMul(spacewidth, dupx);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (charwidth)
|
||||
{
|
||||
w = FixedMul(charwidth, dupx);
|
||||
center = w/2 - SHORT(tny_font[c]->width)*(dupx/4);
|
||||
}
|
||||
else
|
||||
w = SHORT(tny_font[c]->width) * dupx / 2;
|
||||
|
||||
if (cx > scrwidth)
|
||||
break;
|
||||
if (cx+left + w < 0) //left boundary check
|
||||
{
|
||||
cx += w;
|
||||
continue;
|
||||
}
|
||||
|
||||
colormap = V_GetStringColormap(charflags);
|
||||
|
||||
V_DrawFixedPatch(cx + center, cy, FRACUNIT/2, option, tny_font[c], colormap);
|
||||
|
||||
cx += w;
|
||||
}
|
||||
}
|
||||
|
||||
void V_DrawCenteredSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
{
|
||||
x -= V_SmallThinStringWidth(string, option)/4;
|
||||
|
@ -3266,56 +2557,6 @@ void V_DrawLevelActNum(INT32 x, INT32 y, INT32 flags, UINT8 num)
|
|||
}
|
||||
}
|
||||
|
||||
// Write a string using the credit font
|
||||
// NOTE: the text is centered for screens larger than the base width
|
||||
//
|
||||
void V_DrawCreditString(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
{
|
||||
INT32 w, c, dupx, dupy, scrwidth = BASEVIDWIDTH;
|
||||
fixed_t cx = x, cy = y;
|
||||
const char *ch = string;
|
||||
|
||||
// It's possible for string to be a null pointer
|
||||
if (!string)
|
||||
return;
|
||||
|
||||
if (option & V_NOSCALESTART)
|
||||
{
|
||||
dupx = vid.dupx;
|
||||
dupy = vid.dupy;
|
||||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
dupx = dupy = 1;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
c = *ch++;
|
||||
if (!c)
|
||||
break;
|
||||
if (c == '\n')
|
||||
{
|
||||
cx = x;
|
||||
cy += (12*dupy)<<FRACBITS;
|
||||
continue;
|
||||
}
|
||||
|
||||
c = toupper(c) - CRED_FONTSTART;
|
||||
if (c < 0 || c >= CRED_FONTSIZE)
|
||||
{
|
||||
cx += (16*dupx)<<FRACBITS;
|
||||
continue;
|
||||
}
|
||||
|
||||
w = SHORT(cred_font[c]->width) * dupx;
|
||||
if ((cx>>FRACBITS) > scrwidth)
|
||||
continue;
|
||||
|
||||
V_DrawSciencePatch(cx, cy, option, cred_font[c], FRACUNIT);
|
||||
cx += w<<FRACBITS;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw a string using the nt_font
|
||||
// Note that the outline is a seperate font set
|
||||
static void V_DrawNameTagLine(INT32 x, INT32 y, INT32 option, fixed_t scale, UINT8 *basecolormap, UINT8 *outlinecolormap, const char *string)
|
||||
|
@ -3536,71 +2777,6 @@ INT32 V_CreditStringWidth(const char *string)
|
|||
return w;
|
||||
}
|
||||
|
||||
// Write a string using the level title font
|
||||
// NOTE: the text is centered for screens larger than the base width
|
||||
//
|
||||
void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, left = 0;
|
||||
const char *ch = string;
|
||||
INT32 charflags = (option & V_CHARCOLORMASK);
|
||||
const UINT8 *colormap = NULL;
|
||||
|
||||
if (option & V_NOSCALESTART)
|
||||
{
|
||||
dupx = vid.dupx;
|
||||
dupy = vid.dupy;
|
||||
scrwidth = vid.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dupx = dupy = 1;
|
||||
scrwidth = vid.width/vid.dupx;
|
||||
left = (scrwidth - BASEVIDWIDTH)/2;
|
||||
scrwidth -= left;
|
||||
}
|
||||
|
||||
for (;;ch++)
|
||||
{
|
||||
if (!*ch)
|
||||
break;
|
||||
if (*ch & 0x80) //color parsing -x 2.16.09
|
||||
{
|
||||
// manually set flags override color codes
|
||||
if (!(option & V_CHARCOLORMASK))
|
||||
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||
continue;
|
||||
}
|
||||
if (*ch == '\n')
|
||||
{
|
||||
cx = x;
|
||||
cy += 12*dupy;
|
||||
continue;
|
||||
}
|
||||
|
||||
c = *ch - LT_FONTSTART;
|
||||
if (c < 0 || c >= LT_FONTSIZE || !lt_font[c])
|
||||
{
|
||||
cx += 16*dupx;
|
||||
continue;
|
||||
}
|
||||
|
||||
w = SHORT(lt_font[c]->width) * dupx;
|
||||
|
||||
if (cx > scrwidth)
|
||||
continue;
|
||||
if (cx+left + w < 0) //left boundary check
|
||||
{
|
||||
cx += w;
|
||||
continue;
|
||||
}
|
||||
|
||||
colormap = V_GetStringColormap(charflags);
|
||||
V_DrawFixedPatch(cx<<FRACBITS, cy<<FRACBITS, FRACUNIT, option, lt_font[c], colormap);
|
||||
|
||||
cx += w;
|
||||
}
|
||||
}
|
||||
|
||||
// Find string width from lt_font chars
|
||||
//
|
||||
|
|
|
@ -182,6 +182,12 @@ void V_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c, UINT16 color, U
|
|||
void V_DrawFadeConsBack(INT32 plines);
|
||||
void V_DrawPromptBack(INT32 boxheight, INT32 color);
|
||||
|
||||
/* Convenience macros for leagacy string function macros. */
|
||||
#define V__DrawOneScaleString( x,y,scale,option,font,string ) \
|
||||
V_DrawStringScaled(x,y,scale,FRACUNIT,FRACUNIT,option,font,string)
|
||||
#define V__DrawDupxString( x,y,scale,option,font,string )\
|
||||
V__DrawOneScaleString ((x)<<FRACBITS,(y)<<FRACBITS,scale,option,font,string)
|
||||
|
||||
// draw a single character
|
||||
void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed);
|
||||
// draw a single character, but for the chat
|
||||
|
@ -189,7 +195,8 @@ void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UI
|
|||
|
||||
UINT8 *V_GetStringColormap(INT32 colorflags);
|
||||
|
||||
void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
#define V_DrawLevelTitle( x,y,option,string ) \
|
||||
V__DrawDupxString (x,y,FRACUNIT,option,LT_FONT,string)
|
||||
|
||||
// wordwrap a string using the hu_font
|
||||
char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string);
|
||||
|
@ -207,42 +214,50 @@ void V_DrawStringScaled(
|
|||
const char *text);
|
||||
|
||||
// draw a string using the hu_font
|
||||
void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
#define V_DrawString( x,y,option,string ) \
|
||||
V__DrawDupxString (x,y,FRACUNIT,option,HU_FONT,string)
|
||||
void V_DrawCenteredString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
|
||||
// draw a string using the hu_font, 0.5x scale
|
||||
void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
#define V_DrawSmallString( x,y,option,string ) \
|
||||
V__DrawDupxString (x,y,FRACUNIT>>1,option,HU_FONT,string)
|
||||
void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
|
||||
// draw a string using the tny_font
|
||||
void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
#define V_DrawThinString( x,y,option,string ) \
|
||||
V__DrawDupxString (x,y,FRACUNIT,option,TINY_FONT,string)
|
||||
void V_DrawCenteredThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
|
||||
// draw a string using the tny_font, 0.5x scale
|
||||
void V_DrawSmallThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
#define V_DrawSmallThinString( x,y,option,string ) \
|
||||
V__DrawDupxString (x,y,FRACUNIT>>1,option,TINY_FONT,string)
|
||||
void V_DrawCenteredSmallThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedSmallThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
|
||||
// draw a string using the hu_font at fixed_t coordinates
|
||||
void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
#define V_DrawStringAtFixed( x,y,option,string ) \
|
||||
V__DrawOneScaleString (x,y,FRACUNIT,option,HU_FONT,string)
|
||||
void V_DrawCenteredStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
|
||||
// draw a string using the hu_font at fixed_t coordinates, 0.5x scale
|
||||
void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
#define V_DrawSmallStringAtFixed( x,y,option,string ) \
|
||||
V__DrawOneScaleString (x,y,FRACUNIT>>1,option,HU_FONT,string)
|
||||
void V_DrawCenteredSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
|
||||
// draw a string using the tny_font at fixed_t coordinates
|
||||
void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
#define V_DrawThinStringAtFixed( x,y,option,string ) \
|
||||
V__DrawOneScaleString (x,y,FRACUNIT,option,TINY_FONT,string)
|
||||
void V_DrawCenteredThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
|
||||
// draw a string using the tny_font at fixed_t coordinates, 0.5x scale
|
||||
void V_DrawSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
#define V_DrawSmallThinStringAtFixed( x,y,option,string ) \
|
||||
V__DrawOneScaleString (x,y,FRACUNIT>>1,option,TINY_FONT,string)
|
||||
void V_DrawCenteredSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
|
||||
|
@ -256,7 +271,8 @@ INT32 V_LevelNameWidth(const char *string);
|
|||
INT32 V_LevelNameHeight(const char *string);
|
||||
INT16 V_LevelActNumWidth(UINT8 num); // act number width
|
||||
|
||||
void V_DrawCreditString(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
#define V_DrawCreditString( x,y,option,string ) \
|
||||
V__DrawOneScaleString (x,y,FRACUNIT,option,CRED_FONT,string)
|
||||
INT32 V_CreditStringWidth(const char *string);
|
||||
|
||||
// Draw a string using the nt_font
|
||||
|
|
Loading…
Reference in a new issue