diff --git a/src/playsim/p_maputl.cpp b/src/playsim/p_maputl.cpp index aca40e741d..9c5bd14b18 100644 --- a/src/playsim/p_maputl.cpp +++ b/src/playsim/p_maputl.cpp @@ -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)); +} + diff --git a/wadsrc/static/zscript/doombase.zs b/wadsrc/static/zscript/doombase.zs index c9fa7e1d74..58677b8ca1 100644 --- a/wadsrc/static/zscript/doombase.zs +++ b/wadsrc/static/zscript/doombase.zs @@ -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;