diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 2d7d3ddc0..e287ef047 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -242,6 +242,26 @@ bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType, DVe return true; } +DEFINE_ACTION_FUNCTION(_Line, Activate) +{ + PARAM_SELF_PROLOGUE(line_t); + PARAM_POINTER(mo, AActor); + PARAM_INT(side); + PARAM_INT(activationType); + PARAM_FLOAT_DEF(optx); + PARAM_FLOAT_DEF(opty); + PARAM_FLOAT_DEF(optz); + if ( optx == opty == optz == NAN ) + { + ACTION_RETURN_BOOL(P_ActivateLine(self, mo, side, activationType, NULL)); + } + else + { + DVector3 optpos = DVector3(optx, opty, optz); + ACTION_RETURN_BOOL(P_ActivateLine(self, mo, side, activationType, &optpos)); + } +} + //============================================================================ // // P_TestActivateLine diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index ef20e2310..fea498deb 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -1223,3 +1223,21 @@ enum ActorRenderFeatureFlag RFF_VOXELS = 1<<12, // renderer is capable of voxels }; +// Special activation types +enum SPAC +{ + SPAC_Cross = 1<<0, // when player crosses line + SPAC_Use = 1<<1, // when player uses line + SPAC_MCross = 1<<2, // when monster crosses line + SPAC_Impact = 1<<3, // when projectile hits line + SPAC_Push = 1<<4, // when player pushes line + SPAC_PCross = 1<<5, // when projectile crosses line + SPAC_UseThrough = 1<<6, // when player uses line (doesn't block) + // SPAC_PTOUCH is mapped to SPAC_PCross|SPAC_Impact + SPAC_AnyCross = 1<<7, // when anything without the MF2_TELEPORT flag crosses the line + SPAC_MUse = 1<<8, // monsters can use + SPAC_MPush = 1<<9, // monsters can push + SPAC_UseBack = 1<<10, // Can be used from the backside + + SPAC_PlayerActivate = (SPAC_Cross|SPAC_Use|SPAC_Impact|SPAC_Push|SPAC_AnyCross|SPAC_UseThrough|SPAC_UseBack), +}; diff --git a/wadsrc/static/zscript/mapdata.txt b/wadsrc/static/zscript/mapdata.txt index e219e835a..d7373d766 100644 --- a/wadsrc/static/zscript/mapdata.txt +++ b/wadsrc/static/zscript/mapdata.txt @@ -156,6 +156,7 @@ struct Line native play native Line getPortalDestination(); native int getPortalAlignment(); native int Index(); + native bool Activate(Actor activator, int side, int type, Vector3 pos = (double.nan, double.nan, double.nan)); int GetUDMFInt(Name nm) {