Use R_PointToDist2 for the Lua versions of P_AproxDistance and FixedHypot

This commit is contained in:
LJ Sonic 2021-02-13 18:04:12 +01:00
parent a58df577fe
commit 758de501da
2 changed files with 3 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;
}