diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 914b2fecf..e0d3c52fa 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -115,6 +115,7 @@ enum align { align_fixed, align_small, align_smallfixed, + align_smallcenter, align_smallright, align_thin, align_thinfixed, @@ -127,6 +128,7 @@ static const char *const align_opt[] = { "fixed", "small", "small-fixed", + "small-center", "small-right", "thin", "thin-fixed", @@ -740,6 +742,9 @@ static int libd_drawString(lua_State *L) case align_smallfixed: V_DrawSmallStringAtFixed(x, y, flags, str); break; + case align_smallcenter: + V_DrawCenteredSmallString(x, y, flags, str); + break; case align_smallright: V_DrawRightAlignedSmallString(x, y, flags, str); break; diff --git a/src/v_video.c b/src/v_video.c index aaa796e8b..973cbc0c4 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2299,6 +2299,13 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string) } } +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); diff --git a/src/v_video.h b/src/v_video.h index 06397d409..6f03c4d8f 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -205,6 +205,7 @@ 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); +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