diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 7a633f757..f890f62c0 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -117,6 +117,7 @@ enum align { align_fixedright, align_small, align_smallfixed, + align_smallfixedcenter, align_smallfixedright, align_smallcenter, align_smallright, @@ -137,6 +138,7 @@ static const char *const align_opt[] = { "fixed-right", "small", "small-fixed", + "small-fixed-center", "small-fixed-right", "small-center", "small-right", @@ -762,6 +764,9 @@ static int libd_drawString(lua_State *L) case align_smallfixed: V_DrawSmallStringAtFixed(x, y, flags, str); break; + case align_smallfixedcenter: + V_DrawCenteredSmallStringAtFixed(x, y, flags, str); + break; case align_smallfixedright: V_DrawRightAlignedSmallStringAtFixed(x, y, flags, str); break; diff --git a/src/v_video.c b/src/v_video.c index dba9ed2dc..a4c1bf6ba 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2746,6 +2746,12 @@ void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *st } } +void V_DrawCenteredSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + x -= (V_SmallStringWidth(string, option) / 2)<