Add P_GetZAt to Lua

This commit is contained in:
Monster Iestyn 2018-10-20 21:08:59 +01:00
parent 61fa7026a1
commit 4edeeb6953

View file

@ -14,6 +14,9 @@
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
#include "p_local.h" #include "p_local.h"
#include "p_setup.h" // So we can have P_SetupLevelSky #include "p_setup.h" // So we can have P_SetupLevelSky
#ifdef ESLOPE
#include "p_slopes.h" // P_GetZAt
#endif
#include "z_zone.h" #include "z_zone.h"
#include "r_main.h" #include "r_main.h"
#include "r_things.h" #include "r_things.h"
@ -1547,6 +1550,24 @@ static int lib_evCrumbleChain(lua_State *L)
return 0; return 0;
} }
#ifdef ESLOPE
// P_SLOPES
////////////
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)
return LUA_ErrInvalid(L, "pslope_t");
lua_pushfixed(L, P_GetZAt(slope, x, y));
return 1;
}
#endif
// R_DEFS // R_DEFS
//////////// ////////////
@ -2113,6 +2134,11 @@ static luaL_Reg lib[] = {
{"P_StartQuake",lib_pStartQuake}, {"P_StartQuake",lib_pStartQuake},
{"EV_CrumbleChain",lib_evCrumbleChain}, {"EV_CrumbleChain",lib_evCrumbleChain},
#ifdef ESLOPE
// p_slopes
{"P_GetZAt",lib_pGetZAt},
#endif
// r_defs // r_defs
{"R_PointToAngle",lib_rPointToAngle}, {"R_PointToAngle",lib_rPointToAngle},
{"R_PointToAngle2",lib_rPointToAngle2}, {"R_PointToAngle2",lib_rPointToAngle2},