From cb5c90fc40a8d9d0521a9e549830284cc93456ff Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sat, 7 Sep 2019 17:37:21 -0500 Subject: [PATCH] Create V_DrawRightAlignedThinStringAtFixed() for new "thin-fixed-right" option in v.drawString() These function names are starting to become rediculous... --- src/lua_hudlib.c | 5 +++++ src/v_video.c | 6 ++++++ src/v_video.h | 3 +++ 3 files changed, 14 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index c10bc2efd..61c1ea141 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -122,6 +122,7 @@ enum align { align_smallthin, align_thin, align_thinfixed, + align_thinfixedright, align_thincenter, align_thinright }; @@ -139,6 +140,7 @@ static const char *const align_opt[] = { "small-thin", "thin", "thin-fixed", + "thin-fixed-right", "thin-center", "thin-right", NULL}; @@ -778,6 +780,9 @@ static int libd_drawString(lua_State *L) case align_thinfixed: V_DrawThinStringAtFixed(x, y, flags, str); break; + case align_thinfixedright: + V_DrawRightAlignedThinStringAtFixed(x, y, flags, str); + break; } return 0; } diff --git a/src/v_video.c b/src/v_video.c index 33608de44..c59bebf34 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2848,6 +2848,12 @@ void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *str } } +void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + x -= V_ThinStringWidth(string, option)<