diff --git a/src/lua_baselib.c b/src/lua_baselib.c index c5f847be6..916fa9254 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -432,7 +432,7 @@ static int lib_pAproxDistance(lua_State *L) fixed_t dx = luaL_checkfixed(L, 1); fixed_t dy = luaL_checkfixed(L, 2); //HUDSAFE - lua_pushfixed(L, P_AproxDistance(dx, dy)); + lua_pushfixed(L, R_PointToDist2(0, 0, dx, dy)); return 1; } diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index 10ba42ee0..b6046ab53 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -15,6 +15,7 @@ #include "tables.h" #include "p_local.h" #include "doomstat.h" // for ALL7EMERALDS +#include "r_main.h" // for R_PointToDist2 #include "lua_script.h" #include "lua_libs.h" @@ -129,7 +130,7 @@ static int lib_fixedsqrt(lua_State *L) static int lib_fixedhypot(lua_State *L) { - lua_pushfixed(L, FixedHypot(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2))); + lua_pushfixed(L, R_PointToDist2(0, 0, luaL_checkfixed(L, 1), luaL_checkfixed(L, 2))); return 1; }