Exports P_ActivateLine to ZScript (along with constants for activation type)

This commit is contained in:
Marisa Kirisame 2018-04-07 16:58:30 +02:00 committed by Christoph Oelckers
parent 7c70e0971c
commit 5d0ff4c8ba
3 changed files with 39 additions and 0 deletions

View file

@ -242,6 +242,26 @@ bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType, DVe
return true; 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 // P_TestActivateLine

View file

@ -1223,3 +1223,21 @@ enum ActorRenderFeatureFlag
RFF_VOXELS = 1<<12, // renderer is capable of voxels 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),
};

View file

@ -156,6 +156,7 @@ struct Line native play
native Line getPortalDestination(); native Line getPortalDestination();
native int getPortalAlignment(); native int getPortalAlignment();
native int Index(); native int Index();
native bool Activate(Actor activator, int side, int type, Vector3 pos = (double.nan, double.nan, double.nan));
int GetUDMFInt(Name nm) int GetUDMFInt(Name nm)
{ {