From c4648a2b1cd9267ac02da63c91240db7c62432f5 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Tue, 2 Jan 2018 13:04:28 +0200 Subject: [PATCH] Added CheckMove() function to ZScript Actor class https://forum.zdoom.org/viewtopic.php?t=58964 --- src/p_map.cpp | 8 ++++++++ wadsrc/static/zscript/actor.txt | 1 + wadsrc/static/zscript/constants.txt | 9 +++++++++ 3 files changed, 18 insertions(+) diff --git a/src/p_map.cpp b/src/p_map.cpp index 56eea2e1f0..ea4031eb48 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -2879,6 +2879,14 @@ bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags) return true; } +DEFINE_ACTION_FUNCTION(AActor, CheckMove) +{ + PARAM_SELF_PROLOGUE(AActor); + PARAM_FLOAT(x); + PARAM_FLOAT(y); + PARAM_INT_DEF(flags); + ACTION_RETURN_BOOL(P_CheckMove(self, DVector2(x, y), flags)); +} //========================================================================== diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index ee464a35b5..d9847e2b14 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -624,6 +624,7 @@ class Actor : Thinker native } native bool TryMove(vector2 newpos, int dropoff, bool missilecheck = false, FCheckPosition tm = null); + native bool CheckMove(vector2 newpos, int flags = 0); native void NewChaseDir(); native void RandomChaseDir(); native bool CheckMissileRange(); diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index e35af3a80f..e6954b7896 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -516,6 +516,15 @@ enum EWarpFlags WARPF_COPYPITCH = 0x8000, }; +// Flags for Actor.CheckMove() + +enum ECheckMoveFlags +{ + PCM_DROPOFF = 1, + PCM_NOACTORS = 1 << 1, + PCM_NOLINES = 1 << 2, +}; + // flags for A_SetPitch/SetAngle/SetRoll enum EAngleFlags {