diff --git a/src/v_video.c b/src/v_video.c index a58d2e213..f6e3e400e 100644 --- a/src/v_video.c +++ b/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)<= 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)<= 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<= HU_FONTSIZE || !hu_font[c]) - { - cx += (spacewidth * dupx)<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<= HU_FONTSIZE || !hu_font[c]) - { - cx += (spacewidth * dupx)<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<= HU_FONTSIZE || !tny_font[c]) - { - cx += (spacewidth * dupx)<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<= 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)<= CRED_FONTSIZE) - { - cx += (16*dupx)<width) * dupx; - if ((cx>>FRACBITS) > scrwidth) - continue; - - V_DrawSciencePatch(cx, cy, option, cred_font[c], FRACUNIT); - cx += w<= 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<>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