From 7f57f68ce1c26fd06beee7b0d5816db1f0ecd7fa Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 25 Feb 2016 10:08:08 -0600 Subject: [PATCH] Added GetSpawnHealth() and GetGibHealth() for DECORATE --- src/thingdef/thingdef_codeptr.cpp | 34 +++++++++++++++++++++++++++++++ wadsrc/static/actors/actor.txt | 2 ++ 2 files changed, 36 insertions(+) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index e03d674c7..957f3e361 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -323,6 +323,40 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetDistance) return 0; } +//========================================================================== +// +// GetSpawnHealth +// +//========================================================================== +DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetSpawnHealth) +{ + if (numret > 0) + { + PARAM_PROLOGUE; + PARAM_OBJECT(self, AActor); + ret->SetInt(self->SpawnHealth()); + return 1; + } + return 0; +} + +//========================================================================== +// +// GetGibHealth +// +//========================================================================== +DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetGibHealth) +{ + if (numret > 0) + { + PARAM_PROLOGUE; + PARAM_OBJECT(self, AActor); + ret->SetInt(self->GetGibHealth()); + return 1; + } + return 0; +} + //=========================================================================== // // __decorate_internal_state__ diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 642269f28..34fbd5cef 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -42,6 +42,8 @@ ACTOR Actor native //: Thinker native bool IsPointerEqual(int ptr_select1, int ptr_select2); native int CountInv(class itemtype, int ptr_select = AAPTR_DEFAULT); native float GetDistance(bool checkz, int ptr = AAPTR_DEFAULT); + native int GetSpawnHealth(); + native int GetGibHealth(); // Action functions // Meh, MBF redundant functions. Only for DeHackEd support.