From cb5e433a49c61fda688de6d5dd5910c106df34e3 Mon Sep 17 00:00:00 2001 From: Radicalicious Date: Thu, 3 Jun 2021 09:34:18 -0400 Subject: [PATCH 1/2] Update lua_hudlib.c --- src/lua_hudlib.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 684e47c38..14d7d7f3c 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -794,6 +794,27 @@ static int libd_drawString(lua_State *L) return 0; } +static int libd_drawLevelActNum(lua_State *L) +{ + INT32 x; + INT32 y; + INT32 flags; + UINT8 num; + + HUDONLY + + x = luaL_checkinteger(L, 1); + y = luaL_checkinteger(L, 2); + flags = luaL_optinteger(L, 3, 0); + num = luaL_checkinteger(L, 4); + + flags &= ~V_PARAMMASK; // Don't let crashes happen. + + V_DrawLevelActNum(x, y, flags, num); + return 0; +} + + static int libd_drawNameTag(lua_State *L) { INT32 x; @@ -878,6 +899,20 @@ static int libd_stringWidth(lua_State *L) return 1; } +static int libd_levelActNumWidth(lua_State *L) +{ + HUDONLY + lua_pushinteger(L, V_LevelActNumWidth(luaL_checkinteger(L, 1))); + return 1; +} + +static int libd_levelActNumHeight(lua_State *L) +{ + HUDONLY + lua_pushinteger(L, V_LevelActNumHeight(luaL_checkinteger(L, 1))); + return 1; +} + static int libd_nameTagWidth(lua_State *L) { HUDONLY @@ -1086,11 +1121,14 @@ static luaL_Reg lib_draw[] = { {"drawPaddedNum", libd_drawPaddedNum}, {"drawFill", libd_drawFill}, {"drawString", libd_drawString}, + {"drawLevelActNum", libd_drawLevelActNum}, {"drawNameTag", libd_drawNameTag}, {"drawScaledNameTag", libd_drawScaledNameTag}, {"fadeScreen", libd_fadeScreen}, // misc {"stringWidth", libd_stringWidth}, + {"levelActNumWidth", libd_levelActNumWidth}, + {"levelActNumHeight", libd_levelActNumHeight}, {"nameTagWidth", libd_nameTagWidth}, // m_random {"RandomFixed",libd_RandomFixed}, From 7483a9d049230e983e5fd8b44dd733c7bf26bb16 Mon Sep 17 00:00:00 2001 From: Radicalicious Date: Thu, 3 Jun 2021 10:55:42 -0400 Subject: [PATCH 2/2] Switch num and flags so flags is optional --- src/lua_hudlib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 14d7d7f3c..5e974675f 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -798,15 +798,15 @@ static int libd_drawLevelActNum(lua_State *L) { INT32 x; INT32 y; - INT32 flags; UINT8 num; + INT32 flags; HUDONLY x = luaL_checkinteger(L, 1); y = luaL_checkinteger(L, 2); - flags = luaL_optinteger(L, 3, 0); - num = luaL_checkinteger(L, 4); + num = luaL_checkinteger(L, 3); + flags = luaL_optinteger(L, 4, 0); flags &= ~V_PARAMMASK; // Don't let crashes happen.