diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index e5c384949..60d4d1c21 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -123,6 +123,7 @@ enum align { align_smallright, align_smallthin, align_smallthinfixed, + align_smallthinfixedcenter, align_smallthinfixedright, align_thin, align_thinfixed, @@ -146,6 +147,7 @@ static const char *const align_opt[] = { "small-right", "small-thin", "small-thin-fixed", + "small-thin-fixed-center", "small-thin-fixed-right", "thin", "thin-fixed", @@ -786,6 +788,9 @@ static int libd_drawString(lua_State *L) case align_smallthinfixed: V_DrawSmallThinStringAtFixed(x, y, flags, str); break; + case align_smallthinfixedcenter: + V_DrawCenteredSmallThinStringAtFixed(x, y, flags, str); + break; case align_smallthinfixedright: V_DrawRightAlignedSmallThinStringAtFixed(x, y, flags, str); break; diff --git a/src/v_video.c b/src/v_video.c index a90735927..cdacd8127 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2885,6 +2885,12 @@ void V_DrawSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char } } +void V_DrawCenteredSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + x -= V_SmallThinStringWidth(string, option)/4; + V_DrawSmallThinStringAtFixed(x, y, option, string); +} + void V_DrawRightAlignedSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) { x -= V_SmallThinStringWidth(string, option)/2; diff --git a/src/v_video.h b/src/v_video.h index 5b038419f..9c7d67b11 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -233,7 +233,8 @@ void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, con // 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); -void V_DrawRightAlignedSmallThinStringAtFixed(INT32 x, INT32 y, INT32 option, const char *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); // Draw tall nums, used for menu, HUD, intermission void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num);