From c3894ee348b9e80525eee22e5a28eefb593f9eb4 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Tue, 18 Sep 2018 01:14:39 +0200 Subject: [PATCH] Exports various resurrection-related functions to ZScript. --- src/p_actionfunctions.cpp | 25 ++++++++++++++++++++++++- src/p_enemy.cpp | 6 ++++++ src/p_mobj.cpp | 7 +++++++ wadsrc/static/zscript/actor.txt | 4 ++++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index a7a12f9f1a..3c0d351534 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -4551,7 +4551,30 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseSiblings) } return 0; } - + +//=========================================================================== +// +// A_RaiseSelf +// +//=========================================================================== +DEFINE_ACTION_FUNCTION(AActor, A_RaiseSelf) +{ + PARAM_SELF_PROLOGUE(AActor); + PARAM_INT_DEF(flags); + ACTION_RETURN_BOOL(P_Thing_Raise(self, NULL, (flags & RF_NOCHECKPOSITION))); +} + +//=========================================================================== +// +// CanRaise +// +//=========================================================================== +DEFINE_ACTION_FUNCTION(AActor, CanRaise) +{ + PARAM_SELF_PROLOGUE(AActor); + ACTION_RETURN_BOOL(P_Thing_CanRaise(self)); +} + //=========================================================================== // // A_MonsterRefire diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 9298495ebe..67aa64eefd 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2971,6 +2971,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_ExtChase) return 0; } +DEFINE_ACTION_FUNCTION(AActor, A_CheckForResurrection) +{ + PARAM_SELF_PROLOGUE(AActor); + ACTION_RETURN_BOOL(P_CheckForResurrection(self, false)); +} + // for internal use void A_Chase(AActor *self) { diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index e0ebaea925..bd8da579f6 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -7785,6 +7785,13 @@ void AActor::Revive() E_WorldThingRevived(this); } +DEFINE_ACTION_FUNCTION(AActor, Revive) +{ + PARAM_SELF_PROLOGUE(AActor); + self->Revive(); + return 0; +} + int AActor::GetGibHealth() const { IFVIRTUAL(AActor, GetGibHealth) diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 174722d00d..2ce2e76630 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -1018,6 +1018,7 @@ class Actor : Thinker native native void A_Chase(statelabel melee = null, statelabel missile = null, int flags = 0); native void A_Scream(); native void A_VileChase(); + native bool A_CheckForResurrection(); native void A_BossDeath(); native void A_Detonate(); bool A_CallSpecial(int special, int arg1=0, int arg2=0, int arg3=0, int arg4=0, int arg5=0) @@ -1075,6 +1076,9 @@ class Actor : Thinker native native void A_RaiseMaster(int flags = 0); native void A_RaiseChildren(int flags = 0); native void A_RaiseSiblings(int flags = 0); + native bool A_RaiseSelf(int flags = 0); + native bool CanRaise(); + native void Revive(); action native bool, Actor A_ThrowGrenade(class itemtype, double zheight = 0, double xyvel = 0, double zvel = 0, bool useammo = true); native void A_Weave(int xspeed, int yspeed, double xdist, double ydist); native bool A_Morph(class type, int duration = 0, int flags = 0, class enter_flash = null, class exit_flash = null);