Fix P_GetZAt for Lua

This commit is contained in:
Louis-Antoine 2020-05-18 16:16:45 +02:00
parent d0abd6e86c
commit 435643b958

View file

@ -2184,16 +2184,18 @@ static int lib_evStartCrumble(lua_State *L)
static int lib_pGetZAt(lua_State *L)
{
pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE));
fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3);
//HUDSAFE
if (slope)
lua_pushfixed(L, P_GetSlopeZAt(slope, x, y));
else
if (lua_isnil(L, 1))
{
fixed_t z = luaL_checkfixed(L, 4);
lua_pushfixed(L, P_GetZAt(slope, x, y, z));
lua_pushfixed(L, P_GetZAt(NULL, x, y, z));
}
else
{
pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE));
lua_pushfixed(L, P_GetSlopeZAt(slope, x, y));
}
return 1;