mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
Small hud library additions
This commit is contained in:
parent
0e6c5cf342
commit
a0495142df
1 changed files with 25 additions and 0 deletions
|
@ -560,6 +560,15 @@ static int libd_renderer(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 30/10/18 Lat': Get cv_translucenthud's value for HUD rendering as a normal V_xxTRANS int
|
||||||
|
// Could as well be thrown in global vars for ease of access but I guess it makes sense for it to be a HUD fn
|
||||||
|
static int libd_getlocaltransflag(lua_State *L)
|
||||||
|
{
|
||||||
|
HUDONLY
|
||||||
|
lua_pushinteger(L, (10-cv_translucenthud.value)*V_10TRANS); // A bit weird that it's called "translucenthud" yet 10 is fully opaque :V
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static luaL_Reg lib_draw[] = {
|
static luaL_Reg lib_draw[] = {
|
||||||
{"patchExists", libd_patchExists},
|
{"patchExists", libd_patchExists},
|
||||||
{"cachePatch", libd_cachePatch},
|
{"cachePatch", libd_cachePatch},
|
||||||
|
@ -576,6 +585,7 @@ static luaL_Reg lib_draw[] = {
|
||||||
{"dupx", libd_dupx},
|
{"dupx", libd_dupx},
|
||||||
{"dupy", libd_dupy},
|
{"dupy", libd_dupy},
|
||||||
{"renderer", libd_renderer},
|
{"renderer", libd_renderer},
|
||||||
|
{"localTransFlag", libd_getlocaltransflag},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -599,6 +609,20 @@ static int lib_huddisable(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 30/10/18: Lat': How come this wasn't here before?
|
||||||
|
static int lib_hudenabled(lua_State *L)
|
||||||
|
{
|
||||||
|
enum hud option = luaL_checkoption(L, 1, NULL, hud_disable_options);
|
||||||
|
lua_settop(L, 2);
|
||||||
|
if (!gL || hud_enabled[option/8] & (1<<(option%8)))
|
||||||
|
lua_pushboolean(L, true);
|
||||||
|
else
|
||||||
|
lua_pushboolean(L, false);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// add a HUD element for rendering
|
// add a HUD element for rendering
|
||||||
static int lib_hudadd(lua_State *L)
|
static int lib_hudadd(lua_State *L)
|
||||||
{
|
{
|
||||||
|
@ -623,6 +647,7 @@ static int lib_hudadd(lua_State *L)
|
||||||
static luaL_Reg lib_hud[] = {
|
static luaL_Reg lib_hud[] = {
|
||||||
{"enable", lib_hudenable},
|
{"enable", lib_hudenable},
|
||||||
{"disable", lib_huddisable},
|
{"disable", lib_huddisable},
|
||||||
|
{"enabled", lib_hudenabled},
|
||||||
{"add", lib_hudadd},
|
{"add", lib_hudadd},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue