Skip to content
Snippets Groups Projects
Commit e7156db7 authored by Golden's avatar Golden
Browse files

Allow Lua to draw level title strings, and get the width and height of what would be drawn

parent 43c21edc
No related branches found
No related tags found
1 merge request!1329Some more intermission features for Lua
...@@ -859,6 +859,26 @@ static int libd_drawScaledNameTag(lua_State *L) ...@@ -859,6 +859,26 @@ static int libd_drawScaledNameTag(lua_State *L)
return 0; return 0;
} }
static int libd_drawLevelTitle(lua_State *L)
{
INT32 x;
INT32 y;
const char *str;
INT32 flags;
HUDONLY
x = luaL_checkinteger(L, 1);
y = luaL_checkinteger(L, 2);
str = luaL_checkstring(L, 3);
flags = luaL_optinteger(L, 4, 0);
flags &= ~V_PARAMMASK; // Don't let crashes happen.
V_DrawLevelTitle(x, y, flags, str);
return 0;
}
static int libd_stringWidth(lua_State *L) static int libd_stringWidth(lua_State *L)
{ {
const char *str = luaL_checkstring(L, 1); const char *str = luaL_checkstring(L, 1);
...@@ -888,6 +908,20 @@ static int libd_nameTagWidth(lua_State *L) ...@@ -888,6 +908,20 @@ static int libd_nameTagWidth(lua_State *L)
return 1; return 1;
} }
static int libd_levelTitleWidth(lua_State *L)
{
HUDONLY
lua_pushinteger(L, V_LevelNameWidth(luaL_checkstring(L, 1)));
return 1;
}
static int libd_levelTitleHeight(lua_State *L)
{
HUDONLY
lua_pushinteger(L, V_LevelNameHeight(luaL_checkstring(L, 1)));
return 1;
}
static int libd_getColormap(lua_State *L) static int libd_getColormap(lua_State *L)
{ {
INT32 skinnum = TC_DEFAULT; INT32 skinnum = TC_DEFAULT;
...@@ -1093,10 +1127,13 @@ static luaL_Reg lib_draw[] = { ...@@ -1093,10 +1127,13 @@ static luaL_Reg lib_draw[] = {
{"drawString", libd_drawString}, {"drawString", libd_drawString},
{"drawNameTag", libd_drawNameTag}, {"drawNameTag", libd_drawNameTag},
{"drawScaledNameTag", libd_drawScaledNameTag}, {"drawScaledNameTag", libd_drawScaledNameTag},
{"drawLevelTitle", libd_drawLevelTitle},
{"fadeScreen", libd_fadeScreen}, {"fadeScreen", libd_fadeScreen},
// misc // misc
{"stringWidth", libd_stringWidth}, {"stringWidth", libd_stringWidth},
{"nameTagWidth", libd_nameTagWidth}, {"nameTagWidth", libd_nameTagWidth},
{"levelTitleWidth", libd_levelTitleWidth},
{"levelTitleHeight", libd_levelTitleHeight},
// m_random // m_random
{"RandomFixed",libd_RandomFixed}, {"RandomFixed",libd_RandomFixed},
{"RandomByte",libd_RandomByte}, {"RandomByte",libd_RandomByte},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment