Exposed Box and PointOnLineSide

This commit is contained in:
Boondorl 2022-12-08 14:16:11 -05:00 committed by Christoph Oelckers
parent dce456783d
commit 9a1e666303
2 changed files with 42 additions and 0 deletions

View file

@ -2092,3 +2092,42 @@ int BoxOnLineSide(const FBoundingBox &box, const line_t* ld)
return (p1 == p2) ? p1 : -1;
}
DEFINE_ACTION_FUNCTION(FLevelLocals, PointOnLineSide)
{
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_POINTER(l, line_t);
PARAM_BOOL(precise);
int res;
if (precise) // allow forceful overriding of compat flag
res = P_PointOnLineSidePrecise(x, y, l);
else
res = P_PointOnLineSide(x, y, l);
ACTION_RETURN_INT(res);
}
DEFINE_ACTION_FUNCTION(FLevelLocals, ActorOnLineSide)
{
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_OBJECT(mo, AActor);
PARAM_POINTER(l, line_t);
FBoundingBox box(mo->X(), mo->Y(), mo->radius);
ACTION_RETURN_INT(BoxOnLineSide(box, l));
}
DEFINE_ACTION_FUNCTION(FLevelLocals, BoxOnLineSide)
{
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_FLOAT(radius);
PARAM_POINTER(l, line_t);
FBoundingBox box(x, y, radius);
ACTION_RETURN_INT(BoxOnLineSide(box, l));
}

View file

@ -516,6 +516,9 @@ struct LevelLocals native
native clearscope vector3 Vec3Offset(vector3 pos, vector3 dir, bool absolute = false) const;
native clearscope Vector2 GetDisplacement(int pg1, int pg2) const;
native clearscope int GetPortalGroupCount() const;
native clearscope int PointOnLineSide(Vector2 pos, Line l, bool precise = false) const;
native clearscope int ActorOnLineSide(Actor mo, Line l) const;
native clearscope int BoxOnLineSide(Vector2 pos, double radius, Line l) const;
native String GetChecksum() const;