From fe179331560aab088385bcb7c22b025226aaec29 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Tue, 8 Oct 2019 22:16:50 -0500 Subject: [PATCH] Make V_DrawCenteredSmallThinString() a less precise wrapper for V_DrawCenteredSmallThinStringAtFixed() for new "small-thin-center" option in v.drawString() --- src/lua_hudlib.c | 5 +++++ src/v_video.c | 7 +++++++ src/v_video.h | 1 + 3 files changed, 13 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 5c2cd6e32..d15fe2cea 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -122,6 +122,7 @@ enum align { align_smallcenter, align_smallright, align_smallthin, + align_smallthincenter, align_smallthinright, align_smallthinfixed, align_smallthinfixedcenter, @@ -147,6 +148,7 @@ static const char *const align_opt[] = { "small-center", "small-right", "small-thin", + "small-thin-center", "small-thin-right", "small-thin-fixed", "small-thin-fixed-center", @@ -787,6 +789,9 @@ static int libd_drawString(lua_State *L) case align_smallthin: V_DrawSmallThinString(x, y, flags, str); break; + case align_smallthincenter: + V_DrawCenteredSmallThinString(x, y, flags, str); + break; case align_smallthinright: V_DrawRightAlignedSmallThinString(x, y, flags, str); break; diff --git a/src/v_video.c b/src/v_video.c index e7cf845d8..8a4a3a030 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2435,6 +2435,13 @@ void V_DrawSmallThinString(INT32 x, INT32 y, INT32 option, const char *string) V_DrawSmallThinStringAtFixed((fixed_t)x, (fixed_t)y, option, string); } +void V_DrawCenteredSmallThinString(INT32 x, INT32 y, INT32 option, const char *string) +{ + x <<= FRACBITS; + y <<= FRACBITS; + V_DrawCenteredSmallThinStringAtFixed((fixed_t)x, (fixed_t)y, option, string); +} + void V_DrawRightAlignedSmallThinString(INT32 x, INT32 y, INT32 option, const char *string) { x <<= FRACBITS; diff --git a/src/v_video.h b/src/v_video.h index 169687183..1e7af29d2 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -215,6 +215,7 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st // draw a string using the tny_font, 0.5x scale void V_DrawSmallThinString(INT32 x, INT32 y, INT32 option, const char *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