Merge branch 'draw-act-num' into 'next'

Expose act number drawing functions to Lua

See merge request STJr/SRB2!1532
This commit is contained in:
Tatsuru 2021-09-12 22:15:43 +00:00
commit 30567d75df

View file

@ -919,6 +919,27 @@ static int libd_drawString(lua_State *L)
return 0;
}
static int libd_drawLevelActNum(lua_State *L)
{
INT32 x;
INT32 y;
UINT8 num;
INT32 flags;
HUDONLY
x = luaL_checkinteger(L, 1);
y = luaL_checkinteger(L, 2);
num = luaL_checkinteger(L, 3);
flags = luaL_optinteger(L, 4, 0);
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;
@ -1023,6 +1044,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
@ -1252,12 +1287,15 @@ static luaL_Reg lib_draw[] = {
{"drawPaddedNum", libd_drawPaddedNum},
{"drawFill", libd_drawFill},
{"drawString", libd_drawString},
{"drawLevelActNum", libd_drawLevelActNum},
{"drawNameTag", libd_drawNameTag},
{"drawScaledNameTag", libd_drawScaledNameTag},
{"drawLevelTitle", libd_drawLevelTitle},
{"fadeScreen", libd_fadeScreen},
// misc
{"stringWidth", libd_stringWidth},
{"levelActNumWidth", libd_levelActNumWidth},
{"levelActNumHeight", libd_levelActNumHeight},
{"nameTagWidth", libd_nameTagWidth},
{"levelTitleWidth", libd_levelTitleWidth},
{"levelTitleHeight", libd_levelTitleHeight},