diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index f890f62c0..935a41b43 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -122,6 +122,7 @@ enum align { align_smallcenter, align_smallright, align_smallthin, + align_smallthinfixed, align_thin, align_thinfixed, align_thinfixedcenter, @@ -143,6 +144,7 @@ static const char *const align_opt[] = { "small-center", "small-right", "small-thin", + "small-thin-fixed", "thin", "thin-fixed", "thin-fixed-center", @@ -779,6 +781,9 @@ static int libd_drawString(lua_State *L) case align_smallthin: V_DrawSmallThinString(x, y, flags, str); break; + case align_smallthinfixed: + V_DrawSmallThinStringAtFixed(x, y, flags, str); + break; // tny_font case align_thin: V_DrawThinString(x, y, flags, str); diff --git a/src/v_video.c b/src/v_video.c index a4c1bf6ba..3e64c7748 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2872,6 +2872,108 @@ 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<= 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; + } +} + // Draws a tallnum. Replaces two functions in y_inter and st_stuff void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num) { diff --git a/src/v_video.h b/src/v_video.h index 33328de8c..f1e33e154 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -231,6 +231,8 @@ void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *str 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); +void V_DrawSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); + // Draw tall nums, used for menu, HUD, intermission void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num); void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits);